|
@@ -571,43 +571,43 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
ClassGrade update = BeanUtil.toBean(bo, ClassGrade.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
-
|
|
|
- ClassGradeGoods gradeGoods = iClassGradeGoodsService.getOne(new LambdaQueryWrapper<ClassGradeGoods>().eq(ClassGradeGoods::getGradeId, update.getGradeId()));
|
|
|
- if (ObjectUtils.isNull(gradeGoods)) {
|
|
|
- throw new RuntimeException("班级商品信息查询失败");
|
|
|
- }
|
|
|
- ClassGrade classGrade = getById(update.getGradeId());
|
|
|
- String officialName = classGrade.getOfficialName();//预开班班级编号
|
|
|
- //企业ID
|
|
|
- String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
- SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenant));
|
|
|
-
|
|
|
- Goods goods = iGoodsService.getById(gradeGoods.getGoodsId());
|
|
|
- CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
|
- businessQueryBo.setId(goods.getBusinessId());
|
|
|
- String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
|
|
|
-
|
|
|
- if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName)))&& sysTenant.getShareClass() == 1) {
|
|
|
- if (update.getClassStatus() != null && update.getClassStatus().equals(1)) {
|
|
|
- //二造和二建班级开班校验班级人数(300人)
|
|
|
- if (!checkClassUserNum(goods.getBusinessId(), update.getGradeId())) {
|
|
|
- throw new RuntimeException("班级人数超过上限,不能开班,请检查!");
|
|
|
- }
|
|
|
- ClassGrade gradeGrade = getById(update.getGradeId());
|
|
|
- if (StringUtils.isNotBlank(gradeGrade.getOfficialName())) {
|
|
|
- update.setRegisterCode(gradeGrade.getOfficialName());
|
|
|
- }
|
|
|
- //二建/二造官方信息推送开关打开
|
|
|
- List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
|
|
|
- .list(new LambdaQueryWrapper<ClassGradeInterface>()
|
|
|
- .eq(ClassGradeInterface::getType, 1).last("limit 1"));
|
|
|
- if (CollectionUtils.isNotEmpty(interfaceList)) {
|
|
|
- update.setInterfacePushId(interfaceList.get(0).getId());
|
|
|
+ List<ClassGradeGoods> goodsList = iClassGradeGoodsService.list(new LambdaQueryWrapper<ClassGradeGoods>().eq(ClassGradeGoods::getGradeId, update.getGradeId()));
|
|
|
+ for(ClassGradeGoods gradeGoods:goodsList){
|
|
|
+ if (ObjectUtils.isNull(gradeGoods)) {
|
|
|
+ throw new RuntimeException("班级商品信息查询失败");
|
|
|
+ }
|
|
|
+ ClassGrade classGrade = getById(update.getGradeId());
|
|
|
+ String officialName = classGrade.getOfficialName();//预开班班级编号
|
|
|
+ //企业ID
|
|
|
+ String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ SysTenant sysTenant = sysTenantService.getById(Long.valueOf(tenant));
|
|
|
+
|
|
|
+ Goods goods = iGoodsService.getById(gradeGoods.getGoodsId());
|
|
|
+ CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
|
+ businessQueryBo.setId(goods.getBusinessId());
|
|
|
+ String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
|
|
|
+
|
|
|
+ if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName)))&& sysTenant.getShareClass() == 1) {
|
|
|
+ if (update.getClassStatus() != null && update.getClassStatus().equals(1)) {
|
|
|
+ //二造和二建班级开班校验班级人数(300人)
|
|
|
+ if (!checkClassUserNum(goods.getBusinessId(), update.getGradeId())) {
|
|
|
+ throw new RuntimeException("班级人数超过上限,不能开班,请检查!");
|
|
|
+ }
|
|
|
+ ClassGrade gradeGrade = getById(update.getGradeId());
|
|
|
+ if (StringUtils.isNotBlank(gradeGrade.getOfficialName())) {
|
|
|
+ update.setRegisterCode(gradeGrade.getOfficialName());
|
|
|
+ }
|
|
|
+ //二建/二造官方信息推送开关打开
|
|
|
+ List<ClassGradeInterface> interfaceList = iClassGradeInterfaceService
|
|
|
+ .list(new LambdaQueryWrapper<ClassGradeInterface>()
|
|
|
+ .eq(ClassGradeInterface::getType, 1).last("limit 1"));
|
|
|
+ if (CollectionUtils.isNotEmpty(interfaceList)) {
|
|
|
+ update.setInterfacePushId(interfaceList.get(0).getId());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- if (bo.getStatus() != -1) {
|
|
|
+ if (bo.getStatus() != -1) {
|
|
|
/* LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(ClassGrade::getClassName, update.getClassName());
|
|
|
lqw.eq(ClassGrade::getStatus, 1);
|
|
@@ -622,126 +622,128 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
throw new RuntimeException("班级名称不能重复");
|
|
|
}
|
|
|
}*/
|
|
|
- }
|
|
|
- if (bo.getStatus() == -1) { //删除判断班级是否人数空
|
|
|
- ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
- classGradeUserQueryBo.setGradeId(bo.getGradeId());
|
|
|
- List<ClassGradeStudentVo> list = this.listGrade(classGradeUserQueryBo);
|
|
|
- if (list.size() > 0) {
|
|
|
- throw new RuntimeException("班级还有学员,无法删除");
|
|
|
- }
|
|
|
- ClassGrade grade = getById(bo.getGradeId());
|
|
|
- if (StringUtils.isNotBlank(grade.getOfficialName())) {
|
|
|
- throw new RuntimeException("二建/二造班级无法删除,请联系技术人员!");
|
|
|
}
|
|
|
- }
|
|
|
- if (bo.getStatus() == 0) { //更新为无效
|
|
|
- ClassGradeVo oldGrade = this.queryById(bo.getGradeId());
|
|
|
- if (oldGrade.getStatus() == 1) {
|
|
|
+ if (bo.getStatus() == -1) { //删除判断班级是否人数空
|
|
|
ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
classGradeUserQueryBo.setGradeId(bo.getGradeId());
|
|
|
List<ClassGradeStudentVo> list = this.listGrade(classGradeUserQueryBo);
|
|
|
if (list.size() > 0) {
|
|
|
- throw new RuntimeException("班级还有学员,无法设置为无效");
|
|
|
+ throw new RuntimeException("班级还有学员,无法删除");
|
|
|
+ }
|
|
|
+ ClassGrade grade = getById(bo.getGradeId());
|
|
|
+ if (StringUtils.isNotBlank(grade.getOfficialName())) {
|
|
|
+ throw new RuntimeException("二建/二造班级无法删除,请联系技术人员!");
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(oldGrade.getOfficialName()) && sysTenant.getShareClass() == 1) {
|
|
|
- throw new RuntimeException("二建/二造班级无法设置为无效,请联系技术人员!");
|
|
|
+ if (bo.getStatus() == 0) { //更新为无效
|
|
|
+ ClassGradeVo oldGrade = this.queryById(bo.getGradeId());
|
|
|
+ if (oldGrade.getStatus() == 1) {
|
|
|
+ ClassGradeUserQueryBo classGradeUserQueryBo = new ClassGradeUserQueryBo();
|
|
|
+ classGradeUserQueryBo.setGradeId(bo.getGradeId());
|
|
|
+ List<ClassGradeStudentVo> list = this.listGrade(classGradeUserQueryBo);
|
|
|
+ if (list.size() > 0) {
|
|
|
+ throw new RuntimeException("班级还有学员,无法设置为无效");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (StringUtils.isNotBlank(oldGrade.getOfficialName()) && sysTenant.getShareClass() == 1) {
|
|
|
+ throw new RuntimeException("二建/二造班级无法设置为无效,请联系技术人员!");
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- //更改班主任
|
|
|
- if (bo.getSysUserId() != null) {
|
|
|
- LambdaQueryWrapper<ClassGradeSys> lqw = new LambdaQueryWrapper<>();
|
|
|
- lqw.like(ClassGradeSys::getGradeId, bo.getGradeId());
|
|
|
- lqw.like(ClassGradeSys::getSysUserId, bo.getSysUserId());
|
|
|
- lqw.like(ClassGradeSys::getStatus, 1);
|
|
|
- if (CollectionUtils.isEmpty(classGradeSysService.list(lqw))) {
|
|
|
- lqw.clear();
|
|
|
+ //更改班主任
|
|
|
+ if (bo.getSysUserId() != null) {
|
|
|
+ LambdaQueryWrapper<ClassGradeSys> lqw = new LambdaQueryWrapper<>();
|
|
|
lqw.like(ClassGradeSys::getGradeId, bo.getGradeId());
|
|
|
+ lqw.like(ClassGradeSys::getSysUserId, bo.getSysUserId());
|
|
|
lqw.like(ClassGradeSys::getStatus, 1);
|
|
|
- ClassGradeSys classGradeSys1 = new ClassGradeSys();
|
|
|
- classGradeSys1.setStatus(0);
|
|
|
- classGradeSys1.setEndTime(DateUtils.getNowTime());
|
|
|
- classGradeSys1.setUpdateTime(DateUtils.getNowTime());
|
|
|
- classGradeSysService.update(classGradeSys1, lqw);
|
|
|
-
|
|
|
- ClassGradeSys classGradeSys = new ClassGradeSys();
|
|
|
- classGradeSys.setGradeId(bo.getGradeId());
|
|
|
- classGradeSys.setCreateBy(SecurityUtils.getUsername());
|
|
|
- classGradeSys.setStartTime(DateUtils.getNowTime());
|
|
|
- classGradeSys.setSysUserId(bo.getSysUserId());
|
|
|
- classGradeSys.setStatus(1);
|
|
|
- classGradeSys.setCreateTime(DateUtils.getNowTime());
|
|
|
- classGradeSys.setUpdateTime(DateUtils.getNowTime());
|
|
|
- classGradeSysService.save(classGradeSys);
|
|
|
+ if (CollectionUtils.isEmpty(classGradeSysService.list(lqw))) {
|
|
|
+ lqw.clear();
|
|
|
+ lqw.like(ClassGradeSys::getGradeId, bo.getGradeId());
|
|
|
+ lqw.like(ClassGradeSys::getStatus, 1);
|
|
|
+ ClassGradeSys classGradeSys1 = new ClassGradeSys();
|
|
|
+ classGradeSys1.setStatus(0);
|
|
|
+ classGradeSys1.setEndTime(DateUtils.getNowTime());
|
|
|
+ classGradeSys1.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGradeSysService.update(classGradeSys1, lqw);
|
|
|
+
|
|
|
+ ClassGradeSys classGradeSys = new ClassGradeSys();
|
|
|
+ classGradeSys.setGradeId(bo.getGradeId());
|
|
|
+ classGradeSys.setCreateBy(SecurityUtils.getUsername());
|
|
|
+ classGradeSys.setStartTime(DateUtils.getNowTime());
|
|
|
+ classGradeSys.setSysUserId(bo.getSysUserId());
|
|
|
+ classGradeSys.setStatus(1);
|
|
|
+ classGradeSys.setCreateTime(DateUtils.getNowTime());
|
|
|
+ classGradeSys.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGradeSysService.save(classGradeSys);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- ClassGradeVo classGradeVo = this.queryById(bo.getGradeId());
|
|
|
+ ClassGradeVo classGradeVo = this.queryById(bo.getGradeId());
|
|
|
|
|
|
- //开班发送短信
|
|
|
- if (update.getClassStatus() != null && update.getClassStatus().equals(1) && (classGradeVo.getClassStatus() == null || classGradeVo.getClassStatus().equals(0))) {
|
|
|
- classGradeVo.setClassStartTime(update.getClassStartTime());
|
|
|
- classGradeVo.setClassEndTime(update.getClassEndTime());
|
|
|
- sendClassSMS(classGradeVo);
|
|
|
- }
|
|
|
- if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") &&
|
|
|
- StringUtils.isNotBlank(goods.getSevenYear()) && Arrays.asList("2021","2022").contains(goods.getSevenYear())){
|
|
|
- //七大员继教2021 2022年班级不开班
|
|
|
- update.setClassStatus(0);
|
|
|
- update.setInterfacePushId(null);
|
|
|
- update.setInterfacePeriodId(null);
|
|
|
- }
|
|
|
- this.updateById(update);
|
|
|
- if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") && StringUtils.isNotBlank(classGradeVo.getSevenCode())){
|
|
|
- List<ClassGrade> list = baseMapper.getListNoTenant(classGradeVo.getSevenCode(),update.getGradeId());
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
- List<ClassGrade> collect = list.stream().filter(item -> {
|
|
|
- ClassGradeGoods classGradeGoods = iClassGradeGoodsService.getOneNoTenant(item.getGradeId());
|
|
|
- Goods goodsOne = iGoodsService.getGoodsByIdNotTenant(classGradeGoods.getGoodsId());
|
|
|
- return StringUtils.isNotBlank(goodsOne.getSevenYear()) && !Arrays.asList("2021", "2022").contains(goodsOne.getSevenYear());
|
|
|
- }).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(collect)){
|
|
|
- list.forEach(item ->{
|
|
|
- update.setGradeId(item.getGradeId());
|
|
|
- updateByIdNoTenant(update);
|
|
|
- });
|
|
|
+ //开班发送短信
|
|
|
+ if (update.getClassStatus() != null && update.getClassStatus().equals(1) && (classGradeVo.getClassStatus() == null || classGradeVo.getClassStatus().equals(0))) {
|
|
|
+ classGradeVo.setClassStartTime(update.getClassStartTime());
|
|
|
+ classGradeVo.setClassEndTime(update.getClassEndTime());
|
|
|
+ sendClassSMS(classGradeVo);
|
|
|
+ }
|
|
|
+ if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") &&
|
|
|
+ StringUtils.isNotBlank(goods.getSevenYear()) && Arrays.asList("2021","2022").contains(goods.getSevenYear())){
|
|
|
+ //七大员继教2021 2022年班级不开班
|
|
|
+ update.setClassStatus(0);
|
|
|
+ update.setInterfacePushId(null);
|
|
|
+ update.setInterfacePeriodId(null);
|
|
|
+ }
|
|
|
+ this.updateById(update);
|
|
|
+ if (fullName.contains("继续教育") && fullName.contains("施工现场专业人员") && StringUtils.isNotBlank(classGradeVo.getSevenCode())){
|
|
|
+ List<ClassGrade> list = baseMapper.getListNoTenant(classGradeVo.getSevenCode(),update.getGradeId());
|
|
|
+ if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ List<ClassGrade> collect = list.stream().filter(item -> {
|
|
|
+ ClassGradeGoods classGradeGoods = iClassGradeGoodsService.getOneNoTenant(item.getGradeId());
|
|
|
+ Goods goodsOne = iGoodsService.getGoodsByIdNotTenant(classGradeGoods.getGoodsId());
|
|
|
+ return StringUtils.isNotBlank(goodsOne.getSevenYear()) && !Arrays.asList("2021", "2022").contains(goodsOne.getSevenYear());
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(collect)){
|
|
|
+ list.forEach(item ->{
|
|
|
+ update.setGradeId(item.getGradeId());
|
|
|
+ updateByIdNoTenant(update);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
- ClassGrade grade = getById(update.getGradeId());
|
|
|
- if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && sysTenant.getShareClass() == 1) {
|
|
|
- if (StringUtils.isNotBlank(grade.getOfficialName()) && grade.getClassStatus() == 1) {
|
|
|
+ ClassGrade grade = getById(update.getGradeId());
|
|
|
+ if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && sysTenant.getShareClass() == 1) {
|
|
|
+ if (StringUtils.isNotBlank(grade.getOfficialName()) && grade.getClassStatus() == 1) {
|
|
|
|
|
|
- ClassGradeOpenBo openBo = new ClassGradeOpenBo();
|
|
|
- openBo.setOfficialName(grade.getOfficialName());
|
|
|
+ ClassGradeOpenBo openBo = new ClassGradeOpenBo();
|
|
|
+ openBo.setOfficialName(grade.getOfficialName());
|
|
|
// openBo.setRegisterCode(grade.getRegisterCode());
|
|
|
- openBo.setRegisterCode(officialName);
|
|
|
- openBo.setClassName(grade.getClassName());
|
|
|
- openBo.setClassStartTime(grade.getClassStartTime());
|
|
|
- openBo.setClassEndTime(grade.getClassEndTime());
|
|
|
- openBo.setLearningStatus(grade.getLearningStatus());
|
|
|
- openBo.setLearningTimeStart(grade.getLearningTimeStart());
|
|
|
- //开班修改预报名班级下 所有班级
|
|
|
- this.openOfficialGrade(openBo);
|
|
|
- //官方班级开班通知旧系统
|
|
|
- Long nowTime = DateUtils.getNowTime();
|
|
|
- String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
- openBo.setSign(sign);
|
|
|
- openBo.setStamp(nowTime);
|
|
|
- JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(openBo));
|
|
|
- String respone = "";
|
|
|
- try {
|
|
|
- respone = HttpUtils.sendPost(CLASS_OPEN_PATH, param);
|
|
|
- log.info("查询旧系统班级开班接口结果" + respone, "");
|
|
|
- if (!respone.contains("\"Status\":true")) {
|
|
|
- throw new CustomException("同步请求错误" + respone);
|
|
|
+ openBo.setRegisterCode(officialName);
|
|
|
+ openBo.setClassName(grade.getClassName());
|
|
|
+ openBo.setClassStartTime(grade.getClassStartTime());
|
|
|
+ openBo.setClassEndTime(grade.getClassEndTime());
|
|
|
+ openBo.setLearningStatus(grade.getLearningStatus());
|
|
|
+ openBo.setLearningTimeStart(grade.getLearningTimeStart());
|
|
|
+ //开班修改预报名班级下 所有班级
|
|
|
+ this.openOfficialGrade(openBo);
|
|
|
+ //官方班级开班通知旧系统
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
+ openBo.setSign(sign);
|
|
|
+ openBo.setStamp(nowTime);
|
|
|
+ JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(openBo));
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.sendPost(CLASS_OPEN_PATH, param);
|
|
|
+ log.info("查询旧系统班级开班接口结果" + respone, "");
|
|
|
+ if (!respone.contains("\"Status\":true")) {
|
|
|
+ throw new CustomException("同步请求错误" + respone);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CustomException("同步请求错误" + e.getMessage());
|
|
|
}
|
|
|
- } catch (Exception e) {
|
|
|
- throw new CustomException("同步请求错误" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|