|
@@ -141,9 +141,6 @@ public class PayServiceImpl implements PayService {
|
|
|
json.put("attach", attach);
|
|
|
//分账详情
|
|
|
splitBillDetail = splitBillDetail(order, payment);
|
|
|
- if ("分账失败".equals(splitBillDetail)) {
|
|
|
- return model.error("本次付款金额过小,分账失败");
|
|
|
- }
|
|
|
log.info("分账详情>>>>>>>单位/分>>>" + splitBillDetail);
|
|
|
json.put("splitBillDetail", splitBillDetail);
|
|
|
String sign = PayUtils.buildSign(json, merKey);
|
|
@@ -254,10 +251,13 @@ public class PayServiceImpl implements PayService {
|
|
|
List<OrderProductVo> orderProductList = payDao.fandAllOrderProduct(order.getOrderID().intValue());
|
|
|
//私账应付总金额
|
|
|
BigDecimal privateAccountAmount = BigDecimal.ZERO;
|
|
|
- for (OrderProductVo orderProduct : orderProductList) {
|
|
|
- //不含税-不能开票,则分账到私账银行卡
|
|
|
- if ("0".equals(orderProduct.getIncludedTax()) && "3".equals(orderProduct.getInvoiceType())) {
|
|
|
- privateAccountAmount = MathUtil.add(privateAccountAmount, orderProduct.getShouldPayFee());
|
|
|
+ if ("0".equals(order.getSecondHandOrderFlag())) {
|
|
|
+ //非二手订单才统计
|
|
|
+ for (OrderProductVo orderProduct : orderProductList) {
|
|
|
+ //不含税-不能开票,则分账到私账银行卡
|
|
|
+ if ("0".equals(orderProduct.getIncludedTax()) && "3".equals(orderProduct.getInvoiceType())) {
|
|
|
+ privateAccountAmount = MathUtil.add(privateAccountAmount, orderProduct.getShouldPayFee());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
if (MathUtil.compare(privateAccountAmount, order.getPayTotalFee()) == 0 || "1".equals(order.getSecondHandOrderFlag())) {
|
|
@@ -270,9 +270,6 @@ public class PayServiceImpl implements PayService {
|
|
|
} else {
|
|
|
//分给私账金额
|
|
|
BigDecimal privateAccount = MathUtil.div(MathUtil.mul(fashionableAmount, privateAccountAmount), order.getPayTotalFee());
|
|
|
- if (MathUtil.compare(privateAccount, 0) == 0 && MathUtil.compare(privateAccountAmount, 0) > 0) {
|
|
|
- return "分账失败";
|
|
|
- }
|
|
|
if (MathUtil.compare(privateAccount, 0) != 0) {
|
|
|
//私账
|
|
|
Map<String, String> map1 = new HashMap<>(3);
|
|
@@ -283,13 +280,15 @@ public class PayServiceImpl implements PayService {
|
|
|
map1.put("splitBillValue", String.valueOf(splitBillValue));
|
|
|
list.add(map1);
|
|
|
}
|
|
|
- //公账
|
|
|
- Map<String, String> map2 = new HashMap<>(3);
|
|
|
- map2.put("subUserNo", publicAccountNo);
|
|
|
- map2.put("splitBillType", "2");
|
|
|
- BigDecimal splitBillValue = MathUtil.round(MathUtil.mul(MathUtil.sub(fashionableAmount, privateAccount), 100), 0);
|
|
|
- map2.put("splitBillValue", String.valueOf(splitBillValue));
|
|
|
- list.add(map2);
|
|
|
+ if (MathUtil.compare(privateAccount, fashionableAmount) != 0) {
|
|
|
+ //公账
|
|
|
+ Map<String, String> map2 = new HashMap<>(3);
|
|
|
+ map2.put("subUserNo", publicAccountNo);
|
|
|
+ map2.put("splitBillType", "2");
|
|
|
+ BigDecimal splitBillValue = MathUtil.round(MathUtil.mul(MathUtil.sub(fashionableAmount, privateAccount), 100), 0);
|
|
|
+ map2.put("splitBillValue", String.valueOf(splitBillValue));
|
|
|
+ list.add(map2);
|
|
|
+ }
|
|
|
}
|
|
|
return JSONObject.toJSONString(list);
|
|
|
}
|