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

Commit b0349f91 authored by anjiabin's avatar anjiabin

优化支付代码

parent 4e0fb890
...@@ -24,6 +24,11 @@ public class DragonOrdersDto implements Serializable, Cloneable { ...@@ -24,6 +24,11 @@ public class DragonOrdersDto implements Serializable, Cloneable {
@TableId(value = "mid", type = IdType.AUTO) @TableId(value = "mid", type = IdType.AUTO)
private Long mid; private Long mid;
/**
* order_id
*/
private String orderId;
/** /**
* status * status
*/ */
...@@ -69,6 +74,11 @@ public class DragonOrdersDto implements Serializable, Cloneable { ...@@ -69,6 +74,11 @@ public class DragonOrdersDto implements Serializable, Cloneable {
*/ */
private String notifyUrl; private String notifyUrl;
/**
* 通知状态(0初始化 1通知成功 2 通知失败 3通知超时)
*/
private Integer notifyStatus;
/** /**
* payment_type * payment_type
*/ */
......
package com.liquidnet.service.dragon.biz; package com.liquidnet.service.dragon.biz;
import com.liquidnet.commons.lang.util.BeanUtil;
import com.liquidnet.commons.lang.util.IDGenerator; import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.base.SqlMapping; import com.liquidnet.service.base.SqlMapping;
import com.liquidnet.service.dragon.bo.PayNotifyReqBo; import com.liquidnet.service.dragon.bo.PayNotifyReqBo;
...@@ -9,7 +8,6 @@ import com.liquidnet.service.dragon.dto.DragonOrdersDto; ...@@ -9,7 +8,6 @@ import com.liquidnet.service.dragon.dto.DragonOrdersDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto; import com.liquidnet.service.dragon.dto.DragonPayBaseReqDto;
import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto; import com.liquidnet.service.dragon.dto.DragonPayBaseRespDto;
import com.liquidnet.service.dragon.dto.PayNotifyDto; import com.liquidnet.service.dragon.dto.PayNotifyDto;
import com.liquidnet.service.dragon.entity.DragonOrders;
import com.liquidnet.service.dragon.utils.DataUtils; import com.liquidnet.service.dragon.utils.DataUtils;
import com.liquidnet.service.dragon.utils.MqHandleUtil; import com.liquidnet.service.dragon.utils.MqHandleUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -36,9 +34,9 @@ public class DragonServiceCommonBiz { ...@@ -36,9 +34,9 @@ public class DragonServiceCommonBiz {
@Autowired @Autowired
private DataUtils dataUtils; private DataUtils dataUtils;
public DragonOrders buildPayOrders(DragonPayBaseReqDto dragonPayBaseReqDto, DragonPayBaseRespDto respDto){ public DragonOrdersDto buildPayOrders(DragonPayBaseReqDto dragonPayBaseReqDto, DragonPayBaseRespDto respDto){
//构造订单 //构造订单
DragonOrders orders = DragonOrders.getNew(); DragonOrdersDto orders = DragonOrdersDto.getNew();
// orders.setMid(); // orders.setMid();
orders.setOrderId(IDGenerator.nextTimeId()); orders.setOrderId(IDGenerator.nextTimeId());
orders.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode())); orders.setStatus(Integer.valueOf(DragonConstant.PayStatusEnum.STATUS_UNPAID.getCode()));
...@@ -58,11 +56,10 @@ public class DragonServiceCommonBiz { ...@@ -58,11 +56,10 @@ public class DragonServiceCommonBiz {
orders.setCreatedAt(LocalDateTime.now()); orders.setCreatedAt(LocalDateTime.now());
// orders.setUpdatedAt(); // orders.setUpdatedAt();
DragonOrdersDto ordersDto = DragonOrdersDto.getNew();
BeanUtil.copy(orders,ordersDto);
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
//放到redis缓存中 //放到redis缓存中
dataUtils.createPayOrder(orders.getCode(),ordersDto); dataUtils.createPayOrder(orders.getCode(),orders);
log.info("redis-createPayOrder->耗时:{}",(System.currentTimeMillis() - startTime)+"毫秒"); log.info("redis-createPayOrder->耗时:{}",(System.currentTimeMillis() - startTime)+"毫秒");
// 持久化到数据库 // 持久化到数据库
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
......
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