Browse Source

增加报名列表信息

周箭河 5 năm trước cách đây
mục cha
commit
e951158d18

+ 31 - 19
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamOrganizationRelationDao.java

@@ -14,81 +14,93 @@ import java.util.Set;
 public interface ExamOrganizationRelationDao extends BaseDAO<Long, ExamOrganizationRelation> {
 
     /**
+     * @param examOrganizationRelations:
+     * @return int
      * @describe 批量插入考级项目与合作单位关联
      * @author Joburgess
      * @date 2020.06.18
-     * @param examOrganizationRelations:
-     * @return int
      */
     int batchInsert(@Param("examOrganizationRelations") List<ExamOrganizationRelation> examOrganizationRelations);
 
     /**
+     * @param examOrganizationRelations:
+     * @return int
      * @describe 批量更新
      * @author Joburgess
      * @date 2020.06.29
-     * @param examOrganizationRelations:
-     * @return int
      */
     int batchUpdate(@Param("examOrganizationRelations") List<ExamOrganizationRelation> examOrganizationRelations);
 
     /**
+     * @param examId:      考级项目编号
+     * @param organIds:    合作单位编号列表
+     * @param sendUrlFlag: 链接发送状态
+     * @return int
      * @describe 批量更新合作单位的链接发送状态
      * @author Joburgess
      * @date 2020.06.18
-     * @param examId: 考级项目编号
-     * @param organIds: 合作单位编号列表
-     * @param sendUrlFlag: 链接发送状态
-     * @return int
      */
     int batchUpdateSendUrlFlag(@Param("examId") Integer examId,
                                @Param("organIds") List<Integer> organIds,
-                               @Param("sendUrlFlag")YesOrNoEnum sendUrlFlag);
+                               @Param("sendUrlFlag") YesOrNoEnum sendUrlFlag);
 
     /**
+     * @param examId:
+     * @return com.keao.edu.user.entity.ExamOrganizationRelation
      * @describe 获取考级项目关联的合作单位
      * @author Joburgess
      * @date 2020.06.18
-     * @param examId:
-     * @return com.keao.edu.user.entity.ExamOrganizationRelation
      */
     List<ExamOrganizationRelation> getWithExam(@Param("examId") Integer examId);
 
     List<ExamOrganizationRelation> getWithExams(@Param("examIds") List<Integer> examIds);
 
     /**
+     * @param examId:
+     * @return java.util.Set<java.lang.Integer>
      * @describe 获取考级项目关联的合作单位编号
      * @author Joburgess
      * @date 2020.06.18
-     * @param examId:
-     * @return java.util.Set<java.lang.Integer>
      */
     Set<Integer> getOrganIdsWithExam(@Param("examId") Integer examId);
 
     /**
-     * @describe 统计指定考级项目与指定分布下的报名人数与累计收款
-     * @author Joburgess
-     * @date 2020.06.28
      * @param examId:
      * @param organIds:
      * @return java.util.List<com.keao.edu.user.entity.ExamOrganizationRelation>
+     * @describe 统计指定考级项目与指定分布下的报名人数与累计收款
+     * @author Joburgess
+     * @date 2020.06.28
      */
     List<ExamOrganizationRelation> countExamOrganStudentAndPayment(@Param("examId") Integer examId,
-                                                                       @Param("organIds") List<Integer> organIds);
+                                                                   @Param("organIds") List<Integer> organIds);
 
     /**
      * 是否有考试项目
+     *
      * @param organId
      * @return
      */
     Integer findByOrganId(@Param("organId") Integer organId);
 
     /**
+     * @param params:
+     * @return java.util.List<com.keao.edu.user.entity.Organization>
      * @describe 获取未关联到考级项目的合作单位
      * @author Joburgess
      * @date 2020.07.03
-     * @param params:
-     * @return java.util.List<com.keao.edu.user.entity.Organization>
      */
     List<Organization> queryUnRelatedOrgans(Map<String, Object> params);
+
     int countUnRelatedOrgans(Map<String, Object> params);
+
+    /**
+     * 获取考级项目关联合作单位信息
+     *
+     * @param examId
+     * @param OrganId
+     * @return
+     */
+    ExamOrganizationRelation getExamOrganizationRelation(@Param("examId") Integer examId, @Param("OrganId") Integer OrganId);
+
 }

+ 12 - 6
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationPaymentServiceImpl.java

@@ -10,8 +10,10 @@ import com.keao.edu.thirdparty.yqpay.Msg;
 import com.keao.edu.thirdparty.yqpay.RsqMsg;
 import com.keao.edu.thirdparty.yqpay.YqPayFeignService;
 import com.keao.edu.thirdparty.yqpay.YqPayUtil;
+import com.keao.edu.user.dao.ExamOrganizationRelationDao;
 import com.keao.edu.user.dao.ExamRegistrationPaymentDao;
 import com.keao.edu.user.dto.StudentExamPaymentDto;
+import com.keao.edu.user.entity.ExamOrganizationRelation;
 import com.keao.edu.user.entity.ExamRegistration;
 import com.keao.edu.user.entity.ExamRegistrationPayment;
 import com.keao.edu.user.enums.StudentRegistrationStatusEnum;
@@ -27,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -42,7 +45,7 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
     @Autowired
     private OrganizationService organizationService;
     @Autowired
-    private ExamOrganizationRelationService examOrganizationRelationService;
+    private ExamOrganizationRelationDao examOrganizationRelationDao;
 
     @Override
     public BaseDAO<Long, ExamRegistrationPayment> getDAO() {
@@ -98,11 +101,14 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
         if (examRegistrationService.update(examRegistration) <= 0) {
             throw new BizException("报名状态更新失败");
         }
-//        //更新报名人数,和报名金额
-//        examOrganizationRelationService.queryUnRelatedOrgans()
-//        if(examOrganizationRelationService.update() <= 0){
-//
-//        }
+        //更新报名人数,和报名金额
+        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);
+        if(examOrganizationRelationDao.update(examOrganizationRelation) <= 0){
+            throw new BizException("报名人数报名金额更新失败");
+        }
         return order;
     }
 

+ 5 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamOrganizationRelationMapper.xml

@@ -261,4 +261,9 @@
 		<include refid="queryUnRelatedOrgansCondition"/>
     </select>
 
+	<!-- 获取项目合作机构关联信息 -->
+    <select id="getExamOrganizationRelation" resultMap="ExamOrganizationRelation">
+		SELECT * FROM exam_organization_relation WHERE examination_basic_id_=#{examId} AND organ_id_=#{OrganId} FOR UPDATE
+	</select>
+
 </mapper>