forked from gzzfw/backEnd/gz-dyh

1、优化代码生成器
2、优化用户中心
3、新增client微服务调用controller
3 files added
34 files modified
1203 ■■■■■ changed files
dyh-service/dyh-base/src/main/java/cn/huge/module/constant/BaseConsts.java 8 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/constant/UserBaseConsts.java 104 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtDeptDTO.java 32 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtRoleDTO.java 14 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUnitDTO.java 79 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java 86 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/PaUserDTO.java 39 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/resources/template/webController.ftl 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/resources/template/wechatController.ftl 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoledataWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRolefunWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java 14 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java 59 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUserClientController.java 81 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java 20 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUsepostWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUserWebController.java 145 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUseroleWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java 12 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUserSaveDTO.java 55 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java 18 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUsepostService.java 17 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java 314 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java 16 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/controller/web/PaAccountWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/controller/web/PaUserWebController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/CustClient.java 8 ●●●● patch | view | raw | blame | history
dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java 16 ●●●● patch | view | raw | blame | history
dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/controller/SyncController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/service/SyncService.java 2 ●●● patch | view | raw | blame | history
dyh-service/dyh-utils/src/main/java/cn/huge/module/cases/controller/CaseNoUtilsController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-utils/src/main/java/cn/huge/module/common/controller/IdUtilsController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-utils/src/main/java/cn/huge/module/judic/controller/JudicNoUtilsController.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/module/constant/BaseConsts.java
@@ -14,14 +14,14 @@
     * 根节点标志
     */
    public static final String ROOT = "root";
    public static final int LEVEL_ROOT = 1;
    public static final int LEVEL_1 = 1;
    public static final int LEVEL_2 = 2;
    /**
     * 状态,1:未删除(默认值),99:已删除
     * 状态,0:已删除,1:未删除
     */
    public static final String DELETE_STATUS_1 = "1";
    public static final String DELETE_STATUS_99 = "99";
    public static final int DELETE_STATUS_0 = 0;
    public static final int DELETE_STATUS_1 = 1;
    /**
     * 公用符合
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/constant/UserBaseConsts.java
@@ -9,85 +9,83 @@
 * @version: 1.0.0
 */
public class UserBaseConsts {
    /**
     * 授权凭证明文
     */
    public static final String MR_CIPHER = "byzfw2023!";
    /**
     * 用户状态,1:在职/有效(默认),2:停用,3:离职
     * 用户状态,1:有效(默认),2:停用,3:离职
     */
    public static final String USER_STATUS_1 = "1";
    public static final String USER_STATUS_2 = "2";
    public static final String USER_STATUS_3 = "3";
    public static final int USER_STATUS_1 = 1;
    public static final int USER_STATUS_2 = 2;
    public static final int USER_STATUS_3 = 3;
    /**
     * 部门类型,1:正常部门,2:特殊部门(调委会等)
     * 帐号类型,1:平台web端,2:平台小程序
     */
    public static final String DEPT_TYPE_1 = "1";
    public static final String DEPT_TYPE_2 = "2";
    /**
     * 角色类型,1:自定义角色(默认),2:基础角色,3:平台管理角色
     */
    public static final String ROLE_TYPE_1 = "1";
    public static final String ROLE_TYPE_2 = "2";
    public static final String ROLE_TYPE_3 = "3";
    /**
     * 是否基础角色,基础角色无法自己删除,1:否(默认),2:是
     */
    public static final String IS_ROLE_1 = "1";
    public static final String NO_ROLE_2 = "2";
    /**
     * 帐号类型,22_00027-1:pc帐号(默认),22_00027-2:微信小程序,22_00027-3:政数局统一平台
     */
    public static final String ACC_TYPE_1 = "22_00027-1";
    public static final String ACC_TYPE_2 = "22_00027-2";
    public static final String ACC_TYPE_3 = "22_00027-3";
    /**
     * 人脸认证状态,1:已认证,99:未认证(默认)
     */
    public static final String FACE_STATUS_1 = "1";
    public static final String FACE_STATUS_99 = "99";
    public static final int ACC_TYPE_1 = 1;
    public static final int ACC_TYPE_2 = 2;
    /**
     * 加入方式,1:系统创建(默认),2:自主申请
     */
    public static final String JOIN_WAY_1 = "1";
    public static final String JOIN_WAY_2 = "2";
    public static final int JOIN_WAY_1 = 1;
    public static final int JOIN_WAY_2 = 2;
    /**
     * 实名认证状态,1:通过,99:未通过(默认)
     * 实名认证状态,0:未认证, 1:已认证
     */
    public static final String REAL_STATUS_1 = "1";
    public static final String REAL_STATUS_99 = "99";
    public static final int REAL_STATUS_0 = 0;
    public static final int REAL_STATUS_1 = 1;
    /**
     * 配岗类型,1:主岗(默认),2:兼岗
     * 角色类型,1:自定义角色,2:基础角色
     */
    public static final String MATCH_TYPE_1 = "1";
    public static final String MATCH_TYPE_2 = "2";
    public static final int ROLE_TYPE_1 = 1;
    public static final int ROLE_TYPE_2 = 2;
    /**
     * 是否归类为法院,1:否,2:是
     * 配岗类型,1:主岗,2:兼岗
     */
    public static final String COURT_STATUS_1 = "1";
    public static final String COURT_STATUS_2 = "2";
    public static final int MATCH_TYPE_1 = 1;
    public static final int MATCH_TYPE_2 = 2;
    /**
     * 组织类型,1:指挥中心,2:职能部门,3:镇街,:4:村居社区,5:行、专业,6:企、事业,9:其他
     * 是否可以找他调(小程序),0:否,1:是
     */
    public static final String UNIT_TYPE_1 = "1";
    public static final String UNIT_TYPE_2 = "2";
    public static final String UNIT_TYPE_3 = "3";
    public static final String UNIT_TYPE_4 = "4";
    public static final String UNIT_TYPE_5 = "5";
    public static final String UNIT_TYPE_6 = "6";
    public static final String UNIT_TYPE_9 = "9";
    public static final int FIND_STATUS_0 = 0;
    public static final int FIND_STATUS_1 = 1;
    /**
     * 是否参与自动调度,0:否,1:是
     */
    public static final int DISP_STATUS_0 = 0;
    public static final int DISP_STATUS_2 = 1;
    /**
     * ========================================== 单位部门 ==========================================
     */
    /**
     * 组织级别,1:市级,2:区级,3:镇街级,4:村居级
     */
    public static final int UNIT_GRADE_1 = 1;
    public static final int UNIT_GRADE_2 = 2;
    public static final int UNIT_GRADE_3 = 3;
    public static final int UNIT_GRADE_4 = 4;
    /**
     * 组织类型,0:政法委,1:综治中心,2:直属部门,3:法院,4:行专业调委会,5:企事业调委会,6:演示测试,9:其他
     */
    public static final int UNIT_TYPE_0 = 0;
    public static final int UNIT_TYPE_1 = 1;
    public static final int UNIT_TYPE_2 = 2;
    public static final int UNIT_TYPE_3 = 3;
    public static final int UNIT_TYPE_4 = 4;
    public static final int UNIT_TYPE_5 = 5;
    public static final int UNIT_TYPE_6 = 6;
    public static final int UNIT_TYPE_9 = 9;
}
/**
 * -------------------_ooOoo_-------------------
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtDeptDTO.java
@@ -26,6 +26,16 @@
    private String id;
    /**
     * 层级
     */
    private Integer level;
    /**
     * 父级部门,根级默认root
     */
    private String parentId;
    /**
    * 部门名称
    */
    private String name;
