Explorar o código

APP热更新,BUG修改

LIVE_YE hai 1 ano
pai
achega
8860f49a46

+ 1 - 1
ruoyi-admin/pom.xml

@@ -9,7 +9,7 @@
     </parent>
     <modelVersion>4.0.0</modelVersion>
     <packaging>jar</packaging>
-    <artifactId>ruoyi-admin</artifactId>
+    <artifactId>zhengxie</artifactId>
 
     <description>
         web服务入口

+ 100 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/UpdateAppController.java

@@ -0,0 +1,100 @@
+package com.ruoyi.web.controller.system;
+
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.domain.UpdateApp;
+import com.ruoyi.system.service.IUpdateAppService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Controller
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+@RestController
+@RequestMapping("/system/app")
+public class UpdateAppController extends BaseController
+{
+    @Autowired
+    private IUpdateAppService updateAppService;
+
+    /**
+     * 查询【请填写功能名称】列表
+     */
+    @GetMapping("/list")
+    public TableDataInfo list(UpdateApp updateApp)
+    {
+        startPage();
+        List<UpdateApp> list = updateAppService.selectUpdateAppList(updateApp);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出【请填写功能名称】列表
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, UpdateApp updateApp)
+    {
+        List<UpdateApp> list = updateAppService.selectUpdateAppList(updateApp);
+        ExcelUtil<UpdateApp> util = new ExcelUtil<UpdateApp>(UpdateApp.class);
+        util.exportExcel(response, list, "【请填写功能名称】数据");
+    }
+
+    /**
+     * 获取【请填写功能名称】详细信息
+     */
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(updateAppService.selectUpdateAppById(id));
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody UpdateApp updateApp)
+    {
+        return toAjax(updateAppService.insertUpdateApp(updateApp));
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody UpdateApp updateApp)
+    {
+        return toAjax(updateAppService.updateUpdateApp(updateApp));
+    }
+
+    /**
+     * 删除【请填写功能名称】
+     */
+    @Log(title = "【请填写功能名称】", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(updateAppService.deleteUpdateAppByIds(ids));
+    }
+
+    /**
+     * 获取当前最新版本数据
+     */
+    @GetMapping(value = "/new")
+    public AjaxResult getInfoNew(UpdateApp updateApp)
+    {
+        return success(updateAppService.getInfoNew(updateApp));
+    }
+}

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -20,7 +20,7 @@ spring:
     basename: i18n/messages
   profiles:
     active: druid
-  #    active: prod
+    #active: prod
   # 文件上传
   servlet:
     multipart:

+ 3 - 1
ruoyi-common/src/main/java/com/ruoyi/common/utils/file/MimeTypeUtils.java

@@ -36,7 +36,9 @@ public class MimeTypeUtils
             // 视频格式
             "mp4", "avi", "rmvb",
             // pdf
-            "pdf" };
+            "pdf" ,
+            //app
+            "wgt","apk"};
 
     public static String getExtension(String prefix)
     {

+ 1 - 1
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java

@@ -111,7 +111,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/login", "/register", "/captchaImage").permitAll()
+                .antMatchers("/login", "/register", "/captchaImage","/system/app/new").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()

+ 122 - 0
ruoyi-system/src/main/java/com/ruoyi/system/domain/UpdateApp.java

@@ -0,0 +1,122 @@
+package com.ruoyi.system.domain;
+
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 【请填写功能名称】对象 update_app
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+public class UpdateApp extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /**  */
+    private Long id;
+
+    /** 系统:Android:安卓系统,Apple:苹果系统 */
+    @Excel(name = "系统:Android:安卓系统,Apple:苹果系统")
+    private String model;
+
+    /** 版本名称 */
+    @Excel(name = "版本名称")
+    private String name;
+
+    /** 版本号 */
+    @Excel(name = "版本号")
+    private String code;
+
+    /** 版本描述 */
+    @Excel(name = "版本描述")
+    private String description;
+
+    /** 下载地址 */
+    @Excel(name = "下载地址")
+    private String path;
+
+    /** 是否有效 0:失效 1:有效 */
+    @Excel(name = "是否有效 0:失效 1:有效")
+    private String isDel;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setModel(String model) 
+    {
+        this.model = model;
+    }
+
+    public String getModel() 
+    {
+        return model;
+    }
+    public void setName(String name) 
+    {
+        this.name = name;
+    }
+
+    public String getName() 
+    {
+        return name;
+    }
+    public void setCode(String code) 
+    {
+        this.code = code;
+    }
+
+    public String getCode() 
+    {
+        return code;
+    }
+    public void setDescription(String description) 
+    {
+        this.description = description;
+    }
+
+    public String getDescription() 
+    {
+        return description;
+    }
+    public void setPath(String path) 
+    {
+        this.path = path;
+    }
+
+    public String getPath() 
+    {
+        return path;
+    }
+    public void setIsDel(String isDel) 
+    {
+        this.isDel = isDel;
+    }
+
+    public String getIsDel() 
+    {
+        return isDel;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("model", getModel())
+            .append("name", getName())
+            .append("code", getCode())
+            .append("description", getDescription())
+            .append("path", getPath())
+            .append("isDel", getIsDel())
+            .append("createTime", getCreateTime())
+            .toString();
+    }
+}

