bugfix 推送设备充电状态服务费、电费保留4位小数

This commit is contained in:
Lemon
2024-01-11 10:44:58 +08:00
parent 64ca3d4154
commit 4ab1022c71
2 changed files with 24 additions and 16 deletions

View File

@@ -192,18 +192,23 @@ public class ZDLServiceImpl implements ZDLService {
}
public static void main(String[] args) {
String areaCode = "330000,330200,330213";
// 根据逗号分组
String[] split = StringUtils.split(areaCode, ",");
// 只取最后一部分
String subAreaCode = split[split.length - 1];
String startTime = "00:00:00"; // 00:00:00 格式
// 需要将中间的冒号去掉
String replace = StringUtils.replace(startTime, ":", "");
System.out.println(replace);
System.out.println(subAreaCode);
String organizationCode = "91310120MAC13L2Q9P";
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
System.out.println(equipmentOwnerId); // MAC13L2Q9
// String areaCode = "330000,330200,330213";
// // 根据逗号分组
// String[] split = StringUtils.split(areaCode, ",");
// // 只取最后一部分
// String subAreaCode = split[split.length - 1];
//
// System.out.println(subAreaCode);
//
//
// String organizationCode = "91310120MAC13L2Q9P";
// String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
// System.out.println(equipmentOwnerId); // MAC13L2Q9
}
/**
@@ -384,7 +389,10 @@ public class ZDLServiceImpl implements ZDLService {
for (BillingPriceVO billingPriceVO : billingPriceVOList) {
// 将时段开始时间、电费、服务费信息进行封装
policyInfo = new EquipBusinessPolicyVO.PolicyInfo();
policyInfo.setStartTime(billingPriceVO.getStartTime() + ":00");
String startTime = billingPriceVO.getStartTime() + ":00"; // 00:00:00 格式
// 需要将中间的冒号去掉,改为 000000 格式
String replace = StringUtils.replace(startTime, ":", "");
policyInfo.setStartTime(replace);
policyInfo.setElecPrice(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
policyInfo.setServicePrice(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));