Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/edu-saas

yonge 5 years ago
parent
commit
6fc19e5df7

+ 1 - 1
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/adapay/ConfigInit.java

@@ -38,7 +38,7 @@ public class ConfigInit {
         /**
          * prodMode 模式,默认为生产模式,false可以使用mock模式
          */
-        Adapay.prodMode = true;
+        Adapay.prodMode = false;
 
         /**
          *添加商户配置,一个商户只需要 添加一次,添加以后在内存中。

+ 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);
+
 }

+ 1 - 1
edu-user/edu-user-server/src/main/java/com/keao/edu/user/enums/TransStatusEnum.java

@@ -9,7 +9,7 @@ public enum TransStatusEnum implements BaseEnum<String, TransStatusEnum> {
     ING("ING", "交易中"),
     SUCCESS("SUCCESS", "交易成功"),
     FAILED("FAILED", "交易失败"),
-    CLOSE("REFUND", "交易关闭"),
+    CLOSE("CLOSE", "交易关闭"),
     REFUND("REFUND", "交易退款");
 
     private String code;

+ 14 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationPaymentServiceImpl.java

@@ -10,14 +10,17 @@ 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;
 import com.keao.edu.user.enums.TransStatusEnum;
 import com.keao.edu.user.page.ExamRegistrationPaymentQueryInfo;
 import com.keao.edu.user.page.ExamRegistrationQueryInfo;
+import com.keao.edu.user.service.ExamOrganizationRelationService;
 import com.keao.edu.user.service.ExamRegistrationPaymentService;
 import com.keao.edu.user.service.ExamRegistrationService;
 import com.keao.edu.user.service.OrganizationService;
@@ -26,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;
 
@@ -40,6 +44,8 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
     private YqPayFeignService yqPayFeignService;
     @Autowired
     private OrganizationService organizationService;
+    @Autowired
+    private ExamOrganizationRelationDao examOrganizationRelationDao;
 
     @Override
     public BaseDAO<Long, ExamRegistrationPayment> getDAO() {
@@ -95,6 +101,14 @@ public class ExamRegistrationPaymentServiceImpl extends BaseServiceImpl<Long, Ex
         if (examRegistrationService.update(examRegistration) <= 0) {
             throw new BizException("报名状态更新失败");
         }
+        //更新报名人数,和报名金额
+        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;
     }
 

+ 1 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationServiceImpl.java

@@ -290,6 +290,7 @@ public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegis
         orderNo = idGeneratorService.generatorId("payment") + "";
 
         order.setId(null);
+        order.setTransStatus(TransStatusEnum.ING);
         order.setOrderNo(orderNo);
         examRegistrationPaymentService.insert(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>

+ 4 - 1
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationPaymentMapper.xml

@@ -95,6 +95,9 @@
             <if test="transAmount != null">
                 trans_amount_ = #{transAmount},
             </if>
+            <if test="memo != null">
+                memo_ = #{memo},
+            </if>
             update_time_ = NOW()
         </set>
         WHERE id_ = #{id}
@@ -170,7 +173,7 @@
     <select id="getOrderInfo" resultMap="com.keao.edu.user.dao.StudentDao.queryApplyListMap">
         SELECT * FROM exam_registration_payment erp
         LEFT JOIN exam_registration er ON er.id_ = erp.exam_registration_id_
-        WHERE order_no_ = #{orderNo}
+        WHERE erp.order_no_ = #{orderNo}
     </select>
     <!-- 获取超时未支付的订单 -->
     <select id="findOrdersOverTime" resultMap="ExamRegistrationPayment">