Browse Source

从跟组织开始查询组织网格树

master
sunyuchao 4 years ago
parent
commit
5500927187
  1. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java
  2. 10
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  3. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  4. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/AgencydetailFormDTO.java

@ -17,6 +17,7 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.CustomerClientShowGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@ -36,7 +37,7 @@ public class AgencydetailFormDTO implements Serializable {
/**
* 内部错误分组
* */
public interface AddUserInternalGroup{}
public interface AddUserInternalGroup extends CustomerClientShowGroup {}
/**
* 机关组织Id

10
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -405,4 +405,14 @@ public class CustomerAgencyController {
return new Result<IcResiUserOrgMsgResultDTO>().ok(customerAgencyService.icResiUserOrgMsg(formDTO));
}
/**
* @Description根据组织Id查询扇形组织网格树
* @author sun
**/
@PostMapping("rootagencygridtree")
public Result<AgencyTreeResultDTO> rootAgencyGridTree(@RequestBody AgencydetailFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, AgencydetailFormDTO.AddUserInternalGroup.class);
return new Result<AgencyTreeResultDTO>().ok(customerAgencyService.rootAgencyGridTree(formDTO.getAgencyId()));
}
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java

@ -283,4 +283,9 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
**/
IcResiUserOrgMsgResultDTO icResiUserOrgMsg(IcResiUserOrgMsgFormDTO formDTO);
/**
* @Description根据组织Id查询扇形组织网格树
* @author sun
**/
AgencyTreeResultDTO rootAgencyGridTree(String agencyId);
}

35
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java

@ -30,6 +30,8 @@ import com.epmet.commons.tools.exception.RenException;
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.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant;
@ -1401,4 +1403,37 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
return resultDTO;
}
/**
* @Description根据组织Id查询扇形组织网格树
* @author sun
**/
@Override
public AgencyTreeResultDTO rootAgencyGridTree(String agencyId) {
AgencyTreeResultDTO result = new AgencyTreeResultDTO();
//1.查询组织缓存信息
AgencyInfoCache rootAgency = CustomerOrgRedis.getAgencyInfo(agencyId);
if (null == rootAgency) {
throw new RenException(String.format("查询组织信息失败%s", agencyId));
}
result.setPid(rootAgency.getPid());
result.setAgencyId(rootAgency.getId());
result.setAgencyName(rootAgency.getOrganizationName());
result.setLevel(rootAgency.getLevel());
result.setOrgLevel(rootAgency.getId().concat("-").concat(rootAgency.getLevel()));
result.setLongitude(rootAgency.getLongitude());
result.setLatitude(rootAgency.getLatitude());
String orgTreeCacheKey = RedisKeys.getOrgTreeCacheKey(rootAgency.getId());
Object o = redisUtils.get(orgTreeCacheKey);
if (o == null) {
ExtStaffPermissionResultDTO res = baseDao.selectAgencyAndGridById(rootAgency.getId());
convert2AgencyTreeResult(result, res.getSubAgencyList(), res.getGridList());
redisUtils.set(orgTreeCacheKey, result, RedisUtils.MINUTE_THIRTY_EXPIRE);
} else {
result = (AgencyTreeResultDTO) o;
}
return result;
}
}

Loading…
Cancel
Save