Browse Source

注释

dev_shibei_match
yinzuomei 4 years ago
parent
commit
7a2ee528bf
  1. 4
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java
  2. 39
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java
  3. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java
  4. 32
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java
  5. 23
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java

4
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/ScreenProjectDetailResultDTO.java

@ -26,7 +26,7 @@ public class ScreenProjectDetailResultDTO implements Serializable {
*/ */
private String projectId; private String projectId;
/** /**
* 项目标题 * 项目标题06.25新增工作端小程序难点赌点+群众不满详情用
*/ */
private String projectTitle; private String projectTitle;
@ -73,7 +73,7 @@ public class ScreenProjectDetailResultDTO implements Serializable {
private List<processDTO> processList; private List<processDTO> processList;
/** /**
* 满意度得分 * 满意度得分 06.25新增这个返参目前大屏和工作端小程序都没有用到工作端小程序详情的得分是取得列表返回去的值
*/ */
private BigDecimal score; private BigDecimal score;

39
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/redis/DataReportRedis.java

@ -0,0 +1,39 @@
package com.epmet.datareport.redis;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dto.result.AgencyDetailMulticResultDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* 描述一下
*
* @author yinzuomei@elink-cn.com
* @date 2021/6/29 15:46
*/
@Component
public class DataReportRedis {
@Autowired
private RedisUtils redisUtils;
private String agencyDetailKeyPrefix="epmet:screen:";
public AgencyDetailMulticResultDTO queryAgencyDetailMulticResultDTO(String customerId, String agencyId) {
String agencyDetailKey=agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId);
Map<String, Object> map = redisUtils.hGetAll(agencyDetailKey);
if (MapUtil.isEmpty(map)) {
return null;
}
AgencyDetailMulticResultDTO dto = BeanUtil.mapToBean(map, AgencyDetailMulticResultDTO.class, true);
return dto;
}
public void setAgencyDetailMulticResultDTO(String customerId, String agencyId, AgencyDetailMulticResultDTO agencysResultDTO) {
String agencyDetailKey = agencyDetailKeyPrefix.concat(customerId).concat(":").concat(agencyId);
Map<String, Object> map = BeanUtil.beanToMap(agencysResultDTO);
redisUtils.hMSet(agencyDetailKey, map, RedisUtils.DEFAULT_EXPIRE);
}
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/AgencyServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.datareport.redis.DataReportRedis;
import com.epmet.datareport.service.evaluationindex.screen.AgencyService; import com.epmet.datareport.service.evaluationindex.screen.AgencyService;
import com.epmet.dto.AgencyInfoDTO; import com.epmet.dto.AgencyInfoDTO;
import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.ScreenCustomerGridDTO;
@ -67,6 +68,8 @@ public class AgencyServiceImpl implements AgencyService {
private GovOrgOpenFeignClient govOrgOpenFeignClient; private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired @Autowired
private OperCrmOpenFeignClient operCrmOpenFeignClient; private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Autowired
private DataReportRedis dataReportRedis;
/** /**
* @Description 1组织机构树 * @Description 1组织机构树
@ -371,7 +374,12 @@ public class AgencyServiceImpl implements AgencyService {
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true) @DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override @Override
public AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO) { public AgencyDetailMulticResultDTO queryAgencyDetailMultiC(AgencyDetailMulticFormDTO formDTO) {
AgencyDetailMulticResultDTO agencysResultDTO = new AgencyDetailMulticResultDTO(); AgencyDetailMulticResultDTO agencysResultDTO =dataReportRedis.queryAgencyDetailMulticResultDTO(formDTO.getCustomerId(),formDTO.getAgencyId());
if (null != agencysResultDTO) {
log.info("queryAgencyDetailMultiC从redis取值入参:"+ JSON.toJSONString(formDTO));
return agencysResultDTO;
}
agencysResultDTO = new AgencyDetailMulticResultDTO();
List<ParentListResultDTO> parentList = new ArrayList<>(); List<ParentListResultDTO> parentList = new ArrayList<>();
agencysResultDTO.setParentList(parentList); agencysResultDTO.setParentList(parentList);
@ -405,7 +413,6 @@ public class AgencyServiceImpl implements AgencyService {
if(agencysResultDTO.getHaveSubCustomer()){ if(agencysResultDTO.getHaveSubCustomer()){
// 5、多客户时根据area_code查询上级,自下向上,查询到当前客户的跟组织即可stop // 5、多客户时根据area_code查询上级,自下向上,查询到当前客户的跟组织即可stop
// TODO
log.info("多客户版本parentList、level要重新赋值"); log.info("多客户版本parentList、level要重新赋值");
ScreenCustomerAgencyDTO parentAgency=screenCustomerAgencyDao.selectByAreaCode(agencysResultDTO.getParentAreaCode()); ScreenCustomerAgencyDTO parentAgency=screenCustomerAgencyDao.selectByAreaCode(agencysResultDTO.getParentAreaCode());
agencysResultDTO.setLevel(getAgencyLevelMultiC(parentAgency)); agencysResultDTO.setLevel(getAgencyLevelMultiC(parentAgency));
@ -429,6 +436,7 @@ public class AgencyServiceImpl implements AgencyService {
agencysResultDTO.setParentList(screenCustomerAgencyDao.selectPAgencyById(pidList)); agencysResultDTO.setParentList(screenCustomerAgencyDao.selectPAgencyById(pidList));
} }
} }
dataReportRedis.setAgencyDetailMulticResultDTO(formDTO.getCustomerId(),formDTO.getAgencyId(),agencysResultDTO);
return agencysResultDTO; return agencysResultDTO;
} }

32
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/redis/CustomerRedis.java

@ -17,10 +17,15 @@
package com.epmet.redis; package com.epmet.redis;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.dto.CustomerDTO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.Map;
/** /**
* 客户表 * 客户表
* *
@ -32,6 +37,11 @@ public class CustomerRedis {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
/**
* 客户信息rediskey前缀
*/
private String customerInfoKeyPref="epmet:customer:info:";
public void delete(Object[] ids) { public void delete(Object[] ids) {
} }
@ -44,4 +54,26 @@ public class CustomerRedis {
return null; return null;
} }
/**
* 查询客户基本信息
*/
public CustomerDTO queryCustomerInfo(String customerId) {
String customerInfoKey=customerInfoKeyPref.concat(customerId);
Map<String, Object> customerDtoMap = redisUtils.hGetAll(customerInfoKey);
if (MapUtil.isEmpty(customerDtoMap)) {
return null;
}
CustomerDTO customerDTO = BeanUtil.mapToBean(customerDtoMap, CustomerDTO.class, true);
return customerDTO;
}
/**
* 将客户基本信息放到redis有效期一天
*/
public void saveCustomerInfo(String customerId, CustomerDTO data) {
String customerInfoKey = customerInfoKeyPref.concat(customerId);
Map<String, Object> customerDtoMap = BeanUtil.beanToMap(data);
redisUtils.hMSet(customerInfoKey, customerDtoMap,RedisUtils.DEFAULT_EXPIRE);
}
} }

