From 7c3e4c60be169d5ef8170783e428afe383ab44f2 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Fri, 20 Aug 2021 17:01:51 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E8=A1=A5=E7=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/epmetuser/CustomerStaffDao.xml | 8 ++++---- .../resources/mapper/govorg/CustomerStaffAgencyDao.xml | 4 ++-- .../java/com/epmet/service/impl/StaffServiceImpl.java | 3 ++- .../src/main/resources/mapper/CustomerAgencyDao.xml | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml index 6fea2678fe..2f1cae9706 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/CustomerStaffDao.xml @@ -68,10 +68,10 @@ sr.staff_id, case when gsr.role_key = - + 'agency_leader' - + 'dept_leader' @@ -92,10 +92,10 @@ ORDER BY gsr.role_key ]]> - + 'agency_leader' - + 'dept_leader' diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml index d08de26805..29da78941d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerStaffAgencyDao.xml @@ -53,7 +53,7 @@ - + SELECT ca.customer_id, ca.id AS "agencyId", @@ -464,7 +464,7 @@ AND ca.del_flag = '0' AND cd.id = #{orgId} - + SELECT ca.customer_id, ca.id AS "agencyId", From 54bc6913ede1bcae727f7b1c89b7aa9efc3ea7fd Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 20 Aug 2021 17:05:16 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E3=80=90=E5=8F=91=E9=80=81=E6=B6=88?= =?UTF-8?q?=E6=81=AF=E3=80=91=E6=88=91=E6=94=B6=E5=88=B0=E3=80=81=E6=88=91?= =?UTF-8?q?=E5=8F=91=E9=80=81=E7=BA=A2=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../message/result/InfoRedDotResultDTO.java | 5 +++-- .../dao/epmetmessage/InfoReceiversDao.java | 16 ++++++++++++++ .../impl/EpmetMessageServiceImpl.java | 5 ++++- .../mapper/epmetmessage/InfoReceiversDao.xml | 21 +++++++++++++++++++ 4 files changed, 44 insertions(+), 3 deletions(-) diff --git a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java index ce159b6a33..40f96878c5 100644 --- a/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java +++ b/epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/message/result/InfoRedDotResultDTO.java @@ -1,5 +1,6 @@ package com.epmet.dataaggre.dto.message.result; +import com.epmet.commons.tools.constant.NumConstant; import lombok.Data; import java.io.Serializable; @@ -17,10 +18,10 @@ public class InfoRedDotResultDTO implements Serializable { /** * 我发出的,新回复数量 */ - private Integer sentNewReplyCount; + private Integer sentNewReplyCount = NumConstant.ZERO; /** * 我收到的未读的消息数量 */ - private Integer receivedUnReadCount; + private Integer receivedUnReadCount = NumConstant.ZERO; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java index c0d8b4c86d..5d232ffe09 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/epmetmessage/InfoReceiversDao.java @@ -90,4 +90,20 @@ public interface InfoReceiversDao extends BaseDao { * @date 2021/8/20 2:31 下午 */ List selectReplyAtt(String replyId); + + /** + * @Description 查询我收到的未读的消息数量 + * @Param userId + * @author zxc + * @date 2021/8/20 4:16 下午 + */ + Integer selectUnReadCount(@Param("userId") String userId); + + /** + * @Description 我发出的,新回复数量 + * @Param userId + * @author zxc + * @date 2021/8/20 4:20 下午 + */ + Integer selectNewReplyCount(@Param("userId") String userId); } \ No newline at end of file diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java index 6d1c3ff183..69ebdbb38d 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java @@ -187,7 +187,10 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { */ @Override public InfoRedDotResultDTO redDot(String userId) { - return null; + InfoRedDotResultDTO result = new InfoRedDotResultDTO(); + result.setReceivedUnReadCount(infoReceiversDao.selectUnReadCount(userId)); + result.setSentNewReplyCount(infoReceiversDao.selectNewReplyCount(userId)); + return result; } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml index 179b3469fd..bd57d3da72 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetmessage/InfoReceiversDao.xml @@ -104,4 +104,25 @@ ORDER BY m.SORT ASC + + + + + + \ No newline at end of file From 2b279651ffe05cd57c8a2e8c09aeb415ae79a528 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:18:27 +0800 Subject: [PATCH 3/8] =?UTF-8?q?CustomerStaffRedis=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E4=B8=BA=E9=9D=99=E6=80=81=E6=96=B9=E6=B3=95=20=E6=97=A0?= =?UTF-8?q?=E9=9C=80=E6=B3=A8=E5=85=A5=E7=9B=B4=E6=8E=A5=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/filter/LogMsgSendFilter.java | 2 +- .../redis/common/CustomerStaffRedis.java | 36 +++++++++++-------- .../dataaggre/controller/DemoController.java | 5 ++- .../impl/EpmetMessageServiceImpl.java | 10 +++--- .../epmetuser/impl/EpmetUserServiceImpl.java | 4 +-- .../screen/impl/ScreenProjectServiceImpl.java | 5 ++- .../impl/CustomerStaffServiceImpl.java | 6 ++-- .../service/impl/StaffRoleServiceImpl.java | 9 ----- 8 files changed, 34 insertions(+), 43 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 4a6332f74a..33807f7f08 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -205,7 +205,7 @@ public class LogMsgSendFilter extends LevelFilter { } return slashMatcher.start(); } catch (Exception e) { - logger.warn("getCharacterPosition no matche", e); + logger.warn("getCharacterPosition no matche"); return string.length(); } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 3acbad8a1b..7f005b5eb5 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -17,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; +import javax.annotation.PostConstruct; import java.util.Map; /** @@ -32,14 +33,21 @@ public class CustomerStaffRedis { private RedisUtils redisUtils; @Autowired private CommonAggFeignClient commonAggFeignClient; + + private static CustomerStaffRedis customerStaffRedis; private static final String ROLE_MAP_KEY = "roleMap"; - //@PostConstruct - public void init() { - CustomerStaffInfoCacheResult role = this.getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); - role = this.getStaffInfo("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"); + @PostConstruct + public void init(){ + customerStaffRedis = this; + customerStaffRedis.redisUtils = this.redisUtils; + customerStaffRedis.commonAggFeignClient = this.commonAggFeignClient; + } + public static void initTest() { + CustomerStaffInfoCacheResult role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); + role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"); System.out.println(JSON.toJSONString(role)); - System.out.println(JSON.toJSONString(this.getStaffRoleMap("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"))); + System.out.println(JSON.toJSONString(getStaffRoleMap("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"))); } /** @@ -52,9 +60,9 @@ public class CustomerStaffRedis { * @date 2021/8/19 10:29 下午 * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 */ - public CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) { + public static CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) { String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); - Map roleMap = redisUtils.hGetAll(key); + Map roleMap = customerStaffRedis.redisUtils.hGetAll(key); if (!CollectionUtils.isEmpty(roleMap)) { return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); } @@ -66,8 +74,8 @@ public class CustomerStaffRedis { } @Nullable - private CustomerStaffInfoCache reloadStaffCache(String staffId, String key) { - Result staffResult = commonAggFeignClient.getStaffInfo(staffId); + private static CustomerStaffInfoCache reloadStaffCache(String staffId, String key) { + Result staffResult = customerStaffRedis.commonAggFeignClient.getStaffInfo(staffId); if (staffResult == null || !staffResult.success()) { throw new RenException("获取工作人员信息失败"); } @@ -78,7 +86,7 @@ public class CustomerStaffRedis { } Map map = BeanUtil.beanToMap(resultData, false, true); - redisUtils.hMSet(key, map); + customerStaffRedis.redisUtils.hMSet(key, map); return resultData; } @@ -92,9 +100,9 @@ public class CustomerStaffRedis { * @date 2021/8/19 10:29 下午 * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 */ - public Map getStaffRoleMap(String customerId, String staffId) { + public static Map getStaffRoleMap(String customerId, String staffId) { String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); - Map roleMap = (Map) redisUtils.hGet(key,ROLE_MAP_KEY); + Map roleMap = (Map) customerStaffRedis.redisUtils.hGet(key,ROLE_MAP_KEY); if (!CollectionUtils.isEmpty(roleMap)) { return roleMap; } @@ -112,13 +120,13 @@ public class CustomerStaffRedis { * @author LiuJanJun * @date 2021/8/19 10:39 下午 */ - public boolean delStaffInfoFormCache(String customerId, String staffId) { + public static Boolean delStaffInfoFormCache(String customerId, String staffId) { if (StringUtils.isBlank(customerId) || StringUtils.isBlank(staffId)) { log.warn("delStaffInfoFormCache param is blank,customerId:{},staffId:{}", customerId, staffId); return false; } String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); - return redisUtils.delete(key); + return customerStaffRedis.redisUtils.delete(key); } } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java index e8fb5e18e3..16d6aa362f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/DemoController.java @@ -2,7 +2,6 @@ package com.epmet.dataaggre.controller; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.dataaggre.service.DemoService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -21,8 +20,8 @@ public class DemoController { demoService.doIt(); - CustomerStaffRedis bean = SpringContextUtils.getBean(CustomerStaffRedis.class); - bean.init(); + //CustomerStaffRedis bean = SpringContextUtils.getBean(CustomerStaffRedis.class); + CustomerStaffRedis.initTest(); return new Result(); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java index 69ebdbb38d..f49f3cfc1f 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetmessage/impl/EpmetMessageServiceImpl.java @@ -43,8 +43,6 @@ import java.util.stream.Collectors; public class EpmetMessageServiceImpl implements EpmetMessageService { @Autowired private InfoReceiversDao infoReceiversDao; - @Autowired - private CustomerStaffRedis customerStaffRedis; /** * @param formDTO @@ -75,7 +73,7 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { ReceiverDTO dto = new ReceiverDTO(); dto.setStaffId(item.getStaffId()); dto.setReadFlag(item.getReadFlag()); - CustomerStaffInfoCacheResult staffInfoCache = customerStaffRedis.getStaffInfo(item.getCustomerId(), item.getStaffId()); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(item.getCustomerId(), item.getStaffId()); dto.setStaffName(staffInfoCache.getRealName()); dto.setGender(staffInfoCache.getGender()); dto.setHeadPhoto(staffInfoCache.getHeadPhoto()); @@ -105,7 +103,7 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { List staffNameList = new ArrayList<>(); for (String userId : group.getStaffIdList()) { //查询每个工作人员的基本信息,获取姓名 - CustomerStaffInfoCacheResult staffInfoCache = customerStaffRedis.getStaffInfo(customerId, userId); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(customerId, userId); if (null != staffInfoCache) { staffNameList.add(staffInfoCache.getRealName()); } @@ -136,7 +134,7 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { if (CollectionUtils.isNotEmpty(staffIds.getList())) { for (String userId : staffIds.getList()) { //查询每个工作人员的基本信息 - CustomerStaffInfoCacheResult staffInfoCache = customerStaffRedis.getStaffInfo(formDTO.getCustomerId(), userId); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), userId); if (null != staffInfoCache) { StaffInfoCommonDTO staffInfo = new StaffInfoCommonDTO(); staffInfo.setStaffId(userId); @@ -167,7 +165,7 @@ public class EpmetMessageServiceImpl implements EpmetMessageService { result.setTotal((int) data.getTotal()); for (InfoReplyDetail detail : data.getList()) { //查询每个工作人员的基本信息 - CustomerStaffInfoCacheResult staffInfoCache = customerStaffRedis.getStaffInfo(formDTO.getCustomerId(), detail.getStaffId()); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), detail.getStaffId()); detail.setStaffName(staffInfoCache.getRealName()); detail.setGender(staffInfoCache.getGender().toString()); detail.setHeadPhoto(StringUtils.isNotBlank(staffInfoCache.getHeadPhoto()) ? staffInfoCache.getHeadPhoto() : StrConstant.EPMETY_STR); diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index c743821b4e..4fdfd32af6 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -76,8 +76,6 @@ public class EpmetUserServiceImpl implements EpmetUserService { private GovProjectService govProjectService; @Resource private GovStaffRoleDao govStaffRoleDao; - @Resource - private CustomerStaffRedis customerStaffRedis; /** * @Description 根据UserIds查询 @@ -487,7 +485,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { RoleUsersResultDTO dto = new RoleUsersResultDTO(); dto.setStaffId(item.getStaffId()); //从redis获取用户信息 - CustomerStaffInfoCacheResult staffInfoCache = customerStaffRedis.getStaffInfo(item.getCustomerId(), item.getStaffId()); + CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(item.getCustomerId(), item.getStaffId()); dto.setGender(staffInfoCache.getGender()); dto.setHeadPhoto(staffInfoCache.getHeadPhoto()); dto.setName(staffInfoCache.getRealName()); diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java index 67e33d93be..127f239501 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java @@ -56,8 +56,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { private ScreenEventImgDataDao screenEventImgDataDao; @Autowired private ScreenProjectDataDao screenProjectDataDao; - @Autowired - private CustomerStaffRedis staffRedis; + @Autowired private ScreenProjectCategoryOrgDailyDao screenProjectCategoryOrgDailyDao; @Autowired @@ -118,7 +117,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService { CustomerAgencyUserRoleFormDTO userRoleFormDTO = new CustomerAgencyUserRoleFormDTO(); userRoleFormDTO.setCustomerId(formDTO.getCustomerId()); userRoleFormDTO.setStaffId(item.getReportUserId()); - Map staffRoleMap = staffRedis.getStaffRoleMap(formDTO.getCustomerId(), item.getReportUserId()); + Map staffRoleMap = CustomerStaffRedis.getStaffRoleMap(formDTO.getCustomerId(), item.getReportUserId()); if (!CollectionUtils.isEmpty(staffRoleMap)){ item.setReportUserRoleSet(staffRoleMap.keySet()); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 0333550df2..9405f9a4a9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -99,8 +99,6 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl page(Map params) { @@ -343,7 +341,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(ConvertUtils.sourceToTarget(staffEntity, CustomerStaffDTO.class)); } @@ -416,7 +414,7 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl implements StaffRoleService { - @Autowired - private CustomerStaffRedis staffRedis; - - @Autowired - private GovStaffRoleTemplateDao govStaffRoleTemplateDao; - @Override public PageData page(Map params) { IPage page = baseDao.selectPage( From bed190232db8f9fd624a16eb774087ef45fa679f Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:26:37 +0800 Subject: [PATCH 4/8] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/feign/CommonAggFeignClient.java | 2 +- .../tools/redis/common/CustomerStaffRedis.java | 4 +++- .../service/epmetuser/impl/EpmetUserServiceImpl.java | 12 ++++++------ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java index d9ceb0f3a0..7b87579a4d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; * @Description * @Author sun */ -@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = CommonAggFeignClientFallBackFactory.class) +@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = CommonAggFeignClientFallBackFactory.class,url = "http://localhost:8114") public interface CommonAggFeignClient { /** diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 7f005b5eb5..72dd12d1ab 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -45,7 +45,9 @@ public class CustomerStaffRedis { } public static void initTest() { CustomerStaffInfoCacheResult role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); - role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"); + role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); + System.out.println(JSON.toJSONString(role)); + role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "ec524bbbc41d0662cbb36236161005e9"); System.out.println(JSON.toJSONString(role)); System.out.println(JSON.toJSONString(getStaffRoleMap("45687aa479955f9d06204d415238f7cc", "7f694a66efe60a47c2114875f310248a"))); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index 4fdfd32af6..bc78ba62a5 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -574,12 +574,12 @@ public class EpmetUserServiceImpl implements EpmetUserService { List idAndNameList = new ArrayList<>(); for (CustomerGridDTO customerGridDTO : list) { IdAndNameDTO grid = new IdAndNameDTO(); - if (isContinueMkName && OrgTypeEnum.GRID.getCode().equals(fromOrgType)&&grid.getId().equals(result.getFromOrgId())){ - showNameBuilder.append(agencyDTO.getOrganizationName()).append(StrConstant.HYPHEN).append(grid.getName()); - } grid.setId(customerGridDTO.getId()); grid.setName(customerGridDTO.getGridName()); idAndNameList.add(grid); + if (isContinueMkName && OrgTypeEnum.GRID.getCode().equals(fromOrgType)&&grid.getId().equals(result.getFromOrgId())){ + showNameBuilder.append(agencyDTO.getOrganizationName()).append(StrConstant.HYPHEN).append(grid.getName()); + } } result.setGridList(idAndNameList); @@ -587,12 +587,12 @@ public class EpmetUserServiceImpl implements EpmetUserService { idAndNameList = new ArrayList<>(); for (CustomerDepartmentDTO org : deptList) { IdAndNameDTO dept = new IdAndNameDTO(); - if (isContinueMkName && OrgTypeEnum.GRID.getCode().equals(fromOrgType)&&dept.getId().equals(result.getFromOrgId())){ - showNameBuilder.append(agencyDTO.getOrganizationName()).append(StrConstant.HYPHEN).append(dept.getName()); - } dept.setId(org.getId()); dept.setName(org.getDepartmentName()); idAndNameList.add(dept); + if (isContinueMkName && OrgTypeEnum.DEPT.getCode().equals(fromOrgType)&&dept.getId().equals(result.getFromOrgId())){ + showNameBuilder.append(agencyDTO.getOrganizationName()).append(StrConstant.HYPHEN).append(dept.getName()); + } } result.setDeptList(idAndNameList); //特殊处理 显示的名字 From f70d397c4206dfd61488ef66f1765d65562d7be2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:28:02 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E7=BC=93=E5=AD=98key=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/commons/tools/redis/RedisKeys.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java index c3edf2dcbc..fd52f94968 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java @@ -498,6 +498,6 @@ public class RedisKeys { * @return */ public static String getCustomerStaffInfoKey(String customerId, String staffId) { - return rootPrefix.concat("gov:staff").concat(customerId).concat(StrConstant.COLON).concat(staffId); + return rootPrefix.concat("gov:staff:").concat(customerId).concat(StrConstant.COLON).concat(staffId); } } From bdd006f0d26f9a9d09134516f01ffdf975189ba7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:37:45 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/redis/common/CustomerStaffRedis.java | 4 +++- .../service/epmetuser/impl/EpmetUserServiceImpl.java | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 72dd12d1ab..97e545f98f 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -70,7 +70,9 @@ public class CustomerStaffRedis { } CustomerStaffInfoCache resultData = reloadStaffCache(staffId, key); - if (resultData == null) return null; + if (resultData == null) { + return null; + } return ConvertUtils.sourceToTarget(resultData,CustomerStaffInfoCacheResult.class); } diff --git a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java index bc78ba62a5..3cfb3acf89 100644 --- a/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java +++ b/epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/epmetuser/impl/EpmetUserServiceImpl.java @@ -537,7 +537,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { CustomerStaffEntity staffEntity = customerStaffDao.selectOne(queryWrapper); CustomerStaffResultDTO result = ConvertUtils.sourceToTarget(staffEntity, CustomerStaffResultDTO.class); - //2.查询工作人员所属组织信息 + //查询工作人员所属组织信息 CustomerAgencyDTO agencyDTO = govOrgService.gridByAgencyId(null,staffId); if (agencyDTO == null){ log.error("getStaffInfo have any agency staffId:{}",staffId); @@ -569,7 +569,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { Map roleMap = roleList.stream().collect(Collectors.toMap(StaffRoleResultDTO::getRoleKey, StaffRoleResultDTO::getRoleName)); result.setRoleMap(roleMap); - //1.查询当前人员所在的网格列表 + //1.查询工作人员所在的网格列表 List list = govOrgService.getStaffGridList(staffId); List idAndNameList = new ArrayList<>(); for (CustomerGridDTO customerGridDTO : list) { @@ -583,6 +583,7 @@ public class EpmetUserServiceImpl implements EpmetUserService { } result.setGridList(idAndNameList); + //查询工作人员所在的部门列表 List deptList = govOrgService.getStaffDeptList(staffId); idAndNameList = new ArrayList<>(); for (CustomerDepartmentDTO org : deptList) { From f67f1ea1f66b40a0d4205a29f83872e80a04cb58 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:39:26 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../redis/common/CustomerStaffRedis.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java index 97e545f98f..831d2f177d 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerStaffRedis.java @@ -38,14 +38,15 @@ public class CustomerStaffRedis { private static final String ROLE_MAP_KEY = "roleMap"; @PostConstruct - public void init(){ + public void init() { customerStaffRedis = this; customerStaffRedis.redisUtils = this.redisUtils; customerStaffRedis.commonAggFeignClient = this.commonAggFeignClient; } + public static void initTest() { CustomerStaffInfoCacheResult role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "9e37adcce6472152e6508a19d3683e02"); - role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); + role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "e08316376c972b5cb3f085bb39a3680f"); System.out.println(JSON.toJSONString(role)); role = getStaffInfo("45687aa479955f9d06204d415238f7cc", "ec524bbbc41d0662cbb36236161005e9"); System.out.println(JSON.toJSONString(role)); @@ -66,7 +67,7 @@ public class CustomerStaffRedis { String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); Map roleMap = customerStaffRedis.redisUtils.hGetAll(key); if (!CollectionUtils.isEmpty(roleMap)) { - return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); + return ConvertUtils.mapToEntity(roleMap, CustomerStaffInfoCacheResult.class); } CustomerStaffInfoCache resultData = reloadStaffCache(staffId, key); @@ -74,7 +75,7 @@ public class CustomerStaffRedis { return null; } - return ConvertUtils.sourceToTarget(resultData,CustomerStaffInfoCacheResult.class); + return ConvertUtils.sourceToTarget(resultData, CustomerStaffInfoCacheResult.class); } @Nullable @@ -99,20 +100,16 @@ public class CustomerStaffRedis { * * @param customerId * @param staffId - * @return com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache - * @author LiuJanJun - * @date 2021/8/19 10:29 下午 - * @remark 此方法仅用于 获取某个工作人员的信息,不用于获取客户下所有工作人员信息 */ - public static Map getStaffRoleMap(String customerId, String staffId) { + public static Map getStaffRoleMap(String customerId, String staffId) { String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId); - Map roleMap = (Map) customerStaffRedis.redisUtils.hGet(key,ROLE_MAP_KEY); + Map roleMap = (Map) customerStaffRedis.redisUtils.hGet(key, ROLE_MAP_KEY); if (!CollectionUtils.isEmpty(roleMap)) { - return roleMap; + return roleMap; } reloadStaffCache(staffId, key); - return getStaffRoleMap(customerId,staffId); + return getStaffRoleMap(customerId, staffId); } /** From 29aee85d01752afb34c9896e8b7daf2db39eecf2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 20 Aug 2021 17:42:26 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E5=9C=B0=E5=9D=80=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/feign/CommonAggFeignClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java index 7b87579a4d..d9ceb0f3a0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java @@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.PostMapping; * @Description * @Author sun */ -@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = CommonAggFeignClientFallBackFactory.class,url = "http://localhost:8114") +@FeignClient(name = ServiceConstant.DATA_AGGREGATOR_SERVER, fallbackFactory = CommonAggFeignClientFallBackFactory.class) public interface CommonAggFeignClient { /**