|
@@ -192,9 +192,6 @@ public class TOrderController {
|
|
|
return JsonMessage.error("参数错误");
|
|
|
}
|
|
|
|
|
|
- if (equipment == null) {
|
|
|
- return JsonMessage.error("找不到设备");
|
|
|
- }
|
|
|
|
|
|
Long equipmentId = equipment.getId();
|
|
|
//查找商品
|
|
@@ -230,12 +227,13 @@ public class TOrderController {
|
|
|
|
|
|
// 支付方式:0或null为汇聚,1为汇付支付
|
|
|
String payPlatform = admin.getPayPlatform();
|
|
|
+ String companyType = admin.getCompanyType();
|
|
|
// 汇聚分账参数
|
|
|
JSONArray altInfo = new JSONArray();
|
|
|
// 汇付分账明细参数
|
|
|
JSONObject acctSplitBunch = new JSONObject();
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion, price);
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
|
|
|
} else {
|
|
|
altInfo = getAltInfo(proportion, price);
|
|
|
}
|
|
@@ -282,14 +280,14 @@ public class TOrderController {
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(admin.getId());
|
|
|
+ order.setAgencyId(proportion.getAgencyId());
|
|
|
}
|
|
|
if(admin.getType()==1){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
order.setAgencyId(proportion.getAgencyId());
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(admin.getId());
|
|
|
+ order.setMerchantId(proportion.getMerchantId());
|
|
|
}
|
|
|
if(admin.getType()==2){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
@@ -298,7 +296,7 @@ public class TOrderController {
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
order.setMerchantId(proportion.getMerchantId());
|
|
|
order.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
- order.setPersonageId(admin.getId());
|
|
|
+ order.setPersonageId(proportion.getPersonageId());
|
|
|
}
|
|
|
|
|
|
order.setPayPlatform(payPlatform);
|
|
@@ -315,7 +313,7 @@ public class TOrderController {
|
|
|
orderDetails.setProductNumber(productNumber);
|
|
|
orderDetails.setAmount(price);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
- orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setCompanyType(companyType);
|
|
|
orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
String client6 = clientId.substring(clientId.length() - 6);
|
|
@@ -332,8 +330,12 @@ public class TOrderController {
|
|
|
tHuifuTempOrder.setId(id);
|
|
|
BeanUtil.copyProperties(order,tHuifuTempOrder,ignoreProperties);
|
|
|
huifuTempOrderService.save(tHuifuTempOrder);
|
|
|
- result = HuifuConstant.JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
- System.out.println(result);
|
|
|
+ if (StrUtil.isNotEmpty(companyType)&&companyType.equals("1")) {
|
|
|
+ result = HuifuConstant.SC_JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ } else {
|
|
|
+ result = HuifuConstant.SZ_JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ }
|
|
|
+ log.info("返回链接:{}", result);
|
|
|
String qrcode = toQrcode(result);
|
|
|
JSONObject kindData = new JSONObject();
|
|
|
kindData.put("sn", sn);
|
|
@@ -344,7 +346,7 @@ public class TOrderController {
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
orderNo, amount, productName1, productDesc,
|
|
|
- notifyUrl, frpCode, openId, appid, acctSplitBunch
|
|
|
+ notifyUrl, frpCode, openId, appid, acctSplitBunch, companyType
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -490,12 +492,13 @@ public class TOrderController {
|
|
|
|
|
|
// 支付方式:0或null为汇聚,1为汇付支付
|
|
|
String payPlatform = admin.getPayPlatform();
|
|
|
+ String companyType = admin.getCompanyType();
|
|
|
// 汇聚分账参数
|
|
|
JSONArray altInfo = new JSONArray();
|
|
|
// 汇付分账明细参数
|
|
|
JSONObject acctSplitBunch = new JSONObject();
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion, price);
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
|
|
|
} else {
|
|
|
altInfo = getAltInfo(proportion, price);
|
|
|
}
|
|
@@ -543,14 +546,14 @@ public class TOrderController {
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(admin.getId());
|
|
|
+ order.setAgencyId(proportion.getAgencyId());
|
|
|
}
|
|
|
if(admin.getType()==1){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
order.setAgencyId(proportion.getAgencyId());
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(admin.getId());
|
|
|
+ order.setMerchantId(proportion.getMerchantId());
|
|
|
}
|
|
|
if(admin.getType()==2){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
@@ -559,7 +562,7 @@ public class TOrderController {
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
order.setMerchantId(proportion.getMerchantId());
|
|
|
order.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
- order.setPersonageId(admin.getId());
|
|
|
+ order.setPersonageId(proportion.getPersonageId());
|
|
|
}
|
|
|
order.setPayPlatform(payPlatform);
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
@@ -579,7 +582,7 @@ public class TOrderController {
|
|
|
orderDetails.setProductNumber(productNumber);
|
|
|
orderDetails.setAmount(price);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
- orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setCompanyType(companyType);
|
|
|
orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
|
String client6 = clientId.substring(clientId.length() - 6);
|
|
@@ -589,7 +592,7 @@ public class TOrderController {
|
|
|
order.setAcctSplitBunch(acctSplitBunch.toString());
|
|
|
try {
|
|
|
result = huifuMchService.cardPay(
|
|
|
- orderNo, amount, productName1, notifyUrl, authCode, acctSplitBunch
|
|
|
+ orderNo, amount, productName1, notifyUrl, authCode, acctSplitBunch, companyType
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -727,12 +730,13 @@ public class TOrderController {
|
|
|
|
|
|
// 支付方式:0或null为汇聚,1为汇付支付
|
|
|
String payPlatform = admin.getPayPlatform();
|
|
|
+ String companyType = admin.getCompanyType();
|
|
|
// 汇聚分账参数
|
|
|
JSONArray altInfo = new JSONArray();
|
|
|
// 汇付分账明细参数
|
|
|
JSONObject acctSplitBunch = new JSONObject();
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion, price);
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
|
|
|
} else {
|
|
|
altInfo = getAltInfo(proportion, price);
|
|
|
}
|
|
@@ -776,19 +780,19 @@ public class TOrderController {
|
|
|
order.setAltInfo(altInfo.toString());
|
|
|
order.setStatus(0);
|
|
|
order.setType(admin.getType());
|
|
|
- order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setCompanyType(companyType);
|
|
|
order.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(admin.getId());
|
|
|
+ order.setAgencyId(proportion.getAgencyId());
|
|
|
}
|
|
|
if(admin.getType()==1){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
order.setAgencyId(proportion.getAgencyId());
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(admin.getId());
|
|
|
+ order.setMerchantId(proportion.getMerchantId());
|
|
|
}
|
|
|
if(admin.getType()==2){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
@@ -797,7 +801,7 @@ public class TOrderController {
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
order.setMerchantId(proportion.getMerchantId());
|
|
|
order.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
- order.setPersonageId(admin.getId());
|
|
|
+ order.setPersonageId(proportion.getPersonageId());
|
|
|
}
|
|
|
order.setPayPlatform(payPlatform);
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
@@ -818,9 +822,31 @@ public class TOrderController {
|
|
|
order2.setFrpCode(frpCode2);
|
|
|
order2.setAltInfo(altInfo.toString());
|
|
|
order2.setStatus(0);
|
|
|
+ order2.setType(admin.getType());
|
|
|
order2.setPayPlatform(payPlatform);
|
|
|
- order2.setCompanyType(admin.getCompanyType());
|
|
|
+ order2.setCompanyType(companyType);
|
|
|
order2.setMachineType(equipment.getMachineType());
|
|
|
+ if(admin.getType()==0){
|
|
|
+ order2.setAdminProportion(proportion.getAdminProportion());
|
|
|
+ order2.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
+ order2.setAgencyId(proportion.getAgencyId());
|
|
|
+ }
|
|
|
+ if(admin.getType()==1){
|
|
|
+ order2.setAdminProportion(proportion.getAdminProportion());
|
|
|
+ order2.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
+ order2.setAgencyId(proportion.getAgencyId());
|
|
|
+ order2.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
+ order2.setMerchantId(proportion.getMerchantId());
|
|
|
+ }
|
|
|
+ if(admin.getType()==2){
|
|
|
+ order2.setAdminProportion(proportion.getAdminProportion());
|
|
|
+ order2.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
+ order2.setAgencyId(proportion.getAgencyId());
|
|
|
+ order2.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
+ order2.setMerchantId(proportion.getMerchantId());
|
|
|
+ order2.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
+ order2.setPersonageId(proportion.getPersonageId());
|
|
|
+ }
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
order2.setIsSettlement("0");
|
|
|
}
|
|
@@ -834,7 +860,7 @@ public class TOrderController {
|
|
|
orderDetails.setProductNo(product.getNo());
|
|
|
orderDetails.setProductNumber(productNumber);
|
|
|
orderDetails.setAmount(price);
|
|
|
- orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setCompanyType(companyType);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
@@ -852,12 +878,17 @@ public class TOrderController {
|
|
|
tHuifuTempOrder.setId(id);
|
|
|
BeanUtil.copyProperties(order,tHuifuTempOrder,ignoreProperties);
|
|
|
huifuTempOrderService.save(tHuifuTempOrder);
|
|
|
- String result1 = HuifuConstant.JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ String result1 = "";
|
|
|
+ if (StrUtil.isNotEmpty(companyType)&&companyType.equals("1")) {
|
|
|
+ result1 = HuifuConstant.SC_JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ } else {
|
|
|
+ result1 = HuifuConstant.SZ_JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ }
|
|
|
// 支付宝
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
sn2, amount, productName1, productDesc,
|
|
|
- notifyUrl, frpCode2, openId, appid, acctSplitBunch
|
|
|
+ notifyUrl, frpCode2, openId, appid, acctSplitBunch,companyType
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -1117,12 +1148,13 @@ public class TOrderController {
|
|
|
|
|
|
// 支付方式:0或null为汇聚,1为汇付支付
|
|
|
String payPlatform = admin.getPayPlatform();
|
|
|
+ String companyType = admin.getCompanyType();
|
|
|
// 汇聚分账参数
|
|
|
JSONArray altInfo = new JSONArray();
|
|
|
// 汇付分账明细参数
|
|
|
JSONObject acctSplitBunch = new JSONObject();
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion, price);
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
|
|
|
} else {
|
|
|
altInfo = getAltInfo(proportion, price);
|
|
|
}
|
|
@@ -1170,19 +1202,19 @@ public class TOrderController {
|
|
|
order.setProductNumber(productNumber);
|
|
|
order.setStatus(0);
|
|
|
order.setType(admin.getType());
|
|
|
- order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setCompanyType(companyType);
|
|
|
order.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(admin.getId());
|
|
|
+ order.setAgencyId(proportion.getAgencyId());
|
|
|
}
|
|
|
if(admin.getType()==1){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
order.setAgencyId(proportion.getAgencyId());
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(admin.getId());
|
|
|
+ order.setMerchantId(proportion.getMerchantId());
|
|
|
}
|
|
|
if(admin.getType()==2){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
@@ -1191,7 +1223,7 @@ public class TOrderController {
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
order.setMerchantId(proportion.getMerchantId());
|
|
|
order.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
- order.setPersonageId(admin.getId());
|
|
|
+ order.setPersonageId(proportion.getPersonageId());
|
|
|
}
|
|
|
order.setPayPlatform(payPlatform);
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
@@ -1212,29 +1244,29 @@ public class TOrderController {
|
|
|
order2.setAltInfo(altInfo.toString());
|
|
|
order2.setStatus(0);
|
|
|
order2.setProductNumber(productNumber);
|
|
|
- order.setType(admin.getType());
|
|
|
- order.setCompanyType(admin.getCompanyType());
|
|
|
+ order2.setType(admin.getType());
|
|
|
+ order2.setCompanyType(companyType);
|
|
|
order2.setMachineType(equipment.getMachineType());
|
|
|
if(admin.getType()==0){
|
|
|
- order.setAdminProportion(proportion.getAdminProportion());
|
|
|
- order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(admin.getId());
|
|
|
+ order2.setAdminProportion(proportion.getAdminProportion());
|
|
|
+ order2.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
+ order2.setAgencyId(proportion.getAgencyId());
|
|
|
}
|
|
|
if(admin.getType()==1){
|
|
|
- order.setAdminProportion(proportion.getAdminProportion());
|
|
|
- order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(proportion.getAgencyId());
|
|
|
- order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(admin.getId());
|
|
|
+ order2.setAdminProportion(proportion.getAdminProportion());
|
|
|
+ order2.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
+ order2.setAgencyId(proportion.getAgencyId());
|
|
|
+ order2.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
+ order2.setMerchantId(proportion.getMerchantId());
|
|
|
}
|
|
|
if(admin.getType()==2){
|
|
|
- order.setAdminProportion(proportion.getAdminProportion());
|
|
|
- order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(proportion.getAgencyId());
|
|
|
- order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(proportion.getMerchantId());
|
|
|
- order.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
- order.setPersonageId(admin.getId());
|
|
|
+ order2.setAdminProportion(proportion.getAdminProportion());
|
|
|
+ order2.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
+ order2.setAgencyId(proportion.getAgencyId());
|
|
|
+ order2.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
+ order2.setMerchantId(proportion.getMerchantId());
|
|
|
+ order2.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
+ order2.setPersonageId(proportion.getPersonageId());
|
|
|
}
|
|
|
order2.setPayPlatform(payPlatform);
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
@@ -1246,7 +1278,7 @@ public class TOrderController {
|
|
|
orderDetails.setAdminId(admin.getId());
|
|
|
orderDetails.setEquipmentId(equipmentId);
|
|
|
orderDetails.setCreateDate(new Date());
|
|
|
- orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setCompanyType(companyType);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
@@ -1273,12 +1305,17 @@ public class TOrderController {
|
|
|
tHuifuTempOrder.setId(id);
|
|
|
BeanUtil.copyProperties(order,tHuifuTempOrder,ignoreProperties);
|
|
|
huifuTempOrderService.save(tHuifuTempOrder);
|
|
|
- String result1 = HuifuConstant.JUMP_URL+"/#/weChatPay?id=" + id;
|
|
|
+ String result1 = "";
|
|
|
+ if (StrUtil.isNotEmpty(companyType)&&companyType.equals("1")) {
|
|
|
+ result1 = HuifuConstant.SC_JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ } else {
|
|
|
+ result1 = HuifuConstant.SZ_JUMP_URL+ "/#/weChatPay?id=" + id;
|
|
|
+ }
|
|
|
// 支付宝
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
sn2, amount, productName1, productDesc,
|
|
|
- notifyUrl, frpCode2, openId, appid, acctSplitBunch
|
|
|
+ notifyUrl, frpCode2, openId, appid, acctSplitBunch, companyType
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -1578,12 +1615,13 @@ public class TOrderController {
|
|
|
|
|
|
// 支付方式:0或null为汇聚,1为汇付支付
|
|
|
String payPlatform = admin.getPayPlatform();
|
|
|
+ String companyType = admin.getCompanyType();
|
|
|
// 汇聚分账参数
|
|
|
JSONArray altInfo = new JSONArray();
|
|
|
// 汇付分账明细参数
|
|
|
JSONObject acctSplitBunch = new JSONObject();
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion, price);
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
|
|
|
} else {
|
|
|
altInfo = getAltInfo(proportion, price);
|
|
|
}
|
|
@@ -1673,7 +1711,7 @@ public class TOrderController {
|
|
|
order.setType(admin.getType());
|
|
|
order.setMarketingAmount(marketingAmount);
|
|
|
order.setProductNumber(productNumber);
|
|
|
- order.setCompanyType(admin.getCompanyType());
|
|
|
+ order.setCompanyType(companyType);
|
|
|
order.setMachineType(equipment.getMachineType());
|
|
|
if(couponList.size()>0){
|
|
|
order.setCoupons(couponList.toString());
|
|
@@ -1681,14 +1719,14 @@ public class TOrderController {
|
|
|
if(admin.getType()==0){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
- order.setAgencyId(admin.getId());
|
|
|
+ order.setAgencyId(proportion.getAgencyId());
|
|
|
}
|
|
|
if(admin.getType()==1){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
|
order.setAgencyProportion(proportion.getAgencyProportion());
|
|
|
order.setAgencyId(proportion.getAgencyId());
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
- order.setMerchantId(admin.getId());
|
|
|
+ order.setMerchantId(proportion.getMerchantId());
|
|
|
}
|
|
|
if(admin.getType()==2){
|
|
|
order.setAdminProportion(proportion.getAdminProportion());
|
|
@@ -1697,7 +1735,7 @@ public class TOrderController {
|
|
|
order.setMerchantProportion(proportion.getMerchantProportion());
|
|
|
order.setMerchantId(proportion.getMerchantId());
|
|
|
order.setPersonageProportion(proportion.getPersonageProportion());
|
|
|
- order.setPersonageId(admin.getId());
|
|
|
+ order.setPersonageId(proportion.getPersonageId());
|
|
|
}
|
|
|
order.setPayPlatform(payPlatform);
|
|
|
if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
|
|
@@ -1726,7 +1764,7 @@ public class TOrderController {
|
|
|
orderDetails.setAdminId(admin.getId());
|
|
|
orderDetails.setEquipmentId(equipmentId);
|
|
|
orderDetails.setCreateDate(new Date());
|
|
|
- orderDetails.setCompanyType(admin.getCompanyType());
|
|
|
+ orderDetails.setCompanyType(companyType);
|
|
|
orderDetails.setRefundStatus("0");
|
|
|
orderDetails.setMachineType(equipment.getMachineType());
|
|
|
|
|
@@ -1747,7 +1785,7 @@ public class TOrderController {
|
|
|
try {
|
|
|
result = huifuMchService.uniPay(
|
|
|
orderNo1, amount, productName1, productDesc,
|
|
|
- notifyUrl, frpCode1, openId, appid, acctSplitBunch
|
|
|
+ notifyUrl, frpCode1, openId, appid, acctSplitBunch, companyType
|
|
|
);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -1819,27 +1857,54 @@ public class TOrderController {
|
|
|
// 获取code
|
|
|
String code = request.getParameter("code");
|
|
|
String id = request.getParameter("state");
|
|
|
- // 获取openid
|
|
|
- String openUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
|
|
|
- "appid=" + HuifuConstant.WX_SUB_APP_ID +
|
|
|
- "&secret=" + HuifuConstant.WX_APP_SECRET +
|
|
|
- "&code=" + code +
|
|
|
- "&grant_type=authorization_code";
|
|
|
- org.json.JSONObject jsonObject = HttpClientUtils.get(openUrl);
|
|
|
- String openid = jsonObject.getString("openid");
|
|
|
- // 从临时表中获取订单信息
|
|
|
LambdaQueryWrapper<THuifuTempOrder> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.eq(THuifuTempOrder::getId,id);
|
|
|
THuifuTempOrder huifuTempOrder = huifuTempOrderService.getOne(wrapper);
|
|
|
+ // 从临时表中获取订单信息
|
|
|
String result = null;
|
|
|
- if(huifuTempOrder.getStatus() == 1) {
|
|
|
-// result = "http://szwltest.sunzee.com.cn/shenze/#/popPayment?status=1";
|
|
|
- result = HuifuConstant.JUMP_URL+"/#/popPayment?status=1";
|
|
|
- } else {
|
|
|
- try {
|
|
|
- result = huifuMchService.wetchatPay(huifuTempOrder,openid);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
+ if(huifuTempOrder != null) {
|
|
|
+ String companyType = huifuTempOrder.getCompanyType();
|
|
|
+ if(huifuTempOrder.getStatus() == 1) {
|
|
|
+ if(StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
+ result = HuifuConstant.SC_JUMP_URL+"/#/popPayment?status=1";
|
|
|
+ } else {
|
|
|
+ result = HuifuConstant.SZ_JUMP_URL+"/#/popPayment?status=1";
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ String openid;
|
|
|
+ if(StrUtil.isNotEmpty(companyType) && companyType.equals("1")) {
|
|
|
+ // 获取openid
|
|
|
+ try {
|
|
|
+ String openUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
|
|
|
+ "appid=" + HuifuConstant.SC_WX_SUB_APP_ID +
|
|
|
+ "&secret=" + HuifuConstant.SC_WX_APP_SECRET +
|
|
|
+ "&code=" + code +
|
|
|
+ "&grant_type=authorization_code";
|
|
|
+ log.info("获取openID:{}", openUrl);
|
|
|
+ org.json.JSONObject jsonObject = HttpClientUtils.get(openUrl);
|
|
|
+ log.info("获取openID结果:{}", jsonObject);
|
|
|
+ openid = jsonObject.getString("openid");
|
|
|
+ result = huifuMchService.wetchatPay(huifuTempOrder,openid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // 获取openid
|
|
|
+ try {
|
|
|
+ String openUrl = "https://api.weixin.qq.com/sns/oauth2/access_token?" +
|
|
|
+ "appid=" + HuifuConstant.SZ_WX_SUB_APP_ID +
|
|
|
+ "&secret=" + HuifuConstant.SZ_WX_APP_SECRET +
|
|
|
+ "&code=" + code +
|
|
|
+ "&grant_type=authorization_code";
|
|
|
+ log.info("获取openID:{}", openUrl);
|
|
|
+ org.json.JSONObject jsonObject = HttpClientUtils.get(openUrl);
|
|
|
+ log.info("获取openID结果:{}", jsonObject);
|
|
|
+ openid = jsonObject.getString("openid");
|
|
|
+ result = huifuMchService.wetchatPay(huifuTempOrder,openid);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
log.info("支付链接:{}",result);
|
|
@@ -2570,10 +2635,10 @@ public class TOrderController {
|
|
|
order.setRefundAmount(newRefundAmount);
|
|
|
// 如果小于订单金额
|
|
|
if(newRefundAmount.compareTo(order.getPrice()) < 0) {
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion,order.getPrice().subtract(newRefundAmount)).toString();
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion,order.getPrice().subtract(newRefundAmount), order.getCompanyType()).toString();
|
|
|
order.setAcctSplitBunch(acctSplitBunch);
|
|
|
} else {
|
|
|
- acctSplitBunch = getAcctSplitBunch(proportion,order.getPrice()).toString();
|
|
|
+ acctSplitBunch = getAcctSplitBunch(proportion,order.getPrice(), order.getCompanyType()).toString();
|
|
|
order.setAcctSplitBunch(acctSplitBunch);
|
|
|
}
|
|
|
} else {
|
|
@@ -2581,7 +2646,7 @@ public class TOrderController {
|
|
|
if(new BigDecimal(ordAmt).setScale(2, RoundingMode.HALF_UP).compareTo(order.getPrice()) < 0) {
|
|
|
// 重新设置分销
|
|
|
acctSplitBunch = getAcctSplitBunch(proportion,order.getPrice()
|
|
|
- .subtract(new BigDecimal(ordAmt).setScale(2,RoundingMode.HALF_UP))).toString();
|
|
|
+ .subtract(new BigDecimal(ordAmt).setScale(2,RoundingMode.HALF_UP)), order.getCompanyType()).toString();
|
|
|
order.setAcctSplitBunch(acctSplitBunch);
|
|
|
}
|
|
|
}
|
|
@@ -3165,7 +3230,8 @@ public class TOrderController {
|
|
|
merchantJson = new JSONObject();
|
|
|
merchantJson.put("altMchNo", selfMch.getAltMchNo());
|
|
|
merchantJson.put("altAmount", selfAmount.toString());
|
|
|
- merchantJson.put("isGuar", "12");altInfo.add(merchantJson);
|
|
|
+ merchantJson.put("isGuar", "12");
|
|
|
+ altInfo.add(merchantJson);
|
|
|
break;
|
|
|
}
|
|
|
Iterator<Object> iterator = altInfo.iterator();
|
|
@@ -3185,7 +3251,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();
|
|
@@ -3232,7 +3298,12 @@ 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();
|
|
@@ -3258,7 +3329,12 @@ 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();
|
|
@@ -3294,7 +3370,12 @@ 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();
|
|
@@ -3332,7 +3413,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());
|
|
@@ -3344,5 +3425,277 @@ public class TOrderController {
|
|
|
return acctSplitBunch;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 旧版退款成功回调
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping(value = "/oldNotifyRefund", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ public Object oldNotifyRefund(HttpServletRequest request) {
|
|
|
+
|
|
|
+ String r6_Status = request.getParameter("ra_Status");
|
|
|
+
|
|
|
+ // 订单号
|
|
|
+ String sn = request.getParameter("r2_OrderNo");
|
|
|
+ // 退款订单号
|
|
|
+ String refundSn = request.getParameter("r3_RefundOrderNo");
|
|
|
+ String num = refundSn.substring(refundSn.length() - 1);
|
|
|
+ Integer refundNumber = Integer.valueOf(num);
|
|
|
+
|
|
|
+// LambdaQueryWrapper<TOrder> query = Wrappers.lambdaQuery();
|
|
|
+ LambdaQueryWrapper<TOrder> query = new LambdaQueryWrapper<>();
|
|
|
+ query.eq(TOrder::getSn,sn);
|
|
|
+ if(StringUtils.isEmpty(sn)){
|
|
|
+ return "error";
|
|
|
+ }
|
|
|
+// List<TOrder> list = orderService.list(query);
|
|
|
+// TOrder order = list.get(0);
|
|
|
+ TOrder order = orderService.getOne(query);
|
|
|
+ if (order == null) {
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ if (order.getStatus() == 3) {
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ // 判断退款版本号是否存在
|
|
|
+ String refundOrderNo = order.getRefundOrderNo();
|
|
|
+ if(StringUtils.isNotEmpty(refundOrderNo)) {
|
|
|
+ if(refundSn.equals(refundOrderNo)) {
|
|
|
+ try {
|
|
|
+ esTOrderService.updateDataById(order);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 订单商品数量
|
|
|
+ Integer productNumber = order.getProductNumber();
|
|
|
+ if (JoinpayConstant.r6_Status_100.equals(r6_Status)) {
|
|
|
+ // 设置退款版本号
|
|
|
+ order.setRefundOrderNo(refundSn);
|
|
|
+ // 已退款
|
|
|
+ if(productNumber >= refundNumber){
|
|
|
+ productNumber -= refundNumber;
|
|
|
+ order.setProductNumber(productNumber);
|
|
|
+ }
|
|
|
+ // r4_refundAmount: 退款金额
|
|
|
+ BigDecimal r4_refundAmount = new BigDecimal(request.getParameter("r4_RefundAmount_str"));
|
|
|
+ if(order.getRefundMarketingAmount()!=null){
|
|
|
+ r4_refundAmount =r4_refundAmount.add(order.getRefundMarketingAmount());
|
|
|
+ }
|
|
|
+ // price: 当前订单退完款剩余的金额
|
|
|
+ BigDecimal price = order.getPrice();
|
|
|
+ // 判断退款金额是否小于订单余额
|
|
|
+ if(r4_refundAmount.compareTo(price)==-1){
|
|
|
+ // refundAmount: 已退款金额
|
|
|
+ BigDecimal refundAmount = order.getRefundAmount();
|
|
|
+ if(refundAmount!=null){
|
|
|
+ // 如果已退款金额不为空,则加上退款金额
|
|
|
+ order.setRefundAmount(refundAmount.add(r4_refundAmount));
|
|
|
+ }else {
|
|
|
+ // 已退款金额
|
|
|
+ order.setRefundAmount(r4_refundAmount);
|
|
|
+ }
|
|
|
+ // 订单设置为支付状态
|
|
|
+ order.setStatus(1);
|
|
|
+ // 改变订单的金额,原先金额减去退款金额
|
|
|
+ order.setPrice(price.subtract(r4_refundAmount));
|
|
|
+ // 重置分销
|
|
|
+ if(order.getAltInfo()!=null) {
|
|
|
+ TEquipment tEquipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
+ String altInfo = altInfoReset(tEquipment.getId(), price.subtract(r4_refundAmount));
|
|
|
+ order.setAltInfo(altInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断退款金额是否等于订单余额
|
|
|
+ if(r4_refundAmount.compareTo(price)==0){
|
|
|
+ BigDecimal refundAmount = order.getRefundAmount();
|
|
|
+// order.setAltInfo("");
|
|
|
+ order.setProductNumber(1);
|
|
|
+ if(refundAmount!=null){
|
|
|
+ order.setRefundAmount(refundAmount.add(r4_refundAmount));
|
|
|
+ // 全部退完款重新加回已退款的金额
|
|
|
+ order.setPrice(order.getPrice().add(refundAmount));
|
|
|
+ }else {
|
|
|
+ // 退款金额
|
|
|
+ order.setRefundAmount(r4_refundAmount);
|
|
|
+ }
|
|
|
+ order.setStatus(3);
|
|
|
+ if(order.getAltInfo()!=null) {
|
|
|
+ TEquipment tEquipment = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
+ String altInfo = altInfoReset(tEquipment.getId(), order.getRefundAmount());
|
|
|
+ order.setAltInfo(altInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 支付平台产生的退款流水号
|
|
|
+ String r5_RefundTrxNo = request.getParameter("r5_RefundTrxNo");
|
|
|
+ order.setRefundTrxNo(r5_RefundTrxNo);
|
|
|
+ order.setRefundDate(new Date());
|
|
|
+ order.setModifyDate(new Date());
|
|
|
+// orderService.updateById(order);
|
|
|
+ String orderStatus = order.getOrderStatus();
|
|
|
+ if(StringUtils.isNotEmpty(orderStatus)&&orderStatus.equals("0")){
|
|
|
+ if(order.getStatus().toString().equals("3")){
|
|
|
+ TEquipment byClientId = R.getDataIfSuccess(szwlFeign.findEquipmentByClientId(order.getClientId()));
|
|
|
+ JSONObject kindData = new JSONObject();
|
|
|
+ String s = order.getId().toString();
|
|
|
+ if(s.length()>6){
|
|
|
+ s = s.substring(s.length()-6,s.length());
|
|
|
+ }
|
|
|
+ kindData.put("mealCode", s);
|
|
|
+ equipmentService.sentMessage(byClientId.getClientId(), PushUtils.buildJson("refuse_success", kindData.toString()).toString());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ esTOrderService.updateDataById(order);
|
|
|
+ }catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }finally {
|
|
|
+ orderService.updateById(order);
|
|
|
+ }
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+
|
|
|
+ public String altInfoReset(Long equipmentId, BigDecimal price) {
|
|
|
+ //获取分销 关联设备
|
|
|
+ TProportion proportion = R.getDataIfSuccess(szwlFeign.getProportion(String.valueOf(equipmentId)));
|
|
|
+
|
|
|
+ Integer type = proportion.getType();
|
|
|
+ JSONArray altInfo = new JSONArray();
|
|
|
+ JSONArray altNewInfo = new JSONArray();
|
|
|
+
|
|
|
+ BigDecimal adminProportion = null, agencyProportion = null, merchantProportion = null, personageProportion = null, selfProportion = null;
|
|
|
+ Long agencyId = proportion.getAgencyId();
|
|
|
+ Long merchantId = proportion.getMerchantId();
|
|
|
+ Long personageId = proportion.getPersonageId();
|
|
|
+
|
|
|
+ String orderType = null;
|
|
|
+
|
|
|
+
|
|
|
+ BigDecimal agencyAmount = null;
|
|
|
+ BigDecimal merchantAmount = null;
|
|
|
+ BigDecimal personageAmount = null;
|
|
|
+ BigDecimal selfAmount = null;
|
|
|
+
|
|
|
+ TJoinpayMch agencyMch = null;
|
|
|
+ TJoinpayMch merchantMch = null;
|
|
|
+ TJoinpayMch personageMch = null;
|
|
|
+ TJoinpayMch selfMch = null;
|
|
|
+
|
|
|
+ JSONObject agencyJson = null;
|
|
|
+ JSONObject merchantJson = null;
|
|
|
+ JSONObject personageJson = null;
|
|
|
+ JSONObject selfJson = null;
|
|
|
+
|
|
|
+ // 砍掉千6手续费
|
|
|
+// BigDecimal cutPrice = price.multiply(new BigDecimal(99.4)).divide(new BigDecimal(100));
|
|
|
+ //取消平台扣手续费
|
|
|
+ BigDecimal cutPrice = price.multiply(new BigDecimal(100)).divide(new BigDecimal(100));
|
|
|
+
|
|
|
+ switch (type) {
|
|
|
+
|
|
|
+ case 0:
|
|
|
+ agencyMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAdminId())));
|
|
|
+
|
|
|
+ agencyProportion = proportion.getProportion();
|
|
|
+ adminProportion = proportion.getAdminProportion();
|
|
|
+ orderType = "1";
|
|
|
+ // 代理分销获得利润
|
|
|
+ agencyAmount = cutPrice.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ agencyJson = new JSONObject();
|
|
|
+ agencyJson.put("altMchNo", agencyMch.getAltMchNo());
|
|
|
+ agencyJson.put("altAmount", agencyAmount.toString());
|
|
|
+ agencyJson.put("isGuar", "12");
|
|
|
+ altInfo.add(agencyJson);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ agencyMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAgencyId())));
|
|
|
+
|
|
|
+ selfMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAdminId())));
|
|
|
+
|
|
|
+ agencyProportion = proportion.getAgencyProportion();
|
|
|
+ adminProportion = proportion.getAdminProportion();
|
|
|
+ selfProportion = proportion.getProportion();
|
|
|
+ orderType = "2";
|
|
|
+
|
|
|
+ BigDecimal refuseAmount = new BigDecimal(0.00);
|
|
|
+ if(agencyProportion.compareTo(refuseAmount) == 0||agencyProportion==null){
|
|
|
+// System.out.println("a等于b");
|
|
|
+ }else {
|
|
|
+ // 一级分销获得利润
|
|
|
+ agencyAmount = cutPrice.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ agencyJson = new JSONObject();
|
|
|
+ agencyJson.put("altMchNo", agencyMch.getAltMchNo());
|
|
|
+ agencyJson.put("altAmount", agencyAmount.toString());
|
|
|
+ agencyJson.put("isGuar", "12");
|
|
|
+ altInfo.add(agencyJson);
|
|
|
+ }
|
|
|
+ // 商家自己分销获得利润
|
|
|
+ selfAmount = cutPrice.multiply(selfProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ merchantJson = new JSONObject();
|
|
|
+ merchantJson.put("altMchNo", selfMch.getAltMchNo());
|
|
|
+ merchantJson.put("altAmount", selfAmount.toString());
|
|
|
+ merchantJson.put("isGuar", "12");
|
|
|
+ altInfo.add(merchantJson);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ agencyMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAgencyId())));
|
|
|
+
|
|
|
+ merchantMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getMerchantId())));
|
|
|
+
|
|
|
+ selfMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAdminId())));
|
|
|
+
|
|
|
+ agencyProportion = proportion.getAgencyProportion();
|
|
|
+ adminProportion = proportion.getAdminProportion();
|
|
|
+ merchantProportion = proportion.getMerchantProportion();
|
|
|
+ personageProportion = proportion.getPersonageProportion();
|
|
|
+ selfProportion = proportion.getProportion();
|
|
|
+ orderType = "3";
|
|
|
+ BigDecimal refuseAmount1 = new BigDecimal(0.00);
|
|
|
+ if(agencyProportion.compareTo(refuseAmount1) == 0||agencyProportion==null){
|
|
|
+// System.out.println("a等于b");
|
|
|
+ }else {
|
|
|
+ // 代理分销获得利润
|
|
|
+ agencyAmount = cutPrice.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ agencyJson = new JSONObject();
|
|
|
+ agencyJson.put("altMchNo", agencyMch.getAltMchNo());
|
|
|
+ agencyJson.put("altAmount", agencyAmount.toString());
|
|
|
+ agencyJson.put("isGuar", "12");
|
|
|
+ altInfo.add(agencyJson);
|
|
|
+
|
|
|
+ }
|
|
|
+ if(merchantProportion.compareTo(refuseAmount1) == 0||merchantProportion==null){
|
|
|
+// System.out.println("a等于b");
|
|
|
+ }else {
|
|
|
+ // 经销商分销获得利润
|
|
|
+ merchantAmount = cutPrice.multiply(merchantProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ merchantJson = new JSONObject();
|
|
|
+ merchantJson.put("altMchNo", merchantMch.getAltMchNo());
|
|
|
+ merchantJson.put("altAmount", merchantAmount.toString());
|
|
|
+ merchantJson.put("isGuar", "12");
|
|
|
+ altInfo.add(merchantJson);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 商家自己分销获得利润
|
|
|
+ selfAmount = cutPrice.multiply(selfProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
+ merchantJson = new JSONObject();
|
|
|
+ merchantJson.put("altMchNo", selfMch.getAltMchNo());
|
|
|
+ merchantJson.put("altAmount", selfAmount.toString());
|
|
|
+ merchantJson.put("isGuar", "12");
|
|
|
+ altInfo.add(merchantJson);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return altInfo.toString();
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|