23
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerRelationServiceImpl.java

@ -27,14 +27,20 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.CustomerRelationDao; import com.epmet.dao.CustomerRelationDao;
import com.epmet.dto.CustomerDTO;
import com.epmet.dto.CustomerRelationDTO; import com.epmet.dto.CustomerRelationDTO;
import com.epmet.entity.CustomerRelationEntity; import com.epmet.entity.CustomerRelationEntity;
import com.epmet.redis.CustomerRedis;
import com.epmet.service.CustomerRelationService; import com.epmet.service.CustomerRelationService;
import com.epmet.service.CustomerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -48,6 +54,10 @@ import java.util.Map;
@Slf4j @Slf4j
@Service @Service
public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelationDao, CustomerRelationEntity> implements CustomerRelationService { public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelationDao, CustomerRelationEntity> implements CustomerRelationService {
@Autowired
private CustomerRedis customerRedis;
@Autowired
private CustomerService customerService;
@Override @Override
public PageData<CustomerRelationDTO> page(Map<String, Object> params) { public PageData<CustomerRelationDTO> page(Map<String, Object> params) {
@ -146,7 +156,18 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
**/ **/
@Override @Override
public List<String> getAllSubCustomerIds(String customerId) { public List<String> getAllSubCustomerIds(String customerId) {
return baseDao.selectAllSubCustomerIds(customerId); CustomerDTO customerDTO = customerRedis.queryCustomerInfo(customerId);
if (null != customerDTO) {
return customerDTO.getSubCustomerIds();
}
CustomerDTO data = customerService.get(customerId);
if (null != data) {
data.setSubCustomerIds(baseDao.selectAllSubCustomerIds(customerId));
data.setHaveSubCustomer(CollectionUtils.isNotEmpty(data.getSubCustomerIds()) ? true : false);
customerRedis.saveCustomerInfo(customerId, data);
return data.getSubCustomerIds();
}
return new ArrayList<>();
} }
} }
Loading…
Cancel
Save