Merge remote-tracking branch 'origin/dev' into dev

yun-zuoyi
汪云昊 6 years ago
commit 4b10421349

@ -1,7 +1,7 @@
package cn.estsh.i3plus.core.api.iservice.busi;
import cn.estsh.i3plus.pojo.platform.bean.SysPosition;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserPosition;
import cn.estsh.i3plus.pojo.model.platform.CommonTreeModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import io.swagger.annotations.ApiOperation;
import java.util.List;
@ -59,4 +59,65 @@ public interface ICoreMemTreeService {
@ApiOperation(value = "查询岗位子节点",notes = "查询字节点岗位ID")
List<Long> findChildSysPosition(SysPosition position);
@ApiOperation(value = "查询岗位子节点",notes = "查询字节点岗位ID")
List<Long> findSysPositionChildIdList(Long id);
/********************************************* Start SysOrganize Tree *********************************************/
@ApiOperation(value = "分装组织树",notes = "分装组织树")
List<SysOrganize> packTreeSysOrganize(List<SysOrganize> list,Long parentId);
@ApiOperation(value = "分装组织树",notes = "根据用户组织关系分装组织树")
List<SysOrganize> packTreeSysOrganizeBySysRefUserOrganize(List<SysOrganize> list, List<SysRefUserDepartment> refList);
@ApiOperation(value = "分装组织树",notes = "根据用户组织关系分装组织树")
List<SysOrganize> packTreeSysOrganizeBySysRefUserInfoOrganize(List<SysOrganize> list, List<SysRefUserInfoDepartment> refList);
@ApiOperation(value = "分装组织树",notes = "根据制定IDS分装组织树")
List<SysOrganize> packTreeSysOrganizeByIds(List<SysOrganize> list, List<Long> ids);
@ApiOperation(value = "分装组织树",notes = "根据制定ID分装组织树")
SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id);
@ApiOperation(value = "查询组织子节点",notes = "查询字节点组织ID")
List<Long> findChildSysOrganize(SysOrganize organize);
/********************************************* End SysOrganize Tree *********************************************/
/********************************************* Start CommonTreeModel Tree *********************************************/
@ApiOperation(value = "组织树转TreeModel",notes = "根据帐号ID 分装TreeModel")
List<CommonTreeModel> packTreeTreeModelUser(List<SysOrganize> organizeList,List<SysDepartment> departmentList,List<SysRefUserDepartment> refList);
@ApiOperation(value = "组织树转TreeModel",notes = "使用分装好的树转为TreeMode")
List<CommonTreeModel> packTreeTreeModelSysOrganize(List<SysOrganize> list);
@ApiOperation(value = "组织树转TreeModel",notes = "使用分装好的树转为TreeMode")
List<CommonTreeModel> packTreeTreeModelSysDepartment(List<SysDepartment> list);
List<CommonTreeModel> packTreeTreeModel(List<CommonTreeModel> list, List<SysDepartment> departmentList);
/********************************************* End CommonTreeModel Tree *********************************************/
/********************************************* Start SysDepartment Tree *********************************************/
@ApiOperation(value = "分装部门树",notes = "分装部门树")
List<SysDepartment> packTreeSysDepartment(List<SysDepartment> list,Long parentId);
@ApiOperation(value = "分装部门树",notes = "根据用户部门关系分装部门树")
List<SysDepartment> packTreeSysDepartmentBySysRefUserOrganize(List<SysDepartment> list, List<SysRefUserDepartment> refList);
@ApiOperation(value = "分装部门树",notes = "根据用户部门关系分装部门树")
List<SysDepartment> packTreeSysDepartmentBySysRefUserInfoOrganize(List<SysDepartment> list, List<SysRefUserInfoDepartment> refList);
@ApiOperation(value = "分装部门树",notes = "根据制定IDS分装部门树")
List<SysDepartment> packTreeSysDepartmentByIds(List<SysDepartment> list, List<Long> ids);
@ApiOperation(value = "分装部门树",notes = "根据制定ID分装部门树")
SysDepartment packTreeSysDepartmentById(List<SysDepartment> list, Long id);
@ApiOperation(value = "查询部门子节点",notes = "查询字节点部门ID")
List<Long> findChildSysDepartment(SysDepartment organize);
/********************************************* End SysDepartment Tree *********************************************/
}

