mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 21:52:07 +08:00
禅道#601、#636、#659、#662问题修复
This commit is contained in:
+1
@@ -9,6 +9,7 @@ public class DictTypeConstants {
|
|||||||
|
|
||||||
public static final String USER_TYPE = "user_type"; // 用户类型
|
public static final String USER_TYPE = "user_type"; // 用户类型
|
||||||
public static final String COMMON_STATUS = "common_status"; // 系统状态
|
public static final String COMMON_STATUS = "common_status"; // 系统状态
|
||||||
|
public static final String ROLE_TYPE = "system_role_type"; // 系统角色类型
|
||||||
|
|
||||||
// ========== SYSTEM 模块 ==========
|
// ========== SYSTEM 模块 ==========
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
package com.cf.imes.module.system.controller.admin.permission.vo.role;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||||
@@ -39,19 +40,23 @@ public class RoleRespVO {
|
|||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "角色类型,参见 RoleTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "角色类型,参见 RoleTypeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty(value = "角色类型", converter = DictConvert.class)
|
||||||
|
@DictFormat(DictTypeConstants.ROLE_TYPE)
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@Schema(description = "备注", example = "我是一个角色")
|
@Schema(description = "备注", example = "我是一个角色")
|
||||||
|
@ExcelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "数据范围,参见 DataScopeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "数据范围,参见 DataScopeEnum 枚举类", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
@ExcelProperty("数据范围")
|
|
||||||
private Integer dataScope;
|
private Integer dataScope;
|
||||||
|
|
||||||
@Schema(description = "数据范围(指定部门数组)", example = "1")
|
@Schema(description = "数据范围(指定部门数组)", example = "1")
|
||||||
private Set<Long> dataScopeDeptIds;
|
private Set<Long> dataScopeDeptIds;
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
@ColumnWidth(20)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@Schema(description = "组织id", example = "1")
|
@Schema(description = "组织id", example = "1")
|
||||||
|
|||||||
+17
-79
@@ -1,8 +1,8 @@
|
|||||||
package com.cf.imes.module.system.controller.admin.sms.vo.log;
|
package com.cf.imes.module.system.controller.admin.sms.vo.log;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.write.style.ColumnWidth;
|
||||||
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
import com.cf.imes.framework.excel.core.annotations.DictFormat;
|
||||||
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
import com.cf.imes.framework.excel.core.convert.DictConvert;
|
||||||
import com.cf.imes.framework.excel.core.convert.JsonConvert;
|
|
||||||
import com.cf.imes.module.system.enums.DictTypeConstants;
|
import com.cf.imes.module.system.enums.DictTypeConstants;
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
@@ -21,13 +21,23 @@ public class SmsLogRespVO {
|
|||||||
@ExcelProperty("编号")
|
@ExcelProperty("编号")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Schema(description = "短信渠道编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("短信渠道编号")
|
@ExcelProperty("创建时间")
|
||||||
private Long channelId;
|
@ColumnWidth(20)
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@Schema(description = "短信渠道编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ALIYUN")
|
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
||||||
@ExcelProperty("短信渠道编码")
|
@ExcelProperty("手机号")
|
||||||
private String channelCode;
|
private String mobile;
|
||||||
|
|
||||||
|
@Schema(description = "短信内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "你好,你的验证码是 1024")
|
||||||
|
@ExcelProperty("短信内容")
|
||||||
|
private String templateContent;
|
||||||
|
|
||||||
|
@Schema(description = "发送状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty(value = "发送状态", converter = DictConvert.class)
|
||||||
|
@DictFormat(DictTypeConstants.SMS_SEND_STATUS)
|
||||||
|
private Integer sendStatus;
|
||||||
|
|
||||||
@Schema(description = "模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
|
@Schema(description = "模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "20")
|
||||||
@ExcelProperty("模板编号")
|
@ExcelProperty("模板编号")
|
||||||
@@ -41,76 +51,4 @@ public class SmsLogRespVO {
|
|||||||
@ExcelProperty(value = "短信类型", converter = DictConvert.class)
|
@ExcelProperty(value = "短信类型", converter = DictConvert.class)
|
||||||
@DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE)
|
@DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE)
|
||||||
private Integer templateType;
|
private Integer templateType;
|
||||||
|
|
||||||
@Schema(description = "短信内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "你好,你的验证码是 1024")
|
|
||||||
@ExcelProperty("短信内容")
|
|
||||||
private String templateContent;
|
|
||||||
|
|
||||||
@Schema(description = "短信参数", requiredMode = Schema.RequiredMode.REQUIRED, example = "name,code")
|
|
||||||
@ExcelProperty(value = "短信参数", converter = JsonConvert.class)
|
|
||||||
private Map<String, Object> templateParams;
|
|
||||||
|
|
||||||
@Schema(description = "短信 API 的模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "SMS_207945135")
|
|
||||||
@ExcelProperty("短信 API 的模板编号")
|
|
||||||
private String apiTemplateId;
|
|
||||||
|
|
||||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15601691300")
|
|
||||||
@ExcelProperty("手机号")
|
|
||||||
private String mobile;
|
|
||||||
|
|
||||||
@Schema(description = "用户编号", example = "10")
|
|
||||||
@ExcelProperty("用户编号")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
@Schema(description = "用户类型", example = "1")
|
|
||||||
@ExcelProperty(value = "用户类型", converter = DictConvert.class)
|
|
||||||
@DictFormat(DictTypeConstants.USER_TYPE)
|
|
||||||
private Integer userType;
|
|
||||||
|
|
||||||
@Schema(description = "发送状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
@ExcelProperty(value = "发送状态", converter = DictConvert.class)
|
|
||||||
@DictFormat(DictTypeConstants.SMS_SEND_STATUS)
|
|
||||||
private Integer sendStatus;
|
|
||||||
|
|
||||||
@Schema(description = "发送时间")
|
|
||||||
@ExcelProperty("发送时间")
|
|
||||||
private LocalDateTime sendTime;
|
|
||||||
|
|
||||||
@Schema(description = "短信 API 发送结果的编码", example = "SUCCESS")
|
|
||||||
@ExcelProperty("短信 API 发送结果的编码")
|
|
||||||
private String apiSendCode;
|
|
||||||
|
|
||||||
@Schema(description = "短信 API 发送失败的提示", example = "成功")
|
|
||||||
@ExcelProperty("短信 API 发送失败的提示")
|
|
||||||
private String apiSendMsg;
|
|
||||||
|
|
||||||
@Schema(description = "短信 API 发送返回的唯一请求 ID", example = "3837C6D3-B96F-428C-BBB2-86135D4B5B99")
|
|
||||||
@ExcelProperty("短信 API 发送返回的唯一请求 ID")
|
|
||||||
private String apiRequestId;
|
|
||||||
|
|
||||||
@Schema(description = "短信 API 发送返回的序号", example = "62923244790")
|
|
||||||
@ExcelProperty("短信 API 发送返回的序号")
|
|
||||||
private String apiSerialNo;
|
|
||||||
|
|
||||||
@Schema(description = "接收状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0")
|
|
||||||
@ExcelProperty(value = "接收状态", converter = DictConvert.class)
|
|
||||||
@DictFormat(DictTypeConstants.SMS_RECEIVE_STATUS)
|
|
||||||
private Integer receiveStatus;
|
|
||||||
|
|
||||||
@Schema(description = "接收时间")
|
|
||||||
@ExcelProperty("接收时间")
|
|
||||||
private LocalDateTime receiveTime;
|
|
||||||
|
|
||||||
@Schema(description = "API 接收结果的编码", example = "DELIVRD")
|
|
||||||
@ExcelProperty("API 接收结果的编码")
|
|
||||||
private String apiReceiveCode;
|
|
||||||
|
|
||||||
@Schema(description = "API 接收结果的说明", example = "用户接收成功")
|
|
||||||
@ExcelProperty("API 接收结果的说明")
|
|
||||||
private String apiReceiveMsg;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
@ExcelProperty("创建时间")
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+7
@@ -1,5 +1,7 @@
|
|||||||
package com.cf.imes.module.system.service.notice;
|
package com.cf.imes.module.system.service.notice;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.cf.imes.framework.common.enums.CommonStatusEnum;
|
||||||
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
import com.cf.imes.framework.common.exception.util.ServiceExceptionUtil;
|
||||||
import com.cf.imes.framework.common.pojo.PageResult;
|
import com.cf.imes.framework.common.pojo.PageResult;
|
||||||
import com.cf.imes.framework.common.util.object.BeanUtils;
|
import com.cf.imes.framework.common.util.object.BeanUtils;
|
||||||
@@ -52,6 +54,11 @@ public class NoticeServiceImpl implements NoticeService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<NoticeDO> getNoticePage(NoticePageReqVO reqVO) {
|
public PageResult<NoticeDO> getNoticePage(NoticePageReqVO reqVO) {
|
||||||
|
// 没有显示传入状态默认查有效的
|
||||||
|
Integer status = reqVO.getStatus();
|
||||||
|
if (ObjectUtil.isNull(status)) {
|
||||||
|
reqVO.setStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
|
}
|
||||||
return noticeMapper.selectPage(reqVO);
|
return noticeMapper.selectPage(reqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+39
@@ -17,6 +17,7 @@ import com.cf.imes.module.system.controller.admin.permission.vo.role.RoleSaveReq
|
|||||||
import com.cf.imes.module.system.dal.dataobject.permission.RoleDO;
|
import com.cf.imes.module.system.dal.dataobject.permission.RoleDO;
|
||||||
import com.cf.imes.module.system.dal.mysql.permission.RoleMapper;
|
import com.cf.imes.module.system.dal.mysql.permission.RoleMapper;
|
||||||
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
import com.cf.imes.module.system.dal.redis.RedisKeyConstants;
|
||||||
|
import com.cf.imes.module.system.dal.redis.RedisRefreshChannelTopicConstants;
|
||||||
import com.cf.imes.module.system.enums.permission.DataScopeEnum;
|
import com.cf.imes.module.system.enums.permission.DataScopeEnum;
|
||||||
import com.cf.imes.module.system.enums.permission.RoleCodeEnum;
|
import com.cf.imes.module.system.enums.permission.RoleCodeEnum;
|
||||||
import com.cf.imes.module.system.enums.permission.RoleTypeEnum;
|
import com.cf.imes.module.system.enums.permission.RoleTypeEnum;
|
||||||
@@ -24,6 +25,9 @@ import com.google.common.annotations.VisibleForTesting;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.cache.annotation.CacheEvict;
|
import org.springframework.cache.annotation.CacheEvict;
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
|
import org.springframework.data.redis.core.Cursor;
|
||||||
|
import org.springframework.data.redis.core.ScanOptions;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -53,6 +57,12 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
@Resource
|
@Resource
|
||||||
private RoleService roleService;
|
private RoleService roleService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
// 模糊匹配redisKey:role:{organId}:{roleId}
|
||||||
|
public static final String REDIS_ROLE_KEY_PATTERN = RedisKeyConstants.ROLE + ":*:%d";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createRole(RoleSaveReqVO createReqVO, Integer type) {
|
public Long createRole(RoleSaveReqVO createReqVO, Integer type) {
|
||||||
@@ -80,6 +90,8 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
// 更新到数据库
|
// 更新到数据库
|
||||||
RoleDO updateObj = BeanUtils.toBean(updateReqVO, RoleDO.class);
|
RoleDO updateObj = BeanUtils.toBean(updateReqVO, RoleDO.class);
|
||||||
roleMapper.updateById(updateObj);
|
roleMapper.updateById(updateObj);
|
||||||
|
// 移除角色缓存
|
||||||
|
scanAndDelKeys(String.format(REDIS_ROLE_KEY_PATTERN, updateObj.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -91,6 +103,8 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
// 更新状态
|
// 更新状态
|
||||||
RoleDO updateObj = new RoleDO().setId(id).setStatus(status);
|
RoleDO updateObj = new RoleDO().setId(id).setStatus(status);
|
||||||
roleMapper.updateById(updateObj);
|
roleMapper.updateById(updateObj);
|
||||||
|
// 移除角色缓存
|
||||||
|
scanAndDelKeys(String.format(REDIS_ROLE_KEY_PATTERN, updateObj.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -117,6 +131,31 @@ public class RoleServiceImpl implements RoleService {
|
|||||||
roleMapper.deleteById(id);
|
roleMapper.deleteById(id);
|
||||||
// 删除相关数据
|
// 删除相关数据
|
||||||
permissionService.processRoleDeleted(id);
|
permissionService.processRoleDeleted(id);
|
||||||
|
// 删除角色移除角色缓存
|
||||||
|
scanAndDelKeys(String.format(REDIS_ROLE_KEY_PATTERN, id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* scan匹配keyPattern下缓存并删除缓存
|
||||||
|
*
|
||||||
|
* @param keyPattern
|
||||||
|
*/
|
||||||
|
private void scanAndDelKeys(String keyPattern) {
|
||||||
|
// 根据keyPattern scan匹配的redis key
|
||||||
|
List<String> matchKeys = new ArrayList<>();
|
||||||
|
Cursor<String> cursor = stringRedisTemplate.scan(ScanOptions.scanOptions().match(keyPattern).count(200).build());
|
||||||
|
while (cursor.hasNext()) {
|
||||||
|
matchKeys.add(cursor.next());
|
||||||
|
}
|
||||||
|
cursor.close();
|
||||||
|
if (CollUtil.isNotEmpty(matchKeys)) {
|
||||||
|
for (String key : matchKeys) {
|
||||||
|
// 移除缓存
|
||||||
|
stringRedisTemplate.delete(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 通知刷新本地缓存
|
||||||
|
stringRedisTemplate.convertAndSend(RedisRefreshChannelTopicConstants.PERMISSION_REFRESH, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user