From f974bf528f0fd1f7316bdb3f06be8004e8db9f15 Mon Sep 17 00:00:00 2001
From: wangwh <2397901735@qq.com>
Date: Wed, 21 Aug 2024 17:24:07 +0800
Subject: [PATCH] 用户中心部分迁移1

---
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java |   60 +
 dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/controller/SyncController.java            |   50 +
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUnit.java                   |   31 +
 dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/service/SyncService.java                  |  105 +++
 dyh-gateway/src/main/resources/config/application.yml                                            |    2 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUserMapper.java            |   14 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CtRoleBO.java                 |    6 
 dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/source/SourceCtUnit.java           |  257 ++++++++
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java |   28 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/UtilsClientImpl.java           |    1 
 dyh-gateway/src/main/java/cn/huge/gateway/utils/SpringContextUtil.java                           |    2 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java                   |   24 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtDeptService.java              |   51 +
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java              |   36 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/UserLoginDTO.java                   |    2 
 dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java                        |    2 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtDept.java                   |   19 
 dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/target/TargetCtUnit.java           |  232 +++++++
 dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/CustClient.java                     |   34 +
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUseroleMapper.xml      |    9 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java           |    8 
 dyh-service/dyh-sync/src/main/java/cn/huge/module/client/utils/SysUtils.java                     |   35 +
 dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/SyncMapper.java                |   40 +
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java |   20 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUseroleMapper.java         |    7 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java |  193 ++++++
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java              |   76 ++
 dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java            |   68 ++
 dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/xml/SyncMapper.xml             |   79 ++
 dyh-service/dyh-sync/src/main/java/cn/huge/module/client/constant/SysConsts.java                 |   35 +
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CtRoleMapper.java            |   12 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CtRole.java                   |    2 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml         |   82 ++
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoleMapper.xml         |    4 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtPostService.java              |    5 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java              |  138 ++++
 36 files changed, 1,718 insertions(+), 51 deletions(-)

