浏览代码

1.添加字典缓存
2.添加巡检单功能
3.risksnap添加字段 riskModelId 关联风险模型

wanghs 2 年之前
父节点
当前提交
9933d14f16
共有 16 个文件被更改,包括 760 次插入8 次删除
  1. 308 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/biz/InspectOrderBiz.java
  2. 37 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/cache/DataDictionaryCache.java
  3. 40 5
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/HomeController.java
  4. 84 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/InspectOrderController.java
  5. 4 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/EarlyReport.java
  6. 7 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/EarlyReportWindturbine.java
  7. 97 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/InspectOrder.java
  8. 4 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/RiskSnap.java
  9. 6 2
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/mapper/EarlyReportMapper.java
  10. 27 1
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/mapper/EarlyReportWindturbineMapper.java
  11. 14 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/mapper/InspectOrderMapper.java
  12. 89 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/model/InspectOrderDto.java
  13. 6 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/EarlyReportService.java
  14. 15 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/EarlyReportWindturbineService.java
  15. 16 0
      warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/InspectOrderService.java
  16. 6 0
      warning-web/src/main/resources/mappers/InspectOrderMapper.xml

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

@@ -0,0 +1,308 @@
+package com.gyee.wisdom.alarm.sharding.biz;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.wisdom.alarm.sharding.cache.DataDictionaryCache;
+import com.gyee.wisdom.alarm.sharding.entity.Alertrule2;
+import com.gyee.wisdom.alarm.sharding.entity.EarlyReport;
+import com.gyee.wisdom.alarm.sharding.entity.EarlyReportWindturbine;
+import com.gyee.wisdom.alarm.sharding.entity.InspectOrder;
+import com.gyee.wisdom.alarm.sharding.model.InspectOrderDto;
+import com.gyee.wisdom.alarm.sharding.service.EarlyReportService;
+import com.gyee.wisdom.alarm.sharding.service.EarlyReportWindturbineService;
+import com.gyee.wisdom.alarm.sharding.service.InspectOrderService;
+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;
+
+import javax.annotation.Resource;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-09-12
+ */
+@Component
+public class InspectOrderBiz {
+
+    @Resource
+    private EarlyReportWindturbineService earlyReportWindturbineService;
+
+    @Resource
+    private InspectOrderService inspectOrderService;
+
+    @Resource
+    private EarlyReportService earlyReportService;
+
+    public IPage<InspectOrderDto> getInspectOrderDtoPage(Integer pageNum, Integer pageSize, String windturbineId, Optional<Integer> step, Date startTime, Date endTime) {
+        //节点 1-待审核,2-已审核,3-未计划,4-已计划,5-未巡检,6-已巡检
+        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());
+        return pageDto;
+    }
+
+    public List<InspectOrderDto> getInspectOrderDtoPage(String stationId, String windturbineId) {
+        List<EarlyReportWindturbine> noVerifiedPort = getNoVerifiedPort(stationId, windturbineId);
+        List<InspectOrderDto> inspectOrderDtos = packWindturbineReportInspectOrderDto(noVerifiedPort);
+        return inspectOrderDtos;
+    }
+
+    /**
+     * @param
+     * @return
+     * @return java.util.List<com.gyee.wisdom.alarm.sharding.entity.EarlyReportWindturbine>
+     * @author Wanghs
+     * @description 获取最近的一批报告,没有被审核过的风机报告
+     * @date 2022/9/12
+     **/
+    private List<EarlyReportWindturbine> getNoVerifiedPort(String stationId, String windturbineId) {
+
+        List<EarlyReportWindturbine> resultList = new ArrayList<>();
+
+        //获取id最大的数据
+        EarlyReport lastEarlyReport = earlyReportService.findLastEarlyReport();
+        // 根据最后一条数据获取报告生成日期
+        Date date = DateUtil.truncate(lastEarlyReport.getReportDate());
+        QueryWrapper<EarlyReport> wrapper = new QueryWrapper<EarlyReport>().ge("REPORTDATE", date);
+        List<EarlyReport> earlyReportList = earlyReportService.list(wrapper);
+        List<String> collect = earlyReportList.stream().map(s -> s.getId()).collect(Collectors.toList());
+        List<EarlyReportWindturbine> reportWindturbineList = earlyReportWindturbineService.getReportWindturbineByReportId(collect);
+        //筛选出 不是对比数据,且不是全场平局,且没有审核过的数据
+        reportWindturbineList = reportWindturbineList.stream().filter(s -> s.isVerified() == false && s.isCompared() == false && !s.getWindturbineId().equals("全场平均")).collect(Collectors.toList());
+
+        if (StringUtil.isNotBlank(windturbineId))
+            reportWindturbineList = reportWindturbineList.stream().filter(s -> s.getWindturbineId().equals(windturbineId)).collect(Collectors.toList());
+        if (StringUtils.isNotBlank(stationId))
+            reportWindturbineList = reportWindturbineList.stream().filter(s -> s.getEarlyReport().getStationId().equals(stationId)).collect(Collectors.toList());
+
+        return reportWindturbineList;
+
+    }
+
+    private List<InspectOrderDto> packWindturbineReportInspectOrderDto(List<EarlyReportWindturbine> earlyReportWindturbineList) {
+        List<InspectOrderDto> resultList = new ArrayList<>();
+
+        earlyReportWindturbineList.stream().forEach(s -> {
+
+            InspectOrderDto dto = new InspectOrderDto()
+                    .setReportWindturbineId(s.getId())
+                    .setWindturbineId(s.getWindturbineId())
+                    .setWindpowerStationId(s.getEarlyReport().getStationId())
+                    .setEarlyReport(true)
+                    .setEarlyReportWindturbine(s);
+            resultList.add(dto);
+        });
+        return resultList;
+    }
+
+
+    private IPage<InspectOrder> getInspectOrderByStep(int pageNum, int pageSize, Optional<Integer> step, String windturbineId, Date startTime, Date endTime) {
+        List<InspectOrder> resultList = new ArrayList<>();
+        //节点 1-待审核,2-已审核,3-未计划,4-已计划,5-未巡检,6-已巡检
+        QueryWrapper<InspectOrder> wrapper = new QueryWrapper<>();
+
+        if (step.isPresent()) {
+            if (step.get() == 2 || step.get() == 3) {
+                wrapper.isNotNull("VERIFYTIME");//评审时间不为空
+                wrapper.isNull("CREATEPLANTIME");//计划时间为空
+                wrapper.isNull("INSPECTTIME");//巡检时间为空
+            } else if (step.get() == 4 || step.get() == 5) {
+                wrapper.isNotNull("VERIFYTIME");//评审时间不为空
+                wrapper.isNotNull("CREATEPLANTIME");//计划时间不为空
+                wrapper.isNull("INSPECTTIME");//巡检时间为空
+            } else if (step.get() == 6) {
+                wrapper.isNotNull("VERIFYTIME");//评审时间不为空
+                wrapper.isNotNull("CREATEPLANTIME");//计划时间不为空
+                wrapper.isNotNull("INSPECTTIME");//巡检时间不为空
+            }
+        }
+
+        if (StringUtil.isNotBlank(windturbineId))
+            wrapper.eq("WINDTURBINEID", windturbineId);
+        if (startTime != null)
+            wrapper.gt("VERIFYTIME", startTime);
+        if (endTime != null)
+            wrapper.lt("VERIFYTIME", endTime);
+
+        Page<InspectOrder> page = new Page(pageNum, pageSize);
+
+        IPage<InspectOrder> pageResult = inspectOrderService.page(page, wrapper);
+
+
+
+        if (pageResult.getRecords().size() > 0) {
+            List<EarlyReportWindturbine> reportWindturbineById = earlyReportWindturbineService.getReportWindturbineById(pageResult.getRecords().stream().map(s -> s.getReportWindturbineId()).collect(Collectors.toList()));
+            pageResult.getRecords().forEach(s -> {
+                Optional<EarlyReportWindturbine> first = reportWindturbineById.stream().filter(k -> k.getId().equals(s.getReportWindturbineId())).findFirst();
+                if (first.isPresent())
+                    s.setEarlyReportWindturbine(first.get());
+            });
+        }
+
+        return pageResult;
+    }
+
+    private List<InspectOrderDto> packInspectOrderInspectOrderDto(List<InspectOrder> orderList) {
+        List<InspectOrderDto> resultList = new ArrayList<>();
+
+        orderList.stream().forEach(s -> {
+            InspectOrderDto dto = new InspectOrderDto();
+            BeanUtils.copyProperties(s, dto);
+            dto.setEarlyReport(false);
+            resultList.add(dto);
+        });
+
+        return resultList;
+    }
+
+    public ResponseWrapper updateInspectOrder(String user, InspectOrderDto dto) {
+        ResponseWrapper wrapper = null;
+        //代表为 报告评审环节,因此需要 向InspectOrder表中新增数据
+        if (StringUtils.isBlank(dto.getId())) {
+
+            InspectOrder order = new InspectOrder();
+            order.setId(String.valueOf(SnowflakeGenerator.generateId()))
+                    .setVerifyTime(new Date())
+                    .setVerifyUser(user)
+                    .setVerifyView(dto.getVerifyView())
+                    .setVerifyResult(dto.isVerifyResult())
+                    .setClosed(dto.isClosed());
+
+            boolean save = inspectOrderService.save(order);
+            if (save)
+                wrapper = ResponseWrapper.success("评审成功");
+            else
+                wrapper = ResponseWrapper.error("评审失败");
+        } else {
+            InspectOrder order = inspectOrderService.getById(dto.getId());
+
+            if (order == null) {
+                wrapper = ResponseWrapper.error("找不到对应的巡检单");
+            } else {
+                //计划环节
+                if (dto.getCreatePlanTime() != null) {
+                    order.setCreatePlanUser(user)
+                            .setCreatePlanTime(dto.getCreatePlanTime())
+                            .setPlanStartTime(dto.getPlanStartTime())
+                            .setPlanEndTime(dto.getPlanEndTime());
+                }
+                //巡检环节
+                if (dto.getInspectTime() != null) {
+                    order.setInspectUser(user)
+                            .setInspectTime(dto.getInspectTime())
+                            .setInspectView(dto.getInspectView())
+                            .setAccordreport(dto.isAccordreport())
+                            .setClosed(dto.isClosed());
+                }
+
+                boolean b = inspectOrderService.updateById(order);
+                if (b)
+                    wrapper = ResponseWrapper.success("更新成功");
+                else
+                    wrapper = ResponseWrapper.error("更新失败");
+
+            }
+        }
+        return wrapper;
+    }
+
+    public JSONObject getOrderCountInfo(String stationId) {
+
+        Map<String, Integer> inspectOrderCount = getInspectOrderCount(stationId);
+        Map<String, Integer> noVerifyReport = getNoVerifyReport(stationId);
+
+      String dicString="";
+        JSONObject orderObject = new JSONObject();
+        JSONObject reportObject = new JSONObject();
+        for (Map.Entry<String, Integer> entry :
+                inspectOrderCount.entrySet()) {
+            orderObject.put(entry.getKey(), entry.getValue());
+        }
+        for (Map.Entry<String, Integer> entry :
+                noVerifyReport.entrySet()) {
+            reportObject.put(entry.getKey(), entry.getValue());
+            String partName = DataDictionaryCache.getPartName(entry.getKey());
+          dicString=dicString+","+entry.getKey()+"-"+partName;
+        }
+        dicString=dicString+",YSH-已审核,WJH-未计划,YJH-已计划,DXJ-待巡检,YXJ-已巡检";
+
+        JSONObject resultObject = new JSONObject();
+        resultObject.put("report", reportObject);
+        resultObject.put("order", orderObject);
+        resultObject.put("dic",dicString);
+        return resultObject;
+    }
+
+    public Map<String, Integer> getInspectOrderCount(String stationId) {
+
+        List<InspectOrder> list = new ArrayList<>();
+        if (StringUtils.isNotBlank(stationId)) {
+            QueryWrapper<InspectOrder> wrapper = new QueryWrapper<>();
+            wrapper.eq("WINDPOWERSTATIONID", stationId);
+            list = inspectOrderService.list(wrapper);
+        } else {
+            list = inspectOrderService.list();
+        }
+
+        //已审核
+        List<InspectOrder> ysh_collect = list.stream().filter(s -> s.getVerifyTime() != null && s.getCreatePlanTime() == null && s.getInspectTime() == null).collect(Collectors.toList());
+
+        //待计划
+        List<InspectOrder> wjh_collect = list.stream().filter(s -> s.getVerifyTime() != null && s.getCreatePlanTime() == null && s.getInspectTime() == null && s.isClosed() == false).collect(Collectors.toList());
+
+        //已计划 待巡检
+        List<InspectOrder> yjh_collect = list.stream().filter(s -> s.getVerifyTime() != null && s.getCreatePlanTime() != null && s.getInspectTime() == null).collect(Collectors.toList());
+
+        //已巡检
+        List<InspectOrder> yxj_collect = list.stream().filter(s -> s.getVerifyTime() != null && s.getCreatePlanTime() != null && s.getInspectTime() != null && s.isClosed() == true).collect(Collectors.toList());
+
+        Map<String, Integer> resultMap = new HashMap<>();
+
+        resultMap.put("YSH", ysh_collect.size());
+        resultMap.put("WJH", wjh_collect.size());
+        resultMap.put("YJH", yjh_collect.size());
+        resultMap.put("DXJ", yjh_collect.size());
+        resultMap.put("YXJ", yxj_collect.size());
+
+        return resultMap;
+
+    }
+
+    public Map<String, Integer> getNoVerifyReport(String stationId) {
+
+        Map<String, Integer> resultMap = new HashMap<>();
+
+        Map<String, List<EarlyReportWindturbine>> map = new HashMap<>();
+        List<EarlyReportWindturbine> noVerifiedPort = getNoVerifiedPort(stationId, "");
+        for (EarlyReportWindturbine windturbine :
+                noVerifiedPort) {
+            String relatedParts = windturbine.getEarlyReport().getRelatedParts();
+            if (!map.containsKey(relatedParts)) {
+                map.put(relatedParts, new ArrayList<>());
+            }
+            List<EarlyReportWindturbine> earlyReportWindturbines = map.get(relatedParts);
+            earlyReportWindturbines.add(windturbine);
+        }
+
+        for (Map.Entry<String, List<EarlyReportWindturbine>> entry :
+                map.entrySet()) {
+            if (!resultMap.containsKey(entry.getKey())) {
+                resultMap.put(entry.getKey(), entry.getValue().size());
+            }
+        }
+
+        return resultMap;
+    }
+}

