Selaa lähdekoodia

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

zouxuan 5 vuotta sitten
vanhempi
commit
fc9cd23197

+ 72 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/controller/AppVersionInfoController.java

@@ -0,0 +1,72 @@
+package com.keao.edu.user.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiOperation;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import com.keao.edu.common.controller.BaseController;
+import com.keao.edu.common.page.QueryInfo;
+import com.keao.edu.user.entity.AppVersionInfo;
+import com.keao.edu.user.service.AppVersionInfoService;
+
+@RequestMapping("appVersionInfo")
+@Api(tags = "APP版本信息服务")
+@RestController
+public class AppVersionInfoController extends BaseController {
+
+	@Autowired
+	private AppVersionInfoService appVersionInfoService;
+
+	@ApiOperation("分页查询")
+	@GetMapping(value = "/list")
+	@PreAuthorize("@pcs.hasPermissions('appVersionInfo/list')")
+	public Object getList(QueryInfo queryInfo) {
+		return succeed(appVersionInfoService.queryPage(queryInfo));
+	}
+
+	@ApiOperation("根据app客户端查询对象")
+	@ApiImplicitParam(name = "platform", value = "平台名称", required = true, dataType = "String", paramType = "path")
+	@GetMapping(value = "/queryByPlatform")
+	public Object queryByPlatform(String platform) {
+		List<AppVersionInfo> list = appVersionInfoService.queryNewestByPlatform(platform);
+		if (list.size() > 0) {
+			return succeed(list.get(0));
+		}
+		return failed();
+	}
+
+	@ApiOperation("单查询")
+	@ApiImplicitParam(name = "id", value = "ID编号", required = true, dataType = "Integer", paramType = "path")
+	@GetMapping(value = "/query")
+	@PreAuthorize("@pcs.hasPermissions('appVersionInfo/query')")
+	public Object query(Integer id) {
+		return succeed(appVersionInfoService.get(id));
+	}
+
+	@ApiOperation("新增")
+	@PostMapping(value = "/add", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('appVersionInfo/add')")
+	public Object add(AppVersionInfo appVersionInfo) {
+		appVersionInfoService.add(appVersionInfo);
+		return succeed();
+	}
+
+	@ApiOperation("更新")
+	@PostMapping(value = "/update", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
+	@PreAuthorize("@pcs.hasPermissions('appVersionInfo/update')")
+	public Object update(AppVersionInfo appVersionInfo) {
+		appVersionInfoService.updateVersion(appVersionInfo);
+		return succeed();
+	}
+
+}

+ 17 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/dao/AppVersionInfoDao.java

@@ -0,0 +1,17 @@
+package com.keao.edu.user.dao;
+
+import java.util.List;
+
+import com.keao.edu.common.dal.BaseDAO;
+import com.keao.edu.user.entity.AppVersionInfo;
+
+public interface AppVersionInfoDao extends BaseDAO<Integer, AppVersionInfo> {
+
+	List<AppVersionInfo> queryNewestByPlatform(String platform);
+
+	/**
+	 * 修改所有的为历史
+	 * @param platform
+	 */
+	void batchUpdateStatus(String platform);
+}

+ 133 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/entity/AppVersionInfo.java

@@ -0,0 +1,133 @@
+package com.keao.edu.user.entity;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+/**
+ * 对应数据库表(app_version_info):
+ */
+public class AppVersionInfo {
+
+	/**  */
+	private Integer id;
+	
+	/** 平台(andorid/ios) */
+	private String platform;
+	
+	/** 版本号(以V开头) */
+	private String version;
+	
+	/** 状态(newest/history) */
+	private String status;
+	
+	/** 是否强制更新 */
+	private boolean isForceUpdate;
+	
+	/** 更新描述 */
+	private String description;
+	
+	/** 下载地址 */
+	private byte[] downloadUrl;
+	
+	/** 创建人 */
+	private Integer operatorId;
+	
+	/**  */
+	private java.util.Date updateTime;
+	
+	/**  */
+	private java.util.Date createTime;
+
+	public boolean isForceUpdate() {
+		return isForceUpdate;
+	}
+
+	public void setForceUpdate(boolean forceUpdate) {
+		isForceUpdate = forceUpdate;
+	}
+
+	public void setId(Integer id){
+		this.id = id;
+	}
+	
+	public Integer getId(){
+		return this.id;
+	}
+			
+	public void setPlatform(String platform){
+		this.platform = platform;
+	}
+	
+	public String getPlatform(){
+		return this.platform;
+	}
+			
+	public void setVersion(String version){
+		this.version = version;
+	}
+	
+	public String getVersion(){
+		return this.version;
+	}
+			
+	public void setStatus(String status){
+		this.status = status;
+	}
+	
+	public String getStatus(){
+		return this.status;
+	}
+			
+	public void setIsForceUpdate(boolean isForceUpdate){
+		this.isForceUpdate = isForceUpdate;
+	}
+	
+	public boolean getIsForceUpdate(){
+		return this.isForceUpdate;
+	}
+			
+	public void setDescription(String description){
+		this.description = description;
+	}
+	
+	public String getDescription(){
+		return this.description;
+	}
+			
+	public void setDownloadUrl(byte[] downloadUrl){
+		this.downloadUrl = downloadUrl;
+	}
+	
+	public byte[] getDownloadUrl(){
+		return this.downloadUrl;
+	}
+			
+	public void setOperatorId(Integer operatorId){
+		this.operatorId = operatorId;
+	}
+	
+	public Integer getOperatorId(){
+		return this.operatorId;
+	}
+			
+	public void setUpdateTime(java.util.Date updateTime){
+		this.updateTime = updateTime;
+	}
+	
+	public java.util.Date getUpdateTime(){
+		return this.updateTime;
+	}
+			
+	public void setCreateTime(java.util.Date createTime){
+		this.createTime = createTime;
+	}
+	
+	public java.util.Date getCreateTime(){
+		return this.createTime;
+	}
+			
+	@Override
+	public String toString() {
+		return ToStringBuilder.reflectionToString(this);
+	}
+
+}

+ 15 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/AppVersionInfoService.java

@@ -0,0 +1,15 @@
+package com.keao.edu.user.service;
+
+import java.util.List;
+
+import com.keao.edu.common.service.BaseService;
+import com.keao.edu.user.entity.AppVersionInfo;
+
+public interface AppVersionInfoService extends BaseService<Integer, AppVersionInfo> {
+
+	List<AppVersionInfo> queryNewestByPlatform(String platform);
+
+	void add(AppVersionInfo appVersionInfo);
+
+	void updateVersion(AppVersionInfo appVersionInfo);
+}

+ 59 - 0
edu-user/edu-user-server/src/main/java/com/keao/edu/user/service/impl/AppVersionInfoServiceImpl.java

@@ -0,0 +1,59 @@
+package com.keao.edu.user.service.impl;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+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.AppVersionInfoDao;
+import com.keao.edu.user.entity.AppVersionInfo;
+import com.keao.edu.user.service.AppVersionInfoService;
+
+@Service
+public class AppVersionInfoServiceImpl extends BaseServiceImpl<Integer, AppVersionInfo>  implements AppVersionInfoService {
+	
+	@Autowired
+	private AppVersionInfoDao appVersionInfoDao;
+
+	@Override
+	public BaseDAO<Integer, AppVersionInfo> getDAO() {
+		return appVersionInfoDao;
+	}
+
+	@Override
+	public List<AppVersionInfo> queryNewestByPlatform(String platform) {
+		return appVersionInfoDao.queryNewestByPlatform(platform);
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	public void add(AppVersionInfo appVersionInfo) {
+		if(StringUtils.isEmpty(appVersionInfo.getPlatform())){
+			throw new BizException("参数校验异常");
+		}
+		if (StringUtils.equals(appVersionInfo.getStatus(), "newest")) {
+			//修改其他的为历史版本
+			appVersionInfoDao.batchUpdateStatus(appVersionInfo.getPlatform());
+		}
+		appVersionInfoDao.insert(appVersionInfo);
+	}
+
+	@Override
+	public void updateVersion(AppVersionInfo appVersionInfo) {
+		if(StringUtils.isEmpty(appVersionInfo.getPlatform())){
+			throw new BizException("参数校验异常");
+		}
+		if (StringUtils.equals(appVersionInfo.getStatus(), "newest")) {
+			appVersionInfoDao.batchUpdateStatus(appVersionInfo.getPlatform());
+		}
+		appVersionInfo.setUpdateTime(new Date());
+		appVersionInfoDao.update(appVersionInfo);
+	}
+
+}

+ 111 - 0
edu-user/edu-user-server/src/main/resources/config/mybatis/AppVersionInfoMapper.xml

@@ -0,0 +1,111 @@
+<?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.AppVersionInfoDao">
+
+	<resultMap type="com.keao.edu.user.entity.AppVersionInfo" id="AppVersionInfo">
+		<result column="id_" property="id" />
+		<result column="platform_" property="platform" />
+		<result column="version_" property="version" />
+		<result column="status_" property="status" />
+		<result column="is_force_update_" property="isForceUpdate" />
+		<result column="description_" property="description" />
+		<result column="download_url_" property="downloadUrl" />
+		<result column="operator_id_" property="operatorId" />
+		<result column="update_time_" property="updateTime" />
+		<result column="create_time_" property="createTime" />
+	</resultMap>
+
+	<!-- 根据主键查询一条记录 -->
+	<select id="get" resultMap="AppVersionInfo">
+		SELECT * FROM
+		app_version_info WHERE id_ = #{id}
+	</select>
+	
+	<select id="queryNewestByPlatform" resultMap="AppVersionInfo">
+		SELECT * FROM app_version_info WHERE platform_ = #{platform} and status_ = 'newest'
+	</select>
+
+	<!-- 全查询 -->
+	<select id="findAll" resultMap="AppVersionInfo">
+		SELECT * FROM app_version_info
+		<where>
+			<if test="search != null and search != ''">
+				platform_ LIKE CONCAT('%',#{search},'%')
+			</if>
+		</where>
+		ORDER BY status_ DESC
+	</select>
+
+	<!-- 向数据库增加一条记录 -->
+	<insert id="insert" parameterType="com.keao.edu.user.entity.AppVersionInfo"
+		useGeneratedKeys="true" keyColumn="id" keyProperty="id">
+		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
+			AS ID FROM DUAL </selectKey> -->
+		INSERT INTO app_version_info
+		(id_,platform_,version_,status_,is_force_update_,description_,download_url_,operator_id_,update_time_,create_time_)
+		VALUES(#{id},#{platform},#{version},#{status},#{isForceUpdate},#{description},#{downloadUrl},#{operatorId},NOW(),NOW())
+	</insert>
+
+	<!-- 根据主键查询一条记录 -->
+	<update id="update" parameterType="com.keao.edu.user.entity.AppVersionInfo">
+		UPDATE app_version_info
+		<set>
+			<if test="operatorId != null">
+				operator_id_ = #{operatorId},
+			</if>
+			<if test="status != null">
+				status_ = #{status},
+			</if>
+			<if test="downloadUrl != null">
+				download_url_ = #{downloadUrl},
+			</if>
+			<if test="platform != null">
+				platform_ = #{platform},
+			</if>
+			<if test="updateTime != null">
+				update_time_ = #{updateTime},
+			</if>
+			<if test="version != null">
+				version_ = #{version},
+			</if>
+			<if test="description != null">
+				description_ = #{description},
+			</if>
+			<if test="isForceUpdate != null">
+				is_force_update_ = #{isForceUpdate},
+			</if>
+		</set>
+		WHERE id_ = #{id}
+	</update>
+	<update id="batchUpdateStatus">
+		UPDATE app_version_info SET status_ = 'history',update_time_ = NOW() WHERE platform_ = #{platform} AND status_ = 'newest'
+	</update>
+
+	<!-- 根据主键删除一条记录 -->
+	<delete id="delete">
+		DELETE FROM app_version_info WHERE id_ = #{id}
+	</delete>
+
+	<!-- 分页查询 -->
+	<select id="queryPage" resultMap="AppVersionInfo" parameterType="map">
+		SELECT * FROM app_version_info
+		<where>
+			<if test="search != null and search != ''">
+				platform_ LIKE CONCAT('%',#{search},'%')
+			</if>
+		</where>
+		ORDER BY status_ DESC
+		<include refid="global.limit" />
+	</select>
+
+	<!-- 查询当前表的总记录数 -->
+	<select id="queryCount" resultType="int">
+		SELECT COUNT(*) FROM app_version_info
+		<where>
+			<if test="search != null and search != ''">
+				platform_ LIKE CONCAT('%',#{search},'%')
+			</if>
+		</where>
+	</select>
+</mapper>

+ 6 - 2
edu-user/edu-user-server/src/main/resources/config/mybatis/ExamRegistrationPaymentMapper.xml

@@ -138,7 +138,7 @@
                 <![CDATA[AND erp.create_time_ <= #{endTime}]]>
             </if>
             <if test="examName!=null">
-                AND eb.name_=#{examName}
+                AND eb.name_ LIKE CONCAT('%', #{examName}, '%')
             </if>
             <if test="organIds!=null">
                 AND erp.organ_id_ IN
@@ -147,7 +147,7 @@
                 </foreach>
             </if>
             <if test="search!=null">
-                AND (ec.card_no_ LIKE CONCAT('%', #{serch}, '%'))
+                AND (erp.student_id_=#{serch} OR ec.card_no_ LIKE CONCAT('%', #{serch}, '%') OR su.real_name_ LIKE CONCAT('%', #{serch}, '%'))
             </if>
         </where>
     </sql>
@@ -166,6 +166,7 @@
         SELECT erp.*,eb.exam_location_id_list_,ec.card_no_ FROM exam_registration_payment erp
         LEFT JOIN exam_certification ec ON erp.exam_registration_id_ = ec.exam_registration_id_
         LEFT JOIN examination_basic eb ON erp.examination_basic_id_ = eb.id_
+        LEFT JOIN sys_user su ON erp.student_id_=su.id_
         <include refid="queryCondition"/>
         <include refid="global.limit"/>
     </select>
@@ -175,6 +176,7 @@
         SELECT COUNT(*) FROM exam_registration_payment erp
         LEFT JOIN exam_certification ec ON erp.exam_registration_id_ = ec.exam_registration_id_
         LEFT JOIN examination_basic eb ON erp.examination_basic_id_ = eb.id_
+        LEFT JOIN sys_user su ON erp.student_id_=su.id_
         <include refid="queryCondition"/>
     </select>
 
@@ -230,9 +232,11 @@
     <resultMap id="ExamRegistrationPaymentDto" type="com.keao.edu.user.dto.ExamRegistrationPaymentDto"
                extends="ExamRegistrationPayment">
         <result column="card_no_" property="cardNo"/>
+
         <association property="examRegistration"
                      select="com.keao.edu.user.dao.ExamRegistrationDao.getExamRegistrationInfo"
                      column="{id=exam_registration_id_}"/>
+
         <association property="examLocations" select="com.keao.edu.user.dao.ExamLocationDao.getExamLocationByIds"
                      column="{ids=exam_location_id_list_}"/>
     </resultMap>