@@ -34,11 +44,6 @@
    * 描述
    */
    private String des;
    /**
    * 父级部门,根级默认root
    */
    private String parentId;
    /**
    * 组织编号
@@ -66,12 +71,23 @@
    private String canFieldName;
    /**
     * 级别
     * 删除状态,0:已删除,1:未删除
     */
    private String level;
    @TableLogic
    private Integer deleteStatus;
    /**
    * 顾客编号
     * 所属客户编号
    */
    private String custId;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
}
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtRoleDTO.java
@@ -26,6 +26,11 @@
    private String id;
    /**
     * 角色代码
     */
    private String roleCode;
    /**
    * 角色名称
    */
    private String name;
@@ -36,14 +41,15 @@
    private String unitId;
    /**
    * 是否基础角色,基础角色无法自己删除,1:是,2:否(默认)
     * 角色类型,1:自定义角色,2:基础角色
    */
    private String baseRole;
    private Integer roleType;
    /**
    * 删除状态,1:未删除(默认),99:已删除
     * 删除状态,0:已删除,1:未删除
    */
    private String deleteStatus;
    @TableLogic
    private Integer deleteStatus;
    /**
    * 顾客编号
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUnitDTO.java
@@ -1,5 +1,7 @@
package cn.huge.module.cust.dto;
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;
@@ -23,19 +25,29 @@
    private String id;
    /**
     * 层级
     */
    private Integer level;
    /**
     * 父级组织,根级为root
     */
    private String parentId;
    /**
     * 组织级别,1:市级,2:区级,3:镇街级,4:村居级
     */
    private Integer unitGrade;
    /**
    * 组织名称
    */
    private String name;
    private String unitName;
    /**
    * 组织类型,1:指挥中心,2:职能部门,3:镇街,:4:村居社区,5:行、专业,6:企、事业,7:演示测试,9:其他
     * 组织类型,0:政法委,1:综治中心,2:直属部门,3:法院,4:行专业调委会,5:企事业调委会,6:演示测试,9:其他
    */
    private String unitType;
    /**
     * 是否归类为法院,1:否,2:是
     */
    private String courtStatus;
    private Integer unitType;
    /**
    * 组织机构代码
@@ -45,7 +57,7 @@
    /**
    * 描述
    */
    private String des;
    private String unitDes;
    /**
    * 单位负责人姓名
@@ -63,9 +75,9 @@
    private String dutyIdcard;
    /**
    * 加入方式,1:系统创建(默认),1:自主申请
     * 加入方式,1:系统创建,2:自主申请
    */
    private String joinWay;
    private Integer joinWay;
    /**
    * 组织地址省
@@ -133,11 +145,6 @@
    private String lat;
    /**
    * 父级组织,根级默认root
    */
    private String parentId;
    /**
     * 调解专长,多个用,隔开
     */
    private String goodField;
