|
@@ -29,11 +29,9 @@ import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.math.BigInteger;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
|
+import java.time.ZoneId;
|
|
import java.time.format.DateTimeFormatter;
|
|
import java.time.format.DateTimeFormatter;
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
|
|
+import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -79,7 +77,7 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
// modify by pengdi ,判断定时任务是否存在,不存在才进行新增
|
|
// modify by pengdi ,判断定时任务是否存在,不存在才进行新增
|
|
|
|
|
|
boolean exists = jobAndTriggerService.isExists(entity);
|
|
boolean exists = jobAndTriggerService.isExists(entity);
|
|
- if(!exists){
|
|
|
|
|
|
+ if(!exists) {
|
|
String cron = "0 */1 * * * ?";
|
|
String cron = "0 */1 * * * ?";
|
|
log.info("水量每天同步:" + cron);
|
|
log.info("水量每天同步:" + cron);
|
|
entity.setCronExpression(cron);
|
|
entity.setCronExpression(cron);
|
|
@@ -121,10 +119,7 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
Integer month=baseClosingAccountInfoDto.getMonth();
|
|
Integer month=baseClosingAccountInfoDto.getMonth();
|
|
//插入水量基础信息(同步计划)
|
|
//插入水量基础信息(同步计划)
|
|
Integer amountNumber = amountWaterUsedAmountMapper.createdAmountByDay(siteId,customerId);
|
|
Integer amountNumber = amountWaterUsedAmountMapper.createdAmountByDay(siteId,customerId);
|
|
- if(amountNumber == 0){
|
|
|
|
- log.info("每天同步水量失败:生成同步计划失败");
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
//获取客户编号
|
|
//获取客户编号
|
|
List<Customer> customers = customerMapper.getListById(customerId);
|
|
List<Customer> customers = customerMapper.getListById(customerId);
|
|
if(customers .size() != 1){
|
|
if(customers .size() != 1){
|
|
@@ -153,16 +148,16 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
//抄表数据结果
|
|
//抄表数据结果
|
|
List<AmountSynRespDto> lists =new ArrayList<>();
|
|
List<AmountSynRespDto> lists =new ArrayList<>();
|
|
|
|
|
|
- for(int i=0;i<metercodes.size();i+=500){
|
|
|
|
|
|
+ for(int i=0;i<metercodes.size();i+=30){
|
|
AmountDaySynParamDto amountDaySynParamDto= new AmountDaySynParamDto();
|
|
AmountDaySynParamDto amountDaySynParamDto= new AmountDaySynParamDto();
|
|
amountDaySynParamDto.setReadTime(DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now().plusDays(-1)));
|
|
amountDaySynParamDto.setReadTime(DateTimeFormatter.ofPattern("yyyyMMdd").format(LocalDate.now().plusDays(-1)));
|
|
amountDaySynParamDto.setCustomerNo(customerNo);
|
|
amountDaySynParamDto.setCustomerNo(customerNo);
|
|
- //一次查询五百条
|
|
|
|
|
|
+ //一次查询30条
|
|
List<String> selectList ;
|
|
List<String> selectList ;
|
|
- if(i+500 >= metercodes.size()){
|
|
|
|
|
|
+ if(i+30 >= metercodes.size()){
|
|
selectList=metercodes.subList(i,metercodes.size());
|
|
selectList=metercodes.subList(i,metercodes.size());
|
|
}else{
|
|
}else{
|
|
- selectList=metercodes.subList(i,i+500);
|
|
|
|
|
|
+ selectList=metercodes.subList(i,i+30);
|
|
}
|
|
}
|
|
amountDaySynParamDto.setFileNo(selectList);
|
|
amountDaySynParamDto.setFileNo(selectList);
|
|
|
|
|
|
@@ -197,7 +192,7 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
AmountSynRespDto amountSynRespDto = map.get(amountWaterUsedAmountByDay.getMetercode());
|
|
AmountSynRespDto amountSynRespDto = map.get(amountWaterUsedAmountByDay.getMetercode());
|
|
BigDecimal readingOld = amountWaterUsedAmountByDay.getLastreading();//上期止度
|
|
BigDecimal readingOld = amountWaterUsedAmountByDay.getLastreading();//上期止度
|
|
|
|
|
|
- if (amountSynRespDto.getReading() != null) {
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(amountSynRespDto.getReading())) {
|
|
BigDecimal readingNew = new BigDecimal(amountSynRespDto.getReading()).setScale(0, BigDecimal.ROUND_DOWN);//本期止度
|
|
BigDecimal readingNew = new BigDecimal(amountSynRespDto.getReading()).setScale(0, BigDecimal.ROUND_DOWN);//本期止度
|
|
|
|
|
|
BigDecimal payAmount ;//结算水量
|
|
BigDecimal payAmount ;//结算水量
|
|
@@ -206,7 +201,7 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
|
|
|
|
BigDecimal replaceAmount = BigDecimal.ZERO;//旧表用水量
|
|
BigDecimal replaceAmount = BigDecimal.ZERO;//旧表用水量
|
|
|
|
|
|
- String readDate = amountSynRespDto.getCurrentPeriodDate();
|
|
|
|
|
|
+ String readDate = amountSynRespDto.getReadTime();
|
|
|
|
|
|
Integer calculateway = amountWaterUsedAmountByDay.getCalculateway();
|
|
Integer calculateway = amountWaterUsedAmountByDay.getCalculateway();
|
|
|
|
|
|
@@ -230,7 +225,11 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
amountWaterUsedAmountByDay.setReading(readingNew);
|
|
amountWaterUsedAmountByDay.setReading(readingNew);
|
|
- amountWaterUsedAmountByDay.setRecorddate(DateTimeUtil.parseDate(readDate, DateTimeUtil.DATE_TIME_FORMAT_SECOND));
|
|
|
|
|
|
+ if(StringUtils.isNotBlank(readDate)){
|
|
|
|
+ amountWaterUsedAmountByDay.setRecorddate(
|
|
|
|
+ Date.from(LocalDateTime.parse(readDate,DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")).atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
|
+ }
|
|
|
|
+
|
|
amountWaterUsedAmountByDay.setAmount(Amount);
|
|
amountWaterUsedAmountByDay.setAmount(Amount);
|
|
amountWaterUsedAmountByDay.setPayamount(payAmount);
|
|
amountWaterUsedAmountByDay.setPayamount(payAmount);
|
|
updates.add(amountWaterUsedAmountByDay);
|
|
updates.add(amountWaterUsedAmountByDay);
|
|
@@ -245,4 +244,5 @@ public class AmountSynDayServiceImpl implements AmountSynByDayService, Initializ
|
|
}
|
|
}
|
|
log.info("每天水量同步结束:" + LocalDateTime.now());
|
|
log.info("每天水量同步结束:" + LocalDateTime.now());
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|