|  | @@ -26,7 +26,6 @@ import com.keao.edu.user.service.ExamRegistrationPaymentService;
 | 
											
												
													
														|  |  import com.keao.edu.user.service.ExamRegistrationService;
 |  |  import com.keao.edu.user.service.ExamRegistrationService;
 | 
											
												
													
														|  |  import com.keao.edu.user.service.OrganizationService;
 |  |  import com.keao.edu.user.service.OrganizationService;
 | 
											
												
													
														|  |  import com.keao.edu.util.collection.MapUtil;
 |  |  import com.keao.edu.util.collection.MapUtil;
 | 
											
												
													
														|  | -import org.apache.commons.lang3.StringUtils;
 |  | 
 | 
											
												
													
														|  |  import org.springframework.beans.factory.annotation.Autowired;
 |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
											
												
													
														|  |  import org.springframework.stereotype.Service;
 |  |  import org.springframework.stereotype.Service;
 | 
											
												
													
														|  |  import org.springframework.transaction.annotation.Isolation;
 |  |  import org.springframework.transaction.annotation.Isolation;
 | 
											
										
											
												
													
														|  | @@ -111,19 +110,26 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          //更新报名人数,和报名金额
 |  |          //更新报名人数,和报名金额
 | 
											
												
													
														|  |          ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRegistration.getExaminationBasicId(), examRegistration.getOrganId());
 |  |          ExamOrganizationRelation examOrganizationRelation = examOrganizationRelationDao.getExamOrganizationRelation(examRegistration.getExaminationBasicId(), examRegistration.getOrganId());
 | 
											
												
													
														|  | -        examOrganizationRelation.setTotalRegistrationStudentNum(examOrganizationRelation.getTotalRegistrationStudentNum() + 1);
 |  | 
 | 
											
												
													
														|  | -        BigDecimal amount = examOrganizationRelation.getTotalPaymentAmount().add(examRegistration.getLevelFee()).add(examRegistration.getTheoryLevelFee());
 |  | 
 | 
											
												
													
														|  | -        examOrganizationRelation.setTotalPaymentAmount(amount);
 |  | 
 | 
											
												
													
														|  | 
 |  | +        examOrganizationRelation.setSelfRegistrationStudentNum(examOrganizationRelation.getSelfRegistrationStudentNum() + 1);
 | 
											
												
													
														|  | 
 |  | +        BigDecimal amount = examOrganizationRelation.getSelfPaymentAmount().add(examRegistration.getLevelFee()).add(examRegistration.getTheoryLevelFee());
 | 
											
												
													
														|  | 
 |  | +        examOrganizationRelation.setSelfPaymentAmount(amount);
 | 
											
												
													
														|  |          if (examOrganizationRelationDao.update(examOrganizationRelation) <= 0) {
 |  |          if (examOrganizationRelationDao.update(examOrganizationRelation) <= 0) {
 | 
											
												
													
														|  |              throw new BizException("报名人数报名金额更新失败");
 |  |              throw new BizException("报名人数报名金额更新失败");
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |          Organization organization = organizationService.get(examRegistration.getOrganId());
 |  |          Organization organization = organizationService.get(examRegistration.getOrganId());
 | 
											
												
													
														|  | -        if(StringUtils.countMatches(organization.getParentOrganIdTag(), ",")<=0){
 |  | 
 | 
											
												
													
														|  | -            return order;
 |  | 
 | 
											
												
													
														|  | -        }
 |  | 
 | 
											
												
													
														|  | -        List<Integer> parentOrganIds = Arrays.stream(organization.getParentOrganIdTag().split(","))
 |  | 
 | 
											
												
													
														|  | -                .map(e -> Integer.valueOf(e)).filter(e -> !e.equals(organization.getId())).collect(Collectors.toList());
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +        List<Integer> parentOrganIds = Arrays.stream(organization.getParentOrganIdTag().split(","))
 | 
											
												
													
														|  | 
 |  | +                .map(e -> Integer.valueOf(e)).collect(Collectors.toList());
 | 
											
												
													
														|  | 
 |  | +        List<ExamOrganizationRelation> examOrgans = examOrganizationRelationDao.getExamOrganizationRelations(examRegistration.getExaminationBasicId(), parentOrganIds);
 | 
											
												
													
														|  | 
 |  | +        for (ExamOrganizationRelation examOrgan : examOrgans) {
 | 
											
												
													
														|  | 
 |  | +            examOrgan.setTotalRegistrationStudentNum(examOrgan.getTotalRegistrationStudentNum() + 1);
 | 
											
												
													
														|  | 
 |  | +            BigDecimal totalAmount = examOrgan.getTotalPaymentAmount().add(examRegistration.getLevelFee()).add(examRegistration.getTheoryLevelFee());
 | 
											
												
													
														|  | 
 |  | +            examOrgan.setTotalPaymentAmount(totalAmount);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        int updateNum = examOrganizationRelationDao.batchUpdate(examOrgans);
 | 
											
												
													
														|  | 
 |  | +        if(updateNum!=examOrgans.size()){
 | 
											
												
													
														|  | 
 |  | +            throw new BizException("总报名人数报名金额更新失败");
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |          return order;
 |  |          return order;
 | 
											
												
													
														|  |      }
 |  |      }
 |