|
@@ -36,6 +36,7 @@ import com.zhongzheng.modules.goods.vo.GoodsVo;
|
|
|
import com.zhongzheng.modules.grade.bo.*;
|
|
|
import com.zhongzheng.modules.grade.domain.*;
|
|
|
import com.zhongzheng.modules.grade.mapper.ClassGradeMapper;
|
|
|
+import com.zhongzheng.modules.grade.mapper.ClassGradeUserMapper;
|
|
|
import com.zhongzheng.modules.grade.service.*;
|
|
|
import com.zhongzheng.modules.grade.vo.*;
|
|
|
import com.zhongzheng.modules.inform.bo.InformUserAddBo;
|
|
@@ -163,6 +164,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Autowired
|
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ClassGradeUserMapper classGradeUserMapper;
|
|
|
+
|
|
|
@Autowired
|
|
|
private com.zhongzheng.modules.alisms.service.IAliSmsService IAliSmsService;
|
|
|
|
|
@@ -247,7 +251,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
//二建/二造继教班级过滤
|
|
|
String businessName = iGoodsService.getGoodsBusinessName(item.getGoodsId());
|
|
|
if (businessName.contains("继续教育二级建造师") || businessName.contains("继续教育二级造价师")){
|
|
|
- if (gradeVo.getClassStatus() == 1 &&
|
|
|
+ if (Validator.isNotEmpty(gradeVo.getClassStatus())&&gradeVo.getClassStatus() == 1 &&
|
|
|
(gradeVo.getClassStartTime() > DateUtils.getNowTime() || gradeVo.getClassEndTime() < DateUtils.getNowTime())){
|
|
|
//过期班级
|
|
|
return false;
|
|
@@ -354,8 +358,12 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+ if (StringUtils.isNotBlank(bo.getOfficialName()) && ObjectUtils.isNotNull(bo.getClassStatus()) && bo.getClassStatus() == 1){
|
|
|
+ add.setSevenCode(ServletUtils.getEncoded("SEV"));
|
|
|
+ }else {
|
|
|
String sevenCode = getSevenCode(goodsId,add.getStudentUpper());
|
|
|
add.setSevenCode(sevenCode);
|
|
|
+ }
|
|
|
}
|
|
|
else if (("继续教育二级建造师".equals(businessName)|| ("继续教育二级造价师".equals(businessName))) && sysTenant.getShareClass() == 1){
|
|
|
erJfalg = true;
|
|
@@ -652,8 +660,8 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if (bo.getStatus() != -1) {
|
|
|
+ if(Validator.isNotEmpty(bo.getStatus())){
|
|
|
+ if (bo.getStatus() != -1) {
|
|
|
/* LambdaQueryWrapper<ClassGrade> lqw = Wrappers.lambdaQuery();
|
|
|
lqw.eq(ClassGrade::getClassName, update.getClassName());
|
|
|
lqw.eq(ClassGrade::getStatus, 1);
|
|
@@ -668,31 +676,32 @@ 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("二建/二造班级无法设置为无效,请联系技术人员!");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//更改班主任
|
|
@@ -868,6 +877,9 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
if(Validator.isNotEmpty(entity.getOfficialName())){
|
|
|
entity.setOfficialName(entity.getOfficialName().trim());
|
|
|
}
|
|
|
+ if(Validator.isNotEmpty(entity.getPastDueDay())&&entity.getPastDueDay()<10){
|
|
|
+ throw new CustomException("班级提前截止天数错误");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -932,6 +944,172 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
return classGradeStudentVos;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<ClassGradeStudentVo> listGradeAll(ClassGradeUserQueryBo bo) {
|
|
|
+ //身份证去重
|
|
|
+ if (Validator.isNotEmpty(bo.getIdCard()) && Validator.isNotEmpty(bo.getIdCards())) {
|
|
|
+ String idCard = bo.getIdCard();
|
|
|
+ List<String> idCards = bo.getIdCards();
|
|
|
+ Set<String> set = new HashSet<>();
|
|
|
+ for (String id : idCards) {
|
|
|
+ set.add(id);
|
|
|
+ }
|
|
|
+ set.add(idCard);
|
|
|
+ if (Validator.isNotEmpty(set)) {
|
|
|
+ bo.setIdCards(new ArrayList<>(set));
|
|
|
+ }
|
|
|
+ bo.setIdCard(null);
|
|
|
+ }
|
|
|
+ //查找班级学员
|
|
|
+ List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGradeAll(bo);
|
|
|
+ //得到每个学员的课程学习记录
|
|
|
+ for (ClassGradeStudentVo classGradeStudentVo : classGradeStudentVos) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(classGradeStudentVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(classGradeStudentVo.getUserId());
|
|
|
+ subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
|
|
|
+ subjectStudyRecordQueryBo.setOrderGoodsId(classGradeStudentVo.getOrderGoodsId());
|
|
|
+ List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
+ for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
|
|
|
+ secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
|
|
|
+ studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /* List<Long> timeList = classGradeUserMapper.selectStart(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId());
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(timeList)) {
|
|
|
+ //查找开始学习时间
|
|
|
+ classGradeStudentVo.setStartTime(timeList.get(0));
|
|
|
+ }else{
|
|
|
+ classGradeStudentVo.setStartTime(classGradeUserMapper.selectStartNoPhoto(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId())
|
|
|
+ );
|
|
|
+ }*/
|
|
|
+ //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
|
|
|
+ classGradeStudentVo.setSecAllNum(secLong);
|
|
|
+ classGradeStudentVo.setStuAllNum(studyLong);
|
|
|
+ /*UserUpdateQueryBo userUpdateQueryBo = new UserUpdateQueryBo();
|
|
|
+ userUpdateQueryBo.setUserId(classGradeStudentVo.getUserId());
|
|
|
+ classGradeStudentVo.setUserUpdates(iUserUpdateService.queryList(userUpdateQueryBo));*/
|
|
|
+ /*if (Validator.isNotEmpty(classGradeStudentVo.getRebuyOrderGoodsId()) && classGradeStudentVo.getRebuyOrderGoodsId().longValue() > 0) {
|
|
|
+ classGradeStudentVo.setRebuy(orderMapper.getGradePeriod(classGradeStudentVo.getRebuyOrderGoodsId(), classGradeStudentVo.getUserId()));
|
|
|
+ }*/
|
|
|
+/* if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())){
|
|
|
+ SysTenant tenant = iSysTenantService.getById(classGradeStudentVo.getOrgId());
|
|
|
+ if (ObjectUtils.isNotNull(tenant)){
|
|
|
+ classGradeStudentVo.setTenantName(tenant.getTenantName());
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+ }
|
|
|
+ return classGradeStudentVos;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ClassGradeStudentAllExportVo> listGradeAllExport(ClassGradeUserQueryBo bo) {
|
|
|
+ if (Validator.isNotEmpty(bo.getIdCard()) && Validator.isNotEmpty(bo.getIdCards())) {
|
|
|
+ String idCard = bo.getIdCard();
|
|
|
+ List<String> idCards = bo.getIdCards();
|
|
|
+ Set<String> set = new HashSet<>();
|
|
|
+ for (String id : idCards) {
|
|
|
+ set.add(id);
|
|
|
+ }
|
|
|
+ set.add(idCard);
|
|
|
+ if (Validator.isNotEmpty(set)) {
|
|
|
+ bo.setIdCards(new ArrayList<>(set));
|
|
|
+ }
|
|
|
+ bo.setIdCard(null);
|
|
|
+ }
|
|
|
+ //查找班级学员
|
|
|
+ List<ClassGradeStudentVo> classGradeStudentVos = baseMapper.listGradeAll(bo);
|
|
|
+ List<ClassGradeStudentAllExportVo> eList = new ArrayList<>();
|
|
|
+ //得到每个学员的课程学习记录
|
|
|
+ for (ClassGradeStudentVo classGradeStudentVo : classGradeStudentVos) {
|
|
|
+ Long secLong = 0L;
|
|
|
+ Long studyLong = 0L;
|
|
|
+
|
|
|
+ SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();
|
|
|
+ subjectStudyRecordQueryBo.setGoodsId(classGradeStudentVo.getGoodsId());
|
|
|
+ subjectStudyRecordQueryBo.setUserId(classGradeStudentVo.getUserId());
|
|
|
+ subjectStudyRecordQueryBo.setGradeId(bo.getGradeId());
|
|
|
+ subjectStudyRecordQueryBo.setOrderGoodsId(classGradeStudentVo.getOrderGoodsId());
|
|
|
+ List<SubjectStudyRecordVo> subjectStudyRecordVos = iUserStudyRecordService.listSubject(subjectStudyRecordQueryBo);
|
|
|
+ for (SubjectStudyRecordVo subjectStudyRecordVo : subjectStudyRecordVos) {
|
|
|
+ secLong = new BigDecimal(secLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getSectionNum().toString())).longValue();
|
|
|
+ studyLong = new BigDecimal(studyLong.toString()).add(new BigDecimal(subjectStudyRecordVo.getRecordNum().toString())).longValue();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Long> timeList = classGradeUserMapper.selectStart(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId());
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(timeList)) {
|
|
|
+ //查找开始学习时间
|
|
|
+ classGradeStudentVo.setStartTime(timeList.get(0));
|
|
|
+ }else{
|
|
|
+ classGradeStudentVo.setStartTime(classGradeUserMapper.selectStartNoPhoto(classGradeStudentVo.getUserId(), classGradeStudentVo.getGoodsId(), classGradeStudentVo.getGradeId(),classGradeStudentVo.getOrderGoodsId())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //BigDecimal divide = new BigDecimal(studyLong.toString()).divide(new BigDecimal(secLong.toString()),2,BigDecimal.ROUND_HALF_UP);
|
|
|
+ //classGradeStudentVo.setStudyNum(divide.multiply(new BigDecimal("100")).longValue());
|
|
|
+ classGradeStudentVo.setSecAllNum(secLong);
|
|
|
+ classGradeStudentVo.setStuAllNum(studyLong);
|
|
|
+ /*UserUpdateQueryBo userUpdateQueryBo = new UserUpdateQueryBo();
|
|
|
+ userUpdateQueryBo.setUserId(classGradeStudentVo.getUserId());
|
|
|
+ classGradeStudentVo.setUserUpdates(iUserUpdateService.queryList(userUpdateQueryBo));*/
|
|
|
+ /*if (Validator.isNotEmpty(classGradeStudentVo.getRebuyOrderGoodsId()) && classGradeStudentVo.getRebuyOrderGoodsId().longValue() > 0) {
|
|
|
+ classGradeStudentVo.setRebuy(orderMapper.getGradePeriod(classGradeStudentVo.getRebuyOrderGoodsId(), classGradeStudentVo.getUserId()));
|
|
|
+ }*/
|
|
|
+ if (ObjectUtils.isNotNull(classGradeStudentVo.getOrgId())){
|
|
|
+ SysTenant tenant = iSysTenantService.getById(classGradeStudentVo.getOrgId());
|
|
|
+ if (ObjectUtils.isNotNull(tenant)){
|
|
|
+ classGradeStudentVo.setTenantName(tenant.getTenantName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ClassGradeStudentAllExportVo exportVo = BeanUtil.toBean(classGradeStudentVo,ClassGradeStudentAllExportVo.class);
|
|
|
+ exportVo.setHourStr((classGradeStudentVo.getRecordNum()+classGradeStudentVo.getStuAllNum())+"/"+(classGradeStudentVo.getExamNum()+classGradeStudentVo.getSecAllNum()));
|
|
|
+ exportVo.setServiceTimeStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getServiceStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS)+"至"+DateUtils.timestampToDateFormat(classGradeStudentVo.getServiceEndTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ exportVo.setVideoStr(classGradeStudentVo.getStuAllNum()+"/"+classGradeStudentVo.getSecAllNum());
|
|
|
+ exportVo.setExamStr(classGradeStudentVo.getRecordNum()+"/"+classGradeStudentVo.getExamNum());
|
|
|
+ exportVo.setStudyStartStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getStartTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ exportVo.setStudyEndStr(DateUtils.timestampToDateFormat(classGradeStudentVo.getEndTime(),DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
+ if(classGradeStudentVo.getPeriodStatus()==-1||classGradeStudentVo.getPeriodStatus()==0){
|
|
|
+ exportVo.setStudyStatusStr("未学完");
|
|
|
+ }else{
|
|
|
+ exportVo.setStudyStatusStr("已完成");
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(classGradeStudentVo.getStudyCount())){
|
|
|
+ classGradeStudentVo.setStudyCount(0L);
|
|
|
+ }
|
|
|
+ if(Validator.isEmpty(classGradeStudentVo.getUseStudyCount())){
|
|
|
+ classGradeStudentVo.setUseStudyCount(0);
|
|
|
+ }
|
|
|
+ exportVo.setTotalStudyCount(classGradeStudentVo.getUseStudyCount()+classGradeStudentVo.getStudyCount().intValue());
|
|
|
+ if(Validator.isNotEmpty(classGradeStudentVo.getUserStatus())&&classGradeStudentVo.getUserStatus()==1){
|
|
|
+ exportVo.setUserStatus("变更");
|
|
|
+ }else{
|
|
|
+ exportVo.setUserStatus("未变更");
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(classGradeStudentVo.getOfficialStatus())&&classGradeStudentVo.getOfficialStatus()==1){
|
|
|
+ exportVo.setOfficialStatus("是");
|
|
|
+ }else{
|
|
|
+ exportVo.setOfficialStatus("否");
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(classGradeStudentVo.getPeriodStatus())&&classGradeStudentVo.getPeriodStatus()==1){
|
|
|
+ exportVo.setPeriodStatus("通过");
|
|
|
+ }else{
|
|
|
+ exportVo.setPeriodStatus("未通过");
|
|
|
+ }
|
|
|
+ if(Validator.isNotEmpty(classGradeStudentVo.getPeriodPlush())&&classGradeStudentVo.getPeriodPlush()==1){
|
|
|
+ exportVo.setPeriodPlush("是");
|
|
|
+ }else{
|
|
|
+ exportVo.setPeriodPlush("否");
|
|
|
+ }
|
|
|
+ eList.add(exportVo);
|
|
|
+ }
|
|
|
+ return eList;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean editUserGrade(ClassGradeUserAddQueryBo bo) {
|
|
@@ -1661,7 +1839,7 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
|
|
|
@Override
|
|
|
public List<ClassGradeVo> searchGradeList(ClassGradeQueryBo bo) {
|
|
|
List<ClassGradeVo> classGradeVos = entity2Vo(baseMapper.searchGradeList(bo));
|
|
|
- if (CollectionUtils.isEmpty(classGradeVos)) {
|
|
|
+ if (Validator.isEmpty(classGradeVos)||CollectionUtils.isEmpty(classGradeVos)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
classGradeVos.forEach(item -> {
|