@@ -158,49 +165,25 @@
    private String canFieldName;
    /**
     * 是否可以找他调(小程序),1:否,2:是
     * 是否可以找他调(小程序),0:否,1:是
     */
    private String findStatus;
    private Integer findStatus;
    /**
     * 是否参与自动调度,1:否,2:是
     * 是否参与自动调度,0:否,1:是
     */
    private String dispStatus;
    private Integer dispStatus;
    /**
     * 累计调解数量
     * 删除状态,0:已删除,1:未删除
     */
    private String countCase;
    @TableLogic
    private Integer deleteStatus;
    /**
     * 级别
     */
    private String level;
    /**
    * 删除状态,1:未删除(默认),99:已删除
    */
    private String deleteStatus;
    /**
    * 顾客编号
     * 所属客户编号
    */
    private String custId;
    /**
    * 所属客户省
    */
    private String custProv;
    /**
    * 所属客户市
    */
    private String custCity;
    /**
    * 所属客户区
    */
    private String custArea;
    /**
    * 创建时间
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/CtUserDTO.java
@@ -31,6 +31,11 @@
    private String trueName;
    /**
     * 平台账号
     */
    private String acc;
    /**
     * 性别
     */
    private String sex;
@@ -126,11 +131,6 @@
    private String avatar;
    /**
     * 平台账号
     */
    private String acc;
    /**
     * 组织编号
     */
    private String unitId;
@@ -139,11 +139,6 @@
     * 组织名称
     */
    private String unitName;
    /**
     * 组织类型,1:指挥中心,2:职能部门,3:镇街,:4:村居社区,5:行、专业,6:企、事业,7:演示测试,9:其他
     */
    private Integer unitType;
    /**
     * 部门编号
@@ -156,49 +151,19 @@
    private String deptName;
    /**
     * 部门类型,1:正常部门,2:特殊部门(调委会等)
     */
    private String deptType;
    /**
     * 加入方式,1:系统创建(默认),2:自主申请
     */
    private String joinWay;
    private Integer joinWay;
    /**
     * 实名认证状态,1:通过,99:未通过(默认)
     * 实名认证状态,0:未认证,1:已认证
     */
    private String realStatus;
    private Integer realStatus;
    /**
     * 人脸认证状态,1:已认证,99:未认证(默认)
     * 用户状态,1:有效(默认),2:停用,3:离职
     */
    private String faceStatus;
    /**
     * 用户状态,1:在职(默认),2:停用,99:离职
     */
    private String status;
    /**
     * 删除状态,1:未删除(默认),99:已删除
     */
    private String deleteStatus;
    /**
     * 所属客户编号
     */
    private String custId;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
    private Integer status;
    /**
     * 调解专长,多个用,隔开
@@ -221,6 +186,37 @@
    private String canFieldName;
    /**
     * 是否可以找他调(小程序),0:否,1:是
     */
    private Integer findStatus;
    /**
     * 是否参与自动调度,0:否,1:是
     */
    private Integer dispStatus;
    /**
     * 删除状态,0:已删除(默认),1:未删除
     */
    @TableLogic
    private Integer deleteStatus;
    /**
     * 所属客户编号
     */
    private String custId;
    /**
     * 创建时间
     */
    private Date createTime;
    /**
     * 更新时间
     */
    private Date updateTime;
    /**
     * 用户角色代码编号
     */
    private String roleCodes;
dyh-service/dyh-base/src/main/java/cn/huge/module/cust/dto/PaUserDTO.java
@@ -45,17 +45,7 @@
    private String mobile;
    /**
    * 证件类型
    */
    private String idcardType;
    /**
    * 证件类型名称
    */
    private String idcardTypeName;
    /**
    * 证件号码
     * 身份证号码
    */
    private String idcard;
