Browse Source

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

wuwen 3 years ago
parent
commit
73f103bb38

+ 21 - 9
src/main/java/com/ssj/api/controller/ApiManagerTeacherController.java

@@ -16,6 +16,7 @@ import com.ssj.bean.common.framework.core.domain.Response;
 import com.ssj.bean.sys.imlibuser.TbClassStudentTemp;
 import com.ssj.bean.sys.imlibuser.TbClassTeacherTemp;
 import com.ssj.bean.weixin.libmy.domain.TbLibManager;
+import com.ssj.framework.basic.utils.DateHelper;
 import com.ssj.framework.core.common.controller.BaseController;
 import com.ssj.framework.core.util.Constant;
 import com.ssj.framework.core.util.PasswordUtil;
@@ -281,7 +282,18 @@ public class ApiManagerTeacherController extends BaseController {
         Map<String,Object> params=new HashMap<>(4);
         try {
             params.put("beginDate",req.getBeginDate());
-            params.put("endDate",req.getEndDate());
+            LocalTime time = LocalTime.now();
+            String endDate = time.getHour()<12?DateHelper.format(DateHelper.getNextDay(new Date(),-2),"yyyy-MM-dd"):DateHelper.format(DateHelper.getNextDay(new Date(),-1),"yyyy-MM-dd");
+            if(StringUtils.isBlank(req.getBeginDate()) || req.getEndDate().compareTo(endDate)>0){
+                params.put("endDate",endDate);
+            }else{
+                params.put("endDate",req.getEndDate());
+            }
+
+            //显示质检时间,如果当前时间是中午12点前,就限制质检时间为昨天中午12点前,如果是今天就限制为今天12点前
+            String checkDate  = DateHelper.format(DateHelper.getNextDay(DateHelper.parseDate(params.get("endDate").toString(),"yyyy-MM-dd"),1),"yyyy-MM-dd").concat(" 12:00:00");
+
+            params.put("checkDate",checkDate);
             params.put("teacherId",req.getTeacherId());
             params.put("subject",req.getSubject());
             Map<String,Object> data = statisticsService.errorList(params,initPage(req.getPageNo(),req.getPageSize()));
@@ -466,14 +478,14 @@ public class ApiManagerTeacherController extends BaseController {
     private List<Map<String,Object>> getSalaryList(String userId){
         //计算今天日期
         LocalDate date = LocalDate.now();
-//        int day = date.getDayOfMonth();
-//        LocalTime time = LocalTime.now();
-//        boolean lastMonth = day< 4 || (day==4 && time.getHour()<12);
-//        LocalDate localDate = lastMonth?date.minusMonths(2):date.minusMonths(1);
-//        int month = localDate.getMonthValue();
-//        int year = localDate.getYear();
-        int month = date.getMonthValue();
-        int year = date.getYear();
+        int day = date.getDayOfMonth();
+        LocalTime time = LocalTime.now();
+        boolean lastMonth = day< 4 || (day==4 && time.getHour()<12);
+        LocalDate localDate = lastMonth?date.minusMonths(2):date.minusMonths(1);
+        int month = localDate.getMonthValue();
+        int year = localDate.getYear();
+//        int month = date.getMonthValue();
+//        int year = date.getYear();
         return teacherPayService.salaryList(userId,month,year);
     }
 

+ 9 - 5
src/main/java/com/ssj/statistics/dao/impl/StatisticsQueryImpl.java

@@ -81,7 +81,7 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
     public Page<Map<String, Object>> errorList(Map<String, Object> params, Pageable initPage) {
         StringBuffer sql = new StringBuffer();
         List<Object> queryParams = new ArrayList<>();
-        sql.append("SELECT DATE_FORMAT(t11.create_time,'%Y-%m-%d') as year_1,DATE_FORMAT(t11.create_time,'%m月%d日') as workDate from scon_homework_picture_correct t \n");
+        sql.append("SELECT DATE_FORMAT(t.end_time,'%Y-%m-%d') as year_1,DATE_FORMAT(t.end_time,'%m月%d日') as workDate from scon_homework_picture_correct t \n");
         sql.append("join scon_homework_picture t11 on t.homework_picture_id = t11.id\n");
         sql.append("left join tb_lib_vip t12 on t11.vip_id = t12.id\n");
         sql.append("where t.type = 8 and t.is_check_error  = 1\n");
@@ -89,14 +89,18 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         queryParams.add(params.get("subject"));
         queryParams.add(params.get("teacherId"));
         if(Objects.nonNull(params.get("beginDate")) && StringUtils.isNotBlank(MapUtils.getString(params,"beginDate"))){
-            sql.append(" and  to_days(t11.create_time) >=to_days(?)  ");
+            sql.append(" and  to_days(t.end_time) >=to_days(?)  ");
             queryParams.add(params.get("beginDate"));
         }
         if(Objects.nonNull(params.get("endDate")) && StringUtils.isNotBlank(MapUtils.getString(params,"endDate"))){
-            sql.append(" and  to_days(t11.create_time) <=to_days(?)  ");
+            sql.append(" and  to_days(t.end_time) <=to_days(?)  ");
             queryParams.add(params.get("endDate"));
         }
-        sql.append("GROUP BY DATE_FORMAT(t11.create_time,'%y-%m-%d')");
+        if(Objects.nonNull(params.get("checkDate")) && StringUtils.isNotBlank(MapUtils.getString(params,"checkDate"))){
+            sql.append(" and  t.check_date < ?  ");
+            queryParams.add(params.get("checkDate"));
+        }
+        sql.append("GROUP BY DATE_FORMAT(t.end_time,'%y-%m-%d')");
 
         return dao.findPage(sql.toString(),queryParams.toArray(),initPage);
     }
@@ -113,7 +117,7 @@ public class StatisticsQueryImpl implements IStatisticsQueryDao {
         sql.append("and t11.`subject`=? and t11.teacher_id=?\n");
         queryParams.add(subject);
         queryParams.add(teacherId);
-        sql.append(" and  to_days(t11.create_time) =to_days(?)  ");
+        sql.append(" and  to_days(t.end_time) =to_days(?)  ");
         queryParams.add(date);
         sql.append("group by t11.homework_id");
         return dao.findMap(sql.toString(),queryParams.toArray());