baihe 3 gadi atpakaļ
vecāks
revīzija
d4f874a33b

+ 13 - 13
application-facade/src/main/java/com/factory/controller/wx/StatisticsController.java

@@ -1,5 +1,15 @@
 package com.factory.controller.wx;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
 import com.factory.base.entity.aggregates.ResponseBean;
 import com.factory.base.util.res.ResponseBeanBuilder;
 import com.factory.web.entity.statistics.ExceptionCountRes;
@@ -10,18 +20,9 @@ import com.factory.wx.entity.req.AbnormalPlanReq;
 import com.factory.wx.entity.res.AbnormalDetailRes;
 import com.factory.wx.entity.res.AbnormalPlanRes;
 import com.factory.wx.service.AbnormalStatisticsService;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
 
 /**
  * 微信小程序端异常统计
@@ -33,7 +34,6 @@ import java.util.Map;
 @Api(tags = "微信小程序端")
 @RestController
 @RequestMapping("/statistics")
-@Slf4j
 public class StatisticsController {
     @Autowired
     private StatisticsService statisticsService;
@@ -48,9 +48,9 @@ public class StatisticsController {
 
     @ApiOperation(value = "异常计划列表")
     @PostMapping("/list")
-    public ResponseBean<Map> statisticsList(@RequestBody AbnormalPlanReq abnormalPlanReq) {
+    public ResponseBean<Map<String,Object>> statisticsList(@RequestBody AbnormalPlanReq abnormalPlanReq) {
         List<AbnormalPlanRes> abnormalPlanResList = abnormalStatisticsService.getExceptionPlansByMonth(abnormalPlanReq);
-        Map map = new HashMap<>();
+        Map<String,Object> map = new HashMap<>();
         map.put("row", abnormalPlanResList);
         return ResponseBeanBuilder.ok(map);
     }

+ 5 - 8
application-facade/src/main/java/com/factory/wx/service/impl/AbnormalStatisticsServiceImpl.java

@@ -113,8 +113,8 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
         BentelerPlan bentelerPlan = bentelerPlanMapper.selectById(abnormalDetailReq.getPlanId());
         abnormalDetailRes.setPlanId(bentelerPlan.getId());
         abnormalDetailRes.setPlanName(bentelerPlan.getName());
-
-        if (abnormalDetailReq.getCheckType() == 1) {
+        abnormalDetailRes.setPlanType(bentelerPlan.getPlanType());
+        if (bentelerPlan.getPlanType() == 1) {
             //获取title
             FirstArticleTitle title = firstArticleService.getFaTitle(abnormalDetailReq.getPlanId());
             //判断是否有附件
@@ -125,8 +125,7 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
             //取放行信息
             List<AbnormalTaskInfoRes> abnormalTaskInfoResList = getFaAbnormalTaskInfoRes(abnormalDetailReq);
             abnormalDetailRes.setAbnormalTaskInfos(abnormalTaskInfoResList);
-        }
-        if (abnormalDetailReq.getCheckType() == 2) {
+        }else if (bentelerPlan.getPlanType() == 2) {
             //获取title
             OnsiteTitle title = preventMistakeService.getTitle(abnormalDetailReq.getPlanId());
             //判断是否有附件
@@ -153,8 +152,7 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
         if (abnormalDetailReq.getAbnormalType() == 1) {
             //重检内容
             faList = abnormalStatisticsMapper.getFaRecheckedListByPlanId(abnormalDetailReq.getPlanId(),abnormalDetailReq.getTaskId());
-        }
-        if (abnormalDetailReq.getAbnormalType() == 2) {
+        }else  {//if (abnormalDetailReq.getAbnormalType() == 2)
             //放行内容
             faList = abnormalStatisticsMapper.getFaReleaseListByPlanId(abnormalDetailReq.getPlanId(),abnormalDetailReq.getTaskId());
         }
@@ -241,8 +239,7 @@ public class AbnormalStatisticsServiceImpl implements AbnormalStatisticsService
         if (abnormalDetailReq.getAbnormalType() == 1) {
             //重检内容
             pmList = abnormalStatisticsMapper.getPmRecheckedListByPlanId(abnormalDetailReq.getPlanId(),abnormalDetailReq.getTaskId());
-        }
-        if (abnormalDetailReq.getAbnormalType() == 2) {
+        }else   {//if (abnormalDetailReq.getAbnormalType() == 2)
             //放行内容
             pmList = abnormalStatisticsMapper.getPmReleaseListByPlanId(abnormalDetailReq.getPlanId(),abnormalDetailReq.getTaskId());
         }

+ 2 - 2
application-facade/src/main/resources/mapper/AbnormalStatisticsMapper.xml

@@ -123,7 +123,7 @@
           AND ot.`status` = 2
           AND bp.id = #{planId}
           <if test="taskId!=null">
-          	ot.id=#{taskId}
+          AND ot.id=#{taskId}
           </if>
     </select>
     <!-- 取得首件放行 -->
@@ -176,7 +176,7 @@
           AND oc.user_id = uu.id
           AND bp.id = #{planId}
           <if test="taskId!=null">
-          	ot.id=#{taskId}
+          	AND ot.id=#{taskId}
           </if>
     </select>
     <!-- 首件重检信息 -->

+ 16 - 13
application-task/src/main/java/com/factory/init/FirstRemindJob.java

@@ -85,10 +85,10 @@ public class FirstRemindJob implements Job {
         Callable<Integer> cal = null;
         if (isWork) {
             param.put("remind_task_flag", 0);
-            cal = new RemindFirstWorker(paramMap, param);
+            cal = new RemindFirstWorker(paramMap, param,0);
         } else {
             param.put("remind_nowork_flag", 0);
-            cal = new RemindFirstNoWorker(paramMap, param);
+            cal = new RemindFirstNoWorker(paramMap, param,0);
         }
         
         return cal;
@@ -108,10 +108,10 @@ public class FirstRemindJob implements Job {
         Callable<Integer> cal = null;
         if (isWork) {
             param.put("remind_task_flag", 0);
-            cal = new RemindFirstWorker(paramMap, param);
+            cal = new RemindFirstWorker(paramMap, param,1);
         } else {
             param.put("remind_nowork_flag", 0);
-            cal = new RemindFirstNoWorker(paramMap, param);
+            cal = new RemindFirstNoWorker(paramMap, param,1);
         }
         return cal;
     }
@@ -123,10 +123,12 @@ public class FirstRemindJob implements Job {
 
         private ConcurrentMap<String, Object> paramMap;
         private HashMap<String,Object> paramQuery;
+        private int typeFlag=0;
 
-        public RemindFirstWorker(ConcurrentMap<String, Object> paramMap, HashMap<String,Object> paramQuery) {
+        public RemindFirstWorker(ConcurrentMap<String, Object> paramMap, HashMap<String,Object> paramQuery,int typeFlag) {
             this.paramMap = paramMap;
             this.paramQuery = paramQuery;
+            this.typeFlag = typeFlag;
         }
 
 
@@ -138,11 +140,11 @@ public class FirstRemindJob implements Job {
 			LocalDateTime now = LocalDateTime.now();
 			log.info("等待中1首件防错任务数量{}",cals.size());
 			for (FirstCalendar cal : cals) {
-				if (StringUtils.isNotBlank(cal.getFirstRemind()) && now
+				if (typeFlag==0&&StringUtils.isNotBlank(cal.getFirstRemind()) && now
 						.isBefore(TimeUtils.paserDayTimeString(cal.getTaskTime() + " " + cal.getFirstRemind() + ":00"))) {//首件
 					// 还未到时间
 					continue;
-				} else if (now.isBefore(TimeUtils.paserDayTimeString(cal.getTaskTime() + " "+cal.getTwoRemind()+":00"))) {//200件
+				} else if (typeFlag==1&&now.isBefore(TimeUtils.paserDayTimeString(cal.getTaskTime() + " "+cal.getTwoRemind()+":00"))) {//200件
 					continue;
 				}
 				log.info("发送超期提醒到PAD{}",cal);
@@ -172,12 +174,14 @@ public class FirstRemindJob implements Job {
     public class RemindFirstNoWorker implements Callable<Integer> {
 
         private ConcurrentMap<String, Object> paramMap;
-        private HashMap<String,Object> paramQuery;
-
+        private HashMap<String,Object> paramQuery = new HashMap<>();
+        private  int typeFlag;
 
-        public RemindFirstNoWorker(ConcurrentMap<String, Object> paramMap, HashMap<String,Object> paramQuery) {
+        public RemindFirstNoWorker(ConcurrentMap<String, Object> paramMap, HashMap<String,Object> paramQuery,int typeFlag) {
             this.paramMap = paramMap;
+            this.typeFlag = typeFlag;
             this.paramQuery = paramQuery;
+            paramQuery.put("type_flag", typeFlag);
         }
 
         @Override
@@ -185,15 +189,14 @@ public class FirstRemindJob implements Job {
             FirstTaskService firstTaskService = (FirstTaskService) paramMap.get("firstTaskService");
             MsgService msgService = (MsgService) paramMap.get("msgService");
             List<FirstCalendar> cals = firstTaskService.getRemindWork(paramQuery);
-            
             LocalDateTime now = LocalDateTime.now();
             log.info("等待中2首件防错任务数量{}",cals.size());
             for (FirstCalendar cal : cals) {
-                if (StringUtils.isNotBlank(cal.getFirstRemind()) && now
+                if (typeFlag==0&&StringUtils.isNotBlank(cal.getFirstRemind()) && now
 						.isBefore(TimeUtils.paserDayTimeString(cal.getTaskTime() + " " + cal.getFirstRemind() + ":00").plusMinutes(cal.getUpleverTimeNum()))) {
 					// 还未到时间
 					continue;
-				} else if (now.isBefore(TimeUtils.paserDayTimeString(cal.getTaskTime() + " "+cal.getTwoRemind()+":00").plusMinutes(cal.getUpleverTimeNum()))) {
+				} else if (typeFlag==1&&now.isBefore(TimeUtils.paserDayTimeString(cal.getTaskTime() + " "+cal.getTwoRemind()+":00").plusMinutes(cal.getUpleverTimeNum()))) {
 					continue;
 				}