Quellcode durchsuchen

Merge branch 'fu-normal-push' of uskycloud/usky-modules into master

gez vor 3 Wochen
Ursprung
Commit
4bc4761258

+ 51 - 47
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -110,9 +110,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         }
 
         Map<String, Object> map = new HashMap<>();
-        map.put("planSonCount", planSonCount);//巡检任务总数
-        map.put("patrolledCount", patrolledCount);//已巡检任务
-        map.put("undetectedCount", undetectedCount);//漏检任务
+        map.put("planSonCount", planSonCount);// 巡检任务总数
+        map.put("patrolledCount", patrolledCount);// 已巡检任务
+        map.put("undetectedCount", undetectedCount);// 漏检任务
         return map;
     }
 
@@ -298,8 +298,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
          * 巡检时间判断
          * */
         LocalDateTime now = LocalDateTime.now();
-        LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() + " " + planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() + " " + planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         if (inspectionDateTime.isAfter(now)) {
             PatrolInspectionEvent patrolInspectionEvent = new PatrolInspectionEvent();
             patrolInspectionEvent.setEventName("早到");
@@ -311,7 +311,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             patrolInspectionEvent.setCreateTime(LocalDateTime.now());
             patrolInspectionEventService.add(patrolInspectionEvent);
             throw new BusinessException("计划未开始,不可巡检");
-        } else if (now.isAfter(inspectionDateTime1)){
+        } else if (now.isAfter(inspectionDateTime1)) {
             PatrolInspectionEvent patrolInspectionEvent = new PatrolInspectionEvent();
             patrolInspectionEvent.setEventName("迟到");
             patrolInspectionEvent.setEventType(34);
@@ -372,9 +372,13 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             patrolInspectionRecordPictureService.save(recordPictureList.get(i));
         }
 
-        for (int i = 0; i < recordOptionList.size(); i++) {
-            recordOptionList.get(i).setRecordId(recordId);
-            patrolInspectionRecordOptionService.save(recordOptionList.get(i));
+        if (recordOptionList != null && !recordOptionList.isEmpty()) {
+            for (int i = 0; i < recordOptionList.size(); i++) {
+                recordOptionList.get(i).setRecordId(recordId);
+                patrolInspectionRecordOptionService.save(recordOptionList.get(i));
+            }
+        } else {
+            throw new BusinessException("请选择或填写巡检内容!");
         }
 
         LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapperTwo = Wrappers.lambdaQuery();
@@ -399,46 +403,46 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     }
 
     @Override
-    public void addPatrolInspectionAbnormalData(){
+    public void addPatrolInspectionAbnormalData() {
         LOGGER.info("巡检漏检定时任务 begin");
         DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         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"));
 
-        List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1,datetime2);
-        if(list.size() <=0){
+        List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1, datetime2);
+        if (list.size() <= 0) {
             LOGGER.info("当前时间向前一小时没有漏检记录");
-        }else{
+        } else {
             List<Integer> sonIdlist = new ArrayList<>();
             for (int i = 0; i < list.size(); i++) {
                 sonIdlist.add(list.get(i).getId());
             }
             LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapper = Wrappers.lambdaQuery();
-            queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId,sonIdlist)
-                    .eq(PatrolInspectionPlanSiteSon::getInspectionStatus,1);
+            queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId, sonIdlist)
+                    .eq(PatrolInspectionPlanSiteSon::getInspectionStatus, 1);
             List<PatrolInspectionPlanSiteSon> siteSonList = patrolInspectionPlanSiteSonService.list(queryWrapper);
