|
@@ -1,13 +1,20 @@
|
|
|
package com.bz.smart_city.quartz.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.bz.smart_city.commom.util.DateTimeUtil;
|
|
|
+import com.bz.smart_city.commom.util.HttpClientUtils;
|
|
|
+import com.bz.smart_city.dao.CustomerMapper;
|
|
|
import com.bz.smart_city.dao.pay.AmountWaterUsedAmountMapper;
|
|
|
import com.bz.smart_city.dao.pay.BaseClosingAccountInfoMapper;
|
|
|
import com.bz.smart_city.dao.pay.PayBaseConfigMapper;
|
|
|
import com.bz.smart_city.dto.pay.*;
|
|
|
+import com.bz.smart_city.entity.Customer;
|
|
|
import com.bz.smart_city.quartz.service.AmountSynService;
|
|
|
import com.bz.smart_city.quartz.service.JobAndTriggerService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -18,10 +25,9 @@ import java.time.Duration;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneId;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
+import java.util.function.Function;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @description
|
|
@@ -35,11 +41,16 @@ public class AmountSynServiceImpl implements AmountSynService {
|
|
|
@Value("1")
|
|
|
private BigInteger createBy;
|
|
|
|
|
|
+ @Value("http://114.135.61.188:58080/api/syncData/clearingData")
|
|
|
+ private String amountSynUrl;
|
|
|
+
|
|
|
@Resource
|
|
|
private BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
|
|
|
@Resource
|
|
|
private AmountWaterUsedAmountMapper amountWaterUsedAmountMapper;
|
|
|
@Resource
|
|
|
+ private CustomerMapper customerMapper;
|
|
|
+ @Resource
|
|
|
private PayBaseConfigMapper payBaseConfigMapper;
|
|
|
@Resource
|
|
|
private JobAndTriggerService jobAndTriggerService;
|
|
@@ -50,180 +61,195 @@ public class AmountSynServiceImpl implements AmountSynService {
|
|
|
|
|
|
@Override
|
|
|
public void amountUpdate(Integer siteId, Integer customerId) {
|
|
|
-
|
|
|
-
|
|
|
- //获取水表信息
|
|
|
- //调取接口获取水量信息
|
|
|
- //保存水量信息
|
|
|
- }
|
|
|
-
|
|
|
- /* public void amountUpdate(Integer siteId, Integer customerId){
|
|
|
-
|
|
|
//获取最新账期
|
|
|
+ BaseClosingAccountInfoDto baseClosingAccountInfoDto = baseClosingAccountInfoMapper.getLastClosingAccount(siteId, customerId);
|
|
|
|
|
|
- List<BaseClosingAccountInfoDto> baseClosingAccountInfoDtos = baseClosingAccountInfoMapper.getList(null,null, BigInteger.valueOf(siteId),BigInteger.valueOf(customerId),0);
|
|
|
- if(baseClosingAccountInfoDtos.size()>0){
|
|
|
- //customerId accountPeriod 是否有结算计划
|
|
|
- BaseClosingAccountInfoDto baseClosingAccountInfoDto = baseClosingAccountInfoDtos.get(0);
|
|
|
- Integer year = baseClosingAccountInfoDto.getYear();
|
|
|
- Integer month = baseClosingAccountInfoDto.getMonth();
|
|
|
-
|
|
|
- String accountPeriod = year + String.format("%02d",month);
|
|
|
-
|
|
|
-
|
|
|
- ClearingRecord clearingRecord = //clearingRecordMapper.findClearingRecordByAccoutPeriodAndCust(accountPeriod,Integer.valueOf(customerId));
|
|
|
- if(clearingRecord!=null){
|
|
|
- //产生水量基础计划
|
|
|
- Integer totalNum = amountWaterUsedAmountMapper.getAllAmountCount(year,month,siteId,customerId);
|
|
|
- Integer num = totalNum / 500 + (totalNum % 500 > 0 ? 1 : 0);
|
|
|
- log.info("抄表计划生成开始:" + LocalDateTime.now() + ",计划条数" + totalNum);
|
|
|
- for (int i = 0; i < num; i++)
|
|
|
- {
|
|
|
- int a = amountWaterUsedAmountMapper.createdAmount(year,month,siteId,customerId);
|
|
|
- log.info("成功条数" + i + ":" + a);
|
|
|
+ if(baseClosingAccountInfoDto == null
|
|
|
+ || baseClosingAccountInfoDto .getYear() == null
|
|
|
+ || baseClosingAccountInfoDto.getMonth() == null){
|
|
|
+ log.info("同步水量失败:获取账期信息失败");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ Integer year=baseClosingAccountInfoDto.getYear();
|
|
|
+ Integer month=baseClosingAccountInfoDto.getMonth();
|
|
|
+ //插入水量基础信息(同步计划)
|
|
|
+ Integer amountNumber = amountWaterUsedAmountMapper.insertSelectAmountBaseInfo(year,month,siteId,customerId);
|
|
|
+ if(amountNumber == 0){
|
|
|
+ log.info("同步水量失败:生成同步计划失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //获取客户编号
|
|
|
+ List<Customer> customers = customerMapper.getListById(customerId);
|
|
|
+ if(customers .size() != 1){
|
|
|
+ log.info("同步水量失败:查询客户信息异常");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ String customerNo=customers.get(0).getCustomerNo();
|
|
|
+ //获取同步计划
|
|
|
+ List<AmountWaterUsedAmountDto> amountWaterUsedAmountDtos = amountWaterUsedAmountMapper.getAllAmountRecord(year, month,siteId, customerId);
|
|
|
+ if(amountWaterUsedAmountDtos.size() == 0){
|
|
|
+ log.info("同步水量失败:获取同步计划失败");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<String> metercodes = amountWaterUsedAmountDtos.stream().map(
|
|
|
+ AmountWaterUsedAmountDto -> AmountWaterUsedAmountDto.getMetercode()).collect(Collectors.toList());
|
|
|
+// List<String> metercodes =amountWaterUsedAmountMapper.GetAmountSynInfo(year,month,siteId,customerId);
|
|
|
+
|
|
|
+ //批量更新水量信息
|
|
|
+ List<AmountWaterUsedAmountDto> updates = new ArrayList<>();
|
|
|
+
|
|
|
+ List<AmountSynRespDto> lists =new ArrayList<>();
|
|
|
+ for(int i=0;i<metercodes.size();i+=500){
|
|
|
+ AmountSynParamDto amountSynParamDto= new AmountSynParamDto();
|
|
|
+ amountSynParamDto.setYyyymm(year+""+month);
|
|
|
+ amountSynParamDto.setCustomerNo(customerNo);
|
|
|
+ //一次查询五百条
|
|
|
+ if(i+500 >= metercodes.size()){
|
|
|
+ amountSynParamDto.setFileNo(metercodes.subList(i,metercodes.size()));
|
|
|
+ }else{
|
|
|
+ amountSynParamDto.setFileNo(metercodes.subList(i,i+500));
|
|
|
+ }
|
|
|
+ String context=JSON.toJSON(amountSynParamDto).toString();
|
|
|
+ try {
|
|
|
+ String result= HttpClientUtils.doPostWithJson(amountSynUrl,context);
|
|
|
+ log.info("同步水量请求结果"+result);
|
|
|
+
|
|
|
+ JSONObject jsonObject= JSON.parseObject(result);
|
|
|
+ Integer status= jsonObject.getInteger("status");
|
|
|
+ if(status .equals(0)){ //返回正常
|
|
|
+ JSONObject datas = jsonObject.getJSONObject("data");
|
|
|
+ String total = datas.getString("total");
|
|
|
+ if(StringUtils.isNotBlank(total) && Integer.valueOf(total) > 0){//有数据
|
|
|
+ JSONArray jsonArray = datas.getJSONArray("list");
|
|
|
+ List<AmountSynRespDto> list = jsonArray.toJavaList(AmountSynRespDto.class);
|
|
|
+ lists.addAll(list);
|
|
|
+ }
|
|
|
}
|
|
|
- log.info("抄表计划生成完成:" + LocalDateTime.now());
|
|
|
-
|
|
|
- //获取结算水量
|
|
|
- log.info("水量同步开始:" + LocalDateTime.now());
|
|
|
- HashMap<BigInteger, ClearingDataInfoDto> clearingDataHashMap = clearingRecordItemMapper.findClearingDataHashMap(clearingRecord.getId(),1);
|
|
|
- if(clearingDataHashMap!=null&&clearingDataHashMap.size()>0) {
|
|
|
- //同步水量
|
|
|
- List<AmountWaterUsedAmountDto> amountWaterUsedAmountDtos = amountWaterUsedAmountMapper.getAllAmountRecord(year, month,siteId, customerId);
|
|
|
- //批量更新水量信息
|
|
|
- List<AmountWaterUsedAmountDto> updates = new ArrayList<>();
|
|
|
-
|
|
|
- //换表记录
|
|
|
- HashMap<BigInteger, ReplaceMeterCountDto> replaceMap = new HashMap<>();
|
|
|
- if(amountWaterUsedAmountDtos.size() > 0){
|
|
|
- LocalDateTime stTime = LocalDateTime.ofInstant(baseClosingAccountInfoDtos.get(0).getStartTime().toInstant(), ZoneId.systemDefault());
|
|
|
- HashMap<BigInteger, ReplaceMeterCountDto> childReplaceMap = amountWaterUsedAmountMapper.getRepalceRecordCount(stTime,null,null,null,customerId);
|
|
|
- if(childReplaceMap.size() >0){
|
|
|
- List<ReplaceMeterDto> replaceMeterDtoList = amountWaterUsedAmountMapper.getRepalceRecordDetail(stTime,null,null,null,customerId);
|
|
|
- if(replaceMeterDtoList.size() >0){
|
|
|
- for(int i=0;i<replaceMeterDtoList.size();i++){
|
|
|
- if(childReplaceMap.containsKey(replaceMeterDtoList.get(i).getDeviceId())){
|
|
|
- ReplaceMeterCountDto replaceMeterCountDto = childReplaceMap.get(replaceMeterDtoList.get(i).getDeviceId());
|
|
|
- if(replaceMeterCountDto.getReplaceMeterDtoList() == null)
|
|
|
- {
|
|
|
- replaceMeterCountDto.setReplaceMeterDtoList(new ArrayList<>());
|
|
|
- }
|
|
|
- replaceMeterCountDto.getReplaceMeterDtoList().add(replaceMeterDtoList.get(i));
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- replaceMap.putAll(childReplaceMap);
|
|
|
+
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Map<String ,AmountSynRespDto> map = lists.stream().collect(Collectors.toMap(AmountSynRespDto::getFileNo, Function.identity(), (key1, key2) -> key2));
|
|
|
+ //换表记录
|
|
|
+ HashMap<BigInteger, ReplaceMeterCountDto> replaceMap = new HashMap<>();
|
|
|
+ LocalDateTime stTime = LocalDateTime.ofInstant(baseClosingAccountInfoDto.getStartTime().toInstant(), ZoneId.systemDefault());
|
|
|
+ HashMap<BigInteger, ReplaceMeterCountDto> childReplaceMap = amountWaterUsedAmountMapper.getRepalceRecordCount(stTime,null,null,null,customerId);
|
|
|
+ if(childReplaceMap.size() >0){
|
|
|
+ List<ReplaceMeterDto> replaceMeterDtoList = amountWaterUsedAmountMapper.getRepalceRecordDetail(stTime,null,null,null,customerId);
|
|
|
+ if(replaceMeterDtoList.size() >0){
|
|
|
+ for(int i=0;i<replaceMeterDtoList.size();i++){
|
|
|
+ if(childReplaceMap.containsKey(replaceMeterDtoList.get(i).getDeviceId())){
|
|
|
+ ReplaceMeterCountDto replaceMeterCountDto = childReplaceMap.get(replaceMeterDtoList.get(i).getDeviceId());
|
|
|
+ if(replaceMeterCountDto.getReplaceMeterDtoList() == null)
|
|
|
+ {
|
|
|
+ replaceMeterCountDto.setReplaceMeterDtoList(new ArrayList<>());
|
|
|
}
|
|
|
+ replaceMeterCountDto.getReplaceMeterDtoList().add(replaceMeterDtoList.get(i));
|
|
|
}
|
|
|
+ }
|
|
|
+ }
|
|
|
+ replaceMap.putAll(childReplaceMap);
|
|
|
+ }
|
|
|
|
|
|
- for (AmountWaterUsedAmountDto amountWaterUsedAmountDto : amountWaterUsedAmountDtos) {
|
|
|
- BigInteger watermeterId = amountWaterUsedAmountDto.getWatermeterId();
|
|
|
- if (watermeterId != null && clearingDataHashMap.containsKey(watermeterId)) {
|
|
|
- ClearingDataInfoDto clearingDataDTO = clearingDataHashMap.get(watermeterId);
|
|
|
- BigInteger amountId = amountWaterUsedAmountDto.getId();//水量id
|
|
|
- BigDecimal readingOld = amountWaterUsedAmountDto.getLastreading();//上期止度
|
|
|
- if (clearingDataDTO.getCurrentPeriodData() != null) {
|
|
|
- BigDecimal readingNew = new BigDecimal(clearingDataDTO.getCurrentPeriodData()).setScale(0, BigDecimal.ROUND_DOWN);//本期止度
|
|
|
- BigInteger meterid = amountWaterUsedAmountDto.getWatermeterId();//水表id
|
|
|
- BigDecimal payAmount = BigDecimal.ZERO;//结算水量
|
|
|
- Date lastAmountDate = amountWaterUsedAmountDto.getLastrecorddate();
|
|
|
- BigDecimal Amount = BigDecimal.ZERO;//实际用水量
|
|
|
- BigDecimal tempReading = BigDecimal.ZERO;
|
|
|
- tempReading = readingOld;//起度或上期的止度
|
|
|
- String readDate = clearingDataDTO.getMeterReadDate();
|
|
|
- Integer calculateway = amountWaterUsedAmountDto.getCalculateway();
|
|
|
-
|
|
|
- //换表记录计算
|
|
|
- boolean replace = false;
|
|
|
- ReplaceMeterCountDto replaceMeterCountDto=null;
|
|
|
- if(replaceMap.containsKey(watermeterId)){
|
|
|
- replaceMeterCountDto = replaceMap.get(watermeterId);
|
|
|
- //有换表记录且换表时间在两次同步之间 用水量=(换表中的旧表止度-上次抄表止度) + (本次止度-换表中的新表起度)
|
|
|
- if(replaceMeterCountDto != null){
|
|
|
- LocalDateTime currTime = LocalDateTime.parse(readDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S"));//本次抄表时间
|
|
|
- LocalDateTime previousTime = LocalDateTime.ofInstant(amountWaterUsedAmountDto.getLastrecorddate().toInstant(),ZoneId.systemDefault()); //上个帐期的结算抄表时间
|
|
|
-
|
|
|
- ReplaceMeterDto oldReplaceMeterDto = null;
|
|
|
- for(int i = 0;i<replaceMeterCountDto.getReplaceMeterDtoList().size();i++){
|
|
|
- LocalDateTime replaceTime = replaceMeterCountDto.getReplaceMeterDtoList().get(i).getReplaceTime(); //换表时间
|
|
|
-
|
|
|
- Duration duration1 = Duration.between(previousTime,replaceTime);
|
|
|
- Duration duration2 = Duration.between(replaceTime,currTime);
|
|
|
- if(duration1.toMillis() > 0 && duration2.toMinutes() > 0){
|
|
|
- BigDecimal replaceEndData = new BigDecimal(replaceMeterCountDto.getReplaceMeterDtoList().get(i).getOldEnd()).setScale(2,BigDecimal.ROUND_DOWN);//换表中的旧表止度
|
|
|
- BigDecimal replaceData = BigDecimal.ZERO;
|
|
|
- if(oldReplaceMeterDto == null)
|
|
|
- replaceData = tempReading;
|
|
|
- else
|
|
|
- replaceData = new BigDecimal(oldReplaceMeterDto.getNewBegin()).setScale(0,BigDecimal.ROUND_DOWN);//换表中的起度
|
|
|
- BigDecimal oldMeterUse = replaceEndData.subtract(replaceData); //旧表用量
|
|
|
-
|
|
|
- Amount = Amount.add(oldMeterUse);
|
|
|
- replace = true;
|
|
|
-
|
|
|
- oldReplaceMeterDto = replaceMeterCountDto.getReplaceMeterDtoList().get(i);
|
|
|
- }
|
|
|
- else {
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- //新表用量
|
|
|
- if(oldReplaceMeterDto != null){
|
|
|
- BigDecimal replaceNewDate = new BigDecimal(oldReplaceMeterDto.getNewBegin()).setScale(0,BigDecimal.ROUND_DOWN);//换表中的新表起度
|
|
|
- BigDecimal newMeterUse = readingNew.subtract(replaceNewDate);//新表用量
|
|
|
- Amount = Amount.add(newMeterUse);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
+ for (AmountWaterUsedAmountDto amountWaterUsedAmountDto : amountWaterUsedAmountDtos) {
|
|
|
+ BigInteger watermeterId = amountWaterUsedAmountDto.getWatermeterId();
|
|
|
+ if (watermeterId != null && map.containsKey(amountWaterUsedAmountDto.getMetercode())) {
|
|
|
+ AmountSynRespDto amountSynRespDto = map.get(amountWaterUsedAmountDto.getMetercode());
|
|
|
+ BigInteger amountId = amountWaterUsedAmountDto.getId();//水量id
|
|
|
+ BigDecimal readingOld = amountWaterUsedAmountDto.getLastreading();//上期止度
|
|
|
+ if (amountSynRespDto.getReading() != null) {
|
|
|
+ BigDecimal readingNew = new BigDecimal(amountSynRespDto.getReading()).setScale(0, BigDecimal.ROUND_DOWN);//本期止度
|
|
|
+ BigInteger meterid = amountWaterUsedAmountDto.getWatermeterId();//水表id
|
|
|
+ BigDecimal payAmount = BigDecimal.ZERO;//结算水量
|
|
|
+ Date lastAmountDate = amountWaterUsedAmountDto.getLastrecorddate();
|
|
|
+ BigDecimal Amount = BigDecimal.ZERO;//实际用水量
|
|
|
+ BigDecimal tempReading = BigDecimal.ZERO;
|
|
|
+ tempReading = readingOld;//起度或上期的止度
|
|
|
+ String readDate = amountSynRespDto.getCurrentPeriodDate();
|
|
|
+ Integer calculateway = amountWaterUsedAmountDto.getCalculateway();
|
|
|
+
|
|
|
+ //换表记录计算
|
|
|
+ boolean replace = false;
|
|
|
+ ReplaceMeterCountDto replaceMeterCountDto=null;
|
|
|
+ if(replaceMap.containsKey(watermeterId)){
|
|
|
+ replaceMeterCountDto = replaceMap.get(watermeterId);
|
|
|
+ //有换表记录且换表时间在两次同步之间 用水量=(换表中的旧表止度-上次抄表止度) + (本次止度-换表中的新表起度)
|
|
|
+ if(replaceMeterCountDto != null){
|
|
|
+ LocalDateTime currTime = LocalDateTime.parse(readDate, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S"));//本次抄表时间
|
|
|
+ LocalDateTime previousTime = LocalDateTime.ofInstant(amountWaterUsedAmountDto.getLastrecorddate().toInstant(),ZoneId.systemDefault()); //上个帐期的结算抄表时间
|
|
|
+
|
|
|
+ ReplaceMeterDto oldReplaceMeterDto = null;
|
|
|
+ for(int i = 0;i<replaceMeterCountDto.getReplaceMeterDtoList().size();i++){
|
|
|
+ LocalDateTime replaceTime = replaceMeterCountDto.getReplaceMeterDtoList().get(i).getReplaceTime(); //换表时间
|
|
|
+
|
|
|
+ Duration duration1 = Duration.between(previousTime,replaceTime);
|
|
|
+ Duration duration2 = Duration.between(replaceTime,currTime);
|
|
|
+ if(duration1.toMillis() > 0 && duration2.toMinutes() > 0){
|
|
|
+ BigDecimal replaceEndData = new BigDecimal(replaceMeterCountDto.getReplaceMeterDtoList().get(i).getOldEnd()).setScale(2,BigDecimal.ROUND_DOWN);//换表中的旧表止度
|
|
|
+ BigDecimal replaceData = BigDecimal.ZERO;
|
|
|
+ if(oldReplaceMeterDto == null)
|
|
|
+ replaceData = tempReading;
|
|
|
+ else
|
|
|
+ replaceData = new BigDecimal(oldReplaceMeterDto.getNewBegin()).setScale(0,BigDecimal.ROUND_DOWN);//换表中的起度
|
|
|
+ BigDecimal oldMeterUse = replaceEndData.subtract(replaceData); //旧表用量
|
|
|
+
|
|
|
+ Amount = Amount.add(oldMeterUse);
|
|
|
+ replace = true;
|
|
|
+
|
|
|
+ oldReplaceMeterDto = replaceMeterCountDto.getReplaceMeterDtoList().get(i);
|
|
|
}
|
|
|
-
|
|
|
- if(!replace){
|
|
|
- if (readingNew.compareTo(tempReading) > 0)
|
|
|
- Amount = Amount.add(readingNew.subtract(tempReading));
|
|
|
+ else {
|
|
|
+ break;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
+ //新表用量
|
|
|
+ if(oldReplaceMeterDto != null){
|
|
|
+ BigDecimal replaceNewDate = new BigDecimal(oldReplaceMeterDto.getNewBegin()).setScale(0,BigDecimal.ROUND_DOWN);//换表中的新表起度
|
|
|
+ BigDecimal newMeterUse = readingNew.subtract(replaceNewDate);//新表用量
|
|
|
+ Amount = Amount.add(newMeterUse);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- //计量方式判断
|
|
|
-
|
|
|
- if (calculateway.equals(1))//按实际用量
|
|
|
- payAmount = Amount;
|
|
|
- else if (calculateway.equals(2))//按固定量
|
|
|
- payAmount = BigDecimal.valueOf(amountWaterUsedAmountDto.getFixedamount());
|
|
|
- else
|
|
|
- payAmount = Amount;
|
|
|
+ if(!replace){
|
|
|
+ if (readingNew.compareTo(tempReading) > 0)
|
|
|
+ Amount = Amount.add(readingNew.subtract(tempReading));
|
|
|
+ }
|
|
|
|
|
|
- if (payAmount.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+ //计量方式判断
|
|
|
+ if (calculateway.equals(1))//按实际用量
|
|
|
+ payAmount = Amount;
|
|
|
+ else if (calculateway.equals(2))//按固定量
|
|
|
+ payAmount = BigDecimal.valueOf(amountWaterUsedAmountDto.getFixedamount());
|
|
|
+ else
|
|
|
+ payAmount = Amount;
|
|
|
|
|
|
- amountWaterUsedAmountDto.setReading(readingNew);
|
|
|
- amountWaterUsedAmountDto.setRecorddate(DateTimeUtil.parseDate(readDate, DateTimeUtil.DATE_TIME_FORMAT_SECOND));
|
|
|
- amountWaterUsedAmountDto.setAmount(Amount);
|
|
|
- amountWaterUsedAmountDto.setPayamount(payAmount);
|
|
|
+ if (payAmount.compareTo(BigDecimal.ZERO) < 0) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
- updates.add(amountWaterUsedAmountDto);
|
|
|
+ amountWaterUsedAmountDto.setReading(readingNew);
|
|
|
+ amountWaterUsedAmountDto.setRecorddate(DateTimeUtil.parseDate(readDate, DateTimeUtil.DATE_TIME_FORMAT_SECOND));
|
|
|
+ amountWaterUsedAmountDto.setAmount(Amount);
|
|
|
+ amountWaterUsedAmountDto.setPayamount(payAmount);
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
+ updates.add(amountWaterUsedAmountDto);
|
|
|
|
|
|
}
|
|
|
- if (updates.size() > 0) {
|
|
|
- //List<List<AmountWaterUsedAmountDto>> lists = Lists.partition(updates, 500);
|
|
|
- for (AmountWaterUsedAmountDto amountWaterUsedAmountDto : updates) {
|
|
|
- amountWaterUsedAmountMapper.batchUpdate(amountWaterUsedAmountDto);
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- log.info("水量同步结束:" + LocalDateTime.now());
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
+ if (updates.size() > 0) {
|
|
|
+ //List<List<AmountWaterUsedAmountDto>> lists = Lists.partition(updates, 500);
|
|
|
+ for (AmountWaterUsedAmountDto amountWaterUsedAmount : updates) {
|
|
|
+ amountWaterUsedAmountMapper.batchUpdate(amountWaterUsedAmount);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
- }*/
|
|
|
+ log.info("水量同步结束:" + LocalDateTime.now());
|
|
|
+
|
|
|
+ }
|
|
|
}
|