Browse Source

居民、事件、资源详情

master
zxc 3 years ago
parent
commit
d776d6aa55
  1. 4
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/CoverageHomeSearchFormDTO.java
  2. 39
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SearchDetailFormDTO.java
  3. 28
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java
  4. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/CoverageService.java
  5. 77
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java
  6. 98
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/IcCityManagementDao.xml

4
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/CoverageHomeSearchFormDTO.java

@ -37,4 +37,8 @@ public class CoverageHomeSearchFormDTO extends PageFormDTO implements Serializab
* searchType为resource时此字段必填 * searchType为resource时此字段必填
*/ */
private String resourceType; private String resourceType;
private String resourceId;
private String icEventId;
private String icUserId;
} }

39
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/form/SearchDetailFormDTO.java

@ -0,0 +1,39 @@
package com.epmet.dataaggre.dto.govorg.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2022/7/29 08:48
* @DESC
*/
@Data
public class SearchDetailFormDTO implements Serializable {
private static final long serialVersionUID = 3499320376768396157L;
public interface SearchUserDetailForm{}
public interface SearchEventDetailForm{}
public interface SearchResourceDetailForm{}
@NotBlank(message = "icUserId不能为空",groups = SearchUserDetailForm.class)
private String icUserId;
@NotBlank(message = "icEventId不能为空",groups = SearchEventDetailForm.class)
private String icEventId;
@NotBlank(message = "resourceId不能为空",groups = SearchResourceDetailForm.class)
private String resourceId;
/**
* 资源类型社区自组织community_org;优势资源:superior_resource;城市管理city_management重点危化企业dangerous_chemicals公共服务public_service企事业单位巡查enterprise_patrol
*/
@NotBlank(message = "resourceType不能为空",groups = SearchResourceDetailForm.class)
private String resourceType;
private String customerId;
}

28
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/CoverageController.java

@ -7,14 +7,14 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.coverage.AnalysisGovernedTargetsResult; import com.epmet.dataaggre.dto.coverage.AnalysisGovernedTargetsResult;
import com.epmet.dataaggre.dto.coverage.AnalysisResourceCategoriesResult; import com.epmet.dataaggre.dto.coverage.AnalysisResourceCategoriesResult;
import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListFormDTO;
import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListLeftFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListLeftFormDTO;
import com.epmet.dataaggre.dto.govorg.form.CoverageHomeSearchFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageHomeSearchFormDTO;
import com.epmet.dataaggre.dto.govorg.result.CoverageAnalisisDataListResultDTO; import com.epmet.dataaggre.dto.govorg.form.SearchDetailFormDTO;
import com.epmet.dataaggre.dto.govorg.result.CoverageAnalisisDataListResultDTOV2; import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.govorg.result.CoverageHomeSearchResultDTO;
import com.epmet.dataaggre.service.CoverageService; import com.epmet.dataaggre.service.CoverageService;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -118,4 +118,26 @@ public class CoverageController {
PageData<CoverageAnalisisDataListResultDTOV2> page = coverageService.dataListLeft(formDTO); PageData<CoverageAnalisisDataListResultDTOV2> page = coverageService.dataListLeft(formDTO);
return new Result<PageData<CoverageAnalisisDataListResultDTOV2>>().ok(page); return new Result<PageData<CoverageAnalisisDataListResultDTOV2>>().ok(page);
} }
@PostMapping("search-user-detail")
public Result<UserInfoResultDTO> searchUserDetail(@RequestBody SearchDetailFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, SearchDetailFormDTO.SearchUserDetailForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<UserInfoResultDTO>().ok(coverageService.searchUserDetail(formDTO));
}
@PostMapping("search-event-detail")
public Result<EventInfoResultDTO> searchEventDetail(@RequestBody SearchDetailFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, SearchDetailFormDTO.SearchEventDetailForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<EventInfoResultDTO>().ok(coverageService.searchEventDetail(formDTO));
}
@PostMapping("search-resource-detail")
public Result<ResourceInfoResultDTO> searchResourceDetail(@RequestBody SearchDetailFormDTO formDTO,@LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, SearchDetailFormDTO.SearchResourceDetailForm.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<ResourceInfoResultDTO>().ok(coverageService.searchResourceDetail(formDTO));
}
} }

12
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/CoverageService.java