-            if(CollectionUtils.isNotEmpty(siteSonList)){
+            if (CollectionUtils.isNotEmpty(siteSonList)) {
                 List<Integer> siteIdList = new ArrayList<>();
                 List<Integer> noSonIdList = new ArrayList<>();
                 for (int i = 0; i < siteSonList.size(); i++) {
                     siteIdList.add(siteSonList.get(i).getSiteId());
                     noSonIdList.add(siteSonList.get(i).getPlanId());
                 }
-                //获取巡检地点
+                // 获取巡检地点
                 LOGGER.info("获取巡检地点");
                 LambdaQueryWrapper<PatrolInspectionSite> queryWrapper1 = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(siteIdList)){
-                    queryWrapper1.in(PatrolInspectionSite::getId,siteIdList)
-                            .eq(PatrolInspectionSite::getEnable,1);
+                if (CollectionUtils.isNotEmpty(siteIdList)) {
+                    queryWrapper1.in(PatrolInspectionSite::getId, siteIdList)
+                            .eq(PatrolInspectionSite::getEnable, 1);
                 }
                 List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper1);
-                if(siteList.size() <= 0){
+                if (siteList.size() <= 0) {
                     LOGGER.info("查询巡检地点记录为空");
                 }
-                //获取巡检子计划
+                // 获取巡检子计划
                 LambdaQueryWrapper<PatrolInspectionPlanSon> planSonQueryWrapper = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(noSonIdList)){
-                    planSonQueryWrapper.in(PatrolInspectionPlanSon::getId,noSonIdList);
+                if (CollectionUtils.isNotEmpty(noSonIdList)) {
+                    planSonQueryWrapper.in(PatrolInspectionPlanSon::getId, noSonIdList);
                 }
                 List<PatrolInspectionPlanSon> noPlanSonList = this.list(planSonQueryWrapper);
                 List<Integer> planIdList = new ArrayList<>();
@@ -450,27 +454,27 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     areaList.add(noPlanSonList.get(i).getAreaId());
                 }
 
-                //获取巡检计划
+                // 获取巡检计划
                 List<PatrolInspectionPlan> noPlanIdList = patrolInspectionPlanMapper.selectNoPlanList(planIdList);
-                //获取巡检人员
+                // 获取巡检人员
                 LOGGER.info("获取巡检人员");
                 LambdaQueryWrapper<PatrolInspectionPersonnel> personnelQueryWrapper = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(personnelList)){
-                    personnelQueryWrapper.in(PatrolInspectionPersonnel::getId,personnelList)
-                            .eq(PatrolInspectionPersonnel::getEnable,1);
+                if (CollectionUtils.isNotEmpty(personnelList)) {
+                    personnelQueryWrapper.in(PatrolInspectionPersonnel::getId, personnelList)
+                            .eq(PatrolInspectionPersonnel::getEnable, 1);
                 }
                 List<PatrolInspectionPersonnel> inspectionPersonnelList = patrolInspectionPersonnelService.list(personnelQueryWrapper);
-                if(inspectionPersonnelList.size() <= 0){
+                if (inspectionPersonnelList.size() <= 0) {
                     LOGGER.info("巡检人员信息不存在");
                 }
-                //获取巡检区域
+                // 获取巡检区域
                 LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(areaList)){
+                if (CollectionUtils.isNotEmpty(areaList)) {
                     queryWrapperOne.in(PatrolInspectionArea::getId, areaList)
-                            .eq(PatrolInspectionArea::getEnable,1);
+                            .eq(PatrolInspectionArea::getEnable, 1);
                 }
                 List<PatrolInspectionArea> areaInfoList = patrolInspectionAreaService.list(queryWrapperOne);
-                if(areaInfoList.size() <= 0){
+                if (areaInfoList.size() <= 0) {
                     LOGGER.info("巡检区域不存在");
                 }
 
@@ -479,7 +483,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     Integer siteId = siteSonList.get(i).getSiteId();
                     Integer planSonId = siteSonList.get(i).getPlanId();
                     for (int j = 0; j < siteList.size(); j++) {
-                        if(siteId.equals(siteList.get(j).getId())){
+                        if (siteId.equals(siteList.get(j).getId())) {
                             patrolInspectionAbnormal.setSiteNubmber(siteList.get(j).getSiteNubmber());
                             patrolInspectionAbnormal.setSiteType(siteList.get(j).getSiteType());
                             patrolInspectionAbnormal.setSiteName(siteList.get(j).getSiteName());
@@ -492,7 +496,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
 
                     for (int j = 0; j < noPlanSonList.size(); j++) {
-                        if(planSonId.equals(noPlanSonList.get(j).getId())){
+                        if (planSonId.equals(noPlanSonList.get(j).getId())) {
                             patrolInspectionAbnormal.setPlanId(noPlanSonList.get(j).getPlanId());
                             patrolInspectionAbnormal.setPlanSonId(noPlanSonList.get(j).getId());
                             patrolInspectionAbnormal.setTenantId(noPlanSonList.get(j).getTenantId());
@@ -513,14 +517,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 
                             Integer noAreaId = noPlanSonList.get(j).getAreaId();
                             for (int k = 0; k < areaInfoList.size(); k++) {
-                                if(noAreaId.equals(areaInfoList.get(k).getId())){
+                                if (noAreaId.equals(areaInfoList.get(k).getId())) {
                                     patrolInspectionAbnormal.setAreaName(areaInfoList.get(k).getAreaName());
                                     break;
                                 }
                             }
                             Integer noPersonnelId = noPlanSonList.get(j).getPersonnelId();
                             for (int k = 0; k < inspectionPersonnelList.size(); k++) {
-                                if(noPersonnelId.equals(inspectionPersonnelList.get(k).getId())){
+                                if (noPersonnelId.equals(inspectionPersonnelList.get(k).getId())) {
                                     patrolInspectionAbnormal.setName(inspectionPersonnelList.get(k).getFullName());
                                     patrolInspectionAbnormal.setPhone(inspectionPersonnelList.get(k).getPhoneNumber());
                                     break;
@@ -528,7 +532,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                             }
                             Integer planId = noPlanSonList.get(j).getPlanId();
                             for (int k = 0; k < noPlanIdList.size(); k++) {
-                                if(planId.equals(noPlanIdList.get(k).getId())){
+                                if (planId.equals(noPlanIdList.get(k).getId())) {
                                     patrolInspectionAbnormal.setRouteId(noPlanIdList.get(k).getRouteId());
                                     break;
                                 }
@@ -969,7 +973,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             for (int i = 0; i < planSonList.size(); i++) {
                 planSonidList.add(planSonList.get(i).getId());
             }
-            //巡检计划名称查询
+            // 巡检计划名称查询
             LambdaQueryWrapper<PatrolInspectionPlan> queryWrapperOne = Wrappers.lambdaQuery();
 //            queryWrapperOne.eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
 //            queryWrapperOne.eq(PatrolInspectionPlan::getEnable, 1);
@@ -979,8 +983,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             }
 
             List<PatrolInspectionPlan> planList = patrolInspectionPlanMapper.selectList(queryWrapperOne);
-            List<DataCountVo> patrolledSiteCountList = this.planSiteSonCount(planSonidList, 2);//已巡检地点数量
-            List<DataCountVo> undetectedSiteCountList = this.planSiteSonCount(planSonidList, 1);//漏检地点数量
+            List<DataCountVo> patrolledSiteCountList = this.planSiteSonCount(planSonidList, 2);// 已巡检地点数量
+            List<DataCountVo> undetectedSiteCountList = this.planSiteSonCount(planSonidList, 1);// 漏检地点数量
             for (int i = 0; i < planSonList.size(); i++) {
                 PatrolInspectionPlanSonVo patrolInspectionPlanSonVo = new PatrolInspectionPlanSonVo();
                 patrolInspectionPlanSonVo.setId(planSonList.get(i).getId());
@@ -994,7 +998,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                 patrolInspectionPlanSonVo.setInspectionDate(planSonList.get(i).getInspectionDate());
                 patrolInspectionPlanSonVo.setPatrolledSiteCount(0);
                 patrolInspectionPlanSonVo.setUndetectedSiteCount(0);
-                //计划名称
+                // 计划名称
                 for (int j = 0; j < planList.size(); j++) {
                     if (planSonList.get(i).getPlanId().equals(planList.get(j).getId())) {
                         patrolInspectionPlanSonVo.setPlanId(planList.get(j).getId());
@@ -1005,7 +1009,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                 Date currentTime = new Date();
                 Date endTime = null;
                 if (planSonList.get(i).getPlanType() == 1) {
-                    //获取结束日期时间
+                    // 获取结束日期时间
                     LocalDate inspectionDate = planSonList.get(i).getInspectionDate();
                     String inspectionDateOne = df1.format(inspectionDate);
                     String inspectionDateTwo = inspectionDateOne + " " + planSonList.get(i).getEndTime();
@@ -1015,14 +1019,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
 
                 } else {
-                    //获取结束日期时间
+                    // 获取结束日期时间
                     LocalDate endDate = planSonList.get(i).getEndDate();
                     String endDateOne = df1.format(endDate) + " 23:59:59";
                     try {
                         endTime = formatter.parse(endDateOne);
                     } catch (Exception e) {
                     }
-                    //计划类型描述
+                    // 计划类型描述
                     String planCycleName = null;
                     if (planSonList.get(i).getPlanCycle() == 1) {
                         planCycleName = "(日)";
@@ -1035,7 +1039,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
                     patrolInspectionPlanSonVo.setPlanTypeDescribe("按次计划" + planCycleName);
                 }
-                //判断计划状态
+                // 判断计划状态
                 int status = endTime.compareTo(currentTime);
                 if (status == -1) {
                     if (planSonList.get(i).getCompletion() == 100) {

+ 2 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmTimeConfServiceImpl.java

@@ -289,7 +289,8 @@ public class PmTimeConfServiceImpl extends AbstractCrudService<PmTimeConfMapper,
 
         LambdaQueryWrapper<PmWorkReport> reportQuery = new LambdaQueryWrapper<>();
         reportQuery.eq(PmWorkReport::getTenantId, tenantId)
-                .eq(PmWorkReport::getReportDate, countDate);
+                .eq(PmWorkReport::getReportDate, countDate)
+                .eq(PmWorkReport::getReportStatus, 1);
         switch (queryType) {
             // 按时提交
             case 0:

+ 5 - 4
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/PmWorkReportServiceImpl.java

@@ -421,13 +421,14 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                 }
             } else {
                 rp.setId(rid);
-                rp.setCcTo(ccTo);
                 rp.setCoordinateWork(pmWorkReport.getCoordinateWork());
                 rp.setTomorrowPlan(pmWorkReport.getTomorrowPlan());
                 rp.setUpdateBy(userName);
                 rp.setUpdateTime(dateTime);
+                rp.setTotalHours(totalWorkTime);
                 rp.setIsRegularlySend(pmWorkReport.getIsRegularlySend());
-                rp.setSendDingTalk(pmWorkReport.getSendDingTalk());
+                rp.setReportFile(pmWorkReport.getReportFile());
+                rp.setReportImage(pmWorkReport.getReportImage());
                 pmWorkReportMapper.updateById(rp);
 
                 pmWorkContentService.deleteContent(rid);
@@ -759,7 +760,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
                 .eq(SysUser::getStatus, 0)
                 .eq(SysUser::getDelFlag, 0)
                 .notIn(!userIds.isEmpty(), SysUser::getUserId, userIds);
-        userIds =  sysUserMapper.selectList(userQueryWrapper).stream().map(SysUser::getUserId).collect(Collectors.toList());
+        userIds = sysUserMapper.selectList(userQueryWrapper).stream().map(SysUser::getUserId).collect(Collectors.toList());
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("infoTitle", INFO_TITLE);
@@ -774,7 +775,7 @@ public class PmWorkReportServiceImpl extends AbstractCrudService<PmWorkReportMap
         try {
             remoteMceService.addMce(jsonObject.toString());
         } catch (Exception e) {
-            throw new BusinessException("报告提醒通知失败" + e);
+            log.error("报告提醒通知推送消息中心异常" + e);
         }
     }
 }