diff --git a/modules/i3plus-core-api/pom.xml b/modules/i3plus-core-api/pom.xml
index 42c86a0..fbc6758 100644
--- a/modules/i3plus-core-api/pom.xml
+++ b/modules/i3plus-core-api/pom.xml
@@ -5,7 +5,7 @@
i3plus-core
i3plus.core
- 1.0-TEST-SNAPSHOT
+ 1.0.0.2
../../pom.xml
4.0.0
@@ -69,4 +69,4 @@
${project.artifactId}-${project.version}
-
\ No newline at end of file
+
diff --git a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/IPersonnelService.java b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/IPersonnelService.java
index 3c512df..94a6fd8 100644
--- a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/IPersonnelService.java
+++ b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/IPersonnelService.java
@@ -19,6 +19,7 @@ public interface IPersonnelService {
/**
* 保存账号信息
+ *
* @param user 账号信息
* @return 保存之后的账号信息
*/
@@ -27,6 +28,7 @@ public interface IPersonnelService {
/**
* 保存用户信息
+ *
* @param info 账号信息
* @return 保存后的账号信息
*/
@@ -34,22 +36,22 @@ public interface IPersonnelService {
SysUserInfo saveSysUserInfo(SysUserInfo info);
@ApiOperation(value = "更新用户状态")
- void updateSysUserInfoStatus(Long userInfoId,Integer status);
+ void updateSysUserInfoStatus(Long userInfoId, Integer status);
@ApiOperation(value = "修改用户主组织信息")
void updateSysUserOrganize(Long userId, Long organizeId);
@ApiOperation(value = "删除账号信息")
- void deleteSysUser(Long[] userIdList,String userName);
+ void deleteSysUser(Long[] userIdList, String userName);
@ApiOperation(value = "删除用户信息")
- void deleteSysUserInfo(Long[] infoIdList,String userName);
+ void deleteSysUserInfo(Long[] infoIdList, String userName);
@ApiOperation(value = "获取账号信息")
SysUser getSysUserById(Long id);
- @ApiOperation(value = "查询账号ID",notes = "根据部门ID 查询所有的人员信息")
- List findSysUserIdByDepartmentId(Long ...departmentId);
+ @ApiOperation(value = "查询账号ID", notes = "根据部门ID 查询所有的人员信息")
+ List findSysUserIdByDepartmentId(Long... departmentId);
// @ApiOperation(value = "查询账号ID",notes = "根据组织代码 查询所有的人员信息")
// List findSysUserIdByOrganizeCode(String ...organizeCode);
@@ -64,13 +66,13 @@ public interface IPersonnelService {
List querySysUserByUserDetailModelOrIds(UserDetailModel model, List ids);
@ApiOperation(value = "查询账号信息")
- ListPager querySysUserPagerByUserDetailModelOrIds(UserDetailModel model,Pager pager, List ids);
+ ListPager querySysUserPagerByUserDetailModelOrIds(UserDetailModel model, Pager pager, List ids);
@ApiOperation(value = "获取用户信息")
SysUserInfo getSysUserInfoById(Long id);
- @ApiOperation(value = "查询账号ID",notes = "根据部门ID 查询所有的人员信息")
- List findSysUserInfoIdByDepartmentId(Long ...departmentId);
+ @ApiOperation(value = "查询账号ID", notes = "根据部门ID 查询所有的人员信息")
+ List findSysUserInfoIdByDepartmentId(Long... departmentId);
// @ApiOperation(value = "查询账号ID",notes = "根据组织代码 查询所有的人员信息")
// List findSysUserInfoIdByOrganizeCode(String ...organizeCode);
@@ -87,43 +89,49 @@ public interface IPersonnelService {
@ApiOperation(value = "查询用户信息")
List findSysUserInfoByIds(Long[] ids);
- @ApiOperation(value = "查询角色",notes = "查询制定用户的角色信息")
+ @ApiOperation(value = "查询角色", notes = "查询制定用户的角色信息")
List findSysRoleByUserId(Long userId);
// @ApiOperation(value = "查询角色",notes = "查询所有角色信息")
// List findSysRoleList();
- @ApiOperation(value = "查询权限",notes = "查询所有权限")
+ @ApiOperation(value = "查询权限", notes = "查询所有权限")
List findSysMenuList();
- @ApiOperation(value = "查询权限",notes = "查询所有权限")
+ @ApiOperation(value = "查询权限", notes = "查询所有权限")
List findSysMenuByUserId(Long userId);
// @ApiOperation(value = "查询权限",notes = "查询所有权限")
// List findSysMenuByIdList(List ids);
- @ApiOperation(value = "查询权限",notes = "查询所有权限")
+ @ApiOperation(value = "查询权限", notes = "查询所有权限")
List findSysMenuByRefRoleMenu(List refList);
@ApiOperation(value = "查询账号角色关系")
List findSysRefUserRole(Long userId);
@ApiOperation(value = "查询账号角色关系")
- List findSysRefUserRole(Long roleId,String organizeCode);
+ List findSysRefUserRole(Long roleId, String organizeCode);
@ApiOperation(value = "查询账号角色关系")
- List findSysRefUserRole(Long userId,Long roleId,String organizeCode);
+ List findSysRefUserRole(Long userId, Long roleId, String organizeCode);
- @ApiOperation(value = "角色权限关系",notes = "根据角色ID 查询权限")
+ @ApiOperation(value = "角色权限关系", notes = "根据角色ID 查询权限")
List findSysRefRoleMenuByUserId(Long userId);
- @ApiOperation(value = "角色权限关系",notes = "根据角色ID 查询权限")
+ @ApiOperation(value = "查询角色账号关系", notes = "查询角色账号关系")
+ ListPager findSysRefUserRoleByRoleIds(List roleIdList, Pager pager);
+
+ @ApiOperation(value = "查询人员拥有的角色信息", notes = "查询人员是否拥有对应角色")
+ List findSysRefUserRoleByRoleNameAndUserID(String roleName, Long userId);
+
+ @ApiOperation(value = "角色权限关系", notes = "根据角色ID 查询权限")
List findSysRefRoleMenuByRoleIds(List roleIdList);
- @ApiOperation(value = "角色权限关系",notes = "根据角色ID 查询权限")
+ @ApiOperation(value = "角色权限关系", notes = "根据角色ID 查询权限")
List findSysRefRoleMenuByRole(List roleList);
- @ApiOperation(value = "角色权限关系",notes = "根据角色ID 查询权限")
+ @ApiOperation(value = "角色权限关系", notes = "根据角色ID 查询权限")
List findSysRefRoleMenuByRefUserRole(List refList);
@ApiOperation(value = "查询账号部门关系")
diff --git a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java
index 54375c7..796d2e5 100644
--- a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java
+++ b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysRoleService.java
@@ -64,4 +64,13 @@ public interface ISysRoleService extends ICrudService {
*/
@ApiOperation(value = "查询符合条件的角色")
List findAllByBaseBean(SysRole sysRole);
+
+ /**
+ * 根据sysRole属性 查询符合条件的角色
+ *
+ * @param sysRole
+ * @return
+ */
+ @ApiOperation(value = "查询符合条件的角色")
+ List findAllByRoleProperty(SysRole sysRole);
}
diff --git a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysUserService.java b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysUserService.java
index 15ee493..10405df 100644
--- a/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysUserService.java
+++ b/modules/i3plus-core-api/src/main/java/cn/estsh/i3plus/core/api/iservice/busi/ISysUserService.java
@@ -57,6 +57,15 @@ public interface ISysUserService {
void updateBatchSysUserStatus(Long[] ids, int status, SessionUser user);
/**
+ * 根据用户名批量修改账号状态
+ *
+ * @param userLoginNameList
+ * @param status
+ */
+ @ApiOperation(value = "根据用户名批量修改账号状态", notes = "根据用户名批量修改账号状态")
+ void updateBatchSysUserStatusByUserLoginNames(List userLoginNameList, int status);
+
+ /**
* 修改账号信息
*
* @param sysUser
diff --git a/modules/i3plus-core-apiservice/pom.xml b/modules/i3plus-core-apiservice/pom.xml
index f6d2309..af92ab0 100644
--- a/modules/i3plus-core-apiservice/pom.xml
+++ b/modules/i3plus-core-apiservice/pom.xml
@@ -5,7 +5,7 @@
i3plus-core
i3plus.core
- 1.0-TEST-SNAPSHOT
+ 1.0.0.2
../../pom.xml
4.0.0
@@ -357,4 +357,4 @@
-
\ No newline at end of file
+
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/AuthController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/AuthController.java
index a38591a..050c511 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/AuthController.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/AuthController.java
@@ -155,15 +155,18 @@ public class AuthController extends CoreBaseController {
*/
@GetMapping(value = "/menu/find-module-list/{parentId}")
@ApiOperation(value = "获取登录用户功能权限信息", notes = "获取首页权限信息")
- public ResultBean findMenuModuleList(@PathVariable("parentId") String parentId) {
+ public ResultBean findMenuModuleList(@PathVariable("parentId") String parentId, Integer menuSort) {
try {
ValidatorBean.checkIsNumber(parentId, "父节点不能为空");
List result = memTreeService.packTreeSysMenuByUserIdAndParentId(getSessionUser().getUser().getId(), Long.parseLong(parentId));
- for (SysMenu sysMenu : result) {
- sysMenu.setChildList(sysMenu.getChildList().stream().sorted(Comparator.comparing(SysMenu::getMenuSort)).collect(Collectors.toList()));
+ //如果menuSort为0,则不用通过menuSort字段进行排序
+ if (menuSort == null || menuSort != 0) {
+ for (SysMenu sysMenu : result) {
+ sysMenu.setChildList(sysMenu.getChildList().stream().sorted(Comparator.comparing(SysMenu::getMenuSort)).collect(Collectors.toList()));
+ }
+ result = result.stream().sorted(Comparator.comparing(SysMenu::getMenuSort)).collect(Collectors.toList());
}
- result = result.stream().sorted(Comparator.comparing(SysMenu::getMenuSort)).collect(Collectors.toList());
result = sysMenuService.setLanguageSysMenuName(AuthUtil.getSessionUser().getLanguageCode(), result);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(result);
} catch (ImppBusiException busExcep) {
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/BackstageController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/BackstageController.java
index 60b5b6b..9540340 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/BackstageController.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/BackstageController.java
@@ -158,6 +158,24 @@ public class BackstageController extends CoreBaseController {
}
}
+ @GetMapping(value = "/license")
+ @ApiOperation(value = "获取授权信息", notes = "获取授权信息")
+ public ResultBean getLicense(){
+ try {
+ ImppLicense license = ImppLicenseTool.getLicense();
+ //icense.getMaturityDateTime() 可能从lockEndTime和licenseEndDateTime字段获取值
+ license.setMaturityDateTime(license.getMaturityDateTime());
+ ResultBean result = ResultBean.success("查询成功").setResultObject(license);
+ return result;
+ } catch (ImppBusiException busExcep) {
+ return ResultBean.fail(busExcep);
+ } catch (Exception e) {
+ return ResultBean.fail(e).setCode(ImppExceptionEnum.SYSTEM_EXCEPTION.getCode());
+ }
+ }
+
+
+
@GetMapping(value = "/update-clean-menu-soft-type")
@ApiOperation(value = "更新并清理功能软件模块数据", notes = "更新并清理功能软件模块数据")
public ResultBean updateCleanMenuSoftType(){
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/WhiteController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/WhiteController.java
index 32f7e8b..e8efd9f 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/WhiteController.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/base/WhiteController.java
@@ -4,8 +4,7 @@ import cn.estsh.i3plus.core.api.iservice.base.ISynchronizedService;
import cn.estsh.i3plus.core.api.iservice.base.ISystemInitService;
import cn.estsh.i3plus.core.api.iservice.base.ISystemLoginStrategyService;
import cn.estsh.i3plus.core.api.iservice.busi.*;
-import cn.estsh.i3plus.core.apiservice.controller.busi.PersonnelController;
-import cn.estsh.i3plus.core.apiservice.controller.busi.SysUserInfoController;
+import cn.estsh.i3plus.core.apiservice.controller.busi.*;
import cn.estsh.i3plus.core.apiservice.util.SysUserPasswordUtil;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
@@ -16,15 +15,16 @@ import cn.estsh.i3plus.platform.common.tool.TimeTool;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.annotation.AnnoIgnoreLog;
-import cn.estsh.i3plus.pojo.base.bean.BaseConstWords;
-import cn.estsh.i3plus.pojo.base.bean.BaseThreadLocal;
-import cn.estsh.i3plus.pojo.base.bean.ListPager;
+import cn.estsh.i3plus.pojo.base.bean.*;
+import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.model.common.CloudPagerModel;
+import cn.estsh.i3plus.pojo.model.common.ImppSmsContent;
import cn.estsh.i3plus.pojo.model.license.ImppLicense;
import cn.estsh.i3plus.pojo.model.platform.SysLoginModel;
+import cn.estsh.i3plus.pojo.model.platform.SysRoleModel;
import cn.estsh.i3plus.pojo.model.platform.UserDetailModel;
import cn.estsh.i3plus.pojo.model.platform.UserDetailPagerModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
@@ -33,6 +33,7 @@ import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
+import cn.estsh.impp.framework.boot.fileservice.ImppFileService;
import cn.estsh.impp.framework.boot.license.ImppLicenseTool;
import cn.estsh.impp.framework.boot.license.serviceimpl.ImppLicenseDecoder;
import cn.estsh.impp.framework.boot.util.ImppRedis;
@@ -58,6 +59,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -82,6 +84,7 @@ import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
/**
* @Description :
@@ -157,6 +160,18 @@ public class WhiteController extends CoreBaseController {
@Autowired
private IDingTalkService dingTalkService;
+ @Autowired
+ private SysSmsSendRecordController smsSendRecordController;
+
+ @Autowired
+ private ISysRoleService sysRoleService;
+
+ @Autowired
+ private SysUserController sysUserController;
+
+ @Autowired
+ private SysFileController sysFileController;
+
private Cache unsavedLocaleResSwitch = CacheBuilder.newBuilder()
.maximumSize(1)
.expireAfterWrite(1, TimeUnit.MINUTES)
@@ -396,7 +411,16 @@ public class WhiteController extends CoreBaseController {
} catch (AuthenticationException e) {
// 系统异常
result = ResultBean.fail(ImppExceptionEnum.LOGIN_EXCEPTION_USER_PASSWORD.getDescription()).setCode(ImppExceptionEnum.LOGIN_EXCEPTION_USER_PASSWORD.getCode());
- result.setErrorMsg(e.getMessage());
+ if (e.getCause() != null) {
+ if (e.getCause() instanceof ImppBusiException) {
+ ImppBusiException imppBusiException = (ImppBusiException) e.getCause();
+ result.setErrorMsg(LocaleUtils.getLocaleRes(imppBusiException.getErrorDetail()));
+ }else {
+ result.setErrorMsg(e.getCause().getMessage());
+ }
+ } else {
+ result.setErrorMsg(e.getMessage());
+ }
userLoginStatus = CommonEnumUtil.USER_LOGIN_STATUS.SYSTEM_ERROR;
LOGGER.warn("Impp业务异常AuthenticationException 登录失败 ", e);
} catch (ImppBusiException e) {
@@ -578,6 +602,18 @@ public class WhiteController extends CoreBaseController {
}
/**
+ * 根据id删除文件资源
+ *
+ * @param idStr 文件资源
+ * @return 处理结果
+ */
+ @DeleteMapping(value = "/sys-file/delete/{id}")
+ @ApiOperation(value = "根据id删除文件资源", notes = "根据id删除文件资源")
+ public ResultBean deleteSysFileById(@PathVariable("id") String idStr) {
+ return sysFileController.deleteSysFileById(idStr);
+ }
+
+ /**
* 根据文件代码查询文件信息
*
* @param fileCode 文件代码
@@ -899,4 +935,55 @@ public class WhiteController extends CoreBaseController {
public ResultBean querySysUserInfo(@RequestBody CloudPagerModel cloudPagerModel) {
return sysUserInfoController.querySysUserInfo(cloudPagerModel.getObj(), cloudPagerModel.getPager());
}
+
+ @PostMapping("/sendSms")
+ @ApiOperation("无需登录 发送短信")
+ public ResultBean sendSms(@RequestBody ImppSmsContent imppSmsContent){
+ return smsSendRecordController.send(imppSmsContent);
+ }
+
+
+ @PostMapping(value = "/queryAllRoleRefUser")
+ @ApiOperation(value = "在所有角色中查询角色及关联的人员信息", notes = "查询角色及关联的人员信息")
+ public BaseResultBean queryAllRoleRefUser(@RequestBody SysRoleModel sysRoleModel) {
+ try {
+ ListPager result = null;
+ List roleList = null;
+ SysRole sysRole = sysRoleModel.getSysRole();
+ Pager pager = sysRoleModel.getPager();
+ if (ObjectUtils.isEmpty(sysRole)) {
+ sysRole = new SysRole();
+ }
+ if (ObjectUtils.isEmpty(pager)) {
+ pager = new Pager();
+ }
+ //过滤SysRefUserRole
+ roleList = sysRoleService.findAllByRoleProperty(sysRole);
+ if (ObjectUtils.isEmpty(roleList)){
+ return ResultBean.success("操作成功");
+ }
+
+ List roleIdList = roleList.stream().map(el -> el.getId()).collect(Collectors.toList());
+ result = personnelService.findSysRefUserRoleByRoleIds(roleIdList, pager);
+ return ResultBean.success("操作成功").setListPager(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
+ } catch (ImppBusiException busExcep) {
+ return ResultBean.fail(busExcep);
+ } catch (Exception e) {
+ return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
+ }
+ }
+
+ /**
+ * 根据登录的用户名批量修改账号状态
+ *
+ * @param userLoginNames 用户名数组
+ * @param status 状态
+ * @return 处理结果
+ */
+ @PutMapping(value = "/batch-status/userLoginNames")
+ @ApiOperation(value = "根据用户名批量修改账号状态", notes = "根据用户名批量修改账号状态")
+ public ResultBean updateBatchStatusByUserLoginNames(String[] userLoginNames, Integer status) {
+ return sysUserController.updateBatchStatusByUserLoginNames(userLoginNames,status);
+ }
+
}
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java
index ca8378b..6585b68 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysRoleController.java
@@ -10,13 +10,13 @@ import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.platform.common.util.FileContentTypeTool;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
+import cn.estsh.i3plus.pojo.base.bean.BaseResultBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
-import cn.estsh.i3plus.pojo.platform.bean.SysRefRoleMenu;
-import cn.estsh.i3plus.pojo.platform.bean.SysRefUserRole;
-import cn.estsh.i3plus.pojo.platform.bean.SysRole;
+import cn.estsh.i3plus.pojo.model.platform.SysRoleModel;
+import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.impp.framework.base.controller.CrudBaseController;
import cn.estsh.impp.framework.base.service.ICrudService;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
@@ -30,14 +30,12 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanWrapper;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.http.MediaType;
+import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
@@ -47,9 +45,7 @@ import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -246,6 +242,74 @@ public class SysRoleController extends CrudBaseController {
}
}
+ @PostMapping(value = "/queryAllRoleRefUser")
+ @ApiOperation(value = "在所有角色中查询角色及关联的人员信息", notes = "查询角色及关联的人员信息")
+ public BaseResultBean queryAllRoleRefUser(@RequestBody SysRoleModel sysRoleModel) {
+ try {
+ ListPager result = null;
+ List roleList = null;
+ SysRole sysRole = sysRoleModel.getSysRole();
+ Pager pager = sysRoleModel.getPager();
+ if (ObjectUtils.isEmpty(sysRole)) {
+ sysRole = new SysRole();
+ }
+ if (ObjectUtils.isEmpty(pager)) {
+ pager = new Pager();
+ }
+ roleList = sysRoleService.findAllByRoleProperty(sysRole);
+ //过滤SysRefUserRole
+ if (ObjectUtils.isEmpty(roleList)){
+ return ResultBean.success("操作成功");
+ }
+
+ List roleIdList = roleList.stream().map(el -> el.getId()).collect(Collectors.toList());
+ result = personnelService.findSysRefUserRoleByRoleIds(roleIdList, pager);
+ return ResultBean.success("操作成功").setListPager(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
+ } catch (ImppBusiException busExcep) {
+ return ResultBean.fail(busExcep);
+ } catch (Exception e) {
+ return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
+ }
+ }
+
+
+ @PostMapping(value = "/queryRoleRefUser")
+ @ApiOperation(value = "查询当前请求人员的角色及关联的人员信息", notes = "查询角色及关联的人员信息")
+ public BaseResultBean queryRoleRefUser(@RequestBody SysRoleModel sysRoleModel) {
+ try {
+ ListPager result = null;
+ SysRole sysRole = sysRoleModel.getSysRole();
+ Pager pager = sysRoleModel.getPager();
+ if (ObjectUtils.isEmpty(sysRole)){
+ return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
+ }
+ if (ObjectUtils.isEmpty(pager)){
+ pager = new Pager();
+ }
+ if (StringUtils.isEmpty(sysRole.getName())){
+ return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
+ }
+ List refList = personnelService.findSysRefUserRoleByRoleNameAndUserID(sysRole.getName(), getSessionUser().getUser().getId());
+ if (refList != null && refList.size() > 0) {
+ List idList = new ArrayList<>(refList.size());
+ refList.forEach(ref -> {
+ idList.add(ref.getRoleId());
+ });
+
+// result = sysRoleService.querySysRole(sysRole, idList, pager);
+// List roleList = result.getObjectList();
+// //过滤SysRefUserRole
+//
+// List roleIdList = roleList.stream().map(el -> el.getId()).collect(Collectors.toList());
+ result = personnelService.findSysRefUserRoleByRoleIds(idList,pager);
+ }
+ return ResultBean.success("操作成功").setListPager(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
+ } catch (ImppBusiException busExcep) {
+ return ResultBean.fail(busExcep);
+ } catch (Exception e) {
+ return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
+ }
+ }
/**
* 修改角色状态
*
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserController.java
index 0398610..74961c0 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserController.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserController.java
@@ -39,6 +39,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
+import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -59,6 +60,7 @@ import java.sql.ResultSet;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
+import java.util.stream.Stream;
import static java.util.stream.Collectors.toCollection;
@@ -290,6 +292,31 @@ public class SysUserController extends CoreBaseController {
}
/**
+ * 根据登录的用户名批量修改账号状态
+ *
+ * @param userLoginNames 用户名数组
+ * @param status 状态
+ * @return 处理结果
+ */
+ @PutMapping(value = "/batch-status/userLoginNames")
+ @ApiOperation(value = "根据用户名批量修改账号状态", notes = "根据用户名批量修改账号状态")
+ public ResultBean updateBatchStatusByUserLoginNames(String[] userLoginNames, Integer status) {
+ try {
+ if(ObjectUtils.isEmpty(userLoginNames)){
+ return ResultBean.success("操作失败").setCode(ResourceEnumUtil.MESSAGE.FAIL.getCode()).setErrorMsg("用户名不能为空");
+ }
+ ValidatorBean.checkNotZero(status, "账号状态不能为空");
+ List userLoginNameList = Stream.of(userLoginNames).collect(Collectors.toList());
+ sysUserService.updateBatchSysUserStatusByUserLoginNames(userLoginNameList,status);
+ return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
+ } catch (ImppBusiException busExcep) {
+ return ResultBean.fail(busExcep);
+ } catch (Exception e) {
+ return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
+ }
+ }
+
+ /**
* 修改当前登录用户密码
*
* @param password 原密码
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserInfoController.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserInfoController.java
index 4c2d6db..773973c 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserInfoController.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/controller/busi/SysUserInfoController.java
@@ -426,8 +426,15 @@ public class SysUserInfoController extends CoreBaseController {
userInfo = new SysUserInfo();
}
try {
- ListPager result = sysUserInfoService.querySysUserInfo(userInfo, packUserInfo(userInfo), pager);
- List list = result.getObjectList();
+ ListPager result = null;
+ List list = null;
+ if (ObjectUtils.isEmpty(pager)|| pager.getPageSize() == 0) {
+ list = sysUserInfoService.querySysUserInfoList(userInfo, packUserInfo(userInfo));
+ } else {
+ result = sysUserInfoService.querySysUserInfo(userInfo, packUserInfo(userInfo), pager);
+ list = result.getObjectList();
+ }
+
Map sysUserMap = sysUserService.list().stream()
.collect(Collectors.toMap(SysUser::getId, Function.identity()));
List exportModelList = new ArrayList<>();
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PersonnelServiceService.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PersonnelServiceService.java
index ef0f0ce..5ecfcee 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PersonnelServiceService.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/PersonnelServiceService.java
@@ -33,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.util.*;
@@ -129,9 +130,9 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void updateSysUserOrganize(Long userId, Long organizeId) {
- LOGGER.info("平台账号 SysUser userId:{} organizeId",userId, organizeId);
+ LOGGER.info("平台账号 SysUser userId:{} organizeId", userId, organizeId);
SysUser user = userRDao.getById(userId);
- if(user != null){
+ if (user != null) {
user.setOrganizeId(organizeId);
userRDao.save(user);
}
@@ -139,26 +140,26 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "删除账号信息")
- public void deleteSysUser(Long[] userIdList,String userName) {
+ public void deleteSysUser(Long[] userIdList, String userName) {
LOGGER.info("平台账号 SysUser userIdList:{}", userIdList);
// 删除账号信息
- userRDao.updateValidStatusByPropertyIn("id", userIdList,CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
+ userRDao.updateValidStatusByPropertyIn("id", userIdList, CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
// 删除账号关系
- refUserDepartmentRDao.deleteByPropertyIn("userId",userIdList);
+ refUserDepartmentRDao.deleteByPropertyIn("userId", userIdList);
refUserRoleRDao.deleteByPropertyIn("userId", userIdList);
}
@Override
@ApiOperation(value = "删除用户信息")
- public void deleteSysUserInfo(Long[] infoIdList,String userName) {
+ public void deleteSysUserInfo(Long[] infoIdList, String userName) {
LOGGER.info("平台用户 SysUserInfo infoIdList:{}", infoIdList);
// 删除用户信息
- userInfoRDao.updateValidStatusByPropertyIn("id", infoIdList,CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
+ userInfoRDao.updateValidStatusByPropertyIn("id", infoIdList, CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
// 删除用户关系
- refUserInfoDepartmentRDao.deleteByPropertyIn("userId",infoIdList);
- refUserPositionRDao.deleteByPropertyIn("userId",infoIdList);
+ refUserInfoDepartmentRDao.deleteByPropertyIn("userId", infoIdList);
+ refUserPositionRDao.deleteByPropertyIn("userId", infoIdList);
}
@Override
@@ -169,9 +170,9 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysUserIdByDepartmentId(Long... departmentId) {
List result = new ArrayList<>();
- if(departmentId != null && departmentId.length > 0){
+ if (departmentId != null && departmentId.length > 0) {
List departmentList = refUserDepartmentRDao.findByHqlWhere(CoreHqlPack.packHqlIds("departmentId", departmentId));
- if(departmentList != null && departmentList.size() > 0){
+ if (departmentList != null && departmentList.size() > 0) {
departmentList.forEach(department -> result.add(department.getUserId()));
}
}
@@ -207,14 +208,14 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public ListPager querySysUser(UserDetailModel model, Pager pager) {
Set idList = new HashSet<>();
- if(model.getSysUser() != null && model.getSysUser().getDepartmentId() != null){
+ if (model.getSysUser() != null && model.getSysUser().getDepartmentId() != null) {
idList.addAll(findSysUserIdByDepartmentId(model.getSysUser().getDepartmentId()));
}
// if(model.getSysUser() != null && model.getSysUser().getOrganizeCode() != null){
// idList.addAll(findSysUserIdByOrganizeCode(model.getSysUser().getOrganizeCode()));
// }
- if(model.getUserIdList() != null){
+ if (model.getUserIdList() != null) {
model.getUserIdList().forEach(idStr -> idList.add(Long.parseLong(idStr)));
}
@@ -233,7 +234,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "查询账号信息")
- public ListPager querySysUserPagerByUserDetailModelOrIds(UserDetailModel model,Pager pager, List ids) {
+ public ListPager querySysUserPagerByUserDetailModelOrIds(UserDetailModel model, Pager pager, List ids) {
LOGGER.info("平台用户 SysUser model:{} ids:{}", model, ids);
String modeWhere = HqlModelPack.packHqlSysUserByModelOrIds(model, ids);
@@ -249,9 +250,9 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysUserInfoIdByDepartmentId(Long... departmentId) {
List result = new ArrayList<>();
- if(departmentId != null && departmentId.length > 0){
+ if (departmentId != null && departmentId.length > 0) {
List departmentList = refUserInfoDepartmentRDao.findByHqlWhere(CoreHqlPack.packHqlIds("departmentId", departmentId));
- if(departmentList != null && departmentList.size() > 0){
+ if (departmentList != null && departmentList.size() > 0) {
departmentList.forEach(department -> result.add(department.getUserId()));
}
}
@@ -285,7 +286,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public SessionUser queryUserLogin(String userName, String password, String languageCode) {
LOGGER.info("平台用户 SYS_USER loginName:{} \t password:{} \t languageCode:{}", userName, password, languageCode);
- UserToken token = new UserToken(userName,password,languageCode);
+ UserToken token = new UserToken(userName, password, languageCode);
SessionUser sessionUser = AuthUtil.login(token);
AuthUtil.setSessionUser(sessionUser);
return sessionUser;
@@ -295,7 +296,6 @@ public class PersonnelServiceService implements IPersonnelService {
public ListPager querySysUserInfo(UserDetailModel model, Pager pager) {
-
DdlPackBean packBean = CoreHqlPack.packDdlBeanSysUserInfo(model.getSysUserInfo(), StringTool.getListLong(model.getUserInfoIdList()));
pager = PagerHelper.getPager(pager, userInfoRDao.findByHqlWhereCount(packBean));
@@ -316,7 +316,7 @@ public class PersonnelServiceService implements IPersonnelService {
LOGGER.debug("平台账号角色 SysRole userId:{}", userId);
List refList = findSysRefUserRole(userId);
- if(refList != null && refList.size() > 0){
+ if (refList != null && refList.size() > 0) {
List idList = new ArrayList<>();
refList.forEach(ref -> idList.add(ref.getRoleId()));
@@ -350,7 +350,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysMenuByUserId(Long userId) {
- LOGGER.info("平台账号权限 SysMenu userId:{}",userId);
+ LOGGER.info("平台账号权限 SysMenu userId:{}", userId);
List refUserRoleList = findSysRefUserRole(userId);
List refRoleMenuList = findSysRefRoleMenuByRefUserRole(refUserRoleList);
return findSysMenuByRefRoleMenu(refRoleMenuList);
@@ -368,7 +368,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysMenuByRefRoleMenu(List refList) {
LOGGER.info("平台账号角色 SysRefRoleMenu refList:{}", refList);
- if(refList != null && refList.size() > 0){
+ if (refList != null && refList.size() > 0) {
List idList = new ArrayList<>(refList.size());
refList.forEach(ref -> idList.add(ref.getMenuId()));
return menuService.findByIdList(idList);
@@ -388,33 +388,53 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysRefUserRole(Long userId, Long roleId, String organizeCode) {
- LOGGER.info("平台账号角色 SysRefUserRole userId:{} roleId:{} organizeCode:{}",userId, roleId,organizeCode);
+ LOGGER.info("平台账号角色 SysRefUserRole userId:{} roleId:{} organizeCode:{}", userId, roleId, organizeCode);
return refUserRoleRDao.findByHqlWhere(CoreHqlPack.packDdlBeanSysRefUserRole(userId, roleId, organizeCode));
}
@Override
public List findSysRefRoleMenuByUserId(Long userId) {
LOGGER.info("平台账号角色 SysRefRoleMenu userId:{}", userId);
- if(userId != null){
+ if (userId != null) {
List refRoleList = findSysRefUserRole(userId);
- if(refRoleList != null && refRoleList.size() > 0){
+ if (refRoleList != null && refRoleList.size() > 0) {
List idList = new ArrayList<>(refRoleList.size());
refRoleList.forEach(ref -> idList.add(ref.getRoleId()));
- return findSysRefRoleMenuByRoleIds( idList);
+ return findSysRefRoleMenuByRoleIds(idList);
}
}
return null;
}
@Override
+ public ListPager findSysRefUserRoleByRoleIds(List roleIdList, Pager pager) {
+ if (ObjectUtils.isEmpty(roleIdList)) {
+ return new ListPager();
+ }
+ DdlPackBean packBean = DdlPackBean.getDdlPackBean();
+ DdlPreparedPack.getInPackList(roleIdList, "roleId", packBean);
+ pager = PagerHelper.getPager(pager, refUserRoleRDao.findByHqlWhereCount(packBean));
+ return new ListPager<>(refUserRoleRDao.findByHqlWherePage(packBean, pager), pager);
+ }
+
+ @Override
+ public List findSysRefUserRoleByRoleNameAndUserID(String roleName, Long userId) {
+ DdlPackBean packBean = DdlPackBean.getDdlPackBean();
+ DdlPreparedPack.getStringLikerPack(roleName, "roleNameRdd", packBean);
+ DdlPreparedPack.getNumEqualPack(userId, "userId", packBean);
+ return refUserRoleRDao.findByHqlWhere(packBean);
+
+ }
+
+ @Override
public List findSysRefRoleMenuByRoleIds(List roleIdList) {
LOGGER.info("平台账号角色 SysRefRoleMenu roleIdList:{}", roleIdList);
- if(roleIdList != null){
+ if (roleIdList != null) {
StringBuffer findWhere = new StringBuffer();
- HqlPack.getInPack(StringUtils.join(roleIdList,","),"roleId",findWhere);
- HqlPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),"isDeleted",findWhere);
- HqlPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),"isValid",findWhere);
+ HqlPack.getInPack(StringUtils.join(roleIdList, ","), "roleId", findWhere);
+ HqlPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "isDeleted", findWhere);
+ HqlPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(), "isValid", findWhere);
return refRoleMenuRDao.findByHqlWhere(findWhere.toString());
}
@@ -424,7 +444,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysRefRoleMenuByRole(List roleList) {
LOGGER.info("平台账号角色 SysRefRoleMenu roleList:{}", roleList);
- if(roleList != null && roleList.size() > 0){
+ if (roleList != null && roleList.size() > 0) {
List idList = new ArrayList<>(roleList.size());
roleList.forEach(ref -> idList.add(ref.getId()));
return findSysRefRoleMenuByRoleIds(idList);
@@ -435,7 +455,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysRefRoleMenuByRefUserRole(List refList) {
LOGGER.info("平台账号角色 SysRefRoleMenu refList:{}", refList);
- if(refList != null && refList.size() > 0){
+ if (refList != null && refList.size() > 0) {
List idList = new ArrayList<>(refList.size());
refList.forEach(ref -> idList.add(ref.getRoleId()));
return findSysRefRoleMenuByRoleIds(idList);
@@ -446,7 +466,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysRefUserDepartmentByUserId(Long userId) {
LOGGER.info("平台账号部门 SysRefUserDepartment userId:{}", userId);
- return refUserDepartmentRDao.findByProperty("userId",userId);
+ return refUserDepartmentRDao.findByProperty("userId", userId);
}
@Override
@@ -454,7 +474,7 @@ public class PersonnelServiceService implements IPersonnelService {
LOGGER.info("平台账号部门 SysRefUserDepartment organizeIdList:{}", organizeIdList);
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
- DdlPreparedPack.getInPackList(organizeIdList,"organizeId",packBean);
+ DdlPreparedPack.getInPackList(organizeIdList, "organizeId", packBean);
return refUserDepartmentRDao.findByHqlWhere(packBean);
}
@@ -464,7 +484,7 @@ public class PersonnelServiceService implements IPersonnelService {
LOGGER.info("平台账号部门 SysRefUserDepartment organizeCode:{}", organizeCode);
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
- DdlPreparedPack.getStringEqualPack(organizeCode,"organizeCode",packBean);
+ DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
return refUserDepartmentRDao.findByHqlWhere(packBean);
}
@@ -474,25 +494,25 @@ public class PersonnelServiceService implements IPersonnelService {
LOGGER.info("平台账号部门 SysRefUserDepartment departmentIdList:{}", departmentIdList);
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
- DdlPreparedPack.getInPackList(departmentIdList,"departmentId",packBean);
+ DdlPreparedPack.getInPackList(departmentIdList, "departmentId", packBean);
return refUserDepartmentRDao.findByHqlWhere(packBean);
}
@Override
public List querySysRefUserDepartmentByUserDetailModel(UserDetailModel model) {
- if(model != null){
+ if (model != null) {
StringBuffer userIdWhere = new StringBuffer();
- if(model.getUserDepartmentIdList() != null){
- HqlPack.getInPack(StringUtils.join(model.getInfoDepartmentIdList(),","),"departmentId", userIdWhere);
+ if (model.getUserDepartmentIdList() != null) {
+ HqlPack.getInPack(StringUtils.join(model.getInfoDepartmentIdList(), ","), "departmentId", userIdWhere);
}
- if(model.getUserOrganizeIdList() != null){
- HqlPack.getInPack( StringUtils.join(model.getUserOrganizeIdList(),","),"organizeId",userIdWhere);
+ if (model.getUserOrganizeIdList() != null) {
+ HqlPack.getInPack(StringUtils.join(model.getUserOrganizeIdList(), ","), "organizeId", userIdWhere);
}
return refUserDepartmentRDao.findByHqlWhere(userIdWhere.toString());
- }else {
+ } else {
return null;
}
}
@@ -500,7 +520,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysRefUserInfoDepartmentById(Long infoId) {
LOGGER.info("平台用户部门关系 SysRefUserInfoDepartment infoId:{}", infoId);
- return refUserInfoDepartmentRDao.findByProperty("userId",infoId);
+ return refUserInfoDepartmentRDao.findByProperty("userId", infoId);
}
@Override
@@ -508,7 +528,7 @@ public class PersonnelServiceService implements IPersonnelService {
LOGGER.info("平台账号部门 SysRefUserDepartment organizeIdList:{}", organizeIdList);
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
- DdlPreparedPack.getInPackList(organizeIdList,"organizeId",packBean);
+ DdlPreparedPack.getInPackList(organizeIdList, "organizeId", packBean);
return refUserInfoDepartmentRDao.findByHqlWhere(packBean);
}
@@ -518,7 +538,7 @@ public class PersonnelServiceService implements IPersonnelService {
LOGGER.info("平台账号部门 SysRefUserInfoDepartment departmentIdList:{}", departmentIdList);
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
- DdlPreparedPack.getInPackList(departmentIdList,"departmentId",packBean);
+ DdlPreparedPack.getInPackList(departmentIdList, "departmentId", packBean);
return refUserInfoDepartmentRDao.findByHqlWhere(packBean);
}
@@ -536,7 +556,7 @@ public class PersonnelServiceService implements IPersonnelService {
List result = new ArrayList<>();
List refs = findSysRefUserInfoDepartmentById(infoId);
- if(refs != null && refs.size() > 0){
+ if (refs != null && refs.size() > 0) {
List ids = new ArrayList<>();
refs.forEach(ref -> ids.add(ref.getDepartmentId()));
@@ -552,7 +572,7 @@ public class PersonnelServiceService implements IPersonnelService {
List result = new ArrayList<>();
List refs = findSysRefUserDepartmentByUserId(infoId);
- if(refs != null && refs.size() > 0){
+ if (refs != null && refs.size() > 0) {
List ids = new ArrayList<>();
refs.forEach(ref -> ids.add(ref.getDepartmentId()));
@@ -575,7 +595,7 @@ public class PersonnelServiceService implements IPersonnelService {
List result = new ArrayList<>();
List refs = findSysRefUserInfoDepartmentById(infoId);
- if(refs != null && refs.size() > 0){
+ if (refs != null && refs.size() > 0) {
List ids = new ArrayList<>();
refs.forEach(ref -> ids.add(ref.getOrganizeId()));
@@ -590,7 +610,7 @@ public class PersonnelServiceService implements IPersonnelService {
List result = new ArrayList<>();
List refs = findSysRefUserDepartmentByUserId(infoId);
- if(refs != null && refs.size() > 0){
+ if (refs != null && refs.size() > 0) {
List ids = new ArrayList<>();
refs.forEach(ref -> ids.add(ref.getOrganizeId()));
@@ -618,14 +638,14 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List findSysRefUserPositionByUserInfoId(Long infoId) {
LOGGER.info("平台用户岗位 SysRefUserPosition infoId:{}", infoId);
- return refUserPositionRDao.findByProperty("userId",infoId);
+ return refUserPositionRDao.findByProperty("userId", infoId);
}
@Override
public List findSysRefUserPositionByIdList(List idList) {
- if(idList != null && idList.size() > 0){
+ if (idList != null && idList.size() > 0) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
- DdlPreparedPack.getInPackList(idList,"positionId",packBean);
+ DdlPreparedPack.getInPackList(idList, "positionId", packBean);
return refUserPositionRDao.findByHqlWhere(packBean);
}
return null;
@@ -633,9 +653,9 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void checkSysUserOnly(SysUser user) {
- if(user != null){
+ if (user != null) {
// 登录名唯一教研
- if(!checkSysUserLoginName(user.getUserLoginName(), user.getId() == null ? 0 : user.getId())){
+ if (!checkSysUserLoginName(user.getUserLoginName(), user.getId() == null ? 0 : user.getId())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
@@ -667,7 +687,7 @@ public class PersonnelServiceService implements IPersonnelService {
// }
// 工号唯一教研
- if(!checkSysUserEmpNo(user.getUserEmpNo(),user.getUserInfoId() == null ? 0 : user.getUserInfoId())){
+ if (!checkSysUserEmpNo(user.getUserEmpNo(), user.getUserInfoId() == null ? 0 : user.getUserInfoId())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_EXIT.getCode())
@@ -683,13 +703,13 @@ public class PersonnelServiceService implements IPersonnelService {
public Integer checkSysUserResetPassword(SysUser user) {
LOGGER.info("平台用户岗位 SysUser user:{}", user);
Integer num = 0;
- if(user != null){
+ if (user != null) {
String redisKey = CommonConstWords.REDIS_PREFIX_USER_RESET_PASSWORD + ":" + TimeTool.getToday() + ":" + user.getId();
Object redisValue = redisCore.getObject(redisKey);
num = redisValue == null ? 1 : Integer.parseInt(redisValue.toString()) + 1;
int numMax = RedisCacheTool.getSysConfigIntVal(CommonConstWords.CONFIG_PWD_RESET_PASSWORD, CommonConstWords.CONFIG_PWD_RESET_PASSWORD_DEFAULT);
- if(num > numMax){
+ if (num > numMax) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.USER_PERMISSION_RUN_OUT.getCode())
@@ -697,7 +717,7 @@ public class PersonnelServiceService implements IPersonnelService {
.setErrorSolution("请明日再次使用")
.build();
}
- redisCore.putObject(redisKey,num,CommonConstWords.REDIS_TIME_DAY_ONE);
+ redisCore.putObject(redisKey, num, CommonConstWords.REDIS_TIME_DAY_ONE);
}
return num;
}
@@ -706,16 +726,16 @@ public class PersonnelServiceService implements IPersonnelService {
public void checkSysPositionRef(Long positionId) {
LOGGER.info("平台岗位 SysPosition positionId:{}", positionId);
- if(positionId != null){
+ if (positionId != null) {
SysPosition sp = new SysPosition();
sp.setParentId(positionId);
List positionList = positionService.findAllByBean(sp);
- if (positionList!= null && positionList.size() >= 1) {
+ if (positionList != null && positionList.size() >= 1) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在岗位信息["+positionList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在岗位信息[" + positionList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除子集信息在操作")
.build();
}
@@ -733,7 +753,7 @@ public class PersonnelServiceService implements IPersonnelService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在用户信息["+userInfoList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在用户信息[" + userInfoList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除用户引用信息再操作")
.build();
}
@@ -744,13 +764,13 @@ public class PersonnelServiceService implements IPersonnelService {
public void checkSysDepartmentRef(Long departmentId) {
LOGGER.info("平台部门 SysDepartment departmentId:{}", departmentId);
- if(departmentId != null){
- List departmentList = departmentService.findAllByBean(new SysDepartment(null,departmentId,null));
+ if (departmentId != null) {
+ List departmentList = departmentService.findAllByBean(new SysDepartment(null, departmentId, null));
if (departmentList != null && departmentList.size() >= 1) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在相关部门信息["+departmentList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在相关部门信息[" + departmentList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除子集信息在操作")
.build();
}
@@ -760,7 +780,7 @@ public class PersonnelServiceService implements IPersonnelService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在用户信息["+userInfoList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在用户信息[" + userInfoList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除用户引用信息再操作")
.build();
}
@@ -770,7 +790,7 @@ public class PersonnelServiceService implements IPersonnelService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在账号信息["+userList.get(0).getUserLoginName()+"]无法删除!")
+ .setErrorDetail("存在账号信息[" + userList.get(0).getUserLoginName() + "]无法删除!")
.setErrorSolution("请先删除账号引用信息再操作")
.build();
}
@@ -781,7 +801,7 @@ public class PersonnelServiceService implements IPersonnelService {
public void checkSysOrganizeRef(Long organizeId) {
LOGGER.info("平台部门 SysOrganize organizeId:{}", organizeId);
- if(organizeId != null){
+ if (organizeId != null) {
SysOrganize org = new SysOrganize();
org.setParentId(organizeId);
List organizeList = organizeService.findAllByBean(org);
@@ -789,7 +809,7 @@ public class PersonnelServiceService implements IPersonnelService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在相关组织信息["+organizeList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在相关组织信息[" + organizeList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除子集信息在操作")
.build();
}
@@ -804,12 +824,12 @@ public class PersonnelServiceService implements IPersonnelService {
// .buildSearch();
// }
- List departmentList = departmentService.findAllByBean(new SysDepartment(null,null,organizeId));
+ List departmentList = departmentService.findAllByBean(new SysDepartment(null, null, organizeId));
if (departmentList != null && departmentList.size() >= 1) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在部门信息["+departmentList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在部门信息[" + departmentList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除部门引用信息再操作")
.build();
}
@@ -819,7 +839,7 @@ public class PersonnelServiceService implements IPersonnelService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在用户信息["+userInfoList.get(0).getName()+"]无法删除!")
+ .setErrorDetail("存在用户信息[" + userInfoList.get(0).getName() + "]无法删除!")
.setErrorSolution("请先删除用户引用信息再操作")
.build();
}
@@ -829,7 +849,7 @@ public class PersonnelServiceService implements IPersonnelService {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION.getCode())
- .setErrorDetail("存在账号信息["+userList.get(0).getUserLoginName()+"]无法删除!")
+ .setErrorDetail("存在账号信息[" + userList.get(0).getUserLoginName() + "]无法删除!")
.setErrorSolution("请先删除账号引用信息再操作")
.build();
}
@@ -942,18 +962,18 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void refreshRefSysUserDepartment(Long userId, Long[] departmentIds) {
- LOGGER.info("账号部门信息 SysUser userInfoId:{} departmentIds:{}",userId,departmentIds);
+ LOGGER.info("账号部门信息 SysUser userInfoId:{} departmentIds:{}", userId, departmentIds);
SysUser user = userRDao.getById(userId);
- if(user != null ){
+ if (user != null) {
// 删除用户部门关系
- refUserDepartmentRDao.deleteByProperty("userId",user.getId());
+ refUserDepartmentRDao.deleteByProperty("userId", user.getId());
- if(departmentIds.length > 0){
+ if (departmentIds.length > 0) {
// 查询部门信息
List departmentList = departmentService.findByIdList(Arrays.asList(departmentIds));
- if(departmentList != null && departmentList.size() >0){
+ if (departmentList != null && departmentList.size() > 0) {
List list = new ArrayList<>();
SysRefUserDepartment ref = null;
for (SysDepartment department : departmentList) {
@@ -974,7 +994,7 @@ public class PersonnelServiceService implements IPersonnelService {
refUserDepartmentRDao.saveAll(list);
userRDao.save(user);
- LOGGER.info("账号部门信息 SysUserInfo RefUserDepartmentRDao Insert Size :{}",list.size());
+ LOGGER.info("账号部门信息 SysUserInfo RefUserDepartmentRDao Insert Size :{}", list.size());
}
}
}
@@ -1016,12 +1036,12 @@ public class PersonnelServiceService implements IPersonnelService {
}
List roleRdds = refUserRoles.stream().map(SysRefUserRole::getRoleNameRdd).collect(Collectors.toList());
currentRole = StringUtils.join(roleRdds, ",");
- SysLogRoleChange logRoleChange=new SysLogRoleChange();
+ SysLogRoleChange logRoleChange = new SysLogRoleChange();
logRoleChange.setUserName(user.getUserName());
logRoleChange.setUserId(userId);
logRoleChange.setPreviousRoles(previousRole);
logRoleChange.setCurrentRoles(currentRole);
- ConvertBean.serviceModelInitialize(logRoleChange,AuthUtil.getSessionUser().getUserName());
+ ConvertBean.serviceModelInitialize(logRoleChange, AuthUtil.getSessionUser().getUserName());
logRoleChangeRepository.save(logRoleChange);
refUserRoleRDao.saveAll(refUserRoles);
@@ -1032,18 +1052,18 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void refreshUpdateRefSysUserInfoDepartment(Long userInfoId, Long[] departmentIds) {
- LOGGER.info("用户部门关系信息 SysUser userInfoId:{} departmentIds:{}",userInfoId,departmentIds);
+ LOGGER.info("用户部门关系信息 SysUser userInfoId:{} departmentIds:{}", userInfoId, departmentIds);
SysUserInfo info = userInfoRDao.getById(userInfoId);
- if(info != null ){
+ if (info != null) {
// 删除用户部门关系
- refUserInfoDepartmentRDao.deleteByProperty("userId",info.getId());
+ refUserInfoDepartmentRDao.deleteByProperty("userId", info.getId());
- if(departmentIds.length > 0){
+ if (departmentIds.length > 0) {
// 查询部门信息
List departmentList = departmentService.findByIdList(Arrays.asList(departmentIds));
- if(departmentList != null && departmentList.size() >0){
+ if (departmentList != null && departmentList.size() > 0) {
List list = new ArrayList<>();
SysRefUserInfoDepartment ref = null;
for (SysDepartment department : departmentList) {
@@ -1064,10 +1084,10 @@ public class PersonnelServiceService implements IPersonnelService {
refUserInfoDepartmentRDao.saveAll(list);
userInfoRDao.save(info);
- LOGGER.info("用户部门关系信息 SysUserInfo RefUserDepartmentRDao Insert Size :{}",list.size());
+ LOGGER.info("用户部门关系信息 SysUserInfo RefUserDepartmentRDao Insert Size :{}", list.size());
}
}
- }else {
+ } else {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(cn.estsh.impp.framework.boot.exception.ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
@@ -1119,19 +1139,19 @@ public class PersonnelServiceService implements IPersonnelService {
// }
// }
- @Override
+ @Override
public void refreshRefSysUserInfoPosition(Long userInfoId, Long[] positionIds) {
- LOGGER.info("用户岗位关系信息 RefSysUserInfoPosition userInfoId:{} positionIds:{} ",userInfoId,positionIds);
+ LOGGER.info("用户岗位关系信息 RefSysUserInfoPosition userInfoId:{} positionIds:{} ", userInfoId, positionIds);
SysUserInfo userInfo = userInfoRDao.getById(userInfoId);
- if(userInfo != null ){
+ if (userInfo != null) {
// 删除用户岗位关系
- refUserPositionRDao.deleteByProperty("userId",userInfo.getId());
+ refUserPositionRDao.deleteByProperty("userId", userInfo.getId());
- if(positionIds.length > 0){
+ if (positionIds.length > 0) {
List positionList = positionService.findByIdList(Arrays.asList(positionIds));
- if(positionList != null && positionList.size() >0){
+ if (positionList != null && positionList.size() > 0) {
List list = new ArrayList<>();
SysRefUserPosition ref = null;
for (SysPosition position : positionList) {
@@ -1149,10 +1169,10 @@ public class PersonnelServiceService implements IPersonnelService {
refUserPositionRDao.saveAll(list);
userInfoRDao.save(userInfo);
- LOGGER.info("用户岗位关系信息 SysUserInfo RefUserPositionRDao Insert Size :{}",list.size());
+ LOGGER.info("用户岗位关系信息 SysUserInfo RefUserPositionRDao Insert Size :{}", list.size());
}
}
- }else {
+ } else {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.VARIFY_EXCEPTION_DATA_NOT_EXIT.getCode())
@@ -1171,18 +1191,19 @@ public class PersonnelServiceService implements IPersonnelService {
/**
* 校验密码长度
+ *
* @return
*/
- private boolean checkPasswordLength(SysConfig config,String password){
- if(config != null){
- if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.NUMBER.getValue())){
+ private boolean checkPasswordLength(SysConfig config, String password) {
+ if (config != null) {
+ if (config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.NUMBER.getValue())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
.setErrorDetail("系统配置格式错误(密码长度)")
.setErrorSolution("请先配置系统参数")
.build();
- }else {
+ } else {
int length = Integer.parseInt(config.getConfigValue());
return password.trim().length() >= length;
}
@@ -1192,20 +1213,21 @@ public class PersonnelServiceService implements IPersonnelService {
/**
* 校验密码小写
+ *
* @param password
* @return
*/
- private boolean checkPasswordLowerEnglish(SysConfig config,String password){
- if(config != null){
- if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
+ private boolean checkPasswordLowerEnglish(SysConfig config, String password) {
+ if (config != null) {
+ if (config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
.setErrorDetail("系统配置格式错误(密码英文小写配置)")
.setErrorSolution("请先配置系统参数")
.build();
- }else {
- if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
+ } else {
+ if (config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) {
return StringTool.isContainLowerCase(password);
}
}
@@ -1215,20 +1237,21 @@ public class PersonnelServiceService implements IPersonnelService {
/**
* 校验密码大写
+ *
* @param password
* @return
*/
- private boolean checkPasswordUpperEnglish(SysConfig config,String password){
- if(config != null){
- if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
+ private boolean checkPasswordUpperEnglish(SysConfig config, String password) {
+ if (config != null) {
+ if (config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
.setErrorDetail("系统配置格式错误(密码英文大写配置)")
.setErrorSolution("请先配置系统参数")
.build();
- }else {
- if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
+ } else {
+ if (config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) {
return StringTool.isContainUpperCase(password);
}
}
@@ -1238,20 +1261,21 @@ public class PersonnelServiceService implements IPersonnelService {
/**
* 校验密码大写
+ *
* @param password
* @return
*/
- private boolean checkPasswordNumber(SysConfig config,String password){
- if(config != null){
- if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
+ private boolean checkPasswordNumber(SysConfig config, String password) {
+ if (config != null) {
+ if (config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
.setErrorDetail("系统配置格式错误(密码数字配置)")
.setErrorSolution("请先配置系统参数")
.build();
- }else {
- if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
+ } else {
+ if (config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) {
return StringTool.isContainNumber(password);
}
}
@@ -1261,20 +1285,21 @@ public class PersonnelServiceService implements IPersonnelService {
/**
* 校验密码特殊字符
+ *
* @param password
* @return
*/
- private boolean checkPasswordSpecialChar(SysConfig config,String password){
- if(config != null){
- if(config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())){
+ private boolean checkPasswordSpecialChar(SysConfig config, String password) {
+ if (config != null) {
+ if (config.getConfigValue() == null || config.getConfigType().equals(ImppEnumUtil.SYS_VALUE_TYPE.SWITCH.getValue())) {
throw ImppExceptionBuilder.newInstance()
.setSystemID(CommonEnumUtil.SOFT_TYPE.CORE.getCode())
.setErrorCode(ImppExceptionEnum.NOT_CONFIG_EXCEPTION.getCode())
.setErrorDetail("系统配置格式错误(密码特殊字符配置)")
.setErrorSolution("请先配置系统参数")
.build();
- }else {
- if(config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())){
+ } else {
+ if (config.getConfigValue().equals(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValueStr())) {
return StringTool.isConSpeCharacters(password);
}
}
@@ -1291,88 +1316,91 @@ public class PersonnelServiceService implements IPersonnelService {
*/
private boolean checkSysUserLoginName(String userLoginName, long userId) {
int count = 0;
- if(userId > 0){
+ if (userId > 0) {
StringBuffer sw = new StringBuffer();
- HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
- HqlPack.getStringEqualPack(userLoginName,"userLoginName",sw);
- HqlPack.getNumNOEqualPack(userId,"id",sw);
+ HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", sw);
+ HqlPack.getStringEqualPack(userLoginName, "userLoginName", sw);
+ HqlPack.getNumNOEqualPack(userId, "id", sw);
count = userRDao.findByHqlWhereCount(sw.toString());
- }else{
+ } else {
count = userRDao.findByPropertyCount(
- new String[]{"userLoginName","isValid"},
- new Object[]{userLoginName,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
+ new String[]{"userLoginName", "isValid"},
+ new Object[]{userLoginName, CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
- return count <= 0 ;
+ return count <= 0;
}
/**
* 用户邮箱唯一检查
+ *
* @param email
* @param infoId
* @return
*/
private boolean checkSysUserEmail(String email, long infoId) {
int count;
- if(infoId > 0){
+ if (infoId > 0) {
StringBuffer sw = new StringBuffer();
- HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
- HqlPack.getStringEqualPack(email,"userEmail",sw);
- HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
+ HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", sw);
+ HqlPack.getStringEqualPack(email, "userEmail", sw);
+ HqlPack.getNumNOEqualPack(infoId, "userInfoId", sw);
count = userRDao.findByHqlWhereCount(sw.toString());
- }else{
+ } else {
count = userRDao.findByPropertyCount(
- new String[]{"userEmail","isValid"},
- new Object[]{email,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
+ new String[]{"userEmail", "isValid"},
+ new Object[]{email, CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
- return count <= 0 ;
+ return count <= 0;
}
/**
* 手机号码 唯一校验
+ *
* @param phone
* @param infoId
* @return
*/
private boolean checkSysUserPhone(String phone, long infoId) {
int count;
- if(infoId > 0){
+ if (infoId > 0) {
StringBuffer sw = new StringBuffer();
- HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
- HqlPack.getStringEqualPack(phone,"userPhone",sw);
- HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
+ HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", sw);
+ HqlPack.getStringEqualPack(phone, "userPhone", sw);
+ HqlPack.getNumNOEqualPack(infoId, "userInfoId", sw);
count = userRDao.findByHqlWhereCount(sw.toString());
- }else{
+ } else {
count = userRDao.findByPropertyCount(
- new String[]{"userPhone","isValid"},
- new Object[]{phone,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
+ new String[]{"userPhone", "isValid"},
+ new Object[]{phone, CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
- return count <= 0 ;
+ return count <= 0;
}
/**
* 工号唯一检查
+ *
* @param empNo
* @param infoId
* @return
*/
private boolean checkSysUserEmpNo(String empNo, long infoId) {
int count;
- if(infoId > 0){
+ if (infoId > 0) {
StringBuffer sw = new StringBuffer();
- HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(),"isValid",sw);
- HqlPack.getStringEqualPack(empNo,"userEmpNo",sw);
- HqlPack.getNumNOEqualPack(infoId,"userInfoId",sw);
+ HqlPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", sw);
+ HqlPack.getStringEqualPack(empNo, "userEmpNo", sw);
+ HqlPack.getNumNOEqualPack(infoId, "userInfoId", sw);
count = userRDao.findByHqlWhereCount(sw.toString());
- }else{
+ } else {
count = userRDao.findByPropertyCount(
- new String[]{"userEmpNo","isValid"},
- new Object[]{empNo,CommonEnumUtil.IS_VAILD.VAILD.getValue()});
+ new String[]{"userEmpNo", "isValid"},
+ new Object[]{empNo, CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
- return count <= 0 ;
+ return count <= 0;
}
}
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleService.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleService.java
index 66cd810..bf7028e 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleService.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysRoleService.java
@@ -6,6 +6,7 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.exception.ImppExceptionEnum;
+import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
@@ -36,6 +37,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
+import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
@@ -299,6 +301,14 @@ public class SysRoleService extends CrudService implements ISysRoleServ
return this.roleRDao.findAll(example);
}
+ @Override
+ public List findAllByRoleProperty(SysRole sysRole) {
+ DdlPackBean packBean = DdlPackBean.getDdlPackBean(sysRole);
+ DdlPreparedPack.getNumEqualPack(sysRole.getRoleStatus(), "roleStatus", packBean);
+ DdlPreparedPack.getStringLikerPack(sysRole.getName(), "name", packBean);
+ return roleRDao.findByHqlWhere(packBean);
+ }
+
// @Override
// public void packAfterRefreshCache() {
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysUserService.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysUserService.java
index 06d94c0..98cb5fe 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysUserService.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/serviceimpl/busi/SysUserService.java
@@ -223,6 +223,29 @@ public class SysUserService implements ISysUserService {
}
@Override
+ public void updateBatchSysUserStatusByUserLoginNames(List userLoginNameList, int status) {
+
+ DdlPackBean ddlPackBean = new DdlPackBean();
+ DdlPreparedPack.getNumEqualPack(CommonEnumUtil.IS_VAILD.VAILD.getValue(), "isValid", ddlPackBean);
+ DdlPreparedPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(), "isDeleted", ddlPackBean);
+ DdlPreparedPack.getInPackList(userLoginNameList, "userLoginName", ddlPackBean);
+ String modifiedUser = "系统";
+ try {
+ modifiedUser = AuthUtil.getSessionUser().getUserName();
+ } catch (Exception e) {
+
+ }
+ userRDao.updateByProperties(
+ new String[]{"userStatus", "modifyDatetime", "modifyUser"},
+ new Object[]{status, TimeTool.getNowTime(true), modifiedUser},
+ ddlPackBean);
+// userRDao.updateByProperties(
+// new String[]{"userStatus", "modifyUser"},
+// new Object[]{status, modifiedUser},
+// ddlPackBean);
+ }
+
+ @Override
@ApiOperation(value = "修改账号", notes = "修改账号信息")
public void updateSysUser(SysUser sysUser) {
LOGGER.debug("平台用户 SYS_USER SysUser :{}", sysUser);
@@ -602,7 +625,7 @@ public class SysUserService implements ISysUserService {
public List findSysRefUserRoleMenuByUserId(Long userId) {
List roleList = findSysRefUserRoleByUserId(userId);
if (ObjectUtils.isEmpty(roleList)) {
- return null;
+ return null;
}
List roleIdList = roleList.stream().map(el -> el.getRoleId()).collect(Collectors.toList());
List menuList = roleService.findSysRefRoleMenuByRoleIdList(roleIdList);
diff --git a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/util/SysUserPasswordUtil.java b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/util/SysUserPasswordUtil.java
index 43f44b8..ead89c2 100644
--- a/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/util/SysUserPasswordUtil.java
+++ b/modules/i3plus-core-apiservice/src/main/java/cn/estsh/i3plus/core/apiservice/util/SysUserPasswordUtil.java
@@ -19,6 +19,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Propagation;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.naming.NamingException;
@@ -493,6 +495,7 @@ public class SysUserPasswordUtil {
int day = TimeTool.getSecoundsBetweenTime(4, user.getUserLoginLastDateTime(), TimeTool.getNowTime(true));
if(day > loginDayMax){
// 锁定账号信息
+ //todo: 账户没有被锁定,由于异常事务回滚,导致账户没有被锁定,这个更新操作就是多余的
userService.doLockSysUserById(user.getId());
throw ImppExceptionBuilder.newInstance()
diff --git a/modules/i3plus-core-apiservice/src/main/resources/application.properties b/modules/i3plus-core-apiservice/src/main/resources/application.properties
index 5c57413..80d6f6a 100644
--- a/modules/i3plus-core-apiservice/src/main/resources/application.properties
+++ b/modules/i3plus-core-apiservice/src/main/resources/application.properties
@@ -1,5 +1,5 @@
#\u4F7F\u7528\u914D\u7F6E
-spring.profiles.active=test
+spring.profiles.active=docker
#\u9879\u76EE\u63CF\u8FF0\u4FE1\u606F\uFF08swagger\u4E2D\u663E\u5F0F\uFF09\uFF0C\u4E2D\u6587\u4F7F\u7528uncode\u8F6C\u7801
desc.application.name=\u6838\u5FC3\u7BA1\u7406\u540E\u53F0
@@ -69,4 +69,4 @@ redis.resource.db=0
#\u7528\u6237\u4F1A\u8BDD\u7F13\u5B58\u5E93
redis.session.db=1
#\u7CFB\u7EDF\u5168\u5C40\u7F13\u5B58\u5E93\uFF0C\u5B58\u653E\u5E73\u53F0\u6838\u5FC3\u6570\u636E\u7F13\u5B58
-redis.core.db=2
\ No newline at end of file
+redis.core.db=2
diff --git a/pom.xml b/pom.xml
index 347af6b..b298123 100644
--- a/pom.xml
+++ b/pom.xml
@@ -7,7 +7,7 @@
i3plus.core
i3plus-core
pom
- 1.0-TEST-SNAPSHOT
+ 1.0.0.2
modules/i3plus-core-api
modules/i3plus-core-apiservice
@@ -37,6 +37,7 @@
true
UTF-8
1.8
+ 1.0-TEST-SNAPSHOT
@@ -48,82 +49,82 @@
impp.framework
impp-framework-boot
- ${project.version}
+ ${project.dependency.version}
i3plus.core
i3plus-core-icloud
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-wms
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-mes
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-mes-pcn
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-ptl
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-andon
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-form
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-softswitch
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-mdm
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-screen
- ${project.version}
+ ${project.dependency.version}
i3plus.pojo
i3plus-pojo-model
- ${project.version}
+ ${project.dependency.version}
i3plus.pojo
i3plus-pojo-mdm
- ${project.version}
+ ${project.dependency.version}
@@ -136,65 +137,65 @@
i3plus.sdk
i3plus-sdk-dingtalk
- ${project.version}
+ ${project.dependency.version}
i3plus.sdk
i3plus-sdk-wechat
- ${project.version}
+ ${project.dependency.version}
i3plus.sdk
i3plus-sdk-sms
- ${project.version}
+ ${project.dependency.version}
i3plus.platform
i3plus-platform-common
- ${project.version}
+ ${project.dependency.version}
i3plus.platform
i3plus-platform-plugin
- ${project.version}
+ ${project.dependency.version}
i3plus.platform
i3plus-platform-plugin
- ${project.version}
+ ${project.dependency.version}
i3plus.pojo
i3plus-pojo-platform
- ${project.version}
+ ${project.dependency.version}
i3plus.pojo
i3plus-pojo-mes
- ${project.version}
+ ${project.dependency.version}
i3plus.pojo
i3plus-pojo-base
- ${project.version}
+ ${project.dependency.version}
i3plus.pojo
i3plus-pojo-mes
- ${project.version}
+ ${project.dependency.version}
i3plus.icloud
i3plus-icloud-core
- ${project.version}
+ ${project.dependency.version}
@@ -423,4 +424,4 @@
-
\ No newline at end of file
+