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

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

@ -1,19 +1,15 @@
package cn.estsh.i3plus.core.api.iservice.busi; package cn.estsh.i3plus.core.api.iservice.busi;
import cn.estsh.i3plus.pojo.base.bean.ListPager; import cn.estsh.i3plus.pojo.platform.bean.SysOrganize;
import cn.estsh.i3plus.pojo.base.common.Pager;
import cn.estsh.i3plus.pojo.platform.bean.*;
import cn.estsh.impp.framework.base.service.ICrudService; import cn.estsh.impp.framework.base.service.ICrudService;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List;
/** /**
* @Description : * @Description :
* @Reference : * @Reference :
* @Author : wei.peng * @Author : wei.peng
* @Date : 2018-10-22 16:58:42.941 * @Date : 2018-10-22 16:58:42.941
* @Modify : * @Modify :
**/ **/
public interface ISysOrganizeService extends ICrudService<SysOrganize> { public interface ISysOrganizeService extends ICrudService<SysOrganize> {
// //
@ -85,7 +81,7 @@ public interface ISysOrganizeService extends ICrudService<SysOrganize> {
@ApiOperation(value = "获取组织对象信息") @ApiOperation(value = "获取组织对象信息")
SysOrganize get(SysOrganize bean); SysOrganize get(SysOrganize bean);
// //
// /** // /**
// * 查询组织个数 // * 查询组织个数
// * @return // * @return
@ -104,4 +100,5 @@ public interface ISysOrganizeService extends ICrudService<SysOrganize> {
boolean checkSysOrganizeOnly(SysOrganize sysOrganize); boolean checkSysOrganizeOnly(SysOrganize sysOrganize);
SysOrganize getByCode(String organizeCode);
} }

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

@ -54,6 +54,11 @@
<artifactId>i3plus-icloud-mdm</artifactId> <artifactId>i3plus-icloud-mdm</artifactId>
</dependency> </dependency>
<dependency>
<groupId>i3plus.icloud</groupId>
<artifactId>i3plus-icloud-screen</artifactId>
</dependency>
<!-- 对象 --> <!-- 对象 -->
<dependency> <dependency>
<groupId>i3plus.pojo</groupId> <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.pcn.sdk.IMesPcnCommonCloud;
import cn.estsh.i3plus.icloud.mes.sdk.IMesCommonCloud; import cn.estsh.i3plus.icloud.mes.sdk.IMesCommonCloud;
import cn.estsh.i3plus.icloud.ptl.sdk.IPtlCommonCloud; 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.softswitch.sdk.IBsCommonCloud;
import cn.estsh.i3plus.icloud.wms.sdk.IWmsCommonCloud; import cn.estsh.i3plus.icloud.wms.sdk.IWmsCommonCloud;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; import cn.estsh.i3plus.platform.common.convert.ConvertBean;
@ -36,12 +37,23 @@ import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.web.multipart.MultipartFile;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletResponse; 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.net.URLEncoder;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -85,6 +97,9 @@ public class SysTaskController extends CoreBaseController {
private IPtlCommonCloud ptlCommonCloud; private IPtlCommonCloud ptlCommonCloud;
@Autowired @Autowired
private IScreenCommonCloud screenCommonCloud;
@Autowired
private EntityManager entityManager; private EntityManager entityManager;
@Autowired @Autowired
@ -126,6 +141,8 @@ public class SysTaskController extends CoreBaseController {
// Ptl // Ptl
} else if (softType == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) { } else if (softType == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) {
commonService = ptlCommonCloud; commonService = ptlCommonCloud;
} else if (softType == CommonEnumUtil.SOFT_TYPE.SCREEN.getValue()) {
commonService = screenCommonCloud;
} }
return commonService; return commonService;
} }
@ -346,7 +363,7 @@ public class SysTaskController extends CoreBaseController {
@GetMapping(value = "/export") @GetMapping(value = "/export")
@ApiOperation(value = "导出数据") @ApiOperation(value = "导出数据")
public void exportExcel(SysTask bean,HttpServletResponse response) { public void exportExcel(SysTask bean, HttpServletResponse response) {
File excelFile = null; File excelFile = null;
try { try {
Map<String, String> colMap = ExcelTool.getColName(SysTask.class); Map<String, String> colMap = ExcelTool.getColName(SysTask.class);
@ -392,7 +409,7 @@ public class SysTaskController extends CoreBaseController {
} }
} }
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("下载异常",e); LOGGER.error("下载异常", e);
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build(); throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
} finally { } finally {
if (excelFile != null) { if (excelFile != null) {
@ -448,7 +465,7 @@ public class SysTaskController extends CoreBaseController {
response.getOutputStream().write(excelTool.importTemplate(SysTask.class)); response.getOutputStream().write(excelTool.importTemplate(SysTask.class));
response.getOutputStream().flush(); response.getOutputStream().flush();
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("下载异常",e); LOGGER.error("下载异常", e);
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build(); throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
} }
} }

@ -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.pcn.sdk.IMesPcnScheduleJobCloud;
import cn.estsh.i3plus.icloud.mes.sdk.IMesScheduleJobCloud; import cn.estsh.i3plus.icloud.mes.sdk.IMesScheduleJobCloud;
import cn.estsh.i3plus.icloud.ptl.sdk.IPtlScheduleJobCloud; 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.softswitch.sdk.IBsScheduleJobCloud;
import cn.estsh.i3plus.icloud.wms.sdk.IWmsScheduleJobCloud; import cn.estsh.i3plus.icloud.wms.sdk.IWmsScheduleJobCloud;
import cn.estsh.i3plus.platform.common.convert.ConvertBean; 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.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; 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 org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.servlet.http.HttpServletResponse; 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.net.URLEncoder;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -82,7 +95,7 @@ public class SysTaskPlanController extends CoreBaseController {
@Autowired @Autowired
private ISystemInitService systemInitService; private ISystemInitService systemInitService;
@Resource(name= CommonConstWords.IMPP_REDIS_RES) @Resource(name = CommonConstWords.IMPP_REDIS_RES)
private ImppRedis redisRes; private ImppRedis redisRes;
/************ 微服定时任务 *********/ /************ 微服定时任务 *********/
@ -107,6 +120,9 @@ public class SysTaskPlanController extends CoreBaseController {
@Autowired @Autowired
private IPtlScheduleJobCloud ptlScheduleJobCloud; private IPtlScheduleJobCloud ptlScheduleJobCloud;
@Autowired
private IScreenScheduleJobCloud screenScheduleJobCloud;
/** /**
* *
* *
@ -137,6 +153,8 @@ public class SysTaskPlanController extends CoreBaseController {
// Ptl // Ptl
} else if (source == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) { } else if (source == CommonEnumUtil.SOFT_TYPE.PTL.getValue()) {
quartzJobService = ptlScheduleJobCloud; quartzJobService = ptlScheduleJobCloud;
} else if (source == CommonEnumUtil.SOFT_TYPE.SCREEN.getValue()) {
quartzJobService = screenScheduleJobCloud;
} }
return quartzJobService; return quartzJobService;
} }
@ -551,8 +569,8 @@ public class SysTaskPlanController extends CoreBaseController {
// 判断是否失败如果失败进行补偿新增,避免出现勿删的情况 // 判断是否失败如果失败进行补偿新增,避免出现勿删的情况
if (!baseResultBean.isSuccess()) { if (!baseResultBean.isSuccess()) {
LOGGER.error("重载任务计划name{} group:{} 失败: {}",sysTaskPlan.getName() LOGGER.error("重载任务计划name{} group:{} 失败: {}", sysTaskPlan.getName()
,sysTaskPlan.getGroupName(),baseResultBean.getErrorMsg()); , sysTaskPlan.getGroupName(), baseResultBean.getErrorMsg());
getJobService(sysTaskPlan.getTaskSoftTypeRdd()) getJobService(sysTaskPlan.getTaskSoftTypeRdd())
.addTask(sysTask.getTaskPackage(), sysTask.getTaskClass(), sysTaskPlan.getName() .addTask(sysTask.getTaskPackage(), sysTask.getTaskClass(), sysTaskPlan.getName()
@ -579,7 +597,7 @@ public class SysTaskPlanController extends CoreBaseController {
@GetMapping(value = "/export") @GetMapping(value = "/export")
@ApiOperation(value = "导出数据") @ApiOperation(value = "导出数据")
public void exportExcel(SysTaskPlan sysTaskPlan,HttpServletResponse response) { public void exportExcel(SysTaskPlan sysTaskPlan, HttpServletResponse response) {
File excelFile = null; File excelFile = null;
try { try {
Map<String, String> colMap = ExcelTool.getColName(SysTaskPlan.class); Map<String, String> colMap = ExcelTool.getColName(SysTaskPlan.class);
@ -657,7 +675,7 @@ public class SysTaskPlanController extends CoreBaseController {
ConvertBean.modelInitialize(sysTaskPlan, AuthUtil.getSessionUser()); ConvertBean.modelInitialize(sysTaskPlan, AuthUtil.getSessionUser());
ResultBean resultBean = insertSysTaskTime(sysTaskPlan,CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue()); ResultBean resultBean = insertSysTaskTime(sysTaskPlan, CommonEnumUtil.TRUE_OR_FALSE.FALSE.getValue());
if (!resultBean.isSuccess()) { if (!resultBean.isSuccess()) {
return resultBean; return resultBean;
} }
@ -690,22 +708,22 @@ public class SysTaskPlanController extends CoreBaseController {
response.getOutputStream().write(excelTool.importTemplate(SysTaskPlan.class)); response.getOutputStream().write(excelTool.importTemplate(SysTaskPlan.class));
response.getOutputStream().flush(); response.getOutputStream().flush();
} catch (Exception e) { } catch (Exception e) {
LOGGER.error("下载异常",e); LOGGER.error("下载异常", e);
throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build(); throw ImppExceptionBuilder.newInstance().setErrorDetail(e.getMessage()).build();
} }
} }
private void putTaskPlanCache(SysTaskPlan plan){ private void putTaskPlanCache(SysTaskPlan plan) {
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName(); String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName();
redisRes.putObject(redisKey, plan.getLogLevelVal(), -1); redisRes.putObject(redisKey, plan.getLogLevelVal(), -1);
} }
private void removeTaskPlanCache(SysTaskPlan plan){ private void removeTaskPlanCache(SysTaskPlan plan) {
String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName(); String redisKey = CommonConstWords.REDIS_PREFIX_TASK_LOG_LEVEL + ":" + plan.getName() + "." + plan.getGroupName();
redisRes.deleteKey(redisKey); redisRes.deleteKey(redisKey);
} }
private void reloadAllTaskPlanCache(){ private void reloadAllTaskPlanCache() {
systemInitService.reloadTaskPlanLogLevel(); systemInitService.reloadTaskPlanLogLevel();
} }
} }

@ -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);
}
}
/** /**
* *
* *
@ -502,11 +516,11 @@ public class SysUserController extends CoreBaseController {
userPasswordService.updatePasswordResetLastModifyTime(user.getId(), password); userPasswordService.updatePasswordResetLastModifyTime(user.getId(), password);
LOGGER.info("系统提示:{} 使用密码重置功能帮{}重置了{}账号的密码,新密码是:{}", LOGGER.info("系统提示:{} 使用密码重置功能帮{}重置了{}账号的密码,新密码是:{}",
getSessionUser().getUserName(),user.getUserName(),user.getUserLoginName(),password); getSessionUser().getUserName(), user.getUserName(), user.getUserLoginName(), password);
String result = "操作成功,【"+user.getUserName()+"】账号今日重置密码次数剩余" +num+ "次"; String result = "操作成功,【" + user.getUserName() + "】账号今日重置密码次数剩余" + num + "次";
return ResultBean.success(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode()); return ResultBean.success(result).setCode(ResourceEnumUtil.MESSAGE.SUCCESS.getCode());
}else{ } else {
return ResultBean.success("操作失败") return ResultBean.success("操作失败")
.setCode(ResourceEnumUtil.MESSAGE.FAIL.getCode()) .setCode(ResourceEnumUtil.MESSAGE.FAIL.getCode())
.setErrorMsg("用户不存在"); .setErrorMsg("用户不存在");
@ -517,6 +531,7 @@ public class SysUserController extends CoreBaseController {
return ImppExceptionBuilder.newInstance().buildExceptionResult(e); 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.jpa.dao.BaseRepository;
import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack; import cn.estsh.i3plus.pojo.base.tool.DdlPreparedPack;
import cn.estsh.i3plus.pojo.platform.bean.SysOrganize; 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.i3plus.pojo.platform.sqlpack.CoreHqlPack;
import cn.estsh.impp.framework.base.service.CrudService; import cn.estsh.impp.framework.base.service.CrudService;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -258,6 +263,13 @@ public class SysOrganizeService extends CrudService<SysOrganize> implements ISys
public boolean checkSysOrganizeOnly(SysOrganize sysOrganize) { public boolean checkSysOrganizeOnly(SysOrganize sysOrganize) {
return !organizeRDao.isExitByHql(CoreHqlPack.packHqlCheckSysOrganizeOnly(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 // @Override
// @ApiOperation(value = "查询当前用户所有组织数据", notes = "查询当前用户所有组织数据") // @ApiOperation(value = "查询当前用户所有组织数据", notes = "查询当前用户所有组织数据")

@ -498,6 +498,35 @@ public class SysUserService implements ISysUserService {
} }
@Override @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 查询账号信息") @ApiOperation(value = "账号查询", notes = "根据ID 查询账号信息")
public SysUser getSysUserById(Long id) { public SysUser getSysUserById(Long id) {
LOGGER.debug("平台用户 SYS_USER get By id :{}", id); LOGGER.debug("平台用户 SYS_USER get By id :{}", id);

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

Loading…
Cancel
Save