yonge 2 years ago
parent
commit
c9ba35fdd2

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/PaymentParam.java

@@ -20,6 +20,8 @@ public class PaymentParam {
     
     private String ip;
     
+    private String merNo;
+    
 
     public PaymentParam() {
     }
@@ -127,4 +129,12 @@ public class PaymentParam {
 	public void setIp(String ip) {
 		this.ip = ip;
 	}
+
+	public String getMerNo() {
+		return merNo;
+	}
+
+	public void setMerNo(String merNo) {
+		this.merNo = merNo;
+	}
 }

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/OrderPayOpsServiceImpl.java

@@ -158,6 +158,7 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
         if (tenantOrderRecord.getOrderState() != 0) {
             throw new BizException("订单已处理!");
         }
+        payParam.setMerNo(tenantOrderRecord.getMerNos());
         //获取支付数据
         Map<String, Object> payment;
         try {
@@ -182,6 +183,7 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
             throw new BizException("订单不存在");
         }
         payParam.setTenantId(1);
+        payParam.setMerNo(tenantPaymentOrder.getMerNos());
         try {
             payment = checkOrderAndGetParam(payParam,
                     tenantPaymentOrder,
@@ -204,6 +206,8 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
             throw new BizException("订单不存在");
         }
         
+        payParam.setMerNo(studentPaymentOrder.getMerNos());
+        
         payment = checkOrderAndGetParam(payParam,
                 studentPaymentOrder,
                 StudentPaymentOrder::getStatus,
@@ -256,7 +260,7 @@ public class OrderPayOpsServiceImpl implements OrderPayOpsService {
 			
 			Map<String, Object> params = new HashMap<String, Object>();
 			params.put("parentMerchantNo", hfMerchantConfig.getPlatformPayeeMemberId());
-			params.put("merchantNo", hfMerchantConfig.getPlatformPayeeMemberId());
+			params.put("merchantNo", payParam.getMerNo());
 			params.put("orderId", payParam.getOrderNo());
 			params.put("orderAmount", payParam.getAmount());
 			params.put("notifyUrl", payParam.getNotifyUrl());

+ 9 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentPaymentOrderServiceImpl.java

@@ -567,6 +567,7 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
         TenantContextHolder.clearTenantId();
     }
 
+    @Transactional(rollbackFor = Exception.class)
     public Boolean confirmOrder(StudentPaymentOrder order) {
         // 只有大雅延迟分账,其他实时分账
         if (order.getTenantId() != 1) {
@@ -652,28 +653,31 @@ public class StudentPaymentOrderServiceImpl extends BaseServiceImpl<Long, Studen
 				}
 				BigDecimal splitAmount = new BigDecimal(orderInfo.get("unSplitAmount").toString());
 
-				Map<String, String> divides = new HashMap<String, String>();
-
 				BigDecimal divideAmount = BigDecimal.ZERO;
 				BigDecimal dividedAmount = BigDecimal.ZERO;
+				List<Map<String,String>> divides = new ArrayList<Map<String,String>>();
 				for (int i = 0; i < routeOrders.size(); i++) {
 
 					studentPaymentRouteOrder = routeOrders.get(i);
+					
+					Map<String, String> divide = new HashMap<String, String>();
 
-					divides.put("ledgerNo", studentPaymentRouteOrder.getMerNo());
+					divide.put("ledgerNo", studentPaymentRouteOrder.getMerNo());
 
 					if (i + 1 == routeOrders.size()) {
 						divideAmount = splitAmount.subtract(dividedAmount);
-						divides.put("amount", divideAmount.toPlainString());
+						divide.put("amount", divideAmount.toPlainString());
 					} else {
 						divideAmount = studentPaymentRouteOrder.getRouteAmount().multiply(splitAmount).divide(order.getActualAmount(), 2,
 								BigDecimal.ROUND_HALF_UP);
-						divides.put("amount", divideAmount.toPlainString());
+						divide.put("amount", divideAmount.toPlainString());
 					}
 					dividedAmount = dividedAmount.add(divideAmount);
 
 					studentPaymentRouteOrder.setServiceFee(studentPaymentRouteOrder.getRouteAmount().subtract(divideAmount));
 					studentPaymentRouteOrder.setUpdateTime(date);
+					
+					divides.add(divide);
 				}
 				params.put("divideDetail", JSON.toJSONString(divides));
 

+ 1 - 1
mec-student/src/main/java/com/ym/mec/student/controller/StudentOrderController.java

@@ -286,7 +286,7 @@ public class StudentOrderController extends BaseController {
 				
 				dto = DigitalEnvelopeUtils.decrypt(dto, privateKey, publicKey);
 				
-				logger.info("易宝支付回调信息:{}", dto.getPlainText());
+				logger.info("易宝支付回调信息:response:{} plaintText:{}", content, dto.getPlainText());
 				
 				JSONObject dataObj = JSON.parseObject(dto.getPlainText());
 				

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/payment/YeepayController.java

@@ -139,7 +139,7 @@ public class YeepayController extends BaseController {
 			
 			dto = DigitalEnvelopeUtils.decrypt(dto, privateKey, publicKey);
 			
-			logger.info("易宝支付回调信息:{}", dto.getPlainText());
+			logger.info("易宝支付回调信息:response:{} plaintText:{}", content, dto.getPlainText());
 			
 			return "SUCCESS";
 		} catch (Exception e) {