|
|
@@ -39,8 +39,6 @@ import com.cyksj.mapper.manage.coupon.CouponMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponSkuMapper;
|
|
|
import com.cyksj.mapper.manage.coupon.CouponUserMapper;
|
|
|
import com.cyksj.mapper.manage.distribute.*;
|
|
|
-import com.cyksj.mapper.market.draw.LuckyDrawSpecificChanceMapper;
|
|
|
-import com.cyksj.mapper.market.draw.LuckyDrawSpecificChanceRecordMapper;
|
|
|
import com.cyksj.mapper.market.task.TaskTypeMapper;
|
|
|
import com.cyksj.model.dto.AliPayParams;
|
|
|
import com.cyksj.model.dto.CouponPopularizeDto;
|
|
|
@@ -58,9 +56,9 @@ import com.cyksj.redis.RedisService;
|
|
|
import com.cyksj.service.coupon.CouponFontService;
|
|
|
import com.cyksj.service.exchange.ExchangeCodeService;
|
|
|
import com.cyksj.service.mange.stock.GoodsDonStockService;
|
|
|
+import com.cyksj.service.market.MarketFrontService;
|
|
|
import com.cyksj.service.market.task.TaskService;
|
|
|
import com.cyksj.service.order.OrderDonService;
|
|
|
-import com.cyksj.service.sys.SysConfigService;
|
|
|
import com.cyksj.service.template.TemplateCommonService;
|
|
|
import com.cyksj.service.wechat.WeChatService;
|
|
|
import com.cyksj.task.JobManager;
|
|
|
@@ -170,11 +168,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
|
|
|
private final TemplateCommonService templateCommonService;
|
|
|
|
|
|
- private final SysConfigService sysConfigService;
|
|
|
-
|
|
|
- private final LuckyDrawSpecificChanceMapper luckyDrawSpecificChanceMapper;
|
|
|
-
|
|
|
- private final LuckyDrawSpecificChanceRecordMapper luckyDrawSpecificChanceRecordMapper;
|
|
|
+ private final MarketFrontService marketFrontService;
|
|
|
|
|
|
private final List<String> noChekGoodsTemp = List.of("Apple One", "Youtube", "Spotify");
|
|
|
|
|
|
@@ -489,9 +483,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
//配置了特定奖池,增加抽奖机会
|
|
|
TASK_POOL.execute(() -> {
|
|
|
try {
|
|
|
- addSpecificChanceNum(order.getUserId(), order.getId(), order.getGoodsId(), order.getSkuId());
|
|
|
+ marketFrontService.addSpecificChanceNum(order.getUserId(), order.getId(), order.getGoodsId(), order.getSkuId());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("wx增加抽奖机会error:{}", e);
|
|
|
+ log.error("wx增加抽奖机会错误,orderId:{},error:{}", order.getId(), e);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -559,7 +553,8 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Throwable.class)
|
|
|
public OrderDon renewal(OrderPayRequest payRequest) throws Exception {
|
|
|
- User user = userMapper.selectById(payRequest.getUserId());
|
|
|
+ Long userId = payRequest.getUserId();
|
|
|
+ User user = userMapper.selectById(userId);
|
|
|
CouponUser couponUser = null;
|
|
|
if (StrUtil.isNotBlank(payRequest.getCouponExCode()) || payRequest.getCouponId() != null) {
|
|
|
checkCouponStatus(payRequest.getSkuId(), payRequest.getCouponExCode(), payRequest.getCouponId(), payRequest.getUserId(), true);
|
|
|
@@ -577,9 +572,10 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
if (relation == null) {
|
|
|
throw new BusinessRuntimeException("");
|
|
|
}
|
|
|
- if (!relation.getUserId().equals(user.getId())) {
|
|
|
- throw new BusinessRuntimeException("");
|
|
|
- }
|
|
|
+
|
|
|
+ if (!relation.getUserId().equals(user.getId())) {
|
|
|
+ throw new BusinessRuntimeException("");
|
|
|
+ }
|
|
|
GroupsTrips groupsTrips = groupsMapper.selectById(relation.getGroupsId());
|
|
|
|
|
|
GoodsDon goodsDon = goodsDonMapper.selectById(sku.getGoodsId());
|
|
|
@@ -758,9 +754,9 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
//配置了特定奖池,增加抽奖机会
|
|
|
TASK_POOL.execute(() -> {
|
|
|
try {
|
|
|
- addSpecificChanceNum(orderDon.getUserId(), orderDon.getId(), orderDon.getGoodsId(), orderDon.getSkuId());
|
|
|
+ marketFrontService.addSpecificChanceNum(orderDon.getUserId(), orderDon.getId(), orderDon.getGoodsId(), orderDon.getSkuId());
|
|
|
} catch (Exception e) {
|
|
|
- log.error("zfb增加抽奖机会error:{}", e);
|
|
|
+ log.error("zfb增加抽奖机会错误,orderId:{},error:{}", orderDon.getId(), e);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -889,6 +885,11 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
THREAD_POOL_TASK_EXECUTOR.execute(()->{
|
|
|
refundRecord(orderDon, goodsDon, sku, outNo);
|
|
|
goodsDonStockService.upStockRelate(null, orderDon.getId(),"refund");
|
|
|
+ try {
|
|
|
+ marketFrontService.subSpecificChanceNum(orderDon.getUserId(), orderDon.getId(), orderDon.getGoodsId(), orderDon.getUpdateTime());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("zfb减少抽奖机会错误,orderId:{},error:{}", orderDon.getId(), e);
|
|
|
+ }
|
|
|
});
|
|
|
//虚物订单退款,清出车队,车票变为已过期
|
|
|
clearUnrealGoodsDetail(orderDon, goodsDon, sku);
|
|
|
@@ -1080,6 +1081,14 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
|
}
|
|
|
log.info("微信退款: 退款单号[{}] 退款成功.", outRefundNo);
|
|
|
+
|
|
|
+ TASK_POOL.execute(()->{
|
|
|
+ try {
|
|
|
+ marketFrontService.subSpecificChanceNum(orderDon.getUserId(), orderDon.getId(), orderDon.getGoodsId(), orderDon.getUpdateTime());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("wx减少抽奖机会错误,orderId:{},error:{}", orderDon.getId(), e);
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
public void setRelation(Long relationId, Long userId, Long goodsId, Boolean isLoginPopularize) {
|
|
|
@@ -1522,43 +1531,4 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- private void addSpecificChanceNum(Long userId, Long orderId, Long goodsId, Long skuId) throws Exception {
|
|
|
- SysConfig lottery_specific_goods = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class).eq(SysConfig::getSysKey, Constant.LOTTERY_SPECIFIC_GOODS).last("limit 1"));
|
|
|
- if (lottery_specific_goods == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- String sysValue = lottery_specific_goods.getSysValue();
|
|
|
- if (sysValue == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
- List<Long> goodsIdList = Jsons.parseList(sysValue, Long.class);
|
|
|
- if (!goodsIdList.contains(goodsId)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- LuckyDrawSpecificChance chance = luckyDrawSpecificChanceMapper.selectOne(Wrappers.lambdaQuery(LuckyDrawSpecificChance.class)
|
|
|
- .eq(LuckyDrawSpecificChance::getUserId, userId).last("limit 1").select(LuckyDrawSpecificChance::getNum));
|
|
|
- if (chance == null) {
|
|
|
- try {
|
|
|
- LuckyDrawSpecificChance entity = new LuckyDrawSpecificChance();
|
|
|
- entity.setUserId(userId);
|
|
|
- entity.setNum(1);
|
|
|
- luckyDrawSpecificChanceMapper.insert(entity);
|
|
|
- } catch (DuplicateKeyException e) {
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- luckyDrawSpecificChanceMapper.addChanceNum(userId);
|
|
|
- }
|
|
|
- saveChanceRecord(userId, orderId, goodsId, skuId);
|
|
|
- }
|
|
|
-
|
|
|
- public void saveChanceRecord(Long userId, Long orderId, Long goodsId, Long skuId) {
|
|
|
- LuckyDrawSpecificChanceRecord record = new LuckyDrawSpecificChanceRecord();
|
|
|
- record.setUserId(userId);
|
|
|
- record.setOrderId(orderId);
|
|
|
- record.setGoodsId(goodsId);
|
|
|
- record.setSkuId(skuId);
|
|
|
- luckyDrawSpecificChanceRecordMapper.insert(record);
|
|
|
- }
|
|
|
}
|