@ -81,8 +81,11 @@ public interface IPersonnelService {
@ApiOperation(value = "查询账号角色关系")
List<SysRefUserRole> findSysRefUserRoleById(Long userId);
@ApiOperation(value = "查询角色",notes = "查询制定用户的角色信息")
List<SysRole> findSysRoleByUserId(Long userId);
@ApiOperation(value = "查询账号部门关系")
List<SysRefUserDepartment> findSysRefUserDepartmentById(Long userId);
List<SysRefUserDepartment> findSysRefUserDepartmentByUserId(Long userId);
@ApiOperation(value = "查询账号部门关系")
List<SysRefUserDepartment> querySysRefUserDepartmentByUserDetailModel(UserDetailModel model);
@ -96,12 +99,19 @@ public interface IPersonnelService {
@ApiOperation(value = "查询账号部门关系")
List<SysDepartment> findSysUserDepartmentByInfoId(Long infoId);
@ApiOperation(value = "查询所有部门信息")
List<SysDepartment> findSysUserDepartmentList();
@ApiOperation(value = "查询用户部门关系")
List<SysOrganize> findSysUserInfoOrganize(Long infoId);
@ApiOperation(value = "查询账户组织关系")
List<SysOrganize> findSysUserOrganize(Long infoId);
List<SysOrganize> findSysOrganizeList();
List<SysPosition> findSysPositionList();
@ApiOperation(value = "查询用户岗位关系")
List<SysRefUserPosition> findSysRefUserPositionById(Long infoId);

@ -4,6 +4,7 @@ import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserDepartment;
import io.swagger.annotations.ApiOperation;
import java.util.List;
@ -71,6 +72,8 @@ public interface ISysOrganizeService {
@ApiOperation(value = "查询组织信息",notes = "查询 组织信息(分页、组合)")
ListPager<SysOrganize> querySysOrganize(SysOrganize organize, Pager pager);
ListPager<SysOrganize> querySysOrganize(SysOrganize organize,List<Long> idList, Pager pager);
/**
* id
* @param id
@ -85,4 +88,12 @@ public interface ISysOrganizeService {
*/
@ApiOperation(value = "查询组织个数")
long getSysOrganizeCount();
/**
* ID
* @return
*/
@ApiOperation(value = "查询当前用户所有组织数据",notes = "查询当前用户所有组织数据")
List<SysOrganize> findOrganizeIdByRefUsers(List<SysRefUserDepartment> sysRefUserDepartments);
}

@ -59,13 +59,18 @@ public interface ISysPositionService {
/**
*
* 使 
* @param position
* @param pager
* @return
*/
@Deprecated
@ApiOperation(value = "查询岗位信息",notes = "查询岗位信息 (分页,组合)")
ListPager<SysPosition> querySysPosition(SysPosition position, Pager pager);
@ApiOperation(value = "查询岗位信息",notes = "查询岗位信息 (分页,组合)")
ListPager<SysPosition> querySysPosition(SysPosition position,List<Long> idList, Pager pager);
/**
* Key
*

@ -144,6 +144,9 @@ public interface ISysRoleService {
@ApiOperation(value = "查信角色信息",notes = "查询角色信息(分页/组合)")
ListPager<SysRole> querySysRole(SysRole role, Pager pager);
@ApiOperation(value = "查信角色信息",notes = "查询角色信息(分页/组合)")
ListPager<SysRole> querySysRole(SysRole role,List<Long> idList, Pager pager);
/***
*
* @param role

@ -77,6 +77,18 @@ public class AuthController extends CoreBaseController {
}
}
@GetMapping(value = "/get-user-type")
@ApiOperation(value = "获取登录用户信息", notes = "获取当前登录用户账号详细信息")
public ResultBean getUserType() {
LOGGER.info("获取用户信息...lang:{}", AuthUtil.getSessionAttribute("languageCode"));
try {
CommonEnumUtil.USER_TYPE type = AuthUtil.getUserType();
return new ResultBean(true, "", type);
} catch (ImppBusiException e) {
return new ResultBean(false, e.getErrorDetail() + "-[解决]" + e.getErrorSolution());
}
}
/**
*

@ -297,7 +297,7 @@ public class PersonnelController extends CoreBaseController {
List<SysRefUserInfoDepartment> refUserInfoDepartmentList = personnelService.findSysRefUserInfoDepartmentById(info.getId());
List<SysRefUserPosition> refUserPositionList = personnelService.findSysRefUserPositionById(info.getId());
List<SysRefUserDepartment> refUserDepartmentList = personnelService.findSysRefUserDepartmentById(user.getId());
List<SysRefUserDepartment> refUserDepartmentList = personnelService.findSysRefUserDepartmentByUserId(user.getId());
List<SysRefUserRole> refUserRoleList = personnelService.findSysRefUserRoleById(user.getId());
SysFile image = info.getUserImageId() != null ? fileService.getSysFileById(info.getUserImageId()) : null;
@ -331,7 +331,7 @@ public class PersonnelController extends CoreBaseController {
SysUser user = personnelService.getSysUserById(Long.parseLong(id));
List<SysRefUserDepartment> refUserInfoDepartmentList = personnelService.findSysRefUserDepartmentById(user.getId());
List<SysRefUserDepartment> refUserInfoDepartmentList = personnelService.findSysRefUserDepartmentByUserId(user.getId());
List<SysRefUserRole> refUserRoleList = personnelService.findSysRefUserRoleById(user.getId());
resultMap.put("refUserDepartmentList", refUserInfoDepartmentList);

@ -6,8 +6,8 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISysPositionService;
import cn.estsh.i3plus.platform.common.util.PlatformConstWords;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysPosition;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserPosition;
import cn.estsh.i3plus.pojo.model.platform.CommonTreeModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.SysRefUserPositionRepository;
import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
@ -68,12 +68,11 @@ public class SysMemTreeController extends CoreBaseController {
/**
* ID
* @param userId
* @return
*/
@GetMapping(value="/position/user")
@ApiOperation(value="查询岗位树",notes="通过部门主键获取岗位树,-1为根节点")
public ResultBean listSysPositionParentId(Long userId) {
public ResultBean listSysPositionParentId() {
try {
List list = positionService.listSysPosition();
List listTree = memTreeService.packTreeSysPosition(list, CommonEnumUtil.PARENT.DEFAULT.getValue());
@ -156,4 +155,49 @@ public class SysMemTreeController extends CoreBaseController {
}
}
/**
* ID
* @return
*/
@GetMapping(value="/organize/user")
@ApiOperation(value="查询岗位树",notes="通过部门主键获取岗位树,-1为根节点")
public ResultBean findSysOrganizeByUser() {
try {
List<SysOrganize> list = personnelService.findSysOrganizeList();
List listTree = memTreeService.packTreeSysOrganize(list, CommonEnumUtil.PARENT.DEFAULT.getValue());
List<SysRefUserDepartment> refList = personnelService.findSysRefUserDepartmentByUserId(getSessionUser().getUser().getId());
List userTreeList = memTreeService.packTreeSysOrganizeBySysRefUserOrganize(listTree, refList);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(userTreeList);
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/**
* ID
* @return
*/
@GetMapping(value="/organize-department/user")
@ApiOperation(value="查询岗位树",notes="通过部门主键获取岗位树,-1为根节点")
public ResultBean findTreeModelUser() {
try {
List<SysRefUserDepartment> refList = personnelService.findSysRefUserDepartmentByUserId(getSessionUser().getUser().getId());
if(refList != null && refList.size()> 0){
List<SysOrganize> organizeList = personnelService.findSysOrganizeList();
List<SysDepartment> departmentList = personnelService.findSysUserDepartmentList();
List<CommonTreeModel> result = memTreeService.packTreeTreeModelUser(organizeList, departmentList, refList);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(result);
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
}

@ -1,5 +1,7 @@
package cn.estsh.i3plus.core.apiservice.controller.busi;
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysOrganizeService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.StringTool;
@ -9,6 +11,7 @@ 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.SysOrganize;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserDepartment;
import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
@ -21,9 +24,13 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Description :
@ -42,6 +49,12 @@ public class SysOrganizeController extends CoreBaseController{
@Autowired
private ISysOrganizeService organizeService;
@Autowired
private IPersonnelService personnelService;
@Autowired
private ICoreMemTreeService coreMemTreeService;
/**
*
* @param organize
@ -133,8 +146,9 @@ public class SysOrganizeController extends CoreBaseController{
@ApiOperation(value = "查询所有组织", notes = "查询所有组织")
public ResultBean findSysOrganizeAll() {
try {
List<SysOrganize> list = organizeService.listSysOrganize();
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(list);
List<SysRefUserDepartment> refList = personnelService.findSysRefUserDepartmentByUserId(getSessionUser().getUser().getId());
List<SysOrganize> result = organizeService.findOrganizeIdByRefUsers(refList);
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(result);
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
@ -152,8 +166,15 @@ public class SysOrganizeController extends CoreBaseController{
@ApiOperation(value="查询组织",notes="组合查询组织外加分页")
public ResultBean queryPosition(SysOrganize organize, Pager pager){
try{
ListPager<SysOrganize> listPager = organizeService.querySysOrganize(organize, pager);
return ResultBean.success("操作成功").setListPager(listPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
List<SysRefUserDepartment> refList = personnelService.findSysRefUserDepartmentByUserId(getSessionUser().getUser().getId());
if(refList != null && refList.size() > 0){
List<Long> idList = new ArrayList<>(refList.size());
refList.forEach(ref ->idList.add(ref.getOrganizeId()));
return ResultBean.success("操作成功").setListPager(organizeService.querySysOrganize(organize, idList, pager))
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){

@ -1,5 +1,7 @@
package cn.estsh.i3plus.core.apiservice.controller.busi;
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysPositionService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.StringTool;
@ -10,6 +12,7 @@ import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.enumutil.ResourceEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysPosition;
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserPosition;
import cn.estsh.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppBusiException;
@ -24,6 +27,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -42,6 +46,12 @@ public class SysPositionController extends CoreBaseController {
@Autowired
private ISysPositionService positionService;
@Autowired
private IPersonnelService personnelService;
@Autowired
private ICoreMemTreeService memTreeService;
/**
*
*
@ -139,10 +149,23 @@ public class SysPositionController extends CoreBaseController {
@ApiOperation(value = "查询岗位", notes = "复杂查询岗位带分页")
public ResultBean querySysPosition(SysPosition position, Pager pager) {
try {
position.setOrganizeCode(AuthUtil.getOrganize().getOrganizeCode());
ListPager<SysPosition> listPager = positionService.querySysPosition(position, pager);
return ResultBean.success("操作成功").setListPager(listPager)
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
List<SysRefUserPosition> refList = personnelService.findSysRefUserPositionById(getSessionUser().getUserInfo().getId());
if(refList != null && refList.size() > 0){
List<Long> idList = new ArrayList<>();
if(position.getParentId() != null){
idList = memTreeService.findSysPositionChildIdList(position.getParentId());
}else{
for (SysRefUserPosition ref : refList) {
idList.add(ref.getPositionId());
}
}
ListPager<SysPosition> listPager = positionService.querySysPosition(position,idList, pager);
return ResultBean.success("操作成功").setListPager(listPager).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {

@ -1,5 +1,6 @@
package cn.estsh.i3plus.core.apiservice.controller.busi;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
import cn.estsh.i3plus.platform.common.tool.StringTool;
@ -9,6 +10,7 @@ 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.impp.framework.base.controller.CoreBaseController;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
@ -24,6 +26,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -43,6 +46,9 @@ public class SysRoleController extends CoreBaseController{
@Autowired
private ISysRoleService sysRoleService;
@Autowired
private IPersonnelService personnelService;
/**
*
* @param role
@ -141,6 +147,19 @@ public class SysRoleController extends CoreBaseController{
}
}
@GetMapping(value = "/list-user")
@ApiOperation(value = "查询角色", notes = "查询用户所拥有的角色信息")
public ResultBean findSysRoleByUser() {
try {
List<SysRole> result = personnelService.findSysRoleByUserId(getSessionUser().getUser().getId());
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()).setResultList(result);
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/**
*
* @param ids id
@ -191,10 +210,16 @@ public class SysRoleController extends CoreBaseController{
@ApiOperation(value="查询角色",notes="组合查询角色,外带分页功能")
public ResultBean querySysRole(SysRole role, Pager pager){
try{
ListPager<SysRole> listPager = sysRoleService.querySysRole(role, pager);
List<SysRefUserRole> refList = personnelService.findSysRefUserRoleById(getSessionUser().getUser().getId());
return ResultBean.success("操作成功").setListPager(listPager)
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
if(refList != null && refList.size() > 0){
List<Long> idList = new ArrayList<>(refList.size());
refList.forEach(ref -> idList.add(ref.getRoleId()));
return ResultBean.success("操作成功").setListPager(sysRoleService.querySysRole(role, idList, pager))
.setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}
return ResultBean.success("操作成功").setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}catch(ImppBusiException busExcep){
return ResultBean.fail(busExcep);
}catch(Exception e){

@ -1,10 +1,13 @@
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.core.api.iservice.busi.ICoreMemTreeService;
import cn.estsh.i3plus.platform.common.util.CommonConstWords;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.platform.bean.SysPosition;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserPosition;
import cn.estsh.i3plus.pojo.base.enumutil.ModelEnumUtil;
import cn.estsh.i3plus.pojo.model.platform.CommonTreeModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -20,12 +23,15 @@ import java.util.List;
@Service
public class CoreMemTreeService implements ICoreMemTreeService {
@Autowired
private IPersonnelService personnelService;
@Override
public List<SysPosition> packTreeSysPosition(List<SysPosition> list, Long parentId) {
List<SysPosition> result = new ArrayList<>();
List<SysPosition> copyList = new ArrayList<>(list);
if(list != null && list.size() > 0){
List<SysPosition> copyList = new ArrayList<>(list);
list.forEach(position -> {
if(position.getParentId() != null && position.getParentId().equals(parentId)){
result.add(position);
@ -43,9 +49,7 @@ public class CoreMemTreeService implements ICoreMemTreeService {
List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){
refList.forEach(ref ->{
ids.add(ref.getPositionId());
});
refList.forEach(ref -> ids.add(ref.getPositionId()));
}
return packTreeSysPositionByIds(list, ids);
@ -100,4 +104,299 @@ public class CoreMemTreeService implements ICoreMemTreeService {
return result;
}
@Override
public List<Long> findSysPositionChildIdList(Long id) {
SysPosition position = personnelService.getSysPositionById(id);
if(position != null){
List<SysPosition> list = personnelService.findSysPositionList();
if(list != null && list.size() > 0){
List<SysPosition> treeList = packTreeSysPosition(list, CommonEnumUtil.PARENT.DEFAULT.getValue());
SysPosition treeSPosition = packTreeSysPositionById(treeList, position.getId());
List<Long> idList = findChildSysPosition(treeSPosition);
idList.add(position.getId());
return idList;
}
}
return null;
}
/********************************************* Start SysOrganize Tree *********************************************/
@Override
public List<SysOrganize> packTreeSysOrganize(List<SysOrganize> list, Long parentId) {
List<SysOrganize> result = new ArrayList<>();
if(list != null && list.size() > 0){
List<SysOrganize> copyList = new ArrayList<>(list);
list.forEach(organize -> {
if(organize.getParentId() != null && organize.getParentId().equals(parentId)){
result.add(organize);
copyList.remove(organize);
organize.setChildList(packTreeSysOrganize(copyList, organize.getId()));
}
});
}
return result;
}
@Override
public List<SysOrganize> packTreeSysOrganizeBySysRefUserOrganize(List<SysOrganize> list, List<SysRefUserDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){
refList.forEach(ref -> ids.add(ref.getOrganizeId()));
}
return packTreeSysOrganizeByIds(list, ids);
}
@Override
public List<SysOrganize> packTreeSysOrganizeBySysRefUserInfoOrganize(List<SysOrganize> list, List<SysRefUserInfoDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){
refList.forEach(ref ->{
ids.add(ref.getOrganizeId());
});
}
return packTreeSysOrganizeByIds(list, ids);
}
@Override
public List<SysOrganize> packTreeSysOrganizeByIds(List<SysOrganize> list, List<Long> ids) {
List<SysOrganize> result = new ArrayList<>();
if(list != null && list.size() > 0){
list.forEach(organize -> {
if(organize.getChildList() == null || organize.getChildList().size() <= 0){
if(ids.contains(organize.getId())){
result.add(organize);
}
}else{
List<SysOrganize> childList = packTreeSysOrganizeByIds(organize.getChildList(), ids);
if(ids.contains(organize.getId()) || childList != null && childList.size() > 0){
organize.setChildList(childList);
result.add(organize);
}
}
});
}
return result;
}
@Override
public SysOrganize packTreeSysOrganizeById(List<SysOrganize> list, Long id) {
if(list != null && list.size() > 0){
for (SysOrganize organize : list) {
if(organize.getId().equals(id)){
organize.setChildList(packTreeSysOrganize(list, organize.getId()));
return organize;
}
}
}
return null;
}
@Override
public List<Long> findChildSysOrganize(SysOrganize organize) {
List<Long> result = new ArrayList<>();
if(organize != null && organize.getChildList() != null && organize.getChildList().size() > 0){
for (SysOrganize so : organize.getChildList()) {
result.add(so.getId());
result.addAll(findChildSysOrganize(so));
}
}
return result;
}
/********************************************* End SysOrganize Tree *********************************************/
/********************************************* Start CommonTreeModel Tree *********************************************/
@Override
public List<CommonTreeModel> packTreeTreeModelUser(List<SysOrganize> organizeList, List<SysDepartment> departmentList, List<SysRefUserDepartment> refList) {
if(refList != null && organizeList != null && departmentList != null){
List<Long> organizeIdList = new ArrayList<>();
List<Long> departmentIdList = new ArrayList<>();
refList.forEach(ref -> {
if(!organizeIdList.contains(ref.getOrganizeId())){
organizeIdList.add(ref.getOrganizeId());
}
if(!departmentIdList.contains(ref.getDepartmentId())){
departmentIdList.add(ref.getDepartmentId());
}
});
organizeList = packTreeSysOrganize(organizeList, CommonEnumUtil.PARENT.DEFAULT.getValue());
organizeList = packTreeSysOrganizeByIds(organizeList, organizeIdList);
departmentList = packTreeSysDepartment(departmentList, CommonEnumUtil.PARENT.DEFAULT.getValue());
departmentList = packTreeSysDepartmentByIds(departmentList, departmentIdList);
List<CommonTreeModel> modelList = packTreeTreeModelSysOrganize(organizeList);
List<CommonTreeModel> result = packTreeTreeModel(modelList, departmentList);
return result;
}
return null;
}
@Override
public List<CommonTreeModel> packTreeTreeModelSysOrganize(List<SysOrganize> list) {
List<CommonTreeModel> result = new ArrayList<>();
if(list != null && list.size() > 0){
for (SysOrganize organize : list) {
CommonTreeModel model = new CommonTreeModel();
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_ORGANIZE.getValue());
model.setBean(organize);
model.getChildList().addAll(packTreeTreeModelSysOrganize(organize.getChildList()));
result.add(model);
}
}
return result;
}
@Override
public List<CommonTreeModel> packTreeTreeModelSysDepartment(List<SysDepartment> list) {
List<CommonTreeModel> result = new ArrayList<>();
if(list != null && list.size() > 0){
for (SysDepartment department : list) {
CommonTreeModel model = new CommonTreeModel();
model.setBeanType(ModelEnumUtil.COMMON_TREE_TYPE.TYPE_DEPARTMENT.getValue());
model.setBean(department);
model.getChildList().addAll(packTreeTreeModelSysDepartment(department.getChildList()));
result.add(model);
}
}
return result;
}
@Override
public List<CommonTreeModel> packTreeTreeModel(List<CommonTreeModel> list, List<SysDepartment> departmentList) {
if(list != null && list.size() > 0 && departmentList != null && departmentList.size() > 0){
list.forEach(model -> {
SysOrganize organize = (SysOrganize) model.getBean();
List<SysDepartment> departments = new ArrayList<>();
departmentList.forEach(department -> {
if(department.getParentId().equals(CommonEnumUtil.PARENT.DEFAULT.getValue()) && department.getOrganizeId().equals(organize.getId())){
departments.add(department);
}
});
List<CommonTreeModel> childList = new ArrayList<>();
childList.addAll(packTreeTreeModel(model.getChildList(), departmentList));
childList.addAll(packTreeTreeModelSysDepartment(departments));
model.setChildList(childList);
});
}
return list;
}
/********************************************* Start CommonTreeModel Tree *********************************************/
/********************************************* Start SysDepartment Tree *********************************************/
@Override
public List<SysDepartment> packTreeSysDepartment(List<SysDepartment> list, Long parentId) {
List<SysDepartment> result = new ArrayList<>();
if(list != null && list.size() > 0){
List<SysDepartment> copyList = new ArrayList<>(list);
list.forEach(department -> {
if(department.getParentId() != null && department.getParentId().equals(parentId)){
result.add(department);
copyList.remove(department);
department.setChildList(packTreeSysDepartment(copyList, department.getId()));
}
});
}
return result;
}
@Override
public List<SysDepartment> packTreeSysDepartmentBySysRefUserOrganize(List<SysDepartment> list, List<SysRefUserDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){
refList.forEach(ref -> ids.add(ref.getDepartmentId()));
}
return packTreeSysDepartmentByIds(list, ids);
}
@Override
public List<SysDepartment> packTreeSysDepartmentBySysRefUserInfoOrganize(List<SysDepartment> list, List<SysRefUserInfoDepartment> refList) {
List<Long> ids = new ArrayList<>(refList.size());
if(refList != null && refList.size() > 0){
refList.forEach(ref -> ids.add(ref.getDepartmentId()));
}
return packTreeSysDepartmentByIds(list, ids);
}
@Override
public List<SysDepartment> packTreeSysDepartmentByIds(List<SysDepartment> list, List<Long> ids) {
List<SysDepartment> result = new ArrayList<>();
if(list != null && list.size() > 0){
list.forEach(department -> {
if(department.getChildList() == null || department.getChildList().size() <= 0){
if(ids.contains(department.getId())){
result.add(department);
}
}else{
List<SysDepartment> childList = packTreeSysDepartmentByIds(department.getChildList(), ids);
if(ids.contains(department.getId()) || childList != null && childList.size() > 0){
department.setChildList(childList);
result.add(department);
}
}
});
}
return result;
}
@Override
public SysDepartment packTreeSysDepartmentById(List<SysDepartment> list, Long id) {
if(list != null && list.size() > 0){
for (SysDepartment department : list) {
if(department.getId().equals(id)){
department.setChildList(packTreeSysDepartment(list, department.getId()));
return department;
}
}
}
return null;
}
@Override
public List<Long> findChildSysDepartment(SysDepartment department) {
List<Long> result = new ArrayList<>();
if(department != null && department.getChildList() != null && department.getChildList().size() > 0){
for (SysDepartment dep : department.getChildList()) {
result.add(dep.getId());
result.addAll(findChildSysDepartment(dep));
}
}
return result;
}
/********************************************* End SysDepartment Tree *********************************************/
}

@ -6,6 +6,7 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
import cn.estsh.i3plus.core.apiservice.util.HqlModelPack;
import cn.estsh.i3plus.platform.common.tool.StringTool;
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;
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
@ -17,7 +18,6 @@ import cn.estsh.i3plus.pojo.model.platform.UserDetailModel;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.repository.*;
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
import cn.estsh.i3plus.pojo.wms.sqlpack.WmsHqlPack;
import cn.estsh.impp.framework.boot.auth.AuthUtil;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
@ -97,13 +97,13 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public SysUser saveSysUser(SysUser user) {
LOGGER.debug("平台账号 SysUser user:{}", user);
LOGGER.info("平台账号 SysUser user:{}", user);
return userRDao.save(user);
}
@Override
public SysUserInfo saveSysUserInfo(SysUserInfo info) {
LOGGER.debug("平台用户 SysUserInfo info:{}", info);
LOGGER.info("平台用户 SysUserInfo info:{}", info);
return userInfoRDao.save(info);
}
@ -114,7 +114,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void updateSysUserOrganize(Long userId, Long organizeId) {
LOGGER.debug("平台账号 SysUser userId:{} organizeId",userId, organizeId);
LOGGER.info("平台账号 SysUser userId:{} organizeId",userId, organizeId);
SysUser user = userRDao.getById(userId);
if(user != null){
user.setOrganizeId(organizeId);
@ -125,7 +125,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "删除账号信息")
public void deleteSysUser(Long[] userIdList,String userName) {
LOGGER.debug("平台账号 SysUser userIdList:{}", userIdList);
LOGGER.info("平台账号 SysUser userIdList:{}", userIdList);
// 删除账号信息
userRDao.updateValidStatusByPropertyIn("id", userIdList,CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
@ -137,7 +137,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "删除用户信息")
public void deleteSysUserInfo(Long[] infoIdList,String userName) {
LOGGER.debug("平台用户 SysUserInfo infoIdList:{}", infoIdList);
LOGGER.info("平台用户 SysUserInfo infoIdList:{}", infoIdList);
// 删除用户信息
userInfoRDao.updateValidStatusByPropertyIn("id", infoIdList,CommonEnumUtil.IS_VAILD.INVAILD.getValue(), userName);
@ -153,7 +153,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List<SysUser> findSysUserByIds(Long[] ids) {
LOGGER.debug("平台用户 SysUserInfo ids:{}", ids);
LOGGER.info("平台用户 SysUserInfo ids:{}", ids);
String infoWhere = CoreHqlPack.packHqlIds("id", ids);
return userRDao.findByHqlWhere(infoWhere);
@ -161,7 +161,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List<SysUser> querySysUserByUserDetailModelOrIds(UserDetailModel model, List<Long> ids) {
LOGGER.debug("平台用户 SysUser model:{} ids:{}", model, ids);
LOGGER.info("平台用户 SysUser model:{} ids:{}", model, ids);
String modeWhere = HqlModelPack.packHqlSysUserByModelOrIds(model, ids);
return userRDao.findByHqlWhere(modeWhere);
@ -170,7 +170,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "查询账号信息")
public ListPager<SysUser> querySysUserPagerByUserDetailModelOrIds(UserDetailModel model,Pager pager, List<Long> ids) {
LOGGER.debug("平台用户 SysUser model:{} ids:{}", model, ids);
LOGGER.info("平台用户 SysUser model:{} ids:{}", model, ids);
String modeWhere = HqlModelPack.packHqlSysUserByModelOrIds(model, ids);
pager = PagerHelper.getPager(pager, userRDao.findByHqlWhereCount(modeWhere));
@ -199,7 +199,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public SessionUser queryUserLogin(String userName, String password, String languageCode) {
LOGGER.debug("平台用户 SYS_USER loginName:{} \t password:{} \t languageCode:{}", userName, password, languageCode);
LOGGER.info("平台用户 SYS_USER loginName:{} \t password:{} \t languageCode:{}", userName, password, languageCode);
UserToken token = new UserToken(userName,password,languageCode);
SessionUser sessionUser = AuthUtil.login(token);
AuthUtil.setSessionUser(sessionUser);
@ -214,7 +214,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List<SysUserInfo> findSysUserInfoByIds(Long[] ids) {
LOGGER.debug("平台用户 SysUserInfo ids:{}", ids);
LOGGER.info("平台用户 SysUserInfo ids:{}", ids);
String infoWhere = CoreHqlPack.packHqlIds("id", ids);
return userInfoRDao.findByHqlWhere(infoWhere);
@ -222,13 +222,33 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List<SysRefUserRole> findSysRefUserRoleById(Long userId) {
LOGGER.debug("平台账号角色 SysRefUserRole userId:{}", userId);
LOGGER.info("平台账号角色 SysRefUserRole userId:{}", userId);
return refUserRoleRDao.findByProperty("userId",userId);
}
@Override
public List<SysRefUserDepartment> findSysRefUserDepartmentById(Long userId) {
LOGGER.debug("平台账号部门 SysRefUserDepartment userId:{}", userId);
public List<SysRole> findSysRoleByUserId(Long userId) {
LOGGER.debug("平台账号角色 SysRole userId:{}", userId);
List<SysRefUserRole> refList = findSysRefUserRoleById(userId);
if(refList != null && refList.size() > 0){
List<Long> idList = new ArrayList<>();
StringBuffer findWhere = new StringBuffer();
refList.forEach(ref -> idList.add(ref.getRoleId()));
HqlPack.getInPack(StringUtils.join(idList,","),"id",findWhere);
HqlPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue(),"isDeleted",findWhere);
HqlPack.getNumEqualPack(CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(),"isValid",findWhere);
return roleRDao.findByHqlWhere(findWhere.toString());
}
return null;
}
@Override
public List<SysRefUserDepartment> findSysRefUserDepartmentByUserId(Long userId) {
LOGGER.info("平台账号部门 SysRefUserDepartment userId:{}", userId);
return refUserDepartmentRDao.findByProperty("userId",userId);
}
@ -252,14 +272,14 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List<SysRefUserInfoDepartment> findSysRefUserInfoDepartmentById(Long infoId) {
LOGGER.debug("平台用户部门关系 SysRefUserInfoDepartment infoId:{}", infoId);
LOGGER.info("平台用户部门关系 SysRefUserInfoDepartment infoId:{}", infoId);
return refUserInfoDepartmentRDao.findByProperty("userId",infoId);
}
@Override
@ApiOperation(value = "查询用户部门关系")
public List<SysDepartment> findSysUserInfoDepartmentByInfoId(Long infoId) {
LOGGER.debug("平台用户部门 SysDepartment infoId:{}", infoId);
LOGGER.info("平台用户部门 SysDepartment infoId:{}", infoId);
List<SysDepartment> result = new ArrayList<>();
List<SysRefUserInfoDepartment> refs = findSysRefUserInfoDepartmentById(infoId);
@ -277,10 +297,10 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "查询账号部门关系")
public List<SysDepartment> findSysUserDepartmentByInfoId(Long infoId) {
LOGGER.debug("平台用户部门 SysDepartment infoId:{}", infoId);
LOGGER.info("平台用户部门 SysDepartment infoId:{}", infoId);
List<SysDepartment> result = new ArrayList<>();
List<SysRefUserDepartment> refs = findSysRefUserDepartmentById(infoId);
List<SysRefUserDepartment> refs = findSysRefUserDepartmentByUserId(infoId);
if(refs != null && refs.size() > 0){
Long[] ids = new Long[refs.size()];
for (int i = 0; i < refs.size(); i++) {
@ -293,8 +313,16 @@ public class PersonnelServiceService implements IPersonnelService {
}
@Override
public List<SysDepartment> findSysUserDepartmentList() {
LOGGER.info("平台用户部门 SysOrganize Find All");
return departmentRDao.findByProperty(
new String[]{"isDeleted","isValid"},
new Object[]{CommonEnumUtil.IS_DEAL.NO.getValue(),CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
@Override
public List<SysOrganize> findSysUserInfoOrganize(Long infoId) {
LOGGER.debug("平台用户部门 SysDepartment infoId:{}", infoId);
LOGGER.info("平台用户部门 SysDepartment infoId:{}", infoId);
List<SysOrganize> result = new ArrayList<>();
List<SysRefUserInfoDepartment> refs = findSysRefUserInfoDepartmentById(infoId);
@ -311,10 +339,10 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public List<SysOrganize> findSysUserOrganize(Long infoId) {
LOGGER.debug("平台用户部门 SysDepartment infoId:{}", infoId);
LOGGER.info("平台用户部门 SysOrganize infoId:{}", infoId);
List<SysOrganize> result = new ArrayList<>();
List<SysRefUserDepartment> refs = findSysRefUserDepartmentById(infoId);
List<SysRefUserDepartment> refs = findSysRefUserDepartmentByUserId(infoId);
if(refs != null && refs.size() > 0){
List<Long> ids = new ArrayList<>();
refs.forEach(ref -> {
@ -329,8 +357,24 @@ public class PersonnelServiceService implements IPersonnelService {
}
@Override
public List<SysOrganize> findSysOrganizeList() {
LOGGER.info("平台用户组织 SysOrganize Find All");
return organizeRDao.findByProperty(
new String[]{"isDeleted","isValid"},
new Object[]{CommonEnumUtil.IS_DEAL.NO.getValue(),CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
@Override
public List<SysPosition> findSysPositionList() {
LOGGER.info("平台用户岗位 SysOrganize Find All");
return positionRDao.findByProperty(
new String[]{"isDeleted","isValid"},
new Object[]{CommonEnumUtil.IS_DEAL.NO.getValue(),CommonEnumUtil.IS_VAILD.VAILD.getValue()});
}
@Override
public List<SysRefUserPosition> findSysRefUserPositionById(Long infoId) {
LOGGER.debug("平台用户岗位 SysRefUserPosition infoId:{}", infoId);
LOGGER.info("平台用户岗位 SysRefUserPosition infoId:{}", infoId);
return refUserPositionRDao.findByProperty("userId",infoId);
}
@ -387,7 +431,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
@ApiOperation(value = "重置密码检查")
public Integer checkSysUserResetPassword(SysUser user) {
LOGGER.debug("平台用户岗位 SysUser user:{}", user);
LOGGER.info("平台用户岗位 SysUser user:{}", user);
Integer num = 0;
if(user != null){
String day = DateFormatUtils.ISO_8601_EXTENDED_DATE_FORMAT.format(new Date());
@ -410,7 +454,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void checkSysPositionRef(Long positionId) {
LOGGER.debug("平台岗位 SysPosition positionId:{}", positionId);
LOGGER.info("平台岗位 SysPosition positionId:{}", positionId);
if(positionId != null){
List<SysPosition> positionList = positionRDao.findByProperty("parentId", positionId);
@ -445,7 +489,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void checkSysDepartmentRef(Long departmentId) {
LOGGER.debug("平台部门 SysDepartment departmentId:{}", departmentId);
LOGGER.info("平台部门 SysDepartment departmentId:{}", departmentId);
if(departmentId != null){
List<SysDepartment> departmentList = departmentRDao.findByProperty("parentId", departmentId);
@ -490,7 +534,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void checkSysOrganizeRef(Long organizeId) {
LOGGER.debug("平台部门 SysOrganize organizeId:{}", organizeId);
LOGGER.info("平台部门 SysOrganize organizeId:{}", organizeId);
if(organizeId != null){
List<SysOrganize> organizeList = organizeRDao.findByProperty("parentId", organizeId);
@ -547,7 +591,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void checkSysUserPassword(String password) {
LOGGER.debug("平台用户 SysUser password:{}", password);
LOGGER.info("平台用户 SysUser password:{}", password);
if(StringUtils.isNotBlank(password)){
// 密码长度校验
@ -763,7 +807,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void refreshRefSysUserRole(Long userId, Long[] roleIds) {
LOGGER.debug("账号角色关系信息 RefSysUserRole userId:{} roleIds:{} ", userId,roleIds);
LOGGER.info("账号角色关系信息 RefSysUserRole userId:{} roleIds:{} ", userId,roleIds);
SysUser user = userRDao.getById(userId);
if(user != null){
// 根据IDS 查询所有的角色信息
@ -801,7 +845,7 @@ public class PersonnelServiceService implements IPersonnelService {
@Override
public void refreshUpdateSysRoleRdd(Long roleId) {
LOGGER.debug("角色信息 RefSysUserRole roleId:{}", roleId);
LOGGER.info("角色信息 RefSysUserRole roleId:{}", roleId);
if(roleId != null){
SysRole role = roleRDao.getById(roleId);
if(role != null){

@ -2,12 +2,15 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysOrganizeService;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.platform.bean.SessionUser;
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
import cn.estsh.i3plus.pojo.platform.bean.SysRefUserDepartment;
import cn.estsh.i3plus.pojo.platform.repository.SysOrganizeRepository;
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
@ -18,8 +21,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Description :
@ -42,9 +48,6 @@ public class SysOrganizeService implements ISysOrganizeService {
@Autowired
private IPersonnelService personnelService;
@Override
@ApiOperation(value = "更新组织", notes = "传入持久化组织对象,进行更新")
public void updateSysOrganize(SysOrganize organize) {
@ -170,24 +173,14 @@ public class SysOrganizeService implements ISysOrganizeService {
@ApiOperation(value = "查询组织信息", notes = "查询 组织信息(分页、组合)")
public ListPager<SysOrganize> querySysOrganize(SysOrganize organize, Pager pager) {
LOGGER.info("组织信息 SysOrganize find SysOrganize page");
return querySysOrganize(organize, null, pager);
}
if (organize == null) {
//不传入实体对象,查询所有
int count = organizeRDao.listCount();
pager = PagerHelper.getPager(pager, count);
return new ListPager(organizeRDao.listPager(pager), pager);
} else {
if (organize.getParentId() != null) {
SysOrganize parent = coreTreeService.getSysOrganizeTreeById(organize.getParentId());
List<Long> childIds = coreTreeService.findSysOrganizeChildIds(parent);
organize.setChildIdList(childIds);
}
//生成hql查询语句
String hqlPack = CoreHqlPack.packHqlSysOrganize(organize);
pager = PagerHelper.getPager(pager, organizeRDao.findByHqlWhereCount(hqlPack));
return new ListPager(organizeRDao.findByHqlWherePage(hqlPack + organize.orderBy(), pager), pager);
}
@Override
public ListPager<SysOrganize> querySysOrganize(SysOrganize organize, List<Long> idList, Pager pager) {
DdlPackBean packBean = CoreHqlPack.packHqlSysOrganize(organize, idList);
pager = PagerHelper.getPager(pager, organizeRDao.findByHqlWhereCount(packBean));
return new ListPager(organizeRDao.findByHqlWherePage(packBean, pager), pager);
}
@Override
@ -201,4 +194,15 @@ public class SysOrganizeService implements ISysOrganizeService {
public long getSysOrganizeCount() {
return organizeRDao.listCount();
}
@Override
@ApiOperation(value = "查询当前用户所有组织数据", notes = "查询当前用户所有组织数据")
public List<SysOrganize> findOrganizeIdByRefUsers(List<SysRefUserDepartment> sysRefUserDepartments) {
if (CollectionUtils.isEmpty(sysRefUserDepartments)) {
return null;
} else {
DdlPackBean packBean = CoreHqlPack.packHqlSysOrganize(sysRefUserDepartments);
return organizeRDao.findByHqlWhere(packBean);
}
}
}

@ -155,18 +155,14 @@ public class SysPositionService implements ISysPositionService {
@ApiOperation(value = "查询岗位信息", notes = "查询岗位信息 (分页,组合)")
public ListPager<SysPosition> querySysPosition(SysPosition position, Pager pager) {
LOGGER.info("岗位信息 SysPosition find SysPosition page");
return querySysPosition(position, null, pager);
}
if (position == null) {
//不传入实体对象,查询所有
int count = positionRDao.listCount();
pager = PagerHelper.getPager(pager, count);
return new ListPager(positionRDao.listPager(pager), pager);
} else {
//生成hql查询语句
DdlPackBean ddlPackBean = CoreHqlPack.packHqlSysPosition(position);
pager = PagerHelper.getPager(pager, positionRDao.findByHqlWhereCount(ddlPackBean));
return new ListPager(positionRDao.findByHqlWherePage(ddlPackBean, pager), pager);
}
@Override
public ListPager<SysPosition> querySysPosition(SysPosition position, List<Long> idList, Pager pager) {
DdlPackBean ddlPackBean = CoreHqlPack.packHqlSysPosition(position,idList);
pager = PagerHelper.getPager(pager, positionRDao.findByHqlWhereCount(ddlPackBean));
return new ListPager(positionRDao.findByHqlWherePage(ddlPackBean, pager), pager);
}
@Override

@ -3,6 +3,7 @@ package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
import cn.estsh.i3plus.core.api.iservice.busi.ISysRoleService;
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
@ -238,18 +239,14 @@ public class SysRoleService implements ISysRoleService {
@ApiOperation(value = "查信角色信息",notes = "查询角色信息(分页/组合)")
public ListPager<SysRole> querySysRole(SysRole role, Pager pager) {
LOGGER.info("系统角色 SysRole find role :{} page :{}", role, pager);
return querySysRole(role, null, pager);
}
if (role == null) {
//不传入实体对象,查询所有
int count = roleRDao.listCount();
pager = PagerHelper.getPager(pager, count);
return new ListPager(roleRDao.listPager(pager), pager);
} else {
//生成hql查询语句
String hqlPack = CoreHqlPack.packHqlSysRole(role);
pager = PagerHelper.getPager(pager, roleRDao.findByHqlWhereCount(hqlPack));
return new ListPager(roleRDao.findByHqlWherePage(hqlPack + role.orderBy(), pager), pager);
}
@Override
public ListPager<SysRole> querySysRole(SysRole role, List<Long> idList, Pager pager) {
DdlPackBean packBean = CoreHqlPack.packDdlBeanSysRole(role,idList);
pager = PagerHelper.getPager(pager, roleRDao.findByHqlWhereCount(packBean));
return new ListPager(roleRDao.findByHqlWherePage(packBean , pager), pager);
}
@Override

Loading…
Cancel
Save