记得上下班打卡 | git大法好,push需谨慎

Commit feecdd56 authored by jiangxiulong's avatar jiangxiulong

支付宝退款主动查询

parent b2d54abf
......@@ -5,6 +5,7 @@ import com.liquidnet.service.platform.service.refund.OrderRefundsCallbackService
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -31,4 +32,11 @@ public class OrderRefundCallbackController {
String result = orderRefundsCallbackServiceImpl.refundCallback(refundCallbackParam);
return result;
}
@GetMapping("alipayActiveCallback")
@ApiOperation("支付宝主动查询退款结果")
public String alipayActiveCallback() {
String result = orderRefundsCallbackServiceImpl.alipayActiveCallback();
return result;
}
}
package com.liquidnet.service.platform.service.refund;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.commons.lang.util.HttpUtil;
import com.liquidnet.service.kylin.constant.KylinTableStatusConst;
import com.liquidnet.service.kylin.dto.param.RefundCallbackParam;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo;
import com.liquidnet.service.kylin.entity.KylinOrderRefunds;
import com.liquidnet.service.kylin.entity.KylinOrderTickets;
import com.liquidnet.service.kylin.mapper.*;
import com.liquidnet.service.kylin.service.IKylinOrderRefundsService;
import com.liquidnet.service.platform.utils.DataUtils;
......@@ -14,13 +17,17 @@ import com.mongodb.client.result.UpdateResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.convert.MongoConverter;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import java.time.LocalDateTime;
import java.util.List;
/**
* <p>
......@@ -33,18 +40,23 @@ import java.time.LocalDateTime;
@Slf4j
@Service
public class OrderRefundsCallbackServiceImpl extends ServiceImpl<KylinOrderRefundsMapper, KylinOrderRefunds> implements IKylinOrderRefundsService {
@Value("${liquidnet.client.admin.platformUrl}")
private String platformUrl;
@Value("${liquidnet.client.admin.phpPayUrl}")
private String phpPayUrl;
@Autowired
private KylinRefundsStatusServiceImpl kylinRefundsStatusServiceImpl;
@Autowired
private KylinOrderRefundsMapper kylinOrderRefundsMapper;
@Autowired
private KylinOrderTicketsMapper kylinOrderTicketsMapper;
@Autowired
MongoTemplate mongoTemplate;
@Autowired
private MongoConverter mongoConverter;
@Autowired
private DataUtils dataUtils;
......@@ -104,4 +116,34 @@ public class OrderRefundsCallbackServiceImpl extends ServiceImpl<KylinOrderRefun
public String getOrderRefundCode(String orderRefundCode,int type) {
return null;
}
public String alipayActiveCallback() {
List<KylinOrderRefunds> kylinOrderRefunds = kylinOrderRefundsMapper.selectList(
Wrappers.lambdaQuery(KylinOrderRefunds.class)
.eq(KylinOrderRefunds::getStatus, KylinTableStatusConst.ORDER_REFUND_STATUS_UNFILLED)
);
for (KylinOrderRefunds refundInfo : kylinOrderRefunds) {
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
Wrappers.lambdaQuery(KylinOrderTickets.class)
.eq(KylinOrderTickets::getOrderTicketsId, refundInfo.getOrderTicketsId())
);
MultiValueMap<String, String> params = new LinkedMultiValueMap();
params.add("notifyUrl", platformUrl.concat("/platform/refund/callback"));
params.add("orderCode", orderInfo.getOrderCode());
params.add("orderRefundCode", refundInfo.getOrderRefundCode());
params.add("paymentId", orderInfo.getPaymentId());
// log.info("退款参数" + JsonUtils.toJson(params));
log.info("\n支付宝退款主动查询参数:\n[{}] ", params.toString());
// 请求pay
try {
String postResult = HttpUtil.post(phpPayUrl.concat("/dragon/refund/refund/alipay/result"), params);
log.info("\n支付宝退款主动查询处理结果:\n[{}] " + postResult);
} catch (Exception e) {
log.info("\n支付宝退款主动查询失败:[errorMsg=[{}], [orderRefundsId=[{}]", e.getMessage(), refundInfo.getOrderRefundsId());
}
}
return "success";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment