feat(core): 添加根据组织 查询下面用户接口

添加根据组织 查询下面用户接口
yun-zuoyi
wynne1005 4 years ago
parent f8b6226dc5
commit d9ea9c63ee

@ -1,13 +1,9 @@
package cn.estsh.i3plus.core.api.iservice.busi;
import cn.estsh.i3plus.pojo.base.bean.ListPager;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
import cn.estsh.impp.framework.base.service.ICrudService;
import io.swagger.annotations.ApiOperation;
import java.util.List;
/**
* @Description :
* @Reference :
@ -104,4 +100,5 @@ public interface ISysOrganizeService extends ICrudService<SysOrganize> {
boolean checkSysOrganizeOnly(SysOrganize sysOrganize);
SysOrganize getByCode(String organizeCode);
}

@ -178,6 +178,9 @@ public interface ISysUserService {
@ApiOperation(value = "账号查询", notes = "查询账号信息-复杂查询")
ListPager<SysUser> querySysUserByPager(SysUser user, List<Long> idList, Pager pager);
List<SysUser> querySysUserByOrganizeCode(String orgCode);
/**
* id
*

@ -54,6 +54,11 @@
<artifactId>i3plus-icloud-mdm</artifactId>
</dependency>
<dependency>
<groupId>i3plus.icloud</groupId>
<artifactId>i3plus-icloud-screen</artifactId>
</dependency>
<!-- 对象 -->
<dependency>
<groupId>i3plus.pojo</groupId>

@ -7,6 +7,7 @@ import cn.estsh.i3plus.icloud.andon.sdk.IAndonCommonCloud;
import cn.estsh.i3plus.icloud.mes.pcn.sdk.IMesPcnCommonCloud;
import cn.estsh.i3plus.icloud.mes.sdk.IMesCommonCloud;
import cn.estsh.i3plus.icloud.ptl.sdk.IPtlCommonCloud;
import cn.estsh.i3plus.icloud.screen.sdk.IScreenCommonCloud;
import cn.estsh.i3plus.icloud.softswitch.sdk.IBsCommonCloud;
import cn.estsh.i3plus.icloud.wms.sdk.IWmsCommonCloud;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
@ -36,12 +37,23 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.List;
import java.util.Map;
@ -85,6 +97,9 @@ public class SysTaskController extends CoreBaseController {
private IPtlCommonCloud ptlCommonCloud;
@Autowired
private IScreenCommonCloud screenCommonCloud;
@Autowired
private EntityManager entityManager;
@Autowired
@ -126,6 +141,8 @@ public class SysTaskController extends CoreBaseController {
// Ptl
} else if (softType == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) {
commonService = ptlCommonCloud;
} else if (softType == CommonEnumUtil.SOFT_TYPE.SCREEN.getValue()) {
commonService = screenCommonCloud;
}
return commonService;
}

@ -8,6 +8,7 @@ import cn.estsh.i3plus.icloud.andon.sdk.IAndonScheduleJobCloud;
import cn.estsh.i3plus.icloud.mes.pcn.sdk.IMesPcnScheduleJobCloud;
import cn.estsh.i3plus.icloud.mes.sdk.IMesScheduleJobCloud;
import cn.estsh.i3plus.icloud.ptl.sdk.IPtlScheduleJobCloud;
import cn.estsh.i3plus.icloud.screen.sdk.IScreenScheduleJobCloud;
import cn.estsh.i3plus.icloud.softswitch.sdk.IBsScheduleJobCloud;
import cn.estsh.i3plus.icloud.wms.sdk.IWmsScheduleJobCloud;
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
@ -40,13 +41,25 @@ import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.HashSet;
import java.util.List;
@ -107,6 +120,9 @@ public class SysTaskPlanController extends CoreBaseController {
@Autowired
private IPtlScheduleJobCloud ptlScheduleJobCloud;
@Autowired
private IScreenScheduleJobCloud screenScheduleJobCloud;
/**
*
*
@ -137,6 +153,8 @@ public class SysTaskPlanController extends CoreBaseController {
// Ptl
} else if (source == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) {
quartzJobService = ptlScheduleJobCloud;
} else if (source == CommonEnumUtil.SOFT_TYPE.SCREEN.getValue()) {
quartzJobService = screenScheduleJobCloud;
}
return quartzJobService;
}

@ -356,6 +356,20 @@ public class SysUserController extends CoreBaseController {
}
}
@GetMapping(value = "/query-user-in-org")
@ApiOperation(value = "根据orgCode查询系统用户")
public ResultBean queryUserInOrg(String organizeCode) {
try {
List<SysUser> sysUsers = sysUserService.querySysUserByOrganizeCode(organizeCode);
return ResultBean.success("操作成功").setResultList(sysUsers).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
} catch (ImppBusiException busExcep) {
return ResultBean.fail(busExcep);
} catch (Exception e) {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/**
*
*
@ -517,6 +531,7 @@ public class SysUserController extends CoreBaseController {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e);
}
}
/**
*
*

@ -6,7 +6,12 @@ import cn.estsh.i3plus.pojo.base.bean.DdlPackBean;
import cn.estsh.i3plus.pojo.base.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
import cn.estsh.i3plus.pojo.platform.repository.*;
import cn.estsh.i3plus.pojo.platform.repository.SysDepartmentRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysOrganizeRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysRefUserDepartmentRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysRefUserInfoDepartmentRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysUserInfoRepository;
import cn.estsh.i3plus.pojo.platform.repository.SysUserRepository;
import cn.estsh.i3plus.pojo.platform.sqlpack.CoreHqlPack;
import cn.estsh.impp.framework.base.service.CrudService;
import org.slf4j.Logger;
@ -258,6 +263,13 @@ public class SysOrganizeService extends CrudService<SysOrganize> implements ISys
public boolean checkSysOrganizeOnly(SysOrganize sysOrganize) {
return !organizeRDao.isExitByHql(CoreHqlPack.packHqlCheckSysOrganizeOnly(sysOrganize));
}
@Override
public SysOrganize getByCode(String organizeCode) {
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getStringEqualPack(organizeCode, "organizeCode", packBean);
return organizeRDao.getByProperty(packBean);
}
//
// @Override
// @ApiOperation(value = "查询当前用户所有组织数据", notes = "查询当前用户所有组织数据")

@ -498,6 +498,35 @@ public class SysUserService implements ISysUserService {
}
@Override
public List<SysUser> querySysUserByOrganizeCode(String orgCode) {
SysOrganize sysOrganize = organizeService.getByCode(orgCode);
List<Long> departmentIdList = new ArrayList<>();
// 查出所有组织 ID 集合
SysOrganize parent = coreTreeService.getSysOrganizeTreeById(sysOrganize.getId());
List<Long> childIds = coreTreeService.findSysOrganizeChildIds(parent);
// 查询所有部门 ID 集合
if (childIds != null && childIds.size() > 0) {
for (Long organizeId : childIds) {
List<Long> ids = coreTreeService.findSysDepartmentIdByOrganizeId(organizeId);
departmentIdList.addAll(ids);
}
}
List<Long> distinctUserIds = findSysUserIdListByDepartmentId(departmentIdList).stream()
.distinct()
.collect(Collectors.toList());
if (CollectionUtils.isEmpty(distinctUserIds)) {
return null;
}
DdlPackBean packBean = DdlPackBean.getDdlPackBean();
DdlPreparedPack.getInPackList(distinctUserIds, "id", packBean);
return userRDao.findByHqlWhere(packBean);
}
@Override
@ApiOperation(value = "账号查询", notes = "根据ID 查询账号信息")
public SysUser getSysUserById(Long id) {
LOGGER.debug("平台用户 SYS_USER get By id :{}", id);

@ -107,6 +107,12 @@
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>i3plus.icloud</groupId>
<artifactId>i3plus-icloud-screen</artifactId>
<version>${project.version}</version>
</dependency>
<!-- 基础对象调用 -->
<dependency>
<groupId>i3plus.pojo</groupId>

Loading…
Cancel
Save