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 */
private String orderId;
/** 原始价格 */
private BigDecimal originalPrice;
/** 折扣金额 */
private BigDecimal deductionPrice;
/** 支付金额 */
private BigDecimal payPrice;
/** 交易订单状态 */
private Integer tradeOrderStatus;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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