Explorar el Código

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

zouxuan hace 5 años
padre
commit
118fb2f54e

+ 12 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamOrderController.java

@@ -189,6 +189,18 @@ public class ExamOrderController extends BaseController {
         return msg;
     }
 
+    @PostMapping(value = "orderSuccess")
+    public HttpResponseResult orderSuccess(String orderNo){
+        Map<String, String> notifyMap = new HashMap<>();
+        notifyMap.put("channelType", "Alipay");
+        notifyMap.put("memo", "手动回调");
+        notifyMap.put("transStatus", "SUCCESS");
+        notifyMap.put("orderNo", orderNo);
+        notifyMap.put("transNo", UUID.randomUUID().toString());
+        examRegistrationPaymentService.updateOrder(notifyMap);
+        return succeed();
+    }
+
     @ApiOperation(value = "关闭订单")
     @PostMapping("/closeOrder")
     public HttpResponseResult closeOrder(String orderNo){

+ 8 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamOrganizationRelationDao.java

@@ -106,4 +106,12 @@ public interface ExamOrganizationRelationDao extends BaseDAO<Long, ExamOrganizat
      */
     ExamOrganizationRelation getExamOrganizationRelation(@Param("examId") Long examId, @Param("OrganId") Integer OrganId);
 
+    /**
+     * 获取考级项目关联合作单位信息
+     * @param examId
+     * @param organIds
+     * @return
+     */
+    List<ExamOrganizationRelation> getExamOrganizationRelations(@Param("examId") Long examId, @Param("organIds") List<Integer> organIds);
+
 }

+ 15 - 9
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamRegistrationPaymentServiceImpl.java

@@ -26,7 +26,6 @@ import com.keao.edu.user.service.ExamRegistrationPaymentService;
 import com.keao.edu.user.service.ExamRegistrationService;
 import com.keao.edu.user.service.OrganizationService;
 import com.keao.edu.util.collection.MapUtil;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 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.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) {
             throw new BizException("报名人数报名金额更新失败");
         }
         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;
     }

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

@@ -322,5 +322,11 @@
     <select id="getExamOrganizationRelation" resultMap="ExamOrganizationRelation">
 		SELECT * FROM exam_organization_relation WHERE examination_basic_id_=#{examId} AND organ_id_=#{OrganId} FOR UPDATE
 	</select>
+	<select id="getExamOrganizationRelations" resultMap="ExamOrganizationRelation">
+		SELECT * FROM exam_organization_relation WHERE examination_basic_id_=#{examId} AND organ_id_ IN
+		<foreach collection="organIds" item="organId" separator="," open="(" close=")">
+			#{organId}
+		</foreach>
+	</select>
 
 </mapper>

+ 1 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -138,7 +138,6 @@
 
 	<sql id="queryCondition">
 		<where>
-			er.status_ != 'PAY_WAIT'
 			<if test="organIds!=null">
 				AND er.organ_id_ IN
 				<foreach collection="organIds" item="organId" separator="," open="(" close=")">
@@ -313,7 +312,7 @@
 
     <select id="getExamRegistrationStaticsInfo" resultMap="ExamRegistrationStatisticsDto">
 		SELECT
-			SUM( CASE WHEN er.organ_id_ = #{selfOrganId} THEN 1 ELSE 0 END ) totalRegistrationStudentNum,
+			COUNT( er.student_id_ ) totalRegistrationStudentNum,
 			SUM( CASE WHEN er.organ_id_ != #{selfOrganId} THEN 1 ELSE 0 END ) childOrganRegistrationStudentNum,
 			SUM( CASE WHEN er.status_ = 'AUDIT_WAIT' THEN 1 ELSE 0 END ) waitAuditStudentNum,
 			SUM( CASE WHEN er.status_ = 'REFUNDED' THEN 1 ELSE 0 END ) refundedStudentNum