|
@@ -79,14 +79,8 @@ import com.zhongzheng.modules.top.goods.service.ITopOldOrderService;
|
|
|
import com.zhongzheng.modules.top.goods.vo.TopOldOrderInvoiceVo;
|
|
|
import com.zhongzheng.modules.top.settle.domian.TopInstSettle;
|
|
|
import com.zhongzheng.modules.top.settle.service.ITopInstSettleService;
|
|
|
-import com.zhongzheng.modules.user.domain.User;
|
|
|
-import com.zhongzheng.modules.user.domain.UserExamGoods;
|
|
|
-import com.zhongzheng.modules.user.domain.UserStudyVideo;
|
|
|
-import com.zhongzheng.modules.user.domain.UserSubscribe;
|
|
|
-import com.zhongzheng.modules.user.service.IUserExamGoodsService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserStudyVideoService;
|
|
|
-import com.zhongzheng.modules.user.service.IUserSubscribeService;
|
|
|
+import com.zhongzheng.modules.user.domain.*;
|
|
|
+import com.zhongzheng.modules.user.service.*;
|
|
|
import com.zhongzheng.modules.user.vo.UserVo;
|
|
|
import com.zhongzheng.modules.wx.service.IWxPayService;
|
|
|
import net.polyv.common.v1.util.StringUtils;
|
|
@@ -218,6 +212,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
private ISysTenantService iSysTenantService;
|
|
|
@Autowired
|
|
|
private IUserStudyVideoService iUserStudyVideoService;
|
|
|
+ @Autowired
|
|
|
+ private IUserStudyRecordService iUserStudyRecordService;
|
|
|
@Value("${oldStudySys.createExamPath}")
|
|
|
private String CREATE_EXAM_PATH;
|
|
|
|
|
@@ -3425,6 +3421,63 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
|
|
return baseMapper.exportNew(bo);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void handleRepetitionOrder(RepetitionOrderBo bo) {
|
|
|
+ //获取所有的考前七大员订单
|
|
|
+ List<RepetitionOrderVo> voList = baseMapper.getSevenOrder(bo);
|
|
|
+ if (CollectionUtils.isEmpty(voList)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Map<Long, Map<Long, List<RepetitionOrderVo>>> collect = voList.stream()
|
|
|
+ .collect(Collectors.groupingBy(RepetitionOrderVo::getUserId, Collectors.groupingBy(RepetitionOrderVo::getGoodsId)));
|
|
|
+ collect.forEach((k,v) -> {
|
|
|
+ v.forEach((j,m) -> {
|
|
|
+ if (m.size() == 1){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> orderGoodsIds = new ArrayList<>();
|
|
|
+ //找到学过的订单
|
|
|
+ for (RepetitionOrderVo vo : m) {
|
|
|
+ ClassGradeUser gradeUser = iClassGradeUserService
|
|
|
+ .getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getOrderGoodsId, vo.getOrderGoodsId())
|
|
|
+ .eq(ClassGradeUser::getChangeGrade, 0)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(gradeUser) && gradeUser.getFinishStatus() == 1){
|
|
|
+ orderGoodsIds.add(vo.getOrderGoodsId());
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ //没学完
|
|
|
+ int count = iUserStudyRecordService.count(new LambdaQueryWrapper<UserStudyRecord>()
|
|
|
+ .eq(UserStudyRecord::getOrderGoodsId, vo.getOrderGoodsId())
|
|
|
+ .eq(UserStudyRecord::getCurrentStatus, 1));
|
|
|
+ if (count > 0){
|
|
|
+ orderGoodsIds.add(vo.getOrderGoodsId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(orderGoodsIds)){
|
|
|
+ //都没学过,不处理
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<RepetitionOrderVo> collect1 = m.stream().filter(x -> !orderGoodsIds.contains(x.getOrderGoodsId())).collect(Collectors.toList());
|
|
|
+ //关闭没用订单
|
|
|
+ for (RepetitionOrderVo vo : collect1) {
|
|
|
+ OrderGoods orderGoods = iOrderGoodsService.getById(vo.getOrderGoodsId());
|
|
|
+ orderGoods.setStatus(0);
|
|
|
+ ClassGradeUser gradeUser = iClassGradeUserService
|
|
|
+ .getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getOrderGoodsId, vo.getOrderGoodsId())
|
|
|
+ .eq(ClassGradeUser::getChangeGrade, 0)
|
|
|
+ .last("limit 1"));
|
|
|
+ gradeUser.setStatus(0);
|
|
|
+ iOrderGoodsService.updateById(orderGoods);
|
|
|
+ iClassGradeUserService.updateById(gradeUser);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
private void questionOpen(User user, QuestionMerchant merchant,UserSubscribe userSubscribe,Long loginId,String loginName) {
|
|
|
//商家商品
|
|
|
Goods merGoods = iGoodsService.getOne(new LambdaQueryWrapper<Goods>()
|