15928045575 2 лет назад
Родитель
Сommit
69aed727ff

+ 5 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/dos/mysql/KwsDevice.java

@@ -131,6 +131,11 @@ public class KwsDevice implements Serializable {
      */
     private String relevanceLevel;
 
+    /**
+     * 维修电话
+     */
+    private String servicePhones;
+
     private static final long serialVersionUID = 1L;
 
 }

+ 6 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/param/DeviceAdd.java

@@ -83,6 +83,12 @@ public class DeviceAdd {
     @NotNull(message = "是否关联设备不能为空")
     private Integer related;
 
+    /**
+     * 维修电话
+     */
+    @NotBlank(message = "维修电话不能为空")
+    private String  servicePhones;
+
     /**
      * 接口
      */

+ 5 - 0
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/model/vo/DeviceVo.java

@@ -205,6 +205,11 @@ public class DeviceVo implements Serializable {
      */
     private List<Object> data;
 
+    /**
+     * data
+     */
+    private String servicePhones;
+
 
 
 

+ 1 - 1
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/DeviceService.java

@@ -349,7 +349,7 @@ public class DeviceService {
         List<DeviceIntegrationVo> intergData = new ArrayList<>();
 //        intergData = deviceIntegrationMapper.selectListByParamsAndInterName(vo);
         intergData = deviceIntegrationMapper.selectListParamsAndInterNameByDeviceId(vo.getId());
-        if (!Objects.isNull(intergData)) {
+        if (!Objects.isNull(intergData) && insTables != null) {
             for (DeviceIntegrationVo inter : intergData) {
                 List<SlopeData> slopeData = slopeDataMapper.selectListByTwoLine(snCode, inter.getPartNames());//获取到当前测量值--现在只有单一值
                 if (!Objects.isNull(slopeData) && slopeData.size()>0) {

+ 23 - 25
slope-modules/slope-detection/src/main/java/com/sckw/slope/detection/service/task/ReportTemplateTaskService.java

@@ -26,6 +26,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 import org.springframework.util.CollectionUtils;
+
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.net.MalformedURLException;
@@ -62,52 +63,48 @@ public class ReportTemplateTaskService {
     @Autowired
     SlopeDataMapper slopeDataMapper;
 
-    public void report(KwsReportTemplate kwsReportTemplate,String date1,String date2) throws NoSuchAlgorithmException, IOException {
+    public void report(KwsReportTemplate kwsReportTemplate, String date1, String date2) throws NoSuchAlgorithmException, IOException {
 
-        String[] title  = "推送时间".split(",");
+        String[] title = "推送时间".split(",");
         String[] part = kwsReportTemplate.getPartNames().split(",");
         String[] intergration = kwsReportTemplate.getIntergrationNames().split(",");
         List<String> list = new ArrayList<>();
         list.addAll(Arrays.asList(title));
         list.addAll(Arrays.asList(part));
-        list.addAll(Arrays.asList(intergration));
+        //list.addAll(Arrays.asList(intergration));
         String projectId = kwsReportTemplate.getProjectId();
         //首先查询模板中的要素关联的设备-项目中的设备
         List<DeviceVo> devices = reportTemplateMapper.selectDeviceByProjectId(projectId, list);
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         //List<Object> deviceName = new ArrayList<>();
-        List<Map<String,Object>> deviceData = new ArrayList<>();
-        Map<String,List<Object>> map1 = new HashMap<>();
-        for (DeviceVo vo : devices){
+        List<Map<String, Object>> deviceData = new ArrayList<>();
+        Map<String, List<Object>> map1 = new HashMap<>();
+        for (DeviceVo vo : devices) {
             List<SlopeData> selectedData = slopeDataMapper.selectLineListByList(vo.getSnCode(), list, "2022-1-1 00:00:00", date2);
             if (Objects.nonNull(selectedData)) {
                 Map<String, List<SlopeData>> map = selectedData.stream().collect(Collectors.groupingBy(SlopeData::getMsgId));
 
                 List<Object> list1 = new ArrayList<>();
-
-
-                map.forEach((key,value) -> {
+                for (List<SlopeData> value : map.values()) {
                     List<Object> listObject = new ArrayList<>();
-                    value.forEach(valuetemp->{
-                        listObject.add(sdf.format(valuetemp.getTs()));
-                        for (int i = 0;i< list.size();i++){
-                            if(valuetemp.getLine().equals(list.get(i))){
-                                listObject.add(valuetemp.getVal());
-                            }else{
-                                listObject.add("");
+                    listObject.add(sdf.format(value.get(0).getTs()));
+                    for (int i = 1; i < list.size(); i++) {
+                        for (SlopeData slopeData : value) {
+                            if (slopeData.getLine().equals(list.get(i))) {
+                                listObject.add(slopeData.getVal());
                             }
                         }
-                    });
+                    }
                     list1.add(listObject);
-                });
+                }
 
-                map1.put(vo.getName(),list1);
+                map1.put(vo.getName(), list1);
             }
         }
         ExcelContext excelContext = TaskReportExportVO.class.getAnnotation(ExcelContext.class);
-        if(devices.size()>0) {
+        if (devices.size() > 0) {
             String md5 = returnMd5();
-            String filePath = ExcelUtil.taskExportByExcelUploadingToOss(map1,devices, md5 + ".xlsx", TaskReportExportVO.class,list);
+            String filePath = ExcelUtil.taskExportByExcelUploadingToOss(map1, devices, md5 + ".xlsx", TaskReportExportVO.class, list);
             //生成的日报新增到kws_report_data
             URL url = new URL(filePath);
             URLConnection connection = url.openConnection();
@@ -131,7 +128,7 @@ public class ReportTemplateTaskService {
     /**
      * 报表生成定时任务-天
      */
-    //@Scheduled(cron = "* * * * * *")
+    // @Scheduled(cron = "* * * * * *")
     public void templateTaskDay() throws IOException, NoSuchAlgorithmException {
         List<KwsReportTemplate> kwsReportTemplates = reportTemplateMapper.selectList(new LambdaQueryWrapper<KwsReportTemplate>()
                 .eq(KwsReportTemplate::getStatus, 0)
@@ -145,11 +142,12 @@ public class ReportTemplateTaskService {
                     LocalDateTime dateStart = com.sckw.excel.utils.DateUtil.localDateToLocalDateTimeStart(localDateTime.toLocalDate());
                     String date1 = dateStart.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
                     String date2 = dateEnd.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                    report(kwsReportTemplate,date1,date2);
+                    report(kwsReportTemplate, date1, date2);
                 }
             }
         }
     }
+
     public String returnMd5() throws NoSuchAlgorithmException {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String currentTime = sdf.format(new Date());
@@ -192,7 +190,7 @@ public class ReportTemplateTaskService {
                     LocalDateTime dateStart = com.sckw.excel.utils.DateUtil.localDateToLocalDateTimeStart(localDateTime.toLocalDate());
                     String date1 = dateStart.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
                     String date2 = dateEnd.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                    report(kwsReportTemplate,date1,date2);
+                    report(kwsReportTemplate, date1, date2);
                 }
             }
         }
@@ -215,7 +213,7 @@ public class ReportTemplateTaskService {
                     LocalDateTime dateStart = com.sckw.excel.utils.DateUtil.localDateToLocalDateTimeStart(localDateTime.toLocalDate());
                     String date1 = dateStart.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
                     String date2 = dateEnd.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-                    report(kwsReportTemplate,date1,date2);
+                    report(kwsReportTemplate, date1, date2);
                 }
             }
         }

+ 2 - 2
slope-modules/slope-detection/src/main/resources/mapper/mysql/KwsReportDataMapper.xml

@@ -50,11 +50,11 @@
   <insert id="insert" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsReportData">
     <!--@mbg.generated-->
     insert into kws_report_data (id,mountain_id,company_id, template_id, project_id,
-      project_name, file_size, file_url,create_time
+      project_name, file_size, file_url,create_time,del_flag
       )
     values (#{id,jdbcType=BIGINT}, #{mountainId,jdbcType=BIGINT}, #{companyId,jdbcType=BIGINT},
       #{templateId,jdbcType=VARCHAR}, #{projectId,jdbcType=BIGINT}, #{projectName,jdbcType=VARCHAR},
-      #{fileSize,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP})
+      #{fileSize,jdbcType=VARCHAR}, #{fileUrl,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=BIGINT})
   </insert>
   <insert id="insertSelective" parameterType="com.sckw.slope.detection.model.dos.mysql.KwsReportData">
     <!--@mbg.generated-->