7.14 准备对接外部小型商城+支付

This commit is contained in:
zhangsan 2025-07-14 13:50:29 +08:00
parent a8b99664f9
commit 1140505c6e
8 changed files with 27 additions and 12 deletions

View File

@ -18,8 +18,12 @@ public class LockMarketPayOrderResponseDTO {
/** 预购订单ID */ /** 预购订单ID */
private String orderId; private String orderId;
/** 原始价格 */
private BigDecimal originalPrice;
/** 折扣金额 */ /** 折扣金额 */
private BigDecimal deductionPrice; private BigDecimal deductionPrice;
/** 支付金额 */
private BigDecimal payPrice;
/** 交易订单状态 */ /** 交易订单状态 */
private Integer tradeOrderStatus; private Integer tradeOrderStatus;

View File

@ -1,3 +1,3 @@
spring: spring:
profiles: profiles:
active: prod active: dev

View File

@ -15,6 +15,7 @@
<result column="channel" property="channel"/> <result column="channel" property="channel"/>
<result column="original_price" property="originalPrice"/> <result column="original_price" property="originalPrice"/>
<result column="deduction_price" property="deductionPrice"/> <result column="deduction_price" property="deductionPrice"/>
<result column="pay_price" property="payPrice"/>
<result column="status" property="status"/> <result column="status" property="status"/>
<result column="out_trade_no" property="outTradeNo"/> <result column="out_trade_no" property="outTradeNo"/>
<result column="out_trade_time" property="outTradeTime"/> <result column="out_trade_time" property="outTradeTime"/>
@ -26,19 +27,19 @@
<insert id="insert" parameterType="edu.whut.infrastructure.dao.po.GroupBuyOrderList"> <insert id="insert" parameterType="edu.whut.infrastructure.dao.po.GroupBuyOrderList">
insert into group_buy_order_list( insert into group_buy_order_list(
user_id, team_id, order_id, activity_id, start_time, user_id, team_id, order_id, activity_id, start_time,
end_time, goods_id, source, channel, original_price, end_time, goods_id, source, channel, original_price, pay_price,
deduction_price, status, out_trade_no, biz_id, create_time, update_time deduction_price, status, out_trade_no, biz_id, create_time, update_time
) )
values( values(
#{userId}, #{teamId}, #{orderId}, #{activityId}, #{startTime}, #{userId}, #{teamId}, #{orderId}, #{activityId}, #{startTime},
#{endTime}, #{goodsId}, #{source}, #{channel}, #{originalPrice}, #{endTime}, #{goodsId}, #{source}, #{channel}, #{originalPrice},#{payPrice}
#{deductionPrice}, #{status}, #{outTradeNo}, #{bizId}, now(), now() #{deductionPrice}, #{status}, #{outTradeNo}, #{bizId}, now(), now()
) )
</insert> </insert>
<select id="queryGroupBuyOrderRecordByOutTradeNo" parameterType="edu.whut.infrastructure.dao.po.GroupBuyOrderList" resultMap="dataMap"> <select id="queryGroupBuyOrderRecordByOutTradeNo" parameterType="edu.whut.infrastructure.dao.po.GroupBuyOrderList" resultMap="dataMap">
select user_id, team_id, order_id, activity_id, start_time, select user_id, team_id, order_id, activity_id, start_time,
end_time, goods_id, source, channel, original_price, deduction_price, status end_time, goods_id, source, channel, original_price, deduction_price, pay_price, status
from group_buy_order_list from group_buy_order_list
where out_trade_no = #{outTradeNo} and user_id = #{userId} and status = 0 where out_trade_no = #{outTradeNo} and user_id = #{userId} and status = 0
</select> </select>

View File

@ -20,8 +20,12 @@ public class MarketPayOrderEntity {
private String teamId; private String teamId;
/** 预购订单ID */ /** 预购订单ID */
private String orderId; private String orderId;
/** 原始价格 */
private BigDecimal originalPrice;
/** 折扣金额 */ /** 折扣金额 */
private BigDecimal deductionPrice; private BigDecimal deductionPrice;
/** 支付金额 */
private BigDecimal payPrice;
/** 交易订单状态枚举 */ /** 交易订单状态枚举 */
private TradeOrderStatusEnumVO tradeOrderStatusEnumVO; private TradeOrderStatusEnumVO tradeOrderStatusEnumVO;

View File

@ -63,17 +63,19 @@ public class TradeRepository implements ITradeRepository {
query.setUserId(userId); query.setUserId(userId);
query.setOutTradeNo(outTradeNo); query.setOutTradeNo(outTradeNo);
GroupBuyOrderList po = groupBuyOrderListDao.queryGroupBuyOrderRecordByOutTradeNo(query); GroupBuyOrderList res = groupBuyOrderListDao.queryGroupBuyOrderRecordByOutTradeNo(query);
if (po == null) { if (res == null) {
return null; return null;
} }
// 组装领域对象返回只返回上层真正关心的属性 // 组装领域对象返回只返回上层真正关心的属性
return MarketPayOrderEntity.builder() return MarketPayOrderEntity.builder()
.teamId(po.getTeamId()) .teamId(res.getTeamId())
.orderId(po.getOrderId()) .orderId(res.getOrderId())
.deductionPrice(po.getDeductionPrice()) .originalPrice(res.getOriginalPrice())
.tradeOrderStatusEnumVO(TradeOrderStatusEnumVO.valueOf(po.getStatus())) .deductionPrice(res.getDeductionPrice())
.payPrice(res.getPayPrice())
.tradeOrderStatusEnumVO(TradeOrderStatusEnumVO.valueOf(res.getStatus()))
.build(); .build();
} }

View File

@ -40,6 +40,8 @@ public class GroupBuyOrderList extends Page {
private BigDecimal originalPrice; private BigDecimal originalPrice;
/** 折扣金额 */ /** 折扣金额 */
private BigDecimal deductionPrice; private BigDecimal deductionPrice;
/** 支付金额 */
private BigDecimal payPrice;
/** 状态0初始锁定、1消费完成 */ /** 状态0初始锁定、1消费完成 */
private Integer status; private Integer status;
/** 外部交易单号-确保外部调用唯一幂等 */ /** 外部交易单号-确保外部调用唯一幂等 */

View File

@ -249,7 +249,9 @@ public class MarketTradeController implements IMarketTradeService {
.info(ResponseCode.SUCCESS.getInfo()) .info(ResponseCode.SUCCESS.getInfo())
.data(LockMarketPayOrderResponseDTO.builder() .data(LockMarketPayOrderResponseDTO.builder()
.orderId(entity.getOrderId()) .orderId(entity.getOrderId())
.originalPrice(entity.getOriginalPrice())
.deductionPrice(entity.getDeductionPrice()) .deductionPrice(entity.getDeductionPrice())
.payPrice(entity.getPayPrice())
.tradeOrderStatus(entity.getTradeOrderStatusEnumVO().getCode()) .tradeOrderStatus(entity.getTradeOrderStatusEnumVO().getCode())
.build()) .build())
.build(); .build();

View File

@ -17,8 +17,8 @@ public class GroupBuyNotifyJob {
private final ITradeSettlementOrderService tradeSettlementOrderService; private final ITradeSettlementOrderService tradeSettlementOrderService;
//15秒执行一次 //30秒执行一次
@Scheduled(cron = "0/15 * * * * ?") @Scheduled(cron = "0/30 * * * * ?")
public void exec() { public void exec() {
try { try {
Map<String, Integer> result = tradeSettlementOrderService. execSettlementNotifyJob(); Map<String, Integer> result = tradeSettlementOrderService. execSettlementNotifyJob();