|
@ -17,6 +17,7 @@ |
|
|
|
|
|
|
|
|
package com.epmet.service.impl; |
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
@ -26,6 +27,8 @@ import com.epmet.commons.tools.constant.StrConstant; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
|
|
import com.epmet.commons.tools.redis.RedisUtils; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
@ -77,6 +80,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
@Autowired |
|
|
@Autowired |
|
|
private CustomerGridDao customerGridDao; |
|
|
private CustomerGridDao customerGridDao; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private RedisUtils redisUtils; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<CustomerGridDTO> page(Map<String, Object> params) { |
|
|
public PageData<CustomerGridDTO> page(Map<String, Object> params) { |
|
|
IPage<CustomerGridEntity> page = baseDao.selectPage( |
|
|
IPage<CustomerGridEntity> page = baseDao.selectPage( |
|
@ -712,13 +718,23 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO) { |
|
|
public CustomerGridDTO getBaseInfo(CustomerGridFormDTO customerGridFormDTO) { |
|
|
CustomerGridDTO restltDTO = ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class); |
|
|
String redisKey = RedisKeys.getGridByIdKey(customerGridFormDTO.getGridId()); |
|
|
if (null != restltDTO) { |
|
|
Map<String, Object> gridCache = redisUtils.hGetAll(redisKey); |
|
|
CustomerAgencyEntity entity = customerAgencyService.selectById(restltDTO.getPid()); |
|
|
if (gridCache != null && gridCache.size() > 0) { |
|
|
restltDTO.setAgencyName(null != entity ? entity.getOrganizationName() : ""); |
|
|
// 直接取缓存中的
|
|
|
|
|
|
CustomerGridDTO gridInfo = BeanUtil.mapToBean(gridCache, CustomerGridDTO.class, true); |
|
|
|
|
|
return gridInfo; |
|
|
} |
|
|
} |
|
|
return new Result<CustomerGridDTO>().ok(restltDTO); |
|
|
|
|
|
|
|
|
CustomerGridDTO gridInfo = ConvertUtils.sourceToTarget(baseDao.selectById(customerGridFormDTO.getGridId()), CustomerGridDTO.class); |
|
|
|
|
|
if (null != gridInfo) { |
|
|
|
|
|
CustomerAgencyEntity entity = customerAgencyService.selectById(gridInfo.getPid()); |
|
|
|
|
|
gridInfo.setAgencyName(null != entity ? entity.getOrganizationName() : ""); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
redisUtils.hMSet(redisKey, BeanUtil.beanToMap(gridInfo)); |
|
|
|
|
|
return gridInfo; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|