+ 66 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UpdateAppMapper.java

@@ -0,0 +1,66 @@
+package com.ruoyi.system.mapper;
+
+import com.ruoyi.system.domain.UpdateApp;
+
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+public interface UpdateAppMapper 
+{
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public UpdateApp selectUpdateAppById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<UpdateApp> selectUpdateAppList(UpdateApp updateApp);
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 删除【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteUpdateAppById(Long id);
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteUpdateAppByIds(Long[] ids);
+
+    UpdateApp getInfo(UpdateApp updateApp);
+
+    void updateUpdateAppAll(UpdateApp update);
+}

+ 3 - 0
ruoyi-system/src/main/java/com/ruoyi/system/mapper/ZxFjMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.ruoyi.system.domain.ProposalInfo;
 import com.ruoyi.system.domain.ZxFj;
+import org.apache.ibatis.annotations.Param;
 
 /**
  * 政协_附件Mapper接口
@@ -69,4 +70,6 @@ public interface ZxFjMapper
      * @return
      */
     int batchZxFj(List<ZxFj> zxFjList);
+
+    void deleteZxFj(@Param("sourceId") Long sourceId, @Param("mainId")Long mainId, @Param("type")String type, @Param("stytle")String stytle);
 }

+ 64 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IUpdateAppService.java