@@ -135,29 +125,14 @@
    private String avatar;
    /**
     * 组织编号
     * 实名认证状态,0:未认证,1:已认证
     */
    private String unitId;
    private Integer realStatus;
    /**
     * 组织名称
     * 用户状态,0:停用,1:启用
     */
    private String unitName;
    /**
    * 实名认证状态,1:通过,99:未通过(默认)
    */
    private String realStatus;
    /**
    * 人脸认证状态,1:已认证,99:未认证(默认)
    */
    private String faceStatus;
    /**
    * 用户状态,1:有效(默认),2:停用
    */
    private String status;
    private Integer status;
    /**
    * 关注纠纷类型,多个用,隔开
@@ -165,10 +140,10 @@
    private String followCaseType;
    /**
    * 删除状态,1:未删除(默认),99:已删除
     * 删除状态,0:已删除,1:未删除
    */
    @TableLogic
    private String deleteStatus;
    private Integer deleteStatus;
    /**
    * 客户编号
dyh-service/dyh-base/src/main/resources/template/webController.ftl
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: ${tableComments}接口api
 * @description: ${tableComments}接口api
 * @title: ${tableComments}接口api-web端
 * @description: ${tableComments}接口api-web端
 * @company: hugeinfo
 * @author: ${author}
 * @time: ${createTime}
dyh-service/dyh-base/src/main/resources/template/wechatController.ftl
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: ${tableComments}接口api
 * @description: ${tableComments}接口api
 * @title: ${tableComments}接口api-wechat端
 * @description: ${tableComments}接口api-wechat端
 * @company: hugeinfo
 * @author: ${author}
 * @time: ${createTime}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoleWebController.java
@@ -17,8 +17,8 @@
import java.util.Map;
/**
 * @title: 角色表接口api
 * @description: 角色表接口api
 * @title: 角色表接口api-web端
 * @description: 角色表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRoledataWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户角色数据权限表接口api
 * @description: 客户角色数据权限表接口api
 * @title: 客户角色数据权限表接口api-web端
 * @description: 客户角色数据权限表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/controller/web/CtRolefunWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户角色菜单权限表接口api
 * @description: 客户角色菜单权限表接口api
 * @title: 客户角色菜单权限表接口api-web端
 * @description: 客户角色菜单权限表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CtRoleService.java
@@ -6,6 +6,7 @@
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.ctrole.dao.mapper.CtRoleMapper;
import cn.huge.module.ctrole.domain.po.CtRole;
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;
@@ -128,4 +129,17 @@
        }
    }
    /**
     * 根据单位编号和角色编号查询
     * @param unitId 单位编号
     * @param roleId 角色编号
     * @return
     */
    public CtRole getByUnitIdAndRoleId(String unitId, String roleId){
        QueryWrapper<CtRole> ctRoleQueryWrapper = new QueryWrapper<>();
        ctRoleQueryWrapper.eq("unit_id", unitId).eq("role_code", roleId);
        CtRole ctRole = mapper.selectOne(ctRoleQueryWrapper);
        return ctRole;
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUnitClientController.java
New file
@@ -0,0 +1,59 @@
package cn.huge.module.ctuser.controller.client;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
/**
 * @title: 客户组织信息表接口api-微服务调用
 * @description: 客户组织信息表接口api-微服务调用
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/client/ctUnit")
public class CtUnitClientController {
    @Autowired(required = false)
    private HttpServletRequest request;
    @Autowired
    private CtUnitService service;
    @Autowired
    private CtUserService ctUserService;
    /**
     * 微服务调用-数据迁移-批量新增
     * @url {ctx}/api/client/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();
        }
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/client/CtUserClientController.java
New file
@@ -0,0 +1,81 @@
package cn.huge.module.ctuser.controller.client;
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.config.CurrentUser;
import cn.huge.module.ctrole.service.CtRoleService;
import cn.huge.module.ctuser.domain.po.CtUser;
import cn.huge.module.ctuser.dto.CtUserSaveDTO;
import cn.huge.module.ctuser.service.*;
import cn.huge.module.cust.dto.CtUserDTO;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
 * @title: 客户用户表接口api-微服务调用
 * @description: 客户用户表接口api-微服务调用
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
 * @version: 1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/api/client/ctUser")
public class CtUserClientController {
    @Autowired(required = false)
    private HttpServletRequest request;
    @Autowired
    private CtUserService service;
    /**
     * 微服务调用,只获取用户信息
     * @url {ctx}/api/client/ctUser/clientGetUser
     * @param userId 登录用户编号
     * @return Object
     */
    @GetMapping("/clientGetUser")
    public Object clientGetUser(@RequestParam(value = "userId") String userId) {
        try {
            CtUser ctUser = service.getById(userId);
            if (ObjectUtils.isNotEmpty(ctUser)){
                CtUserDTO ctUserDTO = new CtUserDTO();
                BeanUtils.copyProperties(ctUser, ctUserDTO);
                return ReturnSucUtils.getRepInfo(ctUserDTO);
            }else {
                return ReturnFailUtils.getRepInfo("用户不存在!");
            }
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * 微服务调用,获取用户所有信息(用户信息、角色等)
     * @url {ctx}/api/client/ctUser/clientGetUserAll
     * @param userId 登录用户编号
     * @return Object
     */
    @GetMapping("/clientGetUserAll")
    public Object clientGetUserAll(@RequestParam(value = "userId") String userId) {
        try {
            CtUserDTO ctUserDTO = service.clientGetUserAll(userId);
            if (ObjectUtils.isEmpty(ctUserDTO)){
                return ReturnFailUtils.getRepInfo("用户不存在!");
            }
            return ReturnSucUtils.getRepInfo(ctUserDTO);
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtAccountWebController.java
@@ -25,8 +25,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户用户账号表接口api
 * @description: 客户用户账号表接口api
 * @title: 客户用户账号表接口api-web端-web端
 * @description: 客户用户账号表接口api-web端-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:18
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtDeptWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户部门表接口api
 * @description: 客户部门表接口api
 * @title: 客户部门表接口api-web端
 * @description: 客户部门表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtPostWebController.java
@@ -24,8 +24,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户岗位表接口api
 * @description: 客户岗位表接口api
 * @title: 客户岗位表接口api-web端
 * @description: 客户岗位表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUnitWebController.java
@@ -23,8 +23,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户组织信息表接口api
 * @description: 客户组织信息表接口api
 * @title: 客户组织信息表接口api-web端
 * @description: 客户组织信息表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
@@ -308,22 +308,6 @@
    public Object saveCtUnit(@RequestBody CtUnit ctUnit) {
        try {
            service.saveCtUnit(ctUnit);
            return ReturnSucUtils.getRepInfo();
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * 批量新增-数据迁移
     * @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();
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUsepostWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户用户配岗表接口api
 * @description: 客户用户配岗表接口api
 * @title: 客户用户配岗表接口api-web端
 * @description: 客户用户配岗表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
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.CtUserSaveDTO;
import cn.huge.module.ctuser.service.*;
import cn.huge.module.cust.constant.RoleBaseEnum;
import cn.huge.module.cust.constant.UserBaseConsts;
@@ -32,8 +33,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户用户表接口api
 * @description: 客户用户表接口api
 * @title: 客户用户表接口api-web端
 * @description: 客户用户表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
@@ -279,10 +280,10 @@
     * @throws Exception
     */
    @PostMapping("/saveCtUser")
    public Object saveCtUser(@RequestBody CtUser ctUser, @CurrentUser String userId) {
    public Object saveCtUser(@RequestBody CtUserSaveDTO ctUserSaveDTO, @CurrentUser String userId) {
        try {
            // 保存更新用户信息
            service.webSaveCtUser(ctUser, userId);
            service.webSaveCtUser(ctUserSaveDTO, userId);
            return ReturnSucUtils.getRepInfo();
        } catch (Exception e) {
            return ReturnFailUtils.getRepInfo();
@@ -299,69 +300,15 @@
    @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);
            Map<String, Object> result = service.webListSelectTerm(userId);
            return ReturnSucUtils.getRepInfo(result);
        } catch (Exception e) {
            log.error("Controller接口[CtUserController.listSelectTerm]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo("查询失败", null);
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * 条件分页查询人员信息
     * web端-人员信息管理-人员列表
     * @url {ctx}/api/v1/ctUser/pageQuery
     * @param page 页码
     * @param size 每页数量
@@ -371,79 +318,11 @@
    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);
            Map<String, Object> result = service.webPageQuery(page, size, terms, userId);
            return ReturnSucUtils.getRepInfo(result);
        } catch (Exception e) {
            log.error("Controller接口[CtUserController.pageQuery]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo(e.getMessage(), null);
            return ReturnFailUtils.getRepInfo();
        }
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/controller/web/CtUseroleWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 客户用户角色表接口api
 * @description: 客户用户角色表接口api
 * @title: 客户用户角色表接口api-web端
 * @description: 客户用户角色表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/domain/po/CtUser.java
@@ -34,6 +34,12 @@
    private String trueName;
    /**
    * 平台账号
    */
    @TableField(value = "acc")
    private String acc;
    /**
    * 性别
    */
    @TableField(value = "sex")
@@ -249,12 +255,6 @@
    */
    @TableField(value = "update_time")
    private Date updateTime;
    /**
     * 平台账号
     */
    @TableField(exist = false)
    private String acc;
    /**
     * 密码
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUserSaveDTO.java
New file
@@ -0,0 +1,55 @@
package cn.huge.module.ctuser.dto;
import cn.huge.module.ctuser.domain.po.CtUsepost;
import cn.huge.module.ctuser.domain.po.CtUser;
import cn.huge.module.ctuser.domain.po.CtUserole;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
 * @title: 客户用户表业务扩展类
 * @description: 客户用户表业务扩展类
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
 * @version: 1.0.0
 * @see CtUser
 */
@Data
public class CtUserSaveDTO extends CtUser {
    /**
     * 密码
     */
    private String cipher;
    /**
     * 角色名称
     */
    private String roleName;
    /**
     * 岗位名称
     */
    private String postName;
    /**
     * 人员角色信息
     */
    private List<CtUserole> ctUseroleList;
    /**
     * 人员岗位信息
     */
    private List<CtUsepost> ctUsepostList;
    /**
     * 最后一次登录时间
     */
    private Date loginTime;
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java
@@ -153,9 +153,23 @@
     * @param accType 账号类型
     * @return
     */
    public CtAccount getByAccAndType(String acc, String accType){
    public CtAccount getByAccAndType(String acc, int accType){
        QueryWrapper<CtAccount> accountWrapper = new QueryWrapper<>();
        accountWrapper.eq("acc", acc)
                .eq("acc_type", accType);
        CtAccount ctAccount = this.getOne(accountWrapper);
        return ctAccount;
    }
    /**
     * 根据用户编号和类型查询
     * @param userId 用户编号
     * @param accType 账号类型
     * @return
     */
    public CtAccount getByUserIdAndType(String userId, int accType){
        QueryWrapper<CtAccount> accountWrapper = new QueryWrapper<>();
        accountWrapper.eq("user_id", userId)
                .eq("acc_type", accType);
        CtAccount ctAccount = this.getOne(accountWrapper);
        return ctAccount;
@@ -214,7 +228,7 @@
                if (checkCredential(ctAccountLoginDTO.getCipher(), ctAccount)) {
                    //返回结果
                    UserLoginDTO userLoginDTO = new UserLoginDTO();
                    CtUser ctUser = ctUserService.getByIdFromRedis(ctAccount.getUserId());
                    CtUser ctUser = ctUserService.getById(ctAccount.getUserId());
                    if (ObjectUtils.isEmpty(ctUser)){
                        return ReturnFailUtils.getRepInfo("账号或密码错误,请确认后重试!");
                    }
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUsepostService.java
@@ -6,6 +6,8 @@
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.ctuser.dao.mapper.CtUsepostMapper;
import cn.huge.module.ctuser.domain.po.CtUsepost;
import cn.huge.module.ctuser.domain.po.CtUserole;
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;
@@ -130,4 +132,19 @@
        }
    }
    /**
     * 根据用户编号物理删除
     * @param userId 用户编号
     */
    public void deleteByUserId(String userId){
        try{
            QueryWrapper<CtUsepost> ctUseroleQueryWrapper = new QueryWrapper<>();
            ctUseroleQueryWrapper.eq("user_id", userId);
            mapper.delete(ctUseroleQueryWrapper);
        }catch (Exception e){
            log.error("[CtUsepostService.deleteByUserId]调用失败,异常信息:"+e, e);
            throw new ServiceException("CtUsepostService.deleteByUserId", e);
        }
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUserService.java
@@ -1,35 +1,41 @@
package cn.huge.module.ctuser.service;
import cn.huge.base.common.dto.SelectTermDTO;
import cn.huge.base.common.exception.MethodException;
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.common.utils.ObjectUtils;
import cn.huge.base.common.utils.SelectTermUtils;
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.constant.BaseConsts;
import cn.huge.module.ctrole.domain.po.CtRole;
import cn.huge.module.ctrole.service.CtRoleService;
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.ctuser.domain.po.*;
import cn.huge.module.ctuser.dto.CtUserSaveDTO;
import cn.huge.module.cust.constant.RoleBaseEnum;
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 com.google.common.collect.Maps;
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.Sort;
import org.springframework.data.redis.core.RedisTemplate;
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 org.springframework.util.DigestUtils;
import javax.annotation.PostConstruct;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -53,15 +59,21 @@
    @Autowired
    private CtUserMapper mapper;
    @Autowired
    private CtAccountService ctAccountService;
    @Autowired
    private CtUnitService ctUnitService;
    @Autowired
    private CtUseroleService ctUseroleService;
    @Autowired
    private CtRoleService ctRoleService;
    @Autowired
    private CtUsepostService ctUsepostService;
    @Autowired
    private CtDeptService ctDeptService;
    @Autowired
    private UtilsClientImpl utilsClient;
    @Autowired
    private CtUnitService ctUnitService;
    @Autowired
    private CtUseroleService ctUseroleService;
    /**
    * 更新对象
@@ -188,24 +200,7 @@
    }
    /**
     * web端-人员信息管理-新增/新用户信息
     * @param ctUser
     * @param userId
     */
    public void webSaveCtUser(CtUser ctUser, String userId) {
        try {
            // 获取当前登录用户
            CtUser loginUser = this.getByIdFromRedis(userId);
            Date nowDate = DateUtils.getNowDate();
        } catch (Exception e) {
            log.error("service方法[CtUserService.webSaveCtUser]调用异常:" + e, e);
            throw new MethodException(e.getMessage());
        }
    }
    /**
     * 重写根据id获取用户
     * 重写根据id获取用户(id带有角色信息,如:1001&01)
     * @param userId 登录用户编号
     * @return Object
     */
@@ -218,6 +213,265 @@
            loginUserId = userId;
        }
        return mapper.selectById(loginUserId);
    }
    /**
     * web端-获取人员信息列表查询条件
     * @param userId 当前登录用户编号
     * @return
     */
    public Map<String, Object> webListSelectTerm(String userId){
        try {
            Map<String, Object> result = Maps.newHashMap();
            // 获取当前登录用户
            CtUserDTO loginUser = this.clientGetUserAll(userId);
            // 组织条件
            List<CtUnit> ctUnits = ctUnitService.list();
            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 (ctUnit.getUnitType() == UserBaseConsts.UNIT_TYPE_4) {
                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 result;
        }catch (Exception e){
            log.error("[CtUserService.webListSelectTerm]调用失败,异常信息:"+e, e);
            throw new ServiceException("CtUserService.webListSelectTerm", e);
        }
    }
    /**
     * web端-人员信息管理-人员列表
     * @param page 分页对象
     * @param terms 条件
     * @return Page
     */
    public Map<String, Object> webPageQuery(int page, int size, Map<String, Object> terms, String userId){
        try {
            // 获取当前登录用户
            CtUserDTO loginUser = this.clientGetUserAll(userId);
            Map<String, Object> result = Maps.newHashMap();
            // todo 角色数据权限
            Sort sort = Sort.by(Sort.Direction.DESC, "t1.create_time");
            PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
            Page<CtUser> ctUserPage = this.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);
            // todo 角色数据权限
            long countZzStatus = this.countTerms(terms);
            result.put("countZzStatus", countZzStatus);
            return result;
        }catch (Exception e){
            log.error("[CtUserService.webPageQuery]调用失败,异常信息:"+e, e);
            throw new ServiceException("CtUserService.webPageQuery", e);
        }
    }
    /**
     * web端-人员信息管理-新增/新用户信息
     * @param ctUserSaveDTO 提交用户信息
     * @param userId 当前登录用户编号
     */
    public void webSaveCtUser(CtUserSaveDTO ctUserSaveDTO, String userId) {
        try {
            // 获取当前登录用户
            CtUser loginUser = this.getById(userId);
            Date nowDate = DateUtils.getNowDate();
            // 判断是否新增
            CtUser ctUser = new CtUser();
            BeanUtils.copyProperties(ctUserSaveDTO, ctUser);
            ctUser.setUpdateTime(nowDate);
            if (IdUtils.checkNewId(ctUser.getId())) {
                ctUser.setId(utilsClient.getNewTimeId());
                ctUser.setCreateTime(nowDate);
                ctUser.setDeleteStatus(BaseConsts.DELETE_STATUS_1);
                ctUser.setJoinWay(UserBaseConsts.JOIN_WAY_1);
                ctUser.setRealStatus(UserBaseConsts.REAL_STATUS_0);
                ctUser.setStatus(UserBaseConsts.USER_STATUS_1);
                ctUser.setCustId(loginUser.getCustId());
                mapper.insert(ctUser);
                // 创建账号
                CtAccount ctAccount = ctAccountService.getByAccAndType(ctUser.getAcc(), UserBaseConsts.ACC_TYPE_1);
                if (ObjectUtils.isNotEmpty(ctAccount)) {
                    throw new ServiceException("账号已存在,请重新输入!");
                } else {
                    ctAccount = new CtAccount();
                    ctAccount.setCustId(ctUser.getCustId());
                    ctAccount.setId(utilsClient.getNewTimeId());
                    ctAccount.setUserId(ctUser.getId());
                    ctAccount.setAccType(UserBaseConsts.ACC_TYPE_1);
                    ctAccount.setAcc(ctUser.getAcc());
                    ctAccount.setCipher(DigestUtils.md5DigestAsHex(ctUserSaveDTO.getCipher().getBytes()));
                    ctAccount.setCipherOpen(ctUserSaveDTO.getCipher());
                    ctAccount.setDeleteStatus(BaseConsts.DELETE_STATUS_1);
                    ctAccount.setCreateTime(nowDate);
                    ctAccount.setCipherTime(nowDate);
                    ctAccount.setUpdateTime(nowDate);
                    ctAccountService.save(ctAccount);
                }
                // 保存角色
                List<CtUserole> ctUseroleList = ctUserSaveDTO.getCtUseroleList();
                for (CtUserole ctUserole : ctUseroleList) {
                    ctUserole.setId(utilsClient.getNewTimeId());
                    ctUserole.setUserId(ctUser.getId());
                    CtRole ctRole = ctRoleService.getByUnitIdAndRoleId(ctUser.getUnitId(), ctUserole.getRoleId());
                    ctUserole.setRoleId(ctRole.getId());
                    ctUserole.setRoleCode(ctRole.getRoleCode());
                    ctUserole.setCustId(ctUser.getCustId());
                    ctUserole.setCreateTime(nowDate);
                    ctUserole.setUpdateTime(nowDate);
                    ctUseroleService.save(ctUserole);
                }
                // 岗位
                List<CtUsepost> ctUsepostList = ctUserSaveDTO.getCtUsepostList();
                if (ObjectUtils.isNotEmpty(ctUsepostList)) {
                    for (CtUsepost ctUsepost : ctUsepostList) {
                        ctUsepost.setId(utilsClient.getNewTimeId());
                        ctUsepost.setUserId(ctUser.getId());
                        ctUsepost.setUnitId(ctUser.getUnitId());
                        ctUsepost.setDeptId(ctUser.getDeptId());
                        ctUsepost.setMatchType(UserBaseConsts.MATCH_TYPE_1);
                        ctUsepost.setCustId(ctUser.getCustId());
                        ctUsepost.setCreateTime(nowDate);
                        ctUsepost.setUpdateTime(nowDate);
                        ctUsepostService.save(ctUsepost);
                    }
                }
            } else {
                // 修改用户信息
                mapper.updateById(ctUser);
                // 修改账号信息
                CtAccount ctAccount = ctAccountService.getByUserIdAndType(ctUser.getId(), UserBaseConsts.ACC_TYPE_1);
                if (!ctAccount.getAcc().equals(ctUser.getAcc())) {
                    CtAccount oldAccount = ctAccountService.getByAccAndType(ctUser.getAcc(), UserBaseConsts.ACC_TYPE_1);
                    if (ObjectUtils.isNotEmpty(oldAccount)) {
                        throw new MethodException("修改后的账号已存在,请重新输入!");
                    } else {
                        ctAccount.setAcc(ctUser.getAcc());
                    }
                }
                ctAccount.setCipher(DigestUtils.md5DigestAsHex(ctUserSaveDTO.getCipher().getBytes()));
                ctAccount.setCipherOpen(ctUserSaveDTO.getCipher());
                ctAccount.setCipherTime(nowDate);
                ctAccount.setUpdateTime(nowDate);
                ctAccountService.updateById(ctAccount);
                // 修改角色信息
                ctUseroleService.deleteByUserId(ctUser.getId());
                List<CtUserole> ctUseroleList = ctUserSaveDTO.getCtUseroleList();
                for (CtUserole ctUserole : ctUseroleList) {
                    ctUserole.setId(utilsClient.getNewTimeId());
                    ctUserole.setUserId(ctUser.getId());
                    ctUserole.setCustId(ctUser.getCustId());
                    CtRole ctRole = ctRoleService.getByUnitIdAndRoleId(ctUser.getUnitId(), ctUserole.getRoleId());
                    ctUserole.setRoleId(ctRole.getId());
                    ctUserole.setRoleCode(ctRole.getRoleCode());
                    ctUserole.setCreateTime(nowDate);
                    ctUserole.setUpdateTime(nowDate);
                    ctUseroleService.save(ctUserole);
                }
                // 修改岗位信息
                ctUsepostService.deleteByUserId(ctUser.getId());
                List<CtUsepost> ctUsepostList = ctUserSaveDTO.getCtUsepostList();
                if (ObjectUtils.isNotEmpty(ctUsepostList)) {
                    for (CtUsepost ctUsepost : ctUsepostList) {
                        ctUsepost.setId(utilsClient.getNewTimeId());
                        ctUsepost.setUserId(ctUser.getId());
                        ctUsepost.setUnitId(ctUser.getUnitId());
                        ctUsepost.setDeptId(ctUser.getDeptId());
                        ctUsepost.setMatchType(UserBaseConsts.MATCH_TYPE_1);
                        ctUsepost.setCustId(ctUser.getCustId());
                        ctUsepost.setCreateTime(nowDate);
                        ctUsepost.setUpdateTime(nowDate);
                        ctUsepostService.save(ctUsepost);
                    }
                }
            }
        } catch (Exception e) {
            log.error("service方法[CtUserService.webSaveCtUser]调用异常:" + e, e);
            throw new MethodException(e.getMessage());
        }
    }
    /**
@@ -251,12 +505,8 @@
        // 用户信息
        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);
dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtUseroleService.java
@@ -5,6 +5,7 @@
import cn.huge.base.common.utils.IdUtils;
import cn.huge.module.client.api.impl.UtilsClientImpl;
import cn.huge.module.ctuser.dao.mapper.CtUseroleMapper;
import cn.huge.module.ctuser.domain.po.CtUsepost;
import cn.huge.module.ctuser.domain.po.CtUserole;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -155,4 +156,19 @@
    public  List<String> listRoleCode(String userId){
        return mapper.listRoleCode(userId);
    }
    /**
     * 根据用户编号物理删除
     * @param userId 用户编号
     */
    public void deleteByUserId(String userId){
        try{
            QueryWrapper<CtUserole> ctUseroleQueryWrapper = new QueryWrapper<>();
            ctUseroleQueryWrapper.eq("user_id", userId);
            mapper.delete(ctUseroleQueryWrapper);
        }catch (Exception e){
            log.error("[CtUseroleService.deleteByUserId]调用失败,异常信息:"+e, e);
            throw new ServiceException("CtUseroleService.deleteByUserId", e);
        }
    }
}
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/controller/web/PaAccountWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 公众用户账号表接口api
 * @description: 公众用户账号表接口api
 * @title: 公众用户账号表接口api-web端
 * @description: 公众用户账号表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-cust/src/main/java/cn/huge/module/pauser/controller/web/PaUserWebController.java
@@ -19,8 +19,8 @@
import java.util.stream.Stream;
/**
 * @title: 公众用户表接口api
 * @description: 公众用户表接口api
 * @title: 公众用户表接口api-web端
 * @description: 公众用户表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-19 20:04:19
dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/CustClient.java
@@ -23,12 +23,12 @@
public interface CustClient {
    /**
     *
     * @url {ctx}/api/v1/ctUser/clientGetUser?userId=
     * @param targetCtUnitList 登录用户编号
     * 微服务调用-数据迁移-批量新增
     * @url {ctx}/api/client/ctUnit/saveCtUnitList
     * @param targetCtUnitList 批量数据
     * @return ReturnBO
     */
    @GetMapping("/api/web/ctUnit/saveCtUnitList")
    @GetMapping("/api/client/ctUnit/saveCtUnitList")
    ReturnBO saveCtUnitList(@RequestBody List<TargetCtUnit> targetCtUnitList);
}
dyh-service/dyh-sync/src/main/java/cn/huge/module/client/api/impl/CustClientImpl.java
@@ -46,23 +46,23 @@
    private ObjectMapper objectMapper = new ObjectMapper();
    /**
     * 内部用户-获取登录用户
     * @param userId 用户编号
     * @return CtUserDTO
     * 微服务调用-数据迁移-批量新增
     * @param targetCtUnitList 批量数据
     * @return
     */
    public CtUserDTO clientGetUser(List<TargetCtUnit> targetCtUnitList){
    public CtUserDTO saveCtUnitList(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());
                log.error("Client外服务接口[CustClientImpl.saveCtUnitList]请求异常:" + returnBo.getMsg(), returnBo.getMsg());
                throw new ClientException("CustClientImpl.saveCtUnitList", returnBo.getMsg());
            }
        }catch (Exception e){
            log.error("service方法[CustClientImpl.clientGetUser]调用异常:"+e, e);
            throw new ServiceException("CustClientImpl.clientGetUser", e);
            log.error("service方法[CustClientImpl.saveCtUnitList]调用异常:"+e, e);
            throw new ServiceException("CustClientImpl.saveCtUnitList", e);
        }
    }
}
dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/controller/SyncController.java
@@ -10,8 +10,8 @@
import javax.servlet.http.HttpServletRequest;
/**
 * @title: 客户组织信息表接口api
 * @description: 客户组织信息表接口api
 * @title: 客户组织信息表接口api-web端
 * @description: 客户组织信息表接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2024-08-17 15:30:57
dyh-service/dyh-sync/src/main/java/cn/huge/module/sync/service/SyncService.java
@@ -73,7 +73,7 @@
                    targetCtUnitList.add(targetCtUnit);
                }
                if(CollectionUtils.isNotEmpty(targetCtUnitList)){
                    custClient.clientGetUser(targetCtUnitList);
                    custClient.saveCtUnitList(targetCtUnitList);
                }
            }
        } catch (Exception e) {
dyh-service/dyh-utils/src/main/java/cn/huge/module/cases/controller/CaseNoUtilsController.java
@@ -20,8 +20,8 @@
import java.util.Date;
/**
 * @title: 公共参数-案号工具接口api
 * @description: 公共参数-案号工具接口api
 * @title: 公共参数-案号工具接口api-web端
 * @description: 公共参数-案号工具接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2022-04-29 10:12:39
dyh-service/dyh-utils/src/main/java/cn/huge/module/common/controller/IdUtilsController.java
@@ -14,8 +14,8 @@
import javax.servlet.http.HttpServletRequest;
/**
 * @title: 公共参数-id工具接口api
 * @description: 公共参数-id工具接口api
 * @title: 公共参数-id工具接口api-web端
 * @description: 公共参数-id工具接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2022-04-29 10:12:39
dyh-service/dyh-utils/src/main/java/cn/huge/module/judic/controller/JudicNoUtilsController.java
@@ -17,8 +17,8 @@
import java.util.Date;
/**
 * @title: 公共参数-司法确认号工具接口api
 * @description: 公共参数-司法确认号工具接口api
 * @title: 公共参数-司法确认号工具接口api-web端
 * @description: 公共参数-司法确认号工具接口api-web端
 * @company: hugeinfo
 * @author: liyj
 * @time: 2022-04-29 10:12:39