From b47d4a7accabce974e19d2a1ffb3c5c67507d74b Mon Sep 17 00:00:00 2001 From: wangwh <2397901735@qq.com> Date: Wed, 28 Aug 2024 15:11:59 +0800 Subject: [PATCH] 1、组织架构的接口 2、事项登记接口 --- dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java | 133 +++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 125 insertions(+), 8 deletions(-) diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java index dbfbcb0..654da13 100644 --- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java +++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java @@ -1,12 +1,24 @@ -package cn.huge.module.ctuser.controller; +package cn.huge.module.ctuser.controller.web; +import cn.huge.base.common.dto.SelectTermDTO; +import cn.huge.base.common.utils.ObjectUtils; import cn.huge.base.common.utils.ReturnFailUtils; import cn.huge.base.common.utils.ReturnSucUtils; +import cn.huge.base.common.utils.SelectTermUtils; import cn.huge.base.config.CurrentUser; -import cn.huge.module.ctuser.domain.po.CtUser; -import cn.huge.module.ctuser.service.CtUserService; +import cn.huge.module.ctrole.domain.po.CtRole; +import cn.huge.module.ctrole.service.CtRoleService; +import cn.huge.module.ctuser.domain.po.*; +import cn.huge.module.ctuser.dto.CtUserSaveDTO; +import cn.huge.module.ctuser.service.*; +import cn.huge.module.cust.constant.RoleBaseEnum; +import cn.huge.module.cust.constant.UserBaseConsts; +import cn.huge.module.cust.dto.CtUserDTO; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; @@ -15,13 +27,16 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; /** - * @title: 客户用户表接口api - * @description: 客户用户表接口api + * @title: 客户用户表接口api-web端 + * @description: 客户用户表接口api-web端 * @company: hugeinfo * @author: liyj * @time: 2024-08-19 20:04:19 @@ -37,6 +52,24 @@ @Autowired private CtUserService service; + + @Autowired + private CtUnitService ctUnitService; + + @Autowired + private CtRoleService ctRoleService; + + @Autowired + private CtDeptService ctDeptService; + + @Autowired + private CtUseroleService ctUseroleService; + + @Autowired + private CtAccountService ctAccountService; + + @Autowired + private CtUsepostService ctUsepostService; /** * 获取请求URL参数 @@ -214,7 +247,7 @@ if (StringUtils.isNotBlank(dispStatus)){ terms.put("dispStatus", dispStatus); } - // 删除状态,0:已删除(默认),1:未删除 + // 删除状态,0:未删除,1:已删除 String deleteStatus = request.getParameter("deleteStatus"); if (StringUtils.isNotBlank(deleteStatus)){ terms.put("deleteStatus", deleteStatus); @@ -238,6 +271,17 @@ terms.put("updateStart", updateStart); terms.put("updateEnd", updateEnd); } + // 平台账号 + String acc = request.getParameter("acc"); + if (StringUtils.isNotBlank(acc)){ + terms.put("acc", acc); + } + // 角色编码 + String roleCode = request.getParameter("roleCode"); + if (StringUtils.isNotBlank(roleCode)){ + terms.put("roleCode", roleCode); + } + return terms; } @@ -249,14 +293,87 @@ * @throws Exception */ @PostMapping("/saveCtUser") - public Object saveCtUser(@RequestBody CtUser ctUser, @CurrentUser String userId) { + public Object saveCtUser(@RequestBody CtUserSaveDTO ctUserSaveDTO, @CurrentUser String userId) { try { // 保存更新用户信息 - service.webSaveCtUser(ctUser, userId); + service.webSaveCtUser(ctUserSaveDTO, userId); return ReturnSucUtils.getRepInfo(); } catch (Exception e) { return ReturnFailUtils.getRepInfo(); } } + /** + * 获取人员信息列表查询条件 + * @url {ctx}/api/v1/ctUser/listSelectTerm + * @return userId 登录用户标识称 + * @return Object + * @throws Exception + */ + @GetMapping("/listSelectTerm") + public Object listSelectTerm(@CurrentUser String userId) { + try { + Map<String, Object> result = service.webListSelectTerm(userId); + return ReturnSucUtils.getRepInfo(result); + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(); + } + } + + /** + * web端-人员信息管理-人员列表 + * @url {ctx}/api/v1/ctUser/pageQuery + * @param page 页码 + * @param size 每页数量 + * @return Object + */ + @GetMapping("/pageQuery") + public Object pageQuery(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size, + @CurrentUser String userId) { + try { + Map<String, Object> terms = getParameter(); + Map<String, Object> result = service.webPageQuery(page, size, terms, userId); + return ReturnSucUtils.getRepInfo(result); + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(); + } + } + + /** + * 更新人员状态信息 + * @url {ctx}/api/web/ctUser/updateCtUserStatus + * @param id 编号 status :用户状态,1:在职(默认),2:停用,99:离职 + * @return Object + * @throws Exception + */ + @GetMapping("/updateCtUserStatus") + public Object updateCtUserStatus(@RequestParam(value = "status") String status, @RequestParam(value = "id") String id) { + try { + // 修改状态 + UpdateWrapper<CtUser> ctUserUpdateWrapper = new UpdateWrapper(); + ctUserUpdateWrapper.eq("id", id); + ctUserUpdateWrapper.set("status", status).set("update_time", new Date()); + service.update(ctUserUpdateWrapper); + return ReturnSucUtils.getRepInfo(); + } catch (Exception e) { + return ReturnFailUtils.getRepInfo(); + } + } + + /** + * 根据主键单个/批量删除 + * @url {ctx}/api/v1/ctUser/removeByIds + * @return Object + * @throws Exception + */ + @PostMapping("/removeByIds") + public Object removeByIds(@RequestBody List<String> data) { + try { + service.removeListId(data); + return ReturnSucUtils.getRepInfo(); + } catch (Exception e) { + log.error("Controller接口[CtUserController.removeByIds]请求异常:"+e, e); + return ReturnFailUtils.getRepInfo(); + } + } } -- Gitblit v1.8.0