From 5ea973af033b0d368a48baeecae8091d574d227a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 5 Nov 2021 11:22:04 +0800 Subject: [PATCH] =?UTF-8?q?getcustomerform=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/commons/tools/redis/RedisKeys.java | 8 +++++-- .../com/epmet/redis/CustomerFootBarRedis.java | 24 +++++++++++++++---- .../epmet/service/impl/IcFormServiceImpl.java | 4 ++-- 3 files changed, 27 insertions(+), 9 deletions(-) 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 9b7a7afccb..62557e2892 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 @@ -586,7 +586,11 @@ public class RedisKeys { * @param customerId * @return */ - public static String getIcFormKey(String formCode,String customerId) { - return rootPrefix.concat("icform:").concat(formCode).concat(":").concat(customerId); + public static String getIcFormKeyForAdd(String formCode,String customerId) { + return rootPrefix.concat("icform:").concat(formCode).concat(":add:").concat(customerId); + } + + public static String getIcFormKeyForExport(String formCode,String customerId) { + return rootPrefix.concat("icform:").concat(formCode).concat(":export:").concat(customerId); } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java index 8cded15b44..0c549999ed 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/CustomerFootBarRedis.java @@ -51,18 +51,32 @@ public class CustomerFootBarRedis { } public void deleteIcForm(String formCode,String customerId) { - String key = RedisKeys.getIcFormKey(formCode,customerId); + String key = RedisKeys.getIcFormKeyForAdd(formCode,customerId); redisUtils.delete(key); } - public void setCustomerFormResultDTO(String formCode,String customerId, CustomerFormResultDTO value){ - String key = RedisKeys.getIcFormKey(formCode,customerId); + public void setCustomerFormResultDTO(String formCode,String customerId, CustomerFormResultDTO value,Boolean dynamic){ + String key=""; + if (null != dynamic && dynamic) { + //新增表单 + key = RedisKeys.getIcFormKeyForAdd(formCode,customerId); + }else{ + //导出 + key = RedisKeys.getIcFormKeyForExport(formCode,customerId); + } Map map = BeanUtil.beanToMap(value, false, true); redisUtils.hMSet(key, map); } - public CustomerFormResultDTO getCustomerFormResultDTO(String formCode,String customerId){ - String key = RedisKeys.getIcFormKey(formCode,customerId); + public CustomerFormResultDTO getCustomerFormResultDTO(String formCode,String customerId,Boolean dynamic){ + String key=""; + if (null != dynamic && dynamic) { + //新增表单 + key = RedisKeys.getIcFormKeyForAdd(formCode,customerId); + }else{ + //导出 + key = RedisKeys.getIcFormKeyForExport(formCode,customerId); + } Map resultMap = redisUtils.hGetAll(key); if (CollectionUtils.isEmpty(resultMap)) { return null; diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java index 23088c3024..06da023015 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java @@ -116,7 +116,7 @@ public class IcFormServiceImpl extends BaseServiceImpl */ @Override public CustomerFormResultDTO getCustomerForm(CustomerFormQueryDTO formDto) { - CustomerFormResultDTO customerFormResultDTO = customerFootBarRedis.getCustomerFormResultDTO(formDto.getFormCode(), formDto.getCustomerId()); + CustomerFormResultDTO customerFormResultDTO = customerFootBarRedis.getCustomerFormResultDTO(formDto.getFormCode(), formDto.getCustomerId(),formDto.getDynamic()); if (null != customerFormResultDTO) { return customerFormResultDTO; } @@ -128,7 +128,7 @@ public class IcFormServiceImpl extends BaseServiceImpl List groupList=baseDao.selectListGroup(resultDTO.getFormId()); resultDTO.setItemList(itemList); resultDTO.setGroupList(groupList); - customerFootBarRedis.setCustomerFormResultDTO(formDto.getFormCode(),formDto.getCustomerId(),resultDTO); + customerFootBarRedis.setCustomerFormResultDTO(formDto.getFormCode(),formDto.getCustomerId(),resultDTO,formDto.getDynamic()); return resultDTO; }