|
@@ -38,6 +38,7 @@ import com.zhongzheng.modules.inform.service.IInformRemindService;
|
|
|
import com.zhongzheng.modules.inform.service.IInformUserService;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindBusinessVo;
|
|
|
import com.zhongzheng.modules.inform.vo.InformRemindVo;
|
|
|
+import com.zhongzheng.modules.order.bo.OrderShareMoneyAddBo;
|
|
|
import com.zhongzheng.modules.order.mapper.OrderMapper;
|
|
|
import com.zhongzheng.modules.system.domain.SysTenant;
|
|
|
import com.zhongzheng.modules.system.service.ISysTenantService;
|
|
@@ -157,6 +158,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Value("${oldStudySys.pushGradeCount}")
|
|
|
private String GRADE_CHANGE_PATH;
|
|
|
|
|
|
+ @Value("${oldStudySys.classUserListPath}")
|
|
|
+ private String CLASS_LIST_PATH;
|
|
|
+
|
|
|
@Override
|
|
|
public ClassGradeVo queryById(Long gradeId) {
|
|
|
ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
|
|
@@ -240,7 +244,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
List<ClassGrade> classGrades = baseMapper.getGradeListByTenant(bgListBo);
|
|
|
if (CollectionUtils.isEmpty(classGrades)){
|
|
|
//生成预报名官方编号
|
|
|
- add.setRegisterCode(ServletUtils.getEncoded("PIY"));
|
|
|
+ add.setOfficialName(ServletUtils.getEncoded("PIY"));
|
|
|
add.setClassStatus(0);
|
|
|
}else {
|
|
|
//获取班级创建最多的机构
|
|
@@ -258,11 +262,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goodsId);
|
|
|
if(gradeGoods.size() < classGradesMax.size()){
|
|
|
ClassGrade classGrade = classGradesMax.get(gradeGoods.size());
|
|
|
- add.setRegisterCode(classGrade.getRegisterCode());
|
|
|
+ add.setOfficialName(classGrade.getRegisterCode());
|
|
|
add.setClassStatus(0);
|
|
|
}else {
|
|
|
//生成预报名官方编号
|
|
|
- add.setRegisterCode(ServletUtils.getEncoded("PIY"));
|
|
|
+ add.setOfficialName(ServletUtils.getEncoded("PIY"));
|
|
|
add.setClassStatus(0);
|
|
|
}
|
|
|
}
|
|
@@ -305,6 +309,23 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
ClassGrade update = BeanUtil.toBean(bo, ClassGrade.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ //二建和二造班级开班预留预报名编号
|
|
|
+ if (update.getClassStatus() != null && update.getClassStatus().equals(1)) {
|
|
|
+ //二造和二建班级开班校验班级人数(300人)
|
|
|
+ ClassGradeGoods gradeGoods = iClassGradeGoodsService.getOne(new LambdaQueryWrapper<ClassGradeGoods>().eq(ClassGradeGoods::getGradeId,update.getGradeId()));
|
|
|
+ if (ObjectUtils.isNull(gradeGoods)){
|
|
|
+ throw new RuntimeException("班级商品信息查询失败");
|
|
|
+ }
|
|
|
+ Goods goods = iGoodsService.getById(gradeGoods.getGoodsId());
|
|
|
+ if (!checkEjjjPeopleNumLimit(goods.getBusinessId(),update.getGradeId())){
|
|
|
+ throw new RuntimeException("班级人数超过上限,不能开班,请检查!");
|
|
|
+ }
|
|
|
+
|
|
|
+ ClassGrade gradeGrade = getById(update.getGradeId());
|
|
|
+ if (StringUtils.isNotBlank(gradeGrade.getOfficialName())){
|
|
|
+ update.setRegisterCode(gradeGrade.getOfficialName());
|
|
|
+ }
|
|
|
+ }
|
|
|
if (bo.getStatus() != -1) {
|
|
|
LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(ClassGrade::getClassName, update.getClassName());
|
|
@@ -328,6 +349,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
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());
|
|
@@ -339,6 +364,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
throw new RuntimeException("班级还有学员,无法设置为无效");
|
|
|
}
|
|
|
}
|
|
|
+ if (StringUtils.isNotBlank(oldGrade.getOfficialName())){
|
|
|
+ throw new RuntimeException("二建/二造班级无法设置为无效,请联系技术人员!");
|
|
|
+ }
|
|
|
}
|
|
|
//更改班主任
|
|
|
if (bo.getSysUserId() != null) {
|
|
@@ -1031,7 +1059,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
List<ClassGrade> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGrade::getCreateTime)).collect(Collectors.toList());
|
|
|
if(bo.getSortNum() < classGradesMax.size()){
|
|
|
ClassGrade classGrade = classGradesMax.get(bo.getSortNum());
|
|
|
- return classGrade.getRegisterCode();
|
|
|
+ return classGrade.getOfficialName();
|
|
|
}else {
|
|
|
//创建新预报名班级
|
|
|
creatClass(goodsIds.get(0),tenantId,encoded);
|
|
@@ -1040,6 +1068,87 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return encoded;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ClassGrade> getGradeListByTenant(ClassGradeListBo bgListBo) {
|
|
|
+ return baseMapper.getGradeListByTenant(bgListBo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void openOfficialGrade(ClassGradeOpenBo bo) {
|
|
|
+ List<ClassGrade> list = baseMapper.getGradeListByCodeTenant(bo.getRegisterCode());
|
|
|
+ if (CollectionUtils.isEmpty(list)){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<Long> ids = list.stream().map(ClassGrade::getGradeId).collect(Collectors.toList());
|
|
|
+ //保留预报名编号
|
|
|
+ baseMapper.UpGradeCodeByIdTenant(ids);
|
|
|
+
|
|
|
+ ClassGradeOpenUpBo openUpBo = new ClassGradeOpenUpBo();
|
|
|
+ openUpBo.setGradeIds(ids);
|
|
|
+ openUpBo.setClassStatus(bo.getClassStatus());
|
|
|
+ openUpBo.setOfficialName(bo.getOfficialName());
|
|
|
+ baseMapper.UpGradeStatusByTenant(openUpBo);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ClassNpUserInfoVo> otherClassUserList(ClassNpUserInfoBo bo) {
|
|
|
+ //新系统二建/二造班级学员信息
|
|
|
+ List<ClassNpUserInfoVo> result = baseMapper.getGradeDetailByTenant(bo);
|
|
|
+ if (CollectionUtils.isNotEmpty(result)){
|
|
|
+ result.forEach(item -> {
|
|
|
+ String date = "yyyy-MM-dd HH:mm:ss";
|
|
|
+ item.setOrderTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(),date));
|
|
|
+ item.setCreateTime(DateUtils.timestampToDateFormat(item.getCreateTimeLong(),date));
|
|
|
+ item.setDoTime(DateUtils.timestampToDateFormat(item.getDoTimeLong(),date));
|
|
|
+ //机构名称
|
|
|
+ SysTenant tenant = sysTenantService.getById(item.getTenantId());
|
|
|
+ if (ObjectUtils.isNotNull(tenant)){
|
|
|
+ item.setOrgName(tenant.getTenantName());
|
|
|
+ }
|
|
|
+ //获取学习开始时间和结束时间
|
|
|
+ UserStudyRecord startRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(),item.getGradeId(),"ASC");
|
|
|
+ if (ObjectUtils.isNotNull(startRecord)){
|
|
|
+ item.setBeginTime(DateUtils.timestampToDateFormat(startRecord.getCreateTime(),date));
|
|
|
+ UserStudyRecord endRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(),item.getGradeId(),"DESC");
|
|
|
+ item.setApplyTime(DateUtils.timestampToDateFormat(endRecord.getCreateTime(),date));
|
|
|
+ }
|
|
|
+ //科目名称
|
|
|
+ if(StringUtils.isNotBlank(item.getSubjectIds())){
|
|
|
+ List<CourseSubject> courseSubjectList = iCourseSubjectService.listByIds(Arrays.asList(item.getSubjectIds().split(",")));
|
|
|
+ item.setMajorName(courseSubjectList.stream().filter(x -> StringUtils.isNotBlank(x.getSubjectName())).map(CourseSubject::getSubjectName).collect(Collectors.joining(",")));
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //旧系统二建/二造班级学员信息
|
|
|
+ bo.setClassNo(bo.getOfficialName());
|
|
|
+// Map<String, String> params = new HashMap<>();
|
|
|
+ Long nowTime = DateUtils.getNowTime();
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
+// params.put("stamp", nowTime.toString());
|
|
|
+// params.put("sign", sign);
|
|
|
+// params.put("jsonstr", JSONObject.toJSONString(bo));
|
|
|
+ bo.setSign(sign);
|
|
|
+ bo.setStamp(nowTime);
|
|
|
+ JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(bo));
|
|
|
+ String respone = "";
|
|
|
+ try {
|
|
|
+ respone = HttpUtils.sendPost(CLASS_LIST_PATH, param);
|
|
|
+ log.info("查询旧系统班级人数结果" + respone, "");
|
|
|
+ if (!respone.contains("\"Status\":true")) {
|
|
|
+ throw new CustomException("同步请求错误" + respone);
|
|
|
+ }
|
|
|
+ JSONObject jsonObject = (JSONObject) JSONObject.parse(respone);
|
|
|
+ JSONArray dataArray = jsonObject.getJSONArray("Message");
|
|
|
+ if (ObjectUtils.isNotNull(dataArray)){
|
|
|
+ List<ClassNpUserInfoVo> voList = JSONArray.parseArray(JSONArray.toJSONString(dataArray), ClassNpUserInfoVo.class);
|
|
|
+ result.addAll(voList);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new CustomException("同步请求错误"+e.getMessage());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
//创建预开班班级
|
|
|
private void creatClass(Long goodsId,Long tenantId,String code){
|
|
|
//创建新班级
|
|
@@ -1056,7 +1165,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
classGrade.setLearningStatus(2);//待定
|
|
|
classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
//生成官方班级编号
|
|
|
- classGrade.setRegisterCode(code);
|
|
|
+ classGrade.setOfficialName(code);
|
|
|
}
|
|
|
classGrade.setUpdateTime(DateUtils.getNowTime());
|
|
|
classGrade.setStatus(1);
|