|
@@ -51,11 +51,15 @@ public class PayServiceImpl implements PayService {
|
|
*/
|
|
*/
|
|
String merNo = "10001720";
|
|
String merNo = "10001720";
|
|
/**
|
|
/**
|
|
- * 公账,子商户商编
|
|
|
|
|
|
+ * 公账-专票,子商户商编
|
|
*/
|
|
*/
|
|
String publicAccountNo = "20001793";
|
|
String publicAccountNo = "20001793";
|
|
/**
|
|
/**
|
|
- * 私账,子商户商编
|
|
|
|
|
|
+ * 公账-普票,子商户商编
|
|
|
|
+ */
|
|
|
|
+ String commonInvoiceNo = "20001754";
|
|
|
|
+ /**
|
|
|
|
+ * 私账-无票,子商户商编
|
|
*/
|
|
*/
|
|
String privateAccountNo = "20001924";
|
|
String privateAccountNo = "20001924";
|
|
|
|
|
|
@@ -179,8 +183,10 @@ public class PayServiceImpl implements PayService {
|
|
splitAccount.setMbOrderId(mbOrderId);
|
|
splitAccount.setMbOrderId(mbOrderId);
|
|
if (subUserNo.equals(publicAccountNo)) {
|
|
if (subUserNo.equals(publicAccountNo)) {
|
|
splitAccount.setType("1");
|
|
splitAccount.setType("1");
|
|
- } else {
|
|
|
|
|
|
+ } else if (subUserNo.equals(privateAccountNo)) {
|
|
splitAccount.setType("2");
|
|
splitAccount.setType("2");
|
|
|
|
+ } else {
|
|
|
|
+ splitAccount.setType("3");
|
|
}
|
|
}
|
|
splitAccount.setSubUserNo(subUserNo);
|
|
splitAccount.setSubUserNo(subUserNo);
|
|
if ("1".equals(splitBillType)) {
|
|
if ("1".equals(splitBillType)) {
|
|
@@ -249,14 +255,19 @@ public class PayServiceImpl implements PayService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
List<OrderProductVo> orderProductList = payDao.fandAllOrderProduct(order.getOrderID().intValue());
|
|
List<OrderProductVo> orderProductList = payDao.fandAllOrderProduct(order.getOrderID().intValue());
|
|
- //私账应付总金额
|
|
|
|
|
|
+ //私账-无票总金额
|
|
BigDecimal privateAccountAmount = BigDecimal.ZERO;
|
|
BigDecimal privateAccountAmount = BigDecimal.ZERO;
|
|
|
|
+ //公账-普票总金额
|
|
|
|
+ BigDecimal commonAmount = BigDecimal.ZERO;
|
|
if ("0".equals(order.getSecondHandOrderFlag())) {
|
|
if ("0".equals(order.getSecondHandOrderFlag())) {
|
|
//非二手订单才统计
|
|
//非二手订单才统计
|
|
for (OrderProductVo orderProduct : orderProductList) {
|
|
for (OrderProductVo orderProduct : orderProductList) {
|
|
//不含税-不能开票,则分账到私账银行卡
|
|
//不含税-不能开票,则分账到私账银行卡
|
|
if ("0".equals(orderProduct.getIncludedTax()) && "3".equals(orderProduct.getInvoiceType())) {
|
|
if ("0".equals(orderProduct.getIncludedTax()) && "3".equals(orderProduct.getInvoiceType())) {
|
|
privateAccountAmount = MathUtil.add(privateAccountAmount, orderProduct.getShouldPayFee());
|
|
privateAccountAmount = MathUtil.add(privateAccountAmount, orderProduct.getShouldPayFee());
|
|
|
|
+ } else if ("2".equals(orderProduct.getInvoiceType())) {
|
|
|
|
+ //普通发票
|
|
|
|
+ commonAmount = MathUtil.add(commonAmount, orderProduct.getShouldPayFee());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -272,8 +283,10 @@ public class PayServiceImpl implements PayService {
|
|
BigDecimal privateAccount = MathUtil.div(MathUtil.mul(fashionableAmount, privateAccountAmount), order.getPayTotalFee(), 8);
|
|
BigDecimal privateAccount = MathUtil.div(MathUtil.mul(fashionableAmount, privateAccountAmount), order.getPayTotalFee(), 8);
|
|
log.info("分给私账金额>>>>>>>>>>>>>>>>>>>>>>>" + privateAccount);
|
|
log.info("分给私账金额>>>>>>>>>>>>>>>>>>>>>>>" + privateAccount);
|
|
privateAccount = MathUtil.div(MathUtil.mul(fashionableAmount, privateAccountAmount), order.getPayTotalFee(), 2);
|
|
privateAccount = MathUtil.div(MathUtil.mul(fashionableAmount, privateAccountAmount), order.getPayTotalFee(), 2);
|
|
|
|
+ //分给公账-普票金额
|
|
|
|
+ BigDecimal commonInvoice = MathUtil.div(MathUtil.mul(fashionableAmount, commonAmount), order.getPayTotalFee(), 2);
|
|
if (MathUtil.compare(privateAccount, 0) != 0) {
|
|
if (MathUtil.compare(privateAccount, 0) != 0) {
|
|
- //私账
|
|
|
|
|
|
+ //私账-无票
|
|
Map<String, String> map1 = new HashMap<>(3);
|
|
Map<String, String> map1 = new HashMap<>(3);
|
|
map1.put("subUserNo", privateAccountNo);
|
|
map1.put("subUserNo", privateAccountNo);
|
|
map1.put("splitBillType", "2");
|
|
map1.put("splitBillType", "2");
|
|
@@ -282,12 +295,22 @@ public class PayServiceImpl implements PayService {
|
|
map1.put("splitBillValue", String.valueOf(splitBillValue));
|
|
map1.put("splitBillValue", String.valueOf(splitBillValue));
|
|
list.add(map1);
|
|
list.add(map1);
|
|
}
|
|
}
|
|
- if (MathUtil.compare(privateAccount, fashionableAmount) != 0) {
|
|
|
|
- //公账
|
|
|
|
|
|
+ if (MathUtil.compare(commonInvoice, 0) != 0) {
|
|
|
|
+ //公账-普票
|
|
|
|
+ Map<String, String> map3 = new HashMap<>(3);
|
|
|
|
+ map3.put("subUserNo", commonInvoiceNo);
|
|
|
|
+ map3.put("splitBillType", "2");
|
|
|
|
+ BigDecimal splitBillValue = MathUtil.round(MathUtil.mul(commonInvoice, 100), 0);
|
|
|
|
+ map3.put("splitBillValue", String.valueOf(splitBillValue));
|
|
|
|
+ list.add(map3);
|
|
|
|
+ }
|
|
|
|
+ BigDecimal publicAccount = MathUtil.add(privateAccount, commonInvoice);
|
|
|
|
+ if (MathUtil.compare(publicAccount, fashionableAmount) != 0) {
|
|
|
|
+ //公账-专票
|
|
Map<String, String> map2 = new HashMap<>(3);
|
|
Map<String, String> map2 = new HashMap<>(3);
|
|
map2.put("subUserNo", publicAccountNo);
|
|
map2.put("subUserNo", publicAccountNo);
|
|
map2.put("splitBillType", "2");
|
|
map2.put("splitBillType", "2");
|
|
- BigDecimal splitBillValue = MathUtil.round(MathUtil.mul(MathUtil.sub(fashionableAmount, privateAccount), 100), 0);
|
|
|
|
|
|
+ BigDecimal splitBillValue = MathUtil.round(MathUtil.mul(MathUtil.sub(fashionableAmount, publicAccount), 100), 0);
|
|
map2.put("splitBillValue", String.valueOf(splitBillValue));
|
|
map2.put("splitBillValue", String.valueOf(splitBillValue));
|
|
list.add(map2);
|
|
list.add(map2);
|
|
}
|
|
}
|