|
@@ -1626,6 +1626,19 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
log.error("微信支付成功通知成功,未查询到分账信息,不进行分账");
|
|
|
return stringStringMap;
|
|
|
}
|
|
|
+ BigDecimal shBigDecimal =BigDecimal.ZERO;
|
|
|
+ try {
|
|
|
+ shBigDecimal = getBigDecimal(priceSum, separateAccounts.getShSeparateAccounts());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("百分比计算错误", e);
|
|
|
+ }
|
|
|
+ BigDecimal ptBigDecimal =BigDecimal.ZERO;
|
|
|
+ try {
|
|
|
+ ptBigDecimal = getBigDecimal(priceSum, separateAccounts.getPtSeparateAccounts());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("百分比计算错误", e);
|
|
|
+ }
|
|
|
+ BigDecimal mdBigDecimal = priceSum.subtract(shBigDecimal).subtract(ptBigDecimal).setScale(2, RoundingMode.HALF_UP);
|
|
|
|
|
|
log.info("支付成功消息通知,门店添加明细:"+JSONObject.toJSONString(receiptPaymentDetailsInfoVoMd));
|
|
|
iReceiptPaymentDetailsInfoService.add(receiptPaymentDetailsInfoVoMd);
|
|
@@ -1635,23 +1648,29 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
return stringStringMap;
|
|
|
}
|
|
|
|
|
|
- private void getReceiptPaymentDetailsInfoVo(ReceiptPaymentDetailsInfoVo receiptPaymentDetailsInfoVo,BigDecimal proportion,String orgCode,String deptId,Integer deptType,BigDecimal priceSum){
|
|
|
- receiptPaymentDetailsInfoVo.setOrgCode(orgCode);
|
|
|
+
|
|
|
+
|
|
|
+ private void getChangeMoney(ReceiptPaymentDetailsInfoVo receiptPaymentDetailsInfoVo,String orgCode,String deptId,Integer deptType,BigDecimal changeMoney){
|
|
|
receiptPaymentDetailsInfoVo.setDeptId(deptId);
|
|
|
receiptPaymentDetailsInfoVo.setDeptType(deptType);
|
|
|
+ receiptPaymentDetailsInfoVo.setOrgCode(orgCode);
|
|
|
+ receiptPaymentDetailsInfoVo.setChangeMoney(changeMoney);
|
|
|
+ }
|
|
|
+ private BigDecimal getBigDecimal(BigDecimal priceSum,BigDecimal proportion){
|
|
|
if (proportion==null){
|
|
|
- receiptPaymentDetailsInfoVo.setChangeMoney(BigDecimal.ZERO);
|
|
|
- }else{
|
|
|
- if (proportion.compareTo(BigDecimal.ZERO)==0){
|
|
|
- receiptPaymentDetailsInfoVo.setChangeMoney(BigDecimal.ZERO);
|
|
|
- }else {
|
|
|
-
|
|
|
-// receiptPaymentDetailsInfoVo.setChangeMoney();
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ }else {
|
|
|
+ if (proportion.compareTo(BigDecimal.ZERO) == 0) {
|
|
|
+ return BigDecimal.ZERO;
|
|
|
+ } else { // 将百分比转换为小数(例如:50% -> 0.5)
|
|
|
+ BigDecimal divisor = proportion.divide(BigDecimal.valueOf(100), 4, RoundingMode.HALF_UP);
|
|
|
+ // 执行除法运算,设置精度和舍入模式
|
|
|
+ return priceSum.divide(divisor, 2, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* @return String 订单号
|
|
|
* @Author SheepHy
|