Explorar o código

Merge branch 'master' of http://47.112.200.206:3000/shenhao/sys

wuwen %!s(int64=3) %!d(string=hai) anos
pai
achega
af868d8b4d
Modificáronse 22 ficheiros con 382 adicións e 66 borrados
  1. 11 2
      src/main/java/com/ssj/api/controller/ApiHomeworkController.java
  2. 33 0
      src/main/java/com/ssj/api/controller/ApiManagerTeacherController.java
  3. 18 0
      src/main/java/com/ssj/api/domain/vo/statistics/ListVO.java
  4. 9 0
      src/main/java/com/ssj/api/domain/vo/statistics/TeacherSalarysVO.java
  5. 9 0
      src/main/java/com/ssj/bean/statistics/PlatTeacherStatistics.java
  6. 14 0
      src/main/java/com/ssj/bean/sys/imlibuser/TbClassTeacherTemp.java
  7. 2 0
      src/main/java/com/ssj/dao/sys/homework/dao/HomeworkPictureQueryDao.java
  8. 15 0
      src/main/java/com/ssj/dao/sys/homework/dao/impl/HomeworkPictureQueryDaoImpl.java
  9. 17 17
      src/main/java/com/ssj/dao/sys/homework/dao/impl/HomeworkQueryDaoImpl.java
  10. 4 5
      src/main/java/com/ssj/dao/weixin/library/dao/impl/LibJoinQueryDaoImpl.java
  11. 153 9
      src/main/java/com/ssj/service/kmt/correctsys/KmtCorrectSysServiceImpl.java
  12. 8 2
      src/main/java/com/ssj/service/kmt/correctsys/service/KmtCorrectSysService.java
  13. 2 0
      src/main/java/com/ssj/service/sys/homework/service/HomeworkPictureService.java
  14. 5 0
      src/main/java/com/ssj/service/sys/homework/service/impl/HomeworkPictureServiceImpl.java
  15. 7 2
      src/main/java/com/ssj/service/sys/imlibuser/service/impl/TbClassTeacherTempServiceImpl.java
  16. 5 0
      src/main/java/com/ssj/statistics/dao/IStatisticsDao.java
  17. 31 23
      src/main/java/com/ssj/statistics/dao/impl/StatisticsQueryImpl.java
  18. 10 0
      src/main/java/com/ssj/statistics/entity/TeacherPay.java
  19. 25 3
      src/main/java/com/ssj/statistics/service/impl/StatisticsServiceImpl.java
  20. 2 2
      src/main/java/com/ssj/sys/controller/ImLibUserController.java
  21. 2 1
      src/main/resources/application-common-dev.properties
  22. BIN=BIN
      src/main/resources/static/sys/excel/teacher_all.xlsx

+ 11 - 2
src/main/java/com/ssj/api/controller/ApiHomeworkController.java

