|
@@ -1,5 +1,6 @@
|
|
|
package com.keao.edu.user.service.impl;
|
|
|
|
|
|
+import cfca.sadk.org.bouncycastle.apache.bzip2.BZip2Constants;
|
|
|
import com.keao.edu.auth.api.client.SysUserFeignService;
|
|
|
import com.keao.edu.auth.api.entity.SysUser;
|
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
@@ -247,21 +248,53 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
|
|
|
+ public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation,Integer selfOrganId) {
|
|
|
if(Objects.isNull(examOrganizationRelation.getId())){
|
|
|
throw new BizException("参数错误");
|
|
|
}
|
|
|
-
|
|
|
+ ExamOrganizationRelation organizationRelation = examOrganizationRelationDao.get(examOrganizationRelation.getId());
|
|
|
+ if(Objects.isNull(organizationRelation)){
|
|
|
+ throw new BizException("参数错误");
|
|
|
+ }
|
|
|
+ ExamOrganStatisticsDto selfOrgan = examOrganizationRelationDao.getExamOrganizationRelation(organizationRelation.getExaminationBasicId().longValue(), selfOrganId);
|
|
|
+ if(Objects.isNull(selfOrgan)){
|
|
|
+ throw new BizException("操作异常");
|
|
|
+ }
|
|
|
+ if(selfOrgan.getIsAllowArrangeExam()==0){
|
|
|
+ examOrganizationRelation.setIsAllowArrangeExam(0);
|
|
|
+ }
|
|
|
examOrganizationRelationDao.update(examOrganizationRelation);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void sendUrl(Integer examId) {
|
|
|
+ public void deleteExamOrgan(Long id) {
|
|
|
+ if(Objects.isNull(id)){
|
|
|
+ throw new BizException("参数错误");
|
|
|
+ }
|
|
|
+ ExamOrganizationRelation organizationRelation = examOrganizationRelationDao.get(id);
|
|
|
+ if(Objects.isNull(organizationRelation)){
|
|
|
+ throw new BizException("删除失败");
|
|
|
+ }
|
|
|
+ List<Integer> childOrganIds = organizationService.getChildOrganIds(organizationRelation.getOrganId(), true);
|
|
|
+ List<ExamOrganizationRelation> examOrganizationRelations = examOrganizationRelationDao.getExamOrganizationRelations(organizationRelation.getExaminationBasicId().longValue(), childOrganIds);
|
|
|
+ long count = examOrganizationRelations.stream().filter(e -> e.getSendUrlFlag() == 1).count();
|
|
|
+ if(count>0){
|
|
|
+ throw new BizException("删除失败");
|
|
|
+ }
|
|
|
+ examOrganizationRelationDao.deleteExamOrgans(organizationRelation.getExaminationBasicId().longValue(), childOrganIds);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void sendUrl(Integer examId, Integer selfOrganId) {
|
|
|
if(Objects.isNull(examId)){
|
|
|
throw new BizException("请指定考级项目");
|
|
|
}
|
|
|
- List<ExamOrganizationRelation> examOrgans = examOrganizationRelationDao.getWithExam(examId);
|
|
|
+
|
|
|
+ List<Integer> childOrganIds = organizationService.getChildOrganIds(selfOrganId, true);
|
|
|
+
|
|
|
+ List<ExamOrganizationRelation> examOrgans = examOrganizationRelationDao.getExamOrganizationRelations(examId.longValue(), childOrganIds);
|
|
|
Set<Integer> existOrganizationIds = examOrgans.stream().map(ExamOrganizationRelation::getOrganId).collect(Collectors.toSet());
|
|
|
|
|
|
ExaminationBasic examinationBasic = examinationBasicDao.get(examId.longValue());
|