|
|
@@ -46,9 +46,11 @@ import com.zhongzheng.modules.goods.vo.*;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGrade;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeGoods;
|
|
|
import com.zhongzheng.modules.grade.domain.ClassGradeInterface;
|
|
|
+import com.zhongzheng.modules.grade.domain.ClassGradeUser;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeGoodsService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeInterfaceService;
|
|
|
import com.zhongzheng.modules.grade.service.IClassGradeService;
|
|
|
+import com.zhongzheng.modules.grade.service.IClassGradeUserService;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
import com.zhongzheng.modules.grade.vo.SyncGoodsExport;
|
|
|
import com.zhongzheng.modules.inform.domain.InformRemind;
|
|
|
@@ -57,6 +59,7 @@ import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.domain.OrderInputTemplate;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
import com.zhongzheng.modules.order.service.IOrderInputTemplateService;
|
|
|
+import com.zhongzheng.modules.order.service.IOrderService;
|
|
|
import com.zhongzheng.modules.pay.domain.PayServe;
|
|
|
import com.zhongzheng.modules.pay.domain.PaySupply;
|
|
|
import com.zhongzheng.modules.pay.service.IPayServeService;
|
|
|
@@ -130,7 +133,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Autowired
|
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private IOrderService iOrderService;
|
|
|
@Autowired
|
|
|
private IOrderInputTemplateService iOrderInputTemplateService;
|
|
|
@Autowired
|
|
|
@@ -140,6 +144,8 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private IClassGradeService iClassGradeService;
|
|
|
@Autowired
|
|
|
+ private IClassGradeUserService iClassGradeUserService;
|
|
|
+ @Autowired
|
|
|
private ICourseMenuService iCourseMenuService;
|
|
|
@Autowired
|
|
|
private ICourseMenuExamService iCourseMenuExamService;
|
|
|
@@ -433,7 +439,43 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
|
|
|
@Override
|
|
|
public List<GoodsVo> selectListToInput(GoodsQueryBo bo) {
|
|
|
- return baseMapper.selectListToInput(bo);
|
|
|
+ List<GoodsVo> goodsVoList = baseMapper.selectListToInput(bo);
|
|
|
+ if (CollectionUtils.isEmpty(goodsVoList)){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ if (bo.getGoodsType() == 1){
|
|
|
+ goodsVoList.forEach(item -> {
|
|
|
+ List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService
|
|
|
+ .list(new LambdaQueryWrapper<ClassGradeGoods>()
|
|
|
+ .eq(ClassGradeGoods::getGoodsId, item.getGoodsId()));
|
|
|
+ if (CollectionUtils.isNotEmpty(gradeGoods)){
|
|
|
+ item.setGradeNum(Long.valueOf(gradeGoods.size()));
|
|
|
+ gradeGoods.forEach(gradeGoodsItem -> {
|
|
|
+ ClassGrade grade = iClassGradeService.getById(gradeGoodsItem.getGradeId());
|
|
|
+ if (ObjectUtils.isNotNull(grade.getClassStartTime()) || grade.getClassEndTime() < DateUtils.getNowTime()){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (ObjectUtils.isNotNull(grade.getSevenCode())){
|
|
|
+ //七大员继教班级,计算班级人数
|
|
|
+ Integer classGradeNum = iOrderService.getClassGradeNum(grade.getSevenCode());
|
|
|
+ if (classGradeNum < grade.getStudentUpper()){
|
|
|
+ item.setGradeId(grade.getGradeId());
|
|
|
+ item.setGradeName(grade.getClassName());
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ Integer count = iClassGradeUserService.count(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getGradeId, grade.getGradeId())
|
|
|
+ .eq(ClassGradeUser::getStatus, 1));
|
|
|
+ if (count < grade.getStudentUpper()){
|
|
|
+ item.setGradeId(grade.getGradeId());
|
|
|
+ item.setGradeName(grade.getClassName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return goodsVoList;
|
|
|
}
|
|
|
|
|
|
@Override
|