Explorar el Código

作业报错后台列表以及导出
crm问题优化

shenhao hace 4 años
padre
commit
102b17ef04

+ 1 - 1
src/main/java/com/ssj/dao/sys/fx/dao/impl/FxQueryDaoImpl.java

@@ -690,7 +690,7 @@ public class FxQueryDaoImpl implements FxQueryDao {
     public Page<Map<String, Object>> findMerchantSignByPage(Map<String, Object> params, Pageable initPage) {
         StringBuilder selSql = new StringBuilder();
         List<Object> queryParams = new ArrayList<Object>();
-        selSql.append("SELECT t.*,m.pos_code,m.unit_name FROM `fx_merchant_sign` t LEFT JOIN fx_merchant m ON t.merchant_id=m.id  where 1=1 ");
+        selSql.append("SELECT t.*,m.pos_code,m.unit_name FROM `fx_merchant_sign` t LEFT JOIN fx_merchant m ON t.merchant_id=m.id  where  m.type=5 ");
         if(params.containsKey("merchantId") && StringUtils.isNotEmpty(params.get("merchantId").toString())){
             selSql.append(" AND t.merchant_id=? ");
             queryParams.add(params.get("merchantId"));

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

@@ -1,5 +1,6 @@
 package com.ssj.dao.sys.jxy.dao;
 
+import com.ssj.sys.model.ErrorModel;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 
@@ -9,8 +10,7 @@ public interface JxyQueryDao {
 	public Page<Map<String, Object>> findTeacherIdForPage(Map<String, Object> searchParams, Pageable pageable);
 	
 	public Page<Map<String, Object>> getJxylib(Map<String, Object> searchParams, Pageable pageable);
-	
-	
 
 
+    Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage);
 }

+ 33 - 2
src/main/java/com/ssj/dao/sys/jxy/dao/impl/JxyQueryDaoImpl.java

@@ -2,6 +2,7 @@ package com.ssj.dao.sys.jxy.dao.impl;
 
 import com.ssj.dao.sys.jxy.dao.JxyQueryDao;
 import com.ssj.framework.core.persistence.PagingHibernateJdbcDao;
+import com.ssj.sys.model.ErrorModel;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -51,7 +52,37 @@ public class JxyQueryDaoImpl implements JxyQueryDao {
 	        return dao.findPage(selSQL.toString(), queryParams.toArray(), pageable);
 	
 	}
-	
-	
+
+	@Override
+	public Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage) {
+		StringBuilder selSQL = new StringBuilder();
+		List<Object> queryParams = new ArrayList<Object>();
+		selSQL.append("SELECT t12.child_name,t13.league_name,t.create_time,t.error_reason_code,t11.file_key,t11.`subject`\n");
+		selSQL.append("from scon_homework_idetify_error t \n");
+		selSQL.append("left join scon_homework_picture t11 on t.homework_picture_id = t11.id\n");
+		selSQL.append("left join tb_lib_vip t12 on t.vip_id = t12.id\n");
+		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("")){
+			selSQL.append(" and t11.subject = ? ");
+			queryParams.add(params.get("subject"));
+		}
+		if(!params.get("beginDate").toString().equals("")){
+			selSQL.append(" and to_days(t.create_time)>=to_days(?) ");
+			queryParams.add(params.get("beginDate"));
+		}
+		if(!params.get("endDate").toString().equals("")){
+			selSQL.append(" and to_days(t.create_time)<=to_days(?) ");
+			queryParams.add(params.get("endDate"));
+		}
+		if(!params.get("lib_name").toString().equals("")){
+			selSQL.append(" and t13.league_name like concat('%',?,'%') ");
+			queryParams.add(params.get("lib_name"));
+		}
+		selSQL.append(" order by t.create_time desc \n");
+		return dao.findPage(selSQL.toString(),queryParams.toArray(),initPage,ErrorModel.class);
+	}
+
 
 }

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

@@ -2,6 +2,7 @@ package com.ssj.service.sys.jxy.service;
 
 import com.ssj.bean.sys.jxy.domain.Jxy;
 import com.ssj.framework.core.common.service.BaseService;
+import com.ssj.sys.model.ErrorModel;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 
@@ -46,4 +47,11 @@ public interface JxyService extends BaseService<Jxy, String> {
 	public Jxy saveLibLeader(Jxy jxy, String[] images_localId, String[] images_serverId,
                              String[] recording_localId, String[] recording_serverId);
 
+	/**
+	 * 查找报错列表
+	 * @param params
+	 * @param initPage
+	 * @return
+	 */
+    Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage);
 }

+ 6 - 0
src/main/java/com/ssj/service/sys/jxy/service/impl/JxyServiceImpl.java

@@ -12,6 +12,7 @@ import com.ssj.framework.core.util.SystemResourceLocator;
 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 org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
@@ -110,4 +111,9 @@ public class JxyServiceImpl extends BaseServiceImpl<Jxy, String> implements JxyS
 		this.save(jxy);
 		return jxy;
 	}
