Selaa lähdekoodia

add合作单位导入

周箭河 5 vuotta sitten
vanhempi
commit
36a81883fd

+ 38 - 22
edu-user/edu-user-biz/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -77,10 +77,23 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
             throw new BizException("项目不在报名中,请核对");
         }
 
+        if (examRegistration.getExamSubjectSongId() == null && examRegistration.getExamMusicTheoryId() == null) {
+            throw new BizException("专业级别或乐理必须其一");
+        }
+
         //考试级别信息
-        ExamSubjectSong examSubjectSong = examSubjectSongDao.get(examRegistration.getExamSubjectSongId());
-        if (examSubjectSong == null) {
-            throw new BizException("请选择专业级别");
+        ExamSubjectSong examSubjectSong = null;
+        Integer level = null;
+        BigDecimal amount = BigDecimal.ZERO;
+        BigDecimal registrationFee = BigDecimal.ZERO;
+        if (examRegistration.getExamSubjectSongId() != null) {
+            examSubjectSong = examSubjectSongDao.get(examRegistration.getExamSubjectSongId());
+            if (examSubjectSong == null) {
+                throw new BizException("您选择的专业级别不存在");
+            }
+            level = examSubjectSong.getLevel();
+            registrationFee = examSubjectSong.getRegistrationFee();
+            amount.add(registrationFee);
         }
 
         if (examRegistration.getOrganId() == null) {
@@ -97,8 +110,9 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         statusEnumList.add(StudentRegistrationStatusEnum.AUDIT_PASS);
         statusEnumList.add(StudentRegistrationStatusEnum.PAY_WAIT);
 
+
         ExamRegistration registration = examRegistrationDao.getRegistration(examinationBasic.getId(),
-                examRegistration.getStudentId(), examRegistration.getSubjectId(), examSubjectSong.getLevel(),
+                examRegistration.getStudentId(), examRegistration.getSubjectId(), level,
                 statusEnumList);
         if (registration != null) {
             throw new BizException("该考级相同专业及等级您已报名,请勿重复报名");
@@ -107,13 +121,15 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         Date nowDate = new Date();
         String orderNo = idGeneratorService.generatorId("payment") + "";
 
-        examRegistration.setLevel(examSubjectSong.getLevel());
-        BigDecimal amount = examSubjectSong.getRegistrationFee();
+        examRegistration.setLevel(level);
         //乐理考试级别
         ExamMusicTheory examMusicTheory = null;
         BigDecimal theoryLevelFee = BigDecimal.ZERO;
         if (examRegistration.getExamMusicTheoryId() != null) {
             examMusicTheory = examMusicTheoryDao.get(examRegistration.getExamMusicTheoryId());
+            if (examMusicTheory == null) {
+                throw new BizException("你选择的乐理级别不存在");
+            }
         }
         if (examMusicTheory != null) {
             theoryLevelFee = examMusicTheory.getFee();
@@ -123,7 +139,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
 
         examRegistration.setTenantId(organization.getTenantId());
         examRegistration.setStatus(StudentRegistrationStatusEnum.PAY_WAIT);
-        examRegistration.setLevelFee(examSubjectSong.getRegistrationFee());
+        examRegistration.setLevelFee(registrationFee);
         examRegistration.setTheoryLevelFee(theoryLevelFee);
         examRegistration.setCreateTime(nowDate);
         examRegistration.setUpdateTime(nowDate);
@@ -143,7 +159,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         examRegistrationPaymentService.insert(examRegistrationPayment);
 
         HashMap<String, Object> rpMap = new HashMap<>();
-        String baseApiUrl = sysConfigService.findConfigValue("base_api_url",examinationBasic.getTenantId());
+        String baseApiUrl = sysConfigService.findConfigValue("base_api_url", examinationBasic.getTenantId());
         Map<String, Object> payMap = payService.getPayMap(
                 amount,
                 orderNo,
@@ -197,7 +213,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
                 examRegistration.setOrganization(new Organization(examRegistration.getOrganId(), organIdNameMap.get(examRegistration.getOrganId())));
                 examRegistration.getSubject().setName(subjectIdNameMap.get(examRegistration.getSubjectId()));
                 examRegistration.getSysUser().setCertificatePhoto(idPhotoMap.get(examRegistration.getStudentId()));
-                examRegistration.setIsFinishedExam(Objects.isNull(registExamStatusMap.get(examRegistration.getId()))?3:registExamStatusMap.get(examRegistration.getId()));
+                examRegistration.setIsFinishedExam(Objects.isNull(registExamStatusMap.get(examRegistration.getId())) ? 3 : registExamStatusMap.get(examRegistration.getId()));
                 examRegistration.setExaminationBasic(new ExaminationBasic(examRegistration.getExaminationBasicId(), examIdNameMap.get(examRegistration.getExaminationBasicId())));
             }
         }
@@ -222,7 +238,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         Map<String, Object> params = new HashMap<String, Object>();
         MapUtil.populateMap(params, queryInfo);
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        params.put("studentId",sysUser.getId());
+        params.put("studentId", sysUser.getId());
 
         List<ExamRegistrationDto> dataList = null;
         int count = examRegistrationDao.countStudentList(params);
@@ -287,19 +303,19 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         er.setStatus(status);
         er.setMemo(memo);
 
-        SysConfig baseUrlConfig = sysConfigService.findByParamName(SysConfigService.BASE_H5_URL,er.getTenantId());
-        String baseUrl="";
-        if(Objects.nonNull(baseUrlConfig)){
-            baseUrl=baseUrlConfig.getParanValue();
+        SysConfig baseUrlConfig = sysConfigService.findByParamName(SysConfigService.BASE_H5_URL, er.getTenantId());
+        String baseUrl = "";
+        if (Objects.nonNull(baseUrlConfig)) {
+            baseUrl = baseUrlConfig.getParanValue();
         }
-        baseUrl = "1?" + baseUrl+"/#/appDetail?id=" + registId;
+        baseUrl = "1?" + baseUrl + "/#/appDetail?id=" + registId;
 
         Map<Integer, String> receiverMap = new HashMap<>(1);
         receiverMap.put(er.getStudentId(), er.getStudentId().toString());
-        if(StudentRegistrationStatusEnum.AUDIT_PASS.equals(er.getStatus())){
+        if (StudentRegistrationStatusEnum.AUDIT_PASS.equals(er.getStatus())) {
             sysMessageService.batchSendMessage(MessageTypeEnum.REGIST_PASS_PUSH,
                     receiverMap, null, 0, null, JiguangPushPlugin.PLUGIN_NAME);
-        }else if(StudentRegistrationStatusEnum.AUDIT_REJECT.equals(er.getStatus())){
+        } else if (StudentRegistrationStatusEnum.AUDIT_REJECT.equals(er.getStatus())) {
             sysMessageService.batchSendMessage(MessageTypeEnum.REGIST_REJECT_PUSH,
                     receiverMap, null, 0, baseUrl, JiguangPushPlugin.PLUGIN_NAME);
 
@@ -321,9 +337,9 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         if (Objects.isNull(er)) {
             throw new BizException("学员报名信息有误");
         }
-        if(er.getStudentId().equals(examRegistration.getStudentId())){
+        if (er.getStudentId().equals(examRegistration.getStudentId())) {
             examRegistration.setStatus(StudentRegistrationStatusEnum.AUDIT_WAIT);
-        }else{
+        } else {
             examRegistration.setStatus(null);
         }
         examRegistrationDao.update(examRegistration);
@@ -360,7 +376,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
             throw new BizException("项目不在报名中,请核对");
         }
         Map<String, Object> rpMap = new HashMap<>();
-        String baseApiUrl = sysConfigService.findConfigValue("base_api_url",examinationBasic.getTenantId());
+        String baseApiUrl = sysConfigService.findConfigValue("base_api_url", examinationBasic.getTenantId());
         Map<String, Object> payMap = payService.getPayMap(
                 order.getTransAmount(),
                 orderNo,
@@ -384,9 +400,9 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         Map<String, Object> params = new HashMap<>();
         MapUtil.populateMap(params, queryInfo);
         SysUser sysUser = sysUserFeignService.queryUserInfo();
-        params.put("studentId",sysUser.getId());
+        params.put("studentId", sysUser.getId());
         List<StudentBaseExamsDto> dataList = null;
-        params.put("paymentStatus",1);
+        params.put("paymentStatus", 1);
         int count = examRegistrationDao.countStudentBaseExams(params);
         if (count > 0) {
             pageInfo.setTotal(count);