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

@@ -255,8 +255,8 @@ public class LianLianServiceImpl implements LianLianService {
String dataSecret = "KnGhAb88GtUEPb0j"; // SPBNJ1Z5EQNmpK08 VTAEKDPVN9CUS7WO
String dataSecretIV = "XZ4wURhuo2y8s4ZS"; // peRoTcb2C7zqKeII 83UZFFRRZDYNF5CR
String signSecret = "sRjCDeokckFGpYpA"; // sRjCDeokckFGpYpA
String dataString = "pZLkdIJdqGhgVcTEhSQXv7VBj9jRQ+Cjy49RPHeuFkFZreXmtD20J/yVyOKw2GtC5rt7NT20dANzPKIw4GVYrqsBsSaGKZuFTbn7KKf//Jdj5CgBNtGgS5H6wD6F41zHnGegmo\n" +
"hhWPW7WcVBow3CL87rGOaqnOWyLXLh9FlOs9WLtZdIbC47n8agmp7Pcx99Bu7n8e5+lUz1s7NZCsJoknrUl4EhONzGgKu8Hos2W34n7AOM3IzTR/oHBVJtg0cjvnj0zKbweGmTWbIWrY3sJQ==";
String dataString = "pZLkdIJdqGhgVcTEhSQXv7VBj9jRQ+Cjy49RPHeuFkHPOx+D8XLNGFhB/6ZdNDx3D3NEjNx3ua0sTLGv3bC5PkRw2FMiAEA8uM4N6RzDLvoU4C7DnH+gAvpfTocaU1FudrWo2AYme\n" +
"16T37pVsoN5Ztq5RflzYR2utOY2lwFKAHcTqS6Mk1wMW3FZiIB2SbBL+ANRANfmqwVXN8qdJ0MwifuEZZHhZlcdQf7KoQnuMYf4MS1fjGvg3l6R7a8DxvE7WC0WskINuIyq0m9sBPPww4BidRzJdCBSaamiFlzuKzY18p1eFfyjU9mZoe5R3sQze9gBCs1Uj0/dPDXeQOOscmEWs8Fd2mIxaoatUNbhrxekISxpIVhf3bC/nSGWU+F5Qo4x9alm1UcTr6xGZOHr2PejOLxYJKYgt2rNpbQUh+c=";
// 解密data
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(dataString), dataSecret.getBytes(), dataSecretIV.getBytes());
@@ -766,8 +766,8 @@ public class LianLianServiceImpl implements LianLianService {
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())) // 开始时间
.endTime(DateUtils.getDateTime()) // 本次采样时间
.totalPower(new BigDecimal(data.getChargingDegree()).setScale(2, BigDecimal.ROUND_HALF_UP)) // 累计充电量
.elecMoney(totalElectricityAmount.setScale(2, BigDecimal.ROUND_HALF_UP)) // 累计电费
.seviceMoney(totalServiceAmount.setScale(2, BigDecimal.ROUND_HALF_UP)) // 累计服务费
.elecMoney(totalElectricityAmount.setScale(4, BigDecimal.ROUND_HALF_UP)) // 累计电费
.seviceMoney(totalServiceAmount.setScale(4, BigDecimal.ROUND_HALF_UP)) // 累计服务费
.totalMoney(new BigDecimal(data.getChargingAmount())) // 已充金额
.build();

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));