+ 37 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/cache/DataDictionaryCache.java

@@ -0,0 +1,37 @@
+package com.gyee.wisdom.alarm.sharding.cache;
+
+import com.gyee.wisdom.alarm.sharding.entity.Datadictionary;
+import com.gyee.wisdom.alarm.sharding.service.DatadictionaryService;
+import com.gyee.wisdom.alarm.sharding.util.SpringContextUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-09-12
+ */
+public class DataDictionaryCache {
+
+    private static List<Datadictionary> dataDictionaryList = new ArrayList<>();
+
+    public static String getPartName(String code) {
+        if (dataDictionaryList == null || dataDictionaryList.size() <= 0)
+            initList();
+        Optional<Datadictionary> partDataDictionary = dataDictionaryList.stream().filter(s -> s.getCategory().equals("alertrule_category") && s.getCode().equals(code)).findFirst();
+
+        if (partDataDictionary.isPresent())
+            return partDataDictionary.get().getName();
+        else
+            return "";
+    }
+
+    private static void initList() {
+        DatadictionaryService bean = SpringContextUtil.getBean(DatadictionaryService.class);
+        List<Datadictionary> allDatadictionary = bean.list();
+
+        dataDictionaryList = allDatadictionary;
+    }
+}

+ 40 - 5
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/HomeController.java

