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

Commit 7be3d282 authored by 姜秀龙's avatar 姜秀龙

sqb 再次支付

parent 388b2212
......@@ -541,14 +541,35 @@ public class GoblinSqbOrderServiceImpl implements IGoblinSqbOrderService {
public ResponseDto<GoblinSqbOrderCreateVo> repay(String userId, String orderId) {
log.info("[收钱吧再次付款] userId={}, orderId={}", userId, orderId);
GoblinSqbOrderVo orderVo = goblinSqbRedisUtils.getSqbOrder(orderId);
if (orderVo == null) return ResponseDto.failure("订单不存在");
if (!userId.equals(orderVo.getUserId())) return ResponseDto.failure("无权限访问该订单");
GoblinStoreOrderVo storeOrderVo = goblinRedisUtils.getGoblinOrder(orderId);
if (storeOrderVo == null
|| !Integer.valueOf(GoblinStatusConst.Status.ORDER_STATUS_0.getValue()).equals(storeOrderVo.getStatus())) {
if (storeOrderVo == null) {
return ResponseDto.failure("订单不存在");
}
if (!userId.equals(storeOrderVo.getUserId())) {
return ResponseDto.failure("无权限访问该订单");
}
if (!Integer.valueOf(GoblinStatusConst.Status.ORDER_STATUS_0.getValue()).equals(storeOrderVo.getStatus())) {
return ResponseDto.failure("订单状态不支持再次付款(仅待支付状态可重新拉起)");
}
List<String> orderSkuVoIds = storeOrderVo.getOrderSkuVoIds();
if (CollectionUtils.isEmpty(orderSkuVoIds)) {
return ResponseDto.failure("订单数据异常");
}
GoblinOrderSkuVo firstSkuVo = goblinRedisUtils.getGoblinOrderSkuVo(orderSkuVoIds.get(0));
if (firstSkuVo == null) {
return ResponseDto.failure("订单数据异常");
}
if (!Integer.valueOf(33).equals(firstSkuVo.getSkuType())) {
return ResponseDto.failure("该订单非收钱吧订单");
}
GoblinSqbOrderVo orderVo = goblinSqbRedisUtils.getSqbOrder(orderId);
if (orderVo == null) {
return ResponseDto.failure("收钱吧支付信息已失效,请取消订单后重新下单");
}
if (!userId.equals(orderVo.getUserId())) {
return ResponseDto.failure("无权限访问该订单");
}
if (orderVo.getSqbAcquiringSn() == null) {
return ResponseDto.failure("订单数据异常,缺少收单号");
}
......
......@@ -56,6 +56,22 @@ public class GoblinMongoUtils {
object);
}
public GoblinStoreOrderVo getGoblinStoreOrderVoByOrderId(String orderId) {
if (orderId == null || orderId.trim().isEmpty()) {
return null;
}
return mongoTemplate.findOne(Query.query(Criteria.where("orderId").is(orderId)),
GoblinStoreOrderVo.class, GoblinStoreOrderVo.class.getSimpleName());
}
public GoblinOrderSkuVo getGoblinOrderSkuVoByOrderSkuId(String orderSkuId) {
if (orderSkuId == null || orderSkuId.trim().isEmpty()) {
return null;
}
return mongoTemplate.findOne(Query.query(Criteria.where("orderSkuId").is(orderSkuId)),
GoblinOrderSkuVo.class, GoblinOrderSkuVo.class.getSimpleName());
}
//添加 订单SkuVo全量
public GoblinOrderSkuVo insertGoblinOrderSkuVo(GoblinOrderSkuVo vo) {
return mongoTemplate.insert(vo, GoblinOrderSkuVo.class.getSimpleName());
......
......@@ -396,7 +396,11 @@ public class GoblinRedisUtils {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER.concat(orderId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
GoblinStoreOrderVo fromMongo = goblinMongoUtils.getGoblinStoreOrderVoByOrderId(orderId);
if (fromMongo != null) {
redisUtil.set(redisKey, fromMongo);
}
return fromMongo;
} else {
return (GoblinStoreOrderVo) obj;
}
......@@ -407,7 +411,11 @@ public class GoblinRedisUtils {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER_SKU.concat(orderSkuId);
Object obj = redisUtil.get(redisKey);
if (obj == null) {
return null;
GoblinOrderSkuVo fromMongo = goblinMongoUtils.getGoblinOrderSkuVoByOrderSkuId(orderSkuId);
if (fromMongo != null) {
redisUtil.set(redisKey, fromMongo);
}
return fromMongo;
} else {
return (GoblinOrderSkuVo) obj;
}
......
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