From a2a9bf529f5a7afe46a8db83623497f9382775b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=B8=96=E6=B0=B8?= Date: Tue, 18 Jun 2024 11:02:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:#5728=20=E7=AC=AC=E4=B8=89=E6=96=B9?= =?UTF-8?q?=E8=B4=A6=E5=8F=B7=E7=BB=91=E5=AE=9A=E5=90=8E=E5=89=8D=E7=AB=AF?= =?UTF-8?q?=E8=BF=98=E6=98=AF=E6=98=BE=E7=A4=BA=E6=9C=AA=E7=BB=91=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pig4cloud/pigx/admin/api/vo/UserVO.java | 23 ++++++++++--------- .../main/resources/mapper/SysUserMapper.xml | 18 ++++++++++----- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/UserVO.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/UserVO.java index 694b28aac..e6f384e6d 100644 --- a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/UserVO.java +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/UserVO.java @@ -89,6 +89,18 @@ public class UserVO implements Serializable { @Schema(description = "开源中国 open id") private String oscOpenId; + /** + * 企微微信 userid + */ + @Schema(description = "企微微信 userid") + private String wxCpUserid; + + /** + * 钉钉 userid + */ + @Schema(description = "钉钉 userid") + private String wxDingUserid; + /** * 创建时间 */ @@ -185,16 +197,5 @@ public class UserVO implements Serializable { @Schema(description = "邮箱") private String email; - /** - * 企微微信 userid - */ - @Schema(description = "企微微信 userid") - private String wxCpUserid; - - /** - * 钉钉 userid - */ - @Schema(description = "钉钉 userid") - private String wxDingUserid; } diff --git a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml index 7cdc5a10e..4fbc59faf 100644 --- a/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml +++ b/pigx-upms/pigx-upms-biz/src/main/resources/mapper/SysUserMapper.xml @@ -30,16 +30,16 @@ - - + + - + @@ -63,6 +63,8 @@ u.avatar, u.wx_openid, u.qq_openid, + u.gitee_login, + u.osc_id, u.wx_cp_userid, u.wx_ding_userid, u.dept_id, @@ -91,10 +93,10 @@ u.avatar, u.wx_openid, u.qq_openid, - u.gitee_login, - u.wx_cp_userid, - u.wx_ding_userid, + u.gitee_login, u.osc_id, + u.wx_cp_userid, + u.wx_ding_userid, u.del_flag, u.lock_flag, u.password_expire_flag, @@ -140,6 +142,8 @@ u.avatar, u.wx_openid, u.qq_openid, + u.gitee_login, + u.osc_id, u.wx_cp_userid, u.wx_ding_userid, u.dept_id, @@ -188,6 +192,8 @@ u.avatar, u.wx_openid, u.qq_openid, + u.gitee_login, + u.osc_id, u.wx_cp_userid, u.wx_ding_userid, u.dept_id, From 80a335e93c5313246784500455ccacf796c3456b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=B7=E5=86=B7?= <2270033969@qq.com> Date: Sun, 18 Aug 2024 23:43:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(=E6=97=A5=E5=BF=97=E7=AE=A1=E7=90=86):?= =?UTF-8?q?=20=E5=A2=9E=E5=8A=A0=20Jackson=20json=20=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E8=84=B1=E6=95=8F=E5=B7=A5=E5=85=B7=E7=B1=BB=EF=BC=8C=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=97=A5=E5=BF=97=E5=85=A5=E5=BA=93=E4=B8=AD=E6=9C=89?= =?UTF-8?q?=E6=95=8F=E6=84=9F=E5=AD=97=E6=AE=B5=E5=88=99=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pigx/common/log/event/SysLogListener.java | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/event/SysLogListener.java b/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/event/SysLogListener.java index f2cbb1899..d40f04364 100755 --- a/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/event/SysLogListener.java +++ b/pigx-common/pigx-common-log/src/main/java/com/pig4cloud/pigx/common/log/event/SysLogListener.java @@ -18,16 +18,11 @@ package com.pig4cloud.pigx.common.log.event; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.ser.FilterProvider; -import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter; -import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider; import com.pig4cloud.pigx.admin.api.dto.SysLogDTO; import com.pig4cloud.pigx.admin.api.feign.RemoteLogService; -import com.pig4cloud.pigx.common.core.constant.SecurityConstants; import com.pig4cloud.pigx.common.core.jackson.PigxJavaTimeModule; import com.pig4cloud.pigx.common.log.config.PigxLogProperties; +import com.pig4cloud.pigx.common.log.util.JacksonSensitiveFieldUtil; import jakarta.servlet.ServletRequest; import lombok.RequiredArgsConstructor; import lombok.SneakyThrows; @@ -52,12 +47,11 @@ public class SysLogListener implements InitializingBean { /** * 忽略序列化的对象类型 */ - private final static Class[] ignoreClass = { ServletRequest.class, BindingResult.class }; + private final static Class[] ignoreClass = {ServletRequest.class, BindingResult.class}; /** * new 一个 避免日志脱敏策略影响全局ObjectMapper */ - private final static ObjectMapper objectMapper = new ObjectMapper(); private final RemoteLogService remoteLogService; @@ -79,10 +73,9 @@ public class SysLogListener implements InitializingBean { try { // 序列化参数 - String params = objectMapper.writeValueAsString(list); + String params = JacksonSensitiveFieldUtil.getObjectMapper().writeValueAsString(list); source.setParams(StrUtil.subPre(params, logProperties.getMaxLength())); - } - catch (Exception e) { + } catch (Exception e) { log.error("请求参数序列化异常:{}", e.getMessage()); } } @@ -93,18 +86,8 @@ public class SysLogListener implements InitializingBean { @Override public void afterPropertiesSet() { - objectMapper.addMixIn(Object.class, PropertyFilterMixIn.class); String[] ignorableFieldNames = logProperties.getExcludeFields().toArray(new String[0]); - - FilterProvider filters = new SimpleFilterProvider().addFilter("filter properties by name", - SimpleBeanPropertyFilter.serializeAllExcept(ignorableFieldNames)); - objectMapper.setFilterProvider(filters); - objectMapper.registerModule(new PigxJavaTimeModule()); + JacksonSensitiveFieldUtil.configureSensitiveFields(ignorableFieldNames); + JacksonSensitiveFieldUtil.registerCustomModule(new PigxJavaTimeModule()); } - - @JsonFilter("filter properties by name") - class PropertyFilterMixIn { - - } - }