修改用户结算订单,金额小数后2位不在四舍五入

This commit is contained in:
yuyang 2021-10-21 16:19:43 +08:00
parent df5db7c729
commit b658941045
2 changed files with 39 additions and 38 deletions

View File

@ -286,6 +286,7 @@ public class XhpcPileOrderController extends BaseController {
totalPower =totalPower+cacheOrderData.getT4PowerQuantity();
powerPrice=powerPrice.add(multiply);
}
powerPrice =powerPrice.setScale(2,BigDecimal.ROUND_DOWN);
//总服务费
BigDecimal servicePrice = money.subtract(powerPrice);
//剩余的电费
@ -600,17 +601,17 @@ public class XhpcPileOrderController extends BaseController {
xhpcHistoryOrder.setSortingStatus(0);
xhpcHistoryOrder.setType(1);
//订单总价---运维服务费抽成
xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc());
xhpcHistoryOrder.setEndSoc(xhpcChargeOrder.getEndSoc());
xhpcHistoryOrder.setReconciliationStatus(0);

View File

@ -341,17 +341,17 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
xhpcHistoryOrder.setSortingStatus(0);
xhpcHistoryOrder.setType(1);
//订单总价---运维服务费抽成
xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_HALF_UP));
xhpcHistoryOrder.setTotalPrice(money.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setPromotionDiscount(promotionDiscount.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setActPrice(actPrice.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setActPowerPrice(surplusPowerPrice.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setActServicePrice(surplusServicePrice.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setInternetCommission(internetCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setInternetSvcCommission(internetSvcCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setPlatformCommission(platformCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setPlatformSvcCommisssion(platformSvcCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setOperationCommission(operationCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setOperationSvcCommission(operationSvcCommission.setScale(2, BigDecimal.ROUND_DOWN));
xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc());
xhpcHistoryOrder.setEndSoc(xhpcChargeOrder.getEndSoc());
xhpcHistoryOrder.setReconciliationStatus(0);
@ -376,21 +376,21 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
xhpcHistoryOrderService.insert(xhpcHistoryOrder);
//添加流水
xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date);
//xhpcChargeOrderService.addUserAccountStatement(userId, actPrice.negate(), subtract, xhpcChargeOrder.getChargeOrderId(), 3, date);
try{
Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
if(xhpcChargingPile !=null){
//发送短信
if(user.get("phone") !=null){
if("1".equals(xhpcChargingPile.get("type").toString())){
String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。";
smsService.sendNotice(user.get("phone").toString(),content);
}else{
String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。";
smsService.sendNotice(user.get("phone").toString(),content);
}
}
}
// Map<String, Object> xhpcChargingPile = xhpcChargeOrderService.getXhpcChargingPile(xhpcChargeOrder.getTerminalId());
// if(xhpcChargingPile !=null){
// //发送短信
// if(user.get("phone") !=null){
// if("1".equals(xhpcChargingPile.get("type").toString())){
// String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,电量为:" + xhpcChargeOrder.getEndSoc() + "%,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。";
// smsService.sendNotice(user.get("phone").toString(),content);
// }else{
// String content = "【小华停止充电】尊敬的用户,你的爱车已停止充电,总费用为:" + actPrice + "元,充电费用明细,请查询小华充电小程序,谢谢。";
// smsService.sendNotice(user.get("phone").toString(),content);
// }
// }
// }
}catch (Exception e){
logger.info("<<<<<<<<<<<<<<<<发送短信失败>>>>>>>>>>>>>>>>>");
}
@ -398,7 +398,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
executorService.execute(new Runnable() {
@Override
public void run() {
addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
// addPileEndOrder(xhpcHistoryOrder, xhpcChargeOrder, xhpcChargeOrder.getSerialNumber(),1);
}
});
}
@ -412,7 +412,7 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService {
double time = (updateTime2.getTime()-startTime2.getTime())/60000;
BigDecimal decimal = new BigDecimal(time).setScale(2);
//每分钟多少度
BigDecimal degree =chargingDegree.divide(decimal,2,BigDecimal.ROUND_HALF_UP);
BigDecimal degree =chargingDegree.divide(decimal,2,BigDecimal.ROUND_DOWN);
//获取费率时间段
String startTime = DateUtil.formatTime(startTime2);
String endTime = DateUtil.formatTime(updateTime2);