Browse Source

返回下级组织数量

master
lichao 2 years ago
parent
commit
e7d4e4a302
  1. 3
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java
  2. 11
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  3. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  4. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerAgencyService.java
  5. 33
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerAgencyServiceImpl.java
  6. 27
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

3
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyCountCensusResultDTO.java

@ -1,5 +1,7 @@
package com.epmet.dto.result; package com.epmet.dto.result;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
/** /**
@ -8,6 +10,7 @@ import java.io.Serializable;
* @Date 2023/4/6 16:46 * @Date 2023/4/6 16:46
* @Author lichao * @Author lichao
**/ **/
@Data
public class AgencyCountCensusResultDTO implements Serializable { public class AgencyCountCensusResultDTO implements Serializable {
private static final long serialVersionUID = 4360690752084258055L; private static final long serialVersionUID = 4360690752084258055L;

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

@ -517,7 +517,13 @@ public class CustomerAgencyController {
return customerAgencyService.getCurrentUserCommunityInfo(tokenDTO); return customerAgencyService.getCurrentUserCommunityInfo(tokenDTO);
} }
/**
* @Description: 返回下级数量统计
* @param agencyId:
* @Return com.epmet.commons.tools.utils.Result<java.util.List < com.epmet.dto.result.AgencyCountCensusResultDTO>>
* @Author: lichao
* @Date: 2023/4/7 14:48
*/
@GetMapping("getAgencyCountList") @GetMapping("getAgencyCountList")
public Result<List<AgencyCountCensusResultDTO>> getAgencyCountList(@RequestParam String agencyId){ public Result<List<AgencyCountCensusResultDTO>> getAgencyCountList(@RequestParam String agencyId){
return new Result<List<AgencyCountCensusResultDTO>>().ok(customerAgencyService.getAgencyCountList(agencyId)); return new Result<List<AgencyCountCensusResultDTO>>().ok(customerAgencyService.getAgencyCountList(agencyId));
@ -525,4 +531,7 @@ public class CustomerAgencyController {
} }

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java

@ -430,6 +430,10 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
*/ */
List<AgencyResultDTO> getAllCommunity(String customerId); List<AgencyResultDTO> getAllCommunity(String customerId);
Integer agencyCount(@Param("pids") String pids,@Param("level") String level); List<AgencyCountCensusResultDTO> agencyCount(@Param("pids") String pids);
Integer agencyGridCount(@Param("pids") String pids);
Integer agencyStaffCount(@Param("pids") String pids);
} }

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

@ -362,5 +362,11 @@ public interface CustomerAgencyService extends BaseService<CustomerAgencyEntity>
* @return * @return
*/ */
String getOrgIdPath(String orgId); String getOrgIdPath(String orgId);
/**
* 返回下级数量
* @param agencyId
* @return
*/
List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId); List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId);
} }

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

@ -37,6 +37,7 @@ 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.AgencyInfoCache;
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;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerAgencyConstant; import com.epmet.constant.CustomerAgencyConstant;
import com.epmet.constant.CustomerGridConstant; import com.epmet.constant.CustomerGridConstant;
@ -1624,6 +1625,14 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
} }
return customerAgencyEntity.getPids().concat(StrConstant.COLON).concat(orgId); return customerAgencyEntity.getPids().concat(StrConstant.COLON).concat(orgId);
} }
/**
* @Description:
* @param agencyId:
* @Return java.util.List<com.epmet.dto.result.AgencyCountCensusResultDTO>
* @Author: lichao
* @Date: 2023/4/7 14:17
*/
@Override @Override
public List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId) { public List<AgencyCountCensusResultDTO> getAgencyCountList(String agencyId) {
@ -1631,23 +1640,21 @@ public class CustomerAgencyServiceImpl extends BaseServiceImpl<CustomerAgencyDao
CustomerAgencyEntity customerAgency = baseDao.selectById(agencyId); CustomerAgencyEntity customerAgency = baseDao.selectById(agencyId);
if (customerAgency != null){ if (customerAgency != null){
// pidu String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids());
// 区县级 agencyCountCensusResultDTOS = baseDao.agencyCount(pids);
if (customerAgency.getLevel().equals("district")){ AgencyCountCensusResultDTO agencyCountCensusResultDTOGrid = new AgencyCountCensusResultDTO();
// Integer count = baseDao.agencyCount() agencyCountCensusResultDTOGrid.setLevel("grid");
// 镇街级 agencyCountCensusResultDTOGrid.setCount(baseDao.agencyGridCount(pids));
}else if (customerAgency.getLevel().equals("street")){ agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOGrid);
AgencyCountCensusResultDTO agencyCountCensusResultDTOStaff = new AgencyCountCensusResultDTO();
}else{ agencyCountCensusResultDTOStaff.setLevel("staff");
agencyCountCensusResultDTOStaff.setCount(baseDao.agencyStaffCount(pids));
agencyCountCensusResultDTOS.add(agencyCountCensusResultDTOStaff);
}
}else{ }else{
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"获取用户组织信息异常","获取用户组织信息异常");
} }
return agencyCountCensusResultDTOS; return agencyCountCensusResultDTOS;
} }

27
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -863,13 +863,34 @@
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
AND pids LIKE concat('%',#{agencyId}, '%' ) AND pids LIKE concat('%',#{agencyId}, '%' )
</update> </update>
<select id="agencyCount" resultType="java.lang.Integer"> <select id="agencyCount" resultType="com.epmet.dto.result.AgencyCountCensusResultDTO">
select count(*) select level,count(*)
from customer_agency from customer_agency
where DEL_FLAG = 0 where DEL_FLAG = 0
and LEVEL = #{level}
and PIDS like concat(#{pids},'%') and PIDS like concat(#{pids},'%')
group by level
</select>
<select id="agencyGridCount" resultType="java.lang.Integer">
select count(*)
from customer_grid
where DEL_FLAG = 0
and PIDS like concat(#{pids},'%')
</select>
<select id="agencyStaffCount" resultType="java.lang.Integer">
select count(1)
from customer_staff_agency staff
left join customer_agency agency on staff.AGENCY_ID = agency.ID
where agency.DEL_FLAG = 0
and
staff.DEL_FLAG = 0
and agency.PIDS like concat(#{pids},'%')
</select> </select>

Loading…
Cancel
Save