|
@@ -149,6 +149,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Autowired
|
|
|
private ISysOldOrgService iSysOldOrgService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysOldOrgService sysOldOrgService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
|
|
|
|
|
@@ -233,9 +236,14 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
throw new RuntimeException("班级名称不能重复");
|
|
|
}
|
|
|
+ //企业ID
|
|
|
+ String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
|
|
|
+ .eq(SysOldOrg::getTenantId, tenant)
|
|
|
+ .last("limit 1")).stream().findFirst().orElse(null);
|
|
|
//校验是否二建/二造商品创建班级
|
|
|
if (bo.getClassGradeGoodsAddBos() != null &&
|
|
|
- (ObjectUtils.isNull(bo.getClassStatus()) || 1 == bo.getClassStatus())) {
|
|
|
+ (ObjectUtils.isNull(bo.getClassStatus()) || 1 == bo.getClassStatus()) && org.getShareClass() == 1) {
|
|
|
Long goodsId = bo.getClassGradeGoodsAddBos()[0];
|
|
|
Goods goods = iGoodsService.getById(goodsId);
|
|
|
CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
@@ -248,7 +256,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
|
|
|
//是否创建官方班级编号
|
|
|
if (bo.getClassGradeGoodsAddBos() != null &&
|
|
|
- (ObjectUtils.isNull(bo.getClassStatus()) || 0 == bo.getClassStatus())) {
|
|
|
+ (ObjectUtils.isNull(bo.getClassStatus()) || 0 == bo.getClassStatus()) && org.getShareClass() == 1) {
|
|
|
Long goodsId = bo.getClassGradeGoodsAddBos()[0];
|
|
|
Goods goods = iGoodsService.getById(goodsId);
|
|
|
CourseBusiness business = iCourseBusinessService.getById(goods.getBusinessId());
|
|
@@ -259,17 +267,17 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
List<Goods> goodsList = iGoodsService.list(new LambdaQueryWrapper<Goods>()
|
|
|
.eq(Goods::getEducationTypeId, goods.getEducationTypeId())
|
|
|
.eq(Goods::getBusinessId, goods.getBusinessId())
|
|
|
- .eq(Goods::getStatus,1)
|
|
|
- .eq(Goods::getGoodsStatus,1)
|
|
|
+ .eq(Goods::getStatus, 1)
|
|
|
+ .eq(Goods::getGoodsStatus, 1)
|
|
|
.eq(Goods::getProjectId, goods.getProjectId())
|
|
|
.eq(Goods::getSubjectIds, goods.getSubjectIds()));
|
|
|
- if (goodsList.size() > 1){
|
|
|
+ if (goodsList.size() > 1) {
|
|
|
//该业务层次下有多个商品
|
|
|
List<Long> goodsIds = goodsList.stream().filter(item -> !item.getGoodsId().equals(goodsId)).map(Goods::getGoodsId).collect(Collectors.toList());
|
|
|
List<ClassGradeGoods> goodsGradeList = iClassGradeGoodsService
|
|
|
.list(new LambdaQueryWrapper<ClassGradeGoods>()
|
|
|
.in(ClassGradeGoods::getGoodsId, goodsIds));
|
|
|
- if (CollectionUtils.isNotEmpty(goodsGradeList)){
|
|
|
+ if (CollectionUtils.isNotEmpty(goodsGradeList)) {
|
|
|
Map<Long, List<ClassGradeGoods>> map = goodsGradeList.stream().collect(Collectors.groupingBy(ClassGradeGoods::getGoodsId));
|
|
|
List<ClassGradeSortBo> sortList = new ArrayList<>();
|
|
|
map.forEach((k, v) -> {
|
|
@@ -286,10 +294,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goods.getGoodsId());
|
|
|
if (gradeGoods.size() < listGrade.size()) {
|
|
|
ClassGrade grade = list.get(gradeGoods.size());
|
|
|
- if (checkEjjjPeopleNumLimit(business.getId(),grade.getGradeId())){
|
|
|
+ if (checkEjjjPeopleNumLimit(business.getId(), grade.getGradeId())) {
|
|
|
add.setOfficialName(list.get(gradeGoods.size()).getOfficialName());
|
|
|
add.setClassStatus(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
add.setOfficialName(ServletUtils.getEncoded("PIY"));
|
|
|
add.setClassStatus(0);
|
|
|
}
|
|
@@ -297,7 +305,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isBlank(add.getOfficialName())){
|
|
|
+ if (StringUtils.isBlank(add.getOfficialName())) {
|
|
|
List<CourseSubject> courseSubjectList = iCourseSubjectService.listByIds(Arrays.asList(goods.getSubjectIds().split(",")));
|
|
|
List<String> subNames = courseSubjectList.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
List<Long> subIds = iCourseSubjectService.getIdsByTenant(subNames);
|
|
@@ -306,15 +314,15 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
bgListBo.setAliasName(business.getAliasName());
|
|
|
bgListBo.setSubIds(subIds);
|
|
|
List<ClassGrade> classGrades = baseMapper.getGradeListByTenant(bgListBo);
|
|
|
- if (CollectionUtils.isEmpty(classGrades)){
|
|
|
+ if (CollectionUtils.isEmpty(classGrades)) {
|
|
|
//生成预报名官方编号
|
|
|
add.setOfficialName(ServletUtils.getEncoded("PIY"));
|
|
|
add.setClassStatus(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//获取班级创建最多的机构
|
|
|
Map<Long, List<ClassGrade>> map = classGrades.stream().collect(Collectors.groupingBy(ClassGrade::getTenantId));
|
|
|
List<ClassGradeSortBo> sortList = new ArrayList<>();
|
|
|
- map.forEach((k,v) -> {
|
|
|
+ map.forEach((k, v) -> {
|
|
|
ClassGradeSortBo sortBo = new ClassGradeSortBo();
|
|
|
sortBo.setKey(k);
|
|
|
Map<String, List<ClassGrade>> collect = v.stream().collect(Collectors.groupingBy(ClassGrade::getOfficialName));
|
|
@@ -326,17 +334,17 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
//去重
|
|
|
List<String> codeStrs = new ArrayList<>();
|
|
|
for (ClassGrade gradesMax : classGradesMax) {
|
|
|
- if (codeStrs.contains(gradesMax.getOfficialName())){
|
|
|
+ if (codeStrs.contains(gradesMax.getOfficialName())) {
|
|
|
continue;
|
|
|
}
|
|
|
codeStrs.add(gradesMax.getOfficialName());
|
|
|
}
|
|
|
//获取当前机构商品下的班级
|
|
|
List<ClassGradeGoods> gradeGoods = iClassGradeGoodsService.getGradeGoodsList(goodsId);
|
|
|
- if(gradeGoods.size() < codeStrs.size()){
|
|
|
+ if (gradeGoods.size() < codeStrs.size()) {
|
|
|
add.setOfficialName(codeStrs.get(gradeGoods.size()));
|
|
|
add.setClassStatus(0);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//生成预报名官方编号
|
|
|
add.setOfficialName(ServletUtils.getEncoded("PIY"));
|
|
|
add.setClassStatus(0);
|
|
@@ -382,30 +390,36 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
validEntityBeforeSave(update);
|
|
|
update.setUpdateTime(DateUtils.getNowTime());
|
|
|
|
|
|
- ClassGradeGoods gradeGoods = iClassGradeGoodsService.getOne(new LambdaQueryWrapper<ClassGradeGoods>().eq(ClassGradeGoods::getGradeId,update.getGradeId()));
|
|
|
- if (ObjectUtils.isNull(gradeGoods)){
|
|
|
+ ClassGradeGoods gradeGoods = iClassGradeGoodsService.getOne(new LambdaQueryWrapper<ClassGradeGoods>().eq(ClassGradeGoods::getGradeId, update.getGradeId()));
|
|
|
+ if (ObjectUtils.isNull(gradeGoods)) {
|
|
|
throw new RuntimeException("班级商品信息查询失败");
|
|
|
}
|
|
|
+ //企业ID
|
|
|
+ String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
|
|
|
+ .eq(SysOldOrg::getTenantId, tenant)
|
|
|
+ .last("limit 1")).stream().findFirst().orElse(null);
|
|
|
+
|
|
|
Goods goods = iGoodsService.getById(gradeGoods.getGoodsId());
|
|
|
CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
|
businessQueryBo.setId(goods.getBusinessId());
|
|
|
String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
|
|
|
|
|
|
- if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
|
|
|
+ if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName)))&& org.getShareClass() == 1) {
|
|
|
if (update.getClassStatus() != null && update.getClassStatus().equals(1)) {
|
|
|
//二造和二建班级开班校验班级人数(300人)
|
|
|
- if (!checkClassUserNum(goods.getBusinessId(),update.getGradeId())){
|
|
|
+ if (!checkClassUserNum(goods.getBusinessId(), update.getGradeId())) {
|
|
|
throw new RuntimeException("班级人数超过上限,不能开班,请检查!");
|
|
|
}
|
|
|
ClassGrade gradeGrade = getById(update.getGradeId());
|
|
|
- if (StringUtils.isNotBlank(gradeGrade.getOfficialName())){
|
|
|
+ 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)){
|
|
|
+ .eq(ClassGradeInterface::getType, 1).last("limit 1"));
|
|
|
+ if (CollectionUtils.isNotEmpty(interfaceList)) {
|
|
|
update.setInterfacePushId(interfaceList.get(0).getId());
|
|
|
}
|
|
|
}
|
|
@@ -435,7 +449,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
throw new RuntimeException("班级还有学员,无法删除");
|
|
|
}
|
|
|
ClassGrade grade = getById(bo.getGradeId());
|
|
|
- if (StringUtils.isNotBlank(grade.getOfficialName())){
|
|
|
+ if (StringUtils.isNotBlank(grade.getOfficialName())) {
|
|
|
throw new RuntimeException("二建/二造班级无法删除,请联系技术人员!");
|
|
|
}
|
|
|
}
|
|
@@ -449,7 +463,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
throw new RuntimeException("班级还有学员,无法设置为无效");
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(oldGrade.getOfficialName())){
|
|
|
+ if (StringUtils.isNotBlank(oldGrade.getOfficialName()) && org.getShareClass() == 1) {
|
|
|
throw new RuntimeException("二建/二造班级无法设置为无效,请联系技术人员!");
|
|
|
}
|
|
|
}
|
|
@@ -491,9 +505,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
this.updateById(update);
|
|
|
|
|
|
ClassGrade grade = getById(update.getGradeId());
|
|
|
- if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
|
|
|
+ if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && org.getShareClass() == 1) {
|
|
|
if (ObjectUtils.isNotNull(grade) && ObjectUtils.isNotNull(grade.getClassStatus())
|
|
|
- && StringUtils.isNotBlank(grade.getOfficialName()) && grade.getClassStatus() == 1){
|
|
|
+ && StringUtils.isNotBlank(grade.getOfficialName()) && grade.getClassStatus() == 1) {
|
|
|
// List<ClassGrade> list = list(new LambdaQueryWrapper<ClassGrade>().eq(ClassGrade::getOfficialName, update.getRegisterCode()));
|
|
|
// if (CollectionUtils.isNotEmpty(list)){
|
|
|
// update(new LambdaUpdateWrapper<ClassGrade>()
|
|
@@ -519,7 +533,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
this.openOfficialGrade(openBo);
|
|
|
//官方班级开班通知旧系统
|
|
|
Long nowTime = DateUtils.getNowTime();
|
|
|
- String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
openBo.setSign(sign);
|
|
|
openBo.setStamp(nowTime);
|
|
|
JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(openBo));
|
|
@@ -531,7 +545,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
throw new CustomException("同步请求错误" + respone);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
- throw new CustomException("同步请求错误"+e.getMessage());
|
|
|
+ throw new CustomException("同步请求错误" + e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -980,10 +994,15 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
|
|
|
@Override
|
|
|
public boolean checkEjjjPeopleNumLimit(Long businessId, Long gradeId) {
|
|
|
+ //企业ID
|
|
|
+ String tenant = ServletUtils.getRequest().getHeader("TenantId");
|
|
|
+ SysOldOrg org = sysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
|
|
|
+ .eq(SysOldOrg::getTenantId, tenant)
|
|
|
+ .last("limit 1")).stream().findFirst().orElse(null);
|
|
|
CourseBusinessQueryBo businessQueryBo = new CourseBusinessQueryBo();
|
|
|
businessQueryBo.setId(businessId);
|
|
|
String fullName = iCourseBusinessService.queryFullName(businessQueryBo);
|
|
|
- if (("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) {
|
|
|
+ if ((("继续教育二级建造师".equals(fullName)) || ("继续教育二级造价师".equals(fullName))) && org.getShareClass() == 1) {
|
|
|
//继教二建或者继教二造班级
|
|
|
ClassGradeVo gradeVo = queryById(gradeId);
|
|
|
if (Validator.isNotEmpty(gradeVo) && Validator.isNotEmpty(gradeVo.getOfficialName())) {
|
|
@@ -1099,9 +1118,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
throw new CustomException("同步查询班级人数请求错误" + e.getMessage());
|
|
|
}
|
|
|
numAll = peopleNum + oldGradeNum;
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
Long num = baseMapper.getClassUserNumByTenant(gradeId);
|
|
|
- if (ObjectUtils.isNotNull(num)){
|
|
|
+ if (ObjectUtils.isNotNull(num)) {
|
|
|
numAll = num.intValue();
|
|
|
}
|
|
|
}
|
|
@@ -1156,7 +1175,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Override
|
|
|
public ClassGradeVo getClassGradeVo(Long gradeId) {
|
|
|
ClassGrade gradeVo = getById(gradeId);
|
|
|
- if (ObjectUtils.isNull(gradeVo)){
|
|
|
+ if (ObjectUtils.isNull(gradeVo)) {
|
|
|
return null;
|
|
|
}
|
|
|
ClassGradeVo vo = BeanUtil.toBean(gradeVo, ClassGradeVo.class);
|
|
@@ -1173,28 +1192,28 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Override
|
|
|
public List<ClassNpUserInfoVo> officialGradeDetail(ClassNpUserInfoBo bo) {
|
|
|
List<ClassNpUserInfoVo> result = baseMapper.getGradeDetailByTenant(bo);
|
|
|
- if (CollectionUtils.isEmpty(result)){
|
|
|
+ if (CollectionUtils.isEmpty(result)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
result.forEach(item -> {
|
|
|
String date = "yyyy-MM-dd HH:mm:ss";
|
|
|
- item.setOrderTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(),date));
|
|
|
- item.setCreateTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(),date));
|
|
|
- item.setDoTime(DateUtils.timestampToDateFormat(item.getDoTimeLong(),date));
|
|
|
+ item.setOrderTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(), date));
|
|
|
+ item.setCreateTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(), date));
|
|
|
+ item.setDoTime(DateUtils.timestampToDateFormat(item.getDoTimeLong(), date));
|
|
|
//机构名称
|
|
|
SysTenant tenant = sysTenantService.getById(item.getTenantId());
|
|
|
- if (ObjectUtils.isNotNull(tenant)){
|
|
|
+ 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));
|
|
|
+ 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())){
|
|
|
+ if (StringUtils.isNotBlank(item.getSubjectIds())) {
|
|
|
List<CourseSubject> courseSubjectList = iCourseSubjectService.getListByIDs(Arrays.asList(item.getSubjectIds().split(",")).stream().map(x -> Long.valueOf(x)).collect(Collectors.toList()));
|
|
|
item.setMajorName(courseSubjectList.stream().filter(x -> StringUtils.isNotBlank(x.getSubjectName())).map(CourseSubject::getSubjectName).collect(Collectors.joining(",")));
|
|
|
}
|
|
@@ -1213,20 +1232,21 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
//祥粤云
|
|
|
Long tenantId = 867735392558919680L;
|
|
|
bgListBo.setTenantId(tenantId);
|
|
|
+ bgListBo.setEducationName("继续教育");
|
|
|
List<Long> goodsIds = baseMapper.getGoodsIdByBoTenant(bgListBo);
|
|
|
- if (CollectionUtils.isEmpty(goodsIds)){
|
|
|
+ if (CollectionUtils.isEmpty(goodsIds)) {
|
|
|
throw new CustomException("改业务层次下不存在商品,请检查!");
|
|
|
}
|
|
|
//生成预报名官方编号
|
|
|
String encoded = ServletUtils.getEncoded("PIY");
|
|
|
- if (CollectionUtils.isEmpty(classGrades)){
|
|
|
+ if (CollectionUtils.isEmpty(classGrades)) {
|
|
|
//创建新预报名班级
|
|
|
- creatClass(goodsIds.get(0),tenantId,encoded);
|
|
|
- }else {
|
|
|
+ creatClass(goodsIds, tenantId, encoded);
|
|
|
+ } else {
|
|
|
//获取班级创建最多的机构
|
|
|
Map<Long, List<ClassGrade>> map = classGrades.stream().collect(Collectors.groupingBy(ClassGrade::getTenantId));
|
|
|
List<ClassGradeSortBo> sortList = new ArrayList<>();
|
|
|
- map.forEach((k,v) -> {
|
|
|
+ map.forEach((k, v) -> {
|
|
|
ClassGradeSortBo sortBo = new ClassGradeSortBo();
|
|
|
sortBo.setKey(k);
|
|
|
Map<String, List<ClassGrade>> collect = v.stream().collect(Collectors.groupingBy(ClassGrade::getOfficialName));
|
|
@@ -1235,18 +1255,18 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
});
|
|
|
ClassGradeSortBo sortBo = sortList.stream().sorted(Comparator.comparing(ClassGradeSortBo::getSize).reversed()).findFirst().orElse(null);
|
|
|
List<ClassGrade> classGradesMax = map.get(sortBo.getKey()).stream().sorted(Comparator.comparing(ClassGrade::getCreateTime)).collect(Collectors.toList());
|
|
|
- if(bo.getSortNum() < classGradesMax.size()){
|
|
|
+ if (bo.getSortNum() < classGradesMax.size()) {
|
|
|
ClassGrade classGrade = classGradesMax.get(bo.getSortNum());
|
|
|
ClassUserNumBo classUserNumBo = new ClassUserNumBo();
|
|
|
classUserNumBo.setOfficialName(classGrade.getOfficialName());
|
|
|
ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
|
|
|
classGradeQueryBo.setOfficialName(classGrade.getOfficialName());
|
|
|
Integer count = baseMapper.queryOfficialGradeCount(classGradeQueryBo);
|
|
|
- classUserNumBo.setNum(ObjectUtils.isNotNull(count)?count:0);
|
|
|
- return classUserNumBo;
|
|
|
- }else {
|
|
|
+ classUserNumBo.setNum(ObjectUtils.isNotNull(count) ? count : 0);
|
|
|
+ return classUserNumBo;
|
|
|
+ } else {
|
|
|
//创建新预报名班级
|
|
|
- creatClass(goodsIds.get(0),tenantId,encoded);
|
|
|
+ creatClass(goodsIds, tenantId, encoded);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1255,7 +1275,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
ClassGradeQueryBo classGradeQueryBo = new ClassGradeQueryBo();
|
|
|
classGradeQueryBo.setOfficialName(encoded);
|
|
|
Integer count = baseMapper.queryOfficialGradeCount(classGradeQueryBo);
|
|
|
- classUserNumBo.setNum(ObjectUtils.isNotNull(count)?count:0);
|
|
|
+ classUserNumBo.setNum(ObjectUtils.isNotNull(count) ? count : 0);
|
|
|
return classUserNumBo;
|
|
|
}
|
|
|
|
|
@@ -1266,10 +1286,10 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
|
|
|
@Override
|
|
|
public void openOfficialGrade(ClassGradeOpenBo bo) {
|
|
|
- List<ClassGrade> list = baseMapper.getGradeListByCodeTenant(bo.getRegisterCode());
|
|
|
- if (CollectionUtils.isEmpty(list)){
|
|
|
- return;
|
|
|
- }
|
|
|
+ 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);
|
|
@@ -1281,14 +1301,14 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
openUpBo.setClassName(bo.getClassName());
|
|
|
openUpBo.setClassStartTime(bo.getClassStartTime());
|
|
|
openUpBo.setClassEndTime(bo.getClassEndTime());
|
|
|
- openUpBo.setLearningStatus(bo.getLearningStatus());
|
|
|
+ openUpBo.setLearningStatus(ObjectUtils.isNotNull(bo.getLearningStatus())?bo.getLearningStatus():1);
|
|
|
openUpBo.setLearningTimeStart(bo.getLearningTimeStart());
|
|
|
baseMapper.UpGradeStatusByTenant(openUpBo);
|
|
|
|
|
|
//开启官方信息推送
|
|
|
list.forEach(item -> {
|
|
|
- ClassGradeInterface interfaceInterface = iClassGradeInterfaceService.getInfterFaceByTenant(1,item.getTenantId());
|
|
|
- if (ObjectUtils.isNotNull(interfaceInterface)){
|
|
|
+ ClassGradeInterface interfaceInterface = iClassGradeInterfaceService.getInfterFaceByTenant(1, item.getTenantId());
|
|
|
+ if (ObjectUtils.isNotNull(interfaceInterface)) {
|
|
|
ClassGradeOpenUpBo upBo = new ClassGradeOpenUpBo();
|
|
|
upBo.setGradeId(item.getGradeId());
|
|
|
upBo.setInterfacePushId(interfaceInterface.getId());
|
|
@@ -1301,50 +1321,50 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Override
|
|
|
public List<ClassNpUserInfoVo> otherClassUserList(ClassNpUserInfoBo bo) {
|
|
|
ClassGrade grade = getById(bo.getGradeId());
|
|
|
- if (ObjectUtils.isNull(grade) || StringUtils.isBlank(grade.getOfficialName())){
|
|
|
+ if (ObjectUtils.isNull(grade) || StringUtils.isBlank(grade.getOfficialName())) {
|
|
|
throw new CustomException("班级信息有有误,请联系管理员!");
|
|
|
}
|
|
|
//查询旧机构对应新系统ID
|
|
|
- if (ObjectUtils.isNotNull(bo.getTrainOrgId())){
|
|
|
+ if (ObjectUtils.isNotNull(bo.getTrainOrgId())) {
|
|
|
List<SysOldOrg> list = iSysOldOrgService.list(new LambdaQueryWrapper<SysOldOrg>()
|
|
|
.eq(SysOldOrg::getOrgId, bo.getTrainOrgId())
|
|
|
.eq(SysOldOrg::getStatus, 1));
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
SysOldOrg sysOldOrg = list.get(0);
|
|
|
- bo.setTenantId(ObjectUtils.isNotNull(sysOldOrg.getTenantId())?sysOldOrg.getTenantId():0L);
|
|
|
- }else {
|
|
|
+ bo.setTenantId(ObjectUtils.isNotNull(sysOldOrg.getTenantId()) ? sysOldOrg.getTenantId() : 0L);
|
|
|
+ } else {
|
|
|
bo.setTenantId(0L);
|
|
|
}
|
|
|
}
|
|
|
bo.setOfficialName(grade.getOfficialName());
|
|
|
//新系统二建/二造班级学员信息
|
|
|
List<ClassNpUserInfoVo> result = baseMapper.getGradeDetailByTenant(bo);
|
|
|
- if (CollectionUtils.isNotEmpty(result)){
|
|
|
+ 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.getOrderTimeLong(),date));
|
|
|
- item.setDoTime(DateUtils.timestampToDateFormat(item.getDoTimeLong(),date));
|
|
|
+ item.setOrderTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(), date));
|
|
|
+ item.setCreateTime(DateUtils.timestampToDateFormat(item.getOrderTimeLong(), date));
|
|
|
+ item.setDoTime(DateUtils.timestampToDateFormat(item.getDoTimeLong(), date));
|
|
|
//机构名称
|
|
|
SysTenant tenant = sysTenantService.getById(item.getTenantId());
|
|
|
- if (ObjectUtils.isNotNull(tenant)){
|
|
|
+ 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));
|
|
|
- item.setApplyTime(DateUtils.timestampToDateFormat(item.getApplyTimeLong(),date));
|
|
|
+ UserStudyRecord startRecord = iUserStudyRecordService.getStudyRecord(item.getUserId(), item.getGradeId(), "ASC");
|
|
|
+ if (ObjectUtils.isNotNull(startRecord)) {
|
|
|
+ item.setBeginTime(DateUtils.timestampToDateFormat(startRecord.getCreateTime(), date));
|
|
|
+ item.setApplyTime(DateUtils.timestampToDateFormat(item.getApplyTimeLong(), date));
|
|
|
}
|
|
|
//科目名称
|
|
|
- if(StringUtils.isNotBlank(item.getSubjectIds())){
|
|
|
+ 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(",")));
|
|
|
}
|
|
|
- if (ObjectUtils.isNull(item.getReportStatu())){
|
|
|
+ if (ObjectUtils.isNull(item.getReportStatu())) {
|
|
|
item.setReportStatu(0);
|
|
|
}
|
|
|
- if (ObjectUtils.isNull(item.getStudyQueueStatus())){
|
|
|
+ if (ObjectUtils.isNull(item.getStudyQueueStatus())) {
|
|
|
item.setStudyQueueStatus(0);
|
|
|
}
|
|
|
});
|
|
@@ -1352,7 +1372,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
//旧系统二建/二造班级学员信息
|
|
|
bo.setClassNo(bo.getOfficialName());
|
|
|
Long nowTime = DateUtils.getNowTime();
|
|
|
- String sign = ToolsUtils.EncoderByMd5(nowTime.toString()+"pubilc2022");
|
|
|
+ String sign = ToolsUtils.EncoderByMd5(nowTime.toString() + "pubilc2022");
|
|
|
bo.setSign(sign);
|
|
|
bo.setStamp(nowTime);
|
|
|
JSONObject param = JSONObject.parseObject(JSONObject.toJSONString(bo));
|
|
@@ -1365,77 +1385,79 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
JSONObject jsonObject = (JSONObject) JSONObject.parse(respone);
|
|
|
JSONArray dataArray = jsonObject.getJSONArray("Message");
|
|
|
- if (ObjectUtils.isNotNull(dataArray)){
|
|
|
+ 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());
|
|
|
+ throw new CustomException("同步请求错误" + e.getMessage());
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
//创建预开班班级
|
|
|
- private void creatClass(Long goodsId,Long tenantId,String code){
|
|
|
- //创建新班级
|
|
|
- Goods goods = iGoodsService.getGoodsByIdTenant(goodsId,tenantId);
|
|
|
- CourseBusiness businessVo = iCourseBusinessService.getBusinessByIdTenant(goods.getBusinessId(),tenantId);
|
|
|
- boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
- if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateName()) && businessVo.getTemplateName().equals("班级")) {
|
|
|
- isConfigTp = true;
|
|
|
- }
|
|
|
- ClassGrade classGrade = new ClassGrade();
|
|
|
- classGrade.setCreateTime(DateUtils.getNowTime());
|
|
|
- if (isConfigTp) {
|
|
|
- classGrade.setClassStatus(0);
|
|
|
- classGrade.setLearningStatus(2);//待定
|
|
|
- classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
- //生成官方班级编号
|
|
|
- classGrade.setOfficialName(code);
|
|
|
- }
|
|
|
- classGrade.setUpdateTime(DateUtils.getNowTime());
|
|
|
- classGrade.setStatus(1);
|
|
|
- String gradeCode = ServletUtils.getEncoded("BJ");
|
|
|
- classGrade.setGradeCode(gradeCode);
|
|
|
+ private void creatClass(List<Long> goodsIds, Long tenantId, String code) {
|
|
|
+ goodsIds.forEach(goodsId -> {
|
|
|
+ //创建新班级
|
|
|
+ Goods goods = iGoodsService.getGoodsByIdTenant(goodsId, tenantId);
|
|
|
+ CourseBusiness businessVo = iCourseBusinessService.getBusinessByIdTenant(goods.getBusinessId(), tenantId);
|
|
|
+ boolean isConfigTp = false; //商品是否有配置选班模板
|
|
|
+ if (Validator.isNotEmpty(businessVo) && Validator.isNotEmpty(businessVo.getTemplateName()) && businessVo.getTemplateName().equals("班级")) {
|
|
|
+ isConfigTp = true;
|
|
|
+ }
|
|
|
+ ClassGrade classGrade = new ClassGrade();
|
|
|
+ classGrade.setCreateTime(DateUtils.getNowTime());
|
|
|
+ if (isConfigTp) {
|
|
|
+ classGrade.setClassStatus(0);
|
|
|
+ classGrade.setLearningStatus(2);//待定
|
|
|
+ classGrade.setStudentUpper(ClassGrade.INIT_UPPER); //上限300
|
|
|
+ //生成官方班级编号
|
|
|
+ classGrade.setOfficialName(code);
|
|
|
+ }
|
|
|
+ classGrade.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGrade.setStatus(1);
|
|
|
+ String gradeCode = ServletUtils.getEncoded("BJ");
|
|
|
+ classGrade.setGradeCode(gradeCode);
|
|
|
// classGrade.setClassName(goodsName + gradeCode);
|
|
|
- //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
- String businessName = businessVo.getAliasName();
|
|
|
- CourseEducationType educationType = courseEducationTypeService.getEducationByIdtenant(goods.getEducationTypeId(),tenantId);
|
|
|
- String educationName = educationType.getEducationName();
|
|
|
- String className = businessName + educationName;
|
|
|
- if (net.polyv.common.v1.util.StringUtils.isNotBlank(goods.getSubjectIds())){
|
|
|
- ClassGradeListBo bgListBo = new ClassGradeListBo();
|
|
|
- bgListBo.setSubIds(Arrays.stream(goods.getSubjectIds().split(",")).map(x -> Long.valueOf(x)).collect(Collectors.toList()));
|
|
|
- bgListBo.setTenantId(tenantId);
|
|
|
- List<CourseSubject> subjects = iCourseSubjectService.listByIdsTenant(bgListBo);
|
|
|
- List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
- className = String.format("%s(%s)",className,org.apache.commons.lang3.StringUtils.join(names,'+'));
|
|
|
- }
|
|
|
- Integer nameSort = 1;
|
|
|
- //获取排序值
|
|
|
- List<ClassGrade> list = baseMapper.queryListByNameTenantId(className,tenantId);
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
- List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
- String name = item.getClassName();
|
|
|
- String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
- return Integer.parseInt(substring);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(collect)){
|
|
|
- Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
- nameSort = integer + 1;
|
|
|
+ //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
|
|
|
+ String businessName = businessVo.getAliasName();
|
|
|
+ CourseEducationType educationType = courseEducationTypeService.getEducationByIdtenant(goods.getEducationTypeId(), tenantId);
|
|
|
+ String educationName = educationType.getEducationName();
|
|
|
+ String className = businessName + educationName;
|
|
|
+ if (net.polyv.common.v1.util.StringUtils.isNotBlank(goods.getSubjectIds())) {
|
|
|
+ ClassGradeListBo bgListBo = new ClassGradeListBo();
|
|
|
+ bgListBo.setSubIds(Arrays.stream(goods.getSubjectIds().split(",")).map(x -> Long.valueOf(x)).collect(Collectors.toList()));
|
|
|
+ bgListBo.setTenantId(tenantId);
|
|
|
+ List<CourseSubject> subjects = iCourseSubjectService.listByIdsTenant(bgListBo);
|
|
|
+ List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
|
|
|
+ className = String.format("%s(%s)", className, org.apache.commons.lang3.StringUtils.join(names, '+'));
|
|
|
}
|
|
|
- }
|
|
|
- classGrade.setClassName(String.format("%s年第%s期%s",goods.getYear(),nameSort,className));
|
|
|
- classGrade.setTenantId(tenantId);
|
|
|
- save(classGrade);
|
|
|
- //绑定班级商品
|
|
|
- ClassGradeGoods classGradeGoods = new ClassGradeGoods();
|
|
|
- classGradeGoods.setGradeId(classGrade.getGradeId());
|
|
|
- classGradeGoods.setGoodsId(goodsId);
|
|
|
- classGradeGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
- classGradeGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
- classGradeGoods.setTenantId(tenantId);
|
|
|
- iClassGradeGoodsService.save(classGradeGoods);
|
|
|
+ Integer nameSort = 1;
|
|
|
+ //获取排序值
|
|
|
+ List<ClassGrade> list = baseMapper.queryListByNameTenantId(className, tenantId);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
|
|
|
+ String name = item.getClassName();
|
|
|
+ String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
|
|
|
+ return Integer.parseInt(substring);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
+ Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
|
|
|
+ nameSort = integer + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ classGrade.setClassName(String.format("%s年第%s期%s", goods.getYear(), nameSort, className));
|
|
|
+ classGrade.setTenantId(tenantId);
|
|
|
+ save(classGrade);
|
|
|
+ //绑定班级商品
|
|
|
+ ClassGradeGoods classGradeGoods = new ClassGradeGoods();
|
|
|
+ classGradeGoods.setGradeId(classGrade.getGradeId());
|
|
|
+ classGradeGoods.setGoodsId(goodsId);
|
|
|
+ classGradeGoods.setCreateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ classGradeGoods.setTenantId(tenantId);
|
|
|
+ iClassGradeGoodsService.save(classGradeGoods);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
|