From f979cc9a7ce085c2f972368af6f1c15c8ecbcbc7 Mon Sep 17 00:00:00 2001 From: wanggeng <450292408@qq.com> Date: Sat, 22 Jan 2022 20:37:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=94=A8=E6=88=B7=E6=8B=93?= =?UTF-8?q?=E5=B1=95=E5=B1=9E=E6=80=A7=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pojo/dtos/userexpand/UserExpandDTO.java | 63 +++++++++ .../pojo/pos/userexpand/UserExpandPO.java | 63 +++++++++ .../pojo/vos/userexpand/UserExpandVO.java | 36 +++++ .../impl/UserExpandServiceImpl.java | 46 +++++++ src/main/resources/application-dev.yml | 2 +- .../mapper/user-expand/user-expand-mapper.xml | 92 ++++++++++++- .../templates/user-expand/update.html | 124 +++++++++++++++++- 7 files changed, 414 insertions(+), 12 deletions(-) diff --git a/src/main/java/cn/com/tenlion/usercenter/pojo/dtos/userexpand/UserExpandDTO.java b/src/main/java/cn/com/tenlion/usercenter/pojo/dtos/userexpand/UserExpandDTO.java index 916536d..113c006 100644 --- a/src/main/java/cn/com/tenlion/usercenter/pojo/dtos/userexpand/UserExpandDTO.java +++ b/src/main/java/cn/com/tenlion/usercenter/pojo/dtos/userexpand/UserExpandDTO.java @@ -18,6 +18,13 @@ public class UserExpandDTO extends UserDTO { private String areaCode; private String areaName; private Integer userLevel; + private String userSex; + private String userSexName; + private String userBirth; + private String userEducation; + private String userEducationName; + private String userPolitic; + private String userPoliticName; private List departments; public void setUserDTO(UserDTO userDTO) { @@ -48,6 +55,62 @@ public class UserExpandDTO extends UserDTO { this.userLevel = userLevel; } + public String getUserSex() { + return userSex == null ? "" : userSex.trim(); + } + + public void setUserSex(String userSex) { + this.userSex = userSex; + } + + public String getUserSexName() { + return userSexName == null ? "" : userSexName.trim(); + } + + public void setUserSexName(String userSexName) { + this.userSexName = userSexName; + } + + public String getUserBirth() { + return userBirth == null ? "" : userBirth.trim(); + } + + public void setUserBirth(String userBirth) { + this.userBirth = userBirth; + } + + public String getUserEducation() { + return userEducation == null ? "" : userEducation.trim(); + } + + public void setUserEducation(String userEducation) { + this.userEducation = userEducation; + } + + public String getUserEducationName() { + return userEducationName == null ? "" : userEducationName.trim(); + } + + public void setUserEducationName(String userEducationName) { + this.userEducationName = userEducationName; + } + + public String getUserPolitic() { + return userPolitic == null ? "" : userPolitic.trim(); + } + + public void setUserPolitic(String userPolitic) { + this.userPolitic = userPolitic; + } + + public String getUserPoliticName() { + return userPoliticName == null ? "" : userPoliticName.trim(); + } + + public void setUserPoliticName(String userPoliticName) { + this.userPoliticName = userPoliticName; + } + public List getDepartments() { return departments == null ? new ArrayList<>() : departments; } diff --git a/src/main/java/cn/com/tenlion/usercenter/pojo/pos/userexpand/UserExpandPO.java b/src/main/java/cn/com/tenlion/usercenter/pojo/pos/userexpand/UserExpandPO.java index 7dfb2ee..03feb36 100644 --- a/src/main/java/cn/com/tenlion/usercenter/pojo/pos/userexpand/UserExpandPO.java +++ b/src/main/java/cn/com/tenlion/usercenter/pojo/pos/userexpand/UserExpandPO.java @@ -13,6 +13,13 @@ public class UserExpandPO { private String areaCode; private String areaName; private Integer userLevel; + private String userSex; + private String userSexName; + private String userBirth; + private String userEducation; + private String userEducationName; + private String userPolitic; + private String userPoliticName; private String creator; private String gmtCreate; private String modifier; @@ -50,6 +57,62 @@ public class UserExpandPO { this.userLevel = userLevel; } + public String getUserSex() { + return userSex == null ? "" : userSex.trim(); + } + + public void setUserSex(String userSex) { + this.userSex = userSex; + } + + public String getUserSexName() { + return userSexName == null ? "" : userSexName.trim(); + } + + public void setUserSexName(String userSexName) { + this.userSexName = userSexName; + } + + public String getUserBirth() { + return userBirth == null ? "" : userBirth.trim(); + } + + public void setUserBirth(String userBirth) { + this.userBirth = userBirth; + } + + public String getUserEducation() { + return userEducation == null ? "" : userEducation.trim(); + } + + public void setUserEducation(String userEducation) { + this.userEducation = userEducation; + } + + public String getUserEducationName() { + return userEducationName == null ? "" : userEducationName.trim(); + } + + public void setUserEducationName(String userEducationName) { + this.userEducationName = userEducationName; + } + + public String getUserPolitic() { + return userPolitic == null ? "" : userPolitic.trim(); + } + + public void setUserPolitic(String userPolitic) { + this.userPolitic = userPolitic; + } + + public String getUserPoliticName() { + return userPoliticName == null ? "" : userPoliticName.trim(); + } + + public void setUserPoliticName(String userPoliticName) { + this.userPoliticName = userPoliticName; + } + public String getCreator() { return creator == null ? "" : creator.trim(); } diff --git a/src/main/java/cn/com/tenlion/usercenter/pojo/vos/userexpand/UserExpandVO.java b/src/main/java/cn/com/tenlion/usercenter/pojo/vos/userexpand/UserExpandVO.java index 15aeb2e..abac272 100644 --- a/src/main/java/cn/com/tenlion/usercenter/pojo/vos/userexpand/UserExpandVO.java +++ b/src/main/java/cn/com/tenlion/usercenter/pojo/vos/userexpand/UserExpandVO.java @@ -23,6 +23,10 @@ public class UserExpandVO { @ApiModelProperty(name = "userLevel", value = "用户级别") @CheckEmptyAnnotation(name = "用户级别") private Integer userLevel; + private String userSex; + private String userBirth; + private String userEducation; + private String userPolitic; public String getAreaCode() { return areaCode == null ? "" : areaCode.trim(); @@ -47,4 +51,36 @@ public class UserExpandVO { public void setUserLevel(Integer userLevel) { this.userLevel = userLevel; } + + public String getUserSex() { + return userSex == null ? "" : userSex.trim(); + } + + public void setUserSex(String userSex) { + this.userSex = userSex; + } + + public String getUserBirth() { + return userBirth == null ? "" : userBirth.trim(); + } + + public void setUserBirth(String userBirth) { + this.userBirth = userBirth; + } + + public String getUserEducation() { + return userEducation == null ? "" : userEducation.trim(); + } + + public void setUserEducation(String userEducation) { + this.userEducation = userEducation; + } + + public String getUserPolitic() { + return userPolitic == null ? "" : userPolitic.trim(); + } + + public void setUserPolitic(String userPolitic) { + this.userPolitic = userPolitic; + } } diff --git a/src/main/java/cn/com/tenlion/usercenter/service/userexpand/impl/UserExpandServiceImpl.java b/src/main/java/cn/com/tenlion/usercenter/service/userexpand/impl/UserExpandServiceImpl.java index 68585ac..dae40c4 100644 --- a/src/main/java/cn/com/tenlion/usercenter/service/userexpand/impl/UserExpandServiceImpl.java +++ b/src/main/java/cn/com/tenlion/usercenter/service/userexpand/impl/UserExpandServiceImpl.java @@ -11,6 +11,8 @@ import ink.wgink.interfaces.department.IDepartmentBaseService; import ink.wgink.interfaces.department.IDepartmentUserBaseService; import ink.wgink.interfaces.role.IRoleUserBaseService; import ink.wgink.interfaces.user.IUserBaseService; +import ink.wgink.module.dictionary.pojo.dtos.DataDTO; +import ink.wgink.mongo.module.dictionary.service.IMongoDataService; import ink.wgink.pojo.ListPage; import ink.wgink.pojo.dtos.department.DepartmentDTO; import ink.wgink.pojo.dtos.department.DepartmentUserDTO; @@ -49,6 +51,8 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx private IDepartmentBaseService departmentBaseService; @Autowired private IRoleUserBaseService roleUserBaseService; + @Autowired + private IMongoDataService mongoDataService; @Override public String getRoute() { @@ -140,6 +144,8 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx public void update(String userId, UserExpandVO userExpandVO) throws Exception { UserExpandPO userExpandPO = getPO(userId); Map params = HashMapUtil.beanToMap(userExpandVO); + setData(userExpandVO, params); + params.put("userId", userId); if (userExpandPO == null) { setSaveInfo(params); @@ -304,4 +310,44 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx } userExpandDTO.setDepartments(departmentDTOs); } + + /** + * 设置数据字典 + * + * @param userExpandVO + * @param params + */ + private void setData(UserExpandVO userExpandVO, Map params) { + // 性别 + if (!StringUtils.isBlank(userExpandVO.getUserSex())) { + List userSexDTOs = mongoDataService.listByParentId("4ef46940-76ab-4758-b5f0-0cbc93ffc660"); + for (DataDTO userSexDTO : userSexDTOs) { + if (StringUtils.equals(userExpandVO.getUserSex(), userSexDTO.getDataId())) { + params.put("userSexName", userSexDTO.getDataName()); + break; + } + } + } + // 学历 + if (!StringUtils.isBlank(userExpandVO.getUserSex())) { + List userEducationDTOs = mongoDataService.listByParentId("d6b9f026-6ea9-456a-b48b-0c18d502523b"); + for (DataDTO userEducationDTO : userEducationDTOs) { + if (StringUtils.equals(userExpandVO.getUserEducation(), userEducationDTO.getDataId())) { + params.put("userEducationName", userEducationDTO.getDataName()); + break; + } + } + } + // 政治面貌 + if (!StringUtils.isBlank(userExpandVO.getUserPolitic())) { + List userPoliticDTOs = mongoDataService.listByParentId("b2c96de0-3df8-41db-99b1-bc4e24ac6c24"); + for (DataDTO userPoliticDTO : userPoliticDTOs) { + if (StringUtils.equals(userExpandVO.getUserPolitic(), userPoliticDTO.getDataId())) { + params.put("userPoliticName", userPoliticDTO.getDataName()); + break; + } + } + } + + } } diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index 9a86914..02d70fd 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -68,7 +68,7 @@ spring: max-idle: 8 min-idle: 0 kafka: - bootstrap-servers: 127.0.0.1:9092 + bootstrap-servers: localhost:9092 producer: # 写入失败时,重试次数。当leader节点失效,一个repli节点会替代成为leader节点,此时可能出现写入失败, # 当retris为0时,produce不会重复。retirs重发,此时repli节点完全成为leader节点,不会产生消息丢失。 diff --git a/src/main/resources/mybatis/mapper/user-expand/user-expand-mapper.xml b/src/main/resources/mybatis/mapper/user-expand/user-expand-mapper.xml index 4f7b5ab..5c0482f 100644 --- a/src/main/resources/mybatis/mapper/user-expand/user-expand-mapper.xml +++ b/src/main/resources/mybatis/mapper/user-expand/user-expand-mapper.xml @@ -7,6 +7,13 @@ + + + + + + + @@ -18,6 +25,13 @@ + + + + + + + @@ -26,16 +40,21 @@ CREATE TABLE IF NOT EXISTS `sys_user_expand` ( `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, `user_id` char(36) DEFAULT NULL COMMENT '主键', - `area_code` varchar(255) DEFAULT NULL COMMENT '地区编码', - `area_name` varchar(255) DEFAULT NULL COMMENT '地区名称', - `user_level` int(2) DEFAULT NULL COMMENT '地区级别', + `area_code` varchar(255) DEFAULT NULL COMMENT '名称', + `area_name` varchar(255) DEFAULT NULL COMMENT '描述', + `user_level` int(2) DEFAULT '1' COMMENT '用户级别', + `user_sex` varchar(255) DEFAULT NULL COMMENT '性别', + `user_sex_name` varchar(255) DEFAULT NULL COMMENT '性别', + `user_birth` varchar(255) DEFAULT NULL COMMENT '出生年月', + `user_politic` varchar(255) DEFAULT NULL COMMENT '政治面貌', + `user_politic_name` varchar(255) DEFAULT NULL COMMENT '政治面貌', `creator` char(36) DEFAULT NULL COMMENT '创建人', `gmt_create` datetime DEFAULT NULL COMMENT '创建时间', `modifier` char(36) DEFAULT NULL COMMENT '修改人', `gmt_modified` datetime DEFAULT NULL COMMENT '修改时间', PRIMARY KEY (`id`), UNIQUE KEY `user_id` (`user_id`) - ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT=''; + ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8 COMMENT='用户拓展属性'; @@ -45,6 +64,13 @@ area_code, area_name, user_level, + user_sex, + user_sex_name, + user_birth, + user_education, + user_education_name, + user_politic, + user_politic_name, creator, gmt_create, modifier, @@ -54,6 +80,13 @@ #{areaCode}, #{areaName}, #{userLevel}, + #{userSex}, + #{userSexName}, + #{userBirth}, + #{userEducation}, + #{userEducationName}, + #{userPolitic}, + #{userPoliticName}, #{creator}, #{gmtCreate}, #{modifier}, @@ -85,6 +118,27 @@ user_level = #{userLevel}, + + + user_sex = #{userSex}, + + + user_sex_name = #{userSexName}, + + + user_birth = #{userBirth}, + + + user_education = #{userEducation}, + + + user_education_name = #{userEducationName}, + + + user_politic = #{userPolitic}, + + + user_politic_name = #{userPoliticName}, gmt_modified = #{gmtModified}, modifier = #{modifier} @@ -99,6 +153,13 @@ t1.area_code, t1.area_name, t1.user_level, + t1.user_sex, + t1.user_sex_name, + t1.user_birth, + t1.user_education, + t1.user_education_name, + t1.user_politic, + t1.user_politic_name, t1.gmt_create FROM sys_user_expand t1 @@ -113,6 +174,13 @@ t1.area_code, t1.area_name, t1.user_level, + t1.user_sex, + t1.user_sex_name, + t1.user_birth, + t1.user_education, + t1.user_education_name, + t1.user_politic, + t1.user_politic_name, t1.creator, t1.gmt_create, t1.modifier, @@ -130,6 +198,13 @@ t1.area_code, t1.area_name, t1.user_level, + t1.user_sex, + t1.user_sex_name, + t1.user_birth, + t1.user_education, + t1.user_education_name, + t1.user_politic, + t1.user_politic_name, t1.creator, t1.gmt_create, t1.modifier, @@ -156,7 +231,14 @@ t1.user_id, t1.area_code, t1.area_name, - t1.user_level + t1.user_level, + t1.user_sex, + t1.user_sex_name, + t1.user_birth, + t1.user_education, + t1.user_education_name, + t1.user_politic, + t1.user_politic_name FROM sys_user_expand t1 diff --git a/src/main/resources/templates/user-expand/update.html b/src/main/resources/templates/user-expand/update.html index 2ac4a83..2eccc2a 100644 --- a/src/main/resources/templates/user-expand/update.html +++ b/src/main/resources/templates/user-expand/update.html @@ -9,6 +9,9 @@ +
@@ -19,7 +22,7 @@
- +
@@ -31,6 +34,48 @@
+
+ +
+ +
+
+
+ +
+ +
+
+ +
+ +
+
+ +
+ +