优化代码
This commit is contained in:
parent
1268637e58
commit
96ba768f50
|
@ -49,24 +49,15 @@ public class SysUserOnlineController extends BaseController
|
||||||
LoginUser user = redisCache.getCacheObject(key);
|
LoginUser user = redisCache.getCacheObject(key);
|
||||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||||
{
|
{
|
||||||
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(ipaddr))
|
else if (StringUtils.isNotEmpty(ipaddr))
|
||||||
{
|
{
|
||||||
if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||||
{
|
{
|
||||||
if (StringUtils.equals(userName, user.getUsername()))
|
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||||
{
|
|
||||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
@ -84,7 +83,7 @@ public class SysConfigController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (!configService.checkConfigKeyUnique(config))
|
||||||
{
|
{
|
||||||
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
|
@ -100,7 +99,7 @@ public class SysConfigController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
if (!configService.checkConfigKeyUnique(config))
|
||||||
{
|
{
|
||||||
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
return error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class SysDeptController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
if (!deptService.checkDeptNameUnique(dept))
|
||||||
{
|
{
|
||||||
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ public class SysDeptController extends BaseController
|
||||||
{
|
{
|
||||||
Long deptId = dept.getDeptId();
|
Long deptId = dept.getDeptId();
|
||||||
deptService.checkDeptDataScope(deptId);
|
deptService.checkDeptDataScope(deptId);
|
||||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
if (!deptService.checkDeptNameUnique(dept))
|
||||||
{
|
{
|
||||||
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDictType;
|
import com.ruoyi.common.core.domain.entity.SysDictType;
|
||||||
|
@ -72,7 +71,7 @@ public class SysDictTypeController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||||
{
|
{
|
||||||
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
|
@ -88,7 +87,7 @@ public class SysDictTypeController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
if (!dictTypeService.checkDictTypeUnique(dict))
|
||||||
{
|
{
|
||||||
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class SysMenuController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
if (!menuService.checkMenuNameUnique(menu))
|
||||||
{
|
{
|
||||||
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ public class SysMenuController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
if (!menuService.checkMenuNameUnique(menu))
|
||||||
{
|
{
|
||||||
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
return error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.page.TableDataInfo;
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
@ -75,11 +74,11 @@ public class SysPostController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
if (!postService.checkPostNameUnique(post))
|
||||||
{
|
{
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (!postService.checkPostCodeUnique(post))
|
||||||
{
|
{
|
||||||
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
|
@ -95,11 +94,11 @@ public class SysPostController extends BaseController
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
if (!postService.checkPostNameUnique(post))
|
||||||
{
|
{
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
else if (!postService.checkPostCodeUnique(post))
|
||||||
{
|
{
|
||||||
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
return error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.config.RuoYiConfig;
|
import com.ruoyi.common.config.RuoYiConfig;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
|
@ -63,13 +62,11 @@ public class SysProfileController extends BaseController
|
||||||
LoginUser loginUser = getLoginUser();
|
LoginUser loginUser = getLoginUser();
|
||||||
SysUser sysUser = loginUser.getUser();
|
SysUser sysUser = loginUser.getUser();
|
||||||
user.setUserName(sysUser.getUserName());
|
user.setUserName(sysUser.getUserName());
|
||||||
if (StringUtils.isNotEmpty(user.getPhonenumber())
|
if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
if (StringUtils.isNotEmpty(user.getEmail())
|
if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
@ -94,11 +93,11 @@ public class SysRoleController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (!roleService.checkRoleNameUnique(role))
|
||||||
{
|
{
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (!roleService.checkRoleKeyUnique(role))
|
||||||
{
|
{
|
||||||
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
|
@ -117,11 +116,11 @@ public class SysRoleController extends BaseController
|
||||||
{
|
{
|
||||||
roleService.checkRoleAllowed(role);
|
roleService.checkRoleAllowed(role);
|
||||||
roleService.checkRoleDataScope(role.getRoleId());
|
roleService.checkRoleDataScope(role.getRoleId());
|
||||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
if (!roleService.checkRoleNameUnique(role))
|
||||||
{
|
{
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
else if (!roleService.checkRoleKeyUnique(role))
|
||||||
{
|
{
|
||||||
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
return error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import com.ruoyi.common.annotation.Log;
|
import com.ruoyi.common.annotation.Log;
|
||||||
import com.ruoyi.common.constant.UserConstants;
|
|
||||||
import com.ruoyi.common.core.controller.BaseController;
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.core.domain.entity.SysDept;
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
||||||
|
@ -125,17 +124,15 @@ public class SysUserController extends BaseController
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||||
{
|
{
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
if (!userService.checkUserNameUnique(user))
|
||||||
{
|
{
|
||||||
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
return error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
||||||
{
|
{
|
||||||
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
||||||
{
|
{
|
||||||
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
|
@ -154,17 +151,15 @@ public class SysUserController extends BaseController
|
||||||
{
|
{
|
||||||
userService.checkUserAllowed(user);
|
userService.checkUserAllowed(user);
|
||||||
userService.checkUserDataScope(user.getUserId());
|
userService.checkUserDataScope(user.getUserId());
|
||||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user)))
|
if (!userService.checkUserNameUnique(user))
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getPhonenumber())
|
else if (StringUtils.isNotEmpty(user.getPhonenumber()) && !userService.checkPhoneUnique(user))
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||||
}
|
}
|
||||||
else if (StringUtils.isNotEmpty(user.getEmail())
|
else if (StringUtils.isNotEmpty(user.getEmail()) && !userService.checkEmailUnique(user))
|
||||||
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
|
||||||
{
|
{
|
||||||
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
return error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,9 +60,9 @@ public class UserConstants
|
||||||
/** InnerLink组件标识 */
|
/** InnerLink组件标识 */
|
||||||
public final static String INNER_LINK = "InnerLink";
|
public final static String INNER_LINK = "InnerLink";
|
||||||
|
|
||||||
/** 校验返回结果码 */
|
/** 校验是否唯一的返回标识 */
|
||||||
public final static String UNIQUE = "0";
|
public final static boolean UNIQUE = true;
|
||||||
public final static String NOT_UNIQUE = "1";
|
public final static boolean NOT_UNIQUE = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户名长度限制
|
* 用户名长度限制
|
||||||
|
|
|
@ -145,16 +145,20 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 计算两个时间差
|
* 计算时间差(单位:分钟)
|
||||||
|
*
|
||||||
|
* @param endTime 最后时间
|
||||||
|
* @param startTime 开始时间
|
||||||
|
* @return 时间差(天/小时/分钟)
|
||||||
*/
|
*/
|
||||||
public static String getDatePoor(Date endDate, Date nowDate)
|
public static String timeDistance(Date endDate, Date startTime)
|
||||||
{
|
{
|
||||||
long nd = 1000 * 24 * 60 * 60;
|
long nd = 1000 * 24 * 60 * 60;
|
||||||
long nh = 1000 * 60 * 60;
|
long nh = 1000 * 60 * 60;
|
||||||
long nm = 1000 * 60;
|
long nm = 1000 * 60;
|
||||||
// long ns = 1000;
|
// long ns = 1000;
|
||||||
// 获得两个时间的毫秒时间差异
|
// 获得两个时间的毫秒时间差异
|
||||||
long diff = endDate.getTime() - nowDate.getTime();
|
long diff = endDate.getTime() - startTime.getTime();
|
||||||
// 计算差多少天
|
// 计算差多少天
|
||||||
long day = diff / nd;
|
long day = diff / nd;
|
||||||
// 计算差多少小时
|
// 计算差多少小时
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ public class ExcelUtil<T>
|
||||||
*/
|
*/
|
||||||
public String encodingFilename(String filename)
|
public String encodingFilename(String filename)
|
||||||
{
|
{
|
||||||
filename = UUID.randomUUID().toString() + "_" + filename + ".xlsx";
|
filename = UUID.randomUUID() + "_" + filename + ".xlsx";
|
||||||
return filename;
|
return filename;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1598,7 +1598,7 @@ public class ExcelUtil<T>
|
||||||
HSSFPicture pic = (HSSFPicture) shape;
|
HSSFPicture pic = (HSSFPicture) shape;
|
||||||
int pictureIndex = pic.getPictureIndex() - 1;
|
int pictureIndex = pic.getPictureIndex() - 1;
|
||||||
HSSFPictureData picData = pictures.get(pictureIndex);
|
HSSFPictureData picData = pictures.get(pictureIndex);
|
||||||
String picIndex = String.valueOf(anchor.getRow1()) + "_" + String.valueOf(anchor.getCol1());
|
String picIndex = anchor.getRow1() + "_" + anchor.getCol1();
|
||||||
sheetIndexPicMap.put(picIndex, picData);
|
sheetIndexPicMap.put(picIndex, picData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ public class Seq
|
||||||
private static AtomicInteger uploadSeq = new AtomicInteger(1);
|
private static AtomicInteger uploadSeq = new AtomicInteger(1);
|
||||||
|
|
||||||
// 机器标识
|
// 机器标识
|
||||||
private static String machineCode = "A";
|
private static final String machineCode = "A";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取通用序列号
|
* 获取通用序列号
|
||||||
|
|
|
@ -117,7 +117,7 @@ public class Jvm
|
||||||
*/
|
*/
|
||||||
public String getRunTime()
|
public String getRunTime()
|
||||||
{
|
{
|
||||||
return DateUtils.getDatePoor(DateUtils.getNowDate(), DateUtils.getServerStartDate());
|
return DateUtils.timeDistance(DateUtils.getNowDate(), DateUtils.getServerStartDate());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class SysRegisterService
|
||||||
{
|
{
|
||||||
msg = "密码长度必须在5到20个字符之间";
|
msg = "密码长度必须在5到20个字符之间";
|
||||||
}
|
}
|
||||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(sysUser)))
|
else if (!userService.checkUserNameUnique(sysUser))
|
||||||
{
|
{
|
||||||
msg = "保存用户'" + username + "'失败,注册账号已存在";
|
msg = "保存用户'" + username + "'失败,注册账号已存在";
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,5 +85,5 @@ public interface ISysConfigService
|
||||||
* @param config 参数信息
|
* @param config 参数信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkConfigKeyUnique(SysConfig config);
|
public boolean checkConfigKeyUnique(SysConfig config);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,7 +89,7 @@ public interface ISysDeptService
|
||||||
* @param dept 部门信息
|
* @param dept 部门信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkDeptNameUnique(SysDept dept);
|
public boolean checkDeptNameUnique(SysDept dept);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验部门是否有数据权限
|
* 校验部门是否有数据权限
|
||||||
|
|
|
@ -94,5 +94,5 @@ public interface ISysDictTypeService
|
||||||
* @param dictType 字典类型
|
* @param dictType 字典类型
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkDictTypeUnique(SysDictType dictType);
|
public boolean checkDictTypeUnique(SysDictType dictType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,5 +140,5 @@ public interface ISysMenuService
|
||||||
* @param menu 菜单信息
|
* @param menu 菜单信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkMenuNameUnique(SysMenu menu);
|
public boolean checkMenuNameUnique(SysMenu menu);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public interface ISysPostService
|
||||||
* @param post 岗位信息
|
* @param post 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkPostNameUnique(SysPost post);
|
public boolean checkPostNameUnique(SysPost post);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验岗位编码
|
* 校验岗位编码
|
||||||
|
@ -55,7 +55,7 @@ public interface ISysPostService
|
||||||
* @param post 岗位信息
|
* @param post 岗位信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkPostCodeUnique(SysPost post);
|
public boolean checkPostCodeUnique(SysPost post);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过岗位ID查询岗位使用数量
|
* 通过岗位ID查询岗位使用数量
|
||||||
|
|
|
@ -65,7 +65,7 @@ public interface ISysRoleService
|
||||||
* @param role 角色信息
|
* @param role 角色信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkRoleNameUnique(SysRole role);
|
public boolean checkRoleNameUnique(SysRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色权限是否唯一
|
* 校验角色权限是否唯一
|
||||||
|
@ -73,7 +73,7 @@ public interface ISysRoleService
|
||||||
* @param role 角色信息
|
* @param role 角色信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkRoleKeyUnique(SysRole role);
|
public boolean checkRoleKeyUnique(SysRole role);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验角色是否允许操作
|
* 校验角色是否允许操作
|
||||||
|
|
|
@ -72,7 +72,7 @@ public interface ISysUserService
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkUserNameUnique(SysUser user);
|
public boolean checkUserNameUnique(SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验手机号码是否唯一
|
* 校验手机号码是否唯一
|
||||||
|
@ -80,7 +80,7 @@ public interface ISysUserService
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkPhoneUnique(SysUser user);
|
public boolean checkPhoneUnique(SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验email是否唯一
|
* 校验email是否唯一
|
||||||
|
@ -88,7 +88,7 @@ public interface ISysUserService
|
||||||
* @param user 用户信息
|
* @param user 用户信息
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public String checkEmailUnique(SysUser user);
|
public boolean checkEmailUnique(SysUser user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户是否允许操作
|
* 校验用户是否允许操作
|
||||||
|
|
|
@ -208,7 +208,7 @@ public class SysConfigServiceImpl implements ISysConfigService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkConfigKeyUnique(SysConfig config)
|
public boolean checkConfigKeyUnique(SysConfig config)
|
||||||
{
|
{
|
||||||
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
Long configId = StringUtils.isNull(config.getConfigId()) ? -1L : config.getConfigId();
|
||||||
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
SysConfig info = configMapper.checkConfigKeyUnique(config.getConfigKey());
|
||||||
|
|
|
@ -171,7 +171,7 @@ public class SysDeptServiceImpl implements ISysDeptService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkDeptNameUnique(SysDept dept)
|
public boolean checkDeptNameUnique(SysDept dept)
|
||||||
{
|
{
|
||||||
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
||||||
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
||||||
|
|
|
@ -210,7 +210,7 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkDictTypeUnique(SysDictType dict)
|
public boolean checkDictTypeUnique(SysDictType dict)
|
||||||
{
|
{
|
||||||
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
Long dictId = StringUtils.isNull(dict.getDictId()) ? -1L : dict.getDictId();
|
||||||
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
SysDictType dictType = dictTypeMapper.checkDictTypeUnique(dict.getDictType());
|
||||||
|
|
|
@ -175,7 +175,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
router.setQuery(menu.getQuery());
|
router.setQuery(menu.getQuery());
|
||||||
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
router.setMeta(new MetaVo(menu.getMenuName(), menu.getIcon(), StringUtils.equals("1", menu.getIsCache()), menu.getPath()));
|
||||||
List<SysMenu> cMenus = menu.getChildren();
|
List<SysMenu> cMenus = menu.getChildren();
|
||||||
if (!cMenus.isEmpty() && cMenus.size() > 0 && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
if (StringUtils.isNotEmpty(cMenus) && UserConstants.TYPE_DIR.equals(menu.getMenuType()))
|
||||||
{
|
{
|
||||||
router.setAlwaysShow(true);
|
router.setAlwaysShow(true);
|
||||||
router.setRedirect("noRedirect");
|
router.setRedirect("noRedirect");
|
||||||
|
@ -335,7 +335,7 @@ public class SysMenuServiceImpl implements ISysMenuService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkMenuNameUnique(SysMenu menu)
|
public boolean checkMenuNameUnique(SysMenu menu)
|
||||||
{
|
{
|
||||||
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
Long menuId = StringUtils.isNull(menu.getMenuId()) ? -1L : menu.getMenuId();
|
||||||
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
SysMenu info = menuMapper.checkMenuNameUnique(menu.getMenuName(), menu.getParentId());
|
||||||
|
|
|
@ -79,7 +79,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkPostNameUnique(SysPost post)
|
public boolean checkPostNameUnique(SysPost post)
|
||||||
{
|
{
|
||||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||||
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
|
SysPost info = postMapper.checkPostNameUnique(post.getPostName());
|
||||||
|
@ -97,7 +97,7 @@ public class SysPostServiceImpl implements ISysPostService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkPostCodeUnique(SysPost post)
|
public boolean checkPostCodeUnique(SysPost post)
|
||||||
{
|
{
|
||||||
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
Long postId = StringUtils.isNull(post.getPostId()) ? -1L : post.getPostId();
|
||||||
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
|
SysPost info = postMapper.checkPostCodeUnique(post.getPostCode());
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkRoleNameUnique(SysRole role)
|
public boolean checkRoleNameUnique(SysRole role)
|
||||||
{
|
{
|
||||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||||
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
SysRole info = roleMapper.checkRoleNameUnique(role.getRoleName());
|
||||||
|
@ -164,7 +164,7 @@ public class SysRoleServiceImpl implements ISysRoleService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkRoleKeyUnique(SysRole role)
|
public boolean checkRoleKeyUnique(SysRole role)
|
||||||
{
|
{
|
||||||
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
Long roleId = StringUtils.isNull(role.getRoleId()) ? -1L : role.getRoleId();
|
||||||
SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
|
SysRole info = roleMapper.checkRoleKeyUnique(role.getRoleKey());
|
||||||
|
|
|
@ -165,7 +165,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkUserNameUnique(SysUser user)
|
public boolean checkUserNameUnique(SysUser user)
|
||||||
{
|
{
|
||||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
SysUser info = userMapper.checkUserNameUnique(user.getUserName());
|
||||||
|
@ -183,7 +183,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkPhoneUnique(SysUser user)
|
public boolean checkPhoneUnique(SysUser user)
|
||||||
{
|
{
|
||||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
SysUser info = userMapper.checkPhoneUnique(user.getPhonenumber());
|
||||||
|
@ -201,7 +201,7 @@ public class SysUserServiceImpl implements ISysUserService
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String checkEmailUnique(SysUser user)
|
public boolean checkEmailUnique(SysUser user)
|
||||||
{
|
{
|
||||||
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
|
||||||
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
SysUser info = userMapper.checkEmailUnique(user.getEmail());
|
||||||
|
|
|
@ -107,7 +107,7 @@
|
||||||
<el-table-column label="参数主键" align="center" prop="configId" />
|
<el-table-column label="参数主键" align="center" prop="configId" />
|
||||||
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
<el-table-column label="参数名称" align="center" prop="configName" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
<el-table-column label="参数键名" align="center" prop="configKey" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="参数键值" align="center" prop="configValue" />
|
<el-table-column label="参数键值" align="center" prop="configValue" :show-overflow-tooltip="true" />
|
||||||
<el-table-column label="系统内置" align="center" prop="configType">
|
<el-table-column label="系统内置" align="center" prop="configType">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
|
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.configType"/>
|
||||||
|
|
Loading…
Reference in New Issue