文件记录表新增app_id字段

This commit is contained in:
gxwebsoft
2024-01-12 17:12:28 +08:00
parent 31c682f047
commit afff31d73c
5 changed files with 56 additions and 18 deletions

View File

@@ -1,5 +1,7 @@
package com.gxwebsoft.common.system.controller;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
@@ -101,7 +103,7 @@ public class MainController extends BaseController {
Integer tenantId = param.getTenantId();
// 判断租户是否销毁
final Tenant tenant = tenantService.getById(tenantId);
if(tenant == null){
if (tenant == null) {
throw new BusinessException("租户不存在");
}
// 登录账号|手机号码|邮箱登录
@@ -138,7 +140,7 @@ public class MainController extends BaseController {
String access_token = JwtUtil.buildToken(new JwtSubject(username, tenantId),
tokenExpireTime, configProperties.getTokenKey());
// 同步redis
redisUtil.set("access_token:" + user.getUserId(),access_token,tokenExpireTime,TimeUnit.SECONDS);
redisUtil.set("access_token:" + user.getUserId(), access_token, tokenExpireTime, TimeUnit.SECONDS);
return success("登录成功", new LoginResult(access_token, user));
}
@@ -155,11 +157,11 @@ public class MainController extends BaseController {
@GetMapping("/auth/tenant")
public ApiResult<?> tenant() {
Integer tenantId = getTenantId();
if(tenantId == null){
if (tenantId == null) {
throw new BusinessException("缺少参数tenantId");
}
Tenant tenant = tenantService.getByIdRel(tenantId);
if(tenant == null){
if (tenant == null) {
throw new BusinessException("该租户不存在");
}
// 企业信息
@@ -184,10 +186,12 @@ public class MainController extends BaseController {
menu.setMenuType(0);
list.add(menu);
tenant.setMenu(list);
// 服务器时间
tenant.setDate(serverTime());
// 授权信息
HashMap<String, Object> config = new HashMap<>();
config.put("LICENSE_CODE","dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW==");
config.put("MAP_KEY","8191620da39a742c6f18f010c084c772");
config.put("LICENSE_CODE", "dk9mcwJyetRWQlxWRiojIzJCLi8mcQ5Wa4ojI0NWZqJWd6ICZpJCL0kjNwl1NnhENahnIvl2cyVmdiwiIiATMuEjI6IibQf0NW==");
config.put("MAP_KEY", "8191620da39a742c6f18f010c084c772");
tenant.setConfig(config);
return success(tenant);
}
@@ -449,7 +453,7 @@ public class MainController extends BaseController {
String email = user.getEmail(); // 邮箱
// 短信验证
if (!StrUtil.equals(code,cacheClient.get(phone,String.class)) && !StrUtil.equals(code,"170083")) {
if (!StrUtil.equals(code, cacheClient.get(phone, String.class)) && !StrUtil.equals(code, "170083")) {
throw new BusinessException("验证码不正确");
}
@@ -968,8 +972,36 @@ public class MainController extends BaseController {
String content = "租户ID".concat(tenant.getTenantId().toString()).concat("\r\n名称" + tenantName).concat("\r\n账号" + phone).concat("\r\n密码" + password);
String adminUrl = "\r\n后台管理".concat("https://admin.gxwebsoft.com");
// 发送邮件通知
emailRecordService.sendEmail(title,content.concat(adminUrl),email);
return success("注册成功",tenant.getTenantId());
emailRecordService.sendEmail(title, content.concat(adminUrl), email);
return success("注册成功", tenant.getTenantId());
}
/**
* 获取服务器时间
* @return String
*/
@ApiOperation("获取服务器时间")
@GetMapping("/serverTime")
public ApiResult<?> serverTime(){
HashMap<String, Object> map = new HashMap<>();
// 今天日期
DateTime date = DateUtil.date();
String today= DateUtil.today();
// 明天日期
final DateTime dateTime = DateUtil.tomorrow();
String tomorrow = DateUtil.format(dateTime, "yyyy-MM-dd");
// 今天星期几
final int week = DateUtil.thisDayOfWeek();;
final DateTime nextWeek = DateUtil.nextWeek();
map.put("now",DateUtil.now());
map.put("today",today);
map.put("tomorrow",tomorrow);
map.put("week",week);
map.put("minDate",DateUtil.offset(date, DateField.DAY_OF_WEEK, -7 ));
map.put("maxDate",DateUtil.offset(date, DateField.DAY_OF_WEEK, 7 ));
map.put("nextWeek",nextWeek);
return success(map);
}
// 缓存租户信息
@@ -978,6 +1010,6 @@ public class MainController extends BaseController {
if (StrUtil.isEmpty(tenant.getTenantCode())) {
tenant.setTenantCode(CommonUtil.randomUUID16());
}
redisUtil.set(key,tenant);
redisUtil.set(key, tenant);
}
}

View File

@@ -42,6 +42,9 @@ public class FileRecord implements Serializable {
@ApiModelProperty("备注")
private String comments;
@ApiModelProperty("应用ID")
private Integer appId;
@ApiModelProperty("创建人")
private Integer createUserId;

View File

@@ -52,14 +52,6 @@ public class Tenant implements Serializable {
@ApiModelProperty(value = "修改时间")
private Date updateTime;
// @ApiModelProperty(value = "游客")
// @TableField(exist = false)
// private String username;
// @ApiModelProperty(value = "游客身份")
// @TableField(exist = false)
// private String token;
@ApiModelProperty(value = "菜单信息")
@TableField(exist = false)
private List<Menu> menu;
@@ -80,4 +72,8 @@ public class Tenant implements Serializable {
@TableField(exist = false)
private Object config;
@ApiModelProperty(value = "服务器时间")
@TableField(exist = false)
private Object date;
}

View File

@@ -20,6 +20,9 @@
<if test="param.path != null">
AND a.path LIKE CONCAT('%', #{param.path}, '%')
</if>
<if test="param.appId != null">
AND a.app_id = #{param.appId}
</if>
<if test="param.createUserId != null">
AND a.create_user_id = #{param.createUserId}
</if>

View File

@@ -38,6 +38,10 @@ public class FileRecordParam extends BaseParam {
@ApiModelProperty("文件存储路径")
private String path;
@QueryField(type = QueryType.EQ)
@ApiModelProperty("应用ID")
private Integer appId;
@QueryField(type = QueryType.EQ)
@ApiModelProperty("创建人")
private Integer createUserId;