merge
This commit is contained in:
@@ -19,7 +19,5 @@ public class demo {
|
||||
for (int i = 0; i < 20; i++) {
|
||||
list.add(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class RedisStartupInit implements InitializingBean {
|
||||
@Value("${redisCode}")
|
||||
private String redisCode;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
logger.info("redis has been start");
|
||||
System.out.println("启动执行方法======刷新缓存==================");
|
||||
|
||||
@@ -70,8 +70,9 @@ public class QRCodeZipService {
|
||||
*/
|
||||
public RestMessage batchGetImage(HttpServletResponse response, String[] names, String fileName) {
|
||||
List<File> files = new ArrayList<>();
|
||||
if (names.length == 0)
|
||||
if (names.length == 0) {
|
||||
throw new BusinessException("请选择要导出的图片");
|
||||
}
|
||||
Arrays.stream(names).forEach(name -> {
|
||||
File file = getFile(name);
|
||||
if (file != null && file.length() > 0) {
|
||||
|
||||
@@ -29,14 +29,16 @@ public class DataDictionaryService {
|
||||
RestMessage result = new RestMessage();
|
||||
//检查编码
|
||||
boolean b = uniqueCode(dictionary.getCode(), null);
|
||||
if (!b)
|
||||
if (!b) {
|
||||
throw new BusinessException("该编码已存在");
|
||||
}
|
||||
//添加必要参数
|
||||
String id = PassWordUtil.createId();
|
||||
dictionary.setId(id);
|
||||
dictionary.setCreateTime(new Date());
|
||||
if (StringUtils.isEmpty(dictionary.getParentId()))
|
||||
if (StringUtils.isEmpty(dictionary.getParentId())) {
|
||||
dictionary.setParentId(CommonConstant.ROOT);
|
||||
}
|
||||
//保存
|
||||
DataDictionary save = dataDictionaryRepository.save(dictionary);
|
||||
if (save != null) {
|
||||
@@ -60,8 +62,9 @@ public class DataDictionaryService {
|
||||
String id = dictionary.getId();
|
||||
//判断该字典是否存在
|
||||
DataDictionary old = getById(id);
|
||||
if (old == null)
|
||||
if (old == null) {
|
||||
throw new BusinessException("该字典不存在");
|
||||
}
|
||||
old.setName(dictionary.getName());
|
||||
old.setDescription(dictionary.getDescription());
|
||||
old.setEnable(dictionary.getEnable());
|
||||
@@ -88,8 +91,9 @@ public class DataDictionaryService {
|
||||
* @return
|
||||
*/
|
||||
public boolean uniqueCode(String code, String id) {
|
||||
if (StringUtils.isEmpty(code))
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
throw new BusinessException("code不能为空");
|
||||
}
|
||||
DataDictionary one = dataDictionaryRepository.getByCode(code);
|
||||
return one == null || StringUtils.isNotEmpty(id) && id.equals(one.getId());
|
||||
}
|
||||
@@ -102,10 +106,11 @@ public class DataDictionaryService {
|
||||
* @return
|
||||
*/
|
||||
public List<DataDictionary> findListByParent(String parentId, String enable) {
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
return dataDictionaryRepository.getByParentIdAndEnable(parentId, enable);
|
||||
else
|
||||
} else {
|
||||
return dataDictionaryRepository.getByParentId(parentId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,23 +42,26 @@ public class SysAuthorityService {
|
||||
RestMessage result = new RestMessage();
|
||||
//检查编码
|
||||
boolean b = uniqueCode(sysAuthority.getCode(), null);
|
||||
if (!b)
|
||||
if (!b) {
|
||||
throw new BusinessException("该编码已存在");
|
||||
}
|
||||
//排序处理
|
||||
if (sysAuthority.getSort() == null) {
|
||||
int sort = getSort() + 1;
|
||||
sysAuthority.setSort(sort);
|
||||
} else {
|
||||
boolean sorted = uniqueSort(sysAuthority.getSort(), null);
|
||||
if (!sorted)
|
||||
if (!sorted) {
|
||||
throw new BusinessException("该排序编号已存在");
|
||||
}
|
||||
}
|
||||
//添加必要参数
|
||||
String id = PassWordUtil.createId();
|
||||
sysAuthority.setId(id);
|
||||
sysAuthority.setCreateTime(new Date());
|
||||
if (StringUtils.isEmpty(sysAuthority.getParentId()))
|
||||
if (StringUtils.isEmpty(sysAuthority.getParentId())) {
|
||||
sysAuthority.setParentId(CommonConstant.ROOT);
|
||||
}
|
||||
//保存
|
||||
SysAuthority save = sysAuthorityRepository.save(sysAuthority);
|
||||
if (save != null) {
|
||||
@@ -81,14 +84,16 @@ public class SysAuthorityService {
|
||||
RestMessage result = new RestMessage();
|
||||
//判断该权限是否存在
|
||||
SysAuthority one = getById(id);
|
||||
if (one == null)
|
||||
if (one == null) {
|
||||
throw new BusinessException("该权限不存在");
|
||||
}
|
||||
//删除自身
|
||||
sysAuthorityRepository.delete(id);
|
||||
//如果有子节点,递归删除子节点
|
||||
List<SysAuthority> list = listChildrenForRemove(id);
|
||||
if (CollectionUtils.isNotEmpty(list))
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
sysAuthorityRepository.deleteInBatch(list);
|
||||
}
|
||||
result.setMessage("删除成功");
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
@@ -105,12 +110,14 @@ public class SysAuthorityService {
|
||||
String id = sysAuthority.getId();
|
||||
//判断该权限是否存在
|
||||
SysAuthority old = getById(id);
|
||||
if (old == null)
|
||||
if (old == null) {
|
||||
throw new BusinessException("该权限不存在");
|
||||
}
|
||||
//检查排序是否重复
|
||||
boolean sorted = uniqueSort(sysAuthority.getSort(), id);
|
||||
if (!sorted)
|
||||
if (!sorted) {
|
||||
throw new BusinessException("该排序编号已存在");
|
||||
}
|
||||
old.setSort(sysAuthority.getSort());
|
||||
//其他参数更新
|
||||
old.setName(sysAuthority.getName());
|
||||
@@ -146,10 +153,11 @@ public class SysAuthorityService {
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> listByEnable(String enable) {
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
return sysAuthorityRepository.getByEnableOrderBySort(enable);
|
||||
else
|
||||
} else {
|
||||
return sysAuthorityRepository.findAll(new Sort(Sort.Direction.ASC, "sort"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -160,10 +168,11 @@ public class SysAuthorityService {
|
||||
* @return
|
||||
*/
|
||||
public List<SysAuthority> listByParentEnable(String parentId, String enable) {
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
return sysAuthorityRepository.getByParentIdAndEnableOrderBySort(parentId, enable);
|
||||
else
|
||||
} else {
|
||||
return sysAuthorityRepository.getByParentIdOrderBySort(parentId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -177,15 +186,18 @@ public class SysAuthorityService {
|
||||
List<SysAuthority> list = new ArrayList<>();
|
||||
// 从角色权限表中获取所有该角色id的权限
|
||||
List<SysRoleAuthority> roleAuthorities = sysRoleAuthorityService.listByRoleId(roleId);
|
||||
if (CollectionUtils.isEmpty(roleAuthorities))
|
||||
if (CollectionUtils.isEmpty(roleAuthorities)) {
|
||||
return list;
|
||||
}
|
||||
//根据权限id获取对应权限列表
|
||||
List<String> authorityIds = roleAuthorities.stream().map(SysRoleAuthority::getAuthorityId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(authorityIds))
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (CollectionUtils.isNotEmpty(authorityIds)) {
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
list = sysAuthorityRepository.getByEnableAndIdInOrderBySort(enable, authorityIds);
|
||||
else
|
||||
} else {
|
||||
list = sysAuthorityRepository.getByIdInOrderBySort(authorityIds);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -217,12 +229,14 @@ public class SysAuthorityService {
|
||||
public List<SysAuthVo> listChildren(String parentId, String enable) {
|
||||
List<SysAuthVo> list = new ArrayList<>();
|
||||
List<SysAuthority> authoritys;
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
authoritys = sysAuthorityRepository.getByParentIdAndEnableOrderBySort(parentId, enable);
|
||||
else
|
||||
} else {
|
||||
authoritys = sysAuthorityRepository.getByParentIdOrderBySort(parentId);
|
||||
if (CollectionUtils.isEmpty(authoritys))
|
||||
}
|
||||
if (CollectionUtils.isEmpty(authoritys)) {
|
||||
return list;
|
||||
}
|
||||
SysAuthVo vo;
|
||||
for (SysAuthority authority : authoritys) {
|
||||
vo = new SysAuthVo(authority);
|
||||
@@ -297,8 +311,9 @@ public class SysAuthorityService {
|
||||
* @return
|
||||
*/
|
||||
private boolean uniqueCode(String code, String id) {
|
||||
if (StringUtils.isEmpty(code))
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
throw new BusinessException("code不能为空");
|
||||
}
|
||||
SysAuthority one = sysAuthorityRepository.getByCode(code);
|
||||
return one == null || StringUtils.isNotEmpty(id) && id.equals(one.getId());
|
||||
}
|
||||
@@ -311,8 +326,9 @@ public class SysAuthorityService {
|
||||
* @return
|
||||
*/
|
||||
private boolean uniqueSort(Integer sort, String id) {
|
||||
if (sort == null)
|
||||
if (sort == null) {
|
||||
throw new BusinessException("sort不能为空");
|
||||
}
|
||||
SysAuthority one = sysAuthorityRepository.getBySort(sort);
|
||||
return one == null || StringUtils.isNotEmpty(id) && id.equals(one.getId());
|
||||
}
|
||||
|
||||
@@ -42,8 +42,9 @@ public class SysRoleService {
|
||||
RestMessage result = new RestMessage();
|
||||
//检查编码
|
||||
boolean b = uniqueCode(sysRole.getCode(), null);
|
||||
if (!b)
|
||||
if (!b) {
|
||||
throw new BusinessException("该编码已存在");
|
||||
}
|
||||
String id = PassWordUtil.createId();
|
||||
sysRole.setId(id);
|
||||
sysRole.setCreateTime(new Date());
|
||||
@@ -67,14 +68,16 @@ public class SysRoleService {
|
||||
public RestMessage removeById(String id) {
|
||||
RestMessage result = new RestMessage();
|
||||
SysRole one = getById(id);
|
||||
if (one == null)
|
||||
if (one == null) {
|
||||
throw new BusinessException("该角色不存在");
|
||||
}
|
||||
//删除角色
|
||||
sysRoleRepository.delete(id);
|
||||
//删除角色权限
|
||||
List<SysRoleAuthority> roleAuthorities = sysRoleAuthorityService.listByRoleId(id);
|
||||
if (CollectionUtils.isNotEmpty(roleAuthorities))
|
||||
if (CollectionUtils.isNotEmpty(roleAuthorities)) {
|
||||
sysRoleAuthorityService.removeBatch(roleAuthorities);
|
||||
}
|
||||
result.setMessage("删除成功");
|
||||
result.setSuccess(true);
|
||||
return result;
|
||||
@@ -90,12 +93,14 @@ public class SysRoleService {
|
||||
RestMessage result = new RestMessage();
|
||||
String id = sysRole.getId();
|
||||
SysRole old = getById(id);
|
||||
if (old == null)
|
||||
if (old == null) {
|
||||
throw new BusinessException("该角色不存在");
|
||||
}
|
||||
//检查编码
|
||||
boolean b = uniqueCode(sysRole.getCode(), id);
|
||||
if (!b)
|
||||
if (!b) {
|
||||
throw new BusinessException("该编码已存在");
|
||||
}
|
||||
old.setModifiedTime(new Date());
|
||||
old.setName(sysRole.getName());
|
||||
old.setCode(sysRole.getCode());
|
||||
@@ -129,10 +134,11 @@ public class SysRoleService {
|
||||
* @return
|
||||
*/
|
||||
public List<SysRole> listAllByEnable(String enable) {
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
return sysRoleRepository.getByEnable(enable);
|
||||
else
|
||||
} else {
|
||||
return sysRoleRepository.findAll();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -146,15 +152,18 @@ public class SysRoleService {
|
||||
List<SysRole> list = new ArrayList<>();
|
||||
//从用户角色表中获取所有该用户id的角色
|
||||
List<SysUserRole> sysUserRoles = sysUserRoleService.listByUserId(userId);
|
||||
if (sysUserRoles == null)
|
||||
if (sysUserRoles == null) {
|
||||
return list;
|
||||
}
|
||||
//根据角色id获取对应角色列表
|
||||
List<String> roleIds = sysUserRoles.stream().map(SysUserRole::getRoleId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(roleIds))
|
||||
if (StringUtils.isNotEmpty(enable))
|
||||
if (CollectionUtils.isNotEmpty(roleIds)) {
|
||||
if (StringUtils.isNotEmpty(enable)) {
|
||||
list = sysRoleRepository.getByEnableAndIdIn(enable, roleIds);
|
||||
else
|
||||
} else {
|
||||
list = sysRoleRepository.getByIdIn(roleIds);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -166,8 +175,9 @@ public class SysRoleService {
|
||||
* @return
|
||||
*/
|
||||
private boolean uniqueCode(String code, String id) {
|
||||
if (StringUtils.isEmpty(code))
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
throw new BusinessException("code不能为空");
|
||||
}
|
||||
SysRole one = sysRoleRepository.getByCode(code);
|
||||
return one == null || StringUtils.isNotEmpty(id) && id.equals(one.getId());
|
||||
}
|
||||
|
||||
@@ -172,8 +172,9 @@ public class SysUserService {
|
||||
sysUser.setSexName(sexEnum.getName());
|
||||
sysUser.setCreate(DateUtil2.dateToStr(sysUser.getCreateTime(), DateUtil2.YYYY_MM_DD_HH_MM_SS));
|
||||
Date modifiedTime = sysUser.getModifiedTime();
|
||||
if (modifiedTime != null)
|
||||
if (modifiedTime != null) {
|
||||
sysUser.setModified(DateUtil2.dateToStr(sysUser.getModifiedTime(), DateUtil2.YYYY_MM_DD_HH_MM_SS));
|
||||
}
|
||||
});
|
||||
}
|
||||
return all;
|
||||
@@ -188,10 +189,12 @@ public class SysUserService {
|
||||
public RestMessage resetPassWord(String id) {
|
||||
RestMessage result = new RestMessage();
|
||||
SysUser old = getById(id);
|
||||
if (old == null)
|
||||
if (old == null) {
|
||||
throw new BusinessException("未查询到用户信息");
|
||||
if (CommonDataUtil.getToken(CommonConstant.CURRENT_USER_ID).equals(id))
|
||||
}
|
||||
if (CommonDataUtil.getToken(CommonConstant.CURRENT_USER_ID).equals(id)) {
|
||||
throw new BusinessException("不能重置当前登录用户");
|
||||
}
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equals(old.getAdmin())) {
|
||||
throw new BusinessException("管理员密码不能重置");
|
||||
}
|
||||
@@ -201,11 +204,13 @@ public class SysUserService {
|
||||
old.setPassword(str[2]);
|
||||
old.setModifiedTime(new Date());
|
||||
SysUser save = sysUserRepository.save(old);
|
||||
if (save == null)
|
||||
if (save == null) {
|
||||
throw new BusinessException("重置密码失败");
|
||||
}
|
||||
boolean send = sendEmail(old, str[0]);
|
||||
if (!send)
|
||||
if (!send) {
|
||||
throw new BusinessException("发送密码邮件错误");
|
||||
}
|
||||
result.setSuccess(true);
|
||||
result.setMessage("重置密码成功");
|
||||
return result;
|
||||
@@ -221,11 +226,13 @@ public class SysUserService {
|
||||
public RestMessage updatePassWord(String newPassWord, String oldPassWord, String id) {
|
||||
RestMessage result = new RestMessage();
|
||||
SysUser sysUser = getById(id);
|
||||
if (sysUser == null)
|
||||
if (sysUser == null) {
|
||||
throw new BusinessException("该用户不存在");
|
||||
}
|
||||
boolean flag = checkPassWord(oldPassWord, sysUser.getPassword(), sysUser.getSalt());
|
||||
if (!flag)
|
||||
if (!flag) {
|
||||
throw new BusinessException("原密码错误,请重新输入");
|
||||
}
|
||||
//生成密码
|
||||
String[] str = PassWordUtil.getUserSecret(newPassWord, null);
|
||||
sysUser.setSalt(str[1]);
|
||||
@@ -258,11 +265,13 @@ public class SysUserService {
|
||||
}
|
||||
//验证账号,密码
|
||||
SysUser user = getByUserName(userName);
|
||||
if (user == null)
|
||||
if (user == null) {
|
||||
throw new BusinessException("账号错误");
|
||||
}
|
||||
boolean flag = checkPassWord(passWord, user.getPassword(), user.getSalt());
|
||||
if (!flag)
|
||||
if (!flag) {
|
||||
throw new BusinessException("密码错误");
|
||||
}
|
||||
//保存登录数据
|
||||
CommonDataUtil.setToken(CommonConstant.CURRENT_USER, userName);
|
||||
CommonDataUtil.setToken(CommonConstant.CURRENT_USER_ID, user.getId());
|
||||
@@ -273,8 +282,9 @@ public class SysUserService {
|
||||
loginInOut.setInoutType(CommonEnum.LoginInOutEnum.IN.getValue());
|
||||
loginInOut.setIp(IpUtil.getIpAddr(request));
|
||||
RestMessage save = loginInOutService.save(loginInOut);
|
||||
if (!save.isSuccess())
|
||||
if (!save.isSuccess()) {
|
||||
throw new BusinessException("保存用户登录日志失败");
|
||||
}
|
||||
restMessage.setSuccess(true);
|
||||
restMessage.setMessage("登录成功");
|
||||
return restMessage;
|
||||
@@ -322,16 +332,18 @@ public class SysUserService {
|
||||
List<SysAuthority> list = new ArrayList<>();
|
||||
//根据用戶id和是否启用获取获取角色
|
||||
List<SysRole> sysRoles = sysRoleService.listByUserIdEnable(userId, enable);
|
||||
if (CollectionUtils.isEmpty(sysRoles))
|
||||
if (CollectionUtils.isEmpty(sysRoles)) {
|
||||
return list;
|
||||
}
|
||||
//遍历获取每个角色拥有的权限,并去重
|
||||
List<SysAuthority> temp;
|
||||
for (SysRole sysRole : sysRoles) {
|
||||
temp = sysAuthorityService.listByRoleIdEnable(sysRole.getId(), enable);
|
||||
if (CollectionUtils.isNotEmpty(temp)) {
|
||||
for (SysAuthority auth : temp) {
|
||||
if (list.contains(auth))
|
||||
if (list.contains(auth)) {
|
||||
continue;// 如果存在,那么去除
|
||||
}
|
||||
list.add(auth);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,8 +109,9 @@ public class EmailUtil {
|
||||
StringBuffer toList = new StringBuffer();
|
||||
if (toEmailArray != null && toEmailArray.length > 0) {
|
||||
for (int i = 0; i < toEmailArray.length; i++) {
|
||||
if (toList.length() > 0)
|
||||
if (toList.length() > 0) {
|
||||
toList.append(",");
|
||||
}
|
||||
toList.append(toEmailArray[i]);
|
||||
}
|
||||
return toList.toString();
|
||||
|
||||
@@ -32,8 +32,9 @@ public class JSONObjResult {
|
||||
public static JSONObject toJSONObj(Object o, String message) {
|
||||
JSONObjResult jsonObjResult = new JSONObjResult();
|
||||
jsonObjResult.setSuccess(true);
|
||||
if (StringUtils.isNotEmpty(message))
|
||||
if (StringUtils.isNotEmpty(message)) {
|
||||
jsonObjResult.setMessage(message);
|
||||
}
|
||||
jsonObjResult.setData(JSONUtil.beanToMap(o));
|
||||
return JSON.parseObject(JSON.toJSONString(jsonObjResult, SerializerFeature.WriteMapNullValue));
|
||||
}
|
||||
|
||||
@@ -26,10 +26,12 @@ public class JSONUtil {
|
||||
* @return
|
||||
*/
|
||||
public static Object beanToMap(Object obj) {
|
||||
if (obj == null)
|
||||
if (obj == null) {
|
||||
return null;
|
||||
if (obj instanceof String)
|
||||
}
|
||||
if (obj instanceof String) {
|
||||
return obj;
|
||||
}
|
||||
if (obj instanceof JSONObject) {
|
||||
return obj;
|
||||
} else if (obj instanceof Map) {
|
||||
|
||||
@@ -34,15 +34,17 @@ public class PassWordUtil {
|
||||
*/
|
||||
public static String[] getUserSecret(String password, String pwdSalt) {
|
||||
String[] str = new String[3];
|
||||
if (StringUtils.isEmpty(password))
|
||||
if (StringUtils.isEmpty(password)) {
|
||||
password = RadomUtil.buildRandom(PWD_LENGTH);
|
||||
}
|
||||
// 密码盐值
|
||||
byte[] salt;
|
||||
// 密码盐值 如果是为空,那么随机获取;不为空,解析pwdSalt
|
||||
if (StringUtils.isEmpty(pwdSalt)) {
|
||||
salt = Digests.generateSalt(SALT_SIZE);
|
||||
} else
|
||||
} else {
|
||||
salt = EncodeUtils.hexDecode(pwdSalt);
|
||||
}
|
||||
// 密码加密
|
||||
byte[] hashPassword = Digests.sha1(password.getBytes(), salt,
|
||||
HASH_INTERATIONS);
|
||||
|
||||
@@ -46,8 +46,9 @@ public class PingUtil {
|
||||
Process pro = Runtime.getRuntime().exec("ping " + ipAddress);
|
||||
//根据操作系统修改字符,否则乱码(windows:gbk,linux:utf-8)
|
||||
BufferedReader buf = new BufferedReader(new InputStreamReader(pro.getInputStream(), "gbk"));
|
||||
while ((line = buf.readLine()) != null)
|
||||
while ((line = buf.readLine()) != null) {
|
||||
System.out.println(line);
|
||||
}
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
LOGGER.error(ex.getMessage());
|
||||
|
||||
@@ -10,8 +10,9 @@ import java.util.Random;
|
||||
*/
|
||||
public class RadomUtil {
|
||||
public static String buildRandom(int length) {
|
||||
if (length < 1)
|
||||
if (length < 1) {
|
||||
throw new UtilException("参数异常!!!");
|
||||
}
|
||||
Random random = new Random();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
|
||||
@@ -57,10 +57,12 @@ public class CaptchaUtil {
|
||||
* 给定范围获得随机颜色
|
||||
*/
|
||||
private Color getRandColor(int fc, int bc) {
|
||||
if (fc > 255)
|
||||
if (fc > 255) {
|
||||
fc = 255;
|
||||
if (bc > 255)
|
||||
}
|
||||
if (bc > 255) {
|
||||
bc = 255;
|
||||
}
|
||||
int r = fc + random.nextInt(bc - fc);
|
||||
int g = fc + random.nextInt(bc - fc);
|
||||
int b = fc + random.nextInt(bc - fc);
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.xwbing.annotation.LogInfo;
|
||||
import com.xwbing.domain.entity.ExpressInfo;
|
||||
import com.xwbing.domain.entity.vo.ExpressInfoVo;
|
||||
import com.xwbing.exception.BusinessException;
|
||||
import com.xwbing.redis.RedisService;
|
||||
import com.xwbing.service.other.CookieSessionService;
|
||||
import com.xwbing.service.other.ExpressDeliveryService;
|
||||
@@ -71,8 +70,9 @@ public class TestControl {
|
||||
@LogInfo("快递查询")
|
||||
@PostMapping("expressInfo")
|
||||
public JSONObject getExpressInfo(@RequestBody ExpressInfo info) {
|
||||
if (StringUtils.isEmpty(info.getLogisticCode()) || StringUtils.isEmpty(info.getShipperCode()))
|
||||
if (StringUtils.isEmpty(info.getLogisticCode()) || StringUtils.isEmpty(info.getShipperCode())) {
|
||||
return JSONObjResult.toJSONObj("快递公司或物流单号不能为空");
|
||||
}
|
||||
ExpressInfoVo infoVo = expressDeliveryService.queryOrderTraces(info);
|
||||
return JSONObjResult.toJSONObj(infoVo, "查询快递信息成功");
|
||||
}
|
||||
@@ -87,8 +87,9 @@ public class TestControl {
|
||||
@LogInfo("解析二维码")
|
||||
@GetMapping("decode")
|
||||
public JSONObject decode(@RequestParam String path) {
|
||||
if (StringUtils.isEmpty(path))
|
||||
if (StringUtils.isEmpty(path)) {
|
||||
return JSONObjResult.toJSONObj("二维码图片路径不能为空");
|
||||
}
|
||||
File file = new File(path);
|
||||
RestMessage decode = qrCodeZipService.decode(file);
|
||||
return JSONObjResult.toJSONObj(decode);
|
||||
@@ -97,8 +98,9 @@ public class TestControl {
|
||||
@LogInfo("导出zip")
|
||||
@GetMapping("batchGetImage")
|
||||
public JSONObject batchGetImage(HttpServletResponse response, @RequestParam String[] names, @RequestParam String fileName) {
|
||||
if (StringUtils.isEmpty(fileName))
|
||||
if (StringUtils.isEmpty(fileName)) {
|
||||
return JSONObjResult.toJSONObj("zip名称不能为空");
|
||||
}
|
||||
RestMessage restMessage = qrCodeZipService.batchGetImage(response, names, fileName);
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
@@ -153,8 +155,9 @@ public class TestControl {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//出现异常,异常会被限制在执行任务的线程范围内
|
||||
if (1 == 1)
|
||||
if (1 == 1) {
|
||||
throw new RuntimeException("545456");
|
||||
}
|
||||
return "world";
|
||||
}), (s1, s2) -> {
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
@@ -45,8 +45,9 @@ public class DataDictionaryControl {
|
||||
@PostMapping("update")
|
||||
@ApiOperation(value = "修改字典", response = RestMessageVo.class)
|
||||
public JSONObject update(@RequestBody DataDictionary dictionary) {
|
||||
if (StringUtils.isEmpty(dictionary.getId()))
|
||||
if (StringUtils.isEmpty(dictionary.getId())) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = dataDictionaryService.update(dictionary);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -55,11 +56,13 @@ public class DataDictionaryControl {
|
||||
@ApiOperation(value = "获取字典详情", response = DataDictionaryVo.class)
|
||||
@GetMapping("getById")
|
||||
public JSONObject getById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
DataDictionary dataDictionary = dataDictionaryService.getById(id);
|
||||
if (dataDictionary == null)
|
||||
if (dataDictionary == null) {
|
||||
return JSONObjResult.toJSONObj("该字典不存在");
|
||||
}
|
||||
return JSONObjResult.toJSONObj(dataDictionary, "");
|
||||
}
|
||||
|
||||
@@ -70,8 +73,9 @@ public class DataDictionaryControl {
|
||||
public JSONObject uniqueCode(@RequestParam String code, String id) {
|
||||
boolean b = dataDictionaryService.uniqueCode(code, id);
|
||||
RestMessage result = new RestMessage();
|
||||
if (b)
|
||||
if (b) {
|
||||
result.setSuccess(true);
|
||||
}
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
|
||||
@@ -83,8 +87,9 @@ public class DataDictionaryControl {
|
||||
})
|
||||
@PostMapping("findListByParent")
|
||||
public JSONObject findListByParent(String enable, String parentId) {
|
||||
if (StringUtils.isEmpty(parentId))
|
||||
if (StringUtils.isEmpty(parentId)) {
|
||||
parentId = CommonConstant.ROOT;
|
||||
}
|
||||
List<DataDictionary> listByParent = dataDictionaryService.findListByParent(parentId, enable);
|
||||
return JSONObjResult.toJSONObj(listByParent, "");
|
||||
}
|
||||
@@ -94,8 +99,9 @@ public class DataDictionaryControl {
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式为Y|N", paramType = "query", dataType = "string")
|
||||
@PostMapping("findListByCode")
|
||||
public JSONObject findListByCode(@RequestParam String code, String enable) {
|
||||
if (StringUtils.isEmpty(code))
|
||||
if (StringUtils.isEmpty(code)) {
|
||||
return JSONObjResult.toJSONObj("编码不能为空");
|
||||
}
|
||||
List<DataDictionary> listByParent = dataDictionaryService.findListByCode(code, enable);
|
||||
return JSONObjResult.toJSONObj(listByParent, "");
|
||||
}
|
||||
|
||||
@@ -43,8 +43,9 @@ public class SysAuthorityControl {
|
||||
public JSONObject save(@RequestBody SysAuthority sysAuthority) {
|
||||
RestMessage save = sysAuthorityService.save(sysAuthority);
|
||||
//删除缓存
|
||||
if (save.isSuccess())
|
||||
if (save.isSuccess()) {
|
||||
redisService.del(CommonConstant.AUTHORITY_THREE);
|
||||
}
|
||||
return JSONObjResult.toJSONObj(save);
|
||||
}
|
||||
|
||||
@@ -52,12 +53,14 @@ public class SysAuthorityControl {
|
||||
@ApiOperation(value = "删除权限", response = RestMessageVo.class)
|
||||
@GetMapping("removeById")
|
||||
public JSONObject removeById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysAuthorityService.removeById(id);
|
||||
//删除缓存
|
||||
if (result.isSuccess())
|
||||
if (result.isSuccess()) {
|
||||
redisService.del(CommonConstant.AUTHORITY_THREE);
|
||||
}
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
|
||||
@@ -65,8 +68,9 @@ public class SysAuthorityControl {
|
||||
@ApiOperation(value = "修改权限", response = RestMessageVo.class)
|
||||
@PostMapping("update")
|
||||
public JSONObject update(@RequestBody SysAuthority sysAuthority) {
|
||||
if (StringUtils.isEmpty(sysAuthority.getId()))
|
||||
if (StringUtils.isEmpty(sysAuthority.getId())) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
String enable = sysAuthority.getEnable();
|
||||
// 如果禁用,查询是否有子节点,如果有,子节点也要被禁用
|
||||
if (CommonConstant.IS_NOT_ENABLE.equals(enable)) {
|
||||
@@ -78,14 +82,16 @@ public class SysAuthorityControl {
|
||||
// 如果是启用,看父节点是否被禁用,一级的不需要判断
|
||||
if (!CommonConstant.ROOT.equals(sysAuthority.getParentId())) {
|
||||
SysAuthority parent = sysAuthorityService.getById(sysAuthority.getParentId());
|
||||
if (parent != null && CommonEnum.YesOrNoEnum.NO.getCode().equals(parent.getEnable()))
|
||||
if (parent != null && CommonEnum.YesOrNoEnum.NO.getCode().equals(parent.getEnable())) {
|
||||
return JSONObjResult.toJSONObj("父节点已被禁用,请先启用父节点");
|
||||
}
|
||||
}
|
||||
}
|
||||
RestMessage result = sysAuthorityService.update(sysAuthority);
|
||||
//删除缓存
|
||||
if (result.isSuccess())
|
||||
if (result.isSuccess()) {
|
||||
redisService.del(CommonConstant.AUTHORITY_THREE);
|
||||
}
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
|
||||
@@ -103,10 +109,12 @@ public class SysAuthorityControl {
|
||||
@ApiOperation(value = "根据父节点查询子节点", response = ListSysAuthorityVo.class)
|
||||
@ApiImplicitParam(name = "parentId", value = "父id,可为空", paramType = "query", dataType = "string")
|
||||
public JSONObject listByParentId(String parentId) {
|
||||
if (StringUtils.isEmpty(parentId))
|
||||
if (StringUtils.isEmpty(parentId)) {
|
||||
parentId = CommonConstant.ROOT;
|
||||
if (!CommonConstant.ROOT.equals(parentId) && sysAuthorityService.getById(parentId) == null)
|
||||
}
|
||||
if (!CommonConstant.ROOT.equals(parentId) && sysAuthorityService.getById(parentId) == null) {
|
||||
return JSONObjResult.toJSONObj("父节点不存在");
|
||||
}
|
||||
List<SysAuthority> queryByParentId = sysAuthorityService.listByParentEnable(parentId, null);
|
||||
return JSONObjResult.toJSONObj(queryByParentId, "");
|
||||
}
|
||||
|
||||
@@ -77,8 +77,9 @@ public class SysConfigControl {
|
||||
public JSONObject update(SysConfig sysConfig) {
|
||||
String logMsg = "修改系统配置信息";
|
||||
logger.info(logMsg);
|
||||
if (StringUtils.isEmpty(sysConfig.getCode()))
|
||||
if (StringUtils.isEmpty(sysConfig.getCode())) {
|
||||
return JSONObjResult.toJSONObj("配置项的code不能为空");
|
||||
}
|
||||
RestMessage result = sysConfigService.update(sysConfig);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,9 @@ public class SysRoleControl {
|
||||
@ApiOperation(value = "删除角色", response = RestMessageVo.class)
|
||||
@GetMapping("removeById")
|
||||
public JSONObject removeById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysRoleService.removeById(id);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -62,8 +63,9 @@ public class SysRoleControl {
|
||||
@ApiOperation(value = "修改角色", response = RestMessageVo.class)
|
||||
@PostMapping("update")
|
||||
public JSONObject update(@RequestBody SysRole sysRole) {
|
||||
if (StringUtils.isEmpty(sysRole.getId()))
|
||||
if (StringUtils.isEmpty(sysRole.getId())) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysRoleService.update(sysRole);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -72,11 +74,13 @@ public class SysRoleControl {
|
||||
@ApiOperation(value = "获取角色详情", response = SysRoleVo.class)
|
||||
@GetMapping("getById")
|
||||
public JSONObject getById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
SysRole sysRole = sysRoleService.getById(id);
|
||||
if (sysRole == null)
|
||||
if (sysRole == null) {
|
||||
return JSONObjResult.toJSONObj("该角色不存在");
|
||||
}
|
||||
return JSONObjResult.toJSONObj(sysRole, "");
|
||||
}
|
||||
|
||||
@@ -94,11 +98,13 @@ public class SysRoleControl {
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@PostMapping("listAuthorityByRoleId")
|
||||
public JSONObject listAuthorityByRoleId(@RequestParam String roleId, String enable) {
|
||||
if (StringUtils.isEmpty(roleId))
|
||||
if (StringUtils.isEmpty(roleId)) {
|
||||
return JSONObjResult.toJSONObj("角色主键不能为空");
|
||||
}
|
||||
SysRole sysRole = sysRoleService.getById(roleId);
|
||||
if (sysRole == null)
|
||||
if (sysRole == null) {
|
||||
return JSONObjResult.toJSONObj("该角色不存在");
|
||||
}
|
||||
List<SysAuthority> authoritys = sysAuthorityService.listByRoleIdEnable(roleId, enable);
|
||||
return JSONObjResult.toJSONObj(authoritys, "");
|
||||
}
|
||||
@@ -107,13 +113,16 @@ public class SysRoleControl {
|
||||
@ApiOperation(value = "保存角色权限", response = RestMessageVo.class)
|
||||
@PostMapping("saveAuthority")
|
||||
public JSONObject saveAuthority(@RequestParam String authorityIds, @RequestParam String roleId) {
|
||||
if (StringUtils.isEmpty(authorityIds))
|
||||
if (StringUtils.isEmpty(authorityIds)) {
|
||||
return JSONObjResult.toJSONObj("权限主键集合不能为空");
|
||||
if (StringUtils.isEmpty(roleId))
|
||||
}
|
||||
if (StringUtils.isEmpty(roleId)) {
|
||||
return JSONObjResult.toJSONObj("角色主键不能为空");
|
||||
}
|
||||
SysRole sysRole = sysRoleService.getById(roleId);
|
||||
if (sysRole == null)
|
||||
if (sysRole == null) {
|
||||
return JSONObjResult.toJSONObj("该角色不存在");
|
||||
}
|
||||
String ids[] = authorityIds.split(",");
|
||||
List<SysRoleAuthority> list = new ArrayList<>();
|
||||
SysRoleAuthority roleAuthority;
|
||||
|
||||
@@ -61,8 +61,9 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "删除用户", response = RestMessageVo.class)
|
||||
@GetMapping("removeById")
|
||||
public JSONObject removeById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysUserService.removeById(id);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -71,8 +72,9 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "修改用户信息", response = RestMessageVo.class)
|
||||
@PostMapping("update")
|
||||
public JSONObject update(@RequestBody @Valid SysUser sysUser) {
|
||||
if (StringUtils.isEmpty(sysUser.getId()))
|
||||
if (StringUtils.isEmpty(sysUser.getId())) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage result = sysUserService.update(sysUser);
|
||||
return JSONObjResult.toJSONObj(result);
|
||||
}
|
||||
@@ -81,11 +83,13 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "获取用户详情", response = SysUserVo.class)
|
||||
@GetMapping("getById")
|
||||
public JSONObject getById(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
SysUser sysUser = sysUserService.getById(id);
|
||||
if (sysUser == null)
|
||||
if (sysUser == null) {
|
||||
return JSONObjResult.toJSONObj("未查到该对象");
|
||||
}
|
||||
return JSONObjResult.toJSONObj(sysUser, "");
|
||||
}
|
||||
|
||||
@@ -101,10 +105,12 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "登录", response = RestMessageVo.class)
|
||||
@PostMapping("login")
|
||||
public JSONObject login(HttpServletRequest request, @RequestParam String userName, @RequestParam String passWord, @RequestParam String checkCode) {
|
||||
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(passWord))
|
||||
if (StringUtils.isEmpty(userName) || StringUtils.isEmpty(passWord)) {
|
||||
return JSONObjResult.toJSONObj("用户名或密码不能为空");
|
||||
if (StringUtils.isEmpty(checkCode))
|
||||
}
|
||||
if (StringUtils.isEmpty(checkCode)) {
|
||||
return JSONObjResult.toJSONObj("请输入验证码");
|
||||
}
|
||||
RestMessage login = sysUserService.login(request, userName, passWord, checkCode);
|
||||
return JSONObjResult.toJSONObj(login);
|
||||
}
|
||||
@@ -121,10 +127,12 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "修改密码", response = RestMessageVo.class)
|
||||
@PostMapping("updatePassWord")
|
||||
public JSONObject updatePassWord(@RequestParam String newPassWord, @RequestParam String oldPassWord, @RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
if (StringUtils.isEmpty(newPassWord) || StringUtils.isEmpty(oldPassWord))
|
||||
}
|
||||
if (StringUtils.isEmpty(newPassWord) || StringUtils.isEmpty(oldPassWord)) {
|
||||
return JSONObjResult.toJSONObj("原密码或新密码不能为空");
|
||||
}
|
||||
RestMessage restMessage = sysUserService.updatePassWord(newPassWord, oldPassWord, id);
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
@@ -133,8 +141,9 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "重置密码", response = RestMessageVo.class)
|
||||
@GetMapping("resetPassWord")
|
||||
public JSONObject resetPassWord(@RequestParam String id) {
|
||||
if (StringUtils.isEmpty(id))
|
||||
if (StringUtils.isEmpty(id)) {
|
||||
return JSONObjResult.toJSONObj("主键不能为空");
|
||||
}
|
||||
RestMessage restMessage = sysUserService.resetPassWord(id);
|
||||
return JSONObjResult.toJSONObj(restMessage);
|
||||
}
|
||||
@@ -144,21 +153,24 @@ public class SysUserControl {
|
||||
@GetMapping("getLoginUserInfo")
|
||||
public JSONObject getLoginUserInfo() {
|
||||
SysUser sysUser = sysUserService.getById((String) CommonDataUtil.getToken(CommonConstant.CURRENT_USER_ID));
|
||||
if (sysUser == null)
|
||||
if (sysUser == null) {
|
||||
return JSONObjResult.toJSONObj("未获取到当前登录用户信息");
|
||||
}
|
||||
List<SysAuthority> button = new ArrayList<>();
|
||||
List<SysAuthority> menu = new ArrayList<>();
|
||||
List<SysAuthority> list;
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(sysUser.getAdmin()))
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(sysUser.getAdmin())) {
|
||||
list = sysAuthorityService.listByEnable(CommonEnum.YesOrNoEnum.YES.getCode());
|
||||
else
|
||||
} else {
|
||||
list = sysUserService.listAuthorityByIdAndEnable(sysUser.getId(), CommonEnum.YesOrNoEnum.YES.getCode());
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
for (SysAuthority sysAuthority : list) {
|
||||
if (sysAuthority.getType() == CommonEnum.MenuOrButtonEnum.MENU.getCode())
|
||||
if (sysAuthority.getType() == CommonEnum.MenuOrButtonEnum.MENU.getCode()) {
|
||||
menu.add(sysAuthority);
|
||||
else
|
||||
} else {
|
||||
button.add(sysAuthority);
|
||||
}
|
||||
}
|
||||
}
|
||||
sysUser.setMenus(menu);
|
||||
@@ -170,15 +182,19 @@ public class SysUserControl {
|
||||
@ApiOperation(value = "保存用户角色", response = RestMessageVo.class)
|
||||
@PostMapping("saveRole")
|
||||
public JSONObject saveRole(@RequestParam String roleIds, @RequestParam String userId) {
|
||||
if (StringUtils.isEmpty(roleIds))
|
||||
if (StringUtils.isEmpty(roleIds)) {
|
||||
return JSONObjResult.toJSONObj("角色主键不能为空");
|
||||
if (StringUtils.isEmpty(userId))
|
||||
}
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return JSONObjResult.toJSONObj("用户主键不能为空");
|
||||
}
|
||||
SysUser old = sysUserService.getById(userId);
|
||||
if (old == null)
|
||||
if (old == null) {
|
||||
return JSONObjResult.toJSONObj("该用户不存在");
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(old.getAdmin()))
|
||||
}
|
||||
if (CommonEnum.YesOrNoEnum.YES.getCode().equalsIgnoreCase(old.getAdmin())) {
|
||||
return JSONObjResult.toJSONObj("不能对管理员进行操作");
|
||||
}
|
||||
String ids[] = roleIds.split(",");
|
||||
List<SysUserRole> list = new ArrayList<>();
|
||||
SysUserRole userRole;
|
||||
@@ -197,8 +213,9 @@ public class SysUserControl {
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@PostMapping("listRoleByUserId")
|
||||
public JSONObject listRoleByUserId(@RequestParam String userId, String enable) {
|
||||
if (StringUtils.isEmpty(userId))
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return JSONObjResult.toJSONObj("用户主键不能为空");
|
||||
}
|
||||
List<SysRole> list = sysRoleService.listByUserIdEnable(userId, enable);
|
||||
return JSONObjResult.toJSONObj(list, "");
|
||||
}
|
||||
@@ -208,8 +225,9 @@ public class SysUserControl {
|
||||
@ApiImplicitParam(name = "enable", value = "是否启用,格式Y|N", paramType = "query", dataType = "string")
|
||||
@PostMapping("listAuthorityByUserId")
|
||||
public JSONObject listAuthorityByUserId(@RequestParam String userId, String enable) {
|
||||
if (StringUtils.isEmpty(userId))
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
return JSONObjResult.toJSONObj("用户主键不能为空");
|
||||
}
|
||||
List<SysAuthority> list = sysUserService.listAuthorityByIdAndEnable(userId, enable);
|
||||
return JSONObjResult.toJSONObj(list, "");
|
||||
}
|
||||
|
||||
@@ -63,8 +63,9 @@ public class GlobalExceptionHandler {
|
||||
String errorMessages = cause.getMessage();
|
||||
logger.error(errorMessages);
|
||||
String detail = cause.toString();
|
||||
if (!detail.contains("BusinessException"))
|
||||
if (!detail.contains("BusinessException")) {
|
||||
errorMessages = "异步获取数据出错";
|
||||
}
|
||||
return JSONObjResult.toJSONObj(errorMessages);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user