Browse Source

Merge branch 'usky-zyj' of uskycloud/usky-modules into server-165

James 9 months ago
parent
commit
402ea13985

+ 13 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -15,6 +15,8 @@ import com.usky.fire.mapper.PatrolInspectionRecordMapper;
 import com.usky.fire.service.*;
 import com.usky.fire.service.*;
 import com.usky.fire.service.util.OnlineMethod;
 import com.usky.fire.service.util.OnlineMethod;
 import com.usky.fire.service.vo.*;
 import com.usky.fire.service.vo.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -82,6 +84,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     @Autowired
     @Autowired
     private PatrolInspectionAbnormalService patrolInspectionAbnormalService;
     private PatrolInspectionAbnormalService patrolInspectionAbnormalService;
 
 
+    private static final Logger LOGGER = LoggerFactory.getLogger(PatrolInspectionPlanSonServiceImpl.class);
+
     @Override
     @Override
     public Map<String, Object> appPlanStatistics(String currentDate) {
     public Map<String, Object> appPlanStatistics(String currentDate) {
         Integer planSonCount = 0;
         Integer planSonCount = 0;
@@ -396,13 +400,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 
 
     @Override
     @Override
     public void addPatrolInspectionAbnormalData(){
     public void addPatrolInspectionAbnormalData(){
+        LOGGER.info("巡检漏检定时任务 begin");
         DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         String datetime1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         String datetime1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         String datetime2 = LocalDateTime.now().minusHours(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         String datetime2 = LocalDateTime.now().minusHours(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
 
 
         List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1,datetime2);
         List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1,datetime2);
         if(list.size() <=0){
         if(list.size() <=0){
-            throw new BusinessException("当前时间向前一小时没有漏检记录");
+            LOGGER.info("当前时间向前一小时没有漏检记录");
         }
         }
         List<Integer> sonIdlist = new ArrayList<>();
         List<Integer> sonIdlist = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
         for (int i = 0; i < list.size(); i++) {
@@ -420,12 +425,13 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                 noSonIdList.add(siteSonList.get(i).getPlanId());
                 noSonIdList.add(siteSonList.get(i).getPlanId());
             }
             }
             //获取巡检地点
             //获取巡检地点
+            LOGGER.info("获取巡检地点");
             LambdaQueryWrapper<PatrolInspectionSite> queryWrapper1 = Wrappers.lambdaQuery();
             LambdaQueryWrapper<PatrolInspectionSite> queryWrapper1 = Wrappers.lambdaQuery();
             queryWrapper1.in(PatrolInspectionSite::getId,siteIdList)
             queryWrapper1.in(PatrolInspectionSite::getId,siteIdList)
                     .eq(PatrolInspectionSite::getEnable,1);
                     .eq(PatrolInspectionSite::getEnable,1);
             List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper1);
             List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper1);
             if(siteList.size() <= 0){
             if(siteList.size() <= 0){
-                throw new BusinessException("查询巡检地点记录为空");
+                LOGGER.info("查询巡检地点记录为空");
             }
             }
             //获取巡检子计划
             //获取巡检子计划
             LambdaQueryWrapper<PatrolInspectionPlanSon> planSonQueryWrapper = Wrappers.lambdaQuery();
             LambdaQueryWrapper<PatrolInspectionPlanSon> planSonQueryWrapper = Wrappers.lambdaQuery();
@@ -443,12 +449,13 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             //获取巡检计划
             //获取巡检计划
             List<PatrolInspectionPlan> noPlanIdList = patrolInspectionPlanMapper.selectNoPlanList(planIdList);
             List<PatrolInspectionPlan> noPlanIdList = patrolInspectionPlanMapper.selectNoPlanList(planIdList);
             //获取巡检人员
             //获取巡检人员
+            LOGGER.info("获取巡检人员");
             LambdaQueryWrapper<PatrolInspectionPersonnel> personnelQueryWrapper = Wrappers.lambdaQuery();
             LambdaQueryWrapper<PatrolInspectionPersonnel> personnelQueryWrapper = Wrappers.lambdaQuery();
             personnelQueryWrapper.in(PatrolInspectionPersonnel::getId,personnelList)
             personnelQueryWrapper.in(PatrolInspectionPersonnel::getId,personnelList)
                     .eq(PatrolInspectionPersonnel::getEnable,1);
                     .eq(PatrolInspectionPersonnel::getEnable,1);
             List<PatrolInspectionPersonnel> inspectionPersonnelList = patrolInspectionPersonnelService.list(personnelQueryWrapper);
             List<PatrolInspectionPersonnel> inspectionPersonnelList = patrolInspectionPersonnelService.list(personnelQueryWrapper);
             if(inspectionPersonnelList.size() <= 0){
             if(inspectionPersonnelList.size() <= 0){
-                throw new BusinessException("巡检人员信息不存在");
+                LOGGER.info("巡检人员信息不存在");
             }
             }
             //获取巡检区域
             //获取巡检区域
             LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
             LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
@@ -456,7 +463,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     .eq(PatrolInspectionArea::getEnable,1);
                     .eq(PatrolInspectionArea::getEnable,1);
             List<PatrolInspectionArea> areaInfoList = patrolInspectionAreaService.list(queryWrapperOne);
             List<PatrolInspectionArea> areaInfoList = patrolInspectionAreaService.list(queryWrapperOne);
             if(areaInfoList.size() <= 0){
             if(areaInfoList.size() <= 0){
-                throw new BusinessException("巡检区域不存在");
+                LOGGER.info("巡检区域不存在");
             }
             }
 
 
             for (int i = 0; i < siteSonList.size(); i++) {
             for (int i = 0; i < siteSonList.size(); i++) {
@@ -529,6 +536,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 
 
                 patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
                 patrolInspectionAbnormalService.save(patrolInspectionAbnormal);
 
 
+                LOGGER.info("巡检漏检定时任务 end");
+
             }
             }
 
 
         }
         }