diff --git a/pqs-prepare/prepare-api/pom.xml b/pqs-prepare/prepare-api/pom.xml index 7af3263c8..986f3ec05 100644 --- a/pqs-prepare/prepare-api/pom.xml +++ b/pqs-prepare/prepare-api/pom.xml @@ -12,11 +12,6 @@ 预处理对外接口模块 - - com.njcn - common-core - ${project.version} - com.njcn common-db diff --git a/pqs-prepare/prepare-boot/pom.xml b/pqs-prepare/prepare-boot/pom.xml index b0cb9cd80..a8c73cdb8 100644 --- a/pqs-prepare/prepare-boot/pom.xml +++ b/pqs-prepare/prepare-boot/pom.xml @@ -19,32 +19,6 @@ - - com.njcn - user-api - ${project.version} - - - com.njcn - common-core - ${project.version} - - - com.njcn - process-api - ${project.version} - - - com.njcn - harmonic-api - ${project.version} - compile - - - com.njcn - common-web - ${project.version} - com.njcn common-swagger @@ -60,7 +34,33 @@ common-redis ${project.version} - + + com.njcn + prepare-api + ${project.version} + + + + com.njcn + pqs-influx + ${project.version} + + + com.njcn + user-api + ${project.version} + + + com.njcn + process-api + ${project.version} + + + com.njcn + harmonic-api + ${project.version} + compile + com.njcn system-api @@ -77,7 +77,6 @@ mapstruct ${org.mapstruct.version} - org.mapstruct mapstruct-processor @@ -88,7 +87,6 @@ lombok-mapstruct-binding 0.2.0 - org.projectlombok @@ -96,17 +94,12 @@ ${org.projectlombok.version} provided - com.njcn common-oss ${project.version} - - com.njcn - prepare-api - ${project.version} - + @@ -115,35 +108,13 @@ 3.5.1 - + + - com.njcn - pqs-influx - ${project.version} - - - - - - - - - - - - - - - - - - - - + 2.11.2 + diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/line/PqsEventdetailController.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/line/PqsEventdetailController.java deleted file mode 100644 index 6e034e558..000000000 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/line/PqsEventdetailController.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.njcn.prepare.harmonic.controller.line; - -import com.njcn.common.pojo.annotation.OperateInfo; -import com.njcn.common.pojo.enums.common.LogEnum; -import com.njcn.common.pojo.enums.response.CommonResponseEnum; -import com.njcn.common.pojo.response.HttpResult; -import com.njcn.common.utils.HttpResultUtil; -import com.njcn.device.biz.commApi.CommTerminalGeneralClient; -import com.njcn.device.pq.api.LineFeignClient; -import com.njcn.prepare.harmonic.pojo.param.LineParam; -import com.njcn.prepare.harmonic.service.mysql.line.PqsEventdetailHandlerService; -import com.njcn.web.controller.BaseController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.util.CollectionUtils; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -/** - * Description: - * 接口文档访问地址:http://serverIP:port/swagger-ui.html - * Date: 2022/12/28 13:47【需求编号】 - * - * @author clam - * @version V1.0.0 - */ -@Slf4j -@Api(tags = "监测点暂态指标超标明细") -@RestController -@RequestMapping("/eventdetail") -@RequiredArgsConstructor -public class PqsEventdetailController extends BaseController { - - private final LineFeignClient lineFeignClient; - - private final CommTerminalGeneralClient commTerminalGeneralClient; - - private final PqsEventdetailHandlerService pqsEventdetailHandlerService; - @OperateInfo(info = LogEnum.BUSINESS_COMMON) - @PostMapping("/eventdetailHandler") - @ApiOperation("监测点暂态指标处理") - @ApiImplicitParam(name = "lineParam", value = "参数", required = true) - public HttpResult eventdetailHandler(@RequestBody @Validated LineParam lineParam){ - log.info(LocalDateTime.now()+"eventdetailHandler始执行"); - String methodDescribe = getMethodDescribe("eventdetailHandler"); - List indexLists = new ArrayList<> (); - if(CollectionUtils.isEmpty (lineParam.getLineIds ())){ - indexLists = commTerminalGeneralClient.getRunMonitorIds ().getData (); - }else{ - indexLists = lineParam.getLineIds (); - } - lineParam.setLineIds (indexLists); - - pqsEventdetailHandlerService.eventdetailHandler (lineParam); - return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); - } -} diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/newalgorithm/RMpEventdetailController.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/newalgorithm/RMpEventdetailController.java index ed8c3c97d..b5dfa8937 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/newalgorithm/RMpEventdetailController.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/controller/newalgorithm/RMpEventdetailController.java @@ -5,6 +5,7 @@ import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.response.CommonResponseEnum; import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.utils.HttpResultUtil; +import com.njcn.device.biz.commApi.CommTerminalGeneralClient; import com.njcn.device.pq.api.LineFeignClient; import com.njcn.prepare.harmonic.pojo.param.LineParam; import com.njcn.prepare.harmonic.service.mysql.line.RMpEventDetailService; @@ -40,25 +41,27 @@ import java.util.List; @RequiredArgsConstructor public class RMpEventdetailController extends BaseController { - private final LineFeignClient lineFeignClient; + + private final CommTerminalGeneralClient commTerminalGeneralClient; private final RMpEventDetailService rMpEventDetailService; + @OperateInfo(info = LogEnum.BUSINESS_COMMON) @PostMapping("/eventdetailHandler") @ApiOperation("监测点暂态指标处理") @ApiImplicitParam(name = "lineParam", value = "参数", required = true) - public HttpResult eventdetailHandler(@RequestBody @Validated LineParam lineParam){ - log.info(LocalDateTime.now()+"eventdetailHandler始执行"); + public HttpResult eventdetailHandler(@RequestBody @Validated LineParam lineParam) { + log.info(LocalDateTime.now() + "eventdetailHandler始执行"); String methodDescribe = getMethodDescribe("eventdetailHandler"); - List indexLists = new ArrayList<> (); - if(CollectionUtils.isEmpty (lineParam.getLineIds ())){ - indexLists = lineFeignClient.getLineList ( ).getData ( ); - }else{ - indexLists = lineParam.getLineIds (); + List indexLists; + if (CollectionUtils.isEmpty(lineParam.getLineIds())) { + indexLists = commTerminalGeneralClient.getRunMonitorIds().getData(); + } else { + indexLists = lineParam.getLineIds(); } - lineParam.setLineIds (indexLists); + lineParam.setLineIds(indexLists); - rMpEventDetailService.eventdetailHandler (lineParam); + rMpEventDetailService.eventdetailHandler(lineParam); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); } } diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/PqsEventdetailHandlerServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/PqsEventdetailHandlerServiceImpl.java deleted file mode 100644 index 682d178b3..000000000 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/PqsEventdetailHandlerServiceImpl.java +++ /dev/null @@ -1,209 +0,0 @@ -package com.njcn.prepare.harmonic.service.mysql.Impl.line; - -import com.njcn.harmonic.pojo.po.RMpEventDetailDPO; -import com.njcn.harmonic.pojo.po.RMpEventDetailMPO; -import com.njcn.harmonic.pojo.po.RMpEventDetailQPO; -import com.njcn.harmonic.pojo.po.RMpEventDetailYPO; -import com.njcn.prepare.harmonic.constant.AlgorithmParam; -import com.njcn.prepare.harmonic.pojo.oracle.PqLinedetailPO; -import com.njcn.prepare.harmonic.pojo.param.LineParam; -import com.njcn.prepare.harmonic.service.mysql.line.*; -import com.njcn.prepare.harmonic.service.oracle.PqLinedetailPOService; -import com.njcn.prepare.harmonic.service.oracle.PqsEventdetailService; -import lombok.AllArgsConstructor; -import lombok.SneakyThrows; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Date; -import java.util.List; -import java.util.Objects; - -/** - * Description: - * 接口文档访问地址:http://serverIP:port/swagger-ui.html - * Date: 2022/12/28 14:11【需求编号】 - * - * @author clam - * @version V1.0.0 - */ -@Slf4j -@Service -@AllArgsConstructor -public class PqsEventdetailHandlerServiceImpl implements PqsEventdetailHandlerService { - - private final PqLinedetailPOService pqLinedetailPOService; - - - private final PqsEventdetailService pqsEventdetailService; - - private final RMpEventDetailDService rMpEventDetailDService; - - private final RMpEventDetailMService rMpEventDetailMService; - - private final RMpEventDetailQService rMpEventDetailQService; - - private final RMpEventDetailYService rMpEventDetailYService; - - - - @Override - @Async("asyncExecutor") - public void eventdetailHandler(LineParam lineParam) { - /*if (Objects.equals (lineParam.getDataSource ( ), AlgorithmParam.ORACLE_DATA)) { - hanlderOracleData (lineParam); - } else if (Objects.equals (lineParam.getDataSource ( ), AlgorithmParam.INFLUX_DATA)) {*/ - hanlderInfludxbData (lineParam); - // } - } - /** - * @Description: hanlderInfludxbData - * @Param: [lineParam] - * @return: void - * @Author: clam - * @Date: 2022/12/28 - */ - private void hanlderInfludxbData(LineParam lineParam) { - } - /** - * @Description: hanlderOracleData - * @Param: [lineParam] - * @return: void - * @Author: clam - * @Date: 2022/12/28 - */ - private void hanlderOracleData(LineParam lineParam) { - Integer type = lineParam.getType ( ); - switch (type) { - case 1: - this.hanlderOracleYear (lineParam); - break; - case 2: - this.hanlderOracleQtr (lineParam); - break; - case 3: - this.hanlderOracleMonth (lineParam); - break; - case 5: - this.hanlderOracleDay (lineParam); - break; - default: - break; - } - } - @SneakyThrows - private void hanlderOracleYear(LineParam lineParam) { - List lineIds = lineParam.getLineIds ( ); - String dataDate = lineParam.getDataDate ( ); - final Date tempDate = new SimpleDateFormat ("yyyy-MM-dd").parse (dataDate); - List rMpEventDetailYPOList = new ArrayList<> ( ); - - lineIds.forEach (lineId -> { - /*查询月表数据生成年表数据*/ - List rMpEventDetailMPOList = rMpEventDetailMService.queryOneYearData(lineId,dataDate); - int sagCount = rMpEventDetailMPOList.stream ( ).mapToInt (RMpEventDetailMPO::getSagTimes).sum ( ); - int riseCount = rMpEventDetailMPOList.stream ( ).mapToInt (RMpEventDetailMPO::getSwellTimes).sum ( ); - int interruptCount = rMpEventDetailMPOList.stream ( ).mapToInt (RMpEventDetailMPO::getInterruptTimes).sum ( ); - - RMpEventDetailYPO rMpEventDetailYPO = new RMpEventDetailYPO(); - rMpEventDetailYPO.setMeasurementPointId (lineId); - rMpEventDetailYPO.setDataDate (tempDate); - rMpEventDetailYPO.setSagTimes (sagCount); - rMpEventDetailYPO.setSwellTimes (riseCount); - rMpEventDetailYPO.setInterruptTimes (interruptCount); - rMpEventDetailYPOList.add (rMpEventDetailYPO); - - }); - - rMpEventDetailYService.saveOrUpdateBatchByMultiId (rMpEventDetailYPOList,500); - - - } - @SneakyThrows - private void hanlderOracleQtr(LineParam lineParam) { - List lineIds = lineParam.getLineIds ( ); - String dataDate = lineParam.getDataDate ( ); - final Date tempDate = new SimpleDateFormat ("yyyy-MM-dd").parse (dataDate); - List rMpEventDetailQPOList = new ArrayList<> ( ); - - lineIds.forEach (lineId -> { - /*查询月表数据生成季表数据*/ - List rMpEventDetailMPOList = rMpEventDetailMService.queryOneQtrData(lineId,dataDate); - int sagCount = rMpEventDetailMPOList.stream ( ).mapToInt (RMpEventDetailMPO::getSagTimes).sum ( ); - int riseCount = rMpEventDetailMPOList.stream ( ).mapToInt (RMpEventDetailMPO::getSwellTimes).sum ( ); - int interruptCount = rMpEventDetailMPOList.stream ( ).mapToInt (RMpEventDetailMPO::getInterruptTimes).sum ( ); - - RMpEventDetailQPO rMpEventDetailQPO = new RMpEventDetailQPO(); - rMpEventDetailQPO.setMeasurementPointId (lineId); - rMpEventDetailQPO.setDataDate (tempDate); - rMpEventDetailQPO.setSagTimes (sagCount); - rMpEventDetailQPO.setSwellTimes (riseCount); - rMpEventDetailQPO.setInterruptTimes (interruptCount); - rMpEventDetailQPOList.add (rMpEventDetailQPO); - - }); - - rMpEventDetailQService.saveOrUpdateBatchByMultiId (rMpEventDetailQPOList,500); - } - - @SneakyThrows - private void hanlderOracleMonth(LineParam lineParam) { - List lineIds = lineParam.getLineIds ( ); - String dataDate = lineParam.getDataDate ( ); - final Date tempDate = new SimpleDateFormat ("yyyy-MM-dd").parse (dataDate); - List rMpEventDetailMPOList = new ArrayList<> ( ); - - lineIds.forEach (lineId -> { - /*查询day表数据生成月表数据*/ - List rMpEventDetailDPOList = rMpEventDetailDService.queryOneMothData(lineId,dataDate); - int sagCount = rMpEventDetailDPOList.stream ( ).mapToInt (RMpEventDetailDPO::getSagTimes).sum ( ); - int riseCount = rMpEventDetailDPOList.stream ( ).mapToInt (RMpEventDetailDPO::getSwellTimes).sum ( ); - int interruptCount = rMpEventDetailDPOList.stream ( ).mapToInt (RMpEventDetailDPO::getInterruptTimes).sum ( ); - - RMpEventDetailMPO rMpEventDetailMPO = new RMpEventDetailMPO(); - rMpEventDetailMPO.setMeasurementPointId (lineId); - rMpEventDetailMPO.setDataDate (tempDate); - rMpEventDetailMPO.setSagTimes (sagCount); - rMpEventDetailMPO.setSwellTimes (riseCount); - rMpEventDetailMPO.setInterruptTimes (interruptCount); - rMpEventDetailMPOList.add (rMpEventDetailMPO); - - }); - - rMpEventDetailMService.saveOrUpdateBatchByMultiId (rMpEventDetailMPOList,500); - - } - @SneakyThrows - private void hanlderOracleDay(LineParam lineParam) { - - List lineIds = lineParam.getLineIds ( ); - String dataDate = lineParam.getDataDate ( ); - final Date tempDate = new SimpleDateFormat ("yyyy-MM-dd").parse (dataDate); - List rMpEventDetailDPOList = new ArrayList<> ( ); - - - lineIds.forEach (lineId -> { - - /*获取mysql与Oracle监测点id对应关系*/ - - PqLinedetailPO oracleIndexIdByMonitorId = pqLinedetailPOService.getOracleIndexIdByMonitorId (lineId); - - Integer sagCount = pqsEventdetailService.queryByCondition (oracleIndexIdByMonitorId.getLineIndex(),dataDate,AlgorithmParam.SAG); - Integer riseCount = pqsEventdetailService.queryByCondition (oracleIndexIdByMonitorId.getLineIndex(),dataDate,AlgorithmParam.RISE); - Integer interruptCount = pqsEventdetailService.queryByCondition (oracleIndexIdByMonitorId.getLineIndex(),dataDate,AlgorithmParam.INTERRUPT); - RMpEventDetailDPO rMpEventDetailDPO = new RMpEventDetailDPO(); - rMpEventDetailDPO.setMeasurementPointId (lineId); - rMpEventDetailDPO.setDataDate (tempDate); - rMpEventDetailDPO.setSagTimes (sagCount); - rMpEventDetailDPO.setSwellTimes (riseCount); - rMpEventDetailDPO.setInterruptTimes (interruptCount); - - rMpEventDetailDPOList.add (rMpEventDetailDPO); - }); - - rMpEventDetailDService.saveOrUpdateBatchByMultiId (rMpEventDetailDPOList,500); - } -} diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/RMpEventDetailServiceImpl.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/RMpEventDetailServiceImpl.java index 39bbcdd9e..c95bf2fdf 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/RMpEventDetailServiceImpl.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/Impl/line/RMpEventDetailServiceImpl.java @@ -27,7 +27,6 @@ import java.util.List; import java.util.Optional; /** - * * Description: * 接口文档访问地址:http://serverIP:port/swagger-ui.html * Date: 2023/4/23 13:50【需求编号】 @@ -37,7 +36,7 @@ import java.util.Optional; */ @Service @RequiredArgsConstructor -public class RMpEventDetailServiceImpl extends ServiceImpl implements RMpEventDetailService{ +public class RMpEventDetailServiceImpl extends ServiceImpl implements RMpEventDetailService { private final RMpEventDetailDService rMpEventDetailDService; @@ -54,18 +53,6 @@ public class RMpEventDetailServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper ( ); - queryWrapper.select ("1"). - eq ("measurement_point_id", measurementPointId). - eq ("event_type",eventType). - eq("DATE_FORMAT( start_time ,'%Y-%m-%d')",dataDate); - - Integer integer = this.getBaseMapper ().selectCount (queryWrapper); - - return integer; - } /** * @Description: hanlderOracleData @@ -75,7 +62,7 @@ public class RMpEventDetailServiceImpl extends ServiceImpl lineIds = lineParam.getLineIds(); + String dataDate = lineParam.getDataDate(); + final Date tempDate = new SimpleDateFormat("yyyy-MM-dd").parse(dataDate); + List rMpEventDetailMPOList = new ArrayList<>(); - List lineIds = lineParam.getLineIds ( ); - String dataDate = lineParam.getDataDate ( ); - final Date tempDate = new SimpleDateFormat ("yyyy-MM-dd").parse (dataDate); - List rMpEventDetailMPOList = new ArrayList<> ( ); - - lineIds.forEach (measurementPointId -> { + lineIds.forEach(measurementPointId -> { /*查询day表数据生成月表数据*/ - List rMpEventDetailDPOList = rMpEventDetailDService.queryOneMothData(measurementPointId,dataDate); - int sagCount = rMpEventDetailDPOList.stream ( ).mapToInt (RMpEventDetailDPO::getSagTimes).sum ( ); - int riseCount = rMpEventDetailDPOList.stream ( ).mapToInt (RMpEventDetailDPO::getSwellTimes).sum ( ); - int interruptCount = rMpEventDetailDPOList.stream ( ).mapToInt (RMpEventDetailDPO::getInterruptTimes).sum ( ); + List rMpEventDetailDPOList = rMpEventDetailDService.queryOneMothData(measurementPointId, dataDate); + int sagCount = rMpEventDetailDPOList.stream().mapToInt(RMpEventDetailDPO::getSagTimes).sum(); + int riseCount = rMpEventDetailDPOList.stream().mapToInt(RMpEventDetailDPO::getSwellTimes).sum(); + int interruptCount = rMpEventDetailDPOList.stream().mapToInt(RMpEventDetailDPO::getInterruptTimes).sum(); RMpEventDetailMPO rMpEventDetailMPO = new RMpEventDetailMPO(); - rMpEventDetailMPO.setMeasurementPointId (measurementPointId); - rMpEventDetailMPO.setDataDate (tempDate); - rMpEventDetailMPO.setSagTimes (sagCount); - rMpEventDetailMPO.setSwellTimes (riseCount); - rMpEventDetailMPO.setInterruptTimes (interruptCount); - rMpEventDetailMPOList.add (rMpEventDetailMPO); + rMpEventDetailMPO.setMeasurementPointId(measurementPointId); + rMpEventDetailMPO.setDataDate(tempDate); + rMpEventDetailMPO.setSagTimes(sagCount); + rMpEventDetailMPO.setSwellTimes(riseCount); + rMpEventDetailMPO.setInterruptTimes(interruptCount); + rMpEventDetailMPOList.add(rMpEventDetailMPO); }); - rMpEventDetailMService.saveOrUpdateBatchByMultiId (rMpEventDetailMPOList,500); + rMpEventDetailMService.saveOrUpdateBatchByMultiId(rMpEventDetailMPOList, 500); } @SneakyThrows private void hanlderDay(LineParam lineParam) { - List lineIds = lineParam.getLineIds ( ); - String dataDate = lineParam.getDataDate ( ); - final Date tempDate = new SimpleDateFormat ("yyyy-MM-dd").parse (dataDate); - List rMpEventDetailDPOList = new ArrayList<> ( ); + List lineIds = lineParam.getLineIds(); + String dataDate = lineParam.getDataDate(); + final Date tempDate = new SimpleDateFormat("yyyy-MM-dd").parse(dataDate); + List rMpEventDetailDPOList = new ArrayList<>(); - lineIds.forEach (measurementPointId -> { - Integer sagCount = this.queryByCondition (measurementPointId,dataDate, getEventTypeId(DicDataEnum.VOLTAGE_DIP.getCode ( ))); - Integer riseCount = this.queryByCondition (measurementPointId,dataDate,getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode ( ))); - Integer interruptCount = this.queryByCondition (measurementPointId,dataDate,getEventTypeId(DicDataEnum.SHORT_INTERRUPTIONS.getCode ( ))); + lineIds.forEach(measurementPointId -> { + Integer sagCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.VOLTAGE_DIP.getCode())); + Integer riseCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.VOLTAGE_RISE.getCode())); + Integer interruptCount = this.queryByCondition(measurementPointId, dataDate, getEventTypeId(DicDataEnum.SHORT_INTERRUPTIONS.getCode())); RMpEventDetailDPO rMpEventDetailDPO = new RMpEventDetailDPO(); - rMpEventDetailDPO.setMeasurementPointId (measurementPointId); - rMpEventDetailDPO.setDataDate (tempDate); - rMpEventDetailDPO.setSagTimes (sagCount); - rMpEventDetailDPO.setSwellTimes (riseCount); - rMpEventDetailDPO.setInterruptTimes (interruptCount); + rMpEventDetailDPO.setMeasurementPointId(measurementPointId); + rMpEventDetailDPO.setDataDate(tempDate); + rMpEventDetailDPO.setSagTimes(sagCount); + rMpEventDetailDPO.setSwellTimes(riseCount); + rMpEventDetailDPO.setInterruptTimes(interruptCount); - rMpEventDetailDPOList.add (rMpEventDetailDPO); + rMpEventDetailDPOList.add(rMpEventDetailDPO); }); - rMpEventDetailDService.saveOrUpdateBatchByMultiId (rMpEventDetailDPOList,500); + rMpEventDetailDService.saveOrUpdateBatchByMultiId(rMpEventDetailDPOList, 500); } - public String getEventTypeId(String code){ + public Integer queryByCondition(String measurementPointId, String dataDate, String eventType) { + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.select("1"). + eq("measurement_point_id", measurementPointId). + eq("event_type", eventType). + eq("DATE_FORMAT( start_time ,'%Y-%m-%d')", dataDate); - String eventType =redisUtil.getStringByKey (code); - eventType = Optional.ofNullable (eventType).orElseGet (() ->{ - DictData data = dicDataFeignClient.getDicDataByCode (code).getData ( ); - redisUtil.saveByKey (data.getCode (),data.getId ()); - return data.getId (); + return this.getBaseMapper().selectCount(queryWrapper); + } + + public String getEventTypeId(String code) { + + String eventType = redisUtil.getStringByKey(code); + eventType = Optional.ofNullable(eventType).orElseGet(() -> { + DictData data = dicDataFeignClient.getDicDataByCode(code).getData(); + redisUtil.saveByKey(data.getCode(), data.getId()); + return data.getId(); }); return eventType; diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/PqsEventdetailHandlerService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/PqsEventdetailHandlerService.java deleted file mode 100644 index fd7abe946..000000000 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/PqsEventdetailHandlerService.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.njcn.prepare.harmonic.service.mysql.line; - -import com.njcn.prepare.harmonic.pojo.param.LineParam; - -/** -* -* Description: -* 接口文档访问地址:http://serverIP:port/swagger-ui.html -* Date: 2022/12/28 13:46【需求编号】 -* -* @author clam -* @version V1.0.0 -*/ -public interface PqsEventdetailHandlerService { - - - void eventdetailHandler(LineParam lineParam); -} diff --git a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/RMpEventDetailService.java b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/RMpEventDetailService.java index 789ae2c29..0fdfd5a60 100644 --- a/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/RMpEventDetailService.java +++ b/pqs-prepare/prepare-boot/src/main/java/com/njcn/prepare/harmonic/service/mysql/line/RMpEventDetailService.java @@ -24,5 +24,4 @@ public interface RMpEventDetailService extends IService{ */ void eventdetailHandler(LineParam lineParam); - Integer queryByCondition(String lineId, String dataDate, String eventType); }