From 0b597ea4500b3463ac9f0983dbabaca52417226c Mon Sep 17 00:00:00 2001
From: liyj <1003249715@qq.com>
Date: Sat, 14 Sep 2024 12:21:37 +0800
Subject: [PATCH] 回退上报流程bug修复2

---
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java |   72 ++++++++++++++++++++++++++++++++++--
 1 files changed, 68 insertions(+), 4 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 654da13..4ca98a3 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
@@ -9,6 +9,7 @@
 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.CtUserInfoDTO;
 import cn.huge.module.ctuser.dto.CtUserSaveDTO;
 import cn.huge.module.ctuser.service.*;
 import cn.huge.module.cust.constant.RoleBaseEnum;
@@ -20,6 +21,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageRequest;
@@ -287,7 +289,7 @@
 
     /**
      * web端-人员信息管理-新增/新用户信息
-     * @url {ctx}/api/v1/ctUser/saveCtUser
+     * @url {ctx}/api/web/ctUser/saveCtUser
      * @param userId
      * @return Object
      * @throws Exception
@@ -305,7 +307,7 @@
 
     /**
      * 获取人员信息列表查询条件
-     * @url {ctx}/api/v1/ctUser/listSelectTerm
+     * @url {ctx}/api/web/ctUser/listSelectTerm
      * @return userId 登录用户标识称
      * @return Object
      * @throws Exception
@@ -322,7 +324,7 @@
 
     /**
      * web端-人员信息管理-人员列表
-     * @url {ctx}/api/v1/ctUser/pageQuery
+     * @url {ctx}/api/web/ctUser/pageQuery
      * @param page 页码
      * @param size 每页数量
      * @return Object
@@ -362,7 +364,7 @@
 
     /**
      * 根据主键单个/批量删除
-     * @url {ctx}/api/v1/ctUser/removeByIds
+     * @url {ctx}/api/web/ctUser/removeByIds
      * @return Object
      * @throws Exception
      */
@@ -376,4 +378,66 @@
             return ReturnFailUtils.getRepInfo();
         }
     }
+
+    /**
+     * 选择人员
+     * @url {ctx}/api/web/ctUser/userChoose
+     * @return Object
+     */
+    @GetMapping("/userChoose")
+    public Object userChoose(@CurrentUser String userId) {
+        try {
+            String roleCode = request.getParameter("roleCode");
+            List<SelectTermDTO> unitSelectTerms = service.userChoose(userId, roleCode);
+            return ReturnSucUtils.getRepInfo(unitSelectTerms);
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo(e.getMessage());
+        }
+    }
+
+    /**
+     * 共通组件-根据人员编号查询单个人员信息及角色信息
+     * @url {ctx}/api/web/ctUser/getByIdRole
+     * @param id 主键编号
+     * @return Object
+     * @throws Exception
+     */
+    @GetMapping("/getByIdRole")
+    public Object getByIdRole(@RequestParam(value = "id") String id) {
+        try {
+            CtUserInfoDTO ctUserInfoDTO = new CtUserInfoDTO();
+            CtUser ctUser = service.getById(id);
+            if (ObjectUtils.isNotEmpty(ctUser)) {
+                BeanUtils.copyProperties(ctUser, ctUserInfoDTO);
+                CtAccount ctAccount = ctAccountService.getByUserIdAndType(id, UserBaseConsts.ACC_TYPE_1);
+                ctUserInfoDTO.setLoginTime(ctAccount.getLoginTime());
+                ctUserInfoDTO.setAcc(ctAccount.getAcc());
+                List<String> roleNameList = ctUseroleService.listRoleName(id);
+                if (CollectionUtils.isNotEmpty(roleNameList)) {
+                    String userRoles = roleNameList.stream().map(String::valueOf).collect(Collectors.joining("、"));
+                    ctUserInfoDTO.setUserRoles(userRoles);
+                }
+            }
+            return ReturnSucUtils.getRepInfo(ctUserInfoDTO);
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo();
+        }
+    }
+
+    /**
+     * 人工配置-统一修改单位名称
+     * @url {ctx}/api/web/ctUser/updateUnitName
+     * @param id 主键编号
+     * @return Object
+     * @throws Exception
+     */
+    @GetMapping("/getByIdupdateUnitNameRole")
+    public Object updateUnitName() {
+        try {
+
+            return ReturnSucUtils.getRepInfo();
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo();
+        }
+    }
 }

--
Gitblit v1.8.0