优化
This commit is contained in:
@ -0,0 +1,35 @@
|
|||||||
|
package com.ruoyi.web.controller.common;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.domain.Version;
|
||||||
|
import com.ruoyi.common.service.IVersionService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本Controller
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
@Api(value = "APP版本控制器", tags = {"APP版本管理"})
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/common/version")
|
||||||
|
public class VersionController extends BaseController {
|
||||||
|
|
||||||
|
private final IVersionService iCommonVersionService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("获取最新APP版本详细信息")
|
||||||
|
@GetMapping("/latest")
|
||||||
|
public AjaxResult<Version> getLatest(){
|
||||||
|
return AjaxResult.success(iCommonVersionService.getLatest());
|
||||||
|
}
|
||||||
|
}
|
@ -28,7 +28,7 @@ captcha:
|
|||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器的HTTP端口,默认为8080
|
# 服务器的HTTP端口,默认为8080
|
||||||
port: 9099
|
port: 9097
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /ruoyi
|
context-path: /ruoyi
|
||||||
|
@ -102,7 +102,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
|
|||||||
.authorizeRequests()
|
.authorizeRequests()
|
||||||
// 对于登录login 验证码captchaImage 允许匿名访问
|
// 对于登录login 验证码captchaImage 允许匿名访问
|
||||||
.antMatchers("/login", "/captchaImage","/demo/tress/all").anonymous()
|
.antMatchers("/login", "/captchaImage","/demo/tress/all").anonymous()
|
||||||
.antMatchers("/app/login","/wgz/app/wgzRegister","/sse/subscribe",
|
.antMatchers("/app/login","/wgz/app/wgzRegister","/common/version/latest",
|
||||||
"/app/bgt/recruit/htmlList","/app/bgt/apply/htmlList","/common/annex/getHtmlWgzAnnex"
|
"/app/bgt/recruit/htmlList","/app/bgt/apply/htmlList","/common/annex/getHtmlWgzAnnex"
|
||||||
,"/download-folders","/upload-zip").permitAll()
|
,"/download-folders","/upload-zip").permitAll()
|
||||||
.antMatchers(
|
.antMatchers(
|
||||||
|
@ -67,7 +67,7 @@ public class TokenService {
|
|||||||
String userKey = getTokenKey(type, userId);
|
String userKey = getTokenKey(type, userId);
|
||||||
LoginUser user = redisCache.getCacheObject(userKey);
|
LoginUser user = redisCache.getCacheObject(userKey);
|
||||||
// log.info("用户当前类型:{}", claims);
|
// log.info("用户当前类型:{}", claims);
|
||||||
if(!uuid.equals(user.getToken())){
|
if(user==null || !uuid.equals(user.getToken())){
|
||||||
throw new BaseException("999","您的账号在其他设备登录");
|
throw new BaseException("999","您的账号在其他设备登录");
|
||||||
}
|
}
|
||||||
return user;
|
return user;
|
||||||
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.ruoyi.common.bo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import com.ruoyi.common.core.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本分页查询对象 common_version
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ApiModel("APP版本分页查询对象")
|
||||||
|
public class VersionQueryBo extends BaseEntity {
|
||||||
|
|
||||||
|
/** 分页大小 */
|
||||||
|
@ApiModelProperty("分页大小")
|
||||||
|
private Integer pageSize;
|
||||||
|
/** 当前页数 */
|
||||||
|
@ApiModelProperty("当前页数")
|
||||||
|
private Integer pageNum;
|
||||||
|
/** 排序列 */
|
||||||
|
@ApiModelProperty("排序列")
|
||||||
|
private String orderByColumn;
|
||||||
|
/** 排序的方向desc或者asc */
|
||||||
|
@ApiModelProperty(value = "排序的方向", example = "asc,desc")
|
||||||
|
private String isAsc;
|
||||||
|
|
||||||
|
|
||||||
|
/** 版本号 */
|
||||||
|
@ApiModelProperty("版本号")
|
||||||
|
private String version;
|
||||||
|
/** 下载地址 */
|
||||||
|
@ApiModelProperty("下载地址")
|
||||||
|
private String downUrl;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
package com.ruoyi.common.domain;
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Excel;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本对象 common_version
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("common_version")
|
||||||
|
@ApiModel("APP版本视图对象")
|
||||||
|
public class Version implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
@ApiModelProperty("主键ID")
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 版本号 */
|
||||||
|
@Excel(name = "版本号")
|
||||||
|
@ApiModelProperty("版本号")
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/** 下载地址 */
|
||||||
|
@Excel(name = "下载地址")
|
||||||
|
@ApiModelProperty("下载地址")
|
||||||
|
private String downUrl;
|
||||||
|
|
||||||
|
/** 删除标志(0代表存在 2代表删除) */
|
||||||
|
@Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除")
|
||||||
|
@ApiModelProperty("删除标志(0代表存在 2代表删除)")
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 创建者 */
|
||||||
|
@Excel(name = "创建者")
|
||||||
|
@ApiModelProperty("创建者")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private String createBy;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
@TableField(fill = FieldFill.INSERT)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/** 更新者 */
|
||||||
|
@Excel(name = "更新者")
|
||||||
|
@ApiModelProperty("更新者")
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private String updateBy;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@ApiModelProperty("更新时间")
|
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/** 备注 */
|
||||||
|
@Excel(name = "备注")
|
||||||
|
@ApiModelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.ruoyi.common.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.common.domain.Version;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
|
||||||
|
import org.apache.ibatis.annotations.CacheNamespace;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本Mapper接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象
|
||||||
|
@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class)
|
||||||
|
public interface VersionMapper extends BaseMapperPlus<Version> {
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,60 @@
|
|||||||
|
package com.ruoyi.common.service;
|
||||||
|
|
||||||
|
import com.ruoyi.common.domain.Version;
|
||||||
|
import com.ruoyi.common.bo.VersionQueryBo;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本Service接口
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
public interface IVersionService extends IServicePlus<Version> {
|
||||||
|
/**
|
||||||
|
* 查询单个
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Version queryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
TableDataInfo<Version> queryPageList(VersionQueryBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询列表
|
||||||
|
*/
|
||||||
|
List<Version> queryList(VersionQueryBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据新增业务对象插入APP版本
|
||||||
|
* @param bo APP版本新增业务对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean insert(Version bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据编辑业务对象修改APP版本
|
||||||
|
* @param bo APP版本编辑业务对象
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean update(Version bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验并删除数据
|
||||||
|
* @param ids 主键集合
|
||||||
|
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取最新APP版本
|
||||||
|
*/
|
||||||
|
Version getLatest();
|
||||||
|
}
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.ruoyi.common.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.utils.PageUtils;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.ruoyi.common.bo.VersionQueryBo;
|
||||||
|
import com.ruoyi.common.domain.Version;
|
||||||
|
import com.ruoyi.common.mapper.VersionMapper;
|
||||||
|
import com.ruoyi.common.service.IVersionService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP版本Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-05-08
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VersionServiceImpl extends ServicePlusImpl<VersionMapper, Version> implements IVersionService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Version queryById(Long id){
|
||||||
|
return getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TableDataInfo<Version> queryPageList(VersionQueryBo bo) {
|
||||||
|
Page<Version> result = page(PageUtils.buildPage(), buildQueryWrapper(bo));
|
||||||
|
return PageUtils.buildDataInfo(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Version> queryList(VersionQueryBo bo) {
|
||||||
|
return list(buildQueryWrapper(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<Version> buildQueryWrapper(VersionQueryBo bo) {
|
||||||
|
Map<String, Object> params = bo.getParams();
|
||||||
|
LambdaQueryWrapper<Version> lqw = Wrappers.lambdaQuery();
|
||||||
|
lqw.eq(StrUtil.isNotBlank(bo.getVersion()), Version::getVersion, bo.getVersion());
|
||||||
|
lqw.eq(StrUtil.isNotBlank(bo.getDownUrl()), Version::getDownUrl, bo.getDownUrl());
|
||||||
|
return lqw;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean insert(Version bo) {
|
||||||
|
Version add = BeanUtil.toBean(bo, Version.class);
|
||||||
|
validEntityBeforeSave(add);
|
||||||
|
return save(add);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean update(Version bo) {
|
||||||
|
Version update = BeanUtil.toBean(bo, Version.class);
|
||||||
|
validEntityBeforeSave(update);
|
||||||
|
return updateById(update);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存前的数据校验
|
||||||
|
*
|
||||||
|
* @param entity 实体类数据
|
||||||
|
*/
|
||||||
|
private void validEntityBeforeSave(Version entity){
|
||||||
|
//TODO 做一些数据校验,如唯一约束
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||||
|
if(isValid){
|
||||||
|
//TODO 做一些业务上的校验,判断是否需要校验
|
||||||
|
}
|
||||||
|
return removeByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Version getLatest() {
|
||||||
|
return baseMapper.selectOne(Wrappers.<Version>lambdaQuery()
|
||||||
|
.last("limit 1")
|
||||||
|
.orderByDesc(Version::getVersion));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
<?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.common.mapper.VersionMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.common.domain.Version" id="CommonVersionResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="version" column="version"/>
|
||||||
|
<result property="downUrl" column="downUrl"/>
|
||||||
|
<result property="delFlag" column="del_flag"/>
|
||||||
|
<result property="createBy" column="create_by"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateBy" column="update_by"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
<result property="remark" column="remark"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -97,7 +97,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
project_status
|
project_status
|
||||||
FROM zbf_project zp
|
FROM zbf_project zp
|
||||||
where zp.id in (select zpsa.project_id from zbf_project_subcontracting_apply zpsa
|
where zp.id in (select zpsa.project_id from zbf_project_subcontracting_apply zpsa
|
||||||
where zpsa.fbs_user_id = #{dto.fbsUserId} and zpsa.apply_status !='3')
|
where zpsa.fbs_user_id = #{dto.fbsUserId}
|
||||||
|
and zpsa.apply_status in ('0','1')
|
||||||
|
)
|
||||||
order by zp.id desc
|
order by zp.id desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ VUE_APP_TITLE = RuoYi-Vue-Plus后台管理系统
|
|||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 若依管理系统/开发环境
|
# 若依管理系统/开发环境
|
||||||
VUE_APP_BASE_API = 'http://192.168.110.3:9099/ruoyi'
|
VUE_APP_BASE_API = 'http://192.168.110.5:9097/ruoyi'
|
||||||
# VUE_APP_BASE_API = 'https://gx.jdfktech.com:18279/lhyg/ruoyi'
|
# VUE_APP_BASE_API = 'https://gx.jdfktech.com:18279/lhyg/ruoyi'
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
|
Reference in New Issue
Block a user