wangbo 3 tahun lalu
induk
melakukan
a3694362c0

+ 3 - 0
readme.md

@@ -246,4 +246,7 @@ CREATE TABLE `uims_ver_manage` (
   PRIMARY KEY (`ID`)
 ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_croatian_ci COMMENT='APP版本表';
 
+
+
+
 =========已升级到正式环境20210527==================================================================================

+ 101 - 4
user_center/src/main/java/com/huaxu/controller/VerManageController.java

@@ -3,9 +3,11 @@ package com.huaxu.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.huaxu.entity.App;
+import com.huaxu.entity.UserEntity;
 import com.huaxu.entity.VerManageEntity;
 import com.huaxu.model.*;
 import com.huaxu.service.AppService;
+import com.huaxu.service.UserService;
 import com.huaxu.service.VerManageService;
 import com.huaxu.util.UserUtil;
 import io.swagger.annotations.Api;
@@ -13,12 +15,14 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
 
+import java.time.LocalDate;
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * app版本表控制层
@@ -36,6 +40,9 @@ public class VerManageController {
     @Autowired
     private VerManageService verManageService;
 
+    @Autowired
+    private UserService userService;
+
     /**
      * 查询app版本信息
      * @return 单条数据
@@ -45,4 +52,94 @@ public class VerManageController {
     public AjaxMessage<VerManageEntity> selectVer() {
         return new AjaxMessage<>(ResultStatus.OK, verManageService.selectVer());
     }
+
+    /**
+     * 查询app版本信息
+     * @return 单条数据
+     */
+    @RequestMapping(value = "findVerManage", method = RequestMethod.GET)
+    @ApiOperation(value = "查询app版本信息")
+    public AjaxMessage<List<VerManageEntity>> findVerManage(
+            @ApiParam(value = "版本ID", required = false) @RequestParam(required = false) String verId,
+            @ApiParam(value = "产品类型", required = false) @RequestParam(required = false) String productType) {
+        List<VerManageEntity> list = verManageService.findVerManage(verId,productType);
+        setName(list);
+        return new AjaxMessage<>(ResultStatus.OK, list);
+    }
+
+    /**
+     * 新增APP版本信息
+     */
+    @PostMapping(value = "addVerManage")
+    @ApiOperation(value = "新增版本管理")
+    public AjaxMessage<Object> addVerManage(
+            @ApiParam(value = "新增版本管理", required = true) @RequestBody VerManageEntity verManageEntity) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        verManageEntity.setCreateBy(loginUser.getId().toString());
+        verManageEntity.setStatus(1);
+        int result = verManageService.insertSelective(verManageEntity);
+        if(result>0){
+            return new AjaxMessage<>(ResultStatus.OK);
+        }
+        return new AjaxMessage<>(ResultStatus.ERROR);
+    }
+
+
+    /**
+     * 修改APP版本信息
+     */
+    @PostMapping(value = "updateVerManage")
+    @ApiOperation(value = "修改版本管理")
+    public AjaxMessage<Object> updateVerManage(
+            @ApiParam(value = "修改版本管理", required = true) @RequestBody VerManageEntity verManageEntity) {
+        LoginUser loginUser = UserUtil.getCurrentUser();
+        verManageEntity.setUpdateBy(loginUser.getId().toString());
+        int result = verManageService.updateByPrimaryKeySelective(verManageEntity);
+        if(result>0){
+            return new AjaxMessage<>(ResultStatus.OK);
+        }
+        return new AjaxMessage<>(ResultStatus.ERROR);
+    }
+
+
+    /**
+     * 获取并设置用户、任务工单类型名称
+     * @param result
+     */
+    private void setName(List<VerManageEntity> result){
+        if(result.size()>0){
+            try{
+                List<Integer> idList = new ArrayList<Integer>();
+                for(VerManageEntity verManageEntity:result) {
+                    try {
+                        if (verManageEntity.getCreateBy() != null) {
+                            idList.add(Integer.valueOf(verManageEntity.getCreateBy()));
+                        }
+                        if (verManageEntity.getUpdateBy() != null) {
+                            idList.add(Integer.valueOf(verManageEntity.getUpdateBy()));
+                        }
+                    }catch (Exception e){
+
+                    }
+                }
+                List<UserEntity> userEntityList=userService.findUserIdsByUserIds(idList);
+                Map<Long,String> userMap = userEntityList.stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getUsername));
+                Map<Long,String> userPhoneMap = userEntityList.stream().collect(Collectors.toMap(UserEntity::getId, UserEntity::getPhone));
+                for(int i = 0; i < result.size(); i++) {
+                    VerManageEntity verManage = result.get(i);
+                    try {
+                        if (verManage.getCreateBy() != null) {
+                            verManage.setCreateByName(userMap.get(Long.valueOf(verManage.getCreateBy())));
+                        }
+                        if (verManage.getUpdateBy() != null) {
+                            verManage.setUpdateByName(userMap.get(Long.valueOf(verManage.getUpdateBy())));
+                        }
+                    }catch (Exception e){
+                    }
+                }
+            }catch (Exception e){
+                e.printStackTrace();
+            }
+        }
+    }
 }

