|
@@ -200,6 +200,7 @@ public class TOrderController {
|
|
|
|
|
|
//需要知道订单是哪一个平台的,不能以账号的为标准 0或null为汇聚,1为汇付支付
|
|
|
String payPlatform = order.getPayPlatform();
|
|
|
+ String companyType = order.getCompanyType();
|
|
|
if (StringUtils.isNotEmpty(payPlatform) && payPlatform.equals("1")) {
|
|
|
try {
|
|
|
Date date = order.getCreateDate();
|
|
@@ -208,15 +209,15 @@ public class TOrderController {
|
|
|
// BigDecimal refundAmount = order.getRefundAmount();
|
|
|
// 判断是否退过款
|
|
|
if(refundAmount != null && refundAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion,refusePrice).toString();
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, refusePrice, companyType).toString();
|
|
|
} else {
|
|
|
// 如果退款金额等于订单金额,就直接用原来的分销明细,如果小于就重新计算分销明细
|
|
|
if(refusePrice.compareTo(order.getPrice()) < 0) {
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion,refusePrice).toString();
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, refusePrice, companyType).toString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String refundData = huifuMchService.refund(order.getSn(), price, payDate, remark, acctSplitBunch);
|
|
|
+ String refundData = huifuMchService.refund(order.getSn(), price, payDate, remark, acctSplitBunch, companyType);
|
|
|
//订单号
|
|
|
if(StrUtil.isNotEmpty(refundData)&&(refundData.equals(HuifuConstant.TRANS_STAT_S)||refundData.equals(HuifuConstant.TRANS_STAT_P))) {
|
|
|
order.setStatus(2);
|
|
@@ -402,6 +403,7 @@ public class TOrderController {
|
|
|
|
|
|
//需要知道订单是哪一个平台的,不能以账号的为标准 0或null为汇聚,1为杉德支付
|
|
|
String payPlatform = order.getPayPlatform();
|
|
|
+ String companyType = order.getCompanyType();
|
|
|
if (StringUtils.isNotEmpty(payPlatform) && payPlatform.equals("1")) {
|
|
|
try {
|
|
|
Date date = order.getCreateDate();
|
|
@@ -414,15 +416,15 @@ public class TOrderController {
|
|
|
TProportion proportion = proportionService.getOne(wrapper);
|
|
|
// 判断是否退过款
|
|
|
if(refundAmount != null && refundAmount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion,refusePrice).toString();
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, refusePrice, companyType).toString();
|
|
|
} else {
|
|
|
// 如果退款金额等于订单金额,就直接用原来的分销明细,如果小于就重新计算分销明细
|
|
|
if(refusePrice.compareTo(order.getPrice()) < 0) {
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion,refusePrice).toString();
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, refusePrice, companyType).toString();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String refundData = huifuMchService.refund(order.getSn(), price, payDate, remark, acctSplitBunch);
|
|
|
+ String refundData = huifuMchService.refund(order.getSn(), price, payDate, remark, acctSplitBunch, companyType);
|
|
|
//订单号
|
|
|
if(StrUtil.isNotEmpty(refundData)&&(refundData.equals(HuifuConstant.TRANS_STAT_S)||refundData.equals(HuifuConstant.TRANS_STAT_P))) {
|
|
|
order.setStatus(2);
|
|
@@ -598,7 +600,7 @@ public class TOrderController {
|
|
|
* @param price
|
|
|
* @return
|
|
|
*/
|
|
|
- public JSONObject getAcctSplitBunch(TProportion proportion, BigDecimal price) {
|
|
|
+ public JSONObject getAcctSplitBunch(TProportion proportion, BigDecimal price, String companyType) {
|
|
|
|
|
|
// 获取分账有几方:0:分账方2个,1:分账方3个,2:分账方4个,3:分账方超4个
|
|
|
Integer type = proportion.getType();
|
|
@@ -646,7 +648,11 @@ public class TOrderController {
|
|
|
// 公司平台分销
|
|
|
adminJson = new JSONObject();
|
|
|
adminJson.put("div_amt", adminAmount.toString());
|
|
|
- adminJson.put("huifu_id", HuifuConstant.DIV_HUIFU_ID);
|
|
|
+ if(StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
+ adminJson.put("huifu_id", HuifuConstant.SC_DIV_HUIFU_ID);
|
|
|
+ } else {
|
|
|
+ adminJson.put("huifu_id", HuifuConstant.SZ_DIV_HUIFU_ID);
|
|
|
+ }
|
|
|
acctInfos.add(adminJson);
|
|
|
// 商家分销获得利润
|
|
|
selfJson = new JSONObject();
|
|
@@ -677,7 +683,11 @@ public class TOrderController {
|
|
|
// 公司平台分销
|
|
|
adminJson = new JSONObject();
|
|
|
adminJson.put("div_amt", adminAmount.toString());
|
|
|
- adminJson.put("huifu_id", HuifuConstant.DIV_HUIFU_ID);
|
|
|
+ if(StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
+ adminJson.put("huifu_id", HuifuConstant.SC_DIV_HUIFU_ID);
|
|
|
+ } else {
|
|
|
+ adminJson.put("huifu_id", HuifuConstant.SZ_DIV_HUIFU_ID);
|
|
|
+ }
|
|
|
acctInfos.add(adminJson);
|
|
|
// 商家分销获得利润
|
|
|
selfJson = new JSONObject();
|
|
@@ -721,7 +731,11 @@ public class TOrderController {
|
|
|
// 公司平台分销
|
|
|
adminJson = new JSONObject();
|
|
|
adminJson.put("div_amt", adminAmount.toString());
|
|
|
- adminJson.put("huifu_id", HuifuConstant.DIV_HUIFU_ID);
|
|
|
+ if(StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
+ adminJson.put("huifu_id", HuifuConstant.SC_DIV_HUIFU_ID);
|
|
|
+ } else {
|
|
|
+ adminJson.put("huifu_id", HuifuConstant.SZ_DIV_HUIFU_ID);
|
|
|
+ }
|
|
|
acctInfos.add(adminJson);
|
|
|
// 商家分销获得利润
|
|
|
selfJson = new JSONObject();
|
|
@@ -759,7 +773,7 @@ public class TOrderController {
|
|
|
for (int i = 0; i < acctInfos.size(); i++) {
|
|
|
JSONObject jsonObject = acctInfos.getJSONObject(i);
|
|
|
String huifuId = jsonObject.getString("huifu_id");
|
|
|
- if (huifuId.equals(HuifuConstant.DIV_HUIFU_ID)) {
|
|
|
+ if (huifuId.equals(HuifuConstant.SZ_DIV_HUIFU_ID) || huifuId.equals(HuifuConstant.SC_DIV_HUIFU_ID)) {
|
|
|
BigDecimal currentDivAmt = new BigDecimal(jsonObject.getString("div_amt"));
|
|
|
BigDecimal adjustedDivAmt = currentDivAmt.subtract(diffAmount).max(BigDecimal.ZERO);
|
|
|
jsonObject.put("div_amt", adjustedDivAmt.toString());
|