@ -5,9 +5,8 @@ import com.epmet.dataaggre.dto.coverage.AnalysisGovernedTargetsResult;
import com.epmet.dataaggre.dto.coverage.AnalysisResourceCategoriesResult; import com.epmet.dataaggre.dto.coverage.AnalysisResourceCategoriesResult;
import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListLeftFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListLeftFormDTO;
import com.epmet.dataaggre.dto.govorg.form.CoverageHomeSearchFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageHomeSearchFormDTO;
import com.epmet.dataaggre.dto.govorg.result.CoverageAnalisisDataListResultDTO; import com.epmet.dataaggre.dto.govorg.form.SearchDetailFormDTO;
import com.epmet.dataaggre.dto.govorg.result.CoverageAnalisisDataListResultDTOV2; import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.govorg.result.CoverageHomeSearchResultDTO;
import java.util.List; import java.util.List;
@ -50,4 +49,11 @@ public interface CoverageService {
* @return * @return
*/ */
PageData<CoverageAnalisisDataListResultDTOV2> dataListLeft(CoverageAnalisisDataListLeftFormDTO formDTO); PageData<CoverageAnalisisDataListResultDTOV2> dataListLeft(CoverageAnalisisDataListLeftFormDTO formDTO);
UserInfoResultDTO searchUserDetail(SearchDetailFormDTO formDTO);
EventInfoResultDTO searchEventDetail(SearchDetailFormDTO formDTO);
ResourceInfoResultDTO searchResourceDetail(SearchDetailFormDTO formDTO);
} }

77
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java

@ -8,10 +8,14 @@ import com.epmet.commons.tools.enums.CoveragePlaceTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; 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.redis.common.bean.BuildingInfoCache; import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.EpmetRequestHolder; import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.dataaggre.constant.OrgConstant; import com.epmet.dataaggre.constant.OrgConstant;
import com.epmet.dataaggre.constant.TableConstant; import com.epmet.dataaggre.constant.TableConstant;
@ -20,6 +24,7 @@ import com.epmet.dataaggre.dto.coverage.AnalysisResourceCategoriesResult;
import com.epmet.dataaggre.dto.epmetuser.result.IcResiInfoResultDTO; import com.epmet.dataaggre.dto.epmetuser.result.IcResiInfoResultDTO;
import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListLeftFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageAnalisisDataListLeftFormDTO;
import com.epmet.dataaggre.dto.govorg.form.CoverageHomeSearchFormDTO; import com.epmet.dataaggre.dto.govorg.form.CoverageHomeSearchFormDTO;
import com.epmet.dataaggre.dto.govorg.form.SearchDetailFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*; import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.entity.epmetuser.IcResiUserEntity; import com.epmet.dataaggre.entity.epmetuser.IcResiUserEntity;
import com.epmet.dataaggre.entity.govorg.*; import com.epmet.dataaggre.entity.govorg.*;
@ -959,4 +964,76 @@ public class CoverageServiceImpl implements CoverageService {
// page.getTotal()是多少条业务数据 // page.getTotal()是多少条业务数据
return new PageData<>(list, page.getTotal()); return new PageData<>(list, page.getTotal());
} }
@Override
public UserInfoResultDTO searchUserDetail(SearchDetailFormDTO formDTO) {
CoverageHomeSearchFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CoverageHomeSearchFormDTO.class);
UserInfoResultDTO result = new UserInfoResultDTO();
List<UserInfoResultDTO> allIcUser = icResiService.getAllIcUser(dto);
if (CollectionUtils.isNotEmpty(allIcUser)){
result = allIcUser.get(NumConstant.ZERO);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(result.getGridId());
if (null == gridInfo){
throw new EpmetException("获取网格信息失败:"+result.getGridId());
}
result.setGridName(gridInfo.getGridNamePath());
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(formDTO.getCustomerId(), result.getHomeId());
if (null == houseInfo){
throw new EpmetException("获取房屋信息失败:"+result.getHomeId());
}
result.setHouseName(houseInfo.getAllName());
result.setLongitude(houseInfo.getBuildingLongitude());
result.setLatitude(houseInfo.getBuildingLatitude());
}
return result;
}
@Override
public EventInfoResultDTO searchEventDetail(SearchDetailFormDTO formDTO) {
CoverageHomeSearchFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CoverageHomeSearchFormDTO.class);
EventInfoResultDTO result = new EventInfoResultDTO();
List<EventInfoResultDTO> eventInfos = govProjectService.getEventInfos(dto);
if (CollectionUtils.isNotEmpty(eventInfos)){
result = eventInfos.get(NumConstant.ZERO);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(result.getGridId());
if (null == gridInfo){
throw new EpmetException("获取网格信息失败:"+result.getGridId());
}
result.setGridName(gridInfo.getGridNamePath());
}
return result;
}
@Override
public ResourceInfoResultDTO searchResourceDetail(SearchDetailFormDTO formDTO) {
CoverageHomeSearchFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CoverageHomeSearchFormDTO.class);
ResourceInfoResultDTO result = new ResourceInfoResultDTO();
List<ResourceInfoResultDTO> infos = new ArrayList<>();
switch (formDTO.getResourceType()){
case "community_org":
infos = heartService.getCommunitySelOrgInfos(dto);
break;
case "superior_resource":
infos = govOrgService.getSuperiorResourceInfos(dto);
break;
case "city_management":
infos = govOrgService.getCityManageInfos(dto);
break;
case "dangerous_chemicals":
infos = govOrgService.getDangerousChemicalsInfos(dto);
break;
case "public_service":
infos = govOrgService.getPublicServiceInfos(dto);
break;
case "enterprise_patrol":
infos = govOrgService.getEnterpriseInfos(dto);
break;
default:
break;
}
if (CollectionUtils.isNotEmpty(infos)){
result = infos.get(NumConstant.ZERO);
}
return result;
}
} }