+ 0 - 1
user_center/src/main/java/com/huaxu/dao/UserTagMapper.java

@@ -27,7 +27,6 @@ public interface UserTagMapper extends BaseMapper<UserTagEntity> {
 
     UserTagEntity findUserTagById(Serializable id);
 
-
     List<UserTagEntity> findList(UserTagEntity userTagEntity);
 
     /**删除相关方法  使用mybatis-plus集成的 **/

+ 5 - 5
user_center/src/main/java/com/huaxu/dao/VerManageMapper.java

@@ -1,14 +1,9 @@
 package com.huaxu.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.huaxu.entity.UserEntity;
 import com.huaxu.entity.VerManageEntity;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
-
-import java.io.Serializable;
 import java.util.List;
 
 /**
@@ -20,4 +15,9 @@ import java.util.List;
 @Mapper
 public interface VerManageMapper extends BaseMapper<VerManageEntity> {
 
+    List<VerManageEntity> findVerManage(@Param("verId") String verId,@Param("productType") String productType);
+
+    int insertSelective(VerManageEntity verManageEntity);
+
+    int updateByPrimaryKeySelective(VerManageEntity verManageEntity);
 }

+ 32 - 3
user_center/src/main/java/com/huaxu/entity/VerManageEntity.java

@@ -2,15 +2,12 @@ package com.huaxu.entity;
 
 import com.baomidou.mybatisplus.annotation.*;
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.huaxu.model.ProgramItem;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
-import javax.validation.constraints.NotNull;
 import java.io.Serializable;
 import java.util.Date;
-import java.util.List;
 
 /**
  * uims_ver_manage
@@ -49,6 +46,10 @@ public class VerManageEntity implements Serializable {
     @ApiModelProperty(value = "创建者")
     private String createBy;
 
+    /** 创建者 */
+    @ApiModelProperty(value = "创建者")
+    private String createByName;
+
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     @ApiModelProperty(value = "创建时间")
@@ -58,8 +59,36 @@ public class VerManageEntity implements Serializable {
     @ApiModelProperty(value = "更新者")
     private String updateBy;
 
+    /** 更新者 */
+    @ApiModelProperty(value = "更新者")
+    private String updateByName;
+
     /** 更新时间 */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8")
     @ApiModelProperty(value = "更新时间")
     private Date dateUpdate;
+
+    /** 手机系统 */
+    @ApiModelProperty(value = "手机系统")
+    private String mobileOS;
+
+    /** 当前版本 */
+    @ApiModelProperty(value = "当前版本")
+    private String curAppVer;
+
+    /** 产品类型 */
+    @ApiModelProperty(value = "产品类型")
+    private String productType;
+
+    /** 强制升级版本 */
+    @ApiModelProperty(value = "强制升级版本")
+    private String forcedUpgradeVer;
+
+    /** 是否最新版本 */
+    @ApiModelProperty(value = "是否最新版本")
+    private Integer isNewestVer;
+
+    /** 状态 */
+    @ApiModelProperty(value = "状态")
+    private Integer status;
 }

+ 15 - 0
user_center/src/main/java/com/huaxu/service/VerManageService.java

@@ -17,6 +17,7 @@ import com.huaxu.model.LoginUser;
 import com.huaxu.util.ByteArrayUtils;
 import com.huaxu.util.RedisUtil;
 import com.huaxu.util.UserUtil;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -39,6 +40,8 @@ import java.util.stream.Collectors;
  */
 @Service
 public class VerManageService extends ServiceImpl<VerManageMapper, VerManageEntity> {
+	@Autowired
+	private VerManageMapper verManageMapper;
 
 	public VerManageEntity selectVer(){
 		VerManageEntity res=null;
@@ -48,4 +51,16 @@ public class VerManageService extends ServiceImpl<VerManageMapper, VerManageEnti
 		}
 		return res;
 	}
+
+	public List<VerManageEntity> findVerManage(String verId, String productType){
+		return verManageMapper.findVerManage(verId,productType);
+	}
+
+	public int insertSelective(VerManageEntity verManageEntity){
+		return verManageMapper.insertSelective(verManageEntity);
+	}
+
+	public int updateByPrimaryKeySelective(VerManageEntity verManageEntity){
+		return verManageMapper.updateByPrimaryKeySelective(verManageEntity);
+	}
 }

