|
@@ -15,6 +15,7 @@ import com.keao.edu.common.tenant.TenantContextHolder;
|
|
import com.keao.edu.thirdparty.message.MessageSenderPluginContext;
|
|
import com.keao.edu.thirdparty.message.MessageSenderPluginContext;
|
|
import com.keao.edu.user.dao.ExamOrganizationRelationDao;
|
|
import com.keao.edu.user.dao.ExamOrganizationRelationDao;
|
|
import com.keao.edu.user.dao.ExaminationBasicDao;
|
|
import com.keao.edu.user.dao.ExaminationBasicDao;
|
|
|
|
+import com.keao.edu.user.dao.OrganizationDao;
|
|
import com.keao.edu.user.dao.TeacherDao;
|
|
import com.keao.edu.user.dao.TeacherDao;
|
|
import com.keao.edu.user.entity.ExamOrganizationRelation;
|
|
import com.keao.edu.user.entity.ExamOrganizationRelation;
|
|
import com.keao.edu.user.entity.ExaminationBasic;
|
|
import com.keao.edu.user.entity.ExaminationBasic;
|
|
@@ -50,6 +51,8 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
@Autowired
|
|
@Autowired
|
|
private OrganizationService organizationService;
|
|
private OrganizationService organizationService;
|
|
@Autowired
|
|
@Autowired
|
|
|
|
+ private OrganizationDao organizationDao;
|
|
|
|
+ @Autowired
|
|
private ShortUrlService shortUrlService;
|
|
private ShortUrlService shortUrlService;
|
|
@Autowired
|
|
@Autowired
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
@@ -94,6 +97,42 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ public void addExamOrganizations(Integer examId, String orgainIdsStr) {
|
|
|
|
+ if(Objects.isNull(examId)){
|
|
|
|
+ throw new BizException("请指定考级项目");
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isBlank(orgainIdsStr)){
|
|
|
|
+ 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);
|
|
|
|
+ if(organs.size()!=organIds.size()){
|
|
|
|
+ throw new BizException("合作单位信息错误");
|
|
|
|
+ }
|
|
|
|
+ Map<Integer, Organization> idOrganMap = organs.stream().collect(Collectors.toMap(Organization::getId, o -> o));
|
|
|
|
+ List<ExamOrganizationRelation> organizationRelations=new ArrayList<>();
|
|
|
|
+ for (Integer organId : organIds) {
|
|
|
|
+ if(organIdsWithExam.contains(organId)){
|
|
|
|
+ throw new BizException("合作单位冲突");
|
|
|
|
+ }
|
|
|
|
+ ExamOrganizationRelation og = new ExamOrganizationRelation();
|
|
|
|
+ og.setTenantId(TenantContextHolder.getTenantId().toString());
|
|
|
|
+ og.setExaminationBasicId(examId);
|
|
|
|
+ Organization organization = idOrganMap.get(og.getOrganId());
|
|
|
|
+ if(Objects.isNull(organization)){
|
|
|
|
+ throw new BizException("合作单位不存在");
|
|
|
|
+ }
|
|
|
|
+ og.setSettlementType(organization.getSettlementType());
|
|
|
|
+ og.setShareProfitAmount(organization.getShareProfitAmount());
|
|
|
|
+ og.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());
|
|
|
|
+ og.setTotalPaymentAmount(BigDecimal.ZERO);
|
|
|
|
+ organizationRelations.add(og);
|
|
|
|
+ }
|
|
|
|
+ examOrganizationRelationDao.batchInsert(organizationRelations);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
|
|
public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
|
|
if(Objects.isNull(examOrganizationRelation.getExaminationBasicId())){
|
|
if(Objects.isNull(examOrganizationRelation.getExaminationBasicId())){
|