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
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/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,41 +1,42 @@ //package com.gkhy.fourierSpecialGasMonitor.schedule; // //import com.gkhy.fourierSpecialGasMonitor.entity.req.DeviceMonitorReqDTO; //import com.gkhy.fourierSpecialGasMonitor.entity.req.UploadGasConcentrationReqDTO; //import com.gkhy.fourierSpecialGasMonitor.entity.req.UploadGasFluxReqDTO; //import com.gkhy.fourierSpecialGasMonitor.service.DataReceiveService; //import org.slf4j.Logger; //import org.slf4j.LoggerFactory; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.scheduling.annotation.Async; //import org.springframework.scheduling.annotation.Scheduled; //import org.springframework.stereotype.Component; // //import javax.annotation.PostConstruct; //import java.text.DecimalFormat; //import java.time.LocalDateTime; //import java.time.format.DateTimeFormatter; //import java.util.ArrayList; //import java.util.List; //import java.util.Random; //import java.util.concurrent.TimeUnit; // ///** // * @author Mr.huang // * @decription // * @date 2023/8/22 13:49 // */ //@Component //public class TestSchedule { // // private final Logger logger = LoggerFactory.getLogger(this.getClass()); // // @Autowired // private DataReceiveService dataReceiveService; // // private static final DateTimeFormatter execformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // // 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; import com.gkhy.fourierSpecialGasMonitor.service.DataReceiveService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.text.DecimalFormat; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import java.util.Random; import java.util.concurrent.TimeUnit; /** * @author Mr.huang * @decription * @date 2023/8/22 13:49 */ @Component public class TestSchedule { private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private DataReceiveService dataReceiveService; private static final DateTimeFormatter execformatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // @Scheduled(cron = "1 * * * * ?") // @Async(value = "SocketTaskExecutor") // public void testDeviceMonitor() { @@ -49,8 +50,8 @@ // deviceMonitorReqDTO.setHardwareState(list); // dataReceiveService.deviceMonitor(deviceMonitorReqDTO); // } // // // @Scheduled(cron = "0/30 * * * * ?") // @Async(value = "SocketTaskExecutor") // public void testGasConcentration() { @@ -134,66 +135,69 @@ // dto.setGasValue30(result); // dataReceiveService.uploadGasConcentration(dto); // } // @Autowired private DataReceiveController dataReceiveController; @Scheduled(cron = "0/30 * * * * ?") // @Scheduled(cron = "0 0/15 * * * ?") // @Async(value = "SocketTaskExecutor") // public void testGasFlux() { // logger.info("【气体通量推送测试】:"+LocalDateTime.now().format(execformatter)); // for (int i = 1; i <= 8 ; i++) { // 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); // UploadGasFluxReqDTO dto = new UploadGasFluxReqDTO(); // dto.setEquipmentId("No-123456"); // dto.setTime(LocalDateTime.now()); // dto.setAreaId(i); // dto.setType(1); // dto.setWindSpeed(12.3); // dto.setWindDirection(56); // 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); // dataReceiveService.uploadGasFlux(dto); // } // // } //} @Async(value = "SocketTaskExecutor") public void testGasFlux() { logger.info("【气体通量推送测试】:"+LocalDateTime.now().format(execformatter)); 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"); String formattedDouble = decimalFormat.format(randomDouble); double result = Double.parseDouble(formattedDouble); UploadGasFluxReqDTO dto = new UploadGasFluxReqDTO(); dto.setEquipmentId("No-123456"); dto.setTime(LocalDateTime.now()); dto.setAreaId(i); dto.setType(1); dto.setWindSpeed(12.3); dto.setWindDirection(56); 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); 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,6 +283,7 @@ } catch (IllegalAccessException e) { logger.info("【警告】反射获取气体浓度失败"); } if (value != null) { if (value > threshold.get(i)) { Integer integer = gasExcCountMap.get(i); Integer count= integer + 1; @@ -297,6 +298,7 @@ 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(); }