|
|
@ -32,6 +32,7 @@ import com.epmet.commons.tools.redis.RedisKeys; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
|
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.security.user.LoginUserUtil; |
|
|
|
import com.epmet.commons.tools.utils.*; |
|
|
@ -732,7 +733,6 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
|
|
|
|
/** |
|
|
|
* @param formDTO |
|
|
|
* @param tokenDto |
|
|
|
* @Description 【地图配置】组织查询 |
|
|
|
* 根据level查询去查询不同的表,类型,组织:agency,网格:grid,小区:neighborHood |
|
|
|
* 组织类型去查 customer_agency,看本级是不是 community,是,下级组织就是网格,查询customer_grid,不是,继续查customer_agency |
|
|
@ -743,19 +743,35 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
* @date 2021/10/25 10:50 上午 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO, TokenDto tokenDto) { |
|
|
|
public MapOrgResultDTO mapOrg(MapOrgFormDTO formDTO) { |
|
|
|
MapOrgResultDTO result = new MapOrgResultDTO(); |
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> qw = new LambdaQueryWrapper(); |
|
|
|
qw.eq(CustomerAgencyEntity::getPid, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getDelFlag, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getCustomerId, tokenDto.getCustomerId()); |
|
|
|
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectOne(qw); |
|
|
|
|
|
|
|
String customerId = null; |
|
|
|
|
|
|
|
if (StringUtils.isBlank(formDTO.getOrgId())) { |
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); |
|
|
|
// 没有传参,则使用当前用户所属组织
|
|
|
|
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo((customerId = EpmetRequestHolder.getLoginUserCustomerId()), EpmetRequestHolder.getLoginUserId()); |
|
|
|
if (null == staffInfo) { |
|
|
|
return result; |
|
|
|
} |
|
|
|
formDTO.setOrgId(staffInfo.getAgencyId()); |
|
|
|
formDTO.setLevel(OrgInfoConstant.AGENCY); |
|
|
|
} else { |
|
|
|
// 前段传递了,那就用前端传递的level和orgId,并且查出来这个组织的客户id,用于后面查询跟组织中心点
|
|
|
|
if (OrgInfoConstant.AGENCY.equals(formDTO.getLevel())) { |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); |
|
|
|
customerId = agencyInfo.getCustomerId(); |
|
|
|
} else if (OrgInfoConstant.GRID.equals(formDTO.getLevel())) { |
|
|
|
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(formDTO.getOrgId()); |
|
|
|
customerId = gridInfo.getCustomerId(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 查询客户跟组织中心点
|
|
|
|
LambdaQueryWrapper<CustomerAgencyEntity> qw = new LambdaQueryWrapper(); |
|
|
|
qw.eq(CustomerAgencyEntity::getPid, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getDelFlag, NumConstant.ZERO_STR).eq(CustomerAgencyEntity::getCustomerId, customerId); |
|
|
|
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectOne(qw); |
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(customerAgencyEntity.getLatitude())) { |
|
|
|
result.setLatitude(new BigDecimal(customerAgencyEntity.getLatitude())); |
|
|
|
} |
|
|
|