Ver código fonte

报错管理后台
服务过期定时任务

shenhao 4 anos atrás
pai
commit
b59bf7f504

+ 8 - 0
src/main/java/com/ssj/dao/sys/jxy/dao/JxyQueryDao.java

@@ -13,4 +13,12 @@ public interface JxyQueryDao {
 
 
     Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage);
+
+    /**
+     *
+     * @param params
+     * @param initPage
+     * @return
+     */
+    Page<Map<String,Object>> activityList(Map<String, Object> params, Pageable initPage);
 }

+ 20 - 4
src/main/java/com/ssj/dao/sys/jxy/dao/impl/JxyQueryDaoImpl.java

@@ -64,19 +64,19 @@ public class JxyQueryDaoImpl implements JxyQueryDao {
 		selSQL.append("left join tb_lib_join t13 on t.lib_id = t13.id\n");
 		selSQL.append("where t.valid_status = '1' \n");
 
-		if(!params.get("subject").toString().equals("")){
+		if(!"".equals(params.get("subject").toString())){
 			selSQL.append(" and t11.subject = ? ");
 			queryParams.add(params.get("subject"));
 		}
-		if(!params.get("beginDate").toString().equals("")){
+		if(!"".equals(params.get("beginDate").toString())){
 			selSQL.append(" and to_days(t.create_time)>=to_days(?) ");
 			queryParams.add(params.get("beginDate"));
 		}
-		if(!params.get("endDate").toString().equals("")){
+		if(!"".equals(params.get("endDate").toString())){
 			selSQL.append(" and to_days(t.create_time)<=to_days(?) ");
 			queryParams.add(params.get("endDate"));
 		}
-		if(!params.get("lib_name").toString().equals("")){
+		if(!"".equals(params.get("lib_name").toString())){
 			selSQL.append(" and t13.league_name like concat('%',?,'%') ");
 			queryParams.add(params.get("lib_name"));
 		}
@@ -84,5 +84,21 @@ public class JxyQueryDaoImpl implements JxyQueryDao {
 		return dao.findPage(selSQL.toString(),queryParams.toArray(),initPage,ErrorModel.class);
 	}
 
+	@Override
+	public Page<Map<String,Object>> activityList(Map<String, Object> params, Pageable initPage) {
+		StringBuilder selSQL = new StringBuilder();
+		List<Object> queryParams = new ArrayList<Object>();
+		selSQL.append("SELECT * \n");
+		selSQL.append("from tb_activity_sign t \n");
+		selSQL.append("where 1=1 \n");
+
+		if(!"".equals(params.get("type").toString())){
+			selSQL.append(" and t.type = ? ");
+			queryParams.add(params.get("type"));
+		}
+		selSQL.append(" order by t.create_time desc \n");
+		return dao.findPage(selSQL.toString(),queryParams.toArray(),initPage);
+	}
+
 
 }

+ 6 - 0
src/main/java/com/ssj/dao/weixin/problem/dao/ProblemQueryDao.java

@@ -84,4 +84,10 @@ public interface ProblemQueryDao {
     List<Map<String, Object>> findCnAreaAll(Map<String, Object> params);
 
     Page<MerchantOut> findMerchantByPage(Map<String, Object> params, Pageable initPage);
+
+	/**
+	 * 检查付费用户,服务失效时间
+	 * @return
+	 */
+	List<Map<String, Object>> checkVipValidList();
 }

+ 7 - 0
src/main/java/com/ssj/dao/weixin/problem/dao/ValidVipDao.java

@@ -373,4 +373,11 @@ public interface ValidVipDao extends JpaRepository<ValidVip, String>{
 	@Modifying
 	void saveMonthValidVip();
 
+	@Query(nativeQuery = true,value = "update tb_lib_vip_service set stat=2 where id=?1")
+	@Modifying
+	void updateService(String s_id);
+
+	@Query(nativeQuery = true,value = "update tb_lib_vip set lib_id=null where id=?1")
+	@Modifying
+	void updateVip(String vip_id);
 }

+ 11 - 0
src/main/java/com/ssj/dao/weixin/problem/dao/impl/ProblemQueryDaoImpl.java

@@ -333,6 +333,17 @@ public class ProblemQueryDaoImpl implements ProblemQueryDao{
 	}
 
 	@Override
+	public List<Map<String, Object>> checkVipValidList() {
+		String sql = "SELECT t.id as s_id,t12.id as vip_id from tb_lib_vip_service t\n" +
+				"join tb_lib_order_details t11 on t.order_details_id = t11.id\n" +
+				"join tb_lib_vip t12 on t.vip_id = t12.id and t.lib_id = t12.lib_id\n" +
+				"join fx_merchant t13 on t12.lib_id = t13.lib_id\n" +
+				"where t12.lib_id is not null and t.end_time>NOW() and t.stat=1 ";
+		List<Object> queryParams = new ArrayList<Object>();
+		return dao.findMap(sql,queryParams.toArray());
+	}
+
+	@Override
 	public Page<Map<String, Object>> findValidVip2Page(
 			Map<String, Object> searchParams, Pageable pageable) {
 		StringBuilder selSQL = new StringBuilder();

+ 8 - 0
src/main/java/com/ssj/service/sys/jxy/service/JxyService.java

@@ -54,4 +54,12 @@ public interface JxyService extends BaseService<Jxy, String> {
 	 * @return
 	 */
     Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage);
+
+	/**
+	 * 活动参加列表
+	 * @param params
+	 * @param initPage
+	 * @return
+	 */
+    Page<Map<String,Object>> activityList(Map<String, Object> params, Pageable initPage);
 }

+ 26 - 2
src/main/java/com/ssj/service/sys/jxy/service/impl/JxyServiceImpl.java

@@ -1,5 +1,8 @@
 package com.ssj.service.sys.jxy.service.impl;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
 import com.ssj.bean.sys.jxy.domain.Jxy;
 import com.ssj.bean.weixin.download.domain.DownloadFile;
 import com.ssj.dao.sys.jxy.dao.JxyDao;
@@ -13,6 +16,8 @@ import com.ssj.framework.weixin.util.BarcodeFactory;
 import com.ssj.service.sys.jxy.service.JxyService;
 import com.ssj.service.weixin.download.service.DownloadFileService;
 import com.ssj.sys.model.ErrorModel;
+import com.ssj.sys.model.SignUpBase;
+import com.ssj.sys.model.SignUpVO;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -22,8 +27,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.io.File;
-import java.util.Date;
-import java.util.Map;
+import java.util.*;
 
 @Service
 @Transactional
@@ -116,4 +120,24 @@ public class JxyServiceImpl extends BaseServiceImpl<Jxy, String> implements JxyS
 	public Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage) {
 		return jxyQueryDao.errorList(params,initPage);
 	}
+
+	@Override
+	public Page<Map<String,Object>> activityList(Map<String, Object> params, Pageable initPage) {
+		Page<Map<String,Object>> page = jxyQueryDao.activityList(params,initPage);
+		List<Map<String,Object>> list = page.getContent();
+		if(!list.isEmpty()){
+			list.forEach(m->{
+				String json = (String) m.get("submit_json");
+				List<Map<String,Object>> list2 = new ArrayList<>();
+				JSON.parseArray(json, SignUpVO.class).forEach(o->{
+					Map<String,Object> m2 = new HashMap<>();
+					m2.put("subject",o.getSubject());
+					m2.put("bookList",o.getBookList().toString());
+					list2.add(m2);
+				});
+				m.put("list", list2);
+			});
+		}
+		return page;
+	}
 }

+ 4 - 0
src/main/java/com/ssj/service/weixin/problem/service/ValidVipService.java

@@ -49,4 +49,8 @@ public interface ValidVipService extends BaseService<ValidVip, String>{
 	 */
 	public void saveMonthValidVip();
 
+	/**
+	 *
+	 */
+    void checkVipEndTime();
 }

+ 16 - 0
src/main/java/com/ssj/service/weixin/problem/service/impl/ValidVipServiceImpl.java

@@ -14,6 +14,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 @Service
 @Transactional
@@ -52,6 +53,21 @@ public class ValidVipServiceImpl extends BaseServiceImpl<ValidVip, String> imple
 	}
 
 	@Override
+	public void checkVipEndTime() {
+		/**
+		 * 查询用户支付要过期的数据
+		 */
+		List<Map<String,Object>> list = problemQueryDao.checkVipValidList();
+		if(Objects.nonNull(list)){
+			list.forEach(m->{
+				//清除用户服务(service.stat=2 vip.lib_id =null)
+				validVipDao.updateService(m.get("s_id").toString());
+				validVipDao.updateVip(m.get("vip_id").toString());
+			});
+		}
+	}
+
+	@Override
 	public Page<Map<String, Object>> findValidVip2Page(
 			Map<String, Object> searchParams, Pageable pageable) {
 		 return problemQueryDao.findValidVip2Page(searchParams, pageable);

+ 75 - 0
src/main/java/com/ssj/sys/controller/ErrorController.java

@@ -113,4 +113,79 @@ public class ErrorController extends BaseController {
         response.setContentType("application/vnd.ms-excel;charset=UTF-8");
         response.setCharacterEncoding("utf-8");
     }
+
+    @RequestMapping("/activityList")
+    public String activityList(Model model,
+                            @RequestParam(required = false, defaultValue = "10") int pageSize,
+                            @RequestParam(required = false, defaultValue = "1") int pageNo){
+
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("type", request.getParameter("type")==null?"":request.getParameter("type"));
+        SplitPage sp = new SplitPage();
+        sp.setAction(request.getRequestURI());
+        sp.setPageNo(pageNo);
+        sp.setPageSize(pageSize);
+        sp.setParams(params);
+        Page<Map<String,Object>> page= jxyService.activityList(params, initPage(pageNo,pageSize));
+        sp.setRowCnt((int) page.getTotalElements());
+        model.addAttribute("list", page.getContent());
+        model.addAttribute("listNavigatHtml", sp.getSysPaginHtml());
+        model.addAttribute("page", sp);
+        model.addAttribute("search", params);
+        return  "sys/error/activityList";
+    }
+
+    @RequestMapping(value = "/exportActivityList", method = RequestMethod.POST)
+    @ResponseBody
+    public void exportActivityList(HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("type", request.getParameter("type")==null?"":request.getParameter("type"));
+        ServletOutputStream os = null;
+        String fileName="落地登记";
+        try {
+            os = response.getOutputStream();
+            response.reset();
+            exportExcelHead(response,fileName);
+            Page<Map<String,Object>> page= jxyService.activityList(params, initPage(0,1000));
+            List<Map<String,Object>> list = new ArrayList<>();
+            list.addAll(page.getContent());
+
+            List<ExcelExportEntity> entity = new ArrayList<>();
+            ExcelExportEntity e1 =  new ExcelExportEntity("电话号码","phone_num",20);
+            e1.setNeedMerge(true);
+            entity.add(e1);
+            ExcelExportEntity e2 =  new ExcelExportEntity("申请时间","create_time",20);
+            e2.setNeedMerge(true);
+            e2.setFormat("yyyy-MM-dd HH:mm:ss");
+            entity.add(e2);
+            ExcelExportEntity e3 =  new ExcelExportEntity("来源","type",20);
+            e3.setNeedMerge(true);
+            e3.setReplace(new String[]{"kol_1","电梯框架广告_2","公交车站台广告_3","公众号文章_4","广州线下地推_5","门禁广告_6","朋友圈广告_7","社群广告_8","书店_9","无锡线下地推_10"});
+            entity.add(e3);
+
+            ExcelExportEntity e4 =  new ExcelExportEntity("","list");
+
+            List<ExcelExportEntity> enlist = new ArrayList<>();
+            enlist.add(new ExcelExportEntity("科目","subject"));
+            enlist.add(new ExcelExportEntity("练习册","bookList",50));
+            e4.setList(enlist);
+            entity.add(e4);
+
+            //把我们构造好的bean对象放到params就可以了
+            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(fileName, fileName, ExcelType.XSSF), entity,
+                    list);
+            workbook.write(os);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally{
+            if(os != null){
+                try {
+                    os.flush();
+                    os.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
 }

+ 32 - 0
src/main/java/com/ssj/sys/model/SignUpBase.java

@@ -0,0 +1,32 @@
+package com.ssj.sys.model;
+
+import com.ssj.bean.common.framework.core.domain.BaseRequest;
+
+import java.util.List;
+
+/**
+ * @author sh
+ * @className SignUpBase
+ * @description request
+ * @date 2021/4/7
+ */
+public class SignUpBase extends BaseRequest {
+    private Integer type;
+    private List<SignUpVO> list;
+
+    public Integer getType() {
+        return type;
+    }
+
+    public void setType(Integer type) {
+        this.type = type;
+    }
+
+    public List<SignUpVO> getList() {
+        return list;
+    }
+
+    public void setList(List<SignUpVO> list) {
+        this.list = list;
+    }
+}

+ 35 - 0
src/main/java/com/ssj/sys/model/SignUpVO.java

@@ -0,0 +1,35 @@
+package com.ssj.sys.model;
+
+import com.ssj.bean.common.framework.core.domain.BaseRequest;
+
+import java.util.List;
+
+/**
+ * @author sh
+ * @className SignUpVO
+ * @description request
+ * @date 2021/4/7
+ */
+public class SignUpVO extends BaseRequest {
+
+
+    private String subject;
+
+    private List<String> bookList;
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public List<String> getBookList() {
+        return bookList;
+    }
+
+    public void setBookList(List<String> bookList) {
+        this.bookList = bookList;
+    }
+}

+ 2 - 0
src/main/java/com/ssj/task/ValidVipTask.java

@@ -25,6 +25,8 @@ public class ValidVipTask implements Job {
             validVipService.saveValidVip();
             validVipService.saveMonthValidVip();
 
+            logger.info("2c用户服务检测是否失效任务开始");
+            validVipService.checkVipEndTime();
 
         } catch (Exception e) {
             logger.error("插入各馆有效会员数量任务异常-->"+e.getMessage());

+ 131 - 0
src/main/resources/templates/sys/error/activityList.html

@@ -0,0 +1,131 @@
+<html xmlns:th="http://www.thymeleaf.org">
+<head>
+<title>私塾家</title>
+<script th:include="sys/common/metaCSS" th:remove="tag"></script> 
+<script th:include="sys/common/metaJS" th:remove="tag"></script>
+	<script src="sys/js/My97DatePicker/WdatePicker.js" th:src="@{/static/sys/js/My97DatePicker/WdatePicker.js}"></script>
+</head>
+<style>
+	.tablelink{margin-right:10px;}
+	.stylecss{
+	      color: red;
+	}
+	.select_width{
+	     width: 70px;
+	}
+	.select_width2{
+		border:solid 1px #cbcbcb;
+	}
+	/*设置偶数行颜色*/
+	/*table tr:nth-child(even)*/
+	/*{*/
+	/*	background: #ccc;*/
+	/*}*/
+	/*.c_table tr:nth-child(even){*/
+	/*	backgrond: #f1f1f1;*/
+	/*}*/
+</style>
+<body>
+<div class="place">
+	<span>位置:</span>
+	<ul class="placeul">
+		<li><a href="#">平台管理</a></li>
+		<li><a href="#">落地登记记录</a></li>
+	</ul>
+</div>
+<div class="rightinfo">
+	<form id="seachform" th:action="@{/sys/error/activityList.html}" method="post">
+	<ul class="seachform">
+
+		<li>
+			<label>类型</label>
+			<select name="type" class="scinput select_width">
+				<option value="" th:selected="${ search.get('type')  eq '' }">全部</option>
+				<option value="1" th:selected="${ search.get('type')  eq '1' }">kol</option>
+				<option value="2" th:selected="${ search.get('type')  eq '2' }">电梯框架广告</option>
+				<option value="3" th:selected="${ search.get('type')  eq '3' }">公交车站台广告</option>
+				<option value="4" th:selected="${ search.get('type')  eq '4' }">公众号文章</option>
+				<option value="5" th:selected="${ search.get('type')  eq '5' }">广州线下地推</option>
+				<option value="6" th:selected="${ search.get('type')  eq '6' }">门禁广告</option>
+				<option value="7" th:selected="${ search.get('type')  eq '7' }">朋友圈广告</option>
+				<option value="8" th:selected="${ search.get('type')  eq '8' }">社群广告</option>
+				<option value="9" th:selected="${ search.get('type')  eq '9' }">书店</option>
+				<option value="10" th:selected="${ search.get('type')  eq '10' }">无锡线下地推</option>
+			</select>
+		</li>
+
+		<li>
+			<label>&nbsp;</label>
+			<input type="button" class="scbtn" value="查询" />
+		</li>
+		<li>
+			<input type="button" id="button" style="width: 100px;" class="scbtnbution" value="导出" />
+		</li>
+		</ul>
+	</form>
+	<table class="tablelist">
+		<thead>
+		    <tr>
+		        <th style="width: 80px;">序号</th>
+		        <th>电话号码</th>
+		        <th>申请时间</th>
+				<th>来源</th>
+				<th style="width: 60%;">
+					<table style="width: 100%;">
+						<thead>
+							<th style="width: 20%;">科目</th>
+							<th style="width: 80%;">练习册</th>
+						</thead>
+					</table>
+				</th>
+
+		    </tr>
+		</thead>
+		<tbody>
+			<tr th:each="item:${list}" class="select_width2">
+				<td th:text="${itemStat.count}"></td>
+					<td th:text="${item.get('phone_num')}"  th:title="${item.get('phone_num')}" ></td>
+					<td  th:text="${#calendars.format(item.get('create_time'),'yyyy-MM-dd HH:mm:ss')}" ></td>
+					<td  th:switch="${item.get('type')}" >
+						<span th:case="1">kol</span>
+						<span th:case="2">电梯框架广告</span>
+						<span th:case="3">公交车站台广告</span>
+						<span th:case="4">公众号文章</span>
+						<span th:case="5">广州线下地推</span>
+						<span th:case="6">门禁广告</span>
+						<span th:case="7">朋友圈广告</span>
+						<span th:case="8">社群广告</span>
+						<span th:case="9">书店</span>
+						<span th:case="10">无锡线下地推</span>
+					</td>
+				    <td style="width: 60%;" class="c_table">
+						<table style="width: 100%;">
+							<tr th:each="e:${item.get('list')}">
+								<td  th:text="${e.get('subject')}" style="width: 20%;"></td>
+								<td  th:text="${e.get('bookList')}" style="width: 80%;"></td>
+							</tr>
+						</table>
+					</td>
+			</tr>
+		</tbody>
+	</table>
+	<!-- 分页 -->
+	<div class="pagin">
+    	<div class="message">共<i class="blue">[[${page.rowCnt}]]</i>条记录,当前显示第&nbsp;<i class="blue">[[${page.pageNo }]]&nbsp;</i>页</div>
+    	<div th:utext='${listNavigatHtml}' th:remove="tag" ></div>
+   	</div>
+</div>
+</body>
+<script type="text/javascript">
+
+
+
+$("#button").on('click',function(){
+	
+	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/error/exportActivityList";
+	$("#seachform").submit();
+	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/error/activityList.html";
+});
+
+</script>
+</html>

+ 3 - 0
src/main/resources/templates/sys/problem/cnArealist.html

@@ -81,6 +81,7 @@
 		        <th>类型</th>
 		        <th>首字母拼音</th>
 		        <th>是否热门城市</th>
+				<th>地区</th>
 		        <th>详细地址</th>
 		        <th>学校经度</th>
 		        <th>学校纬度</th>
@@ -102,7 +103,9 @@
 				    <span th:case="0">不是</span>
 				    <span th:case="1">是</span>
 				</td>
+				<td th:text="${cnArealist.get('area')}"></td>
 				<td th:text="${cnArealist.get('school_address')}"></td>
+
 				<td th:text="${cnArealist.get('school_lng')}"></td>
 				<td th:text="${cnArealist.get('school_lat')}"></td>
 				<td>