Joburgess 5 năm trước cách đây
mục cha
commit
76cab67d01

+ 2 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/ExamAgencyRelationController.java

@@ -3,12 +3,14 @@ package com.keao.edu.user.controller;
 import com.keao.edu.common.controller.BaseController;
 import com.keao.edu.common.entity.HttpResponseResult;
 import com.keao.edu.common.page.PageInfo;
+import com.keao.edu.user.entity.Agency;
 import com.keao.edu.user.entity.ExamAgencyRelation;
 import com.keao.edu.user.page.ExamAgencyRelationQueryInfo;
 import com.keao.edu.user.service.ExamAgencyRelationService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 
 /**

+ 10 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/ExamRegistrationDao.java

@@ -0,0 +1,10 @@
+package com.keao.edu.user.dao;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.entity.ExamRegistration;
+
+public interface ExamRegistrationDao extends BaseDAO<Long, ExamRegistration> {
+
+	
+}

+ 37 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamAgencyRelation.java

@@ -5,6 +5,8 @@ import com.keao.edu.user.enums.YesOrNoEnum;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 
+import java.math.BigDecimal;
+
 /**
  * 对应数据库表(exam_agency_relation):
  */
@@ -12,6 +14,9 @@ public class ExamAgencyRelation {
 
 	private Long id;
 
+	@ApiModelProperty(value = "代理商基本信息")
+	private Agency agency;
+
 	@ApiModelProperty(value = "考试编号")
 	private Integer examinationBasicId;
 
@@ -24,6 +29,12 @@ public class ExamAgencyRelation {
 	@ApiModelProperty(value = "分润金额")
 	private java.math.BigDecimal shareProfitAmount;
 
+	@ApiModelProperty(value = "总报名人数")
+	private Integer totalRegistrationStudentNum;
+
+	@ApiModelProperty(value = "总缴费金额")
+	private BigDecimal totalPaymentAmount;
+
 	@ApiModelProperty(value = "链接地址")
 	private String url;
 
@@ -43,7 +54,15 @@ public class ExamAgencyRelation {
 	public Long getId(){
 		return this.id;
 	}
-			
+
+	public Agency getAgency() {
+		return agency;
+	}
+
+	public void setAgency(Agency agency) {
+		this.agency = agency;
+	}
+
 	public void setExaminationBasicId(Integer examinationBasicId){
 		this.examinationBasicId = examinationBasicId;
 	}
@@ -51,7 +70,23 @@ public class ExamAgencyRelation {
 	public Integer getExaminationBasicId(){
 		return this.examinationBasicId;
 	}
-			
+
+	public Integer getTotalRegistrationStudentNum() {
+		return totalRegistrationStudentNum;
+	}
+
+	public void setTotalRegistrationStudentNum(Integer totalRegistrationStudentNum) {
+		this.totalRegistrationStudentNum = totalRegistrationStudentNum;
+	}
+
+	public BigDecimal getTotalPaymentAmount() {
+		return totalPaymentAmount;
+	}
+
+	public void setTotalPaymentAmount(BigDecimal totalPaymentAmount) {
+		this.totalPaymentAmount = totalPaymentAmount;
+	}
+
 	public void setAgencyId(Integer agencyId){
 		this.agencyId = agencyId;
 	}

+ 169 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/ExamRegistration.java

@@ -0,0 +1,169 @@
+package com.keao.edu.user.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(exam_registration):
+ */
+public class ExamRegistration {
+
+	/**  */
+	private Long id;
+	
+	/** 考试项目 */
+	private Integer examinationBasicId;
+	
+	/** 学生 */
+	private Integer studentId;
+	
+	/** 代理商 */
+	private Integer agencyId;
+	
+	/** 专业 */
+	private Integer subjectId;
+	
+	/** 级别 */
+	private Integer level;
+	
+	/** 考试内容(json格式) */
+	private String songJson;
+	
+	/** 上次考试级别 */
+	private Integer lastExamLevel;
+	
+	/** 上次考试证书 */
+	private String lastExamCertificateUrl;
+	
+	/** 指导老师姓名 */
+	private String adviserName;
+	
+	/** 指导老师电话 */
+	private String adviserPhone;
+	
+	/**  */
+	private java.util.Date createTime;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	/**  */
+	private String tenantId;
+	
+	public void setId(Long id){
+		this.id = id;
+	}
+	
+	public Long getId(){
+		return this.id;
+	}
+			
+	public void setExaminationBasicId(Integer examinationBasicId){
+		this.examinationBasicId = examinationBasicId;
+	}
+	
+	public Integer getExaminationBasicId(){
+		return this.examinationBasicId;
+	}
+			
+	public void setStudentId(Integer studentId){
+		this.studentId = studentId;
+	}
+	
+	public Integer getStudentId(){
+		return this.studentId;
+	}
+			
+	public void setAgencyId(Integer agencyId){
+		this.agencyId = agencyId;
+	}
+	
+	public Integer getAgencyId(){
+		return this.agencyId;
+	}
+			
+	public void setSubjectId(Integer subjectId){
+		this.subjectId = subjectId;
+	}
+	
+	public Integer getSubjectId(){
+		return this.subjectId;
+	}
+			
+	public void setLevel(Integer level){
+		this.level = level;
+	}
+	
+	public Integer getLevel(){
+		return this.level;
+	}
+			
+	public void setSongJson(String songJson){
+		this.songJson = songJson;
+	}
+	
+	public String getSongJson(){
+		return this.songJson;
+	}
+			
+	public void setLastExamLevel(Integer lastExamLevel){
+		this.lastExamLevel = lastExamLevel;
+	}
+	
+	public Integer getLastExamLevel(){
+		return this.lastExamLevel;
+	}
+			
+	public void setLastExamCertificateUrl(String lastExamCertificateUrl){
+		this.lastExamCertificateUrl = lastExamCertificateUrl;
+	}
+	
+	public String getLastExamCertificateUrl(){
+		return this.lastExamCertificateUrl;
+	}
+			
+	public void setAdviserName(String adviserName){
+		this.adviserName = adviserName;
+	}
+	
+	public String getAdviserName(){
+		return this.adviserName;
+	}
+			
+	public void setAdviserPhone(String adviserPhone){
+		this.adviserPhone = adviserPhone;
+	}
+	
+	public String getAdviserPhone(){
+		return this.adviserPhone;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public void setTenantId(String tenantId){
+		this.tenantId = tenantId;
+	}
+	
+	public String getTenantId(){
+		return this.tenantId;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 2 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamAgencyRelationService.java

@@ -24,4 +24,6 @@ public interface ExamAgencyRelationService extends BaseService<Long, ExamAgencyR
      */
     void sendUrl(Integer examId, String agencyIds);
 
+
+
 }

+ 9 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/ExamRegistrationService.java

@@ -0,0 +1,9 @@
+package com.keao.edu.user.service;
+
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.ExamRegistration;
+
+public interface ExamRegistrationService extends BaseService<Long, ExamRegistration> {
+
+}

+ 5 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ExamAgencyRelationServiceImpl.java

@@ -1,7 +1,5 @@
 package com.keao.edu.user.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.keao.edu.common.dal.BaseDAO;
 import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
@@ -20,6 +18,7 @@ import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
+import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -46,6 +45,9 @@ public class ExamAgencyRelationServiceImpl extends BaseServiceImpl<Long, ExamAge
 			throw new BizException("请指定代理商");
 		}
 		examAgencyRelation.setTenantId(TenantContextHolder.getTenantId().toString());
+		examAgencyRelation.setShareProfitAmount(BigDecimal.ZERO);
+		examAgencyRelation.setTotalRegistrationStudentNum(BigDecimal.ZERO.intValue());
+		examAgencyRelation.setTotalPaymentAmount(BigDecimal.ZERO);
 		Set<Integer> agencyIds = examAgencyRelationDao.getAgencyIdsWithExam(examAgencyRelation.getExaminationBasicId());
 		if(agencyIds.contains(examAgencyRelation.getAgencyId())){
 			examAgencyRelationDao.update(examAgencyRelation);
@@ -76,6 +78,7 @@ public class ExamAgencyRelationServiceImpl extends BaseServiceImpl<Long, ExamAge
 			examAgencyRelation.setExaminationBasicId(examId);
 			examAgencyRelation.setAgencyId(agencyId);
 			examAgencyRelation.setSendUrlFlag(YesOrNoEnum.YES);
+			examAgencyRelation.setTenantId(TenantContextHolder.getTenantId().toString());
 			examAgencyRelations.add(examAgencyRelation);
 		}
 		ExaminationBasic examinationBasic = examinationBasicDao.get(examId.longValue());

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

@@ -0,0 +1,23 @@
+package com.keao.edu.user.service.impl;
+
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.common.service.impl.BaseServiceImpl;
+import com.keao.edu.user.dao.ExamRegistrationDao;
+import com.keao.edu.user.entity.ExamRegistration;
+import com.keao.edu.user.service.ExamRegistrationService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class ExamRegistrationServiceImpl extends BaseServiceImpl<Long, ExamRegistration> implements ExamRegistrationService {
+	
+	@Autowired
+	private ExamRegistrationDao examRegistrationDao;
+
+	@Override
+	public BaseDAO<Long, ExamRegistration> getDAO() {
+		return examRegistrationDao;
+	}
+	
+}

+ 1 - 2
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/ShortUrlServiceImpl.java

@@ -1,7 +1,6 @@
 package com.keao.edu.user.service.impl;
 
 import com.keao.edu.common.dal.BaseDAO;
-import com.keao.edu.common.exception.BizException;
 import com.keao.edu.common.service.impl.BaseServiceImpl;
 import com.keao.edu.user.dao.ShortUrlDao;
 import com.keao.edu.user.entity.ShortUrl;
@@ -26,7 +25,7 @@ public class ShortUrlServiceImpl extends BaseServiceImpl<Long, ShortUrl> impleme
 	@Transactional(rollbackFor = Exception.class)
 	public String createShortUrl(String sourceUrl) {
 		if(StringUtils.isBlank(sourceUrl)){
-			return null;
+			return sourceUrl;
 		}
 		ShortUrl shortUrl=new ShortUrl(sourceUrl);
 		shortUrlDao.insert(shortUrl);

+ 13 - 4
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamAgencyRelationMapper.xml

@@ -8,10 +8,13 @@
 	
 	<resultMap type="com.keao.edu.user.entity.ExamAgencyRelation" id="ExamAgencyRelation">
 		<result column="id_" property="id" />
+
 		<result column="examination_basic_id_" property="examinationBasicId" />
 		<result column="agency_id_" property="agencyId" />
 		<result column="settlement_type_" property="settlementType" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
 		<result column="share_profit_amount_" property="shareProfitAmount" />
+		<result column="total_registration_student_num_" property="totalRegistrationStudentNum"/>
+		<result column="total_payment_amount_" property="totalPaymentAmount"/>
 		<result column="url_" property="url" />
 		<result column="send_url_flag_" property="sendUrlFlag" typeHandler="com.keao.edu.common.dal.CustomEnumTypeHandler" />
 		<result column="create_time_" property="createTime" />
@@ -35,15 +38,15 @@
 	
 	<!-- 向数据库增加一条记录 -->
 	<insert id="insert" parameterType="com.keao.edu.user.entity.ExamAgencyRelation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO exam_agency_relation (examination_basic_id_,agency_id_,settlement_type_,share_profit_amount_,url_,send_url_flag_,create_time_,update_time_,tenant_id_)
-		VALUES(#{examinationBasicId},#{agencyId},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{shareProfitAmount},#{url},#{sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{tenantId})
+		INSERT INTO exam_agency_relation (examination_basic_id_,agency_id_,settlement_type_,share_profit_amount_,total_registration_student_num_,total_payment_amount_,url_,send_url_flag_,create_time_,update_time_,tenant_id_)
+		VALUES(#{examinationBasicId},#{agencyId},#{settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{shareProfitAmount},#{totalRegistrationStudentNum},#{totalPaymentAmount},#{url},#{sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{tenantId})
 	</insert>
 
     <insert id="batchInsert" parameterType="com.keao.edu.user.entity.ExamAgencyRelation" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
-		INSERT INTO exam_agency_relation (examination_basic_id_,agency_id_,settlement_type_,share_profit_amount_,url_,send_url_flag_,create_time_,update_time_,tenant_id_)
+		INSERT INTO exam_agency_relation (examination_basic_id_,agency_id_,settlement_type_,share_profit_amount_,total_registration_student_num_,total_payment_amount_,url_,send_url_flag_,create_time_,update_time_,tenant_id_)
 		VALUES
 		<foreach collection="examAgencyRelations" item="examAgencyRelation" separator=",">
-			(#{examAgencyRelation.examinationBasicId},#{examAgencyRelation.agencyId},#{examAgencyRelation.settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examAgencyRelation.shareProfitAmount},#{examAgencyRelation.url},#{examAgencyRelation.sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{examAgencyRelation.tenantId})
+			(#{examAgencyRelation.examinationBasicId},#{examAgencyRelation.agencyId},#{examAgencyRelation.settlementType,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},#{examAgencyRelation.shareProfitAmount},#{examAgencyRelation.totalRegistrationStudentNum},#{examAgencyRelation.totalPaymentAmount},#{examAgencyRelation.url},#{examAgencyRelation.sendUrlFlag,typeHandler=com.keao.edu.common.dal.CustomEnumTypeHandler},NOW(),NOW(),#{examAgencyRelation.tenantId})
 		</foreach>
 	</insert>
 
@@ -72,6 +75,12 @@
 			<if test="shareProfitAmount != null">
 			share_profit_amount_ = #{shareProfitAmount},
 			</if>
+			<if test="totalRegistrationStudentNum != null">
+				total_registration_student_num_ = #{totalRegistrationStudentNum},
+			</if>
+			<if test="totalPaymentAmount != null">
+				total_payment_amount_ = #{totalPaymentAmount},
+			</if>
 			<if test="agencyId != null">
 			agency_id_ = #{agencyId},
 			</if>

+ 105 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationMapper.xml

@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+这个文件是自动生成的。
+不要修改此文件。所有改动将在下次重新自动生成时丢失。
+-->
+<mapper namespace="com.keao.edu.user.dao.ExamRegistrationDao">
+	
+	<resultMap type="com.keao.edu.user.entity.ExamRegistration" id="ExamRegistration">
+		<result column="id_" property="id" />
+		<result column="examination_basic_id_" property="examinationBasicId" />
+		<result column="student_id_" property="studentId" />
+		<result column="agency_id_" property="agencyId" />
+		<result column="subject_id_" property="subjectId" />
+		<result column="level_" property="level" />
+		<result column="song_json_" property="songJson" />
+		<result column="last_exam_level_" property="lastExamLevel" />
+		<result column="last_exam_certificate_url_" property="lastExamCertificateUrl" />
+		<result column="adviser_name_" property="adviserName" />
+		<result column="adviser_phone_" property="adviserPhone" />
+		<result column="create_time_" property="createTime" />
+		<result column="update_time_" property="updateTime" />
+		<result column="tenant_id_" property="tenantId" />
+	</resultMap>
+	
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="ExamRegistration" >
+		SELECT * FROM exam_registration WHERE id_ = #{id} 
+	</select>
+	
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="ExamRegistration">
+		SELECT * FROM exam_registration ORDER BY id_
+	</select>
+	
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.keao.edu.user.entity.ExamRegistration" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!--
+		<selectKey resultClass="int" keyProperty="id" > 
+		SELECT SEQ_WSDEFINITION_ID.nextval AS ID FROM DUAL 
+		</selectKey>
+		-->
+		INSERT INTO exam_registration (id_,examination_basic_id_,student_id_,agency_id_,subject_id_,level_,song_json_,last_exam_level_,last_exam_certificate_url_,adviser_name_,adviser_phone_,create_time_,update_time_,tenant_id_)
+		VALUES(#{id},#{examinationBasicId},#{studentId},#{agencyId},#{subjectId},#{level},#{songJson},#{lastExamLevel},#{lastExamCertificateUrl},#{adviserName},#{adviserPhone},NOW(), NOW(),#{tenantId})
+	</insert>
+	
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.keao.edu.user.entity.ExamRegistration">
+		UPDATE exam_registration
+		<set>
+			<if test="examinationBasicId != null">
+			examination_basic_id_ = #{examinationBasicId},
+			</if>
+			<if test="subjectId != null">
+			subject_id_ = #{subjectId},
+			</if>
+			<if test="adviserPhone != null">
+			adviser_phone_ = #{adviserPhone},
+			</if>
+			<if test="lastExamLevel != null">
+			last_exam_level_ = #{lastExamLevel},
+			</if>
+			<if test="id != null">
+			id_ = #{id},
+			</if>
+			<if test="tenantId != null">
+			tenant_id_ = #{tenantId},
+			</if>
+			<if test="level != null">
+			level_ = #{level},
+			</if>
+			<if test="agencyId != null">
+			agency_id_ = #{agencyId},
+			</if>
+			<if test="songJson != null">
+			song_json_ = #{songJson},
+			</if>
+			<if test="adviserName != null">
+			adviser_name_ = #{adviserName},
+			</if>
+			<if test="studentId != null">
+			student_id_ = #{studentId},
+			</if>
+			<if test="lastExamCertificateUrl != null">
+			last_exam_certificate_url_ = #{lastExamCertificateUrl},
+			</if>
+				update_time_ = NOW()
+		</set> WHERE id_ = #{id}
+	</update>
+	
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete" >
+		DELETE FROM exam_registration WHERE id_ = #{id} 
+	</delete>
+	
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="ExamRegistration" parameterType="map">
+		SELECT * FROM exam_registration ORDER BY id_ <include refid="global.limit"/>
+	</select>
+	
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM exam_registration
+	</select>
+</mapper>