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

Commit b0cb215b authored by anjiabin's avatar anjiabin

提交支付查询

parent 8cbbe97f
......@@ -272,4 +272,11 @@ public class DragonConstant {
this.message = message;
}
}
public static void main(String[] args) {
Integer aaa = 1;
if(aaa.toString().equals(DragonConstant.PayStatusEnum.STATUS_PAID.getCode())){
System.out.println("支付成功");
}
}
}
package com.liquidnet.service.dragon.dto;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: DragonPayAlipayAppReqDto
* @Package com.liquidnet.service.dragon.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/9 11:00
*/
public class DragonPayAlipayAppReqDto {
}
package com.liquidnet.service.dragon.dto;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: DragonPayAlipayAppReqDto
* @Package com.liquidnet.service.dragon.dto
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2021/7/9 11:00
*/
public class DragonPayAlipayAppRespDto {
}
......@@ -2,6 +2,8 @@ package com.liquidnet.service.dragon.dto;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
......@@ -13,9 +15,11 @@ import lombok.Data;
*/
@Data
public class DragonPayOrderQueryRespDto {
private Integer status;
private String type;
private String code;
private String paymentId;
private String orderCode;
private String status;
private BigDecimal price;
private String paymentType;
}
......@@ -119,9 +119,6 @@ public class AlipayBiz extends DragonPayBiz {
*/
public static Map<String, Object> tradeQuery(String outTradeNo) {
log.info("======>支付宝交易查询");
String charset = "UTF-8";
String format = "json";
String signType = "RSA2";
AlipayClient alipayClient = PayAlipayUtils.getInstance().getHttpClient();
SortedMap<String, Object> bizContentMap = new TreeMap<>();
......
......@@ -140,8 +140,13 @@ public class PayChannelStrategyAlipayImpl implements IPayChannelStrategy {
@Override
public DragonPayOrderQueryRespDto checkOrderStatus(String code) {
Map<String, Object> result = alipayBiz.tradeQuery(code);
Map<String, Object> resultMap = alipayBiz.tradeQuery(code);
DragonPayOrderQueryRespDto respDto = new DragonPayOrderQueryRespDto();
if ("10000".equals(resultMap.get("code"))) {
}else{
}
return respDto;
}
......
......@@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
......@@ -52,15 +51,11 @@ public class WepayBiz extends DragonPayBiz{
String sign = PayWepayUtils.getInstance().createSign(paramMap);
paramMap.put("sign", sign);
Set<String> ks = paramMap.keySet();
String data = PayWepayUtils.getInstance().getRequestXml(paramMap);
try{
HttpPost httpost = new HttpPost("https://api.mch.weixin.qq.com/pay/orderquery");
httpost.setEntity(new StringEntity(data, "UTF-8"));
CloseableHttpResponse response = null;
response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
CloseableHttpResponse response = PayWepayUtils.getInstance().getHttpClient().execute(httpost);
HttpEntity entity = response.getEntity();
//接受到返回信息
String xmlStr = EntityUtils.toString(response.getEntity(), "UTF-8");
......
......@@ -158,8 +158,12 @@ public abstract class AbstractWepayStrategy implements IWepayStrategy {
WepayOrderQueryRespDto result = wepayBiz.tradeQuery(code,this.getAppid());
DragonPayOrderQueryRespDto respDto = new DragonPayOrderQueryRespDto();
respDto.setCode(code);
respDto.setOrderCode("");
respDto.setStatus("");
// respDto.setOrderCode("");
// respDto.setStatus("");
// respDto.setType();
// respDto.setPaymentId();
// respDto.setPrice();
// respDto.setPaymentType();
return respDto;
}
......
......@@ -66,7 +66,7 @@ public class PayController {
@RequestParam(value = "notifyUrl") @NotNull(message = "通知Url不能为空") String notifyUrl,
@RequestParam(value = "returnUrl",required = false) String returnUrl,
// @RequestParam(value = "quitUrl",required = false) String quitUrl,
// @RequestParam(value = "showUrl",required = false) String showUrl,
@RequestParam(value = "showUrl",required = false) String showUrl,
// @RequestParam(value = "code",required = false) String code,
@RequestParam(value = "createDate",required = true) String createDate,
@RequestParam(value = "expireTime",required = true) String expireTime){
......@@ -91,14 +91,14 @@ public class PayController {
dragonPayBaseReqDto.setNotifyUrl(notifyUrl);
dragonPayBaseReqDto.setReturnUrl(returnUrl);
// dragonPayBaseReqDto.setQuitUrl(quitUrl);
// dragonPayBaseReqDto.setShowUrl(showUrl);
dragonPayBaseReqDto.setShowUrl(showUrl);
// dragonPayBaseReqDto.setCode(code);
dragonPayBaseReqDto.setCreateDate(createDate);
dragonPayBaseReqDto.setExpireTime(expireTime);
return dragonOrdersService.dragonPay(dragonPayBaseReqDto);
}
@PostMapping("/checkOrder")
@GetMapping("/checkOrder")
@ApiOperation("订单查询")
@ApiResponse(code = 200, message = "接口返回对象参数")
@ApiImplicitParams({
......
......@@ -51,12 +51,26 @@ public class DragonOrdersServiceImpl implements IDragonOrdersService {
if(StringUtil.isEmpty(ordersDto)){
throw new LiquidnetServiceException(DragonErrorCodeEnum.TRADE_ERROR_NOT_EXISTS.getCode(),DragonErrorCodeEnum.TRADE_ERROR_NOT_EXISTS.getMessage());
}
//如果已支付 直接返回结果
if(!ordersDto.getStatus().toString().equals(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode())){
DragonPayOrderQueryRespDto queryRespDto = new DragonPayOrderQueryRespDto();
queryRespDto.setStatus(ordersDto.getStatus());
queryRespDto.setType(ordersDto.getType());
queryRespDto.setCode(ordersDto.getCode());
queryRespDto.setPaymentId(ordersDto.getPaymentId());
queryRespDto.setOrderCode(ordersDto.getOrderCode());
queryRespDto.setPrice(ordersDto.getPrice());
queryRespDto.setPaymentType(ordersDto.getPaymentType());
return queryRespDto;
}
//如果未支付进行三方查询
String payType = DragonConstant.PayTypeEnum.getEnumByCode(ordersDto.getPaymentType()).getPayType();
return payChannelStrategyContext.getStrategy(payType).checkOrderStatus(code);
}
@Override
public DragonPayOrderQueryRespDto checkOrderStatusByOrderCode(String orderCode) {
return null;
String code = dataUtils.getCodeByOrderCode(orderCode);
return this.checkOrderStatusByCode(code);
}
}
......@@ -11,6 +11,16 @@ public class DataUtils {
@Autowired
private RedisUtil redisUtil;
/**
* 根据订单编号获取支付code
* @param orderCode
* @return
*/
public String getCodeByOrderCode(String orderCode) {
//获取支付订单号
return (String) redisUtil.get(DragonConstant.REDIS_KET_PAY_ORDERCODE + orderCode);
}
public void createPayOrder(String orderCode, String code, DragonOrdersDto ordersDto) {
if (!redisUtil.hasKey(DragonConstant.REDIS_KET_PAY_ORDERCODE + orderCode)) {
redisUtil.set(DragonConstant.REDIS_KET_PAY_ORDERCODE + orderCode, code);
......
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