@@ -1,10 +1,16 @@
 package com.gyee.wisdom.alarm.sharding.controller;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.gyee.wisdom.alarm.sharding.biz.InspectOrderBiz;
+import com.gyee.wisdom.alarm.sharding.entity.Alertrule2;
 import com.gyee.wisdom.alarm.sharding.model.AlarmCountStat;
 import com.gyee.wisdom.alarm.sharding.model.AlarmHome;
 import com.gyee.wisdom.alarm.sharding.service.AlarmCountService;
 import com.gyee.wisdom.alarm.sharding.service.AlarmSnapService;
+import com.gyee.wisdom.alarm.sharding.service.Alertrule2Service;
 import com.gyee.wisdom.alarm.sharding.service.RiskSnapService;
 import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
 import io.swagger.v3.oas.annotations.Operation;
@@ -36,18 +42,23 @@ public class HomeController {
     private RiskSnapService riskSnapService;
 
     @Autowired
-    private AlarmCountService alarmCountService;
+    private Alertrule2Service alertrule2Service;
+
+    @Autowired
+    private InspectOrderBiz inspectOrderBiz;
 
+    @Autowired
+    private AlarmCountService alarmCountService;
 
     @Operation(description = "报警总数查询")
-    @GetMapping("early/latest")
+    @GetMapping("/early/latest")
     public ResponseWrapper selectAlarmCount(
             @Parameter(name = "stationId", description = "场站id") @RequestParam(value = "stationId") String stationId
     ){
 
         ResponseWrapper wrapper = null;
         try {
-            Map<String,List<AlarmHome>> stringListMap = alarmSnapService.selectAlarmSnapCount(stationId);
+            Map<String, List<AlarmHome>> stringListMap = alarmSnapService.selectAlarmSnapCount(stationId);
             Map<String, List<AlarmHome>> stringListMap2 = riskSnapService.selectRiskSnapCount(stationId);
             stringListMap.putAll(stringListMap2);
             wrapper = ResponseWrapper.success("请求成功", stringListMap);
@@ -58,6 +69,31 @@ public class HomeController {
 
     }
 
+    @Operation(description = "风机部件查询接口")
+    @GetMapping("/alertrule")
+    public ResponseWrapper selectAlertrule2(
+            @RequestParam(value = "station",required = false) String station,
+            @RequestParam(value = "modelid",required = false) String modelid
+    ) {
+
+        ResponseWrapper wrapper = null;
+        try {
+            Map<String, Integer> alertrule2s = alertrule2Service.queryList(station, modelid);
+            wrapper = ResponseWrapper.success("请求成功", alertrule2s);
+        } catch (Exception ex) {
+            wrapper = ResponseWrapper.error("请求失败", JSON.toJSONString(ex.getStackTrace()));
+        }
+        return wrapper;
+
+    }
+    @Operation(description = "巡检单数量统计")
+    @GetMapping("/ordercount")
+    public ResponseWrapper getInspectOrderCountInfo(@Parameter(name = "stationId", description = "场站id") @RequestParam(value = "stationId", required = false) String stationId) {
+        ResponseWrapper wrapper = null;
+        JSONObject orderCountInfo = inspectOrderBiz.getOrderCountInfo(stationId);
+        wrapper = ResponseWrapper.success("请求成功", orderCountInfo);
+        return wrapper;
+    }
     @Operation(description = "首页明细分析")
     @GetMapping("/total/duration")
     public ResponseWrapper selectTotalDuration(){
@@ -87,6 +123,5 @@ public class HomeController {
         return wrapper;
 
     }
-
-
 }
+

+ 84 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/controller/InspectOrderController.java

@@ -0,0 +1,84 @@
+package com.gyee.wisdom.alarm.sharding.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.gyee.wisdom.alarm.sharding.biz.InspectOrderBiz;
+import com.gyee.wisdom.alarm.sharding.entity.Alertrule2;
+import com.gyee.wisdom.alarm.sharding.model.InspectOrderDto;
+import com.gyee.wisdom.alarm.sharding.util.ResponseWrapper;
+import com.gyee.wisdom.alarm.sharding.util.TokenUtil;
+import com.gyee.wisdom.alarm.sharding.util.UserLoginToken;
+import io.jsonwebtoken.Claims;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import java.util.Date;
+import java.util.List;
+import java.util.Optional;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-09-09
+ */
+
+@RestController
+@RequestMapping("/inspectorder")
+@CrossOrigin
+@Tag(name = "检修计划")
+public class InspectOrderController {
+
+    @Resource
+    private InspectOrderBiz inspectOrderBiz;
+
+    @Operation(description = "分页查询隐患巡检单")
+    @GetMapping("/order/page")
+    public ResponseWrapper getInspectOrderPage(
+            @Parameter(name = "pagenum", description = "当前页") @RequestParam(value = "pagenum", required = true) Integer pageNum,
+            @Parameter(name = "pagesize", description = "分页大小") @RequestParam(value = "pagesize", required = true) Integer pageSize,
+            @Parameter(name = "step", description = "节点 1-待审核,2-已审核,3-未计划,4-已计划,5-未巡检,6-已巡检") @RequestParam(value = "step", required = false) Optional<Integer> step,
+            @Parameter(name = "windturbineId", description = "风机编号") @RequestParam(value = "windturbineId", required = false) String windturbineId,
+            @Parameter(name = "startTime", description = "起始时间") @RequestParam(value = "startTime", required = false) Date startTime,
+            @Parameter(name = "endTime", description = "结束时间") @RequestParam(value = "endTime", required = false) Date endTime
+
+    ) {
+
+        ResponseWrapper wrapper = null;
+        IPage<InspectOrderDto> inspectOrderDtoPage = inspectOrderBiz.getInspectOrderDtoPage(pageNum, pageSize, windturbineId, step, startTime, endTime);
+
+        wrapper = new ResponseWrapper<>().success("请求成功", inspectOrderDtoPage);
+        return wrapper;
+    }
+
+    @Operation(description = "分页查询隐患报告(待审核报告)")
+    @GetMapping("/port/list")
+    public ResponseWrapper getNoVerifiedPort(
+            @Parameter(name = "stationId", description = "场站id") @RequestParam(value = "stationId", required = false) String stationId,
+            @Parameter(name = "windturbineId", description = "风机编号") @RequestParam(value = "windturbineId", required = false) String windturbineId
+    ) {
+        List<InspectOrderDto> inspectOrderDtoPage = inspectOrderBiz.getInspectOrderDtoPage(stationId,windturbineId);
+        ResponseWrapper wrapper = ResponseWrapper.success("请求成功", inspectOrderDtoPage);
+        return wrapper;
+    }
+
+    @UserLoginToken
+    @Operation(description = "审核诊断报告")
+    @PostMapping("/update")
+    public ResponseWrapper saveInspectOrder(HttpServletRequest request, @RequestBody InspectOrderDto inspectOrderDto) {
+
+        String token = request.getHeader("token");
+        Claims claims = TokenUtil.parseJWT(token);
+        String userName = claims.get("jti").toString();
+
+        ResponseWrapper ResponseWrapper = null;
+        //如果id为空,则代表报告评审,否则代表更新流程
+        ResponseWrapper = inspectOrderBiz.updateInspectOrder(userName, inspectOrderDto);
+        return ResponseWrapper;
+    }
+
+
+}

+ 4 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/EarlyReport.java

@@ -38,6 +38,10 @@ public class EarlyReport {
     @TableField("STATIONNAME")
     private String stationName;
 
+    //关联大部件
+    @TableField("RELATEDPARTS")
+    private String relatedParts;
+
     //分析起始日期
     @TableField("STATSTARTDATE")
     private Date statStartDate;

+ 7 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/EarlyReportWindturbine.java

@@ -50,6 +50,13 @@ public class EarlyReportWindturbine {
     @TableField("REPORTID")
     private String reportId;
 
+    //是否已审核
+    @TableField("VERIFIED")
+    private boolean verified;
+
+    @TableField(exist = false)
+    private EarlyReport earlyReport;
+
     @TableField(exist = false)
     private List<EarlyReportAlarm> alarmInfoList;
 

+ 97 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/InspectOrder.java

@@ -0,0 +1,97 @@
+package com.gyee.wisdom.alarm.sharding.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @description: 诊断报告审核结果表
+ * @auther: Wanghs
+ * @date: 2022-09-09
+ */
+@Data
+@Accessors(chain = true)
+@TableName("INSPECTORDER")
+public class InspectOrder implements Serializable {
+
+    @TableId
+    private String id;
+    //风机编号
+    @TableField("WINDTURBINEID")
+    private String windturbineId;
+    //风场id
+    @TableField("WINDPOWERSTATIONID")
+    private String windpowerStationId;
+    //诊断报告风机表 id
+    @TableField("REPORTWINDTURBINEID")
+    private String reportWindturbineId;
+    //评审人
+    @TableField("VERIFYUSER")
+    private String verifyUser;
+    //评审时间
+    @TableField("VERIFYTIME")
+    private Date verifyTime;
+    //评审结论
+    @TableField("VERIFYVIEW")
+    private String verifyView;
+    //评审结果 0-不巡检 1-巡检
+    @TableField("VERIFYRESULT")
+    private boolean verifyResult;
+    // 创建计划人
+    @TableField("CREATEPLANUSER")
+    private String createPlanUser;
+    //创建计划时间
+    @TableField("CREATEPLANTIME")
+    private Date createPlanTime;
+    //计划开始时间
+    @TableField("PLANSTARTTIME")
+    private Date planStartTime;
+    //计划结束时间
+    @TableField("PLANENDTIME")
+    private Date planEndTime;
+    //巡检人
+    @TableField("INSPECTUSER")
+    private String inspectUser;
+    //巡检时间
+    @TableField("INSPECTTIME")
+    private Date inspectTime;
+    //巡检结论
+    @TableField("INSPECTVIEW")
+    private String inspectView;
+    //巡检结果是否符合报告结论
+    @TableField("ACCORDREPORT")
+    private boolean accordreport;
+    //0-未关闭  1-已关闭
+    @TableField("CLOSED")
+    private boolean closed;
+
+    @TableField(exist = false)
+    private EarlyReportWindturbine earlyReportWindturbine;
+
+    @TableField(exist = false)
+    private String step;
+
+    private String getStep() {
+        String result = "";
+        if (inspectTime != null && createPlanTime != null && verifyTime != null) {
+            result = "已巡检";
+        } else if (inspectTime == null && createPlanTime != null && verifyTime != null) {
+            result = "待巡检";
+
+        } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == true) {
+            result = "未计划";
+        } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == false) {
+            result="审核不通过";
+        }else{
+            return "";
+        }
+        return step;
+    }
+
+
+}

+ 4 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/entity/RiskSnap.java

@@ -54,6 +54,10 @@ public class RiskSnap  implements Serializable {
     @TableField("PARTS")
     private String parts;
 
+    //模型id
+    @TableField("RISKMODELID")
+    private String riskModelId;
+
     //最后更新时间
     @TableField("LASTUPDATETIME")
     private Date lastUpdateTime;

+ 6 - 2
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/mapper/EarlyReportMapper.java

@@ -25,7 +25,7 @@ public interface EarlyReportMapper extends BaseMapper<EarlyReport> {
                     many = @Many(select = "com.gyee.wisdom.alarm.sharding.mapper.EarlyReportWindturbineMapper.findByReportId")
 
             )})
-    List<EarlyReport> findEarlyReportByDate( @Param("stationId")String stationId,  @Param("startTime")Date startTime, @Param("endTime")Date endTime);
+    List<EarlyReport> findEarlyReportByDate(@Param("stationId") String stationId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
 
     @Select("select * from EARLYREPORT where ID=#{id}")
     @Results({
@@ -37,5 +37,9 @@ public interface EarlyReportMapper extends BaseMapper<EarlyReport> {
                     many = @Many(select = "com.gyee.wisdom.alarm.sharding.mapper.EarlyReportWindturbineMapper.findByReportId")
 
             )})
-    List<EarlyReport> findEarlyReportById( @Param("id")String id);
+    List<EarlyReport> findEarlyReportById(@Param("id") String id);
+
+    @Select(" select * from EARLYREPORT where id=(select max(id) from EARLYREPORT) ")
+    EarlyReport findLastReport();
+
 }

+ 27 - 1
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/mapper/EarlyReportWindturbineMapper.java

@@ -34,6 +34,32 @@ public interface EarlyReportWindturbineMapper extends BaseMapper<EarlyReportWind
                     column = "id",
                     javaType = List.class,
                     many = @Many(select = "com.gyee.wisdom.alarm.sharding.mapper.EarlyReportAlarmMapper.findByWindturbineReportId")
-            )})
+            ),
+            @Result(
+                    property = "earlyReport",
+                    column = "REPORTID",
+                    javaType = EarlyReport.class,
+                    one = @One(select = "com.gyee.wisdom.alarm.sharding.mapper.EarlyReportMapper.selectById")
+            )
+    })
     List<EarlyReportWindturbine> findByIds(@Param("idList") List<String> idList);
+
+    @Select("<script>select * from EARLYREPORTWINDTURBINE where REPORTID in <foreach item='item' index='index' collection='reportIdList'  open='(' separator=',' close=')'>#{item} </foreach></script>")
+    @Results({
+            @Result(id = true, column = "id", property = "id"),
+            @Result(
+                    property = "alarmInfoList",
+                    column = "id",
+                    javaType = List.class,
+                    many = @Many(select = "com.gyee.wisdom.alarm.sharding.mapper.EarlyReportAlarmMapper.findByWindturbineReportId")
+            ),
+            @Result(
+                    property = "earlyReport",
+                    column = "REPORTID",
+                    javaType = EarlyReport.class,
+                    one = @One(select = "com.gyee.wisdom.alarm.sharding.mapper.EarlyReportMapper.selectById")
+            )
+    })
+    List<EarlyReportWindturbine> findByReportIds(@Param("reportIdList") List<String> reportIdList);
+
 }

+ 14 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/mapper/InspectOrderMapper.java

@@ -0,0 +1,14 @@
+package com.gyee.wisdom.alarm.sharding.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.gyee.wisdom.alarm.sharding.entity.InspectOrder;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-09-09
+ */
+@Mapper
+public interface InspectOrderMapper extends BaseMapper<InspectOrder> {
+}

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

