灌溉记录用水量/10000,刷卡记录用户余额/100

This commit is contained in:
mi9688 2025-01-07 18:11:11 +08:00
parent 99e3a161a8
commit ee536f7386

View File

@ -33,6 +33,7 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.LocalTime;
@ -285,7 +286,7 @@ public class DeviceOtherMsgConsumer {
ngCardSwipeRecords.setAreaCode(areaCode);//区域号
ngCardSwipeRecords.setCardSwipeType(0);//开阀
ngCardSwipeRecords.setCardSwipeTime(DateUtils.getNowDate());//刷卡时间
ngCardSwipeRecords.setAmountDue(userBalance);//用户余额
ngCardSwipeRecords.setAmountDue(userBalance.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));//用户余额
if(cardInfo!=null && cardInfo.getUserId()!=null){
ngCardSwipeRecords.setUserId(cardList.get(0).getUserId());//用户id
}
@ -361,7 +362,7 @@ public class DeviceOtherMsgConsumer {
BigDecimal currentFlow=closeCumFlow.subtract(irrigationRecordList.get(0).getOpenCumFlow());//计算结果为当前用水量
//当前用水量
log.info("设备{}本次灌溉用户当前用水量{}",serialNumber,currentFlow);
userIrrigationRecord.setCurFlow(currentFlow);
userIrrigationRecord.setCurFlow(currentFlow.divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP));
BigDecimal userBalance=dataJson.getBigDecimal("userBalance");//用户余额
System.err.println("用户余额:"+userBalance);
@ -387,7 +388,7 @@ public class DeviceOtherMsgConsumer {
ngCardSwipeRecords.setAreaCode(areaCode);//区域号
ngCardSwipeRecords.setCardSwipeType(1);//关阀
ngCardSwipeRecords.setCardSwipeTime(DateUtils.getNowDate());//刷卡时间
ngCardSwipeRecords.setAmountDue(userBalance);//用户余额
ngCardSwipeRecords.setAmountDue(userBalance.divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP));//用户余额
// ngCardSwipeRecords.setUserId(cardList.get(0).getUserId());//用户id