src/main/java/com/gkhy/fourierSpecialGasMonitor/config/authorization/MyWebMvcConfigurerAdapter.java
@@ -20,7 +20,7 @@ public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/uploadtest/**").addResourceLocations("file:E:\\file\\fourier\\test\\"); //registry.addResourceHandler("/upload/**").addResourceLocations("file:/home/upload/laboratoryRiskManage/"); registry.addResourceHandler("/upload/**").addResourceLocations("file:/home/gkhy/upload/fourier/"); registry.addResourceHandler("/upload/**").addResourceLocations("file:/home/gkhy/upload/fourierSpecialgasMonitor/"); super.addResourceHandlers(registry); } } src/main/java/com/gkhy/fourierSpecialGasMonitor/config/authorization/TokenCheckWhiteListEnum.java
@@ -12,6 +12,7 @@ PATH_LICENSE("/sys/lic/**","授权证书查看",true), PATH_ACCOUNT_AUTH("/account/auth/**","用户认证",true), PATH_WEBSOCKET("/ws/**","websocket相关接口",true), PATH_DAILY_REPORT("/upload/**","日报获取接口",true), /*PATH_TEST_ACCOUNT("/account/user/**","账号测试接口",true), //basic部分测试接口 PATH_TEST_BASIC("/basic/**","账号测试接口",true), src/main/java/com/gkhy/fourierSpecialGasMonitor/controller/DataReceiveController.java
@@ -6,8 +6,17 @@ import com.gkhy.fourierSpecialGasMonitor.entity.req.UploadGasConcentrationReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.UploadGasFluxReqDTO; import com.gkhy.fourierSpecialGasMonitor.service.DataReceiveService; import org.redisson.api.RBucket; import org.redisson.api.RedissonClient; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; /** * @author Mr.huang @@ -20,6 +29,18 @@ @Autowired private DataReceiveService dataReceiveService; private final Logger logger = LoggerFactory.getLogger(this.getClass()); //@PostConstruct //private void clearGasConcentrationCache(){ // LocalDateTime time = LocalDateTime.now(); // String cacheName = time.format(formatter); // //清除redis缓存 // RBucket<Object> bucket = redissonClient.getBucket(gasConcentrationCachePrefix+cacheName); // if (bucket.isExists()) { // bucket.delete(); // } //} @PostMapping("/upload/gasConcentration") public ForeignResult uploadGasConcentration(@RequestBody UploadGasConcentrationReqDTO reqDto){ @@ -29,7 +50,8 @@ @PostMapping("/upload/gasFlux") public ForeignResult uploadGasFlux(@RequestBody UploadGasFluxReqDTO reqDto){ ForeignResult result = dataReceiveService.uploadGasFlux(reqDto); UploadGasFluxReqDTO uploadGasFluxReqDTO = reqDto.expansionFactor(); ForeignResult result = dataReceiveService.uploadGasFlux(uploadGasFluxReqDTO); return result; } src/main/java/com/gkhy/fourierSpecialGasMonitor/controller/GasWarnLogController.java
@@ -7,6 +7,7 @@ import com.gkhy.fourierSpecialGasMonitor.entity.req.GasWarnLogCountByTimeReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.GasWarnLogInfoReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.HandleGasWarnLogReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.WindRoseByTimeReqDTO; import com.gkhy.fourierSpecialGasMonitor.service.GasWarnLogService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -46,4 +47,10 @@ Result result = gasWarnLogService.gasWarnLogInfoByTime(gasWarnLogInfoReqDTO); return result; } @PostMapping("/gasWindRoseByTime") public Result gasWindRoseByTime(@RequestBody WindRoseByTimeReqDTO reqDTO){ Result result = gasWarnLogService.gasWindRoseByTime(reqDTO); return result; } } src/main/java/com/gkhy/fourierSpecialGasMonitor/entity/query/WindRoseTimeSlotQuery.java
对比新文件 @@ -0,0 +1,22 @@ package com.gkhy.fourierSpecialGasMonitor.entity.query; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import java.time.LocalDateTime; /** * @author Mr.huang * @decription * @date 2023/9/2 23:34 */ @Data @AllArgsConstructor @NoArgsConstructor public class WindRoseTimeSlotQuery { private LocalDateTime startTime; private LocalDateTime endTime; } src/main/java/com/gkhy/fourierSpecialGasMonitor/entity/req/UploadGasFluxReqDTO.java
@@ -1,8 +1,10 @@ package com.gkhy.fourierSpecialGasMonitor.entity.req; import com.gkhy.fourierSpecialGasMonitor.enums.WarningThresholdEnum; import lombok.Data; import javax.persistence.*; import java.lang.reflect.Field; import java.time.LocalDateTime; @@ -61,4 +63,68 @@ private Double gasValue19; private int gasName20; private Double gasValue20; public UploadGasFluxReqDTO expansionFactor(){ if (gasValue01 != null) { gasValue01 = Math.round(gasValue01 * 3600 * 100.0) / 100.0; } if (gasValue02 != null) { gasValue02 = Math.round(gasValue02 * 3600 * 100.0) / 100.0; } if (gasValue03 != null) { gasValue03 = Math.round(gasValue03 * 3.6 * 100.0) / 100.0; } if (gasValue04 != null) { gasValue04 = Math.round(gasValue04 * 3600 * 100.0) / 100.0; } if (gasValue05 != null) { gasValue05 = Math.round(gasValue05 * 3600 * 100.0) / 100.0; } if (gasValue06 != null) { gasValue06 = Math.round(gasValue06 * 3600 * 100.0) / 100.0; } if (gasValue07 != null) { gasValue07 = Math.round(gasValue07 * 3600 * 100.0) / 100.0; } if (gasValue08 != null) { gasValue08 = Math.round(gasValue08 * 3600 * 100.0) / 100.0; } if (gasValue09 != null) { gasValue09 = Math.round(gasValue09 * 3600 * 100.0) / 100.0; } if (gasValue10 != null) { gasValue10 = Math.round(gasValue10 * 3600 * 100.0) / 100.0; } if (gasValue11 != null) { gasValue11 = Math.round(gasValue11 * 3600 * 100.0) / 100.0; } if (gasValue12 != null) { gasValue12 = Math.round(gasValue12 * 3600 * 100.0) / 100.0; } if (gasValue13 != null) { gasValue13 = Math.round(gasValue13 * 3600 * 100.0) / 100.0; } if (gasValue14 != null) { gasValue14 = Math.round(gasValue14 * 3600 * 100.0) / 100.0; } if (gasValue15 != null) { gasValue15 = Math.round(gasValue15 * 3600 * 100.0) / 100.0; } if (gasValue16 != null) { gasValue16 = Math.round(gasValue16 * 3600 * 100.0) / 100.0; } if (gasValue17 != null) { gasValue17 = Math.round(gasValue17 * 3600 * 100.0) / 100.0; } if (gasValue18 != null) { gasValue18 = Math.round(gasValue18 * 3600 * 100.0) / 100.0; } if (gasValue19 != null) { gasValue19 = Math.round(gasValue19 * 3600 * 100.0) / 100.0; } if (gasValue20 != null) { gasValue20 = Math.round(gasValue20 * 3600 * 100.0) / 100.0; } return this; } } src/main/java/com/gkhy/fourierSpecialGasMonitor/entity/req/WindRoseByTimeReqDTO.java
对比新文件 @@ -0,0 +1,14 @@ package com.gkhy.fourierSpecialGasMonitor.entity.req; import lombok.Data; /** * @author Mr.huang * @decription * @date 2023/9/1 9:36 */ @Data public class WindRoseByTimeReqDTO { private Integer countTime; } src/main/java/com/gkhy/fourierSpecialGasMonitor/entity/resp/WindRoseByTimeRespDTO.java
对比新文件 @@ -0,0 +1,26 @@ package com.gkhy.fourierSpecialGasMonitor.entity.resp; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; /** * @author Mr.huang * @decription * @date 2023/9/1 10:01 */ @Data public class WindRoseByTimeRespDTO implements Serializable { private Long id; private String equipmentId; private LocalDateTime dataReceivingTime; private Double windSpeed; private int windDirection; } src/main/java/com/gkhy/fourierSpecialGasMonitor/enums/GasWarnTimesCountEnum.java
@@ -13,7 +13,7 @@ * @date 2023/9/2 23:31 */ @Getter public enum GasWarnTimesCountEnum { public enum GasWarnTimesCountEnum { TODAY(1,"今天"){ @Override src/main/java/com/gkhy/fourierSpecialGasMonitor/enums/WindRoseEnum.java
对比新文件 @@ -0,0 +1,72 @@ package com.gkhy.fourierSpecialGasMonitor.enums; import com.gkhy.fourierSpecialGasMonitor.entity.query.GasWarnTimesCountTimeSlotQuery; import com.gkhy.fourierSpecialGasMonitor.entity.query.WindRoseTimeSlotQuery; import lombok.Getter; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.temporal.TemporalAdjusters; /** * @author Mr.huang * @decription * @date 2023/9/2 23:31 */ @Getter public enum WindRoseEnum { ONE_HOUR(1,"1小时"){ @Override public WindRoseTimeSlotQuery getTimeSlotByStrategy() { LocalDateTime now = LocalDateTime.now(); LocalDateTime startTime = now.minusHours(1); return new WindRoseTimeSlotQuery(startTime,now); } }, SIX_HOURS(2,"6小时"){ @Override public WindRoseTimeSlotQuery getTimeSlotByStrategy() { LocalDateTime now = LocalDateTime.now(); LocalDateTime startTime = now.minusHours(6); return new WindRoseTimeSlotQuery(startTime,now); } }, IN_12_HOURS(3,"12小时"){ @Override public WindRoseTimeSlotQuery getTimeSlotByStrategy() { LocalDateTime now = LocalDateTime.now(); LocalDateTime startTime = now.minusHours(12); return new WindRoseTimeSlotQuery(startTime,now); } }, IN_24_HOURS(4,"24小时"){ @Override public WindRoseTimeSlotQuery getTimeSlotByStrategy() { LocalDateTime now = LocalDateTime.now(); LocalDateTime startTime = now.minusHours(24); return new WindRoseTimeSlotQuery(startTime,now); } }; private Integer state; private String description; WindRoseEnum(int state, String description) { this.state = state; this.description = description; } public static WindRoseEnum getQueryObject(Integer key){ for (WindRoseEnum value : WindRoseEnum.values()) { if (value.state.equals(key)){ return value; } } return ONE_HOUR; } public abstract WindRoseTimeSlotQuery getTimeSlotByStrategy(); } src/main/java/com/gkhy/fourierSpecialGasMonitor/repository/GasConcentrationRepository.java
@@ -8,10 +8,14 @@ import org.springframework.stereotype.Repository; import javax.persistence.OrderBy; import java.time.LocalDateTime; import java.util.List; @Repository public interface GasConcentrationRepository extends JpaRepository<GasConcentration,Long>, JpaSpecificationExecutor<GasConcentration> { @OrderBy("dataReceivingTime desc") GasConcentration findTopByOrderByDataReceivingTimeDesc(); List<GasConcentration> findAllByDataReceivingTimeBetweenOrderByDataReceivingTimeDesc(LocalDateTime startTime, LocalDateTime endTime); } src/main/java/com/gkhy/fourierSpecialGasMonitor/schedule/DailyReportSchedule.java
@@ -69,6 +69,8 @@ private final Logger logger = LoggerFactory.getLogger(this.getClass()); private static int serialNumber = 4; @Autowired private GasWarnLogService gasWarnLogService; @@ -90,13 +92,15 @@ @Autowired private MonitorDailyReportService monitorDailyReportService; @Scheduled(cron = "0 0 2 * * ?") //每天两点执行一次 //@Scheduled(cron = "0 0 2 * * ?") //每天两点执行一次 @Scheduled(cron = "0/30 * * * * ?") @Async(value = "SocketTaskExecutor") public void generateDailyReport() { LocalDateTime now = LocalDateTime.now(); String startTime = now.format(execformatter); RBucket<List<GasCategory>> bucket = redissonClient.getBucket("gas_category_cache_info"); List<GasCategory> gasCategories = bucket.get(); serialNumber = 4; logger.info("【##】开始生成日报 ,时间:"+startTime); OPCPackage opcPackage = null; //加载文档 @@ -191,9 +195,10 @@ List<GasConcentration> gasConcentrations = gasConcentrationService.listDatabyTimeSlot(LocalDateTime.of(now.minusDays(1).toLocalDate(), LocalTime.MIN) , LocalDateTime.of(now.minusDays(1).toLocalDate(), LocalTime.MAX)); if (!CollectionUtils.isEmpty(gasConcentrations)) { for (int i = 0; i < 30; i++) { //for (int i = 0; i < 30; i++) { for (int i = 0; i < gasCategories.size(); i++) { String series = gasCategories.get(i).getMolecularFormula() + "浓度观测结果"; String title = "—" + gasCategories.get(i).getMolecularFormula(); String title = gasCategories.get(i).getMolecularFormula(); drawLineChart(gasConcentrations, fileurl, series, title, gasCategories.get(i).getMolecularFormula(), i); } } @@ -207,9 +212,13 @@ Map<Integer, String> regionMap = allRegion.stream() .collect(Collectors.toMap(Region::getId, Region::getName)); if (!CollectionUtils.isEmpty(gasFluxes)) { for (int i = 1; i <= areaNum.size(); i++) { for (int j = 0; j < 20; j++) { drawBarChart(gasFluxes, fileurl, regionMap.get(i), "柱形图" + gasCategories.get(j).getMolecularFormula(), i, j + 1); for (int j = 0; j < gasCategories.size(); j++) { for (int i = 1; i <= areaNum.size(); i++) { //for (int j = 0; j < 20; j++) { int finalI = i; List<GasFlux> gasFluxesByArea = gasFluxes.stream().filter(gasFlux -> gasFlux.getAreaId() == finalI) .collect(Collectors.toList()); drawBarChart(gasFluxesByArea, fileurl, regionMap.get(i), gasCategories.get(j).getMolecularFormula(), i, j + 1); } } } @@ -265,6 +274,7 @@ value2.add(n); List<XWPFChart> charts = doc.getCharts(); serialNumber++; for (int k = 0; k < charts.size(); k++) { XWPFChart xwpfChart = charts.get(k); XDDFTitle xddfTitletitle = xwpfChart.getTitle(); @@ -283,9 +293,9 @@ Element aT = (Element) root.getElementsByTagName("a:t").item(0); // 获取 <a:t> 元素的文本内容 获取标题具体内容 String value = aT.getTextContent(); String chartTitle = "图"+(31 + i * j)+" "+i+"号厂区排放"+molecularFormula+"通量反演结果"; if ((i+"-"+j).equals(value)) { drawBarChartExec(charts.get(k), series2, x2, value2, chartTitle); String chartTitle = "图"+serialNumber+" "+i+"号厂区排放"+molecularFormula+"通量反演结果"; if ((j+"-"+i).equals(value)) { drawBarChartExec(charts.get(k), series2, x2, value2, chartTitle,molecularFormula); } } catch (ParserConfigurationException e) { e.printStackTrace(); @@ -393,12 +403,12 @@ public void drawBarChartExec(XWPFChart chart, String[] series, String[] categories, List<Number[]> values, String chartTitle) { List<Number[]> values, String chartTitle,String molecularFormula) { final List<XDDFChartData> data = chart.getChartSeries(); final XDDFBarChartData line = (XDDFBarChartData) data.get(0);//这里一般获取第一个,我们这里是折线图就是XDDFLineChartData line.getCategoryAxis().setTitle(chartTitle); line.getValueAxes().get(0).setTitle("C2H2 Emission Rate (ug/m^2/s)"); line.getValueAxes().get(0).setTitle(molecularFormula+" Emission Rate (ug/m^2/s)"); final int numOfPoints = categories.length; final String categoryDataRange = chart.formatRange(new CellRangeAddress(1, numOfPoints, 0, 0)); @@ -462,8 +472,8 @@ Map<String, Object> map = new HashMap<>(); map.put("${today}", today); map.put("${yesterday}", yesterday); map.put("${generalradius}","10"); map.put("${generalradiu}","20"); map.put("${generalradius}","1km"); map.put("${generalradiu}","300m"); List<GasWarnLog> gasWarnLogs = gasWarnLogService.listYesterday(); if (!CollectionUtils.isEmpty(gasWarnLogs)){ @@ -482,21 +492,21 @@ } String fiveGas = ""; String sixGas = ""; for (int i = 0; i < 6; i++) { for (int i = 0; i < 3; i++) { String name = gasCategories.get(i).getMolecularFormula()+"("+gasCategories.get(i).getName()+")"; name = name + "、"; if (i < 5){ if (i < 3){ fiveGas = fiveGas + name; if (i == 4){ if (i == 2){ int index = fiveGas.lastIndexOf("、"); fiveGas = fiveGas.substring(0, index)+"共五种"; fiveGas = fiveGas.substring(0, index)+"共三种"; } } if (i < 6){ if (i < 3){ sixGas = sixGas + name; if (i == 5){ if (i == 2){ int index = sixGas.lastIndexOf("、"); sixGas = sixGas.substring(0, index)+"共六种"; sixGas = sixGas.substring(0, index)+"共三种"; } } } src/main/java/com/gkhy/fourierSpecialGasMonitor/schedule/HeartbeatSchedule.java
@@ -25,7 +25,7 @@ * @decription * @date 2023/8/8 10:49 */ @Component //@Component public class HeartbeatSchedule { @Autowired src/main/java/com/gkhy/fourierSpecialGasMonitor/schedule/TestSchedule.java
@@ -1,5 +1,6 @@ //package com.gkhy.fourierSpecialGasMonitor.schedule; // //import com.gkhy.fourierSpecialGasMonitor.controller.DataReceiveController; //import com.gkhy.fourierSpecialGasMonitor.entity.req.DeviceMonitorReqDTO; //import com.gkhy.fourierSpecialGasMonitor.entity.req.UploadGasConcentrationReqDTO; //import com.gkhy.fourierSpecialGasMonitor.entity.req.UploadGasFluxReqDTO; @@ -36,110 +37,114 @@ // private static final DateTimeFormatter execformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // // // @Scheduled(cron = "1 * * * * ?") // @Async(value = "SocketTaskExecutor") // public void testDeviceMonitor() { // logger.info("【硬件设备一分钟一次推送测试】:" + LocalDateTime.now().format(execformatter)); // DeviceMonitorReqDTO deviceMonitorReqDTO = new DeviceMonitorReqDTO(); // deviceMonitorReqDTO.setTime(LocalDateTime.now()); // deviceMonitorReqDTO.setConState(0); // deviceMonitorReqDTO.setFluxState(0); // List<Integer> list = new ArrayList<>(); // list.add(0); // deviceMonitorReqDTO.setHardwareState(list); // dataReceiveService.deviceMonitor(deviceMonitorReqDTO); // } // //@Scheduled(cron = "1 * * * * ?") // //@Async(value = "SocketTaskExecutor") // //public void testDeviceMonitor() { // // logger.info("【硬件设备一分钟一次推送测试】:" + LocalDateTime.now().format(execformatter)); // // DeviceMonitorReqDTO deviceMonitorReqDTO = new DeviceMonitorReqDTO(); // // deviceMonitorReqDTO.setTime(LocalDateTime.now()); // // deviceMonitorReqDTO.setConState(0); // // deviceMonitorReqDTO.setFluxState(0); // // List<Integer> list = new ArrayList<>(); // // list.add(0); // // deviceMonitorReqDTO.setHardwareState(list); // // dataReceiveService.deviceMonitor(deviceMonitorReqDTO); // //} // // // //@Scheduled(cron = "0/30 * * * * ?") // //@Async(value = "SocketTaskExecutor") // //public void testGasConcentration() { // // logger.info("【气体实时浓度推送测试】:"+LocalDateTime.now().format(execformatter)); // // Random random = new Random(); // // double randomDouble = random.nextDouble() * 99.9 + 1; // 生成1到100之间的随机双精度数 // // DecimalFormat decimalFormat = new DecimalFormat("0.0"); // // String formattedDouble = decimalFormat.format(randomDouble); // // double result = Double.parseDouble(formattedDouble); // // UploadGasConcentrationReqDTO dto = new UploadGasConcentrationReqDTO(); // // dto.setEquipmentId("No-123456"); // // dto.setTime(LocalDateTime.now()); // // dto.setType(1); // // dto.setLng("东经43"); // // dto.setLat("北纬53"); // // dto.setAngle("60"); // // dto.setTemp(26.9); // // dto.setHumidity(63.3); // // dto.setWindSpeed(12.3); // // dto.setWindDirection(56); // // dto.setPressure(200.0); // // dto.setGasName01(1); // // dto.setGasValue01(result); // // dto.setGasName02(2); // // dto.setGasValue02(result); // // dto.setGasName03(3); // // dto.setGasValue03(result); // // dto.setGasName04(4); // // dto.setGasValue04(result); // // dto.setGasName05(5); // // dto.setGasValue05(result); // // dto.setGasName06(6); // // dto.setGasValue06(result); // // dto.setGasName07(7); // // dto.setGasValue07(result); // // dto.setGasName08(8); // // dto.setGasValue08(result); // // dto.setGasName09(9); // // dto.setGasValue09(result); // // dto.setGasName10(10); // // dto.setGasValue10(result); // // dto.setGasName11(11); // // dto.setGasValue11(result); // // dto.setGasName12(12); // // dto.setGasValue12(result); // // dto.setGasName13(13); // // dto.setGasValue13(result); // // dto.setGasName14(14); // // dto.setGasValue14(result); // // dto.setGasName15(15); // // dto.setGasValue15(result); // // dto.setGasName16(16); // // dto.setGasValue16(result); // // dto.setGasName17(17); // // dto.setGasValue17(result); // // dto.setGasName18(18); // // dto.setGasValue18(result); // // dto.setGasName19(19); // // dto.setGasValue19(result); // // dto.setGasName20(20); // // dto.setGasValue20(result); // // dto.setGasName21(21); // // dto.setGasValue21(result); // // dto.setGasName22(22); // // dto.setGasValue22(result); // // dto.setGasName23(23); // // dto.setGasValue23(result); // // dto.setGasName24(24); // // dto.setGasValue24(result); // // dto.setGasName25(25); // // dto.setGasValue25(result); // // dto.setGasName26(26); // // dto.setGasValue26(result); // // dto.setGasName27(27); // // dto.setGasValue27(result); // // dto.setGasName28(28); // // dto.setGasValue28(result); // // dto.setGasName29(29); // // dto.setGasValue29(result); // // dto.setGasName30(30); // // dto.setGasValue30(result); // // dataReceiveService.uploadGasConcentration(dto); // //} // // @Autowired // private DataReceiveController dataReceiveController; // // @Scheduled(cron = "0/30 * * * * ?") // @Async(value = "SocketTaskExecutor") // public void testGasConcentration() { // logger.info("【气体实时浓度推送测试】:"+LocalDateTime.now().format(execformatter)); // Random random = new Random(); // double randomDouble = random.nextDouble() * 99.9 + 1; // 生成1到100之间的随机双精度数 // DecimalFormat decimalFormat = new DecimalFormat("0.0"); // String formattedDouble = decimalFormat.format(randomDouble); // double result = Double.parseDouble(formattedDouble); // UploadGasConcentrationReqDTO dto = new UploadGasConcentrationReqDTO(); // dto.setEquipmentId("No-123456"); // dto.setTime(LocalDateTime.now()); // dto.setType(1); // dto.setLng("东经43"); // dto.setLat("北纬53"); // dto.setAngle("60"); // dto.setTemp(26.9); // dto.setHumidity(63.3); // dto.setWindSpeed(12.3); // dto.setWindDirection(56); // dto.setPressure(200.0); // dto.setGasName01(1); // dto.setGasValue01(result); // dto.setGasName02(2); // dto.setGasValue02(result); // dto.setGasName03(3); // dto.setGasValue03(result); // dto.setGasName04(4); // dto.setGasValue04(result); // dto.setGasName05(5); // dto.setGasValue05(result); // dto.setGasName06(6); // dto.setGasValue06(result); // dto.setGasName07(7); // dto.setGasValue07(result); // dto.setGasName08(8); // dto.setGasValue08(result); // dto.setGasName09(9); // dto.setGasValue09(result); // dto.setGasName10(10); // dto.setGasValue10(result); // dto.setGasName11(11); // dto.setGasValue11(result); // dto.setGasName12(12); // dto.setGasValue12(result); // dto.setGasName13(13); // dto.setGasValue13(result); // dto.setGasName14(14); // dto.setGasValue14(result); // dto.setGasName15(15); // dto.setGasValue15(result); // dto.setGasName16(16); // dto.setGasValue16(result); // dto.setGasName17(17); // dto.setGasValue17(result); // dto.setGasName18(18); // dto.setGasValue18(result); // dto.setGasName19(19); // dto.setGasValue19(result); // dto.setGasName20(20); // dto.setGasValue20(result); // dto.setGasName21(21); // dto.setGasValue21(result); // dto.setGasName22(22); // dto.setGasValue22(result); // dto.setGasName23(23); // dto.setGasValue23(result); // dto.setGasName24(24); // dto.setGasValue24(result); // dto.setGasName25(25); // dto.setGasValue25(result); // dto.setGasName26(26); // dto.setGasValue26(result); // dto.setGasName27(27); // dto.setGasValue27(result); // dto.setGasName28(28); // dto.setGasValue28(result); // dto.setGasName29(29); // dto.setGasValue29(result); // dto.setGasName30(30); // dto.setGasValue30(result); // dataReceiveService.uploadGasConcentration(dto); // } // // @Scheduled(cron = "0 0/15 * * * ?") // //@Scheduled(cron = "0 0/15 * * * ?") // @Async(value = "SocketTaskExecutor") // public void testGasFlux() { // logger.info("【气体通量推送测试】:"+LocalDateTime.now().format(execformatter)); // for (int i = 1; i <= 8 ; i++) { // for (int i = 1; i <= 6 ; i++) { // Random random = new Random(); // double randomDouble = random.nextDouble() * 99.9 + 1; // 生成1到100之间的随机双精度数 // DecimalFormat decimalFormat = new DecimalFormat("0.0"); @@ -192,8 +197,7 @@ // dto.setGasValue19(result); // dto.setGasName20(20); // dto.setGasValue20(result); // dataReceiveService.uploadGasFlux(dto); // dataReceiveController.uploadGasFlux(dto); // } // // } //} src/main/java/com/gkhy/fourierSpecialGasMonitor/service/GasWarnLogService.java
@@ -7,6 +7,7 @@ import com.gkhy.fourierSpecialGasMonitor.entity.req.GasWarnLogCountByTimeReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.GasWarnLogInfoReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.HandleGasWarnLogReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.WindRoseByTimeReqDTO; import java.util.List; @@ -28,4 +29,6 @@ Result gasWarnLogInfoByTime(GasWarnLogInfoReqDTO gasWarnLogInfoReqDTO); Result gasWindRoseByTime(WindRoseByTimeReqDTO reqDTO); } src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/DataReceiveServiceImpl.java
@@ -157,7 +157,7 @@ @Override public ForeignResult uploadGasFlux(UploadGasFluxReqDTO reqDto) { gasFluxParameterVerification(reqDto); //gasFluxParameterVerification(reqDto); GasFlux gasFlux = new GasFlux(); BeanUtils.copyProperties(reqDto,gasFlux); gasFlux.setDataReceivingTime(LocalDateTime.now()); @@ -240,7 +240,7 @@ @Override @Transactional public ForeignResult uploadGasConcentration(UploadGasConcentrationReqDTO reqDto) { gasConcentrationParameterVerification(reqDto); //gasConcentrationParameterVerification(reqDto); GasConcentration gasConcentration = new GasConcentration(); BeanUtils.copyProperties(reqDto,gasConcentration); gasConcentration.setDataReceivingTime(LocalDateTime.now()); @@ -283,20 +283,22 @@ } catch (IllegalAccessException e) { logger.info("【警告】反射获取气体浓度失败"); } if (value > threshold.get(i)) { Integer integer = gasExcCountMap.get(i); Integer count= integer + 1; gasExcCountMap.put(i,count); if (yellowWarningThreshold.equals(count)) { warnLogGenerateAndExecPush(WarningThresholdEnum.YELLOW.getCode(), gasCategory.get(i),value); } if (redWarningThreshold.equals(count)) { warnLogGenerateAndExecPush(WarningThresholdEnum.RED.getCode(), gasCategory.get(i),value); } } else { Integer integer = gasExcCountMap.get(i); if (integer != null) { gasExcCountMap.put(i,0); if (value != null) { if (value > threshold.get(i)) { Integer integer = gasExcCountMap.get(i); Integer count = integer + 1; gasExcCountMap.put(i, count); if (yellowWarningThreshold.equals(count)) { warnLogGenerateAndExecPush(WarningThresholdEnum.YELLOW.getCode(), gasCategory.get(i), value); } if (redWarningThreshold.equals(count)) { warnLogGenerateAndExecPush(WarningThresholdEnum.RED.getCode(), gasCategory.get(i), value); } } else { Integer integer = gasExcCountMap.get(i); if (integer != null) { gasExcCountMap.put(i, 0); } } } } @@ -415,66 +417,66 @@ throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"实时风向数据为空"); if (reqDto.getPressure() == null) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"实时气压数据为空"); if (reqDto.getGasName01() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类01编号异常"); if (reqDto.getGasName02() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类02编号异常"); if (reqDto.getGasName03() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类03编号异常"); if (reqDto.getGasName04() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类04编号异常"); if (reqDto.getGasName05() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类05编号异常"); if (reqDto.getGasName06() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类06编号异常"); if (reqDto.getGasName07() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类07编号异常"); if (reqDto.getGasName08() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类08编号异常"); if (reqDto.getGasName09() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类09编号异常"); if (reqDto.getGasName10() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类10编号异常"); if (reqDto.getGasName11() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类11编号异常"); if (reqDto.getGasName12() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类12编号异常"); if (reqDto.getGasName13() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类13编号异常"); if (reqDto.getGasName14() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类14编号异常"); if (reqDto.getGasName15() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类15编号异常"); if (reqDto.getGasName16() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类16编号异常"); if (reqDto.getGasName17() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类17编号异常"); if (reqDto.getGasName18() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类18编号异常"); if (reqDto.getGasName19() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类19编号异常"); if (reqDto.getGasName20() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类20编号异常"); if (reqDto.getGasName21() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类21编号异常"); if (reqDto.getGasName22() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类22编号异常"); if (reqDto.getGasName23() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类23编号异常"); if (reqDto.getGasName24() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类24编号异常"); if (reqDto.getGasName25() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类25编号异常"); if (reqDto.getGasName26() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类26编号异常"); if (reqDto.getGasName27() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类27编号异常"); if (reqDto.getGasName28() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类28编号异常"); if (reqDto.getGasName29() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类29编号异常"); if (reqDto.getGasName30() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类30编号异常"); //if (reqDto.getGasName01() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类01编号异常"); //if (reqDto.getGasName02() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类02编号异常"); //if (reqDto.getGasName03() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类03编号异常"); //if (reqDto.getGasName04() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类04编号异常"); //if (reqDto.getGasName05() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类05编号异常"); //if (reqDto.getGasName06() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类06编号异常"); //if (reqDto.getGasName07() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类07编号异常"); //if (reqDto.getGasName08() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类08编号异常"); //if (reqDto.getGasName09() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类09编号异常"); //if (reqDto.getGasName10() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类10编号异常"); //if (reqDto.getGasName11() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类11编号异常"); //if (reqDto.getGasName12() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类12编号异常"); //if (reqDto.getGasName13() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类13编号异常"); //if (reqDto.getGasName14() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类14编号异常"); //if (reqDto.getGasName15() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类15编号异常"); //if (reqDto.getGasName16() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类16编号异常"); //if (reqDto.getGasName17() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类17编号异常"); //if (reqDto.getGasName18() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类18编号异常"); //if (reqDto.getGasName19() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类19编号异常"); //if (reqDto.getGasName20() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类20编号异常"); //if (reqDto.getGasName21() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类21编号异常"); //if (reqDto.getGasName22() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类22编号异常"); //if (reqDto.getGasName23() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类23编号异常"); //if (reqDto.getGasName24() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类24编号异常"); //if (reqDto.getGasName25() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类25编号异常"); //if (reqDto.getGasName26() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类26编号异常"); //if (reqDto.getGasName27() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类27编号异常"); //if (reqDto.getGasName28() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类28编号异常"); //if (reqDto.getGasName29() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类29编号异常"); //if (reqDto.getGasName30() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类30编号异常"); } private void gasFluxParameterVerification(UploadGasFluxReqDTO reqDto){ @@ -492,46 +494,46 @@ throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"实时风速数据为空"); if (reqDto.getWindDirection() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"实时风向数据为空"); if (reqDto.getGasName01() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类01编号异常"); if (reqDto.getGasName02() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类02编号异常"); if (reqDto.getGasName03() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类03编号异常"); if (reqDto.getGasName04() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类04编号异常"); if (reqDto.getGasName05() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类05编号异常"); if (reqDto.getGasName06() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类06编号异常"); if (reqDto.getGasName07() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类07编号异常"); if (reqDto.getGasName08() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类08编号异常"); if (reqDto.getGasName09() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类09编号异常"); if (reqDto.getGasName10() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类10编号异常"); if (reqDto.getGasName11() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类11编号异常"); if (reqDto.getGasName12() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类12编号异常"); if (reqDto.getGasName13() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类13编号异常"); if (reqDto.getGasName14() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类14编号异常"); if (reqDto.getGasName15() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类15编号异常"); if (reqDto.getGasName16() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类16编号异常"); if (reqDto.getGasName17() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类17编号异常"); if (reqDto.getGasName18() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类18编号异常"); if (reqDto.getGasName19() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类19编号异常"); if (reqDto.getGasName20() <= 0) throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类20编号异常"); //if (reqDto.getGasName01() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类01编号异常"); //if (reqDto.getGasName02() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类02编号异常"); //if (reqDto.getGasName03() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类03编号异常"); //if (reqDto.getGasName04() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类04编号异常"); //if (reqDto.getGasName05() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类05编号异常"); //if (reqDto.getGasName06() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类06编号异常"); //if (reqDto.getGasName07() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类07编号异常"); //if (reqDto.getGasName08() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类08编号异常"); //if (reqDto.getGasName09() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类09编号异常"); //if (reqDto.getGasName10() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类10编号异常"); //if (reqDto.getGasName11() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类11编号异常"); //if (reqDto.getGasName12() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类12编号异常"); //if (reqDto.getGasName13() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类13编号异常"); //if (reqDto.getGasName14() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类14编号异常"); //if (reqDto.getGasName15() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类15编号异常"); //if (reqDto.getGasName16() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类16编号异常"); //if (reqDto.getGasName17() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类17编号异常"); //if (reqDto.getGasName18() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类18编号异常"); //if (reqDto.getGasName19() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类19编号异常"); //if (reqDto.getGasName20() <= 0) // throw new DataReceiveException(this.getClass(), ForeignResultCode.PARAM_ERROR_NULL.getCode(),"气体种类20编号异常"); } src/main/java/com/gkhy/fourierSpecialGasMonitor/service/impl/GasWarnLogServiceImpl.java
@@ -8,18 +8,20 @@ import com.gkhy.fourierSpecialGasMonitor.domain.account.entity.User; import com.gkhy.fourierSpecialGasMonitor.domain.account.enums.UserStatusEnum; import com.gkhy.fourierSpecialGasMonitor.domain.account.repository.jpa.UserRepository; import com.gkhy.fourierSpecialGasMonitor.entity.GasConcentration; import com.gkhy.fourierSpecialGasMonitor.entity.GasWarnLog; import com.gkhy.fourierSpecialGasMonitor.entity.query.FindGasWarnLogPageQuery; import com.gkhy.fourierSpecialGasMonitor.entity.query.GasWarnTimesCountTimeSlotQuery; import com.gkhy.fourierSpecialGasMonitor.entity.query.WindRoseTimeSlotQuery; import com.gkhy.fourierSpecialGasMonitor.entity.req.GasWarnLogCountByTimeReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.GasWarnLogInfoReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.HandleGasWarnLogReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.resp.FindGasWarnLogPageRespDTO; import com.gkhy.fourierSpecialGasMonitor.entity.resp.FindGasWarnLogSmsUserPageRespDTO; import com.gkhy.fourierSpecialGasMonitor.entity.resp.GasWarnLogCountByTimeRespDTO; import com.gkhy.fourierSpecialGasMonitor.entity.resp.GasWarnLogInfoByTimeRespDTO; import com.gkhy.fourierSpecialGasMonitor.entity.req.WindRoseByTimeReqDTO; import com.gkhy.fourierSpecialGasMonitor.entity.resp.*; import com.gkhy.fourierSpecialGasMonitor.enums.GasWarnTimesCountEnum; import com.gkhy.fourierSpecialGasMonitor.enums.WarnHandleStatusEnum; import com.gkhy.fourierSpecialGasMonitor.enums.WindRoseEnum; import com.gkhy.fourierSpecialGasMonitor.repository.GasConcentrationRepository; import com.gkhy.fourierSpecialGasMonitor.repository.GasWarnLogRepository; import com.gkhy.fourierSpecialGasMonitor.service.GasWarnLogService; import com.gkhy.fourierSpecialGasMonitor.utils.ThreadLocalUtil; @@ -34,6 +36,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; @@ -53,6 +56,9 @@ @Autowired private GasWarnLogRepository gasWarnLogRepository; @Resource private GasConcentrationRepository gasConcentrationRepository; @Autowired private UserRepository userRepository; @@ -191,6 +197,25 @@ } @Override public Result gasWindRoseByTime(WindRoseByTimeReqDTO reqDTO) { if (reqDTO == null && reqDTO .getCountTime() == null) throw new BusinessException(this.getClass(), ResultCode.PARAM_ERROR_NULL,"参数不能为空"); Integer countTime = reqDTO.getCountTime(); WindRoseTimeSlotQuery query = WindRoseEnum.getQueryObject(countTime).getTimeSlotByStrategy(); Result result = Result.success(); List<GasConcentration> gasConcentrations = gasConcentrationRepository.findAllByDataReceivingTimeBetweenOrderByDataReceivingTimeDesc(query.getStartTime(), query.getEndTime()); if (CollectionUtils.isEmpty(gasConcentrations)) return result; List<WindRoseByTimeRespDTO> collect = gasConcentrations.stream().map(gasConcentration -> { WindRoseByTimeRespDTO dto = new WindRoseByTimeRespDTO(); BeanUtils.copyProperties(gasConcentration, dto); return dto; }).collect(Collectors.toList()); result.setData(collect); return result; } @Override public Result gasWarnLogInfoByTime(GasWarnLogInfoReqDTO gasWarnLogInfoReqDTO) { LocalDateTime now = LocalDateTime.now(); LocalDateTime startTime = now.with(LocalTime.MIN); src/main/java/com/gkhy/fourierSpecialGasMonitor/websocket/GasConcentrationExcWebsocketServer.java
@@ -118,7 +118,7 @@ */ @OnError public void onError(Session session, Throwable error) { log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //error.printStackTrace(); } src/main/java/com/gkhy/fourierSpecialGasMonitor/websocket/GasConcentrationWebsocketServer.java
@@ -116,7 +116,7 @@ */ @OnError public void onError(Session session, Throwable error) { log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //error.printStackTrace(); } src/main/java/com/gkhy/fourierSpecialGasMonitor/websocket/GasDeviceExcWebsocketServer.java
@@ -116,7 +116,7 @@ */ @OnError public void onError(Session session, Throwable error) { log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //error.printStackTrace(); } src/main/java/com/gkhy/fourierSpecialGasMonitor/websocket/GasFluxWebsocketServer.java
@@ -116,7 +116,7 @@ */ @OnError public void onError(Session session, Throwable error) { log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //error.printStackTrace(); } src/main/java/com/gkhy/fourierSpecialGasMonitor/websocket/HeartbeatExcWebsocketServer.java
@@ -116,7 +116,7 @@ */ @OnError public void onError(Session session, Throwable error) { log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //log.error("用户错误:" + this.userId + ",原因:" + error.getMessage()); //error.printStackTrace(); } src/main/resources/template/dailyReportTemplate.docxBinary files differ