Selaa lähdekoodia

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

zouxuan 5 vuotta sitten
vanhempi
commit
600f54ab9c

+ 5 - 5
edu-task/pom.xml

@@ -29,11 +29,6 @@
 		</dependency>
 
 		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-starter-data-redis</artifactId>
-		</dependency>
-
-		<dependency>
 			<groupId>org.mybatis.spring.boot</groupId>
 			<artifactId>mybatis-spring-boot-starter</artifactId>
 		</dependency>
@@ -42,6 +37,11 @@
 			<groupId>com.alibaba</groupId>
 			<artifactId>druid-spring-boot-starter</artifactId>
 		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
 
 		<dependency>
 			<groupId>com.spring4all</groupId>

+ 1 - 1
edu-task/src/main/java/com/keao/edu/task/TaskApplication.java

@@ -17,7 +17,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @SpringBootApplication
 @EnableDiscoveryClient
 @EnableFeignClients("com.keao.edu")
-@MapperScan("com.keao.edu.common.dal.dao")
+@MapperScan("com.keao.edu.task.dal.dao")
 @ComponentScan("com.keao.edu")
 @Configuration
 @EnableSwagger2Doc

+ 2 - 2
edu-task/src/main/resources/application.yml

@@ -27,8 +27,8 @@ spring:
 
   datasource:
     name: test
-    url: jdbc:mysql://47.114.1.200:3306/mec_dev?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai&allowMultiQueries=true
-    username: mec_dev
+    url: jdbc:mysql://47.114.176.40:3306/edu_saas?useUnicode=true&characterEncoding=UTF8&serverTimezone=Asia/Shanghai
+    username: edu_saas
     password: dayaDataOnline@2019
     # 使用druid数据源
     type: com.alibaba.druid.pool.DruidDataSource

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

+ 4 - 24
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamOrganizationRelationServiceImpl.java

@@ -149,31 +149,11 @@ public class ExamOrganizationRelationServiceImpl extends BaseServiceImpl<Long, E
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public void updateExamOrganizationRelation(ExamOrganizationRelation examOrganizationRelation) {
-		if(Objects.isNull(examOrganizationRelation.getExaminationBasicId())){
-			throw new BizException("请指定考级项目");
-		}
-		if(Objects.isNull(examOrganizationRelation.getOrganId())){
-			throw new BizException("请指定合作单位");
-		}
-		Organization organization = organizationService.get(examOrganizationRelation.getOrganId());
-		if(Objects.isNull(organization)){
-			throw new BizException("合作单位不存在");
-		}
-		examOrganizationRelation.setTenantId(TenantContextHolder.getTenantId().toString());
-		if(Objects.isNull(examOrganizationRelation.getSettlementType())){
-			examOrganizationRelation.setSettlementType(organization.getSettlementType());
-		}
-		if(Objects.isNull(organization.getShareProfitAmount())){
-			examOrganizationRelation.setShareProfitAmount(organization.getShareProfitAmount());
-		}
-		examOrganizationRelation.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());
-		examOrganizationRelation.setTotalPaymentAmount(BigDecimal.ZERO);
-		Set<Integer> organIds = examOrganizationRelationDao.getOrganIdsWithExam(examOrganizationRelation.getExaminationBasicId());
-		if(organIds.contains(examOrganizationRelation.getOrganId())){
-			examOrganizationRelationDao.update(examOrganizationRelation);
-		}else{
-			examOrganizationRelationDao.insert(examOrganizationRelation);
+		if(Objects.isNull(examOrganizationRelation.getId())){
+			throw new BizException("参数错误");
 		}
+
+		examOrganizationRelationDao.update(examOrganizationRelation);
 	}
 
 	@Override

+ 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>

+ 3 - 0
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}