diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DataCleanServiceImpl.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DataCleanServiceImpl.java index 1e98e1d..171736a 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DataCleanServiceImpl.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DataCleanServiceImpl.java @@ -18,6 +18,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -36,7 +37,9 @@ import java.util.stream.Collectors; public class DataCleanServiceImpl implements IDataCleanService { private static final Logger logger = LoggerFactory.getLogger(DataCleanServiceImpl.class); - private final static Integer NUM = 100; + + @Value("${line.num}") + private Integer NUM = 100; @Resource private DataVFeignClient dataVFeignClient; diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DayDataServiceImpl.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DayDataServiceImpl.java index 7d7a571..63dbb48 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DayDataServiceImpl.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/DayDataServiceImpl.java @@ -15,6 +15,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.ListUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import javax.annotation.Resource; @@ -31,7 +32,9 @@ import java.util.stream.Collectors; public class DayDataServiceImpl implements IDayDataService { private static final Logger logger = LoggerFactory.getLogger(DayDataServiceImpl.class); - private final static Integer NUM = 100; + + @Value("${line.num}") + private Integer NUM = 100; @Resource private DataVFeignClient dataVFeignClient; @Resource diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataCrossingServiceImpl.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataCrossingServiceImpl.java index e7ea47e..db7d8c6 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataCrossingServiceImpl.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataCrossingServiceImpl.java @@ -27,6 +27,7 @@ import org.apache.commons.collections4.ListUtils; import org.jetbrains.annotations.NotNull; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -50,7 +51,8 @@ import java.util.stream.Collectors; public class IDataCrossingServiceImpl implements IDataCrossingService { private static final Logger logger = LoggerFactory.getLogger(DayDataServiceImpl.class); - private final static Integer NUM = 100; + @Value("${line.num}") + private Integer NUM = 100; @Resource private DataVFeignClient dataVFeignClient; @Resource diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataIntegrityServiceImpl.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataIntegrityServiceImpl.java index b5e9b7f..77b756a 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataIntegrityServiceImpl.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataIntegrityServiceImpl.java @@ -16,6 +16,7 @@ import com.njcn.device.biz.pojo.dto.LineDevGetDTO; import com.njcn.influx.pojo.constant.InfluxDBTableConstant; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -33,6 +34,10 @@ import java.util.stream.Collectors; @Service @RequiredArgsConstructor public class IDataIntegrityServiceImpl implements IDataIntegrityService { + + @Value("${line.num}") + private Integer NUM = 100; + @Resource private CommTerminalGeneralClient commTerminalGeneralClient; @Resource @@ -54,7 +59,7 @@ public class IDataIntegrityServiceImpl implements IDataIntegrityService { DatePattern.NORM_DATETIME_PATTERN ); //以尺寸100分片 - List> pendingIds = ListUtils.partition(lineIds, 5); + List> pendingIds = ListUtils.partition(lineIds, NUM); for (List pendingId : pendingIds) { List lineDevGetDTOList = commTerminalGeneralClient.getMonitorDetailList(pendingId).getData(); List countList = dataVFeignClient.getMeasurementCount(pendingId, beginDay, endDay).getData(); @@ -89,7 +94,7 @@ public class IDataIntegrityServiceImpl implements IDataIntegrityService { List devIdList = calculatedParam.getIdList(); List info = new ArrayList<>(); - List> pendingIds = ListUtils.partition(devIdList, 100); + List> pendingIds = ListUtils.partition(devIdList, NUM); for (List pendingId : pendingIds) { lineParam.setLineId(pendingId); List data = dataIntegrityFeignClient.getRawData(lineParam).getData(); diff --git a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataOnlineRateServiceImpl.java b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataOnlineRateServiceImpl.java index 7947172..bbaabb5 100644 --- a/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataOnlineRateServiceImpl.java +++ b/algorithm/algorithm-boot/src/main/java/com/njcn/algorithm/serviceimpl/line/IDataOnlineRateServiceImpl.java @@ -24,6 +24,7 @@ import com.njcn.user.api.DeptFeignClient; import com.njcn.user.pojo.po.Dept; import lombok.RequiredArgsConstructor; import org.apache.commons.collections4.ListUtils; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -38,7 +39,10 @@ import java.util.stream.Collectors; @Service @RequiredArgsConstructor public class IDataOnlineRateServiceImpl implements IDataOnlineRateService { - private final static Integer NUM = 100; + + @Value("${line.num}") + private Integer NUM = 100; + private final Integer online = 1; @Resource private PqsCommunicateFeignClient communicateFeignClient; diff --git a/algorithm/algorithm-boot/src/main/resources/bootstrap.yml b/algorithm/algorithm-boot/src/main/resources/bootstrap.yml index bf50866..6d0bdba 100644 --- a/algorithm/algorithm-boot/src/main/resources/bootstrap.yml +++ b/algorithm/algorithm-boot/src/main/resources/bootstrap.yml @@ -55,6 +55,8 @@ logging: mybatis-plus: #别名扫描 type-aliases-package: com.njcn.harmonic.pojo +line: + num: 100 mqtt: client-id: @artifactId@${random.value} \ No newline at end of file