+ 0 - 2
user_center/src/main/resources/mapper/UserRoleMapper.xml

@@ -4,7 +4,6 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.huaxu.dao.UserRoleMapper">
 
-
     <resultMap type="UserRoleEntity" id="UserRoleResult">
         <result property="id" column="id"/>
         <result property="userId" column="user_id"/>
@@ -60,7 +59,6 @@
         SELECT
         <include refid="userRoleColumns"/>
         FROM uims_user_role a
-
         <where>
             a.status=1
             <if test="userRole.userId != null ">and a.user_id = #{userRole.userId}</if>

+ 185 - 0
user_center/src/main/resources/mapper/VerManageMapper.xml

@@ -0,0 +1,185 @@
+<?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.huaxu.dao.VerManageMapper">
+    <resultMap type="VerManageEntity" id="VerManageResult">
+        <result property="id"    column="id"    />
+        <result property="verId"    column="ver_id"    />
+        <result property="verUrl"    column="ver_url"    />
+        <result property="isForcedUpgrade"    column="is_forced_upgrade"    />
+        <result property="remark"    column="remark"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="dateCreate"    column="date_create"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="dateUpdate"    column="date_update"    />
+        <result property="mobileOS"    column="mobile_os"    />
+        <result property="curAppVer"    column="cur_app_ver"    />
+        <result property="productType"    column="product_type"    />
+        <result property="forcedUpgradeVer"    column="forced_upgrade_ver"    />
+        <result property="isNewestVer"    column="is_newest_ver"    />
+    </resultMap>
+
+    <!--  实体  -->
+    <sql id="verManageColumns">
+         a.id as "id" ,
+         a.ver_id as "verId" ,
+         a.ver_url as "verUrl" ,
+         a.is_forced_upgrade as "isForcedUpgrade" ,
+         a.remark as "remark" ,
+         a.date_create as "dateCreate" ,
+         a.date_update as "dateUpdate" ,
+         a.create_by as "createBy" ,
+         a.update_by as "updateBy" ,
+         a.mobile_os as "mobileOS" ,
+         a.cur_app_ver as "curAppVer" ,
+         a.product_type as "productType" ,
+         a.forced_upgrade_ver as "forcedUpgradeVer" ,
+         a.is_newest_ver as "isNewestVer"
+     </sql>
+
+    <!--  根据主键获取实体   -->
+    <select id="findVerManage" resultType="com.huaxu.entity.VerManageEntity">
+        SELECT
+        <include refid="verManageColumns"/>
+        FROM uims_ver_manage a
+        WHERE a.status=1
+        <if test="verId != null">
+            and a.ver_id like concat(concat('%',#{verId}) ,'%')
+        </if>
+        <if test="productType != null">
+            and a.product_type = #{productType}
+        </if>
+    </select>
+
+    <insert id="insertSelective" parameterType="com.huaxu.entity.VerManageEntity" >
+        insert into uims_ver_manage
+        <trim prefix="(" suffix=")" suffixOverrides="," >
+            <if test="verId != null" >
+                ver_id,
+            </if>
+            <if test="verUrl != null" >
+                ver_url,
+            </if>
+            <if test="isForcedUpgrade != null" >
+                is_forced_upgrade,
+            </if>
+            <if test="remark != null" >
+                remark,
+            </if>
+            <if test="dateUpdate != null" >
+                date_update,
+            </if>
+            <if test="createBy != null" >
+                create_by,
+            </if>
+            <if test="updateBy != null" >
+                update_by,
+            </if>
+            <if test="mobileOS != null" >
+                mobile_os,
+            </if>
+            <if test="curAppVer != null" >
+                cur_app_ver,
+            </if>
+            <if test="productType != null" >
+                product_type,
+            </if>
+            <if test="forcedUpgradeVer != null" >
+                forced_upgrade_ver,
+            </if>
+            <if test="isNewestVer != null" >
+                is_newest_ver,
+            </if>
+            <if test="status != null" >
+               status,
+            </if>
+            date_create,
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides="," >
+            <if test="verId != null" >
+                #{verId,jdbcType=VARCHAR},
+            </if>
+            <if test="verUrl != null" >
+                #{verUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="isForcedUpgrade != null" >
+                #{isForcedUpgrade,jdbcType=INTEGER},
+            </if>
+            <if test="remark != null" >
+                #{remark,jdbcType=VARCHAR},
+            </if>
+            <if test="dateUpdate != null" >
+                #{dateUpdate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="createBy != null" >
+                #{createBy,jdbcType=VARCHAR},
+            </if>
+            <if test="updateBy != null" >
+                #{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="mobileOS != null" >
+                #{mobileOS,jdbcType=VARCHAR},
+            </if>
+            <if test="curAppVer != null" >
+                #{curAppVer,jdbcType=VARCHAR},
+            </if>
+            <if test="productType != null" >
+                #{productType,jdbcType=VARCHAR},
+            </if>
+            <if test="forcedUpgradeVer != null" >
+                #{forcedUpgradeVer,jdbcType=VARCHAR},
+            </if>
+            <if test="isNewestVer != null" >
+                #{isNewestVer,jdbcType=INTEGER},
+            </if>
+            <if test="status != null" >
+                #{status,jdbcType=INTEGER},
+            </if>
+            SYSDATE(),
+        </trim>
+    </insert>
+
+    <update id="updateByPrimaryKeySelective" parameterType="com.huaxu.entity.VerManageEntity" >
+        update uims_ver_manage
+        <set >
+            <if test="verId != null" >
+                ver_id = #{verId,jdbcType=VARCHAR},
+            </if>
+            <if test="verUrl != null" >
+                ver_url = #{verUrl,jdbcType=VARCHAR},
+            </if>
+            <if test="isForcedUpgrade != null" >
+                is_forced_upgrade = #{isForcedUpgrade,jdbcType=INTEGER},
+            </if>
+            <if test="remark != null" >
+                remark = #{remark,jdbcType=VARCHAR},
+            </if>
+            <if test="dateUpdate != null" >
+                date_update = #{dateUpdate,jdbcType=TIMESTAMP},
+            </if>
+            <if test="updateBy != null" >
+                create_by = #{updateBy,jdbcType=VARCHAR},
+            </if>
+            <if test="mobileOS != null" >
+                mobile_os = #{mobileOS,jdbcType=VARCHAR},
+            </if>
+            <if test="curAppVer != null" >
+                cur_app_ver = #{curAppVer,jdbcType=VARCHAR},
+            </if>
+            <if test="productType != null" >
+                product_type = #{productType,jdbcType=VARCHAR},
+            </if>
+            <if test="forcedUpgradeVer != null" >
+                forced_upgrade_ver = #{forcedUpgradeVer,jdbcType=VARCHAR},
+            </if>
+            <if test="isNewestVer != null" >
+                is_newest_ver = #{isNewestVer,jdbcType=INTEGER},
+            </if>
+            <if test="status != null" >
+                status = #{status,jdbcType=INTEGER},
+            </if>
+        </set>
+        where id = #{id,jdbcType=INTEGER}
+    </update>
+</mapper>