Browse Source

Merge branch 'dev_jcet' into dev_temp

dev_shibei_match
wxz 5 years ago
parent
commit
1ba6355acc
  1. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  2. 24
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -361,4 +361,14 @@ public class RedisKeys {
public static String getResiUserKey(String userId){
return rootPrefix.concat("resi:user:").concat(userId);
}
/**
* @Description 客户的ApiService
* @return
* @author wxz
* @date 2021.01.20 16:56
*/
public static String getCustomerApiServiceKey(String customerId) {
return rootPrefix.concat("customer:thirdplat:apiservice:").concat(customerId);
}
}

24
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerThirdplatApiServiceServiceImpl.java

@ -1,20 +1,42 @@
package com.epmet.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dao.CustomerThirdplatApiserviceDao;
import com.epmet.dto.result.ThirdplatApiserviceResultDTO;
import com.epmet.entity.CustomerThirdplatApiserviceEntity;
import com.epmet.service.CustomerThirdplatApiServiceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Map;
@Service
public class CustomerThirdplatApiServiceServiceImpl implements CustomerThirdplatApiServiceService {
@Autowired
private RedisUtils redisUtils;
@Autowired
private CustomerThirdplatApiserviceDao thirdplatApiserviceDao;
@Override
public ThirdplatApiserviceResultDTO getByCustomerId(String customerId) {
return thirdplatApiserviceDao.getByCustomerId(customerId);
ThirdplatApiserviceResultDTO apiService = null;
// 查redis,存redis
Map<String, Object> apiServiceMap = redisUtils.hGetAll(RedisKeys.getCustomerApiServiceKey(customerId));
if (!CollectionUtils.isEmpty(apiServiceMap)) {
apiService = BeanUtil.mapToBean(apiServiceMap, ThirdplatApiserviceResultDTO.class, true);
}
if (apiService == null) {
apiService = thirdplatApiserviceDao.getByCustomerId(customerId);
redisUtils.hMSet(RedisKeys.getCustomerApiServiceKey(customerId), BeanUtil.beanToMap(apiService));
}
return apiService;
}
}

Loading…
Cancel
Save