|
@@ -61,6 +61,8 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
|
@Autowired
|
|
|
private SysConfigService sysConfigService;
|
|
|
|
|
|
+ public static final Set<ExamStatusEnum> EDIT_ABLE_EXAM_STATUS=new HashSet<>(Arrays.asList(ExamStatusEnum.SETTING,ExamStatusEnum.NOT_START,ExamStatusEnum.APPLYING));
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<Long, ExamOrganizationRelation> getDAO() {
|
|
|
return examOrganizationRelationDao;
|
|
@@ -97,6 +99,7 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void addExamOrganizations(Integer examId, String orgainIdsStr) {
|
|
|
if(Objects.isNull(examId)){
|
|
|
throw new BizException("请指定考级项目");
|
|
@@ -104,6 +107,14 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
|
if(StringUtils.isBlank(orgainIdsStr)){
|
|
|
throw new BizException("请指定合作单位");
|
|
|
}
|
|
|
+ ExaminationBasic examinationBasic = examinationBasicDao.get(examId.longValue());
|
|
|
+ if(Objects.isNull(examinationBasic)){
|
|
|
+ throw new BizException("考级项目不存在");
|
|
|
+ }
|
|
|
+ if(!EDIT_ABLE_EXAM_STATUS.contains(examinationBasic.getStatus())){
|
|
|
+ throw new BizException("当前状态暂不可添加合作单位");
|
|
|
+ }
|
|
|
+
|
|
|
Set<Integer> organIdsWithExam = examOrganizationRelationDao.getOrganIdsWithExam(examId);
|
|
|
List<Integer> organIds = Arrays.stream(orgainIdsStr.split(",")).map(e -> Integer.valueOf(e)).collect(Collectors.toList());
|
|
|
List<Organization> organs = organizationDao.getOrgans(organIds);
|
|
@@ -119,10 +130,13 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
|
ExamOrganizationRelation og = new ExamOrganizationRelation();
|
|
|
og.setTenantId(TenantContextHolder.getTenantId().toString());
|
|
|
og.setExaminationBasicId(examId);
|
|
|
- Organization organization = idOrganMap.get(og.getOrganId());
|
|
|
+ og.setOrganId(organId);
|
|
|
+ Organization organization = idOrganMap.get(organId);
|
|
|
if(Objects.isNull(organization)){
|
|
|
- throw new BizException("合作单位不存在");
|
|
|
+ throw new BizException("合作单位信息错误");
|
|
|
}
|
|
|
+ og.setSendUrlFlag(YesOrNoEnum.NO);
|
|
|
+ og.setIsAllowArrangeExam(organization.getIsAllowArrangeExam());
|
|
|
og.setSettlementType(organization.getSettlementType());
|
|
|
og.setShareProfitAmount(organization.getShareProfitAmount());
|
|
|
og.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());
|