diff --git a/dyh-gateway/src/main/java/cn/huge/gateway/utils/SpringContextUtil.java b/dyh-gateway/src/main/java/cn/huge/gateway/utils/SpringContextUtil.java
index 22c2c46..e6defca 100644
--- a/dyh-gateway/src/main/java/cn/huge/gateway/utils/SpringContextUtil.java
+++ b/dyh-gateway/src/main/java/cn/huge/gateway/utils/SpringContextUtil.java
@@ -53,7 +53,7 @@
     public static Boolean checkDev(){
         String activeProfile = getActiveProfile();
         if (DEV.equals(activeProfile)){
-            return false;
+            return true;
         }else{
             return false;
         }
diff --git a/dyh-gateway/src/main/resources/config/application.yml b/dyh-gateway/src/main/resources/config/application.yml
index f264411..ba6570c 100644
--- a/dyh-gateway/src/main/resources/config/application.yml
+++ b/dyh-gateway/src/main/resources/config/application.yml
@@ -54,4 +54,4 @@
     #refreshToken过期时间:13小时,比token时间长一点
     expire-time: 46800000
   #不进行token拦截
-  auth-skip-urls: /dyh-sys/api/v1/fileInfo/show,/dyh-sys/api/v1/fileInfo/down,/api/v1/ctAccount/login,/dyh-cust/api/weChat/paAccount,/dyh-sys/api/weChat/paHotNews/listShow,/dyh-mediate/api/weChat/paCaseInfo/mediatePower,/dyh-mediate/api/v1/caseOut/rmtj/selectExcels,/dyh-mediate/api/v1/caseOut/rmtj/selectFiles,/dyh-mediate/api/v1/caseInfo/exportListToExcel,/dyh-sys/dingTalk/api/fileInfo/ocrIdcard,/dyh-mediate/api/v1/caseOut/rmtj/outQueryEnd,/dyh-mediate/api/v1/caseInfo/reportStatisticsListToExcel,/dyh-mediate/api/v1/caseInfo/tjExcels,/dyh-mediate/api/v1/caseInfo/tjFiles,/dyh-mediate/api/analyseScreen/unitCount,/dyh-mediate/api/analyseScreen/mediatorCount,/dyh-mediate/api/analyseScreen/mediationCount,/dyh-mediate/api/analyseScreen/caseReasonRate,/dyh-mediate/api/analyseScreen/mediatorReasonRate,/dyh-mediate/api/analyseScreen/monthCount,/dyh-mediate/api/analyseScreen/findAllUnit,/dyh-mediate/api/analyseScreen/findAllCount,/dyh-mediate/api/analyseScreen/dynamicDetail,/dyh-mediate/api/v1/caseInfo/exportAiDoc
\ No newline at end of file
+  auth-skip-urls: /dyh-sys/api/v1/sync/universalSync
\ No newline at end of file
diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java b/dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java
index 9184af1..e39250e 100644
--- a/dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java
+++ b/dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java
@@ -143,7 +143,7 @@
     /**
      * 组织类型,1:指挥中心,2:职能部门,3:镇街,:4:村居社区,5:行、专业,6:企、事业,7:演示测试,9:其他
      */
-    private String unitType;
+    private Integer unitType;
 
     /**
      * 部门编号
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/UtilsClientImpl.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/UtilsClientImpl.java
index d8ff461..bc25875 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/UtilsClientImpl.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/UtilsClientImpl.java
@@ -49,4 +49,5 @@
             throw new ServiceException("UtilsClientImpl.getNewTimeId", e);
         }
     }
+
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CRoleWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java
similarity index 91%
rename from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CRoleWebController.java
rename to dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java
index fb846c5..5687e41 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CRoleWebController.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java
@@ -1,9 +1,9 @@
-package cn.huge.module.ctrole.controller;
+package cn.huge.module.ctrole.controller.web;
 
 import cn.huge.base.common.utils.ReturnFailUtils;
 import cn.huge.base.common.utils.ReturnSucUtils;
-import cn.huge.module.ctrole.domain.po.CRole;
-import cn.huge.module.ctrole.service.CRoleService;
+import cn.huge.module.ctrole.domain.po.CtRole;
+import cn.huge.module.ctrole.service.CtRoleService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -15,8 +15,6 @@
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
 
 /**
  * @title: 角色表接口api
@@ -29,13 +27,13 @@
 @Slf4j
 @RestController
 @RequestMapping("/api/web/cRole")
-public class CRoleWebController {
+public class CtRoleWebController {
 
     @Autowired(required = false)
     private HttpServletRequest request;
 
     @Autowired
-    private CRoleService service;
+    private CtRoleService service;
 
     /**
     * 获取请求URL参数
@@ -123,7 +121,7 @@
             Map<String, Object> terms = getParameter();
             Sort sort = Sort.by(Sort.Direction.DESC, "create_time");
             PageRequest pageRequest = PageRequest.of(page-1, size, sort);
-            Page<CRole> cRolePage = service.pageQuery(pageRequest, terms);
+            Page<CtRole> cRolePage = service.pageQuery(pageRequest, terms);
             return ReturnSucUtils.getRepInfo( "处理成功", cRolePage);
         } catch (Exception e) {
             return ReturnFailUtils.getRepInfo();
@@ -164,13 +162,13 @@
     /**
     * 新增或更新对象
     * @url {ctx}/api/web/cRole/saveCRole
-    * @param cRole 实体对象
+    * @param ctRole 实体对象
     * @return Object
     */
     @PostMapping("/saveCRole")
-    public Object saveCRole(@RequestBody CRole cRole) {
+    public Object saveCRole(@RequestBody CtRole ctRole) {
         try {
-            service.saveCRole(cRole);
+            service.saveCRole(ctRole);
             return ReturnSucUtils.getRepInfo();
         } catch (Exception e) {
             return ReturnFailUtils.getRepInfo();
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CRoleMapper.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CtRoleMapper.java
similarity index 74%
rename from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CRoleMapper.java
rename to dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CtRoleMapper.java
index 715752b..1a8ff91 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CRoleMapper.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/CtRoleMapper.java
@@ -1,6 +1,6 @@
 package cn.huge.module.ctrole.dao.mapper;
 
-import cn.huge.module.ctrole.domain.po.CRole;
+import cn.huge.module.ctrole.domain.po.CtRole;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.data.domain.PageRequest;
@@ -18,20 +18,20 @@
 * @version 1.0.0
 */
 @Repository
-public interface CRoleMapper extends BaseMapper<CRole>{
+public interface CtRoleMapper extends BaseMapper<CtRole>{
 
     /**
     * 更新对象
     * @param entity 对象
     */
-    void updateCRole(@Param("entity") CRole entity);
+    void updateCRole(@Param("entity") CtRole entity);
 
     /**
     * 条件更新对象
     * @param entity 对象
     * @param terms 条件
     */
-    void updateCRoleTerms(@Param("entity") CRole entity, @Param("terms") Map<String, Object> terms);
+    void updateCRoleTerms(@Param("entity") CtRole entity, @Param("terms") Map<String, Object> terms);
 
     /**
     * 根据编号物理删除
@@ -44,7 +44,7 @@
     * @param terms 查询条件集合
     * @return List<CRole>
     */
-    List<CRole> listTerms(@Param("terms") Map<String, Object> terms);
+    List<CtRole> listTerms(@Param("terms") Map<String, Object> terms);
 
     /**
     * 按条件查询实体总数
@@ -59,6 +59,6 @@
     * @param terms 查询条件集合
     * @return List<CRole>
     */
-    List<CRole> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
+    List<CtRole> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
 
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CRoleMapper.xml b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoleMapper.xml
similarity index 98%
rename from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CRoleMapper.xml
rename to dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoleMapper.xml
index 282ae9b..e762a62 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CRoleMapper.xml
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/dao/mapper/xml/CtRoleMapper.xml
@@ -8,9 +8,9 @@
  * @time:2024-08-19 20:04:19
  * @version 1.0.0
 -->
-<mapper namespace="cn.huge.module.ctrole.dao.mapper.CRoleMapper">
+<mapper namespace="cn.huge.module.ctrole.dao.mapper.CtRoleMapper">
     <!-- 结果集 -->
-    <resultMap id="dataResult" type="cn.huge.module.ctrole.domain.po.CRole">
+    <resultMap id="dataResult" type="cn.huge.module.ctrole.domain.po.CtRole">
             <result property="id" column="id"/>
             <result property="roleCode" column="role_code"/>
             <result property="name" column="name"/>
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CRoleBO.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CtRoleBO.java
similarity index 63%
rename from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CRoleBO.java
rename to dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CtRoleBO.java
index 41b5921..fb70601 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CRoleBO.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/bo/CtRoleBO.java
@@ -1,6 +1,6 @@
 package cn.huge.module.ctrole.domain.bo;
 
-import cn.huge.module.ctrole.domain.po.CRole;
+import cn.huge.module.ctrole.domain.po.CtRole;
 
 /**
  * @title: 角色表业务扩展类
@@ -9,9 +9,9 @@
  * @author: liyj
  * @time: 2024-08-19 20:04:19
  * @version: 1.0.0
- * @see cn.huge.module.ctrole.domain.po.CRole
+ * @see CtRole
  */
-public class CRoleBO extends CRole {
+public class CtRoleBO extends CtRole {
 
 
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CRole.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CtRole.java
similarity index 98%
rename from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CRole.java
rename to dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CtRole.java
index 9d56009..cce000e 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CRole.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/domain/po/CtRole.java
@@ -18,7 +18,7 @@
  */
 @TableName(value = "dyh_ct_role")
 @Data
-public class CRole {
+public class CtRole {
 
     /**
     * 角色编号
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CRoleService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
similarity index 75%
rename from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CRoleService.java
rename to dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
index 96bf19a..a6ba27a 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CRoleService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
@@ -4,19 +4,17 @@
 import cn.huge.base.common.utils.DateUtils;
 import cn.huge.base.common.utils.IdUtils;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
-import cn.huge.module.ctrole.dao.mapper.CRoleMapper;
-import cn.huge.module.ctrole.domain.po.CRole;
+import cn.huge.module.ctrole.dao.mapper.CtRoleMapper;
+import cn.huge.module.ctrole.domain.po.CtRole;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.transaction.annotation.Transactional;
 
-import javax.annotation.PostConstruct;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -32,10 +30,10 @@
 @Slf4j
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class CRoleService extends ServiceImpl<CRoleMapper, CRole>{
+public class CtRoleService extends ServiceImpl<CtRoleMapper, CtRole>{
 
     @Autowired
-    private CRoleMapper mapper;
+    private CtRoleMapper mapper;
 
     @Autowired
     private UtilsClientImpl utilsClient;
@@ -44,7 +42,7 @@
     * 更新对象
     * @param entity 对象
     */
-    public void updateCRole(CRole entity){
+    public void updateCRole(CtRole entity){
         try{
             mapper.updateCRole(entity);
         }catch (Exception e){
@@ -58,7 +56,7 @@
     * @param entity 对象
     * @param terms 条件
     */
-    public void updateCRoleTerms(CRole entity, Map<String, Object> terms){
+    public void updateCRoleTerms(CtRole entity, Map<String, Object> terms){
         try{
             mapper.updateCRoleTerms(entity, terms);
         }catch (Exception e){
@@ -85,7 +83,7 @@
     * @param terms 条件
     * @return List
     */
-    public List<CRole> listTerms(Map<String, Object> terms){
+    public List<CtRole> listTerms(Map<String, Object> terms){
         return mapper.listTerms(terms);
     }
 
@@ -104,26 +102,26 @@
     * @param terms 条件
     * @return Page
     */
-    public Page<CRole> pageQuery(PageRequest page, Map<String, Object> terms){
+    public Page<CtRole> pageQuery(PageRequest page, Map<String, Object> terms){
         long total = mapper.countTerms(terms);
-        List<CRole> content = mapper.pageTerms(page, terms);
-        return new PageImpl<CRole>(content, page, total);
+        List<CtRole> content = mapper.pageTerms(page, terms);
+        return new PageImpl<CtRole>(content, page, total);
     }
 
     /**
     * 新增或更新对象
-    * @param cRole 实体对象
+    * @param ctRole 实体对象
     */
-    public void saveCRole(CRole cRole){
+    public void saveCRole(CtRole ctRole){
         try{
             Date nowDate = DateUtils.getNowDate();
             // 判断是否新增
-            if (IdUtils.checkNewId(cRole.getId())){
-                cRole.setId(utilsClient.getNewTimeId());
-                cRole.setCreateTime(nowDate);
+            if (IdUtils.checkNewId(ctRole.getId())){
+                ctRole.setId(utilsClient.getNewTimeId());
+                ctRole.setCreateTime(nowDate);
             }
-            cRole.setUpdateTime(nowDate);
-            this.saveOrUpdate(cRole);
+            ctRole.setUpdateTime(nowDate);
+            this.saveOrUpdate(ctRole);
         }catch (Exception e){
             log.error("[CRoleService.saveCRole]调用失败,异常信息:"+e, e);
             throw new ServiceException("CRoleService.saveCRole", e);
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java
index 11b2aed..fc1f1c1 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java
@@ -2,8 +2,12 @@
 
 import cn.huge.base.common.utils.ReturnFailUtils;
 import cn.huge.base.common.utils.ReturnSucUtils;
+import cn.huge.base.config.CurrentUser;
 import cn.huge.module.ctuser.domain.po.CtPost;
+import cn.huge.module.ctuser.domain.po.CtUser;
 import cn.huge.module.ctuser.service.CtPostService;
+import cn.huge.module.ctuser.service.CtUserService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -14,6 +18,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -36,6 +41,9 @@
 
     @Autowired
     private CtPostService service;
+
+    @Autowired
+    private CtUserService ctUserService;
 
     /**
     * 获取请求URL参数
@@ -172,4 +180,24 @@
         }
     }
 
+    /**
+     * 根据单位编号查询所有岗位
+     * @url {ctx}/api/v1/ctPost/getByUnitId
+     * @param userId 登录用户编号
+     * @return Object
+     * @throws Exception
+     */
+    @GetMapping("/getByUnitId")
+    public Object getByUnitId(@CurrentUser String userId) {
+        try {
+            // 获取当前登录用户
+            CtUser ctUser = ctUserService.getById(userId);
+            QueryWrapper<CtPost> ctPostQueryWrapper = new QueryWrapper<>();
+            ctPostQueryWrapper.eq("unit_id", ctUser.getUnitId());
+            List<CtPost> ctPostList = service.list(ctPostQueryWrapper);
+            return ReturnSucUtils.getRepInfo(ctPostList);
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo();
+        }
+    }
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java
index 058d125..2908cf9 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java
@@ -1,9 +1,12 @@
-package cn.huge.module.ctuser.controller;
+package cn.huge.module.ctuser.controller.web;
 
 import cn.huge.base.common.utils.ReturnFailUtils;
 import cn.huge.base.common.utils.ReturnSucUtils;
+import cn.huge.base.config.CurrentUser;
 import cn.huge.module.ctuser.domain.po.CtUnit;
+import cn.huge.module.ctuser.domain.po.CtUser;
 import cn.huge.module.ctuser.service.CtUnitService;
+import cn.huge.module.ctuser.service.CtUserService;
 import com.google.common.collect.Maps;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -14,6 +17,7 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -36,6 +40,9 @@
 
     @Autowired
     private CtUnitService service;
+    @Autowired
+    private CtUserService ctUserService;
+
 
     /**
     * 获取请求URL参数
@@ -307,4 +314,55 @@
         }
     }
 
+    /**
+     * 批量新增-数据迁移
+     * @url {ctx}/api/web/ctUnit/saveCtUnitList
+     * @param targetCtUnitList 实体对象
+     * @return Object
+     */
+    @PostMapping("/saveCtUnitList")
+    public Object saveCtUnitList(@RequestBody List<CtUnit> targetCtUnitList) {
+        try {
+            service.saveBatch(targetCtUnitList);
+            return ReturnSucUtils.getRepInfo();
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo();
+        }
+    }
+
+    /**
+     * 获取所有组织(包含所有下级子组织)树形结构
+     * @url {ctx}/api/v1/ctUnit/listUnitTree
+     * @param userId 登录用户标识称
+     * @return Object
+     */
+    @GetMapping("/listUnitTree")
+    public Object listUnitTree(@CurrentUser String userId) {
+        try {
+            // 获取当前登录用户
+            CtUser ctUser = ctUserService.getById(userId);
+            // 查询当前登录用户下的所有单位
+            List<CtUnit> ctUnits = service.listUnitTree(ctUser.getCustId(), ctUser.getUnitId());
+            return ReturnSucUtils.getRepInfo( "查询成功", ctUnits);
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo( "查询失败", null);
+        }
+    }
+
+    /**
+     * 获取组织详情(包含组织下的部门详情)
+     * @url {ctx}/api/v1/ctUnit/getUnitAndDept?id=
+     * @param id 组织编号
+     * @return Object
+     */
+    @GetMapping("/getUnitAndDept")
+    public Object getUnitAndDept(@RequestParam(value = "id") String id) {
+        try {
+            //查询该用户组织和部门
+            CtUnit ctUnit = service.getUnitAndDept(id);
+            return ReturnSucUtils.getRepInfo( "查询成功", ctUnit);
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo( "查询失败", null);
+        }
+    }
 }
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..7417445 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,22 @@
-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.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.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,6 +25,8 @@
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
@@ -37,6 +49,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参数
@@ -259,4 +289,161 @@
         }
     }
 
+    /**
+     * 获取人员信息列表查询条件
+     * @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 = Maps.newHashMap();
+            // 获取当前登录用户
+            CtUser loginUser = service.getById(userId);
+            // 组织条件
+            QueryWrapper<CtUnit> ctUnitQueryWrapper = new QueryWrapper<>();
+            ctUnitQueryWrapper.eq("cust_id", loginUser.getCustId());
+            List<CtUnit> ctUnits = ctUnitService.list(ctUnitQueryWrapper);
+            List<SelectTermDTO> unitSelectTerms = new ArrayList<>();
+            for (CtUnit ctUnit: ctUnits) {
+                SelectTermDTO unitSelectTerm = new SelectTermDTO();
+                unitSelectTerm.setValue(ctUnit.getId());
+                unitSelectTerm.setLabel(ctUnit.getUnitName());
+                unitSelectTerm.setParentId(ctUnit.getParentId());
+                unitSelectTerms.add(unitSelectTerm);
+
+                // 部门条件
+                QueryWrapper<CtDept> ctDeptQueryWrapper = new QueryWrapper<>();
+                ctDeptQueryWrapper.eq("unit_id", ctUnit.getId());
+                List<CtDept> ctDepts = ctDeptService.list(ctDeptQueryWrapper);
+                if (CollectionUtils.isNotEmpty(ctDepts)) {
+                    List<SelectTermDTO> deptSelectTerms = new ArrayList<>();
+                    for (CtDept ctDept : ctDepts) {
+                        SelectTermDTO deptSelectTerm = new SelectTermDTO();
+                        deptSelectTerm.setValue(ctDept.getId());
+                        deptSelectTerm.setLabel(ctDept.getName());
+                        deptSelectTerm.setParentId(ctDept.getParentId());
+                        deptSelectTerms.add(deptSelectTerm);
+                    }
+                    List<SelectTermDTO> depts = SelectTermUtils.createTreeByRoot(deptSelectTerms);
+                    unitSelectTerm.setChainList(depts);
+                }
+            }
+            result.put("units", SelectTermUtils.createTreeByFirst(unitSelectTerms, loginUser.getUnitId()));
+
+            // 角色条件
+            QueryWrapper<CtRole> ctRoleQueryWrapper = new QueryWrapper<>();
+            ctRoleQueryWrapper.eq("unit_id", loginUser.getUnitId());
+            //判断是否为村居(村居不应该有调委会管理员角色)
+            QueryWrapper<CtUnit> ctUnitQueryWrapper1 = new QueryWrapper<>();
+            ctUnitQueryWrapper1.eq("id", loginUser.getUnitId()).eq("cust_id", loginUser.getCustId())
+                    .select("unit_type");
+            CtUnit ctUnit = ctUnitService.getOne(ctUnitQueryWrapper1);
+            if(UserBaseConsts.UNIT_TYPE_4.equals(ctUnit.getUnitType())){
+                ctRoleQueryWrapper.ne("role_code", RoleBaseEnum.ROLE_9.getIndex());
+            }
+            List<CtRole> ctRoleList = ctRoleService.list(ctRoleQueryWrapper);
+            List<SelectTermDTO> roleSelectTerms = new ArrayList<>();
+            for (CtRole ctRole: ctRoleList){
+                SelectTermDTO selectTerm = new SelectTermDTO();
+                selectTerm.setValue(ctRole.getRoleCode());
+                selectTerm.setLabel(ctRole.getName());
+                roleSelectTerms.add(selectTerm);
+            }
+            result.put("roles", roleSelectTerms);
+            return ReturnSucUtils.getRepInfo( "查询成功", result);
+        } catch (Exception e) {
+            log.error("Controller接口[CtUserController.listSelectTerm]请求异常:"+e, e);
+            return ReturnFailUtils.getRepInfo("查询失败", null);
+        }
+    }
+
+    /**
+     * 条件分页查询人员信息
+     * @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 {
+            // 获取当前登录用户
+            CtUserDTO loginUser = service.clientGetUserAll(userId);
+            Map<String, Object> result = Maps.newHashMap();
+            Map<String, Object> terms = getParameter();
+            if (RoleBaseEnum.checkAdminPower(loginUser)){
+                terms.put("custId", loginUser.getCustId());
+            }else if (RoleBaseEnum.checkCourtOrUnitPower(loginUser.getRoleCodes())){
+                terms.put("custId", loginUser.getCustId());
+                String unitId = (String) terms.get("unitId");
+                if (StringUtils.isEmpty(unitId)){
+                    terms.put("unitId", loginUser.getUnitId());
+                }
+            }else {
+                terms.put("custId", loginUser.getCustId());
+                terms.put("id", loginUser.getId());
+            }
+            Sort sort = Sort.by(Sort.Direction.DESC, "t1.create_time");
+            PageRequest pageRequest = PageRequest.of(page-1, size, sort);
+            Page<CtUser> ctUserPage = service.pageUserAndRole(pageRequest, terms);
+            QueryWrapper<CtAccount> accountQueryWrapper = new QueryWrapper<>();
+            QueryWrapper<CtUserole> ctUseroleQueryWrapper = new QueryWrapper<>();
+            QueryWrapper<CtUsepost> ctUsepostQueryWrapper = new QueryWrapper<>();
+            for (CtUser ctUser: ctUserPage){
+                accountQueryWrapper.clear();
+                // 密码
+                accountQueryWrapper.eq("acc_type", UserBaseConsts.ACC_TYPE_1);
+                accountQueryWrapper.eq("user_id", ctUser.getId());
+                CtAccount ctAccount = ctAccountService.getOne(accountQueryWrapper);
+                if (ObjectUtils.isNotEmpty(ctAccount)){
+                    ctUser.setAcc(ctAccount.getAcc());
+                    ctUser.setCipher(ctAccount.getCipherOpen());
+                }
+                // 角色
+                ctUseroleQueryWrapper.clear();
+                ctUseroleQueryWrapper.eq("user_id", ctUser.getId());
+                List<CtUserole> ctUseroleList = ctUseroleService.list(ctUseroleQueryWrapper);
+                if (ObjectUtils.isNotEmpty(ctUseroleList)){
+                    for (CtUserole ctUserole: ctUseroleList){
+                        ctUserole.setRoleId(ctUserole.getRoleCode());
+                    }
+                    ctUser.setCtUseroleList(ctUseroleList);
+                }
+                // 岗位
+                ctUsepostQueryWrapper.clear();
+                ctUsepostQueryWrapper.eq("user_id", ctUser.getId());
+                List<CtUsepost> ctUsepostList = ctUsepostService.list(ctUsepostQueryWrapper);
+                if (ObjectUtils.isNotEmpty(ctUsepostList)) {
+                    ctUser.setCtUsepostList(ctUsepostList);
+                }
+            }
+            result.put("ctUserPage", ctUserPage);
+            terms = Maps.newHashMap();
+            // 生效名额
+            terms.put("status", UserBaseConsts.USER_STATUS_1);
+            terms.put("custId", loginUser.getCustId());
+            if (RoleBaseEnum.checkAdminPower(loginUser)){
+                terms.put("custId", loginUser.getCustId());
+            }else if (RoleBaseEnum.checkCourtOrUnitPower(loginUser.getRoleCodes())){
+                terms.put("custId", loginUser.getCustId());
+                String unitId = (String) terms.get("unitId");
+                if (StringUtils.isEmpty(unitId)){
+                    terms.put("unitId", loginUser.getUnitId());
+                }
+            }else {
+                terms.put("custId", loginUser.getCustId());
+                terms.put("id", loginUser.getId());
+            }
+            long countZzStatus = service.countTerms(terms);
+            result.put("countZzStatus", countZzStatus);
+            return ReturnSucUtils.getRepInfo( "处理成功", result);
+        } catch (Exception e) {
+            log.error("Controller接口[CtUserController.pageQuery]请求异常:"+e, e);
+            return ReturnFailUtils.getRepInfo(e.getMessage(), null);
+        }
+    }
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUserMapper.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUserMapper.java
index 19609a5..1ee4253 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUserMapper.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUserMapper.java
@@ -61,4 +61,18 @@
     */
     List<CtUser> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
 
+    /**
+     * 按条件查询实体总数
+     *
+     * @param terms 查询条件集合
+     */
+    long countQueryCtUser(@Param("terms") Map<String, Object> terms);
+
+    /**
+     * 按条件查询实体分页结果集
+     * @param page 分页对象
+     * @param terms 查询条件集合
+     * @return
+     */
+    List<CtUser> pageQueryCtUser(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUseroleMapper.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUseroleMapper.java
index e78833b..35c10b0 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUseroleMapper.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/CtUseroleMapper.java
@@ -61,4 +61,11 @@
     */
     List<CtUserole> pageTerms(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
 
+    /**
+     * 根据用户编号获取其角色名代码
+     * @param userId 用户编号
+     * @return List<String>
+     */
+    List<String> listRoleCode(@Param("userId") String userId);
+
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml
index eb876ed..3a4d8be 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUserMapper.xml
@@ -325,4 +325,86 @@
         limit #{page.offset}, #{page.size}
     </select>
 
+    <!--  根据条件统计  -->
+    <select id="countQueryCtUser" resultType="java.lang.Long">
+        SELECT COUNT(distinct t1.id)
+        FROM dyh_ct_user t1
+        LEFT JOIN dyh_ct_userole t2 on t1.id = t2.user_id
+        <if test="terms != null">
+            <where>
+                <if test="terms.trueName != null and terms.trueName !=''">
+                    and t1.true_name like concat('%', #{terms.trueName}, '%')
+                </if>
+                <if test="terms.acc != null and terms.acc !=''">
+                    and t1.acc like concat('%', #{terms.acc}, '%')
+                </if>
+                <if test="terms.unitId != null and terms.unitId !=''">
+                    and t1.unit_id = #{terms.unitId}
+                </if>
+                <if test="terms.deptId != null and terms.deptId !=''">
+                    and t1.dept_id = #{terms.deptId}
+                </if>
+                <if test="terms.status != null and terms.status !=''">
+                    and t1.status = #{terms.status}
+                </if>
+                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
+                    and t1.delete_status = '1'
+                </if>
+                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
+                    and t1.delete_status = #{terms.deleteStatus}
+                </if>
+                <if test="terms.roleId != null and terms.roleId !=''">
+                    and t2.role_id = #{terms.roleId}
+                </if>
+            </where>
+        </if>
+    </select>
+
+    <!--  根据条件分页查询  -->
+    <select id="pageQueryCtUser" resultMap="dataResult">
+        SELECT t1.*
+        FROM dyh_ct_user t1
+        LEFT JOIN dyh_ct_userole t2 on t1.id = t2.user_id
+        <if test="terms != null">
+            <where>
+                <if test="terms.trueName != null and terms.trueName !=''">
+                    and t1.true_name like concat('%', #{terms.trueName}, '%')
+                </if>
+                <if test="terms.acc != null and terms.acc !=''">
+                    and t1.acc like concat('%', #{terms.acc}, '%')
+                </if>
+                <if test="terms.unitId != null and terms.unitId !=''">
+                    and t1.unit_id = #{terms.unitId}
+                </if>
+                <if test="terms.deptId != null and terms.deptId !=''">
+                    and t1.dept_id = #{terms.deptId}
+                </if>
+                <if test="terms.status != null and terms.status !=''">
+                    and t1.status = #{terms.status}
+                </if>
+                <if test="terms.deleteStatus = null and terms.deleteStatus =''">
+                    and t1.delete_status = '1'
+                </if>
+                <if test="terms.deleteStatus != null and terms.deleteStatus !=''">
+                    and t1.delete_status = #{terms.deleteStatus}
+                </if>
+                <if test="terms.roleId != null and terms.roleId !=''">
+                    and t2.role_id = #{terms.roleId}
+                </if>
+                <if test="terms.roleCode != null and terms.roleCode !=''">
+                    and t2.role_code = #{terms.roleCode}
+                </if>
+            </where>
+        </if>
+        GROUP BY t1.id
+        <if test="page.sort != null">
+            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
+                isnull(${s.property}), ${s.property} ${s.direction}
+            </foreach>
+        </if>
+        <if test="page.sort == null">
+            order by isnull(t1.create_time), t1.create_time desc
+        </if>
+        limit #{page.offset}, #{page.size}
+    </select>
 </mapper> 
\ No newline at end of file
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUseroleMapper.xml b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUseroleMapper.xml
index d54d5dd..f3b00cb 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUseroleMapper.xml
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dao/mapper/xml/CtUseroleMapper.xml
@@ -142,4 +142,13 @@
         limit #{page.offset}, #{page.size}
     </select>
 
+    <select id="listRoleCode" resultType="String">
+        select
+        role_code
+        FROM
+        <include refid="table-name" />
+        WHERE
+        user_id = #{userId}
+    </select>
+
 </mapper> 
\ No newline at end of file
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtDept.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtDept.java
index 37b788a..3203b86 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtDept.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtDept.java
@@ -7,6 +7,7 @@
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @title: 客户部门表数据库对应关系类
@@ -105,4 +106,22 @@
     @TableField(value = "update_time")
     private Date updateTime;
 
+    /**
+     * 人员数量
+     */
+    @TableField(exist = false)
+    private Integer countCtUser;
+
+    /**
+     * 部门下的人员
+     */
+    @TableField(exist = false)
+    private List<CtUser> matchUsers;
+
+    /**
+     * 子部门
+     */
+    @TableField(exist = false)
+    private List<CtDept> children;
+
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUnit.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUnit.java
index 09a7f4e..ef27bae 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUnit.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUnit.java
@@ -7,6 +7,7 @@
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @title: 客户组织信息表数据库对应关系类
@@ -231,4 +232,34 @@
     @TableField(value = "update_time")
     private Date updateTime;
 
+    /**
+     * 子部门
+     */
+    @TableField(exist = false)
+    private List<CtDept> ctDepts;
+
+    /**
+     * 部门数量
+     */
+    @TableField(exist = false)
+    private Integer countCtDept;
+
+    /**
+     * 人员数量
+     */
+    @TableField(exist = false)
+    private Integer countCtUser;
+
+    /**
+     * 子组织
+     */
+    @TableField(exist = false)
+    private List<CtUnit> children;
+
+    /**
+     * 组织下未配岗人员
+     */
+    @TableField(exist = false)
+    private List<CtUser> unMatchUsers;
+
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java
index 18335e7..d984013 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java
@@ -7,6 +7,7 @@
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * @title: 客户用户表数据库对应关系类
@@ -249,4 +250,27 @@
     @TableField(value = "update_time")
     private Date updateTime;
 
+    /**
+     * 平台账号
+     */
+    @TableField(exist = false)
+    private String acc;
+
+    /**
+     * 密码
+     */
+    @TableField(exist = false)
+    private String cipher;
+
+    /**
+     * 人员角色信息
+     */
+    @TableField(exist = false)
+    private List<CtUserole> ctUseroleList;
+
+    /**
+     * 人员岗位信息
+     */
+    @TableField(exist = false)
+    private List<CtUsepost> ctUsepostList;
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/UserLoginDTO.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/UserLoginDTO.java
index 37a2a8e..45d2b7f 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/UserLoginDTO.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/UserLoginDTO.java
@@ -1,8 +1,6 @@
 package cn.huge.module.ctuser.dto;
 
 import cn.huge.module.ctuser.domain.po.CtUserole;
-import cn.huge.module.user.domain.po.CtUser;
-import cn.huge.module.user.domain.po.CtUserole;
 import lombok.Data;
 
 import java.util.Date;
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtDeptService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtDeptService.java
index a563ef1..3853f43 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtDeptService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtDeptService.java
@@ -4,9 +4,12 @@
 import cn.huge.base.common.utils.DateUtils;
 import cn.huge.base.common.utils.IdUtils;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
+import cn.huge.module.constant.BaseConsts;
 import cn.huge.module.ctuser.dao.mapper.CtDeptMapper;
 import cn.huge.module.ctuser.domain.po.CtDept;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import lombok.extern.slf4j.Slf4j;
@@ -17,6 +20,7 @@
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.PostConstruct;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -130,4 +134,51 @@
         }
     }
 
+    /**
+     * 创建某一级部门下树形结构
+     * @param ctDeptList 所有部门集合
+     * @param firstId 某一级组织编号
+     * @return List
+     */
+    public List<CtDept> createTree(List<CtDept> ctDeptList, String firstId) {
+        List<CtDept> firstMapList= new ArrayList<>();
+        for (CtDept ctDept: ctDeptList ){
+            for(CtDept deptParam: ctDeptList ) {
+                if (deptParam.getId().equals(ctDept.getParentId())) {
+                    addToMBean(deptParam, ctDept);
+                    break;
+                }
+            }
+        }
+        //取第一级节点
+        for (CtDept dept: ctDeptList ){
+            if (StringUtils.isNotEmpty(firstId)){
+                if (firstId.equals(dept.getId())) {
+                    firstMapList.add(dept);
+                }
+            }else{
+                if (BaseConsts.ROOT.equals(dept.getParentId()) || StringUtils.isEmpty(dept.getParentId())) {
+                    firstMapList.add(dept);
+                }
+            }
+        }
+        return firstMapList;
+    }
+
+    /**
+     * 获取部门的子级部门
+     * @param targetUnit 目标部门
+     * @param currentUnit 子级部门
+     */
+    public void addToMBean(CtDept targetUnit, CtDept currentUnit){
+        List<CtDept> childListObj = targetUnit.getChildren();
+        List<CtDept> childList = null;
+        if(CollectionUtils.isEmpty(childListObj)) {
+            childList = new ArrayList();
+            targetUnit.setChildren(childList);
+        }else{
+            childList = childListObj;
+        }
+        childList.add(currentUnit);
+    }
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtPostService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtPostService.java
index 54c5e72..4471883 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtPostService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtPostService.java
@@ -3,9 +3,12 @@
 import cn.huge.base.common.exception.ServiceException;
 import cn.huge.base.common.utils.DateUtils;
 import cn.huge.base.common.utils.IdUtils;
+import cn.huge.base.config.CurrentUser;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
 import cn.huge.module.ctuser.dao.mapper.CtPostMapper;
 import cn.huge.module.ctuser.domain.po.CtPost;
+import cn.huge.module.ctuser.domain.po.CtUser;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -15,6 +18,7 @@
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
 
 import javax.annotation.PostConstruct;
 import java.util.Date;
@@ -130,4 +134,5 @@
         }
     }
 
+
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java
index e4e4193..9b35ee2 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUnitService.java
@@ -3,10 +3,17 @@
 import cn.huge.base.common.exception.ServiceException;
 import cn.huge.base.common.utils.DateUtils;
 import cn.huge.base.common.utils.IdUtils;
+import cn.huge.base.config.CurrentUser;
 import cn.huge.module.client.api.impl.UtilsClientImpl;
+import cn.huge.module.constant.BaseConsts;
 import cn.huge.module.ctuser.dao.mapper.CtUnitMapper;
+import cn.huge.module.ctuser.domain.po.CtDept;
 import cn.huge.module.ctuser.domain.po.CtUnit;
+import cn.huge.module.ctuser.domain.po.CtUser;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import lombok.extern.slf4j.Slf4j;
@@ -15,11 +22,14 @@
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
 
 import javax.annotation.PostConstruct;
+import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @title: 客户组织信息表业务逻辑处理
@@ -39,6 +49,12 @@
 
     @Autowired
     private UtilsClientImpl utilsClient;
+
+    @Autowired
+    private CtDeptService ctDeptService;
+
+    @Autowired
+    private CtUserService ctUserService;
 
     /**
     * 更新对象
@@ -130,4 +146,126 @@
         }
     }
 
+    /**
+     * 获取所有组织(包含所有下级子组织)
+     *
+     * @param custId  客户编号
+     * @param firstId 某一级组织编号
+     * @return List
+     */
+    public List<CtUnit> listUnitTree(String custId, String firstId) {
+        QueryWrapper<CtUnit> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("cust_id", custId).orderByDesc("create_time");
+        List<CtUnit> ctUnits = mapper.selectList(queryWrapper);
+
+        // 获取所有的 CtDept 的数量
+        QueryWrapper<CtDept> deptQueryWrapper = new QueryWrapper<>();
+        deptQueryWrapper.in("unit_id", ctUnits.stream().map(CtUnit::getId).collect(Collectors.toList()));
+        List<CtDept> ctDepts = ctDeptService.list(deptQueryWrapper);
+
+        // 将 CtDept 的数量存储在 Map 中
+        Map<String, Long> ctDeptCountMap = ctDepts.stream()
+                .collect(Collectors.groupingBy(CtDept::getUnitId, Collectors.counting()));
+
+        // 为每个 CtUnit 设置 CtDept 的数量
+        for (CtUnit ctUnit : ctUnits) {
+            Long ctDeptsCount = ctDeptCountMap.getOrDefault(ctUnit.getId(), 0L);
+            ctUnit.setCountCtDept(ctDeptsCount.intValue());
+        }
+        return this.createTree(ctUnits, firstId);
+    }
+
+    /**
+     * 创建某一级组织下树形结构
+     *
+     * @param ctUnitList 所有组织集合
+     * @param firstId    某一级组织编号
+     * @return List
+     */
+    public List<CtUnit> createTree(List<CtUnit> ctUnitList, String firstId) {
+        List<CtUnit> firstMapList = new ArrayList<>();
+        for (CtUnit ctUnit : ctUnitList) {
+            for (CtUnit currentParam : ctUnitList) {
+                if (currentParam.getId().equals(ctUnit.getParentId())) {
+                    addToMBean(currentParam, ctUnit);
+                    break;
+                }
+            }
+        }
+        //取第一级节点
+        for (CtUnit unit : ctUnitList) {
+            if (StringUtils.isNotEmpty(firstId)) {
+                if (firstId.equals(unit.getId())) {
+                    firstMapList.add(unit);
+                }
+            } else {
+                if (BaseConsts.ROOT.equals(unit.getParentId()) || StringUtils.isEmpty(unit.getParentId())) {
+                    firstMapList.add(unit);
+                }
+            }
+        }
+        return firstMapList;
+    }
+
+    /**
+     * 获取组织的子级组织
+     *
+     * @param targetUnit  目标组织
+     * @param currentUnit 子级组织
+     */
+    public void addToMBean(CtUnit targetUnit, CtUnit currentUnit) {
+        List<CtUnit> childListObj = targetUnit.getChildren();
+        List<CtUnit> childList = null;
+        if (CollectionUtils.isEmpty(childListObj)) {
+            childList = new ArrayList();
+            targetUnit.setChildren(childList);
+        } else {
+            childList = childListObj;
+        }
+        childList.add(currentUnit);
+    }
+
+    /**
+     * 获取组织相关数据(包含组织下的部门)
+     *
+     * @param unitId 组织主键编号
+     * @return
+     */
+    public CtUnit getUnitAndDept(String unitId) {
+
+        // 组织详情
+        CtUnit ctUnit = mapper.selectById(unitId);
+        // 组织人员数量
+        QueryWrapper<CtUser> userQueryWrapper = new QueryWrapper<>();
+        userQueryWrapper.eq("unit_id", unitId);
+        Integer countCtUser = ctUserService.count(userQueryWrapper);
+        ctUnit.setCountCtUser(countCtUser);
+        // 未配岗人员(单位下)
+        userQueryWrapper.isNull("dept_id");
+        List<CtUser> unMatchUsers = ctUserService.list(userQueryWrapper);
+        ctUnit.setUnMatchUsers(unMatchUsers);
+        // 部门详情
+        QueryWrapper<CtDept> deptQueryWrapper = new QueryWrapper<>();
+        deptQueryWrapper.eq("unit_id", unitId);
+        deptQueryWrapper.orderByDesc("create_time");
+        List<CtDept> ctDepts = ctDeptService.list(deptQueryWrapper);
+        for (CtDept ctDept : ctDepts) {
+            // 部门
+            userQueryWrapper.clear();
+            userQueryWrapper.eq("dept_id", ctDept.getId());
+            // 部门下成员
+            List<CtUser> matchUsers = ctUserService.list(userQueryWrapper);
+            ctDept.setMatchUsers(matchUsers);
+            // 部门人员数量
+            int countDeptUser = ctUserService.count(userQueryWrapper);
+            ctDept.setCountCtUser(countDeptUser);
+        }
+        List<CtDept> ctDeptTrees = ctDeptService.createTree(ctDepts, null);
+        ctUnit.setCtDepts(ctDeptTrees);
+        // 部门数量
+        ctUnit.setCountCtDept(ctDepts.size());
+        return ctUnit;
+    }
+
+
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
index 89b9369..80c5f99 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
@@ -8,13 +8,16 @@
 import cn.huge.module.client.api.impl.UtilsClientImpl;
 import cn.huge.module.constant.BaseConsts;
 import cn.huge.module.ctuser.dao.mapper.CtUserMapper;
+import cn.huge.module.ctuser.domain.po.CtUnit;
 import cn.huge.module.ctuser.domain.po.CtUser;
 import cn.huge.module.cust.constant.UserBaseConsts;
+import cn.huge.module.cust.dto.CtUserDTO;
 import cn.huge.module.redis.constant.RedisKeyConsts;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
@@ -30,6 +33,7 @@
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @title: 客户用户表业务逻辑处理
@@ -52,6 +56,12 @@
 
     @Autowired
     private UtilsClientImpl utilsClient;
+
+    @Autowired
+    private CtUnitService ctUnitService;
+
+    @Autowired
+    private CtUseroleService ctUseroleService;
 
     /**
     * 更新对象
@@ -194,4 +204,70 @@
         }
     }
 
+    /**
+     * 重写根据id获取用户
+     * @param userId 登录用户编号
+     * @return Object
+     */
+    public CtUser getById(String userId) {
+        String loginUserId = "";
+        if (userId.indexOf(BaseConsts.AND) != -1){
+            String[] userIds = userId.split(BaseConsts.AND);
+            loginUserId = userIds[0];
+        }else {
+            loginUserId = userId;
+        }
+        return mapper.selectById(loginUserId);
+    }
+
+    /**
+     * 按条件分页查询
+     *
+     * @param page  分页对象
+     * @param terms 条件
+     * @return Page
+     */
+    public Page<CtUser> pageUserAndRole(PageRequest page, Map<String, Object> terms) {
+        long total = mapper.countQueryCtUser(terms);
+        List<CtUser> content = mapper.pageQueryCtUser(page, terms);
+        return new PageImpl<CtUser>(content, page, total);
+    }
+
+    /**
+     * 获取当前登录用户,获取用户所有信息(用户信息、角色等)
+     * @param userId 登录用户编号
+     * @return Object
+     */
+    public CtUserDTO clientGetUserAll(String userId) {
+        String loginUserId = "";
+        String loginRoleCode = "";
+        if (userId.indexOf(BaseConsts.AND) != -1){
+            String[] userIds = userId.split(BaseConsts.AND);
+            loginUserId = userIds[0];
+            loginRoleCode = userIds[1];
+        }else {
+            loginUserId = userId;
+        }
+        // 用户信息
+        CtUser ctUser = mapper.selectById(loginUserId);
+        if (ObjectUtils.isNotEmpty(ctUser)){
+            CtUnit ctUnit = ctUnitService.getById(ctUser.getUnitId());
+            CtUserDTO ctUserDTO = new CtUserDTO();
+            BeanUtils.copyProperties(ctUser, ctUserDTO);
+            if(ObjectUtils.isNotEmpty(ctUnit)){
+                ctUserDTO.setUnitType(ctUnit.getUnitType());
+            }
+            // 角色代码
+            if (StringUtils.isEmpty(loginRoleCode)) {
+                List<String>  roleCodeList = ctUseroleService.listRoleCode(loginUserId);
+                String userRole = roleCodeList.stream().map(String::valueOf).collect(Collectors.joining(","));
+                ctUserDTO.setRoleCodes(userRole);
+            }else {
+                ctUserDTO.setRoleCodes(loginRoleCode);
+            }
+            return ctUserDTO;
+        }else {
+            return null;
+        }
+    }
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java
index db88b89..cdc2a85 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java
@@ -147,4 +147,12 @@
         return ctUseroleList;
     }
 
+    /**
+     * 根据用户编号获取其角色代码
+     * @param userId 用户编号
+     * @return List<String>
+     */
+    public  List<String> listRoleCode(String userId){
+        return mapper.listRoleCode(userId);
+    }
 }
\ No newline at end of file
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/CustClient.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/CustClient.java
new file mode 100644
index 0000000..59e5c8c
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/CustClient.java
@@ -0,0 +1,34 @@
+package cn.huge.module.client.api;
+
+import cn.huge.base.common.bo.ReturnBO;
+import cn.huge.module.mediate.dto.WechatBindCaseDTO;
+import cn.huge.module.sync.domain.target.TargetCtUnit;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.List;
+
+/**
+ * @title: 客户用户中心微服务调用接口
+ * @description: 客户用户中心微服务调用接口
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2021-11-05 16:51:48
+ * @version: 1.0.0
+ */
+@FeignClient(name = "dyh-cust")
+public interface CustClient {
+
+    /**
+     *
+     * @url {ctx}/api/v1/ctUser/clientGetUser?userId=
+     * @param targetCtUnitList 登录用户编号
+     * @return ReturnBO
+     */
+    @GetMapping("/api/web/ctUnit/saveCtUnitList")
+    ReturnBO saveCtUnitList(@RequestBody List<TargetCtUnit> targetCtUnitList);
+
+}
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java
new file mode 100644
index 0000000..a96db5d
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java
@@ -0,0 +1,68 @@
+package cn.huge.module.client.api.impl;
+
+import cn.huge.base.common.bo.ReturnBO;
+import cn.huge.base.common.constant.ReturnConsts;
+import cn.huge.base.common.dto.SelectTermDTO;
+import cn.huge.base.common.exception.ClientException;
+import cn.huge.base.common.exception.ServiceException;
+import cn.huge.module.client.api.CustClient;
+import cn.huge.module.cust.dto.CtUserDTO;
+import cn.huge.module.cust.dto.PaUserDTO;
+import cn.huge.module.mediate.dto.WechatBindCaseDTO;
+import cn.huge.module.sync.domain.target.TargetCtUnit;
+import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+
+/**
+ * @title: 客户用户中心微服务调用接口实现
+ * @description: 客户用户中心微服务调用接口实现
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2021-11-05 16:51:48
+ * @version: 1.0.0
+ */
+@Slf4j
+@Component
+public class CustClientImpl {
+
+    private CustClient custClient;
+
+    @Autowired
+    public CustClientImpl(CustClient custClient) {
+        this.custClient = custClient;
+    }
+
+    /**
+     * ObjectMapper工具类
+     */
+    private ObjectMapper objectMapper = new ObjectMapper();
+
+    /**
+     * 内部用户-获取登录用户
+     * @param userId 用户编号
+     * @return CtUserDTO
+     */
+    public CtUserDTO clientGetUser(List<TargetCtUnit> targetCtUnitList){
+        try{
+            ReturnBO returnBo = custClient.saveCtUnitList(targetCtUnitList);
+            if (ReturnConsts.OK == returnBo.getCode()){
+                CtUserDTO loginUser = objectMapper.convertValue(returnBo.getData(), CtUserDTO.class);
+                return loginUser;
+            }else{
+                log.error("Client外服务接口[CustClientImpl.clientGetUser]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
+                throw new ClientException("CustClientImpl.clientGetUser", returnBo.getMsg());
+            }
+        }catch (Exception e){
+            log.error("service方法[CustClientImpl.clientGetUser]调用异常:"+e, e);
+            throw new ServiceException("CustClientImpl.clientGetUser", e);
+        }
+    }
+}
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/constant/SysConsts.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/constant/SysConsts.java
new file mode 100644
index 0000000..496c593
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/constant/SysConsts.java
@@ -0,0 +1,35 @@
+package cn.huge.module.client.constant;
+
+/**
+ * @title: 配置微服务相关常量类
+ * @description: 存放配置微服务相关常量
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2021-11-05 16:51:48
+ * @version: 1.0.0
+ */
+public class SysConsts {
+
+}
+/**
+ * -------------------_ooOoo_-------------------
+ * ------------------o8888888o------------------
+ * ------------------88" . "88------------------
+ * ------------------(| -_- |)------------------
+ * ------------------O\  =  /O------------------
+ * ---------------____/`---'\____---------------
+ * -------------.'  \\|     |//  `.-------------
+ * ------------/  \\|||  :  |||//  \------------
+ * -----------/  _||||| -:- |||||-  \-----------
+ * -----------|   | \\\  -  /// |   |-----------
+ * -----------| \_|  ''\---/''  |   |-----------
+ * -----------\  .-\__  `-`  ___/-. /-----------
+ * ---------___`. .'  /--.--\  `. . __----------
+ * ------."" '<  `.___\_<|>_/___.'  >'"".-------
+ * -----| | :  `- \`.;`\ _ /`;.`/ - ` : | |-----
+ * -----\  \ `-.   \_ __\ /__ _/   .-` /  /-----
+ * ======`-.____`-.___\_____/___.-`____.-'======
+ * -------------------`=---='
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ * ---------佛祖保佑---hugeinfo---永无BUG----------
+ */
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/utils/SysUtils.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/utils/SysUtils.java
new file mode 100644
index 0000000..f9fb4c5
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/client/utils/SysUtils.java
@@ -0,0 +1,35 @@
+package cn.huge.module.client.utils;
+
+/**
+ * @title: 配置微服务相关工具类
+ * @description: 存放配置微服务相关工具方法
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2021-11-05 16:51:48
+ * @version: 1.0.0
+ */
+public class SysUtils {
+
+}
+/**
+ * -------------------_ooOoo_-------------------
+ * ------------------o8888888o------------------
+ * ------------------88" . "88------------------
+ * ------------------(| -_- |)------------------
+ * ------------------O\  =  /O------------------
+ * ---------------____/`---'\____---------------
+ * -------------.'  \\|     |//  `.-------------
+ * ------------/  \\|||  :  |||//  \------------
+ * -----------/  _||||| -:- |||||-  \-----------
+ * -----------|   | \\\  -  /// |   |-----------
+ * -----------| \_|  ''\---/''  |   |-----------
+ * -----------\  .-\__  `-`  ___/-. /-----------
+ * ---------___`. .'  /--.--\  `. . __----------
+ * ------."" '<  `.___\_<|>_/___.'  >'"".-------
+ * -----| | :  `- \`.;`\ _ /`;.`/ - ` : | |-----
+ * -----\  \ `-.   \_ __\ /__ _/   .-` /  /-----
+ * ======`-.____`-.___\_____/___.-`____.-'======
+ * -------------------`=---='
+ * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ * ---------佛祖保佑---hugeinfo---永无BUG----------
+ */
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/controller/SyncController.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/controller/SyncController.java
new file mode 100644
index 0000000..703c58b
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/controller/SyncController.java
@@ -0,0 +1,50 @@
+package cn.huge.module.sync.controller;
+
+import cn.huge.base.common.utils.ReturnFailUtils;
+import cn.huge.base.common.utils.ReturnSucUtils;
+import cn.huge.module.sync.service.SyncService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * @title: 客户组织信息表接口api
+ * @description: 客户组织信息表接口api
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2024-08-17 15:30:57
+ * @version: 1.0.0
+ */
+@Slf4j
+@RestController
+@RequestMapping("/api/sync")
+public class SyncController {
+
+    @Autowired(required = false)
+    private HttpServletRequest request;
+
+    private final SyncService syncService;
+
+    public SyncController(SyncService syncService) {
+        this.syncService = syncService;
+    }
+
+    /**
+     * 数据迁移通用接口
+     * @url {ctx}/api/web/ctUnit/universalSync
+     * @return Object
+     */
+    @GetMapping("/universalSync")
+    public Object universalSync() {
+        try {
+            syncService.syncData();
+            return ReturnSucUtils.getRepInfo( "处理成功", null);
+        } catch (Exception e) {
+            return ReturnFailUtils.getRepInfo();
+        }
+    }
+
+
+}
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/SyncMapper.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/SyncMapper.java
new file mode 100644
index 0000000..7505dbe
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/SyncMapper.java
@@ -0,0 +1,40 @@
+package cn.huge.module.sync.dao.mapper;
+
+import cn.huge.module.sync.domain.source.SourceCtUnit;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @title: 客户用户账号表持久层业务处理
+ * @Description 此处仅涉及复杂SQL操作,务必不要在此再次写单表的CRUD操作,因为mybatisPlus已经实现。
+ * @company: hugeinfo
+ * @author: liyj
+ * @time: 2024-08-17 15:30:56
+ * @version 1.0.0
+ */
+@Repository
+public interface SyncMapper{
+
+    /**
+     * 按条件查询结果集
+     * @param mysqlTableName 表名
+     * @param page 分页对象
+     * @return List<CtAccount>
+     */
+    List<SourceCtUnit> pageInfo(@Param("mysqlTableName") String mysqlTableName, @Param("page") PageRequest page);
+
+    /**
+     * 按条件查询结果集
+     * @param mysqlTableName 表名
+     * @return List<CtAccount>
+     */
+    int countData(@Param("mysqlTableName") String mysqlTableName);
+
+
+}
+
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/xml/SyncMapper.xml b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/xml/SyncMapper.xml
new file mode 100644
index 0000000..99961b1
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/dao/mapper/xml/SyncMapper.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<!--
+ * @title: 客户用户账号表
+ * @description: 自定义sql,请自行实现业务逻辑
+ * @company: hugeinfo
+ * @author: liyj
+ * @time:2024-08-17 15:30:56
+ * @version 1.0.0
+-->
+<mapper namespace="cn.huge.module.sync.dao.mapper.SyncMapper">
+
+    <resultMap id="dataResult" type="cn.huge.module.sync.domain.source.SourceCtUnit">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="unitType" column="unit_type"/>
+        <result property="courtStatus" column="court_status"/>
+        <result property="unitCode" column="unit_code"/>
+        <result property="des" column="des"/>
+        <result property="dutyName" column="duty_name"/>
+        <result property="dutyMobile" column="duty_mobile"/>
+        <result property="dutyIdcard" column="duty_idcard"/>
+        <result property="joinWay" column="join_way"/>
+        <result property="prov" column="prov"/>
+        <result property="provName" column="prov_name"/>
+        <result property="city" column="city"/>
+        <result property="cityName" column="city_name"/>
+        <result property="area" column="area"/>
+        <result property="areaName" column="area_name"/>
+        <result property="road" column="road"/>
+        <result property="roadName" column="road_name"/>
+        <result property="village" column="village"/>
+        <result property="villageName" column="village_name"/>
+        <result property="addr" column="addr"/>
+        <result property="lng" column="lng"/>
+        <result property="lat" column="lat"/>
+        <result property="goodField" column="good_field"/>
+        <result property="goodFieldName" column="good_field_name"/>
+        <result property="canField" column="can_field"/>
+        <result property="canFieldName" column="can_field_name"/>
+        <result property="findStatus" column="find_status"/>
+        <result property="dispStatus" column="disp_status"/>
+        <result property="countCase" column="count_case"/>
+        <result property="level" column="level"/>
+        <result property="parentId" column="parent_id"/>
+        <result property="deleteStatus" column="delete_status"/>
+        <result property="custId" column="cust_id"/>
+        <result property="custProv" column="cust_prov"/>
+        <result property="custCity" column="cust_city"/>
+        <result property="custArea" column="cust_area"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+    </resultMap>
+
+    <!--  根据条件分页查询  -->
+    <select id="pageInfo" resultMap = "dataResult">
+        SELECT
+        *
+        FROM
+        ${mysqlTableName}
+        <if test="page.sort != null">
+            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
+                ${s.property} ${s.direction}
+            </foreach>
+        </if>
+        <if test="page.sort == null">
+            order by create_time asc
+        </if>
+        limit #{page.offset}, #{page.size}
+    </select>
+
+    <!--  根据条件分页查询  -->
+    <select id="countData" resultType="int">
+        SELECT
+        count(1)
+        FROM
+        ${mysqlTableName}
+    </select>
+</mapper>
\ No newline at end of file
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/source/SourceCtUnit.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/source/SourceCtUnit.java
new file mode 100644
index 0000000..de02f1c
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/source/SourceCtUnit.java
@@ -0,0 +1,257 @@
+package cn.huge.module.sync.domain.source;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @title: 客户组织表
+ * @description: PO中的属性与数据表是一一对应关系,如需根据业务处理不同,请使用BO对象。
+ * @company:hugeinfo
+ * @author: chenx
+ * @time: 2022-02-22 14:19:41
+ * @version 1.0.0
+ */
+@TableName(value = "dyh_ct_unit")
+@Data
+public class SourceCtUnit {
+
+    /**
+    * 组织编号
+    */
+    @TableId(value = "id")
+    private String id;
+
+    /**
+    * 组织名称
+    */
+    @TableField(value = "name")
+    private String name;
+
+    /**
+    * 组织类型,1:指挥中心,2:职能部门,3:镇街,:4:村居社区,5:行、专业,6:企、事业,7:演示测试,9:其他
+    */
+    @TableField(value = "unit_type")
+    private String unitType;
+
+    /**
+     * 是否归类为法院,1:否,2:是
+     */
+    @TableField(value = "court_status")
+    private String courtStatus;
+
+    /**
+    * 组织机构代码
+    */
+    @TableField(value = "unit_code")
+    private String unitCode;
+
+    /**
+    * 描述
+    */
+    @TableField(value = "des")
+    private String des;
+
+    /**
+    * 单位负责人姓名
+    */
+    @TableField(value = "duty_name")
+    private String dutyName;
+
+    /**
+    * 单位负责人手机号码
+    */
+    @TableField(value = "duty_mobile")
+    private String dutyMobile;
+
+    /**
+    * 单位负责人身份证
+    */
+    @TableField(value = "duty_idcard")
+    private String dutyIdcard;
+
+    /**
+    * 加入方式,1:系统创建(默认),1:自主申请
+    */
+    @TableField(value = "join_way")
+    private String joinWay;
+
+    /**
+    * 组织地址省
+    */
+    @TableField(value = "prov")
+    private String prov;
+
+    /**
+    * 组织地址省名称
+    */
+    @TableField(value = "prov_name")
+    private String provName;
+
+    /**
+    * 组织地址市
+    */
+    @TableField(value = "city")
+    private String city;
+
+    /**
+    * 组织地址市名称
+    */
+    @TableField(value = "city_name")
+    private String cityName;
+
+    /**
+    * 组织地址区
+    */
+    @TableField(value = "area")
+    private String area;
+
+    /**
+    * 组织地址区名称
+    */
+    @TableField(value = "area_name")
+    private String areaName;
+
+    /**
+    * 组织地址街道
+    */
+    @TableField(value = "road")
+    private String road;
+
+    /**
+    * 组织地址街道名称
+    */
+    @TableField(value = "road_name")
+    private String roadName;
+
+    /**
+    * 组织地址社区
+    */
+    @TableField(value = "village")
+    private String village;
+
+    /**
+    * 组织地址社区名称
+    */
+    @TableField(value = "village_name")
+    private String villageName;
+
+    /**
+    * 组织详细地址
+    */
+    @TableField(value = "addr")
+    private String addr;
+
+    /**
+    * 组织经度
+    */
+    @TableField(value = "lng")
+    private String lng;
+
+    /**
+    * 组织纬度
+    */
+    @TableField(value = "lat")
+    private String lat;
+
+    /**
+    * 父级组织,根级默认root
+    */
+    @TableField(value = "parent_id")
+    private String parentId;
+
+    /**
+     * 调解专长,多个用,隔开
+     */
+    @TableField(value = "good_field")
+    private String goodField;
+
+    /**
+     * 调解专长名称,多个用,隔开
+     */
+    @TableField(value = "good_field_name")
+    private String goodFieldName;
+
+    /**
+     * 调解范围,多个用,隔开
+     */
+    @TableField(value = "can_field")
+    private String canField;
+
+    /**
+     * 调解范围名称,多个用,隔开
+     */
+    @TableField(value = "can_field_name")
+    private String canFieldName;
+
+    /**
+     * 是否可以找他调(小程序),1:否,2:是
+     */
+    @TableField(value = "find_status")
+    private String findStatus;
+
+    /**
+     * 是否参与自动调度,1:否,2:是
+     */
+    @TableField(value = "disp_status")
+    private String dispStatus;
+
+    /**
+     * 累计调解数量
+     */
+    @TableField(value = "count_case")
+    private String countCase;
+
+    /**
+     * 级别
+     */
+    @TableField(value = "level")
+    private Integer level;
+
+    /**
+    * 删除状态,1:未删除(默认),99:已删除
+    */
+    @TableLogic
+    @TableField(value = "delete_status")
+    private String deleteStatus;
+
+    /**
+    * 顾客编号
+    */
+    @TableField(value = "cust_id")
+    private String custId;
+
+    /**
+    * 所属客户省
+    */
+    @TableField(value = "cust_prov")
+    private String custProv;
+
+    /**
+    * 所属客户市
+    */
+    @TableField(value = "cust_city")
+    private String custCity;
+
+    /**
+    * 所属客户区
+    */
+    @TableField(value = "cust_area")
+    private String custArea;
+
+    /**
+    * 创建时间
+    */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+    * 更新时间
+    */
+    @TableField(value = "update_time")
+    private Date updateTime;
+}
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/target/TargetCtUnit.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/target/TargetCtUnit.java
new file mode 100644
index 0000000..b1c87af
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/domain/target/TargetCtUnit.java
@@ -0,0 +1,232 @@
+package cn.huge.module.sync.domain.target;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @title: 客户组织信息表数据库对应关系类
+ * @description: PO中的属性与数据表是一一对应关系,如需根据业务处理不同,请使用BO对象。
+ * @company:hugeinfo
+ * @author: liyj
+ * @time: 2024-08-19 20:04:19
+ * @version 1.0.0
+ */
+@Data
+public class TargetCtUnit {
+
+    /**
+    * 组织编号
+    */
+    @TableId(value = "id")
+    private String id;
+
+    /**
+    * 层级
+    */
+    @TableField(value = "level")
+    private Integer level;
+
+    /**
+    * 父级组织,根级为root
+    */
+    @TableField(value = "parent_id")
+    private String parentId;
+
+    /**
+    * 组织级别,1:市级,2:区级,3:镇街级,4:村居级
+    */
+    @TableField(value = "unit_grade")
+    private Integer unitGrade;
+
+    /**
+    * 组织名称
+    */
+    @TableField(value = "unit_name")
+    private String unitName;
+
+    /**
+    * 组织类型,0:政法委,1:综治中心,2:直属部门,3:法院,4:行专业调委会,5:企事业调委会,6:演示测试,9:其他
+    */
+    @TableField(value = "unit_type")
+    private Integer unitType;
+
+    /**
+    * 组织机构代码
+    */
+    @TableField(value = "unit_code")
+    private String unitCode;
+
+    /**
+    * 描述
+    */
+    @TableField(value = "unit_des")
+    private String unitDes;
+
+    /**
+    * 单位负责人姓名
+    */
+    @TableField(value = "duty_name")
+    private String dutyName;
+
+    /**
+    * 单位负责人手机号码
+    */
+    @TableField(value = "duty_mobile")
+    private String dutyMobile;
+
+    /**
+    * 单位负责人身份证
+    */
+    @TableField(value = "duty_idcard")
+    private String dutyIdcard;
+
+    /**
+    * 加入方式,1:系统创建,2:自主申请
+    */
+    @TableField(value = "join_way")
+    private Integer joinWay;
+
+    /**
+    * 组织地址省
+    */
+    @TableField(value = "prov")
+    private String prov;
+
+    /**
+    * 组织地址省名称
+    */
+    @TableField(value = "prov_name")
+    private String provName;
+
+    /**
+    * 组织地址市
+    */
+    @TableField(value = "city")
+    private String city;
+
+    /**
+    * 组织地址市名称
+    */
+    @TableField(value = "city_name")
+    private String cityName;
+
+    /**
+    * 组织地址区
+    */
+    @TableField(value = "area")
+    private String area;
+
+    /**
+    * 组织地址区名称
+    */
+    @TableField(value = "area_name")
+    private String areaName;
+
+    /**
+    * 组织地址街道
+    */
+    @TableField(value = "road")
+    private String road;
+
+    /**
+    * 组织地址街道名称
+    */
+    @TableField(value = "road_name")
+    private String roadName;
+
+    /**
+    * 组织地址社区
+    */
+    @TableField(value = "village")
+    private String village;
+
+    /**
+    * 组织地址社区名称
+    */
+    @TableField(value = "village_name")
+    private String villageName;
+
+    /**
+    * 组织详细地址
+    */
+    @TableField(value = "addr")
+    private String addr;
+
+    /**
+    * 组织经度
+    */
+    @TableField(value = "lng")
+    private String lng;
+
+    /**
+    * 组织纬度
+    */
+    @TableField(value = "lat")
+    private String lat;
+
+    /**
+    * 调解专长,多个用,隔开
+    */
+    @TableField(value = "good_field")
+    private String goodField;
+
+    /**
+    * 调解专长名称,多个用,隔开
+    */
+    @TableField(value = "good_field_name")
+    private String goodFieldName;
+
+    /**
+    * 调解范围,多个用,隔开
+    */
+    @TableField(value = "can_field")
+    private String canField;
+
+    /**
+    * 调解范围名称,多个用,隔开
+    */
+    @TableField(value = "can_field_name")
+    private String canFieldName;
+
+    /**
+    * 是否可以找他调(小程序),0:否,1:是
+    */
+    @TableField(value = "find_status")
+    private Integer findStatus;
+
+    /**
+    * 是否参与自动调度,0:否,1:是
+    */
+    @TableField(value = "disp_status")
+    private Integer dispStatus;
+
+    /**
+    * 删除状态,0:已删除,1:未删除
+    */
+    @TableLogic
+    @TableField(value = "delete_status")
+    private Integer deleteStatus;
+
+    /**
+    * 所属客户编号
+    */
+    @TableField(value = "cust_id")
+    private String custId;
+
+    /**
+    * 创建时间
+    */
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    /**
+    * 更新时间
+    */
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+}
diff --git a/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/service/SyncService.java b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/service/SyncService.java
new file mode 100644
index 0000000..a8449ee
--- /dev/null
+++ b/dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/service/SyncService.java
@@ -0,0 +1,105 @@
+package cn.huge.module.sync.service;
+
+import cn.huge.module.client.api.impl.CustClientImpl;
+import cn.huge.module.sync.dao.mapper.SyncMapper;
+import cn.huge.module.sync.domain.source.SourceCtUnit;
+import cn.huge.module.sync.domain.target.TargetCtUnit;
+import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.beanutils.ConvertUtils;
+import org.apache.commons.beanutils.converters.DateConverter;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.stereotype.Service;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+
+/**
+ * @author liyj
+ * @version 1.0.0
+ * @title: 客户用户账号表业务逻辑处理
+ * @Description 客户用户账号表业务逻辑处理
+ * @company hugeinfo
+ * @Time 2024-08-17 15:30:56
+ */
+@Slf4j
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class SyncService {
+    @Autowired
+    private SyncMapper syncMapper;
+    @Autowired
+    private CustClientImpl custClient;
+
+    private static final String MYSQL_TABLE = "dyh_ct_unit";
+
+    public void syncData() {
+        try {
+            List<SourceCtUnit> sourceCtUnitList = new ArrayList<>();
+            List<TargetCtUnit> targetCtUnitList = new ArrayList<>();
+
+            // 查询MySQL表结构
+            Sort sort = Sort.by(Sort.Direction.ASC, "create_time");
+            int page = 1;
+            int size = 1000;
+            PageRequest pageRequest = PageRequest.of(page-1, size, sort);
+            sourceCtUnitList = syncMapper.pageInfo(MYSQL_TABLE, pageRequest);
+
+            //查询mysql总量
+            int total = syncMapper.countData(MYSQL_TABLE);
+
+            //查出最大页数
+            int maxPage = 1;
+            maxPage = (total / size);
+            if (0 != total % size) {
+                maxPage += 1;
+            }
+
+            for (int i = 1; i >= maxPage; i++) {
+                for(SourceCtUnit sourceCtUnit: sourceCtUnitList){
+                    TargetCtUnit targetCtUnit = new TargetCtUnit();
+                    ConvertUtils.register(new DateConverter(null), java.util.Date.class);
+                    BeanUtils.copyProperties(targetCtUnit, sourceCtUnit);
+//                    for(Field field: sourceCtUnit.getClass().getDeclaredFields()){
+//                        convertType(field.get(sourceCtUnit), field.getName(), targetCtUnit);
+//                    }
+                    targetCtUnitList.add(targetCtUnit);
+                }
+                if(CollectionUtils.isNotEmpty(targetCtUnitList)){
+                    custClient.clientGetUser(targetCtUnitList);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 时间转换的时候,调用初始化,时间类型转换
+     * 		使用:直接在实体中加上一个注解形式。
+     */
+    public static void initDate(){
+//        时间注册
+        DateConverter converter = new DateConverter(null);
+        converter.setPattern(new String("yyyy-MM-dd HH:mm:ss"));
+        ConvertUtils.register(converter, Date.class);
+    }
+
+
+    public void convertType(Object value, String columnName, TargetCtUnit targetCtUnit) {
+        if (value == null) {
+            targetCtUnit.setUnitType(Integer.valueOf("NULL"));
+        }else if("unitType".equals(columnName) || "joinWay".equals(columnName) || "findStatus".equals(columnName)
+                || "dispStatus".equals(columnName)|| "deleteStatus".equals(columnName)){
+            targetCtUnit.setUnitType(Integer.parseInt((String) value));
+        }
+
+    }
+}
\ No newline at end of file

--
Gitblit v1.8.0