Browse Source

1.修改了一些关于巡检计划的相关bug
2.修改了巡检单dto 当前节点的返回内容

wanghs 2 years ago
parent
commit
29aa75bccc

+ 11 - 5
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/biz/InspectOrderBiz.java

@@ -19,7 +19,6 @@ import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
 import com.gyee.wisdom.alarm.sharding.util.SnowflakeGenerator;
 import com.gyee.wisdom.common.utils.DateUtil;
 import com.gyee.wisdom.common.utils.StringUtil;
-import com.mysql.cj.xdevapi.WarningImpl;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Component;
@@ -50,7 +49,7 @@ public class InspectOrderBiz {
         IPage<InspectOrder> inspectOrderByStep = getInspectOrderByStep(pageNum, pageSize, step, windturbineId, startTime, endTime);
         List<InspectOrderDto> inspectOrderDtos = packInspectOrderInspectOrderDto(inspectOrderByStep.getRecords());
         Page<InspectOrderDto> pageDto = new Page<>();
-        pageDto.setPages(inspectOrderByStep.getPages()).setRecords(inspectOrderDtos).setTotal(inspectOrderByStep.getTotal()).setCurrent(inspectOrderByStep.getCurrent());
+        pageDto.setPages(inspectOrderByStep.getPages()).setRecords(inspectOrderDtos).setTotal(inspectOrderByStep.getTotal()).setCurrent(inspectOrderByStep.getCurrent()).setSize(inspectOrderByStep.getSize());
         return pageDto;
     }
 
@@ -74,6 +73,8 @@ public class InspectOrderBiz {
 
         //获取id最大的数据
         EarlyReport lastEarlyReport = earlyReportService.findLastEarlyReport();
+        if(lastEarlyReport==null)
+            return resultList;
         // 根据最后一条数据获取报告生成日期
         Date date = DateUtil.truncate(lastEarlyReport.getReportDate());
         QueryWrapper<EarlyReport> wrapper = new QueryWrapper<EarlyReport>().ge("REPORTDATE", date);
@@ -179,8 +180,13 @@ public class InspectOrderBiz {
                         .setVerifyView(dto.getVerifyView())
                         .setVerifyResult(dto.isVerifyResult())
                         .setWindturbineId(dto.getWindturbineId())
-                        .setReportWindturbineId(dto.getReportWindturbineId())
-                        .setClosed(dto.isClosed());
+                        .setReportWindturbineId(dto.getReportWindturbineId());
+                //如果不需要巡检则,巡检单直接结束
+                if (!dto.isVerifyResult())
+                    order.setClosed(true);
+                else
+                    order.setClosed(false);
+
                 boolean saveInspectOrder = inspectOrderService.saveInspectOrder(order);
                 if (saveInspectOrder)
                     wrapper = ResponseWrapper.success("评审成功");
@@ -210,7 +216,7 @@ public class InspectOrderBiz {
                             .setInspectTime(dto.getInspectTime() == null ? new Date() : dto.getInspectTime())
                             .setInspectView(dto.getInspectView())
                             .setAccordreport(dto.isAccordreport())
-                            .setClosed(dto.isClosed());
+                            .setClosed(true);
                 } else {
                     return ResponseWrapper.error("系统异常,请联系管理员");
                 }

+ 3 - 3
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/model/InspectOrderDto.java

@@ -79,12 +79,12 @@ public class InspectOrderDto implements Serializable {
             if (inspectTime != null && createPlanTime != null && verifyTime != null) {
                 step = "已巡检";
             } else if (inspectTime == null && createPlanTime != null && verifyTime != null) {
-                step = "待巡检";
+                step = "已计划,待巡检";
 
             } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == true) {
-                step = "未计划";
+                step = "已评审,未计划";
             } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == false) {
-                step = "审核不通过";
+                step = "已评审,不巡检";
             } else {
                 return "";
             }

+ 12 - 10
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/EarlyReportService.java

@@ -61,19 +61,21 @@ public class EarlyReportService extends ServiceImpl<EarlyReportMapper, EarlyRepo
             report = earlyReportList.get(0);
 
             List<EarlyReportWindturbine> collect = report.getReportWindturbineInfoList().stream().filter(s -> s.isCompared()).collect(Collectors.toList());
+            if (collect.size() > 0) {
+                List<String> oldReportWindturbineIdList = collect.stream().map(s -> s.getCompareId()).collect(Collectors.toList());
 
-            List<String> oldReportWindturbineIdList = collect.stream().map(s -> s.getCompareId()).collect(Collectors.toList());
+                List<EarlyReportWindturbine> oldReportWindturbineList = earlyReportWindturbineService.getReportWindturbineByIds(oldReportWindturbineIdList);
 
-            List<EarlyReportWindturbine> oldReportWindturbineList = earlyReportWindturbineService.getReportWindturbineByIds(oldReportWindturbineIdList);
-
-            report.getReportWindturbineInfoList().forEach(s -> {
-                if (s.isCompared() && StringUtil.isNotBlank(s.getCompareId())) {
-                    Optional<EarlyReportWindturbine> first = oldReportWindturbineList.stream().filter(k -> k.getId().equals(s.getCompareId())).findFirst();
-                    if (first.isPresent()) {
-                        s.setCompareAlarmInfoList(first.get().getAlarmInfoList());
+                report.getReportWindturbineInfoList().forEach(s -> {
+                    if (s.isCompared() && StringUtil.isNotBlank(s.getCompareId())) {
+                        Optional<EarlyReportWindturbine> first = oldReportWindturbineList.stream().filter(k -> k.getId().equals(s.getCompareId())).findFirst();
+                        if (first.isPresent()) {
+                            s.setCompareAlarmInfoList(first.get().getAlarmInfoList());
+                        }
                     }
-                }
-            });
+                });
+            }
+
         }
 
         return report;

+ 13 - 1
warning-web/src/main/resources/mappers-oracle/Alertrule2Mapper.xml

@@ -61,7 +61,19 @@
         </where>
 
     </select>
-
+    <select id="getAllByStationIdAndModelId2" parameterType="java.util.Map"
+            resultMap="Alertrule2Result">
+        select * from  ALERTRULE2 a
+        <where>
+            1=1
+            <if test="station !=null and station !=''">
+                and a.station = #{station}
+            </if>
+            <if test="modelid !=null and modelid !=''">
+                and a.modelid = #{modelid}
+            </if>
+        </where>
+    </select>
     <select id="getMaxEdnaValue" parameterType="java.util.Map" resultType="java.lang.Integer">
         select max(a.ednavalue) from  ALERTRULE2 a
     </select>

+ 1 - 1
warning-web/src/main/resources/mappers-oracle/DatadictionaryMapper.xml

@@ -4,7 +4,7 @@
 
 
     <select id="selectBycode" parameterType="java.util.Map" resultType="com.gyee.wisdom.alarm.sharding.entity.Datadictionary">
-        select * from Datadictionary where code = #{relatedParts}
+        select * from Datadictionary where code = #{relatedParts} and category='alertrule_category'
     </select>