@@ -0,0 +1,64 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.system.domain.UpdateApp;
+
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+public interface IUpdateAppService 
+{
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    public UpdateApp selectUpdateAppById(Long id);
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 【请填写功能名称】集合
+     */
+    public List<UpdateApp> selectUpdateAppList(UpdateApp updateApp);
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int insertUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    public int updateUpdateApp(UpdateApp updateApp);
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param ids 需要删除的【请填写功能名称】主键集合
+     * @return 结果
+     */
+    public int deleteUpdateAppByIds(Long[] ids);
+
+    /**
+     * 删除【请填写功能名称】信息
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    public int deleteUpdateAppById(Long id);
+
+    UpdateApp getInfoNew(UpdateApp updateApp);
+}

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProposalInfoServiceImpl.java

@@ -57,11 +57,12 @@ public class ProposalInfoServiceImpl implements IProposalInfoService
         //查询附件
         ZxFj zxFj = new ZxFj();
         zxFj.setMainId(proposalId);
+        zxFj.setType("1");
         List<ZxFj> zxFjList = zxFjMapper.selectZxFjList(zxFj);
         List<ZxFj> fjList = new ArrayList<>();
         if(zxFjList!=null && zxFjList.size()>0){
             for (ZxFj fj : zxFjList) {
-                if(proposalId == fj.getSourceId()){
+                if("4".equals(fj.getStytle())){
                     fjList.add(fj);
                 }
             }

+ 2 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/ProposalUnitReplyServiceImpl.java

@@ -135,6 +135,8 @@ public class ProposalUnitReplyServiceImpl implements IProposalUnitReplyService
         }
 
         if(proposalUnitReply.getZxFjList()!=null && proposalUnitReply.getZxFjList().size()>0){
+            //删除附件
+            zxFjMapper.deleteZxFj(list.get(0).getId(),proposalUnitReply.getProposalId(),"1",list.get(0).getType());
             for (ZxFj zxFj : proposalUnitReply.getZxFjList()) {
                 zxFj.setMainId(proposalUnitReply.getProposalId());
                 zxFj.setSourceId(list.get(0).getId());

+ 2 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SqmyInfoServiceImpl.java

@@ -52,11 +52,12 @@ public class SqmyInfoServiceImpl implements ISqmyInfoService
         //查询附件
         ZxFj zxFj = new ZxFj();
         zxFj.setMainId(sqmyId);
+        zxFj.setType("2");
         List<ZxFj> zxFjList = zxFjMapper.selectZxFjList(zxFj);
         List<ZxFj> fjList = new ArrayList<>();
         if(zxFjList!=null && zxFjList.size()>0){
             for (ZxFj fj : zxFjList) {
-                if(sqmyId == fj.getSourceId()){
+                if("4".equals(fj.getStytle())){
                     fjList.add(fj);
                 }
             }

+ 3 - 1
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SqmyUnitReplyServiceImpl.java

@@ -131,10 +131,12 @@ public class SqmyUnitReplyServiceImpl implements ISqmyUnitReplyService
         }
 
         if(sqmyUnitReply.getZxFjList()!=null && sqmyUnitReply.getZxFjList().size()>0){
+            //删除附件
+            zxFjMapper.deleteZxFj(list.get(0).getId(),sqmyUnitReply.getSqmyId(),"2",list.get(0).getType());
             for (ZxFj zxFj : sqmyUnitReply.getZxFjList()) {
                 zxFj.setMainId(sqmyUnitReply.getSqmyId());
                 zxFj.setSourceId(list.get(0).getId());
-                zxFj.setType("1");
+                zxFj.setType("2");
                 zxFj.setStytle(list.get(0).getType());
                 zxFjMapper.insertZxFj(zxFj);
             }

+ 110 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UpdateAppServiceImpl.java

@@ -0,0 +1,110 @@
+package com.ruoyi.system.service.impl;
+
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.system.domain.UpdateApp;
+import com.ruoyi.system.mapper.UpdateAppMapper;
+import com.ruoyi.system.service.IUpdateAppService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ * 
+ * @author ruoyi
+ * @date 2023-02-16
+ */
+@Service
+public class UpdateAppServiceImpl implements IUpdateAppService 
+{
+    @Autowired
+    private UpdateAppMapper updateAppMapper;
+
+    /**
+     * 查询【请填写功能名称】
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public UpdateApp selectUpdateAppById(Long id)
+    {
+        return updateAppMapper.selectUpdateAppById(id);
+    }
+
+    /**
+     * 查询【请填写功能名称】列表
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 【请填写功能名称】
+     */
+    @Override
+    public List<UpdateApp> selectUpdateAppList(UpdateApp updateApp)
+    {
+        return updateAppMapper.selectUpdateAppList(updateApp);
+    }
+
+    /**
+     * 新增【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public int insertUpdateApp(UpdateApp updateApp)
+    {
+        //将之前的数据全改为失效
+        UpdateApp update = new UpdateApp();
+        update.setIsDel("0");
+        update.setModel(updateApp.getModel());
+        updateAppMapper.updateUpdateAppAll(update);
+        //保存当前数据
+        updateApp.setCreateTime(DateUtils.getNowDate());
+        return updateAppMapper.insertUpdateApp(updateApp);
+    }
+
+    /**
+     * 修改【请填写功能名称】
+     * 
+     * @param updateApp 【请填写功能名称】
+     * @return 结果
+     */
+    @Override
+    public int updateUpdateApp(UpdateApp updateApp)
+    {
+        return updateAppMapper.updateUpdateApp(updateApp);
+    }
+
+    /**
+     * 批量删除【请填写功能名称】
+     * 
+     * @param ids 需要删除的【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteUpdateAppByIds(Long[] ids)
+    {
+        return updateAppMapper.deleteUpdateAppByIds(ids);
+    }
+
+    /**
+     * 删除【请填写功能名称】信息
+     * 
+     * @param id 【请填写功能名称】主键
+     * @return 结果
+     */
+    @Override
+    public int deleteUpdateAppById(Long id)
+    {
+        return updateAppMapper.deleteUpdateAppById(id);
+    }
+
+    @Override
+    public UpdateApp getInfoNew(UpdateApp updateApp) {
+        updateApp.setIsDel("Y");
+        return updateAppMapper.getInfo(updateApp);
+    }
+}

+ 103 - 0
ruoyi-system/src/main/resources/mapper/system/UpdateAppMapper.xml

@@ -0,0 +1,103 @@
+<?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.ruoyi.system.mapper.UpdateAppMapper">
+    
+    <resultMap type="UpdateApp" id="UpdateAppResult">
+        <result property="id"    column="id"    />
+        <result property="model"    column="model"    />
+        <result property="name"    column="name"    />
+        <result property="code"    column="code"    />
+        <result property="description"    column="description"    />
+        <result property="path"    column="path"    />
+        <result property="isDel"    column="is_del"    />
+        <result property="createTime"    column="create_time"    />
+    </resultMap>
+
+    <sql id="selectUpdateAppVo">
+        select id, model, name, code, description, path, is_del, create_time from update_app
+    </sql>
+
+    <select id="selectUpdateAppList" parameterType="UpdateApp" resultMap="UpdateAppResult">
+        <include refid="selectUpdateAppVo"/>
+        <where>  
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="path != null  and path != ''"> and path = #{path}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    
+    <select id="selectUpdateAppById" parameterType="Long" resultMap="UpdateAppResult">
+        <include refid="selectUpdateAppVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertUpdateApp" parameterType="UpdateApp">
+        insert into update_app
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null">id,</if>
+            <if test="model != null">model,</if>
+            <if test="name != null">name,</if>
+            <if test="code != null">code,</if>
+            <if test="description != null">description,</if>
+            <if test="path != null">path,</if>
+            <if test="isDel != null">is_del,</if>
+            <if test="createTime != null">create_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null">#{id},</if>
+            <if test="model != null">#{model},</if>
+            <if test="name != null">#{name},</if>
+            <if test="code != null">#{code},</if>
+            <if test="description != null">#{description},</if>
+            <if test="path != null">#{path},</if>
+            <if test="isDel != null">#{isDel},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateUpdateApp" parameterType="UpdateApp">
+        update update_app
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="model != null">model = #{model},</if>
+            <if test="name != null">name = #{name},</if>
+            <if test="code != null">code = #{code},</if>
+            <if test="description != null">description = #{description},</if>
+            <if test="path != null">path = #{path},</if>
+            <if test="isDel != null">is_del = #{isDel},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteUpdateAppById" parameterType="Long">
+        delete from update_app where id = #{id}
+    </delete>
+
+    <delete id="deleteUpdateAppByIds" parameterType="String">
+        delete from update_app where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <select id="getInfo" parameterType="UpdateApp" resultMap="UpdateAppResult">
+        <include refid="selectUpdateAppVo"/>
+        <where>
+            <if test="model != null  and model != ''"> and model = #{model}</if>
+            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
+            <if test="code != null  and code != ''"> and code = #{code}</if>
+            <if test="description != null  and description != ''"> and description = #{description}</if>
+            <if test="path != null  and path != ''"> and path = #{path}</if>
+            <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+        </where>
+    </select>
+    <update id="updateUpdateAppAll" parameterType="UpdateApp">
+        update update_app set is_del = #{isDel}
+        where model = #{model}
+    </update>
+</mapper>

+ 3 - 0
ruoyi-system/src/main/resources/mapper/system/ZxFjMapper.xml

@@ -91,4 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <delete id="deleteZxFjBySourceId" parameterType="Long">
         delete from zx_fj where source_id = #{sourceId}
     </delete>
+    <delete id="deleteZxFj">
+        delete from zx_fj where source_id = #{sourceId} and main_id = #{mainId} and type = #{type} and stytle = #{stytle}
+    </delete>
 </mapper>