98
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/IcCityManagementDao.xml

@ -18,8 +18,15 @@
IFNULL(MOBILE,'') AS MOBILE IFNULL(MOBILE,'') AS MOBILE
FROM ic_city_management FROM ic_city_management
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='resourceId != null and resourceId != "" '>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND ID = #{resourceId}
</if>
<if test='customerId != null and customerId != ""'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -40,8 +47,15 @@
IFNULL(MOBILE,'') AS MOBILE IFNULL(MOBILE,'') AS MOBILE
FROM ic_public_service FROM ic_public_service
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='resourceId != null and resourceId != "" '>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND ID = #{resourceId}
</if>
<if test='customerId != null and customerId != ""'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -60,8 +74,15 @@
ifnull(PRINCIPAL_MOBILE,'') AS mobile ifnull(PRINCIPAL_MOBILE,'') AS mobile
FROM ic_dangerous_chemicals FROM ic_dangerous_chemicals
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='resourceId != null and resourceId != "" '>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND ID = #{resourceId}
</if>
<if test='customerId != null and customerId != ""'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -80,8 +101,15 @@
ifnull(ADDRESS,'') as ADDRESS ifnull(ADDRESS,'') as ADDRESS
FROM ic_superior_resource FROM ic_superior_resource
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='resourceId != null and resourceId != "" '>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND ID = #{resourceId}
</if>
<if test='customerId != null and customerId != ""'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -99,8 +127,15 @@
ifnull(MOBILE,'') AS mobile ifnull(MOBILE,'') AS mobile
FROM ic_enterprise FROM ic_enterprise
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='resourceId != null and resourceId != "" '>
AND CONCAT(AGENCY_PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%') AND ID = #{resourceId}
</if>
<if test='customerId != null and customerId != ""'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND CONCAT(AGENCY_PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND PLACE_ORG_NAME LIKE CONCAT('%',#{name},'%') AND PLACE_ORG_NAME LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -109,8 +144,15 @@
select count(id) select count(id)
FROM ic_city_management FROM ic_city_management
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='resourceId != null and resourceId != "" '>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND ID = #{resourceId}
</if>
<if test='customerId != null and customerId != ""'>
AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -119,8 +161,12 @@
select count(id) select count(id)
FROM ic_public_service FROM ic_public_service
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='customerId != null and customerId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -129,8 +175,12 @@
select count(id) select count(id)
FROM ic_dangerous_chemicals FROM ic_dangerous_chemicals
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='customerId != null and customerId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -139,8 +189,12 @@
select count(id) select count(id)
FROM ic_superior_resource FROM ic_superior_resource
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='customerId != null and customerId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%') AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND AGENCY_ID_PATH LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND `NAME` LIKE CONCAT('%',#{name},'%') AND `NAME` LIKE CONCAT('%',#{name},'%')
</if> </if>
@ -149,8 +203,12 @@
select count(id) select count(id)
FROM ic_enterprise FROM ic_enterprise
WHERE DEL_FLAG = 0 WHERE DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId} <if test='customerId != null and customerId != ""'>
AND CONCAT(AGENCY_PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%') AND CUSTOMER_ID = #{customerId}
</if>
<if test='orgId != null and orgId != ""'>
AND CONCAT(AGENCY_PIDS,':',AGENCY_ID) LIKE CONCAT('%',#{orgId},'%')
</if>
<if test=' name != null and name != "" '> <if test=' name != null and name != "" '>
AND PLACE_ORG_NAME LIKE CONCAT('%',#{name},'%') AND PLACE_ORG_NAME LIKE CONCAT('%',#{name},'%')
</if> </if>

Loading…
Cancel
Save