@@ -128,6 +128,15 @@ public class ApiHomeworkController extends BaseController {
         ResponseEntity responseEntity = new ResponseEntity();
         Map<String,Object> data=new HashMap<>(2);
         try {
+
+
+            if(Objects.isNull(req.getHomeworkId())){
+                return  responseEntity.failure("请检查作业id传参");
+            }
+            Homework homework = homeworkService.getById(req.getHomeworkId());
+            if(Objects.isNull(homework)){
+                return  responseEntity.failure("请检查作业id传参");
+            }
             //查询作业是否在批改
             int correctNum = homeworkPictureService.findHomeworkIsCorrect(req.getHomeworkId());
             if(correctNum>0){
@@ -135,9 +144,9 @@ public class ApiHomeworkController extends BaseController {
             }
             //分配老师
             homeworkPictureService.allotPlatHomework(req.getHomeworkId(),req.getTeacherId());
-            responseEntity.success(data,"获取分配老师列表成功!");
+            responseEntity.success(data,"分配老师成功!");
         } catch (Exception e) {
-            logger.error("获取分配老师列表异常", e);
+            logger.error("分配老师异常", e);
             responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
         }
         return responseEntity;

+ 33 - 0
src/main/java/com/ssj/api/controller/ApiManagerTeacherController.java

@@ -20,6 +20,8 @@ import com.ssj.framework.core.util.PasswordUtil;
 import com.ssj.framework.core.util.ResponseConstant;
 import com.ssj.framework.core.util.ResponseEntity;
 import com.ssj.framework.weixin.util.DateUtil;
+import com.ssj.service.kmt.correctsys.dto.HomeworkPictureCheckDto;
+import com.ssj.service.kmt.correctsys.service.KmtCorrectSysService;
 import com.ssj.service.sys.homework.service.HomeworkPictureService;
 import com.ssj.service.sys.imlibuser.service.TbClassTeacherTempService;
 import com.ssj.service.weixin.library.service.IBookManagerService;
@@ -61,6 +63,9 @@ public class ApiManagerTeacherController extends BaseController {
     @Autowired
     private ITeacherPayService teacherPayService;
 
+    @Autowired
+    private KmtCorrectSysService kmtCorrectSysService;
+
 
 	@RequestMapping(value = "/list", method = RequestMethod.POST)
     @ApiOperation(value = "获取平台批改老师列表接口",  notes = "获取平台批改老师列表接口")
@@ -246,6 +251,19 @@ public class ApiManagerTeacherController extends BaseController {
         }
         return responseEntity;
     }
+    @RequestMapping(value = "/initTeacherPayData", method = RequestMethod.POST)
+    @ApiOperation(value = "手动生成老师薪酬列表",  notes = "手动生成老师薪酬列表")
+    public ResponseEntity initTeacherPayData(@RequestParam(name = "accessToken") String accessToken,String date) {
+        ResponseEntity responseEntity = new ResponseEntity();
+        try {
+            statisticsService.addTeacherSalarysData(date);
+            responseEntity.success("生成数据统计列表成功");
+        } catch (Exception e) {
+            logger.error("数据统计列表异常", e);
+            responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
+        }
+        return responseEntity;
+    }
     @RequestMapping(value = "/errorList", method = RequestMethod.POST)
     @ApiOperation(value = "查看报错列表",  notes = "数据统计列表")
     public ResponseEntity errorList(@RequestParam(name = "accessToken") String accessToken,@RequestBody ListReq req) {
@@ -279,6 +297,21 @@ public class ApiManagerTeacherController extends BaseController {
         }
         return responseEntity;
     }
+    @RequestMapping(value = "/checkHomeworkDetailList", method = RequestMethod.POST)
+    @ApiOperation(value = "查询报错图片列表数据",  notes = "查询报错图片列表数据")
+    public ResponseEntity checkHomeworkDetailList(@RequestParam(name = "accessToken") String accessToken,@RequestBody HomeworkReq req) {
+        ResponseEntity responseEntity = new ResponseEntity();
+        try {
+            List<HomeworkPictureCheckDto> homeworkPictures = kmtCorrectSysService.checkHomeworkDetailList(req.getHomeworkId(),accessToken);
+            Map<String, Object> data = new HashMap<>();
+            data.put("homeworkPictures", homeworkPictures);
+            responseEntity.success(data, "请求成功");
+        } catch (Exception e) {
+            logger.error("数据统计列表异常", e);
+            responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
+        }
+        return responseEntity;
+    }
     @RequestMapping(value = "/pictureDetail", method = RequestMethod.POST)
     @ApiOperation(value = "作业批改痕迹",  notes = "作业批改痕迹")
     public ResponseEntity pictureDetail(@RequestParam(name = "accessToken") String accessToken,@RequestBody HomeworkReq req) {

+ 18 - 0
src/main/java/com/ssj/api/domain/vo/statistics/ListVO.java

@@ -41,6 +41,8 @@ public class ListVO extends BaseRequest {
      private Integer  notCommentNums;
      private Integer  repeatNums;
      private Integer  errorNums ;
+     private Integer  totalNums ;
+     private String   calculateDate ;
 
     public String getTeacherId() {
         return teacherId;
@@ -129,4 +131,20 @@ public class ListVO extends BaseRequest {
     public void setErrorNums(Integer errorNums) {
         this.errorNums = errorNums;
     }
+
+    public String getCalculateDate() {
+        return calculateDate;
+    }
+
+    public void setCalculateDate(String calculateDate) {
+        this.calculateDate = calculateDate;
+    }
+
+    public Integer getTotalNums() {
+        return totalNums;
+    }
+
+    public void setTotalNums(Integer totalNums) {
+        this.totalNums = totalNums;
+    }
 }

+ 9 - 0
src/main/java/com/ssj/api/domain/vo/statistics/TeacherSalarysVO.java

@@ -29,6 +29,7 @@ public class TeacherSalarysVO {
     private String  otherSalary;
     private String  perkSalary;
     private String  salary;
+    private String teacherId;
 
     public String getWorkDate() {
         return workDate;
@@ -109,4 +110,12 @@ public class TeacherSalarysVO {
     public void setSalary(String salary) {
         this.salary = salary;
     }
+
+    public String getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(String teacherId) {
+        this.teacherId = teacherId;
+    }
 }

+ 9 - 0
src/main/java/com/ssj/bean/statistics/PlatTeacherStatistics.java

@@ -23,6 +23,7 @@ public class PlatTeacherStatistics extends BaseEntity {
     private Integer  notCommentNums;
     private Integer  repeatNums;
     private Integer  errorNums ;
+    private Integer  totalNums ;
     private String  calculateDate;
     private Date createTime;
 
@@ -105,4 +106,12 @@ public class PlatTeacherStatistics extends BaseEntity {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public Integer getTotalNums() {
+        return totalNums;
+    }
+
+    public void setTotalNums(Integer totalNums) {
+        this.totalNums = totalNums;
+    }
 }

+ 14 - 0
src/main/java/com/ssj/bean/sys/imlibuser/TbClassTeacherTemp.java

@@ -1,9 +1,11 @@
 package com.ssj.bean.sys.imlibuser;
 
 import com.ssj.bean.common.framework.core.domain.BaseEntity;
+import jdk.nashorn.internal.ir.annotations.Ignore;
 
 import javax.persistence.Entity;
 import javax.persistence.Table;
+import javax.persistence.Transient;
 import java.util.Date;
 
 
@@ -44,6 +46,8 @@ public class TbClassTeacherTemp  extends BaseEntity {
 
     private String inspectorId;
 
+    private Integer type;
+
 	public String getLibId() {
 		return libId;
 	}
@@ -156,6 +160,7 @@ public class TbClassTeacherTemp  extends BaseEntity {
 		this.className = className;
 	}
 
+	@Transient
 	public String getInspectorId() {
 		return inspectorId;
 	}
@@ -163,4 +168,13 @@ public class TbClassTeacherTemp  extends BaseEntity {
 	public void setInspectorId(String inspectorId) {
 		this.inspectorId = inspectorId;
 	}
+
+	@Transient
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
 }

+ 2 - 0
src/main/java/com/ssj/dao/sys/homework/dao/HomeworkPictureQueryDao.java

@@ -89,4 +89,6 @@ public interface HomeworkPictureQueryDao {
 	 * @return
 	 */
 	List<HomeworkPictureDto> findKnowCheckPictureByHomeworkId(String homeworkId);
+
+    List<HomeworkPictureDto> findCheckPictureByHomeworkId2(int type, String homeworkId);
 }

+ 15 - 0
src/main/java/com/ssj/dao/sys/homework/dao/impl/HomeworkPictureQueryDaoImpl.java

@@ -191,4 +191,19 @@ public class HomeworkPictureQueryDaoImpl  implements  HomeworkPictureQueryDao {
 		return dao.findList(sb.toString(), param.toArray(), HomeworkPictureDto.class);
 	}
 
+	@Override
+	public List<HomeworkPictureDto> findCheckPictureByHomeworkId2(int type, String homeworkId) {
+		StringBuffer sb = new StringBuffer();
+		List<Object> param = new ArrayList<Object>();
+		sb.append("SELECT distinct hp.id, hp.subject, hp.file_key, hp.is_feedback, hp.is_delete, hp.is_mark, hp.vip_id,")
+				.append(" hp.is_composition, hp.composition_comment, ")
+				.append(" hp.teacher_id, hp.allot_time,  hp.create_time, hp.corrected_picture_url, hpc.check_date, hpc.checker, hpc.is_check_error," )
+				.append(" hpc.error_reason, hp.is_checker_correct is_correct")
+				.append(" FROM scon_homework_picture hp left join scon_homework_picture_correct hpc on hp.id=hpc.homework_picture_id ")
+				.append(" where hp.homework_id=? and hpc.type = ? and hpc.is_checker_correct = 1 order by hp.create_time");
+		param.add(homeworkId);
+		param.add(type);
+		return dao.findList(sb.toString(), param.toArray(), HomeworkPictureDto.class);
+	}
+
 }

+ 17 - 17
src/main/java/com/ssj/dao/sys/homework/dao/impl/HomeworkQueryDaoImpl.java

@@ -289,19 +289,19 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
         sql.append("(select count(1) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_feedback = 0) as wait_nums  \n ");
         sql.append("from tb_lib_manager t  \n ");
         sql.append("where t.type=30 and t.state = 1 \n ");
-        if(Objects.nonNull(params.get("subject")) && StringUtil.isEmpty(params.get("subject").toString())){
+        if(Objects.nonNull(params.get("subject")) && StringUtil.isNotEmpty(params.get("subject").toString())){
             sql.append(" and t.course_name like concat('%',?,'%')");
             paramList.add(params.get("subject"));
         }
-        if(Objects.nonNull(params.get("teacherId")) && StringUtil.isEmpty(params.get("teacherId").toString())){
+        if(Objects.nonNull(params.get("teacherId")) && StringUtil.isNotEmpty(params.get("teacherId").toString())){
             sql.append(" and t.user_id <> ?");
             paramList.add(params.get("teacherId"));
         }
-        if(Objects.nonNull(params.get("teacherName")) && StringUtil.isEmpty(params.get("teacherName").toString())){
+        if(Objects.nonNull(params.get("teacherName")) && StringUtil.isNotEmpty(params.get("teacherName").toString())){
             sql.append(" and t.name like concat('%',?,'%')");
             paramList.add(params.get("teacherName"));
         }
-        sql.append("order by t.is_online desc  \n ");
+        sql.append("order by t.is_online desc,t.id  \n ");
         return dao.findPage(sql.toString(), paramList.toArray(),initPage,TeacherListVO.class);
     }
 
@@ -311,26 +311,26 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
         List<Object> queryParams = new ArrayList<Object>();
         selSQL.append("SELECT b.homework_id,b.student_name ,b.`subject`,b.grade,b.correctNums as correct_nums,b.totalNums as total_nums,\n");
         selSQL.append("case when state in (6,7) then concat(DATE_FORMAT(SEC_TO_TIME(b.next_1),'%i分%s秒'),'/张') \n");
-        selSQL.append("when state in (2,5) then concat(DATE_FORMAT(SEC_TO_TIME(b.start_time),'%i:%s'),'开始批注')\n");
-        selSQL.append("when state = 4 then concat('等待',DATE_FORMAT(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,b.allot_time,NOW())),'%i:%s'))\n");
+        selSQL.append("when state =4 then concat(DATE_FORMAT(b.start_time,'%i:%s'),'开始批注')\n");
+        selSQL.append("when state = 2 then concat('等待',SEC_TO_TIME(TIMESTAMPDIFF(SECOND,b.allot_time,NOW())))\n");
         selSQL.append("else '作业已超时' end state_msg,b.state \n");
         selSQL.append("from (\n");
         selSQL.append("SELECT a.homework_id,a.student_name,a.`subject`,a.grade,a.correctNums,a.totalNums, \n");
         selSQL.append("case when a.is_feedback = 1  and \n");
-        selSQL.append("((DATE_FORMAT(a.create_time,'%i:%s')>='20:30' and DATE_FORMAT(a.end_time,'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00')) or (DATE_FORMAT(a.create_time,'%i:%s')<'20:30' and DATE_FORMAT(a.end_time,'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),' 23:59:59')))\n");
-        selSQL.append(" then 3\n");
+        selSQL.append("((DATE_FORMAT(a.create_time,'%H:%i')>='20:30' and DATE_FORMAT(a.end_time,'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00')) or (DATE_FORMAT(a.create_time,'%H:%i')<'20:30' and DATE_FORMAT(a.end_time,'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),' 23:59:59')))\n");
+        selSQL.append(" then 5\n");
         selSQL.append("when a.is_feedback = 1 and a.next_1 > 120 then 6 \n");
         selSQL.append("when a.is_feedback = 1 then 7\n");
         selSQL.append("when a.is_feedback = 0 and a.start_time is not null and \n");
-        selSQL.append("((DATE_FORMAT(a.create_time,'%i:%s')>='20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
-        selSQL.append(" or (DATE_FORMAT(a.create_time,'%i:%s')<'20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),'23:59:59')))\n");
-        selSQL.append("then   2\n");
+        selSQL.append("((DATE_FORMAT(a.create_time,'%H:%i')>='20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
+        selSQL.append(" or (DATE_FORMAT(a.create_time,'%H:%i')<'20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),'23:59:59')))\n");
+        selSQL.append("then   3\n");
         selSQL.append("when a.is_feedback = 0 and a.start_time is  null and \n");
-        selSQL.append("((DATE_FORMAT(a.create_time,'%i:%s')>='20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
-        selSQL.append(" or (DATE_FORMAT(a.create_time,'%i:%s')<'20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),' 23:59:59')))\n");
+        selSQL.append("((DATE_FORMAT(a.create_time,'%H:%i')>='20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(DATE_ADD(a.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
+        selSQL.append(" or (DATE_FORMAT(a.create_time,'%H:%i')<'20:30' and DATE_FORMAT(now(),'%Y-%m-%d %H%i:%s')>concat(DATE_FORMAT(a.create_time,'%Y-%m-%d'),' 23:59:59')))\n");
         selSQL.append("then   1\n");
-        selSQL.append("when a.is_feedback = 0 and a.start_time is not null then 5\n");
-        selSQL.append("else 4 end as state,\n");
+        selSQL.append("when a.is_feedback = 0 and a.start_time is not null then 4\n");
+        selSQL.append("else 2 end as state,\n");
         selSQL.append("a.start_time,\n");
         selSQL.append("a.allot_time,\n");
         selSQL.append("a.next_1\n");
@@ -343,11 +343,11 @@ public class HomeworkQueryDaoImpl implements HomeworkQueryDao {
         selSQL.append("max(t11.end_time) as end_time,\n");
         selSQL.append("min(t.create_time) as create_time,\n");
         selSQL.append("sum(t11.correction_time) as correction_time,\n");
-        selSQL.append("floor(sum(t11.correction_time)/ count(1)) as next_1,\n");
+        selSQL.append("floor(sum(t11.correction_time)/ count(if(t.is_feedback = 1,true,null))) as next_1,\n");
         selSQL.append("min(t.is_feedback) as is_feedback\n");
         selSQL.append("from scon_homework_picture t\n");
         selSQL.append("left join scon_homework t14 on t.homework_id = t14.id\n");
-        selSQL.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id\n");
+        selSQL.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id and t11.type=8\n");
         selSQL.append("left join tb_lib_vip t12 on t.vip_id = t12.id\n");
         selSQL.append(" where t.teacher_id=? and ((t11.end_time > ? and t.is_feedback=1) or t.is_feedback=0)\n");
         selSQL.append("and t.is_mark in (0,2)\n");

+ 4 - 5
src/main/java/com/ssj/dao/weixin/library/dao/impl/LibJoinQueryDaoImpl.java

@@ -1308,15 +1308,14 @@ public class LibJoinQueryDaoImpl implements ILibJoinQueryDao{
 		StringBuilder selSQL = new StringBuilder();
 		List<Object> queryParams = new ArrayList<Object>();
 		selSQL.append("SELECT a.wait_nums,a.state,a.teacher_id,a.teacher_name,a.wait_max_time,a.today_correct_time,a.efficiency,(ifnull(a.wait_nums,0)+ifnull(a.wait_nums2,0)) as homework_count from ( SELECT  \n");
-		selSQL.append("(SELECT count(DISTINCT a.homework_id) from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0 and  \n" +
-				"homework_id not in (select homework_id  from scon_homework_picture_correct x where x.homework_picture_id = a.id and x.start_time is not null and x.type=8) ) as wait_nums, \n");
+		selSQL.append("(SELECT count(DISTINCT a.homework_id) from scon_homework_picture a left join scon_homework_picture_correct x on x.homework_picture_id = a.id and x.type = 8 where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0 and  \n" +
+				"        x.start_time is null and a.homework_id not in (SELECT b.homework_id from scon_homework_picture_correct b where b.homework_id = b.homework_id and type=8 and b.start_time is not null)) as wait_nums, \n");
 		selSQL.append("(SELECT count(DISTINCT a.homework_id) from scon_homework_picture a join scon_homework_picture_correct b on b.homework_picture_id = a.id where a.teacher_id = t.user_id and a.is_mark in (0,2) and b.type=8  \n" +
 				"and ((b.end_time > ? and a.is_feedback=1) or a.is_feedback=0) ) as wait_nums2, \n");
 		queryParams.add(params.get("beginTime"));
-		selSQL.append("(SELECT ifnull(concat(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,min(a.allot_time),NOW())),''),0)   from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0) as wait_max_time, \n");
+		selSQL.append("(SELECT ifnull(concat(SEC_TO_TIME(TIMESTAMPDIFF(SECOND,min(a.allot_time),NOW())),''),'00:00:00')   from scon_homework_picture a where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback = 0 and  not exists (select 1 from scon_homework_picture_correct x where x.type=8 and x.start_time is not null and a.homework_id = x.homework_id ) ) as wait_max_time, \n");
 		selSQL.append("t.user_id as teacher_id,t.name as teacher_name, \n");
-		selSQL.append("(select ifnull(concat(SEC_TO_TIME(sum(a.correction_time)),''),0) from scon_homework_picture a join scon_homework_picture_correct b on a.id = b.homework_picture_id where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback=1 and b.end_time >?) as today_correct_time, \n");
-		queryParams.add(params.get("beginTime"));
+		selSQL.append("(select ifnull(concat(SEC_TO_TIME(sum(b.correction_time)),''),'00:00:00') from scon_homework_picture a join scon_homework_picture_correct b on a.id = b.homework_picture_id where a.teacher_id = t.user_id and a.is_mark in (0,2) and a.is_feedback=1 and to_days(b.end_time) =to_days(now())) as today_correct_time, \n");
 		selSQL.append("(select ifnull(concat(SEC_TO_TIME(floor(sum(TIMESTAMPDIFF(SECOND,a.allot_time,b.start_time))/count(1))),''),0) from scon_homework_picture a join scon_homework_picture_correct b on a.id = b.homework_picture_id and b.type=8 where a.teacher_id = t.user_id and a.is_mark in (0,2) and b.start_time is not null and ((a.is_feedback=1 and b.end_time > ?) or a.is_feedback=0)) as efficiency, \n");
 		queryParams.add(params.get("beginTime"));
 		selSQL.append("t.is_online as state  \n");

+ 153 - 9
src/main/java/com/ssj/service/kmt/correctsys/KmtCorrectSysServiceImpl.java

@@ -1,11 +1,5 @@
 package com.ssj.service.kmt.correctsys;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import org.apache.commons.collections.CollectionUtils;
@@ -756,7 +750,7 @@ public class KmtCorrectSysServiceImpl implements KmtCorrectSysService {
 	                        	 Calendar ca = Calendar.getInstance();
 	                             ca.setTime(DateHelper.parseDate(homework.getCorrectDate()+" 12:00:00", "yyyy-MM-dd HH:mm:ss"));
 	            		         ca.add(Calendar.DATE, 4);// num为增加的天数,可以改变的
-	            		         if(new Date().getTime()>=ca.getTime().getTime()) {
+	            		         if(System.currentTimeMillis()>=ca.getTime().getTime()) {
 	            		        	 homeworkCheckStudentDto.setType(1);
 	            		         }else {
 	            		        	 homeworkCheckStudentDto.setType(0);
@@ -774,7 +768,157 @@ public class KmtCorrectSysServiceImpl implements KmtCorrectSysService {
         }
         return resultPage;
     }
-    
+
+    @Override
+    public List<HomeworkPictureCheckDto> checkHomeworkDetailList(String homeworkId, String accessToken) {
+        List<HomeworkPictureDto> homeworkPictures =
+                homeworkPictureService.findCheckHomeworkPictureByHomeworkId2(homeworkId);
+        String teacherId = Objects.nonNull(homeworkPictures) && homeworkPictures.size()>0 ?homeworkPictures.get(0).getTeacherId():"";
+        List<HomeworkPictureCheckDto> result = new ArrayList<>();
+        List<HomeworkExerciseQuestionsDto> exerciseQuestionDtos =
+                correctSysQueryDao.findHomeworkCorrectedQuestions(homeworkId);
+        Map<String, List<HomeworkExerciseQuestionsDto>> exerciseQuestionDtoMap =
+                exerciseQuestionDtos.stream().collect(Collectors.groupingBy(HomeworkExerciseQuestionsDto::getHomeworkPictureId));
+
+        if (CollectionUtils.isNotEmpty(homeworkPictures)) {
+            for (HomeworkPictureDto homeworkPictureDto : homeworkPictures) {
+                //属性copy
+                HomeworkPicture homeworkPicture = this.copyHomeworkPictureDto2HomeworkPicture(homeworkPictureDto);
+                HomeworkPictureCheckDto homeworkPictureCheckDto = null;
+
+                //模糊和不全的,需要查询模糊表
+                List<HomeworkPictureVagueRecord> vagueRecords =
+                        homeworkPictureVagueRecordService.findByHomeworkPictureId(homeworkPicture.getId());
+                Map<Integer, List<HomeworkPictureVagueRecord>> vagueRecordMap = null;
+
+                //把模糊不全表的数据加入返回列表
+                if (homeworkPicture.getIsMark() > 0 && homeworkPicture.getIsMark() < 4) {
+                    if (CollectionUtils.isNotEmpty(vagueRecords)) {
+                        vagueRecordMap =
+                                vagueRecords.stream().collect(Collectors.groupingBy(HomeworkPictureVagueRecord::getType,
+                                        LinkedHashMap::new, Collectors.toList()));
+                        if (homeworkPicture.getIsMark() != 2 && vagueRecords.size() > 1) {
+                            //模糊, 图片不是当前的图片的
+                            if (vagueRecordMap.containsKey(1)) {
+                                for (HomeworkPictureVagueRecord homeworkPictureVagueRecord : vagueRecordMap.get(1)) {
+                                    if (!homeworkPictureVagueRecord.getPictureVaguePath().equals(homeworkPicture.getFileKey())) {
+                                        this.addVagueNoCheckResult(result, homeworkPictureVagueRecord.getId(),
+                                                homeworkPictureVagueRecord.getPictureVaguePath(),
+                                                this.isOtherTeachersWork(teacherId, homeworkPicture, 1) ? 4 : 1);
+                                    }
+                                }
+                            }
+                            //作业不全, 图片不是当前图片
+                            if (vagueRecordMap.containsKey(3)) {
+                                for (HomeworkPictureVagueRecord homeworkPictureVagueRecord : vagueRecordMap.get(3)) {
+                                    if (!homeworkPictureVagueRecord.getPictureVaguePath().equals(homeworkPicture.getFileKey())) {
+                                        this.addVagueNoCheckResult(result, homeworkPictureVagueRecord.getId(),
+                                                homeworkPictureVagueRecord.getPictureVaguePath(),
+                                                this.isOtherTeachersWork(teacherId, homeworkPicture, 1) ? 4 : 2);
+                                    }
+                                }
+                            }
+                        } else if (homeworkPicture.getIsMark() == 2) {
+                            //已经有补拍的,把所有模糊不全图片加入列表
+                            for (HomeworkPictureVagueRecord homeworkPictureVagueRecord : vagueRecords) {
+                                this.addVagueNoCheckResult(result, homeworkPictureVagueRecord.getId(),
+                                        homeworkPictureVagueRecord.getPictureVaguePath(),
+                                        this.isOtherTeachersWork(teacherId, homeworkPicture, 1) ? 4
+                                                : homeworkPictureVagueRecord.getType() == 3 ? 2 :
+                                                homeworkPictureVagueRecord.getType());
+                            }
+                        }
+                    }
+                }
+                if (homeworkPicture.getCheckDate() == null && homeworkPicture.getIsMark() > 0) {
+                    if (vagueRecordMap != null) {
+                        //作业模糊、不全, 图片需要质检的
+                        if (homeworkPicture.getIsMark() == 1 || homeworkPicture.getIsMark() == 3) {
+                            HomeworkPictureCheckDto vagueCheckDto = new HomeworkPictureCheckDto();
+                            for (HomeworkPictureVagueRecord vr : vagueRecords) {
+                                if (vr.getHomeworkPictureId().equals(homeworkPicture.getId()) && vr.getPictureVaguePath().equals(homeworkPicture.getFileKey())) {
+                                    vagueCheckDto.setHomeworkPictureId("vague_" + vr.getId());
+                                }
+                            }
+                            vagueCheckDto.setType(this.isOtherTeachersWork(teacherId, homeworkPicture, 1) ? 4 : 0);
+                            vagueCheckDto.setSecondType(this.isOtherTeachersWork(teacherId, homeworkPicture, 1) ? 4 :
+                                    homeworkPicture.getIsMark());
+                            //作业不全设置为2
+                            if (homeworkPicture.getIsMark() == 3) {
+                                vagueCheckDto.setSecondType(this.isOtherTeachersWork(teacherId, homeworkPicture, 1) ?
+                                        4 : 2);
+                            }
+                            vagueCheckDto.setPath(homeworkPicture.getFileKey());
+                            result.add(vagueCheckDto);
+                            //作业模糊后补拍
+                        } else if (homeworkPicture.getIsMark() == 2) {
+                            //批改完才把补拍的显示出来
+                            if (homeworkPicture.getIsFeedback() == 1) {
+                                homeworkPictureCheckDto = this.getFeedbackHomeworkPictureData(homeworkPicture,
+                                        exerciseQuestionDtoMap, null,accessToken);
+                                if (this.isOtherTeachersWork(teacherId, homeworkPicture, 1)) {
+                                    homeworkPictureCheckDto.setType(4);
+                                    homeworkPictureCheckDto.setSecondType(4);
+                                }
+                                //质检员已批改
+                                if (homeworkPicture.getIsCheckerCorrect() > 0) {
+                                    homeworkPictureCheckDto.setSecondType(12);
+                                }
+                                result.add(homeworkPictureCheckDto);
+                            }
+                        }
+                    } else {
+                        homeworkPictureCheckDto = this.getFeedbackHomeworkPictureData(homeworkPicture,
+                                exerciseQuestionDtoMap, null,accessToken);
+                        if (homeworkPicture.getIsMark() == 4) {
+                            homeworkPictureCheckDto.setSecondType(3);
+                        } else {
+                            homeworkPictureCheckDto.setSecondType(homeworkPicture.getIsMark());
+                        }
+                        if (this.isOtherTeachersWork(teacherId, homeworkPicture, 1)) {
+                            homeworkPictureCheckDto.setType(4);
+                            homeworkPictureCheckDto.setSecondType(4);
+                        }
+                        //质检员已批改
+                        if (homeworkPicture.getIsCheckerCorrect() > 0) {
+                            homeworkPictureCheckDto.setSecondType(12);
+                        }
+                        result.add(homeworkPictureCheckDto);
+                    }
+
+                } else {
+                    homeworkPictureCheckDto = this.getFeedbackHomeworkPictureData(homeworkPicture,
+                            exerciseQuestionDtoMap, null,accessToken);
+                    //非学科图片
+                    if (homeworkPicture.getIsDelete() == 1) {
+                        homeworkPictureCheckDto.setSecondType(3);
+                    } else if (homeworkPicture.getIsMark() == 1) {
+                        homeworkPictureCheckDto.setSecondType(1);
+
+                    } else if (homeworkPicture.getIsMark() == 3) {
+                        homeworkPictureCheckDto.setSecondType(2);
+                    } else if (homeworkPicture.getIsMark() != 2) {
+                        homeworkPictureCheckDto.setSecondType(homeworkPicture.getIsMark());
+                    }
+
+                    //其他老师的作业
+                    if (this.isOtherTeachersWork(teacherId, homeworkPicture, 1)) {
+                        homeworkPictureCheckDto.setType(4);
+                        homeworkPictureCheckDto.setSecondType(4);
+                    }
+
+                    //质检员已批改
+                    if (homeworkPicture.getIsCheckerCorrect() > 0) {
+                        homeworkPictureCheckDto.setSecondType(12);
+                    }
+
+                    result.add(homeworkPictureCheckDto);
+                }
+            }
+        }
+        return result;
+    }
+
 
     /**
      * 按日期顺序插入

+ 8 - 2
src/main/java/com/ssj/service/kmt/correctsys/service/KmtCorrectSysService.java

@@ -67,11 +67,17 @@ public interface KmtCorrectSysService {
 
     /**
      * 查询某个老师的质检作业数据,默认150天的数据
-     * @param teacherId
+     * @param
      * @return
      */
     Page<HomeworkCheckSubjectDto> pageCheckHomeworkList(Map<String, Object> params, Pageable pageable);
 
 
-
+    /**
+     * 获取报错图片
+     * @param homeworkId
+     * @param accessToken
+     * @return
+     */
+    List<HomeworkPictureCheckDto> checkHomeworkDetailList(String homeworkId, String accessToken);
 }

+ 2 - 0
src/main/java/com/ssj/service/sys/homework/service/HomeworkPictureService.java

@@ -86,4 +86,6 @@ public interface HomeworkPictureService extends BaseService<HomeworkPicture, Str
     List<StudentListVO> teacherStudentList(String teacherId);
 
     Map<String, Object> pictureDetail(String pictureId);
+
+    List<HomeworkPictureDto> findCheckHomeworkPictureByHomeworkId2(String homeworkId);
 }

+ 5 - 0
src/main/java/com/ssj/service/sys/homework/service/impl/HomeworkPictureServiceImpl.java

@@ -414,6 +414,11 @@ public class HomeworkPictureServiceImpl extends BaseServiceImpl<HomeworkPicture,
         return result;
     }
 
+    @Override
+    public List<HomeworkPictureDto> findCheckHomeworkPictureByHomeworkId2(String homeworkId) {
+        return homeworkPictureQueryDao.findCheckPictureByHomeworkId2(8, homeworkId);
+    }
+
 
     private boolean isBigQuestionExists (List<String> questionIds, List<ExerciseQuestionDto> questionDtoList){
         boolean result = false;

+ 7 - 2
src/main/java/com/ssj/service/sys/imlibuser/service/impl/TbClassTeacherTempServiceImpl.java

@@ -357,7 +357,12 @@ public class TbClassTeacherTempServiceImpl extends BaseServiceImpl<TbClassTeache
 					user.setUserName(tbLibImTeacherTemp.getTeacherName());
 					user.setMobile(tbLibImTeacherTemp.getTeacherPhone());
 					user.setCreateTime(new Date());
-					user.setPassword("123456");
+					if(tbLibImTeacherTemp.getType()==30){
+						user.setPassword("123456");
+					}else{
+						user.setPassword("123@abc123");
+					}
+
 					user.setPwdSalt(PasswordUtil.generateSalt());
 					user.setPassword(PasswordUtil.initPassword(user.getPassword(), user.getPwdSalt()));
 					user=userService.save(user);
@@ -369,7 +374,7 @@ public class TbClassTeacherTempServiceImpl extends BaseServiceImpl<TbClassTeache
 					tbLibManager=new TbLibManager();
 					tbLibManager.settPhoto(user.getPhoto());
 					tbLibManager.setUserId(user.getId());
-					tbLibManager.setType(Constant.ALL_TEACHER_TYPE);
+					tbLibManager.setType(tbLibImTeacherTemp.getType());
 					tbLibManager.setCreateTime(new Date());
 					tbLibManager.setName(tbLibImTeacherTemp.getTeacherName());
 					tbLibManager.setTelephone(tbLibImTeacherTemp.getTeacherPhone());

+ 5 - 0
src/main/java/com/ssj/statistics/dao/IStatisticsDao.java

@@ -2,6 +2,8 @@ package com.ssj.statistics.dao;
 
 import com.ssj.bean.statistics.PlatTeacherStatistics;
 import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
 import org.springframework.stereotype.Repository;
 
 /**
@@ -12,4 +14,7 @@ import org.springframework.stereotype.Repository;
  */
 @Repository
 public interface IStatisticsDao extends JpaRepository<PlatTeacherStatistics,String> {
+    @Query(nativeQuery = true,value = "delete from plat_teacher_statistics where calculate_date<?1")
+    @Modifying
+    void deleteOldData(String dataDate);
 }

+ 31 - 23
src/main/java/com/ssj/statistics/dao/impl/StatisticsQueryImpl.java

@@ -45,15 +45,19 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
          * accuracy	string	list	正确率
          * errorNums	int	list	报错页数
          */
-
+        sql.append("select a.correctNums,a.overtimeNums, ");
+        sql.append("a.notCorrectNums,a.notCommentNums, ");
+        sql.append("a.repeatNums,concat(floor(100*(a.totalNums- a.errorNums-a.notCorrectNums)/a.totalNums),'%') as accuracy,a.errorNums,a.teacherId,a.teacherName,a.subject,a.allSubject ");
+        sql.append(" from (");
         listInfo(params,queryParams,sql);
+        sql.append(" ) a");
         return dao.findPage(sql.toString(),queryParams.toArray(),initPage);
     }
 
     private void listInfo(Map<String, Object> params,List<Object> queryParams,StringBuffer sql){
-        sql.append("select t.teacher_id,t11.name as teacherName,t11.course_name as subject,t11.course_name as allSubject, \n");
-        sql.append(" t.correct_nums as correctNums,t.overtime_nums as overtimeNums,t.not_correct_nums as notCorrectNums, \n");
-        sql.append(" t.not_comment_nums as notCommentNums,t.repeat_nums as repeatNums,t.accuracy,t.error_nums as errorNums \n");
+        sql.append("select t.teacher_id as teacherId,t11.name as teacherName,t11.course_name as subject,t11.course_name as allSubject, \n");
+        sql.append(" sum(t.correct_nums) as correctNums,sum(t.overtime_nums) as overtimeNums,sum(t.not_correct_nums) as notCorrectNums, \n");
+        sql.append(" sum(t.not_comment_nums) as notCommentNums,sum(t.repeat_nums) as repeatNums,round(avg(t.accuracy),2) as accuracy,sum(t.error_nums) as errorNums,sum(t.total_nums) as totalNums \n");
         sql.append(" from plat_teacher_statistics t \n");
         sql.append(" left join tb_lib_manager t11 on t.teacher_id = t11.user_id \n");
         sql.append(" where t11.type = 30 \n");
@@ -69,6 +73,8 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
             sql.append(" and   t11.name like concat('%',?,'%') ");
             queryParams.add(params.get("teacherName"));
         }
+
+        sql.append(" group by  t11.user_id ");
     }
 
     @Override
@@ -133,9 +139,9 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         errorNums	int	list	报错页数
          */
         StringBuffer sql = new StringBuffer();
-        sql.append("select ifnull(sum(a.overtimeNums),0) as correctTotalNums,ifnull(sum(overtimeNums),0) as overtimeTotalNums, ");
+        sql.append("select ifnull(sum(a.correctNums),0) as correctTotalNums,ifnull(sum(overtimeNums),0) as overtimeTotalNums, ");
         sql.append("ifnull(sum(a.notCorrectNums),0) as notCorrectTotalNums,ifnull(sum(notCommentNums),0) as notCommentTotalNums, ");
-        sql.append("ifnull(sum(a.repeatNums),0) as repeatTotalNums,round(ifnull(avg(accuracy),0),2) as accuracyTotal ");
+        sql.append("ifnull(sum(a.repeatNums),0) as repeatTotalNums,concat(floor(100*(sum(a.totalNums)- sum(a.errorNums)-sum(a.notCorrectNums))/sum(a.totalNums)),'%') as accuracyTotal,ifnull(sum(errorNums),0) as errorTotalNums ");
         sql.append(" from (");
         List<Object> queryParams = new ArrayList<>();
         listInfo(params,queryParams,sql);
@@ -148,21 +154,23 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         StringBuffer sql = new StringBuffer();
         List<Object> queryParams = new ArrayList<>();
         sql.append("SELECT a.teacher_id,a.teacher_name,a.`subject`,a.all_subject,a.correct_nums,a.overtime_nums,a.not_correct_nums,a.not_comment_nums,a.repeat_nums,a.error_nums,\n");
-        sql.append("floor(100*(a.total- a.error_nums-a.not_correct_nums)/a.total) as accuracy\n");
+        sql.append("floor(100*(a.total- a.error_nums-a.not_correct_nums)/a.total) as accuracy,a.calculate_date,a.total as total_nums\n");
         sql.append("from (\n");
         sql.append("SELECT t12.name as teacher_name,t.teacher_id,t.`subject`,t12.course_name as all_subject,count(if(t.is_mark in (0,2) and t.is_feedback=1,true,NULL)) as correct_nums, \n");
-        sql.append("0 as overtime_nums,\n");
+        sql.append("count(if(t.is_feedback=1 and (DATE_FORMAT(t.create_time,'%H:%i')>='20:30' and DATE_FORMAT(t11.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(DATE_ADD(t.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n" +
+                " or (DATE_FORMAT(t.create_time,'%H:%i')<'20:30' and DATE_FORMAT(t11.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(t.create_time,'%Y-%m-%d'),' 23:59:59')),true,null)) as overtime_nums,\n");
         sql.append("count(1) as total,\n");
-        sql.append("count(if(t11.start_time is null,true,null)) as not_correct_nums,\n");
+        sql.append("DATE_FORMAT(t.create_time,'%Y-%m-%d') as calculate_date,\n");
+        sql.append("count(if(t.is_feedback=0 and t.is_mark in (0,2),true,null)) as not_correct_nums,\n");
         sql.append("count(if(t.is_mark=10,true,null)) as not_comment_nums,\n");
         sql.append("count(if(t.is_mark=15,true,null)) as repeat_nums,\n");
         sql.append("count(if(t11.is_check_error=1,true,null)) as error_nums\n");
         sql.append("from scon_homework_picture t \n");
-        sql.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id and t11.type = 8\n");
+        sql.append("left join scon_homework_picture_correct t11 on t.id = t11.homework_picture_id \n");
         sql.append("left join tb_lib_manager t12 on t.teacher_id = t12.user_id\n");
-        sql.append("where t12.type = 30 and to_days(t.create_time)= to_days(?)\n");
+        sql.append("where t12.type = 30 and t11.type = 8 and to_days(t.create_time)<= to_days(?)\n");
         queryParams.add(dateTime);
-        sql.append("GROUP BY t.teacher_id\n");
+        sql.append("GROUP BY t.teacher_id,to_days(t.create_time)\n");
         sql.append(")a");
         return dao.findList(sql.toString(),queryParams.toArray(),ListVO.class);
     }
@@ -171,26 +179,26 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
     public List<TeacherSalarysVO> addTeacherSalarysData(String month) {
         StringBuffer sql = new StringBuffer();
         List<Object> queryParams = new ArrayList<>();
-        sql.append("SELECT a.correct_nums,a.teacher_id,a.overtime_nums,a.perk_nums,a.error_nums,a.work_date,a.`month`,a.`year`,FLOOR(a.sum_perk)/a.perk_nums as perk_efficiency,Floor(100*(a.correct_nums-a.error_nums)/a.correct_nums) as accuracy,\n");
-        sql.append("(a.perk_nums-a.error_nums)*0.15 as perk_salary,(a.correct_nums-a.perk_nums-a.error_nums)*0.15 as other_salary,a.create_time\n" );
+        sql.append("SELECT a.correct_nums,a.teacher_id,a.overtime_nums,a.perk_nums,a.error_nums,a.work_date,FLOOR(a.sum_perk)/a.perk_nums as perk_efficiency,Floor(100*(a.correct_nums-a.error_nums)/a.correct_nums) as accuracy,\n");
+        sql.append(" case when a.perk_nums<134 and a.sum_perk<120 then 20 else (a.perk_nums-a.error_nums)*0.15 end as perk_salary\n" );
+        sql.append(",(a.correct_nums-a.perk_nums-a.error_nums)*0.15 as other_salary\n" );
         sql.append("from (\n" );
         sql.append("SELECT\n" );
         sql.append("count(1) as correct_nums,\n" );
-        sql.append("0 as overtime_nums,\n" );
-        sql.append("count(IF(DATE_FORMAT(t.start_time,'%H:%s')>='18:00' and DATE_FORMAT(t.start_time,'%H:%s')<='20:00',TRUE,null)) as perk_nums,\n" );
+        sql.append("count(if((DATE_FORMAT(t11.create_time,'%i:%s')>='20:30' and DATE_FORMAT(t.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(DATE_ADD(t11.create_time,interval 1 day),'%Y-%m-%d'),' 12:00:00'))\n");
+        sql.append(" or (DATE_FORMAT(t11.create_time,'%H:%i')<'20:30' and DATE_FORMAT(t.end_time,'%Y-%m-%d %H:%i:%s')>concat(DATE_FORMAT(t11.create_time,'%Y-%m-%d'),' 23:59:59')),true,null)) as overtime_nums,\n");
+        sql.append("count(IF(DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00',TRUE,null)) as perk_nums,\n" );
         sql.append("count(IF(t.is_check_error=1,TRUE,null)) as error_nums,\n" );
-        sql.append("DATE_FORMAT(t.start_time,'%Y-%m-%d') as work_date,\n" );
-        sql.append("2 as month,\n" );
-        sql.append("2021 as year,\n" );
-        sql.append("NOW() as create_time,\n" );
-        sql.append("sum(IF(DATE_FORMAT(t.start_time,'%H:%s')>='18:00' and DATE_FORMAT(t.start_time,'%H:%s')<='20:00',t.correction_time,0)) as sum_perk,\n" );
+        sql.append("DATE_FORMAT(t.end_time,'%Y-%m-%d') as work_date,\n" );
+        sql.append("sum(IF(DATE_FORMAT(t.end_time,'%H:%i')>='18:00' and DATE_FORMAT(t.end_time,'%H:%i')<='20:00',t.correction_time,0)) as sum_perk,\n" );
         sql.append("t11.teacher_id,\n" );
         sql.append("t.end_time,\n" );
         sql.append("t.start_time \n" );
         sql.append("from scon_homework_picture_correct t \n" );
         sql.append("join scon_homework_picture t11 on t.homework_picture_id = t11.id\n" );
-        sql.append("where t.type=8 and t11.is_mark in(0,2) \n" );
-        sql.append("and t.start_time like '%2021-02%'\n" );
+        sql.append("where t.type=8 and t11.is_mark in(0,2) and t11.is_feedback=1 \n" );
+        sql.append("and t.end_time like concat('%',?,'%')\n" );
+        queryParams.add(month);
         sql.append("GROUP BY t11.teacher_id\n" );
         sql.append(") a");
         return dao.findList(sql.toString(),queryParams.toArray(),TeacherSalarysVO.class);

+ 10 - 0
src/main/java/com/ssj/statistics/entity/TeacherPay.java

@@ -5,6 +5,7 @@ import com.ssj.bean.common.framework.core.domain.BaseEntity;
 import javax.persistence.Entity;
 import javax.persistence.Table;
 import java.math.BigDecimal;
+import java.util.Date;
 
 /**
  * @author sh
@@ -41,6 +42,7 @@ public class TeacherPay extends BaseEntity {
     private String otherSalary;
     private BigDecimal salary;
     private String teacherId;
+    private Date createTime;
 
     public Integer getCorrectNums() {
         return correctNums;
@@ -145,4 +147,12 @@ public class TeacherPay extends BaseEntity {
     public void setTeacherId(String teacherId) {
         this.teacherId = teacherId;
     }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
 }

+ 25 - 3
src/main/java/com/ssj/statistics/service/impl/StatisticsServiceImpl.java

@@ -8,9 +8,12 @@ import com.ssj.framework.core.common.service.BaseServiceImpl;
 import com.ssj.framework.weixin.util.DateUtil;
 import com.ssj.statistics.dao.IStatisticsDao;
 import com.ssj.statistics.dao.IStatisticsQueryDao;
+import com.ssj.statistics.entity.TeacherPay;
 import com.ssj.statistics.service.IStatisticsService;
+import com.ssj.statistics.service.ITeacherPayService;
 import org.apache.commons.collections4.MapUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.time.DateFormatUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
@@ -18,6 +21,7 @@ import org.springframework.data.domain.Pageable;
 import org.springframework.data.repository.PagingAndSortingRepository;
 import org.springframework.stereotype.Service;
 
+import java.math.BigDecimal;
 import java.util.*;
 
 /**
@@ -35,6 +39,9 @@ public class StatisticsServiceImpl  extends BaseServiceImpl<PlatTeacherStatistic
     @Autowired
     private IStatisticsQueryDao queryDao;
 
+    @Autowired
+    private ITeacherPayService payService;
+
     @Override
     public PagingAndSortingRepository<PlatTeacherStatistics, String> getDao() {
         return dao;
@@ -83,22 +90,37 @@ public class StatisticsServiceImpl  extends BaseServiceImpl<PlatTeacherStatistic
         }
         List<ListVO> list = queryDao.statisticsDataList(dataDate);
         if(Objects.nonNull(list)){
-            String finalDataDate = dataDate;
             list.forEach(o->{
                 PlatTeacherStatistics plat = new PlatTeacherStatistics();
                 BeanUtils.copyProperties(o,plat);
-                plat.setCalculateDate(finalDataDate);
+                plat.setCalculateDate(o.getCalculateDate());
                 plat.setCreateTime(new Date());
                 this.save(plat);
             });
+            //重新生成数据后删除之前的数据
+            dao.deleteOldData(dataDate);
         }
     }
 
     @Override
     public void addTeacherSalarysData(String month) {
         if(StringUtils.isBlank(month)){
-            month = DateUtil.format_yyyyMMdd(DateUtil.addMonth(-1));
+            month = DateFormatUtils.format(DateUtil.addMonth(-1), "yyyy-MM");
         }
         List<TeacherSalarysVO> list = queryDao.addTeacherSalarysData(month);
+        if(Objects.nonNull(list) && list.size()>0){
+            String monthTemp = month.split("-")[1];
+            int month2 = monthTemp.startsWith("0")?Integer.parseInt(monthTemp.substring(1)):Integer.parseInt(monthTemp);
+            int year =Integer.parseInt(month.split("-")[0]) ;
+            for(TeacherSalarysVO vo:list){
+                TeacherPay pay = new TeacherPay();
+                BeanUtils.copyProperties(vo,pay);
+                pay.setMonth(month2);
+                pay.setYear(year);
+                pay.setCreateTime(new Date());
+                pay.setSalary(new BigDecimal(pay.getPerkSalary()).add(new BigDecimal(pay.getOtherSalary())));
+                payService.save(pay);
+            }
+        }
     }
 }

+ 2 - 2
src/main/java/com/ssj/sys/controller/ImLibUserController.java

@@ -886,8 +886,8 @@ public class ImLibUserController extends BaseController {
 					tbLibImTeacherTemp.setTeacherName(map.get("data_0"));
 					tbLibImTeacherTemp.setTeacherPhone(map.get("data_1"));
 					tbLibImTeacherTemp.setGrade(map.get("data_2"));
-					tbLibImTeacherTemp.setClassName(map.get("data_3"));
-					tbLibImTeacherTemp.setSubject(map.get("data_4"));
+					tbLibImTeacherTemp.setSubject(map.get("data_3"));
+					tbLibImTeacherTemp.setType(Integer.parseInt(map.get("data_4")));
 					tbLibImTeacherTemp.setIsCorrect(1);
 
 					tbLibImTeacherTemps.add(tbLibImTeacherTemp);

+ 2 - 1
src/main/resources/application-common-dev.properties

@@ -24,6 +24,7 @@ spring.datasource.filters=stat,wall,slf4j
 spring.datasource.connectionProperties=druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
 
 
+#公网ip:47.106.111.166 内网IP:172.18.30.192
 spring.redis.database=0
 spring.redis.cluster.pool.max-active=8
 spring.redis.cluster.pool.max-wait=-1
@@ -32,7 +33,7 @@ spring.redis.cluster.pool.min-idle=0
 spring.redis.block-when-exhausted=true
 spring.redis.password=dc1qazxsw2!@
 spring.redis.timeout=3000
-spring.redis.cluster.nodes=172.18.30.192:6380,172.18.30.192:6381,172.18.30.192:6382,172.18.30.192:6383,172.18.30.192:6384,172.18.30.192:6385
+spring.redis.cluster.nodes=47.106.111.166:6380,47.106.111.166:6381,47.106.111.166:6382,47.106.111.166:6383,47.106.111.166:6384,47.106.111.166:6385
 spring.redis.cluster.timeout=30
 
 

BIN=BIN
src/main/resources/static/sys/excel/teacher_all.xlsx