|
|
@@ -4131,40 +4131,40 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
|
|
|
public Long checkFinishRequiredCourse(ClassGradeUserQueryBo bo) {
|
|
|
//查询旧系统是否有学习
|
|
|
String businessName = iGoodsService.getGoodsBusinessName(bo.getGoodsId());
|
|
|
-// if (businessName.contains("继续教育二级建造师") || businessName.contains("继续教育二级造价师")){
|
|
|
-// OrderGoods orderGoods = baseMapper.getOrderGoods(bo.getUserId(),bo.getGoodsId());
|
|
|
-// if (ObjectUtils.isNotNull(orderGoods)){
|
|
|
-// ClassGradeUser classGradeUser = getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
-// .eq(ClassGradeUser::getOrderGoodsId, orderGoods.getOrderGoodsId())
|
|
|
-// .eq(ClassGradeUser::getUserId, bo.getUserId())
|
|
|
-// .eq(ClassGradeUser::getStatus, 1)
|
|
|
-// .last("limit 1"));
|
|
|
-// if (ObjectUtils.isNotNull(classGradeUser) && ObjectUtils.isNotNull(classGradeUser.getPeriodWaitTime())){
|
|
|
-// //重修
|
|
|
-// return 0L;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// User user = iUserService.getById(bo.getUserId());
|
|
|
-// Integer type = "继续教育二级建造师".equals(businessName)?1:2;
|
|
|
-// String param = String.format("idnum=%s&type=%s",EncryptHandler.decrypt(user.getIdCard()),type);
|
|
|
-// String respone = "";
|
|
|
-// try {
|
|
|
-// respone = HttpUtils.sendGet(OLD_STUDY_CHECK, param);
|
|
|
-// JSONObject jsonObject1 = JSONObject.parseObject(respone);
|
|
|
-// UserStudyTimeVo timeVo = JSONArray.parseObject(jsonObject1.get("data").toString(), UserStudyTimeVo.class);
|
|
|
-// if (ObjectUtils.isNotNull(timeVo) && ObjectUtils.isNotNull(timeVo.getStudyStartTime()) && timeVo.getStudyFlag()){
|
|
|
-// //旧系统正在学习中
|
|
|
-// throw new CustomException("请把旧云学堂课程学习完成,再学习另一个课程");
|
|
|
-// }
|
|
|
-// } catch (Exception e) {
|
|
|
-// throw new CustomException(e.getMessage());
|
|
|
-// }
|
|
|
-// List<Long> goodsIds = baseMapper.getFinishRequiredCourse(bo);
|
|
|
-// if(Validator.isNotEmpty(goodsIds)&&goodsIds.size()>0){
|
|
|
-// Goods goods = iGoodsService.getById(goodsIds.get(0));
|
|
|
-// throw new CustomException("请按顺序学习,把【"+goods.getGoodsName()+"】学习完成,再学习另一个课程");
|
|
|
-// }
|
|
|
-// }
|
|
|
+ if (businessName.contains("继续教育二级建造师") || businessName.contains("继续教育二级造价师")){
|
|
|
+ OrderGoods orderGoods = baseMapper.getOrderGoods(bo.getUserId(),bo.getGoodsId());
|
|
|
+ if (ObjectUtils.isNotNull(orderGoods)){
|
|
|
+ ClassGradeUser classGradeUser = getOne(new LambdaQueryWrapper<ClassGradeUser>()
|
|
|
+ .eq(ClassGradeUser::getOrderGoodsId, orderGoods.getOrderGoodsId())
|
|
|
+ .eq(ClassGradeUser::getUserId, bo.getUserId())
|
|
|
+ .eq(ClassGradeUser::getStatus, 1)
|
|
|
+ .last("limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(classGradeUser) && ObjectUtils.isNotNull(classGradeUser.getPeriodWaitTime())){
|
|
|
+ //重修
|
|
|
+ return 0L;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ User user = iUserService.getById(bo.getUserId());
|
|
|
+ Integer type = "继续教育二级建造师".equals(businessName)?1:2;
|
|
|
+ String param = String.format("idnum=%s&type=%s",EncryptHandler.decrypt(user.getIdCard()),type);
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.sendGet(OLD_STUDY_CHECK, param);
|
|
|
+ JSONObject jsonObject1 = JSONObject.parseObject(respone);
|
|
|
+ UserStudyTimeVo timeVo = JSONArray.parseObject(jsonObject1.get("data").toString(), UserStudyTimeVo.class);
|
|
|
+ if (ObjectUtils.isNotNull(timeVo) && ObjectUtils.isNotNull(timeVo.getStudyStartTime()) && timeVo.getStudyFlag()){
|
|
|
+ //旧系统正在学习中
|
|
|
+ throw new CustomException("请把旧云学堂课程学习完成,再学习另一个课程");
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CustomException(e.getMessage());
|
|
|
+ }
|
|
|
+ List<Long> goodsIds = baseMapper.getFinishRequiredCourse(bo);
|
|
|
+ if(Validator.isNotEmpty(goodsIds)&&goodsIds.size()>0){
|
|
|
+ Goods goods = iGoodsService.getById(goodsIds.get(0));
|
|
|
+ throw new CustomException("请按顺序学习,把【"+goods.getGoodsName()+"】学习完成,再学习另一个课程");
|
|
|
+ }
|
|
|
+ }
|
|
|
return 0L;
|
|
|
}
|
|
|
|