修改选择用户接口

This commit is contained in:
梁琦涛
2024-08-14 11:25:52 +08:00
parent 9f4b11918a
commit 5df2099c58
9 changed files with 134 additions and 3 deletions
@@ -9,7 +9,7 @@ public class CommonConstant {
/**
* 用户默认密码
*/
public static final String DEFAULT_PASSWORD = "srms1q2w3e";
public static final String DEFAULT_PASSWORD = "test.1234";
/**
* 正常状态
@@ -157,6 +157,7 @@ public class SysUserController {
try {
pageList = sysUserService.queryPage(page, subDepIds, roleId, groupId, queryWrapper);
}catch (Exception e){
log.error("操作异常:" + e.getMessage());
return Result.error(MessageUtils.getMessage(ResultCommon.ERROR));
}
//批量查询用户的所属部门
@@ -180,6 +181,47 @@ public class SysUserController {
return result;
}
/**
* 获取用户列表数据
* @param user
* @param req
* @return
*/
@ApiOperationSupport(order = 1)
@ApiOperation(value="用户列表查询", notes="用户列表查询")
@PermissionData(pageComponent = "system/UserList")
@GetMapping("/list")
public Result<List<String>> queryList(SysUser user,
@RequestParam(name="departId", required = false) String departId,
@RequestParam(name="roleId", required = false) String roleId,
HttpServletRequest req) {
// 处理手机号和邮箱,进行对应加密
Map<String, String[]> parameterMap = req.getParameterMap();
String groupId = req.getParameter("groupId");
this.sysUserService.encryptReqMapData(parameterMap);
user.setEmail(this.sysUserService.proceedEmailEncrypt(user.getEmail()));
user.setPhone(this.sysUserService.proceedPhoneEncrypt(user.getPhone()));
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, parameterMap);
List<String> subDepIds = null;
if (StrUtil.isNotEmpty(departId)){
subDepIds = sysDepartService.getSubDepIdsByDepId(departId);
}
if (StringUtils.isNotBlank(user.getRealnameOrUsername())){
queryWrapper.and(aw -> aw.like("realname", user.getRealnameOrUsername())
.or().like("username", user.getRealnameOrUsername()));
}
List<String> pageList;
try {
pageList = sysUserService.queryList(subDepIds, roleId, groupId, queryWrapper);
}catch (Exception e){
log.error("操作异常:" + e.getMessage());
return Result.error(MessageUtils.getMessage(ResultCommon.ERROR));
}
return Result.OK(pageList);
}
@RequiresPermissions("user:add")
@PostMapping("/add")
public Result<Object> add(@RequestBody JSONObject jsonObject) {
@@ -33,6 +33,14 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
IPage<SysUser> queryPage(Page<SysUser> page, @Param("departIds") List<String> subDepIds , @Param("roleId") String roleId ,
@Param("groupId") String groupId, @Param(Constants.WRAPPER) Wrapper<SysUser> wrapper);
/**
* 分页查询用户,可支持组织机构检索
* @return
*/
List<String> queryList( @Param("departIds") List<String> subDepIds , @Param("roleId") String roleId ,
@Param("groupId") String groupId, @Param(Constants.WRAPPER) Wrapper<SysUser> wrapper);
/**
* 通过用户账号查询用户信息
* @param username
@@ -4,7 +4,38 @@
<!-- 分页查询用户信息 -->
<select id="queryPage" resultType="com.jero.modules.system.entity.SysUser">
select * from sys_user where del_flag = 0
select id from sys_user where del_flag = 0
<if test="departIds!=null and departIds.size()>0">
and id in (select user_id from sys_user_depart where dep_id in
<foreach collection="departIds" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
)
</if>
<if test="groupId != null and groupId !=' '">
and id in (select user_id from sys_user_group where group_id = #{groupId}
)
</if>
<if test="roleId!=null and roleId!=''">
and id in (select user_id from sys_user_role where role_id = #{roleId}
)
</if>
<if test="roleId!=null and roleId!=''">
and id in (select user_id from sys_user_role where role_id = #{roleId}
)
</if>
<choose>
<when test="ew.sqlSegment.indexOf(' ORDER') == 0">
${ew.sqlSegment}
</when>
<otherwise>
AND ${ew.sqlSegment}
</otherwise>
</choose>
</select>
<select id="queryList" resultType="java.lang.String">
select id from sys_user where del_flag = 0
<if test="departIds!=null and departIds.size()>0">
and id in (select user_id from sys_user_depart where dep_id in
<foreach collection="departIds" index="index" item="id" open="(" separator="," close=")">
@@ -38,6 +38,16 @@ public interface ISysUserService extends IService<SysUser> {
*/
IPage<SysUser> queryPage(Page<SysUser> page, List<String> subDepIds, String roleId, String groupId, QueryWrapper<SysUser> queryWrapper);
/**
* 查询用户id
* @param subDepIds
* @param roleId
* @param groupId
* @param queryWrapper
* @return
*/
List<String> queryList(List<String> subDepIds, String roleId, String groupId, QueryWrapper<SysUser> queryWrapper);
/**
* 重置密码
*
@@ -90,6 +90,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
return sysUserIPage;
}
@Override
public List<String> queryList(List<String> subDepIds, String roleId, String groupId, QueryWrapper<SysUser> queryWrapper){
return this.userMapper.queryList(subDepIds, roleId, groupId, queryWrapper);
}
@Override
@CacheEvict(value = {CacheConstant.SYS_USERS_CACHE}, allEntries = true)
public Result<T> resetPassword(String username, String oldpassword, String newpassword, String confirmpassword) {
@@ -195,8 +195,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
unifiedTodoVO.setProcessDefinitionId(processDefinitionId);
unifiedTodoVO.setIsRemark(CommonConstant.TODO_TYPE_0);
list.add(unifiedTodoVO);
long l = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTask(list);
long l1 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTaskByFeiShu(list);
long l2 = System.currentTimeMillis();
System.out.println("===========================OA" + (l1-l) + "+++++++++++feishu" + (l2-l1));
}
private void taskAssigned(ActivitiEvent event) {
@@ -226,8 +230,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
unifiedTodoVO.setIsRemark(CommonConstant.TODO_TYPE_2);
unifiedTodoVO.setProcessDefinitionId(processDefinitionId);
list.add(unifiedTodoVO);
long l = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTask(list);
long l1 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTaskByFeiShu(list);
long l2 = System.currentTimeMillis();
System.out.println("===========================OA" + (l1-l) + "+++++++++++feishu" + (l2-l1));
//更新转办任务id
LambdaUpdateWrapper<ProcessApprovalRecord> update = new LambdaUpdateWrapper<>();
@@ -239,8 +247,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
unifiedTodoVO.setToUserId(assignee);
unifiedTodoVO.setIsRemark(CommonConstant.TODO_TYPE_0);
list.add(unifiedTodoVO);
long l11 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTask(list);
long l12 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTaskByFeiShu(list);
long l13 = System.currentTimeMillis();
System.out.println("===========================OA" + (l12-l11) + "+++++++++++feishu" + (l13-l12));
}
}
@@ -326,8 +338,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
unifiedTodoVO.setProcessDefinitionId(processDefinitionId);
unifiedTodoVO.setIsRemark(CommonConstant.TODO_TYPE_2);
list.add(unifiedTodoVO);
long l = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTask(list);
long l1 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTaskByFeiShu(list);
long l2 = System.currentTimeMillis();
System.out.println("===========================OA" + (l1-l) + "+++++++++++feishu" + (l2-l1));
}
private void entityDeleted(ActivitiEvent event) {
@@ -377,9 +393,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
unifiedTodoVO.setProcessDefinitionId(processDefinitionId);
unifiedTodoVO.setIsRemark(CommonConstant.TODO_TYPE_2);
todoAddList.add(unifiedTodoVO);
long l = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTask(todoAddList);
long l1 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTaskByFeiShu(todoAddList);
long l2 = System.currentTimeMillis();
System.out.println("===========================OA" + (l1-l) + "+++++++++++feishu" + (l2-l1));
}
@@ -484,8 +503,12 @@ public class MyGlobalEventListener implements ActivitiEventListener {
unifiedTodoVO.setIsRemark(CommonConstant.TODO_TYPE_2);
list.add(unifiedTodoVO);
}
long l = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTask(list);
long l1 = System.currentTimeMillis();
pushWorkflowIntegrationAPI.sendTodoTaskByFeiShu(list);
long l2 = System.currentTimeMillis();
System.out.println("===========================OA" + (l1-l) + "+++++++++++feishu" + (l2-l1));
}
log.info("id = " + execution.getId());
log.info("name = " + execution.getName());
@@ -103,4 +103,12 @@ public class ProcessNewStandardImport implements Serializable {
@ApiModelProperty(value = "代替标准编号")
@TableField(exist = false)
private String substituteStandardNumber;
/**主管部门*/
@ApiModelProperty(value = "主管部门")
private String competentDepartment;
/**主控部门*/
@ApiModelProperty(value = "主控部门")
private String mainControlDepartment;
}
@@ -86,6 +86,7 @@ public class ProcessNewStandardImportServiceImpl extends ServiceImpl<ProcessNewS
@Override
public void startProcess(ProcessInfoVO<ProcessNewStandardImport> processInfoVO) {
long l = System.currentTimeMillis();
// 流程Key
String processDefinitionKey = ProcessType.NEW_STANDARD_IMPORT.getProcessKey();
// 流程信息
@@ -127,8 +128,11 @@ public class ProcessNewStandardImportServiceImpl extends ServiceImpl<ProcessNewS
actFlowCommonService.updateProcessAll(processInfo);
// 自动完成第一个任务
actFlowCommonService.completeTask(taskId, userId);
long l1 = System.currentTimeMillis();
// 保存快照
processHandleService.saveToSnapshot(processInfoVO,userId);
long l2 = System.currentTimeMillis();
System.out.println("===========================OA" + (l1-l) + "+++++++++++feishu" + (l2-l1));
}
private Map<String, Object> setVariables(Map<String, Object> userInfoMap) {