1
This commit is contained in:
@@ -58,7 +58,7 @@ public class SecurityUtils {
|
||||
*
|
||||
* @return 系统用户Id
|
||||
*/
|
||||
public static Long getCurrentUserId() {
|
||||
public static String getCurrentUserId() {
|
||||
return getCurrentUser().getId();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
@Data
|
||||
public class CurrentUser implements Serializable {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
private String id;
|
||||
|
||||
//账号
|
||||
private String username;
|
||||
|
||||
@@ -61,7 +61,7 @@ public class QuartzJobServiceImpl implements QuartzJobService {
|
||||
throw new BadRequestException("cron表达式格式错误");
|
||||
}
|
||||
WQLObject quartzTab = WQLObject.getWQLObject("sys_quartz_job");
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String userId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
resources.put("job_id", IdUtil.getSnowflake(1,1).nextId());
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.nl.modules.system.rest;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -10,6 +11,9 @@ import org.nl.modules.logging.annotation.Log;
|
||||
import org.nl.modules.system.domain.vo.RoleVo;
|
||||
import org.nl.modules.system.service.RoleService;
|
||||
import org.nl.modules.wql.core.bean.WQLObject;
|
||||
import org.nl.system.service.role.ISysRoleService;
|
||||
import org.nl.system.service.role.dao.SysRole;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@@ -86,10 +86,10 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
resources.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
resources.setCode(dictObj.getString("code"));
|
||||
resources.setName(dictObj.getString("name"));
|
||||
resources.setCreate_id(SecurityUtils.getCurrentUserId());
|
||||
resources.setCreate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
resources.setCreate_name(SecurityUtils.getCurrentNickName());
|
||||
resources.setCreate_time(DateUtil.now());
|
||||
resources.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
resources.setUpdate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
resources.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
resources.setUpdate_time(DateUtil.now());
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(resources));
|
||||
@@ -106,7 +106,7 @@ public class DictDetailServiceImpl implements DictDetailService {
|
||||
}
|
||||
dto.setUpdate_time(DateUtil.now());
|
||||
dto.setUpdate_optname(SecurityUtils.getCurrentNickName());
|
||||
dto.setUpdate_id(SecurityUtils.getCurrentUserId());
|
||||
dto.setUpdate_id(Long.valueOf(SecurityUtils.getCurrentUserId()));
|
||||
JSONObject json = JSONObject.parseObject(JSON.toJSONString(dto));
|
||||
dictTab.update(json);
|
||||
// 清理缓存
|
||||
|
||||
@@ -75,13 +75,13 @@ public class DictService2Impl implements DictService2 {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||
JSONObject object = wo.query("code = '" + dto.getCode() + "'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(object)) throw new BadRequestException("字典[" + dto.getCode() + "]已存在");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String date = DateUtil.now();
|
||||
dto.setDict_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_id(Long.valueOf(currentUserId));
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_id(Long.valueOf(currentUserId));
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(date);
|
||||
dto.setCreate_time(date);
|
||||
@@ -93,7 +93,7 @@ public class DictService2Impl implements DictService2 {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void update(DictDto dto) {
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_dict");
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
JSONObject otherObj = wo.query("dict_id = '" + dto.getDict_id() + "'").uniqueResult(0);
|
||||
JSONArray dictArray = wo.query("code = '" + otherObj.getString("code") + "'").getResultJSONArray(0);
|
||||
|
||||
@@ -48,7 +48,7 @@ public class GenCodeServiceImpl implements GenCodeService {
|
||||
|
||||
@Override
|
||||
public void create(Map form) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
WQLObject wql = WQLObject.getWQLObject("sys_code_rule");
|
||||
JSONObject json = new JSONObject();
|
||||
|
||||
@@ -47,7 +47,7 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(GridFieldDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
Long uid = SecurityUtils.getCurrentUserId();
|
||||
String uid = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
@@ -108,7 +108,7 @@ public class GridFieldServiceImpl implements GridFieldService {
|
||||
JSONArray fieldDatas = json.getJSONArray("gridFieldData");
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_grid_field");
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
// 先删除原先所有的数据
|
||||
wo.delete("grid_id = '" + grid_id + "'");
|
||||
// 然后添加
|
||||
|
||||
@@ -44,7 +44,7 @@ public class GridServiceImpl implements GridService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(GridDto dto) {
|
||||
String currentUsername = SecurityUtils.getCurrentUsername();
|
||||
Long uid = SecurityUtils.getCurrentUserId();
|
||||
String uid = SecurityUtils.getCurrentUserId();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setId(IdUtil.simpleUUID());
|
||||
|
||||
@@ -71,7 +71,7 @@ public class LocalStorageServiceImpl implements LocalStorageService {
|
||||
throw new BadRequestException("上传失败");
|
||||
}
|
||||
try {
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String userId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
name = StrUtil.isEmpty(name) ? FileUtil.getFileNameNoEx(multipartFile.getOriginalFilename()) : name;
|
||||
|
||||
@@ -74,14 +74,14 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(DataPermissionDto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
dto.setPermission_id(IdUtil.getSnowflake(1, 1).nextId());
|
||||
dto.setCreate_id(currentUserId);
|
||||
dto.setCreate_id(Long.valueOf(currentUserId));
|
||||
dto.setCreate_name(nickName);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_id(Long.valueOf(currentUserId));
|
||||
dto.setUpdate_optname(nickName);
|
||||
dto.setUpdate_time(now);
|
||||
dto.setCreate_time(now);
|
||||
@@ -97,12 +97,12 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
DataPermissionDto entity = this.findById(dto.getPermission_id());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
dto.setUpdate_time(now);
|
||||
dto.setUpdate_id(currentUserId);
|
||||
dto.setUpdate_id(Long.valueOf(currentUserId));
|
||||
dto.setUpdate_optname(nickName);
|
||||
|
||||
WQLObject wo = WQLObject.getWQLObject("sys_data_permission");
|
||||
@@ -113,7 +113,7 @@ public class DataPermissionServiceImpl implements DataPermissionService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(Long[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(Dict dict) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String date = DateUtil.now();
|
||||
Dict oldDict = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>()
|
||||
@@ -64,8 +64,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
dict.setCreateId(currentUserId);
|
||||
dict.setCreateName(nickName);
|
||||
dict.setCreateTime(date);
|
||||
dict.setupdateId(currentUserId);
|
||||
dict.setupdateName(nickName);
|
||||
dict.setUpdateId(currentUserId);
|
||||
dict.setUpdateName(nickName);
|
||||
dict.setUpdateTime(date);
|
||||
sysDictMapper.insert(dict);
|
||||
}
|
||||
@@ -76,15 +76,15 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
Dict dict1 = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dto.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(dict1)) throw new BadRequestException("字典[" + dict1.getCode() + "]已存在");
|
||||
Dict dict = sysDictMapper.selectById(dto.getDictId());
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentNickName = SecurityUtils.getCurrentNickName();
|
||||
// 根据code获取所有字典
|
||||
List<Dict> dicts = sysDictMapper.selectList(new LambdaQueryWrapper<Dict>().eq(Dict::getCode, dict.getCode()));
|
||||
dicts.forEach(di -> {
|
||||
di.setCode(dto.getCode());
|
||||
di.setName(dto.getName());
|
||||
di.setupdateId(currentUserId);
|
||||
di.setupdateName(currentNickName);
|
||||
di.setUpdateId(currentUserId);
|
||||
di.setUpdateName(currentNickName);
|
||||
di.setUpdateTime(DateUtil.now());
|
||||
sysDictMapper.updateById(di);
|
||||
});
|
||||
@@ -139,8 +139,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
dict.setCreateId(SecurityUtils.getCurrentUserId());
|
||||
dict.setCreateName(SecurityUtils.getCurrentNickName());
|
||||
dict.setCreateTime(DateUtil.now());
|
||||
dict.setupdateId(SecurityUtils.getCurrentUserId());
|
||||
dict.setupdateName(SecurityUtils.getCurrentNickName());
|
||||
dict.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||
dict.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||
dict.setUpdateTime(DateUtil.now());
|
||||
sysDictMapper.insert(dict);
|
||||
}
|
||||
@@ -154,8 +154,8 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, Dict> impleme
|
||||
Dict one = sysDictMapper.selectOne(new LambdaQueryWrapper<Dict>().eq(Dict::getLabel, dict.getLabel())
|
||||
.eq(Dict::getCode, dict.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(one)) throw new BadRequestException("标签[" + dict.getLabel() + "]已存在");
|
||||
resources.setupdateId(SecurityUtils.getCurrentUserId());
|
||||
resources.setupdateName(SecurityUtils.getCurrentNickName());
|
||||
resources.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||
resources.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||
resources.setUpdateTime(DateUtil.now());
|
||||
sysDictMapper.updateById(resources);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ public interface ISysMenuService extends IService<SysMenu> {
|
||||
void update(SysMenu menu);
|
||||
|
||||
|
||||
List<MenuDto> findByUser(Long userId);
|
||||
List<MenuDto> findByUser(String userId);
|
||||
|
||||
/**
|
||||
* 构建菜单树
|
||||
|
||||
@@ -28,6 +28,6 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
||||
* @param userId 用户标识
|
||||
* @return 当前用户拥有的菜单列表
|
||||
*/
|
||||
List<SysMenu> findByUser(@Param("userId") Long userId);
|
||||
List<SysMenu> findByUser(@Param("userId") String userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -163,7 +163,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MenuDto> findByUser(Long userId) {
|
||||
public List<MenuDto> findByUser(String userId) {
|
||||
return baseMapper.findByUser(userId).stream().map(menu -> this.doToDto(menu)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,14 +48,14 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
List code = paramMapper.selectByMap(MapOf.of("code", param.getCode()));
|
||||
if (ObjectUtil.isNotEmpty(code)) throw new BadRequestException("编码不能一致");
|
||||
param.setId(IdUtil.getSnowflake(1,1).nextIdStr());
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
param.setCreateId(currentUserId);
|
||||
param.setCreateName(nickName);
|
||||
param.setCreateTime(now);
|
||||
param.setupdateId(currentUserId);
|
||||
param.setupdateName(nickName);
|
||||
param.setUpdateId(currentUserId);
|
||||
param.setUpdateName(nickName);
|
||||
param.setUpdateTime(now);
|
||||
paramMapper.insert(param);
|
||||
}
|
||||
@@ -65,8 +65,8 @@ public class SysParamServiceImpl extends ServiceImpl<SysParamMapper, Param> impl
|
||||
public void update(Param param) {
|
||||
Param paramObj = paramMapper.selectById(param.getId());
|
||||
if (ObjectUtil.isEmpty(paramObj)) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
param.setupdateId(SecurityUtils.getCurrentUserId());
|
||||
param.setupdateName(SecurityUtils.getCurrentNickName());
|
||||
param.setUpdateId(SecurityUtils.getCurrentUserId());
|
||||
param.setUpdateName(SecurityUtils.getCurrentNickName());
|
||||
param.setUpdateTime(DateUtil.now());
|
||||
paramMapper.updateById(param);
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
//判断角色名字是否存在
|
||||
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName()));
|
||||
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String userId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
// 插入
|
||||
@@ -93,7 +93,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
||||
SysRole role = roleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getName, sysRole.getName())
|
||||
.ne(SysRole::getRoleId, sysRole.getRoleId()));
|
||||
if (ObjectUtil.isNotEmpty(role)) throw new BadRequestException("角色【" + name + "】已存在!");
|
||||
Long userId = SecurityUtils.getCurrentUserId();
|
||||
String userId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
sysRole.setUpdateId(userId);
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ${className}ServiceImpl implements ${className}Service {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void create(${className}Dto dto) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
@@ -96,7 +96,7 @@ public class ${className}ServiceImpl implements ${className}Service {
|
||||
${className}Dto entity = this.findById(dto.get${pkChangeColName ? cap_first }());
|
||||
if (entity == null) throw new BadRequestException("被删除或无权限,操作失败!");
|
||||
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
|
||||
String now = DateUtil.now();
|
||||
@@ -112,7 +112,7 @@ public class ${className}ServiceImpl implements ${className}Service {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteAll(${pkColumnType}[] ids) {
|
||||
Long currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String currentUserId = SecurityUtils.getCurrentUserId();
|
||||
String nickName = SecurityUtils.getCurrentNickName();
|
||||
String now = DateUtil.now();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user