+
+	@Override
+	public Page<ErrorModel> errorList(Map<String, Object> params, Pageable initPage) {
+		return jxyQueryDao.errorList(params,initPage);
+	}
 }

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

@@ -0,0 +1,116 @@
+package com.ssj.sys.controller;
+
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
+import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
+import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
+import com.ssj.framework.basic.common.bean.SplitPage;
+import com.ssj.framework.core.common.controller.BaseController;
+import com.ssj.framework.core.util.PropertiesUtil;
+import com.ssj.service.sys.jxy.service.JxyService;
+import com.ssj.service.sys.sort.service.SortService;
+import com.ssj.sys.model.ErrorModel;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.ResponseBody;
+
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author sh
+ * @className ErrorController
+ * @description controller
+ * @date 2021/4/8
+ */
+@RequestMapping("sys/error")
+@Controller
+public class ErrorController extends BaseController {
+
+    @Autowired
+    private JxyService jxyService;
+
+    @Autowired
+    private SortService sortService;
+
+    @RequestMapping("/errorList")
+    public String errorList(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("beginDate", request.getParameter("beginDate")==null?"":request.getParameter("beginDate"));
+        params.put("endDate", request.getParameter("endDate")==null?"":request.getParameter("endDate"));
+        params.put("lib_name", request.getParameter("lib_name")==null?"":request.getParameter("lib_name"));
+        params.put("subject", request.getParameter("subject")==null?"":request.getParameter("subject"));
+        SplitPage sp = new SplitPage();
+        sp.setAction(request.getRequestURI());
+        sp.setPageNo(pageNo);
+        sp.setPageSize(pageSize);
+        sp.setParams(params);
+        Page<ErrorModel> page= jxyService.errorList(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);
+        model.addAttribute("zyb_course", sortService.getParamValByCode("zyb_course"));
+        return  "sys/error/errorList";
+    }
+
+    @RequestMapping(value = "/exportErrorList", method = RequestMethod.POST)
+    @ResponseBody
+    public void exportErrorList(HttpServletRequest request, HttpServletResponse response) {
+        Map<String, Object> params = new HashMap<String, Object>();
+        params.put("beginDate", request.getParameter("beginDate")==null?"":request.getParameter("beginDate"));
+        params.put("endDate", request.getParameter("endDate")==null?"":request.getParameter("endDate"));
+        params.put("lib_name", request.getParameter("lib_name")==null?"":request.getParameter("lib_name"));
+        params.put("subject", request.getParameter("subject")==null?"":request.getParameter("subject"));
+        ServletOutputStream os = null;
+        String fileName="报错记录";
+        try {
+            os = response.getOutputStream();
+            response.reset();
+            exportExcelHead(response,fileName);
+            Page<ErrorModel> page= jxyService.errorList(params, initPage(0,100000));
+            List<ErrorModel> list = new ArrayList<>();
+            list.addAll(page.getContent());
+            list.forEach(o->o.setFileKey(PropertiesUtil.getValue("STATIC_FILE_URL").concat(o.getFileKey())));
+            //把我们构造好的bean对象放到params就可以了
+            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(fileName, fileName, ExcelType.XSSF), ErrorModel.class,
+                    list);
+            workbook.write(os);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }finally{
+            if(os != null){
+                try {
+                    os.flush();
+                    os.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    private void exportExcelHead(HttpServletResponse response, String fileName) throws Exception{
+        String lastFileName = new String(fileName.getBytes("gb2312"), "ISO8859-1") +".xlsx";
+        //设定输出文件头
+        response.setHeader("Content-disposition", "attachment; filename="+ lastFileName);
+        response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+        response.setCharacterEncoding("utf-8");
+    }
+}

+ 7 - 0
src/main/java/com/ssj/sys/controller/FxController.java

@@ -21,6 +21,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpSession;
 
+import com.ssj.conch.util.TimeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFCellStyle;
 import org.apache.poi.hssf.util.HSSFColor;
@@ -3570,12 +3571,16 @@ public class FxController  extends BaseController {
 					map.put("give_month",map.get("give_month"));
 					map.put("sign_time","--");
 					map.put("end_sign_time","--");
+					map.put("export_time",map.get("start_active_time"));
+					map.put("end_export_time",map.get("active_time"));
 					break;
 				case "2":
 					map.put("buy_month","--");
 					map.put("give_month","--");
 					map.put("sign_time",map.get("sign_time"));
 					map.put("end_sign_time",map.get("end_sign_time"));
+                    map.put("export_time","--");
+                    map.put("end_export_time","--");
 					break;
 				default:
 					break;
@@ -3607,6 +3612,8 @@ public class FxController  extends BaseController {
     		myColumns3.add(new ExcelColumn("商户类型", "merchant_type", 20));
     		myColumns3.add(new ExcelColumn("服务包类型", "sign_type", 20));
     		myColumns3.add(new ExcelColumn("服务包人数", "lib_service", 20));
+            myColumns3.add(new ExcelColumn("开始激活日期", "export_time", 20));
+            myColumns3.add(new ExcelColumn("结束激活日期", "end_export_time", 20));
     		myColumns3.add(new ExcelColumn("购买月份", "buy_month", 40));
     		myColumns3.add(new ExcelColumn("赠送月份", "give_month", 20));
     		myColumns3.add(new ExcelColumn("试用开始时间", "sign_time", 20));

+ 77 - 0
src/main/java/com/ssj/sys/model/ErrorModel.java

@@ -0,0 +1,77 @@
+package com.ssj.sys.model;
+
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author sh
+ * @className ErrorMOdel
+ * @description
+ * @date 2021/4/8
+ */
+public class ErrorModel implements Serializable {
+
+    @Excel(name="学生姓名",orderNum = "1",width = 15)
+    private String childName;
+    @Excel(name="校区",width = 30)
+    private String leagueName;
+    @Excel(name="报错原因",orderNum = "3",replace={"答案识别失败_0","答案识别错误_1"},width = 20)
+    private String errorReasonCode;
+    @Excel(name="科目",orderNum = "2")
+    private String subject;
+    @Excel(name="报错时间",format ="yyyy-MM-dd HH:mm:ss",width = 20,orderNum = "4")
+    private Date createTime;
+    @Excel(name="报错作业原图",orderNum = "5",width = 50)
+    private String fileKey;
+
+    public String getChildName() {
+        return childName;
+    }
+
+    public void setChildName(String childName) {
+        this.childName = childName;
+    }
+
+    public String getLeagueName() {
+        return leagueName;
+    }
+
+    public void setLeagueName(String leagueName) {
+        this.leagueName = leagueName;
+    }
+
+    public String getSubject() {
+        return subject;
+    }
+
+    public void setSubject(String subject) {
+        this.subject = subject;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getFileKey() {
+        return fileKey;
+    }
+
+    public void setFileKey(String fileKey) {
+        this.fileKey = fileKey;
+    }
+
+    public String getErrorReasonCode() {
+        return errorReasonCode;
+    }
+
+    public void setErrorReasonCode(String errorReasonCode) {
+        this.errorReasonCode = errorReasonCode;
+    }
+}

+ 108 - 0
src/main/resources/templates/sys/error/errorList.html

@@ -0,0 +1,108 @@
+<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{
+		width: 120px;
+	}
+</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/errorList.html}" method="post">
+	<ul class="seachform">
+		<li>
+			<label>开始时间</label>
+			<input type="text" id="beginDate" name="beginDate"  onclick="WdatePicker({readOnly:true,maxDate:'#F{$dp.$D(\'endDate\')}'})" th:value="${search.beginDate }" class="scinput date_width " placeholder="开始时间">
+		</li>
+
+
+		<li>
+			<label>结束时间</label>
+			<input type="text" id="endDate" name="endDate"  onclick="WdatePicker({minDate:'#F{$dp.$D(\'beginDate\')}',maxDate:'%y-%M-%d'})" th:value="${search.endDate }" class="scinput date_width" placeholder="结束时间">
+		</li>
+		<li>
+			<label>校区</label>
+			<input name="lib_name" type="text" class="scinput" th:value="${search.get('lib_name')}"/>
+		</li>
+		<li>
+		<label>科目</label>
+			<select class="scinput select_width" name="subject" id="subject">
+				 <option value=""  th:selected="${ search.get('subject') eq '' }"  >全部</option>
+				 <option  th:each="sort:${zyb_course}"  th:value="${sort.name}"  th:if="${sort.name ne '总体'}" th:selected="${ search.get('subject')  eq sort.name }" th:text="${sort.name}" ></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>报错原因</th>
+		        <th>报错时间</th>
+		        <th>报错作业原图</th>
+		    </tr>
+		</thead>
+		<tbody>
+			<tr th:each="item:${list}" >
+				<td th:text="${itemStat.count}"></td>
+					<td th:text="${item.leagueName}"  th:title="${item.leagueName}" ></td>
+					<td th:text="${item.childName}"  th:title="${item.childName}" ></td>
+					<td th:text="${item.subject}"  th:title="${item.subject}" ></td>
+				    <td th:utext="${item.errorReasonCode eq '0' } ?'答案识别失败':'答案识别错误'" ></td>
+					<td  th:text="${#calendars.format(item.createTime,'yyyy-MM-dd HH:mm:ss')}" ></td>
+					<td  class="imgtd">
+						<img  th:if="${item.fileKey}!=null" th:src="${imgUrl}+''+${item.fileKey}" style="width: 50px;height: 50px;" />
+					</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/exportErrorList";
+	$("#seachform").submit();
+	document.getElementById("seachform").action = "[[${sysUrl}]]/sys/error/errorList.html";
+});
+
+</script>
+</html>