|
@@ -15,7 +15,9 @@ import com.eptok.yspay.opensdkjava.util.YsfSignUtil;
|
|
import com.qs.mp.common.constant.DivisionLogStatusConstants;
|
|
import com.qs.mp.common.constant.DivisionLogStatusConstants;
|
|
import com.qs.mp.common.constant.YsServerApiConstants;
|
|
import com.qs.mp.common.constant.YsServerApiConstants;
|
|
import com.qs.mp.common.domain.YsCallLog;
|
|
import com.qs.mp.common.domain.YsCallLog;
|
|
|
|
+import com.qs.mp.common.enums.DivisionStatusEnum;
|
|
import com.qs.mp.common.enums.PayOrderStatusEnum;
|
|
import com.qs.mp.common.enums.PayOrderStatusEnum;
|
|
|
|
+import com.qs.mp.common.enums.YsCallBizTypeEnum;
|
|
import com.qs.mp.common.service.IYsCallLogService;
|
|
import com.qs.mp.common.service.IYsCallLogService;
|
|
import com.qs.mp.common.utils.LogUtil;
|
|
import com.qs.mp.common.utils.LogUtil;
|
|
import com.qs.mp.pay.domain.DivisionLog;
|
|
import com.qs.mp.pay.domain.DivisionLog;
|
|
@@ -124,6 +126,15 @@ public class YsPayCallBackController {
|
|
PayOrder order = payOrderService.getOne(new LambdaQueryWrapper<PayOrder>()
|
|
PayOrder order = payOrderService.getOne(new LambdaQueryWrapper<PayOrder>()
|
|
.eq(PayOrder::getTradeNo, tradeNo));
|
|
.eq(PayOrder::getTradeNo, tradeNo));
|
|
|
|
|
|
|
|
+ YsCallLog payYsCallLog = ysCallLogService.getOne(new LambdaQueryWrapper<YsCallLog>()
|
|
|
|
+ .eq(YsCallLog::getBizId, order.getOrderId())
|
|
|
|
+ .eq(YsCallLog::getBizType, YsCallBizTypeEnum.ORDER_PAY));
|
|
|
|
+ if (payYsCallLog != null) {
|
|
|
|
+ ysCallLogService.update(new LambdaUpdateWrapper<YsCallLog>()
|
|
|
|
+ .set(YsCallLog::getCallbackJson, JSONObject.toJSONString(params))
|
|
|
|
+ .eq(YsCallLog::getId, payYsCallLog.getId()));
|
|
|
|
+ }
|
|
|
|
+
|
|
if (PayOrderStatusEnum.SUCCESS.getValue().equals(order.getOrderStatus())) {
|
|
if (PayOrderStatusEnum.SUCCESS.getValue().equals(order.getOrderStatus())) {
|
|
logger.info("支付订单已成功,消息忽略,shopOrderNo:" + orderNo);
|
|
logger.info("支付订单已成功,消息忽略,shopOrderNo:" + orderNo);
|
|
responseWrite(response,"true");
|
|
responseWrite(response,"true");
|
|
@@ -199,9 +210,12 @@ public class YsPayCallBackController {
|
|
req.setParamData(bizContent);
|
|
req.setParamData(bizContent);
|
|
String result = null;
|
|
String result = null;
|
|
DivisionLog divisionLog = new DivisionLog();
|
|
DivisionLog divisionLog = new DivisionLog();
|
|
|
|
+ divisionLog.setStatus(DivisionStatusEnum.INIT);
|
|
YsCallLog ysCallLog = new YsCallLog();
|
|
YsCallLog ysCallLog = new YsCallLog();
|
|
ysCallLog.setInterfaceId("ysepay.single.division.online.accept");
|
|
ysCallLog.setInterfaceId("ysepay.single.division.online.accept");
|
|
ysCallLog.setReqJson(JSONObject.toJSONString(req));
|
|
ysCallLog.setReqJson(JSONObject.toJSONString(req));
|
|
|
|
+ ysCallLog.setBizType(YsCallBizTypeEnum.DIVISION);
|
|
|
|
+ ysCallLog.setBizId(divTradeNo);
|
|
try{
|
|
try{
|
|
logger.info("分账登记调用sdk接口addScanMerc请求入参为:"+ JSONObject.toJSONString(req));
|
|
logger.info("分账登记调用sdk接口addScanMerc请求入参为:"+ JSONObject.toJSONString(req));
|
|
result = MercFundApi.divisionOnlineAccept(req);
|
|
result = MercFundApi.divisionOnlineAccept(req);
|
|
@@ -209,6 +223,7 @@ public class YsPayCallBackController {
|
|
logger.info("分账登记调用addScanMerc出参为:"+ result);
|
|
logger.info("分账登记调用addScanMerc出参为:"+ result);
|
|
//根据返回结果处理自己的业务逻辑,result内容详见接口文档
|
|
//根据返回结果处理自己的业务逻辑,result内容详见接口文档
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
|
|
+ divisionLog.setStatus(DivisionStatusEnum.SUBMIT_FAIL);
|
|
logger.error("线上分账登记接口失败:"+ e.getMessage());
|
|
logger.error("线上分账登记接口失败:"+ e.getMessage());
|
|
}
|
|
}
|
|
// 保存调用日志
|
|
// 保存调用日志
|
|
@@ -216,7 +231,6 @@ public class YsPayCallBackController {
|
|
|
|
|
|
// 保存分账登记记录
|
|
// 保存分账登记记录
|
|
divisionLog.setTradeNo(divTradeNo);
|
|
divisionLog.setTradeNo(divTradeNo);
|
|
- divisionLog.setStatus(DivisionLogStatusConstants.INIT);
|
|
|
|
divisionLog.setAmount(totalAmount);
|
|
divisionLog.setAmount(totalAmount);
|
|
divisionLog.setOrderNo(orderNo);
|
|
divisionLog.setOrderNo(orderNo);
|
|
divisionLog.setBizId(payOrder.getOrderId());
|
|
divisionLog.setBizId(payOrder.getOrderId());
|
|
@@ -231,7 +245,7 @@ public class YsPayCallBackController {
|
|
* @throws Exception
|
|
* @throws Exception
|
|
*/
|
|
*/
|
|
@RequestMapping(value = "/ysDivCallback", method = RequestMethod.GET)
|
|
@RequestMapping(value = "/ysDivCallback", method = RequestMethod.GET)
|
|
- public void divCallback(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
|
|
+ public void divCallback(HttpServletRequest request, HttpServletResponse response) {
|
|
Map<String, String[]> reqParams = request.getParameterMap();
|
|
Map<String, String[]> reqParams = request.getParameterMap();
|
|
|
|
|
|
Map<String, String> params = new HashMap<>();
|
|
Map<String, String> params = new HashMap<>();
|
|
@@ -245,15 +259,34 @@ public class YsPayCallBackController {
|
|
}
|
|
}
|
|
|
|
|
|
System.out.println("分账回调的数据 = " + JSONObject.toJSONString(params));
|
|
System.out.println("分账回调的数据 = " + JSONObject.toJSONString(params));
|
|
-
|
|
|
|
-
|
|
|
|
String divTradeNo = params.get("out_trade_no");
|
|
String divTradeNo = params.get("out_trade_no");
|
|
-
|
|
|
|
|
|
+ String divisionStatusCode = params.get("division_status_code");
|
|
|
|
+ YsCallLog ysCallLog = ysCallLogService.getOne(new LambdaQueryWrapper<YsCallLog>()
|
|
|
|
+ .eq(YsCallLog::getBizId, divTradeNo)
|
|
|
|
+ .eq(YsCallLog::getBizType, YsCallBizTypeEnum.DIVISION));
|
|
|
|
+ if (ysCallLog != null) {
|
|
|
|
+ ysCallLogService.update(new LambdaUpdateWrapper<YsCallLog>()
|
|
|
|
+ .set(YsCallLog::getCallbackJson, JSONObject.toJSONString(params))
|
|
|
|
+ .eq(YsCallLog::getId, ysCallLog.getId()));
|
|
|
|
+ }
|
|
DivisionLog divisionLog = divisionLogService.getOne(
|
|
DivisionLog divisionLog = divisionLogService.getOne(
|
|
new LambdaQueryWrapper<DivisionLog>().eq(DivisionLog::getTradeNo, divTradeNo));
|
|
new LambdaQueryWrapper<DivisionLog>().eq(DivisionLog::getTradeNo, divTradeNo));
|
|
|
|
|
|
- responseWrite(response, "success");
|
|
|
|
|
|
+ if ("00".equals(divisionStatusCode)) {
|
|
|
|
+ divisionLog.setStatus(DivisionStatusEnum.COMPLETE);
|
|
|
|
+ } else {
|
|
|
|
+ divisionLog.setStatus(DivisionStatusEnum.FAIL);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ boolean res = divisionLogService.update(new LambdaUpdateWrapper<DivisionLog>()
|
|
|
|
+ .set(DivisionLog::getStatus, divisionLog.getStatus())
|
|
|
|
+ .eq(DivisionLog::getStatus, DivisionStatusEnum.INIT)
|
|
|
|
+ .eq(DivisionLog::getId, divisionLog.getId()));
|
|
|
|
+ if (!res) {
|
|
|
|
+ logger.error("更新分账状态失败,分账tradeNo:" + divTradeNo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ responseWrite(response, "success");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|