@@ -0,0 +1,89 @@
+package com.gyee.wisdom.alarm.sharding.model;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.gyee.wisdom.alarm.sharding.entity.EarlyReport;
+import com.gyee.wisdom.alarm.sharding.entity.EarlyReportAlarm;
+import com.gyee.wisdom.alarm.sharding.entity.EarlyReportWindturbine;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-09-09
+ */
+@Data
+@Accessors(chain = true)
+public class InspectOrderDto implements Serializable {
+
+    private String id;
+    //风机编号
+    private String windturbineId;
+    //风场id
+    private String windpowerStationId;
+    //诊断报告风机表 id
+    private String reportWindturbineId;
+    //评审人
+    private String verifyUser;
+    //评审时间
+    private Date verifyTime;
+    //评审结论
+    private String verifyView;
+    //评审结果 0-不巡检 1-巡检
+    private boolean verifyResult;
+    // 创建计划人
+    private String createPlanUser;
+    //创建计划时间
+    private Date createPlanTime;
+    //计划开始时间
+    private Date planStartTime;
+    //计划结束时间
+    private Date planEndTime;
+    //巡检人
+    private String inspectUser;
+    //巡检时间
+    private Date inspectTime;
+    //巡检结论
+    private String inspectView;
+    //巡检结果是否符合报告结论
+    private boolean accordreport;
+    //0-未关闭  1-已关闭
+    private boolean closed;
+    //是否已审核
+    private boolean earlyReport;
+
+    private EarlyReportWindturbine earlyReportWindturbine;
+
+    private String step;
+
+    private String getStep() {
+        String result = "";
+
+        if(earlyReport){
+            result="待审核";
+        }else{
+            if (inspectTime != null && createPlanTime != null && verifyTime != null) {
+                result = "已巡检";
+            } else if (inspectTime == null && createPlanTime != null && verifyTime != null) {
+                result = "待巡检";
+
+            } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == true) {
+                result = "未计划";
+            } else if (inspectTime == null && createPlanTime == null && verifyTime != null && verifyResult == false) {
+                result="审核不通过";
+            }else{
+                return "";
+            }
+        }
+
+        return step;
+    }
+
+
+
+}

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

