From 5aec0d41b496803b4d11c8f75d161d8596f79d37 Mon Sep 17 00:00:00 2001 From: tangxiaobao <303826152@qq.com> Date: 星期五, 10 九月 2021 11:46:35 +0800 Subject: [PATCH] 修改标签设置bug --- springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java index 98a5d94..db577af 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java @@ -461,16 +461,15 @@ // record.setPhone(SensitiveUtil.desensitizedPhoneNumber(record.getPhone())); record.setIdCard(SensitiveUtil.desensitizedIdNumber(record.getIdCard())); - StringBuilder sb = new StringBuilder(); +// StringBuilder sb = new StringBuilder(); if (record.getIsPartymember().equals(1)) { - sb.append("党员,"); + record.setTags(record.getTags()+ "党员,"); } if (record.getIsVolunteer().equals(1)) { - sb.append("志愿者,"); + record.setTags(record.getTags()+ "志愿者,"); } - String tag = sb.toString(); - if (tag.length() > 0) { - record.setTags(tag.substring(0, tag.length() - 1)); + if (record.getTags().length() > 0) { + record.setTags(record.getTags().substring(0, record.getTags().length() - 1)); } else { record.setTags("无"); } @@ -579,7 +578,7 @@ SysUserDO sysUserDO = new SysUserDO(); sysUserDO.setUserId(loginUserInfoVO.getUserId()); sysUserDO.setTags(loginUserInfoVO.getTags()); - int update = userDao.updateById(sysUserDO); + int update = userDao.putUserTag(sysUserDO); if (update > 0) { return R.ok(); } @@ -1834,13 +1833,18 @@ * @return 标签集合 */ @Override - public R listTags(Long communityId) { + public R listTags() { List<String> list = new ArrayList<>(); List<ComMngUserTagDO> comMngUserTagDOS = comMngUserTagDAO - .selectList(new QueryWrapper<ComMngUserTagDO>().eq("sys_flag", 1).or().eq("community_id", communityId)); + .selectList(null); if (!ObjectUtils.isEmpty(comMngUserTagDOS)) { - list = comMngUserTagDOS.stream().map(comMngUserTagDO -> comMngUserTagDO.getTagName()) - .collect(Collectors.toList()); + for (ComMngUserTagDO comMngUserTagDO : comMngUserTagDOS) { + if (!list.contains(comMngUserTagDO.getTagName())) { + list.add(comMngUserTagDO.getTagName()); + } + } +// list = comMngUserTagDOS.stream().map(comMngUserTagDO -> comMngUserTagDO.getTagName()) +// .collect(Collectors.toList()); } return R.ok(list); } -- Gitblit v1.7.1