Browse Source

Merge remote-tracking branch 'origin_elink/yantai_zhengwu_master'

dev
yinzuomei 2 years ago
parent
commit
a05d9a03dd
  1. 33
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/ChooseGridFormDTO.java
  2. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  3. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerAgencyDao.java
  4. 7
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java
  5. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  6. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java
  7. 9
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  8. 196
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  9. 65
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

33
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/yt/ChooseGridFormDTO.java

@ -0,0 +1,33 @@
package com.epmet.dto.form.yt;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
/**
* @Description
* @Author yzm
* @Date 2023/4/19 14:13
*/
@Data
public class ChooseGridFormDTO extends PageFormDTO {
/**
* 客户id
*/
private String customerId;
/**
* 组织id
*/
private String agencyId;
/**
* 网格id
*/
private String gridId;
/**
* 楼栋名
*/
private String buildingName;
}

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java

@ -40,6 +40,7 @@ import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.NeighborHoodOptionFormDTO;
import com.epmet.dto.form.yt.ChooseGridFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
@ -183,8 +184,10 @@ public class IcNeighborHoodController {
* @date 2022/8/19 15:56
*/
@PostMapping("neighborhoodlist")
public Result<List<BuildingResultDTO>> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody IcNeighborHoodDTO dto) {
return new Result<List<BuildingResultDTO>>().ok(icNeighborHoodService.getNeighborhoodList(tokenDto, dto));
public Result<List<BuildingResultDTO>> getNeighborhoodList(@LoginUser TokenDto tokenDto, @RequestBody ChooseGridFormDTO dto) {
ValidatorUtils.validateEntity(dto, ChooseGridFormDTO.AddUserInternalGroup.class);
dto.setCustomerId(tokenDto.getCustomerId());
return new Result<List<BuildingResultDTO>>().ok(icNeighborHoodService.getNeighborhoodList(dto));
}
/**

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

@ -436,6 +436,8 @@ public interface CustomerAgencyDao extends BaseDao<CustomerAgencyEntity> {
List<AgencyCountCensusResultDTO> agencyCount(@Param("pids") String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
Integer communityCount(@Param("pids") String pids);
Integer agencyGridCount(@Param("pids") String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);
Integer agencyStaffCount(@Param("pids") String pids,@Param("timeStart")Date timeStart,@Param("timeEnd")Date timeEnd);

7
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcBuildingDao.java

@ -19,7 +19,6 @@ package com.epmet.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.ImportGeneralDTO;
import com.epmet.dto.form.CheckHouseInfoFormDTO;
import com.epmet.dto.form.IcBuildingListFormDTO;
@ -240,12 +239,14 @@ public interface IcBuildingDao extends BaseDao<IcBuildingEntity> {
/**
* 展示所有楼栋和小区信息
*
* @param dto
* @return java.util.List<com.epmet.dto.result.BuildingResultDTO>
* @author zhy
* @date 2022/8/19 17:32
*/
List<BuildingResultDTO> listBuildingInfo(IcNeighborHoodDTO dto);
List<BuildingResultDTO> listBuildingInfo(@Param("customerId")String customerId,
@Param("agencyId")String agencyId,
@Param("gridId") String gridId,
@Param("buildingName")String buildingName);
/**

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

@ -20,7 +20,6 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.dto.result.OptionResultDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcNeighborHoodDTO;
import com.epmet.dto.ImportGeneralDTO;
@ -28,6 +27,7 @@ import com.epmet.dto.NeighborHoodAndManagementDTO;
import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.NeighborHoodOptionFormDTO;
import com.epmet.dto.form.yt.ChooseGridFormDTO;
import com.epmet.dto.result.BuildingResultDTO;
import com.epmet.dto.result.IcNeighborHoodDetailDTO;
import com.epmet.dto.result.ImportTaskCommonResultDTO;
@ -123,13 +123,12 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
/**
* 获取用户组织下小区列表
*
* @param tokenDto
* @param dto
* @return java.util.List<com.epmet.dto.BuildingResultDTO>
* @author zhy
* @date 2022/8/19 15:57
*/
List<BuildingResultDTO> getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto);
List<BuildingResultDTO> getNeighborhoodList(ChooseGridFormDTO dto);
/**
* @Description 通过ID查询小区信息

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java

@ -1147,12 +1147,15 @@ public class AgencyServiceImpl implements AgencyService {
calendar.set(Calendar.MILLISECOND, 0);
Date endTime = calendar.getTime();
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
/* AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
agencyOrgIdPath = getOrgIdPath(agencyInfo.getPids(), agencyInfo.getId());
List<String> currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null);
List<String> currentUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, null);*/
// List<String> preferUsingCommunityList = customerAgencyDao.getUsingCommunityList(customerId, orgId, agencyOrgIdPath, endTime);
// return new UsingCommunityStatsResultDTO(currentUsingCommunityList.size(), currentUsingCommunityList.size() - preferUsingCommunityList.size());
return new UsingCommunityStatsResultDTO(currentUsingCommunityList.size(), 0);
CustomerAgencyEntity customerAgency = customerAgencyDao.selectById(orgId);
String pids = PidUtils.convertPid2OrgIdPath(customerAgency.getId(),customerAgency.getPids());
return new UsingCommunityStatsResultDTO(customerAgencyDao.communityCount(pids), 0);
} else if ("grid".equals(orgType)) {
// 网格下不会有该数据,给个0
return new UsingCommunityStatsResultDTO(0, 0);

9
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -44,7 +44,6 @@ 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.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.CustomerGridConstant;
@ -55,6 +54,7 @@ import com.epmet.dto.form.IcNeighborHoodAddFormDTO;
import com.epmet.dto.form.ImportInfoFormDTO;
import com.epmet.dto.form.ImportTaskCommonFormDTO;
import com.epmet.dto.form.NeighborHoodOptionFormDTO;
import com.epmet.dto.form.yt.ChooseGridFormDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.*;
import com.epmet.excel.IcNeighborHoodExcel;
@ -242,8 +242,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
return datas;
}
public List<BuildingResultDTO> getNeighborhoodList(TokenDto tokenDto, IcNeighborHoodDTO dto) {
dto.setCustomerId(tokenDto.getCustomerId());
public List<BuildingResultDTO> getNeighborhoodList(ChooseGridFormDTO dto) {
// if (StringUtils.isBlank(dto.getAgencyId()) && StringUtils.isEmpty(dto.getGridId())) {
// log.info("agencyId与gridId都为空时,默认查询当前工作人员所属组织下的小区");
// CustomerStaffInfoCacheResult result= CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
@ -253,7 +252,9 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
// }
// dto.setAgencyId(result.getAgencyId());
// }
return icBuildingDao.listBuildingInfo(dto);
PageHelper.startPage(dto.getPageNo(), dto.getPageSize());
List<BuildingResultDTO> list = icBuildingDao.listBuildingInfo(dto.getCustomerId(), dto.getAgencyId(), dto.getGridId(), dto.getBuildingName());
return list;
}
/**

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

@ -899,6 +899,16 @@
</select>
<select id="communityCount" resultType="java.lang.Integer">
select count(1)
from customer_agency agency
where agency.DEL_FLAG = 0
and agency.LEVEL = 'community'
and agency.PIDS like concat(#{pids},'%')
</select>
<select id="agencyGridCount" resultType="java.lang.Integer">
select count(*)
@ -1112,102 +1122,102 @@
select t.ID
from (select ca.ID
, ca.CREATED_TIME created_time
, count(csa.ID) community_count
from customer_agency ca
inner join customer_staff_agency csa on (ca.ID = csa.AGENCY_ID and csa.DEL_FLAG = 0)
where ca.DEL_FLAG = 0
and ca.CUSTOMER_ID=#{customerId}
and ca.LEVEL = 'community'
<if test="endDate != null">
and csa.CREATED_TIME <![CDATA[<]]> #{endDate}
</if>
and (ca.ID = #{agencyId} or ca.PIDS like CONCAT(#{agencyOrgIdPath}, '%'))
group by ca.ID, ca.CREATED_TIME
having community_count > 0
order by created_time desc) t
</select>
<select id="getCurrentUserCommunityInfo"
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName
from customer_agency
where DEL_FLAG = 0
and LEVEL = 'community'
AND CUSTOMER_ID = #{customerId}
<if test="staffAgencyId != null and staffAgencyId != ''">
AND (PIDS like concat('%',#{staffAgencyId},'%') or ID = #{staffAgencyId})
, count(ca.ID) community_count
from customer_agency ca
<!--inner join customer_staff_agency csa on (ca.ID = csa.AGENCY_ID and csa.DEL_FLAG = 0)-->
where ca.DEL_FLAG = 0
and ca.CUSTOMER_ID=#{customerId}
and ca.LEVEL = 'community'
<if test="endDate != null">
and ca.CREATED_TIME <![CDATA[<]]> #{endDate}
</if>
and (ca.ID = #{agencyId} or ca.PIDS like CONCAT(#{agencyOrgIdPath}, '%'))
group by ca.ID, ca.CREATED_TIME
having community_count > 0
order by created_time desc) t
</select>
<select id="getCurrentUserCommunityInfo"
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO">
select
ID AS orgId,
ORGANIZATION_NAME AS orgName
from customer_agency
where DEL_FLAG = 0
and LEVEL = 'community'
AND CUSTOMER_ID = #{customerId}
<if test="staffAgencyId != null and staffAgencyId != ''">
AND (PIDS like concat('%',#{staffAgencyId},'%') or ID = #{staffAgencyId})
</if>
</select>
<select id="selectAgencyTree" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
SELECT
ca.ID as id,
ca.ORGANIZATION_NAME as label,
ca.LONGITUDE as longitude,
ca.LATITUDE as latitude,
ca.`LEVEL` as level,
ca.PID as pId,
'agency' AS orgType
FROM
customer_agency ca
WHERE
ca.ID = #{agencyId}
AND ca.DEL_FLAG = '0'
</select>
</select>
<select id="selectAgencyTree" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
SELECT
ca.ID as id,
<select id="selectNextOrg" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
(SELECT ca.ID as id,
ca.ORGANIZATION_NAME as label,
ca.LONGITUDE as longitude,
ca.LATITUDE as latitude,
ca.`LEVEL` as level,
ca.PID as pId,
'agency' AS orgType
FROM
customer_agency ca
WHERE
ca.ID = #{agencyId}
AND ca.DEL_FLAG = '0'
</select>
<select id="selectNextOrg" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO">
(SELECT ca.ID as id,
ca.ORGANIZATION_NAME as label,
ca.LONGITUDE as longitude,
ca.LATITUDE as latitude,
ca.`LEVEL` as level,
ca.PID as pId,
'agency' AS orgType
FROM customer_agency ca
WHERE ca.PID = #{agencyId}
AND ca.DEL_FLAG = '0'
ORDER BY CAST(ca.organization_name AS SIGNED), CONVERT(ca.organization_name using gbk))
union all
(SELECT cg.id,
cg.GRID_NAME AS label,
cg.LONGITUDE,
cg.LATITUDE,
'grid' AS LEVEL,
cg.PID,
'grid' AS orgType
FROM customer_grid cg
WHERE cg.DEL_FLAG = '0'
AND cg.PID = #{agencyId}
ORDER BY cg.sort, CAST(cg.GRID_NAME AS SIGNED), CONVERT(cg.GRID_NAME using gbk))
</select>
<select id="selectTotalNext" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
sum( t.total )
FROM
(
SELECT
count( a.id ) AS total
FROM
customer_agency a
WHERE
a.PID = #{agencyId}
AND a.DEL_FLAG = '0'
UNION all
SELECT
count( g.id ) AS total
FROM
customer_grid g
WHERE
g.PID = #{agencyId}
AND g.DEL_FLAG = '0'
) t
</select>
<!-- 获取当前客户下所有的社区组织,只返回id,orgIdPath,agencyName -->
ca.LONGITUDE as longitude,
ca.LATITUDE as latitude,
ca.`LEVEL` as level,
ca.PID as pId,
'agency' AS orgType
FROM customer_agency ca
WHERE ca.PID = #{agencyId}
AND ca.DEL_FLAG = '0'
ORDER BY CAST(ca.organization_name AS SIGNED), CONVERT(ca.organization_name using gbk))
union all
(SELECT cg.id,
cg.GRID_NAME AS label,
cg.LONGITUDE,
cg.LATITUDE,
'grid' AS LEVEL,
cg.PID,
'grid' AS orgType
FROM customer_grid cg
WHERE cg.DEL_FLAG = '0'
AND cg.PID = #{agencyId}
ORDER BY cg.sort, CAST(cg.GRID_NAME AS SIGNED), CONVERT(cg.GRID_NAME using gbk))
</select>
<select id="selectTotalNext" parameterType="java.lang.String" resultType="java.lang.Integer">
SELECT
sum( t.total )
FROM
(
SELECT
count( a.id ) AS total
FROM
customer_agency a
WHERE
a.PID = #{agencyId}
AND a.DEL_FLAG = '0'
UNION all
SELECT
count( g.id ) AS total
FROM
customer_grid g
WHERE
g.PID = #{agencyId}
AND g.DEL_FLAG = '0'
) t
</select>
<!-- 获取当前客户下所有的社区组织,只返回id,orgIdPath,agencyName -->
<select id="getAllCommunity" parameterType="java.lang.String" resultType="com.epmet.dto.result.AgencyResultDTO">
SELECT
ca.id agencyId,

65
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml

@ -507,38 +507,41 @@
<select id="listBuildingInfo" resultType="com.epmet.dto.result.BuildingResultDTO">
SELECT
CONCAT( n.NEIGHBOR_HOOD_NAME, b.BUILDING_NAME ) AS label,
b.id AS buildingId,
b.BUILDING_NAME AS buildingName,
n.id AS neighborhoodId,
n.NEIGHBOR_HOOD_NAME AS neighborhoodName,
n.GRID_ID,
g.GRID_NAME,
a.ALL_PARENT_NAME,
a.ORGANIZATION_NAME AS AGENCY_NAME,
n.CUSTOMER_ID
FROM
ic_building b
LEFT JOIN ic_neighbor_hood n ON b.NEIGHBOR_HOOD_ID = n.id
LEFT JOIN customer_grid g ON n.GRID_ID = g.id
LEFT JOIN customer_agency a ON a.id = g.pid
CONCAT( n.NEIGHBOR_HOOD_NAME, b.BUILDING_NAME ) AS label,
b.id AS buildingId,
b.BUILDING_NAME AS buildingName,
n.id AS neighborhoodId,
n.NEIGHBOR_HOOD_NAME AS neighborhoodName,
n.GRID_ID,
g.GRID_NAME,
a.ALL_PARENT_NAME,
a.ORGANIZATION_NAME AS AGENCY_NAME,
n.CUSTOMER_ID
FROM ic_building b
LEFT JOIN ic_neighbor_hood n
ON b.NEIGHBOR_HOOD_ID = n.id
LEFT JOIN customer_grid g
ON n.GRID_ID = g.id
LEFT JOIN customer_agency a
ON a.id = g.pid
WHERE
n.DEL_FLAG = '0'
AND b.DEL_FLAG = '0'
AND g.DEL_FLAG = '0'
AND a.DEL_FLAG = '0'
AND n.CUSTOMER_ID = #{customerId}
<if test="gridId != null and gridId != ''">
AND n.GRID_ID = #{gridId}
</if>
<if test="buildingName != null and buildingName != ''">
AND (n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%') OR b.BUILDING_NAME LIKE CONCAT('%', #{buildingName}, '%'))
</if>
<if test="agencyId != null and agencyId != ''">
AND (
n.AGENCY_ID = #{agencyId}
OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%'))
</if>
n.DEL_FLAG = '0'
AND b.DEL_FLAG = '0'
AND g.DEL_FLAG = '0'
AND a.DEL_FLAG = '0'
AND n.CUSTOMER_ID = #{customerId}
<if test="gridId != null and gridId != ''">
AND n.GRID_ID = #{gridId}
</if>
<if test="buildingName != null and buildingName != ''">
AND n.NEIGHBOR_HOOD_NAME LIKE CONCAT('%', #{buildingName}, '%')
</if>
<if test="agencyId != null and agencyId != ''">
AND (
n.AGENCY_ID = #{agencyId}
OR n.AGENCY_PIDS LIKE CONCAT('%', #{agencyId}, '%'))
</if>
order by n.CREATED_TIME asc,n.id asc
</select>
<select id="getBuildingInfoByName" resultType="com.epmet.entity.IcBuildingEntity"

Loading…
Cancel
Save