@@ -79,5 +79,11 @@ public class EarlyReportService extends ServiceImpl<EarlyReportMapper, EarlyRepo
         return report;
     }
 
+    public EarlyReport findLastEarlyReport() {
+        EarlyReport lastReport = baseMapper.findLastReport();
+
+        return lastReport;
+    }
+
 
 }

+ 15 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/EarlyReportWindturbineService.java

@@ -28,4 +28,19 @@ public class EarlyReportWindturbineService extends ServiceImpl<EarlyReportWindtu
         return reportWindturbineList;
 
     }
+
+    /**
+     * @param
+     * @param reportIdList
+     * @return java.util.List<com.gyee.wisdom.alarm.sharding.entity.EarlyReportWindturbine>
+     * @author Wanghs
+     * @description 根据EarlyReport 的id 获取EarlyReportWindturbine
+     * @date 2022/9/12
+     **/
+
+    public List<EarlyReportWindturbine> getReportWindturbineByReportId(List<String> reportIdList) {
+        List<EarlyReportWindturbine> byReportIds = this.baseMapper.findByReportIds(reportIdList);
+        return byReportIds;
+
+    }
 }

+ 16 - 0
warning-web/src/main/java/com/gyee/wisdom/alarm/sharding/service/InspectOrderService.java

@@ -0,0 +1,16 @@
+package com.gyee.wisdom.alarm.sharding.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.gyee.wisdom.alarm.sharding.entity.InspectOrder;
+import com.gyee.wisdom.alarm.sharding.mapper.InspectOrderMapper;
+import org.springframework.stereotype.Service;
+
+/**
+ * @description:
+ * @auther: Wanghs
+ * @date: 2022-09-09
+ */
+@Service
+public class InspectOrderService extends ServiceImpl<InspectOrderMapper, InspectOrder> {
+
+}

+ 6 - 0
warning-web/src/main/resources/mappers/InspectOrderMapper.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.gyee.wisdom.alarm.sharding.mapper.InspectOrderMapper">
+
+
+</mapper>