Browse Source

大屏调度指挥增加重点单位

dev
luyan 2 years ago
parent
commit
454171a37c
  1. 9
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoverageEnums.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoveragePlaceTypeEnum.java
  3. 20
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/KeyEnterpriseDao.java
  4. 57
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/KeyEnterpriseEntity.java
  5. 58
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  6. 222
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  7. 323
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/impl/CoverageServiceImpl.java
  8. 24
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/KeyEnterpriseDao.xml

9
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoverageEnums.java

@ -6,10 +6,11 @@ package com.epmet.commons.tools.enums;
public enum CoverageEnums {
ZHZL("zhzl", "综合治理图层", 1),
YJCL("yjcl", "应急处置图层", 1),
AQSC("aqsc", "安全生产图层", 1),
CSGL("csgl", "城市管理图层", 1),
GGFW("ggfw", "公共服务图层", 1),
YJCL("yjcl", "应急处置资源", 1),
AQSC("aqsc", "安全生产资源", 1),
ZDDW("zddw", "重点单位", 1), //日照专用
CSGL("csgl", "城市管理资源", 1),
GGFW("ggfw", "公共服务资源", 1),
DATA_TYPE_GOVERNED_TARGET("governedTarget", "被管理对象", 2),
DATA_TYPE_RESOURCES("resources", "资源", 2);

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/CoveragePlaceTypeEnum.java

@ -20,7 +20,8 @@ public enum CoveragePlaceTypeEnum {
EVENT("event", "城市管理事件"),
ZHZL_RQ("zhzl_rq", "综合治理人群"),
NUCLEIC_POINT("nucleic_point", "核酸检测点"),
VACCINE_POINT("vaccine_point", "疫苗接种点");
VACCINE_POINT("vaccine_point", "疫苗接种点"),
KEY_UNIT("key_unit", "重点单位"); //日照专用
private final String code;
private final String name;

20
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/KeyEnterpriseDao.java

@ -0,0 +1,20 @@
package com.epmet.dataaggre.dao.govorg;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dataaggre.entity.govorg.KeyEnterpriseEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author yan Lu
* @description 描述
* @create 2023/6/25 13:44
*/
@Mapper
public interface KeyEnterpriseDao extends BaseDao {
Integer countKeyEnterprise();
List<KeyEnterpriseEntity> getList();
}

57
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/entity/govorg/KeyEnterpriseEntity.java

@ -0,0 +1,57 @@
package com.epmet.dataaggre.entity.govorg;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* @author yan Lu
* @description 描述
* @create 2023/6/25 15:11
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("key_enterprise")
public class KeyEnterpriseEntity extends BaseEpmetEntity {
/**
* 单位名称
*/
private String unitName;
/**
* 单位类型
*/
private String unitType;
/**
* 主营业务
*/
private String business;
/**
* 法人代表
*/
private String legalPerson;
/**
* 电话
*/
private String mobile;
/**
* 地址
*/
private String address;
/**
* 经度
*/
private String longitude;
/**
* 纬度
*/
private String latitude;
}

58
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -13,6 +13,7 @@ import com.epmet.dataaggre.dto.govorg.form.*;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.KeyEnterpriseEntity;
import com.epmet.dto.IcNeighborHoodDTO;
import javax.servlet.http.HttpServletResponse;
@ -48,7 +49,7 @@ public interface GovOrgService {
List<GridsInfoListResultDTO> gridListByIds(List<String> gridIdList);
/**
* @Description 根据userId查询组织ID
* @Description 根据userId查询组织ID
* @Param userId
* @author zxc
* @date 2020/12/25 下午4:53
@ -67,19 +68,19 @@ public interface GovOrgService {
List<CustomerGridDTO> gridListByStaffId(String staffId);
/**
* @Description 查询网格下有网格员角色的人
* @Description 查询网格下有网格员角色的人
* @author sun
*/
List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds, String staffName);
/**
* @Description 查询网格信息或查询当前人员所属组织下所有网格信息
* @Description 查询网格信息或查询当前人员所属组织下所有网格信息
* @author sun
*/
List<CustomerGridDTO> getGridInfoList(List<String> gridIds, String staffId);
/**
* @Description 查询工作人员所属组织信息
* @Description 查询工作人员所属组织信息
* @author sun
*/
CustomerAgencyDTO gridByAgencyId(String customerId, String staffId);
@ -97,6 +98,7 @@ public interface GovOrgService {
* @author sun
*/
OrgStaffListResultDTO staffList(OrgStaffListFormDTO formDTO);
OrgStaffListResultDTO getCurrentOrgStafflist(OrgStaffListFormDTO formDTO);
/**
@ -124,6 +126,7 @@ public interface GovOrgService {
/**
* desc:工作人员所在网格
*
* @param staffId
* @return
*/
@ -131,6 +134,7 @@ public interface GovOrgService {
/**
* desc:工作人员所在部门
*
* @param staffId
* @return
*/
@ -138,6 +142,7 @@ public interface GovOrgService {
/**
* desc获取工作人员是由哪个类型添加进来的
*
* @param staffId
* @return
*/
@ -163,16 +168,16 @@ public interface GovOrgService {
List<String> getStaffOrgList(String staffId);
/**
* @Description 查询组织信息
* @param agencyId
* @Description 查询组织信息
* @author zxc
* @date 2021/11/5 2:54 下午
*/
CustomerAgencyDTO getAgencyInfo(String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @Description 查询网格信息
* @author zxc
* @date 2021/11/5 2:57 下午
*/
@ -198,6 +203,7 @@ public interface GovOrgService {
/**
* 获取楼栋信息
*
* @param buildingId
* @return
*/
@ -205,6 +211,7 @@ public interface GovOrgService {
/**
* 组织下的工作人员下拉框
*
* @param customerId
* @param agencyId
* @return
@ -213,14 +220,15 @@ public interface GovOrgService {
/**
* 查询跟组织信息
*
* @param customerId
* @return
*/
CustomerAgencyEntity getRootAgencyByCustomerId(String customerId);
List<String> listHouseIdsByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId,
String unitId, String houseId, List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> statRule, Integer pageNo, Integer pageSize);
String unitId, String houseId, List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> statRule, Integer pageNo, Integer pageSize);
List<IcNeighborHoodDTO> neighborhoodsByIds(List<String> neighborhoodIds);
@ -229,7 +237,7 @@ public interface GovOrgService {
*
* @Param tokenDto
* @Param formDTO
* @Return {@link PageData< MemberProjectInfoResultDTO>}
* @Return {@link PageData < MemberProjectInfoResultDTO >}
* @Author zhaoqifeng
* @Date 2022/7/27 9:43
*/
@ -240,7 +248,7 @@ public interface GovOrgService {
*
* @Param tokenDto
* @Param formDTO
* @Return {@link PageData< MemberProjectInfoResultDTO>}
* @Return {@link PageData < MemberProjectInfoResultDTO >}
* @Author zhaoqifeng
* @Date 2022/7/27 9:44
*/
@ -248,57 +256,73 @@ public interface GovOrgService {
/**
* Desc: 资源获取城市管理信息
*
* @param formDTO
* @author zxc
* @date 2022/7/28 10:22
*/
List<ResourceInfoResultDTO> getCityManageInfos(CoverageHomeSearchFormDTO formDTO);
Integer getCityManageInfosCount(CoverageHomeSearchFormDTO formDTO);
/**
* Desc: 资源获取公共服务信息
*
* @param formDTO
* @author zxc
* @date 2022/7/28 10:22
*/
List<ResourceInfoResultDTO> getPublicServiceInfos(CoverageHomeSearchFormDTO formDTO);
Integer getPublicServiceInfosCount(CoverageHomeSearchFormDTO formDTO);
/**
* Desc: 资源获取重点危化品企业信息
*
* @param formDTO
* @author zxc
* @date 2022/7/28 10:22
*/
List<ResourceInfoResultDTO> getDangerousChemicalsInfos(CoverageHomeSearchFormDTO formDTO);
Integer getDangerousChemicalsInfosCount(CoverageHomeSearchFormDTO formDTO);
/**
* Desc: 资源获取优势资源信息
*
* @param formDTO
* @author zxc
* @date 2022/7/28 10:22
*/
List<ResourceInfoResultDTO> getSuperiorResourceInfos(CoverageHomeSearchFormDTO formDTO);
Integer getSuperiorResourceInfosCount(CoverageHomeSearchFormDTO formDTO);
/**
* Desc: 资源获取企事业单位巡查信息
*
* @param formDTO
* @author zxc
* @date 2022/7/28 10:22
*/
List<ResourceInfoResultDTO> getEnterpriseInfos(CoverageHomeSearchFormDTO formDTO);
Integer getEnterpriseInfosCount(CoverageHomeSearchFormDTO formDTO);
ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String customerId, String agencyId, Boolean isGetSubAllGrid);
/**
* @Description 查询员工的证件号和手机号
* @param registerId
* @Description 查询员工的证件号和手机号
* @Author zxc
* @Date 2022/10/27 14:03
*/
Map<String,String> getEmployeeRegisterMobileAndIdCard(String registerId);
Map<String, String> getEmployeeRegisterMobileAndIdCard(String registerId);
/**
* 日照统计重点单位数量
*
* @return
*/
Integer countKeyEnterprise();
/**
* 日照获取重点单位坐标位置关系
*
* @return
*/
List<KeyEnterpriseEntity> getKeyEnterprise();
}

222
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -49,6 +49,7 @@ import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import com.epmet.dataaggre.entity.govorg.KeyEnterpriseEntity;
import com.epmet.dataaggre.excel.GridLivelyDetailExcel;
import com.epmet.dataaggre.excel.GridLivelyExcel;
import com.epmet.dataaggre.service.commonservice.AreaCodeService;
@ -133,6 +134,9 @@ public class GovOrgServiceImpl implements GovOrgService {
private GovProjectService govProjectService;
@Autowired
private IcCityManagementDao cityManagementDao;
@Resource
private KeyEnterpriseDao keyEnterpriseDao;
/**
* @param staffId
@ -205,7 +209,7 @@ public class GovOrgServiceImpl implements GovOrgService {
}
/**
* @Description 根据userId查询组织ID
* @Description 根据userId查询组织ID
* @Param userId
* @author zxc
* @date 2020/12/25 下午4:53
@ -217,9 +221,9 @@ public class GovOrgServiceImpl implements GovOrgService {
@Override
public List<NextAreaCodeResultDTO> queryNextLevelAreaCodeList(NextAreaCodeFormDTO formDTO) {
CustomerAgencyEntity parent=customerAgencyDao.selectById(formDTO.getParentAgencyId());
CustomerAgencyEntity parent = customerAgencyDao.selectById(formDTO.getParentAgencyId());
if (null == parent || StringUtils.isBlank(parent.getAreaCode())) {
throw new RenException(EpmetErrorCode.SET_PARENT_AREA_CODE.getCode(),EpmetErrorCode.SET_PARENT_AREA_CODE.getMsg());
throw new RenException(EpmetErrorCode.SET_PARENT_AREA_CODE.getCode(), EpmetErrorCode.SET_PARENT_AREA_CODE.getMsg());
}
//全部下级
List<NextAreaCodeResultDTO> allList = areaCodeService.queryNextLevelAreaCodeList(formDTO);
@ -229,11 +233,11 @@ public class GovOrgServiceImpl implements GovOrgService {
// List<String> usedAreaCodeList1 = customerAgencyDao.selectUsedAreaCodeList(formDTO.getAreaCode());
//外部子客户:
List<String> usedAreaCodeList2 = customerRelation.selectUsedAreaCodeList(formDTO.getAreaCode());
List<String> list=new ArrayList<>();
List<String> list = new ArrayList<>();
/*if(CollectionUtils.isNotEmpty(usedAreaCodeList1)){
list.addAll(usedAreaCodeList1);
}*/
if(CollectionUtils.isNotEmpty(usedAreaCodeList2)){
if (CollectionUtils.isNotEmpty(usedAreaCodeList2)) {
list.addAll(usedAreaCodeList2);
}
HashSet set = new HashSet(list);
@ -255,11 +259,11 @@ public class GovOrgServiceImpl implements GovOrgService {
@Override
public List<OrgInfoCommonDTO> queryNextOrgInfoDTO(String customerId, String orgId) {
List<OrgInfoCommonDTO> result=new ArrayList<>();
List<OrgInfoCommonDTO> result = new ArrayList<>();
List<CustomerAgencyEntity> customerAgencyEntityList = customerAgencyDao.selectNextAgency(customerId, orgId);
if(CollectionUtils.isNotEmpty(customerAgencyEntityList)){
customerAgencyEntityList.forEach(agencyEntity->{
OrgInfoCommonDTO agecnyInfo=new OrgInfoCommonDTO();
if (CollectionUtils.isNotEmpty(customerAgencyEntityList)) {
customerAgencyEntityList.forEach(agencyEntity -> {
OrgInfoCommonDTO agecnyInfo = new OrgInfoCommonDTO();
agecnyInfo.setOrgId(agencyEntity.getId());
agecnyInfo.setOrgName(agencyEntity.getOrganizationName());
agecnyInfo.setOrgType("agency");
@ -269,10 +273,10 @@ public class GovOrgServiceImpl implements GovOrgService {
});
return result;
}
List<GridInfoResultDTO> gridInfoResultDTOList=customerGridDao.selectGridListByAgencyId(orgId);
if(CollectionUtils.isNotEmpty(gridInfoResultDTOList)){
gridInfoResultDTOList.forEach(grid->{
OrgInfoCommonDTO gridInfo=new OrgInfoCommonDTO();
List<GridInfoResultDTO> gridInfoResultDTOList = customerGridDao.selectGridListByAgencyId(orgId);
if (CollectionUtils.isNotEmpty(gridInfoResultDTOList)) {
gridInfoResultDTOList.forEach(grid -> {
OrgInfoCommonDTO gridInfo = new OrgInfoCommonDTO();
gridInfo.setOrgId(grid.getGridId());
gridInfo.setOrgName(grid.getGridName());
gridInfo.setOrgType("grid");
@ -297,29 +301,29 @@ public class GovOrgServiceImpl implements GovOrgService {
}
/**
* @Description 查询网格下有网格员角色的人
* @Description 查询网格下有网格员角色的人
* @author sun
*/
@Override
public List<GridStaffResultDTO> selectGridStaffByGridIds(List<String> gridIds, String staffName) {
if (org.springframework.util.CollectionUtils.isEmpty(gridIds)){
if (org.springframework.util.CollectionUtils.isEmpty(gridIds)) {
return new ArrayList<>();
}
// 查询网格下所有的人
List<GridStaffResultDTO> gridStaff = customerStaffGridDao.selectGridStaffByGridIds(gridIds);
if (org.springframework.util.CollectionUtils.isEmpty(gridStaff)){
if (org.springframework.util.CollectionUtils.isEmpty(gridStaff)) {
return new ArrayList<>();
}
// 拿着网格下所有人去筛选网格员
List<GridStaffResultDTO> result = epmetUserService.staffGridRole(gridStaff, staffName);
if (org.springframework.util.CollectionUtils.isEmpty(result)){
if (org.springframework.util.CollectionUtils.isEmpty(result)) {
return new ArrayList<>();
}
return result;
}
/**
* @Description 查询网格信息或查询当前人员所属组织下所有网格信息
* @Description 查询网格信息或查询当前人员所属组织下所有网格信息
* @author sun
*/
@Override
@ -401,6 +405,7 @@ public class GovOrgServiceImpl implements GovOrgService {
return resultDTO;
}
/**
* @Author sun
* @Description 递归查询当前组织的下一级组织网格列表
@ -433,13 +438,13 @@ public class GovOrgServiceImpl implements GovOrgService {
}
formDTO.setStaffIds(staffIds);
//是否包含自己
if("0".equals(formDTO.getIncludeMe())){
staffIds.removeIf(s->s.equals(formDTO.getStaffId()));
if ("0".equals(formDTO.getIncludeMe())) {
staffIds.removeIf(s -> s.equals(formDTO.getStaffId()));
}
//是否具有超级管理员或管理员角色
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getStaffId());
Map<String,String> roleMap = staffInfoCache.getRoleMap();
Map<String, String> roleMap = staffInfoCache.getRoleMap();
if (roleMap.containsKey("root_manager") || roleMap.containsKey("manager")) {
formDTO.setEnableFlag("disabled");
}
@ -449,7 +454,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//3.查询工作人员注册组织关系信息
List<String> staffIdList = staffList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(staffIdList)){
if (!CollectionUtils.isEmpty(staffIdList)) {
List<StaffOrgNameResultDTO> list = customerAgencyDao.selelctStaffOrg(staffIdList);
staffList.forEach(re -> list.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgType(s.getOrgType())));
}
@ -475,8 +480,8 @@ public class GovOrgServiceImpl implements GovOrgService {
}
formDTO.setStaffIds(staffIds);
//是否包含自己
if("0".equals(formDTO.getIncludeMe())){
staffIds.removeIf(s->s.equals(formDTO.getStaffId()));
if ("0".equals(formDTO.getIncludeMe())) {
staffIds.removeIf(s -> s.equals(formDTO.getStaffId()));
}
//2.分页查询工作人员基础信息、角色信息【组织人员单位领导角色人员在前;部门人员部门领导角色人员在前;网格人员网格长角色人员在前】
@ -484,7 +489,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//3.查询工作人员注册组织关系信息
List<String> staffIdList = staffList.stream().map(ListStaffResultDTO::getStaffId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(staffIdList)){
if (!CollectionUtils.isEmpty(staffIdList)) {
List<StaffOrgNameResultDTO> list = customerAgencyDao.selelctStaffOrg(staffIdList);
staffList.forEach(re -> list.stream().filter(l -> re.getStaffId().equals(l.getStaffId())).forEach(s -> re.setOrgType(s.getOrgType())));
}
@ -504,8 +509,8 @@ public class GovOrgServiceImpl implements GovOrgService {
public StaffDetailV2FormDTO staffDetailV2(StaffDetailV2ResultDTO formDTO) {
//1.查询工作人员基本信息、角色信息
StaffDetailV2FormDTO result = epmetUserService.selectByStaffId(formDTO.getStaffId());
if (null == result||StringUtils.isBlank(result.getStaffId())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"customer_staff is null staffId:"+formDTO.getStaffId(),"未查询到工作人员基本信息");
if (null == result || StringUtils.isBlank(result.getStaffId())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "customer_staff is null staffId:" + formDTO.getStaffId(), "未查询到工作人员基本信息");
// return new StaffDetailV2FormDTO();
}
@ -514,7 +519,7 @@ public class GovOrgServiceImpl implements GovOrgService {
staffIdList.add(formDTO.getStaffId());
List<StaffOrgNameResultDTO> list = customerAgencyDao.selelctStaffOrg(staffIdList);
if (null == list || list.size() < NumConstant.ONE) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"未查询到工作人员注册组织信息","未查询到工作人员所属组织信息");
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查询到工作人员注册组织信息", "未查询到工作人员所属组织信息");
}
//3.封装数据并返回
@ -591,13 +596,13 @@ public class GovOrgServiceImpl implements GovOrgService {
@Override
public List<OrgTreeResultDTO> getAgencyTree(TokenDto tokenDto, SubOrgFormDTO formDTO) {
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (staffInfo == null || StringUtils.isBlank(staffInfo.getAgencyId())){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"工作人员所属组织不存在");
if (staffInfo == null || StringUtils.isBlank(staffInfo.getAgencyId())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "工作人员所属组织不存在");
}
String agencyId = staffInfo.getAgencyId();
String client = formDTO.getClient();
//组织缓存key
String treeCacheKey = RedisKeys.getOrgTreeCacheKey(agencyId,tokenDto.getCustomerId()).concat(StrConstant.COLON).concat(client);
String treeCacheKey = RedisKeys.getOrgTreeCacheKey(agencyId, tokenDto.getCustomerId()).concat(StrConstant.COLON).concat(client);
Long expiryTime = redisUtils.getTTL(treeCacheKey);
List<OrgTreeResultDTO> orgTreeResultDTOS = (List<OrgTreeResultDTO>) redisUtils.get(treeCacheKey);
//如果接近过期或已经过期且缓存数据不为空 则异步查询
@ -606,13 +611,14 @@ public class GovOrgServiceImpl implements GovOrgService {
List<OrgTreeResultDTO> list = buildTempOrgTree(agencyId, client);
redisUtils.set(treeCacheKey, list, RedisUtils.HOUR_FOUR_EXPIRE);
});
} else if (CollectionUtils.isEmpty(orgTreeResultDTOS)){
} else if (CollectionUtils.isEmpty(orgTreeResultDTOS)) {
orgTreeResultDTOS = buildTempOrgTree(staffInfo.getAgencyId(), formDTO.getClient());
redisUtils.set(treeCacheKey, orgTreeResultDTOS, RedisUtils.HOUR_FOUR_EXPIRE);
}
return orgTreeResultDTOS;
}
private List<OrgTreeResultDTO> buildTempOrgTree(String agencyId, String client){
private List<OrgTreeResultDTO> buildTempOrgTree(String agencyId, String client) {
List<OrgTreeResultDTO> list = new ArrayList<>();
if ("resi".equals(client)) {
list.add(customerAgencyDao.getResiOrgTree(agencyId));
@ -636,15 +642,15 @@ public class GovOrgServiceImpl implements GovOrgService {
}
/**
* @Description 查询组织信息
* @param agencyId
* @Description 查询组织信息
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@Override
public CustomerAgencyDTO getAgencyInfo(String agencyId) {
CustomerAgencyEntity customerAgencyEntity=customerAgencyDao.selectById(agencyId);
CustomerAgencyDTO res= ConvertUtils.sourceToTarget(customerAgencyEntity,CustomerAgencyDTO.class);
CustomerAgencyEntity customerAgencyEntity = customerAgencyDao.selectById(agencyId);
CustomerAgencyDTO res = ConvertUtils.sourceToTarget(customerAgencyEntity, CustomerAgencyDTO.class);
//设置行政地区编码全路径
if (null != res && StringUtils.isNotBlank(res.getAreaCode()) && StringUtils.isNotBlank(res.getParentAreaCode())) {
res.setAreaCodePath(queryAreaCodePath(res));
@ -685,8 +691,8 @@ public class GovOrgServiceImpl implements GovOrgService {
}
/**
* @Description 查询网格信息
* @param gridId
* @Description 查询网格信息
* @author zxc
* @date 2021/11/5 2:57 下午
*/
@ -711,7 +717,7 @@ public class GovOrgServiceImpl implements GovOrgService {
if (StringUtils.isNotBlank(formDTO.getType()) && "historyScore".equals(formDTO.getType())) {
GridLivelyResultDTO dto = evaluationIndexService.streetGridList(formDTO);
subList.add(dto);
}else {
} else {
subList = customerAgencyDao.subAgencyListAndGridSumNum(formDTO.getAgencyId());
}
//2.查询直属下级组织下网格在查询时间段内存在例行工作次数的网格,一天一条
@ -770,7 +776,7 @@ public class GovOrgServiceImpl implements GovOrgService {
LinkedList<GridLivelyResultDTO> subList = customerAgencyDao.subAgencyListAndGridSumNum(formDTO.getAgencyId());
//1.查询当前组织下所有网格列表
List<GridInfoResultDTO> gridList = customerGridDao.selectAgencyGridList(formDTO.getAgencyId());
Map<String, GridInfoResultDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoResultDTO :: getGridId, v -> v, (v1, v2) -> v1));
Map<String, GridInfoResultDTO> gridMap = gridList.stream().collect(Collectors.toMap(GridInfoResultDTO::getGridId, v -> v, (v1, v2) -> v1));
//2.查询直属下级组织下网格在查询时间段内存在例行工作次数的网格,一天一条
List<GridDateIdResultDTO> workList = epmetUserService.getGridDateRoutineWorkList(formDTO);
/*//3.查询直属下级组织下网格在查询时间段内存在上报事件(直接立项)数的网格,一天一条
@ -801,7 +807,7 @@ public class GovOrgServiceImpl implements GovOrgService {
//活跃网格数、普通网格数、僵尸网格数
int gridLivelyNum = 0;
int gridOrdinaryNum = 0;
for (Map.Entry<String, Integer> ma : hash.entrySet()){
for (Map.Entry<String, Integer> ma : hash.entrySet()) {
gridSet.add(ma.getKey());
if (ma.getValue() >= NumConstant.FIVE) {//活跃网格
gridLivelyNum++;
@ -809,7 +815,7 @@ public class GovOrgServiceImpl implements GovOrgService {
lively.setAgencyId(sub.getAgencyId());
lively.setAgencyName(sub.getAgencyName());
lively.setGridId(ma.getKey());
lively.setGridName(null!=gridMap.get(ma.getKey())?gridMap.get(ma.getKey()).getGridName():"");
lively.setGridName(null != gridMap.get(ma.getKey()) ? gridMap.get(ma.getKey()).getGridName() : "");
lively.setDatyNum(ma.getValue());
livelyGrid.add(lively);
} else if (ma.getValue() >= NumConstant.TWO && ma.getValue() < NumConstant.FIVE) {//正常网格
@ -818,15 +824,15 @@ public class GovOrgServiceImpl implements GovOrgService {
ordinary.setAgencyId(sub.getAgencyId());
ordinary.setAgencyName(sub.getAgencyName());
ordinary.setGridId(ma.getKey());
ordinary.setGridName(null!=gridMap.get(ma.getKey())?gridMap.get(ma.getKey()).getGridName():"");
ordinary.setGridName(null != gridMap.get(ma.getKey()) ? gridMap.get(ma.getKey()).getGridName() : "");
ordinary.setDatyNum(ma.getValue());
ordinaryGrid.add(ordinary);
}else if (ma.getValue() < NumConstant.TWO) {//部分僵尸网格[这是活跃天数为1的,还有部分活跃天数为0的]
} else if (ma.getValue() < NumConstant.TWO) {//部分僵尸网格[这是活跃天数为1的,还有部分活跃天数为0的]
GridLivelyDetailExcel.LazyGrid lazy = new GridLivelyDetailExcel.LazyGrid();
lazy.setAgencyId(sub.getAgencyId());
lazy.setAgencyName(sub.getAgencyName());
lazy.setGridId(ma.getKey());
lazy.setGridName(null!=gridMap.get(ma.getKey())?gridMap.get(ma.getKey()).getGridName():"");
lazy.setGridName(null != gridMap.get(ma.getKey()) ? gridMap.get(ma.getKey()).getGridName() : "");
lazy.setDatyNum(ma.getValue());
lazyGrid.add(lazy);
}
@ -845,20 +851,20 @@ public class GovOrgServiceImpl implements GovOrgService {
livelyExcelList.add(gridLively);
//5-2.组装不存在活跃度的数据【网格活跃天数为0的】
gridList.forEach(g->{
if(g.getPids().contains(sub.getAgencyId())&&!gridSet.contains(g.getGridId())){
gridList.forEach(g -> {
if (g.getPids().contains(sub.getAgencyId()) && !gridSet.contains(g.getGridId())) {
GridLivelyDetailExcel.LazyGrid lazy = new GridLivelyDetailExcel.LazyGrid();
lazy.setAgencyId(sub.getAgencyId());
lazy.setAgencyName(sub.getAgencyName());
lazy.setGridId(g.getGridId());
lazy.setGridName(null!=gridMap.get(g.getGridId())?gridMap.get(g.getGridId()).getGridName():"");
lazy.setGridName(null != gridMap.get(g.getGridId()) ? gridMap.get(g.getGridId()).getGridName() : "");
lazy.setDatyNum(NumConstant.ZERO);
lazyGrid.add(lazy);
}
});
});
//5-3.网格运行情况合计
if (!CollectionUtils.isEmpty(livelyExcelList)){
if (!CollectionUtils.isEmpty(livelyExcelList)) {
GridLivelyExcel gridLively = new GridLivelyExcel();
gridLively.setAgencyName("合计");
gridLively.setGridSumNum(livelyExcelList.stream().mapToInt(GridLivelyExcel::getGridSumNum).sum());
@ -908,18 +914,18 @@ public class GovOrgServiceImpl implements GovOrgService {
}
//2.查询网格活跃度数据
GridLivelyDetailExcel resultDTO = gridActiveList(formDTO);
if(null==resultDTO||CollectionUtils.isEmpty(resultDTO.getLivelyExcelList())){
if (null == resultDTO || CollectionUtils.isEmpty(resultDTO.getLivelyExcelList())) {
log.warn(String.format("网格员活跃度统计数据为空,入参【%s】", JSON.toJSONString(formDTO)));
return;
}
//3.生成多sheet页excel文件并写入数据导出文件
List<Map<String,Object>> headerList = getHeaderList(formDTO,agencyInfo,resultDTO);
List<Map<String, Object>> headerList = getHeaderList(formDTO, agencyInfo, resultDTO);
try {
Workbook workbook = ExcelExportUtil.exportExcel(headerList, ExcelType.XSSF);
response.setCharacterEncoding("UTF-8");
response.setHeader("content-Type", "application/vnd.ms-excel");
String fileName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName()+"网格活跃度统计.xls");
response.setHeader("Content-Disposition", "attachment;filename=" +fileName);
String fileName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName() + "网格活跃度统计.xls");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
ServletOutputStream out = response.getOutputStream();
workbook.write(out);
out.flush();
@ -929,15 +935,15 @@ public class GovOrgServiceImpl implements GovOrgService {
}
}
private List<Map<String, Object>> getHeaderList(GridLivelyFormDTO formDTO, AgencyInfoCache agencyInfo,GridLivelyDetailExcel resultDTO) {
List<Map<String,Object>> headerList = new ArrayList<>();
String titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName()+"网格活跃度统计表");
private List<Map<String, Object>> getHeaderList(GridLivelyFormDTO formDTO, AgencyInfoCache agencyInfo, GridLivelyDetailExcel resultDTO) {
List<Map<String, Object>> headerList = new ArrayList<>();
String titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName() + "网格活跃度统计表");
headerList.add(getHaderMap(resultDTO.getLivelyExcelList(), titleName, "各街镇网格运行情况", GridLivelyExcel.class));
titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName()+"活跃网格明细");
titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName() + "活跃网格明细");
headerList.add(getHaderMap(resultDTO.getLivelyGrid(), titleName, "活跃网格统计", GridLivelyDetailExcel.LivelyGrid.class));
titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName()+"正常运行网格明细");
titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName() + "正常运行网格明细");
headerList.add(getHaderMap(resultDTO.getOrdinaryGrid(), titleName, "正常运行网格统计", GridLivelyDetailExcel.OrdinaryGrid.class));
titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName()+"僵尸网格明细");
titleName = excelTitleName(formDTO.getStartTime(), formDTO.getEndTime(), agencyInfo.getOrganizationName() + "僵尸网格明细");
headerList.add(getHaderMap(resultDTO.getLazyGrid(), titleName, "僵尸网格统计", GridLivelyDetailExcel.LazyGrid.class));
return headerList;
}
@ -950,23 +956,24 @@ public class GovOrgServiceImpl implements GovOrgService {
* cl sheet页列头对应实体类
* @Description 生成多sheet页excel文件模板数据
**/
private Map<String, Object> getHaderMap(Collection<?> data, String title, String name, Class<?> cl){
Map<String,Object> map = new HashMap<>();
map.put("data",data);
private Map<String, Object> getHaderMap(Collection<?> data, String title, String name, Class<?> cl) {
Map<String, Object> map = new HashMap<>();
map.put("data", data);
ExportParams param1 = new ExportParams(title, name);
map.put("title", param1);
map.put("entity", cl);
return map;
}
/**
* @Author sun
* @Description excel文件sheet页主标题拼接
**/
private String excelTitleName(String startTime, String endTime, String name){
private String excelTitleName(String startTime, String endTime, String name) {
StringBuilder titleName = new StringBuilder();
SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日");
try{
try {
titleName.append("(").append(format2.format(format1.parse(startTime))).append("至").append(format2.format(format1.parse(endTime))).append(")").append(name);
} catch (Exception e) {
log.error("method exception", e);
@ -974,11 +981,11 @@ public class GovOrgServiceImpl implements GovOrgService {
return titleName.toString();
}
private String excelSheetName(GridLivelyFormDTO formDTO){
private String excelSheetName(GridLivelyFormDTO formDTO) {
StringBuilder name = new StringBuilder();
SimpleDateFormat format1 = new SimpleDateFormat("yyyyMMdd");
SimpleDateFormat format2 = new SimpleDateFormat("yyyy年MM月dd日");
try{
try {
name.append(format2.format(format1.parse(formDTO.getStartTime()))).append("至").append(format2.format(format1.parse(formDTO.getEndTime()))).append("网格活跃度统计");
} catch (Exception e) {
log.error("method exception", e);
@ -1013,7 +1020,7 @@ public class GovOrgServiceImpl implements GovOrgService {
return;
}
//3.生成多sheet页excel文件并写入数据导出文件
List<Map<String,Object>> headerList = getHeaderList(formDTO,agencyInfo,resultDTO);
List<Map<String, Object>> headerList = getHeaderList(formDTO, agencyInfo, resultDTO);
// 文件名
String sheetName = excelSheetName(formDTO);
String resultDescFileName = sheetName.concat(".xlsx");
@ -1054,7 +1061,7 @@ public class GovOrgServiceImpl implements GovOrgService {
// String secret = DingDingRobotConstant.YZM_TEST_SECRET;
// String url = DingDingRobotConstant.YZM_TEST_URL;
DingTextBriefNessFormDTO dingTalkTextMsg=new DingTextBriefNessFormDTO();
DingTextBriefNessFormDTO dingTalkTextMsg = new DingTextBriefNessFormDTO();
dingTalkTextMsg.setMsgtype("text");
//小雷哥手机号:18660295251,
@ -1068,7 +1075,7 @@ public class GovOrgServiceImpl implements GovOrgService {
OapiRobotSendRequest.Text text = new OapiRobotSendRequest.Text();
text.setContent("网格活跃度统计: \n" +
"起止时间: " + formDTO.getStartTime().concat(StrConstant.UNDER_LINE).concat(formDTO.getEndTime()) + "\n" +
"文件下载地址: " + uploadResult.getData().getUrl() + "\n"+
"文件下载地址: " + uploadResult.getData().getUrl() + "\n" +
"请查收@18660295251");
dingTalkTextMsg.setText(text);
HttpClientManager.getInstance().sendDingMsg(JSON.toJSONString(dingTalkTextMsg), url, secret);
@ -1083,9 +1090,9 @@ public class GovOrgServiceImpl implements GovOrgService {
*/
@Override
public BuildingInfoCache queryBuildingInfo(String buildingId) {
BuildingInfoCache infoCache=icBuildingDao.selectBuildInfo(buildingId);
if(null!=infoCache){
GridInfoCache gridInfoCache= CustomerOrgRedis.getGridInfo(infoCache.getGridId());
BuildingInfoCache infoCache = icBuildingDao.selectBuildInfo(buildingId);
if (null != infoCache) {
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(infoCache.getGridId());
//赋值 XXX-网格名
infoCache.setGridName(null == gridInfoCache || StringUtils.isBlank(gridInfoCache.getGridNamePath()) ? StrConstant.EPMETY_STR : gridInfoCache.getGridNamePath());
}
@ -1120,15 +1127,15 @@ public class GovOrgServiceImpl implements GovOrgService {
public String getOrgIdPath(String orgId, String orgType) {
if ("agency".equals(orgType)) {
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
if (agencyInfo != null) {
String pids = agencyInfo.getPids();
String id = agencyInfo.getId();
if (StringUtils.isBlank(pids)) {
return id;
} else {
return pids.concat(":").concat(id);
}
if (agencyInfo != null) {
String pids = agencyInfo.getPids();
String id = agencyInfo.getId();
if (StringUtils.isBlank(pids)) {
return id;
} else {
return pids.concat(":").concat(id);
}
}
} else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId);
return gridInfo.getPids().concat(":").concat(gridInfo.getId());
@ -1138,8 +1145,8 @@ public class GovOrgServiceImpl implements GovOrgService {
@Override
public List<String> listHouseIdsByRules(String customerId, String orgIdPath, String orgId, String orgType, String neighborHoodId, String buildingId,
String unitId, String houseId, List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> statRule, Integer pageNo, Integer pageSize) {
String unitId, String houseId, List<ResisByPolicyRulesFormDTO.HouseRule> houseRule,
List<ResisByPolicyRulesFormDTO.StatRule> statRule, Integer pageNo, Integer pageSize) {
if (CollectionUtils.isEmpty(houseRule) && CollectionUtils.isEmpty(statRule)) {
return new ArrayList<>();
@ -1256,8 +1263,8 @@ public class GovOrgServiceImpl implements GovOrgService {
int memberCount = agencyIds.stream().filter(memberMap::containsKey).mapToInt(memberMap::get).sum();
dto.setMemberCount(memberCount);
if (memberCount != NumConstant.ZERO) {
dto.setProjectAve(dto.getProjectCount()/memberCount);
dto.setClosedAve(dto.getClosedCount()/memberCount);
dto.setProjectAve(dto.getProjectCount() / memberCount);
dto.setClosedAve(dto.getClosedCount() / memberCount);
}
return dto;
@ -1277,7 +1284,7 @@ public class GovOrgServiceImpl implements GovOrgService {
* @param formDTO
* @Param tokenDto
* @Param formDTO
* @Return {@link PageData< MemberProjectInfoResultDTO>}
* @Return {@link PageData < MemberProjectInfoResultDTO >}
* @Author zhaoqifeng
* @Date 2022/7/27 9:44
*/
@ -1335,7 +1342,7 @@ public class GovOrgServiceImpl implements GovOrgService {
for (StaffOrgRelationResultDTO staff : staffList) {
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), staff.getStaffId());
if (null != staffInfo) {
if(staffInfo.getRoleMap().containsKey("grid_member")) {
if (staffInfo.getRoleMap().containsKey("grid_member")) {
MemberProjectInfoResultDTO dto = new MemberProjectInfoResultDTO();
dto.setStaffId(staff.getStaffId());
dto.setStaffName(staffInfo.getRealName());
@ -1352,7 +1359,7 @@ public class GovOrgServiceImpl implements GovOrgService {
for (StaffOrgRelationResultDTO staff : staffList) {
CustomerStaffInfoCacheResult staffInfo = getStaffInfo(formDTO.getCustomerId(), staff.getStaffId());
if (null != staffInfo) {
if(staffInfo.getRoleMap().containsKey("grid_member")) {
if (staffInfo.getRoleMap().containsKey("grid_member")) {
MemberProjectInfoResultDTO dto = new MemberProjectInfoResultDTO();
dto.setStaffId(staff.getStaffId());
dto.setStaffName(staffInfo.getRealName());
@ -1370,7 +1377,7 @@ public class GovOrgServiceImpl implements GovOrgService {
PageInfo<MemberProjectInfoResultDTO> pageInfo = new PageInfo<>(list);
list = list.stream().sorted((o1, o2) ->
Collator.getInstance(Locale.SIMPLIFIED_CHINESE)
.compare(o1.getStaffName(),o2.getStaffName())).collect(Collectors.toList());
.compare(o1.getStaffName(), o2.getStaffName())).collect(Collectors.toList());
list = list.stream().skip(num).limit(formDTO.getPageSize()).collect(Collectors.toList());
return new PageData<>(list, pageInfo.getTotal());
@ -1396,8 +1403,8 @@ public class GovOrgServiceImpl implements GovOrgService {
private CustomerStaffInfoCacheResult getStaffInfo(String customerId, String staffId) {
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(staffId)){
log.warn("getStaffInfo param is blank,customerId:{},staffId:{}",customerId,staffId);
if (StringUtils.isBlank(customerId) || StringUtils.isBlank(staffId)) {
log.warn("getStaffInfo param is blank,customerId:{},staffId:{}", customerId, staffId);
return null;
}
String key = RedisKeys.getCustomerStaffInfoKey(customerId, staffId);
@ -1421,7 +1428,7 @@ public class GovOrgServiceImpl implements GovOrgService {
log.warn("getStaffInfo staff is null,staffId:{}", staffId);
return null;
}
CustomerStaffInfoCache resultData =ConvertUtils.sourceToTarget(staffResult, CustomerStaffInfoCache.class);
CustomerStaffInfoCache resultData = ConvertUtils.sourceToTarget(staffResult, CustomerStaffInfoCache.class);
Map<String, Object> map = BeanUtil.beanToMap(resultData, false, true);
redisUtils.hMSet(key, map);
@ -1434,51 +1441,27 @@ public class GovOrgServiceImpl implements GovOrgService {
return cityManagementDao.getCityManageInfos(formDTO);
}
@Override
public Integer getCityManageInfosCount(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getCityManageInfosCount(formDTO);
}
@Override
public List<ResourceInfoResultDTO> getPublicServiceInfos(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getPublicServiceInfos(formDTO);
}
@Override
public Integer getPublicServiceInfosCount(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getPublicServiceInfosCount(formDTO);
}
@Override
public List<ResourceInfoResultDTO> getDangerousChemicalsInfos(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getDangerousChemicalsInfos(formDTO);
}
@Override
public Integer getDangerousChemicalsInfosCount(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getDangerousChemicalsInfosCount(formDTO);
}
@Override
public List<ResourceInfoResultDTO> getSuperiorResourceInfos(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getSuperiorResourceInfos(formDTO);
}
@Override
public Integer getSuperiorResourceInfosCount(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getSuperiorResourceInfosCount(formDTO);
}
@Override
public List<ResourceInfoResultDTO> getEnterpriseInfos(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getEnterpriseInfos(formDTO);
}
@Override
public Integer getEnterpriseInfosCount(CoverageHomeSearchFormDTO formDTO) {
return cityManagementDao.getEnterpriseInfosCount(formDTO);
}
@Override
public ScreenAgencyOrGridListDTO getSubAgencyOrGridList(String customerId, String agencyId, Boolean isGetSubAllGrid) {
ScreenAgencyOrGridListDTO resultDTO = new ScreenAgencyOrGridListDTO();
@ -1530,8 +1513,8 @@ public class GovOrgServiceImpl implements GovOrgService {
}
/**
* @Description 查询员工的证件号和手机号
* @param registerId
* @Description 查询员工的证件号和手机号
* @Author zxc
* @Date 2022/10/27 14:03
*/
@ -1540,4 +1523,13 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getEmployeeRegisterMobileAndIdCard(registerId);
}
@Override
public Integer countKeyEnterprise() { //日照,统计重点单位数量
return keyEnterpriseDao.countKeyEnterprise();
}
@Override
public List<KeyEnterpriseEntity> getKeyEnterprise() {
return keyEnterpriseDao.getList();
}
}

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

@ -105,17 +105,18 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 图层大屏数据分析数据列表
*
* @param coverageTypes 图层列表
* @param categoryKeys 分类列表
* @param search 搜索关键词
* @param pageNo 页码
* @param pageSize 页面大小
* @param categoryKeys 分类列表
* @param search 搜索关键词
* @param pageNo 页码
* @param pageSize 页面大小
* @return
*/
@Override
public PageData<CoverageAnalisisDataListResultDTO> analysisDataList(String customerId,String staffId,String orgId,String orgType,
public PageData<CoverageAnalisisDataListResultDTO> analysisDataList(String customerId, String staffId, String orgId, String orgType,
List<String> coverageTypes, List<String> categoryKeys,
String search, Integer pageNo, Integer pageSize, Boolean isPage) {
String search, Integer pageNo, Integer pageSize, Boolean isPage) {
// 获取跟组织的坐标
CustomerAgencyEntity rootAgency = govOrgService.getRootAgencyByCustomerId(customerId);
@ -137,7 +138,7 @@ public class CoverageServiceImpl implements CoverageService {
}
// 2.循环coverageTypes,使用key到map中查询(为了顺序),得到categoryKeys列表之后,根据实际情况做相应的查询
Map<String,String> agencyMap=getStaffPidsFromStaffInfo(customerId,staffId,orgId,orgType);
Map<String, String> agencyMap = getStaffPidsFromStaffInfo(customerId, staffId, orgId, orgType);
String agencyPath = agencyMap.get(OrgConstant.AGENC_PATH);
String agencyId = agencyMap.get(OrgConstant.AGENCY_ID);
@ -168,7 +169,7 @@ public class CoverageServiceImpl implements CoverageService {
for (GovOrgCoverageService.CategoryCoverageMapping e : ccm) {
Integer tempCount = doDataListCount(EpmetRequestHolder.getLoginUserCustomerId(), agencyId, agencyPath, e.getPlaceType(),
e.getCategoryKey(), search,null);
e.getCategoryKey(), search, null);
lastTotalCount = totalCount;
totalCount += tempCount;
@ -224,6 +225,7 @@ public class CoverageServiceImpl implements CoverageService {
/**
* Desc: 五大图层首页搜索
*
* @param formDTO
* @author zxc
* @date 2022/7/26 16:29
@ -232,8 +234,8 @@ public class CoverageServiceImpl implements CoverageService {
public CoverageHomeSearchResultDTO coverageHomeSearch(CoverageHomeSearchFormDTO formDTO) {
String customerId = formDTO.getCustomerId();
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, formDTO.getUserId());
if (null == staffInfo){
throw new EpmetException("查询工作人员失败:"+formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException("查询工作人员失败:" + formDTO.getUserId());
}
formDTO.setOrgId(staffInfo.getAgencyId());
CoverageHomeSearchResultDTO result = new CoverageHomeSearchResultDTO();
@ -241,61 +243,61 @@ public class CoverageServiceImpl implements CoverageService {
List<GovMenuDTO> customerMenuList = govCustomerMenuRedis.getCustomerMenuList(customerId, 0, "gov_menu");
// org库配置的
List<String> resources = govOrgCoverageService.getAllTypeCoverageByCustomerAndType(customerId, "resources");
if (CollectionUtils.isEmpty(resources)){
if (CollectionUtils.isEmpty(resources)) {
return result;
}
if (CollectionUtils.isEmpty(customerMenuList)){
if (CollectionUtils.isEmpty(customerMenuList)) {
return result;
}
List<String> tableMore = new ArrayList<>();
customerMenuList.forEach(cm -> {
resources.forEach(r -> {
if (cm.getUrl().equals(r)){
if (cm.getUrl().equals(r)) {
String tableName = MenusEnums.getValueByUrl(r);
if (StringUtils.isNotBlank(tableName)){
if (StringUtils.isNotBlank(tableName)) {
tableMore.add(tableName);
}
}
});
});
List<String> tables = tableMore.stream().distinct().collect(Collectors.toList());
if (CollectionUtils.isEmpty(tables)){
if (CollectionUtils.isEmpty(tables)) {
return result;
}
// 更多,查询出直接返回
if (StringUtils.isNotBlank(formDTO.getSearchType())){
if (formDTO.getSearchType().equals(OrgConstant.SEARCH_TYPE_USER)){
if (StringUtils.isNotBlank(formDTO.getSearchType())) {
if (formDTO.getSearchType().equals(OrgConstant.SEARCH_TYPE_USER)) {
PageInfo<UserInfoResultDTO> allIcUserPageInfo = getIcUserPageInfo(formDTO);
result.setUserInfos(allIcUserPageInfo.getList());
result.setUserInfosTotal(allIcUserPageInfo.getTotal());
return result;
}else if (formDTO.getSearchType().equals(OrgConstant.SEARCH_TYPE_RESOURCE)){
} else if (formDTO.getSearchType().equals(OrgConstant.SEARCH_TYPE_RESOURCE)) {
List<ResourceInfoResultDTO> reInfos = new ArrayList<>();
List<CompletableFuture<List<ResourceInfoResultDTO>>> futures = new ArrayList<>();
for (String resource : resources) {
if (MenusEnums.IC_SUPERIOR_RESOURCE.getUrl().equals(resource)){
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getSuperiorResourceInfos(formDTO),executorService);
if (MenusEnums.IC_SUPERIOR_RESOURCE.getUrl().equals(resource)) {
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getSuperiorResourceInfos(formDTO), executorService);
futures.add(c);
}else if (MenusEnums.IC_CITY_MANAGEMENT.getUrl().equals(resource)){
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getCityManageInfos(formDTO),executorService);
} else if (MenusEnums.IC_CITY_MANAGEMENT.getUrl().equals(resource)) {
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getCityManageInfos(formDTO), executorService);
futures.add(c);
}else if (MenusEnums.IC_COMMUNITY_SELF_ORGANIZATION.getUrl().equals(resource)){
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> heartService.getCommunitySelOrgInfos(formDTO),executorService);
} else if (MenusEnums.IC_COMMUNITY_SELF_ORGANIZATION.getUrl().equals(resource)) {
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> heartService.getCommunitySelOrgInfos(formDTO), executorService);
futures.add(c);
}else if (MenusEnums.IC_DANGEROUS_CHEMICALS.getUrl().equals(resource)){
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getDangerousChemicalsInfos(formDTO),executorService);
} else if (MenusEnums.IC_DANGEROUS_CHEMICALS.getUrl().equals(resource)) {
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getDangerousChemicalsInfos(formDTO), executorService);
futures.add(c);
}else if (MenusEnums.IC_ENTERPRISE.getUrl().equals(resource)){
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getEnterpriseInfos(formDTO),executorService);
} else if (MenusEnums.IC_ENTERPRISE.getUrl().equals(resource)) {
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getEnterpriseInfos(formDTO), executorService);
futures.add(c);
}else if (MenusEnums.IC_PUBLIC_SERVICE.getUrl().equals(resource)){
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getPublicServiceInfos(formDTO),executorService);
} else if (MenusEnums.IC_PUBLIC_SERVICE.getUrl().equals(resource)) {
CompletableFuture<List<ResourceInfoResultDTO>> c = CompletableFuture.supplyAsync(() -> govOrgService.getPublicServiceInfos(formDTO), executorService);
futures.add(c);
}
}
for (CompletableFuture<List<ResourceInfoResultDTO>> future : futures) {
try {
if (CollectionUtils.isNotEmpty(future.get())){
if (CollectionUtils.isNotEmpty(future.get())) {
reInfos.addAll(future.get());
}
} catch (InterruptedException e) {
@ -307,63 +309,63 @@ public class CoverageServiceImpl implements CoverageService {
result.setResourceInfos(reInfos);
return result;
}
}else {
} else {
// 查询居民
PageInfo<UserInfoResultDTO> allIcUserPageInfo = getIcUserPageInfo(formDTO);
result.setUserInfos(allIcUserPageInfo.getList());
result.setUserInfosTotal(allIcUserPageInfo.getTotal());
List<ResourceInfoResultDTO> reInfos = new ArrayList<>();
for (String table : tables) {
if (formDTO.getIsPage() && reInfos.size() == formDTO.getPageSize()){
if (formDTO.getIsPage() && reInfos.size() == formDTO.getPageSize()) {
break;
}
Integer flag = formDTO.getPageSize() - reInfos.size();
switch (table){
switch (table) {
case TableConstant.IC_SUPERIOR_RESOURCE:
List<ResourceInfoResultDTO> superiorResourceInfos = govOrgService.getSuperiorResourceInfos(formDTO);
if (formDTO.getIsPage() && superiorResourceInfos.size() > flag){
if (formDTO.getIsPage() && superiorResourceInfos.size() > flag) {
reInfos.addAll(superiorResourceInfos.subList(NumConstant.ZERO, flag));
}else {
} else {
reInfos.addAll(superiorResourceInfos);
}
break;
case TableConstant.IC_CITY_MANAGEMENT:
List<ResourceInfoResultDTO> cityManageInfos = govOrgService.getCityManageInfos(formDTO);
if (formDTO.getIsPage() && cityManageInfos.size() > flag){
reInfos.addAll(cityManageInfos.subList(NumConstant.ZERO,flag));
}else {
if (formDTO.getIsPage() && cityManageInfos.size() > flag) {
reInfos.addAll(cityManageInfos.subList(NumConstant.ZERO, flag));
} else {
reInfos.addAll(cityManageInfos);
}
break;
case TableConstant.IC_COMMUNITY_SELF_ORGANIZATION:
List<ResourceInfoResultDTO> communitySelOrgInfos = heartService.getCommunitySelOrgInfos(formDTO);
if (formDTO.getIsPage() && communitySelOrgInfos.size() > flag){
reInfos.addAll(communitySelOrgInfos.subList(NumConstant.ZERO,flag));
}else {
if (formDTO.getIsPage() && communitySelOrgInfos.size() > flag) {
reInfos.addAll(communitySelOrgInfos.subList(NumConstant.ZERO, flag));
} else {
reInfos.addAll(communitySelOrgInfos);
}
break;
case TableConstant.IC_DANGEROUS_CHEMICALS:
List<ResourceInfoResultDTO> dangerousChemicalsInfos = govOrgService.getDangerousChemicalsInfos(formDTO);
if (formDTO.getIsPage() && dangerousChemicalsInfos.size() > flag){
reInfos.addAll(dangerousChemicalsInfos.subList(NumConstant.ZERO,flag));
}else {
if (formDTO.getIsPage() && dangerousChemicalsInfos.size() > flag) {
reInfos.addAll(dangerousChemicalsInfos.subList(NumConstant.ZERO, flag));
} else {
reInfos.addAll(dangerousChemicalsInfos);
}
break;
case TableConstant.IC_ENTERPRISE:
List<ResourceInfoResultDTO> enterpriseInfos = govOrgService.getEnterpriseInfos(formDTO);
if (formDTO.getIsPage() && enterpriseInfos.size() > flag){
reInfos.addAll(enterpriseInfos.subList(NumConstant.ZERO,flag));
}else {
if (formDTO.getIsPage() && enterpriseInfos.size() > flag) {
reInfos.addAll(enterpriseInfos.subList(NumConstant.ZERO, flag));
} else {
reInfos.addAll(enterpriseInfos);
}
break;
case TableConstant.IC_PUBLIC_SERVICE:
List<ResourceInfoResultDTO> publicServiceInfos = govOrgService.getPublicServiceInfos(formDTO);
if (formDTO.getIsPage() && publicServiceInfos.size() > flag){
reInfos.addAll(publicServiceInfos.subList(NumConstant.ZERO,flag));
}else {
if (formDTO.getIsPage() && publicServiceInfos.size() > flag) {
reInfos.addAll(publicServiceInfos.subList(NumConstant.ZERO, flag));
} else {
reInfos.addAll(publicServiceInfos);
}
break;
@ -375,7 +377,7 @@ public class CoverageServiceImpl implements CoverageService {
result.setResourceInfoTotal(Long.valueOf(String.valueOf(reInfos.size())));
}
for (String resource : resources) {
if (MenusEnums.IC_EVENT.getUrl().equals(resource)){
if (MenusEnums.IC_EVENT.getUrl().equals(resource)) {
PageInfo<EventInfoResultDTO> eventPageInfo = getEventInfo(formDTO);
result.setEventInfos(eventPageInfo.getList());
result.setEventInfoTotal(eventPageInfo.getTotal());
@ -385,116 +387,28 @@ public class CoverageServiceImpl implements CoverageService {
return result;
}
/**
* Desc: 资源优势资源查询
* @param formDTO
* @author zxc
* @date 2022/7/29 08:37
*/
public PageInfo<ResourceInfoResultDTO> getSuperiorResourcePageInfo (CoverageHomeSearchFormDTO formDTO){
PageInfo<ResourceInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> govOrgService.getSuperiorResourceInfos(formDTO));
}else {
List<ResourceInfoResultDTO> superiorResourceInfos = govOrgService.getSuperiorResourceInfos(formDTO);
result.setTotal(Long.valueOf(String.valueOf(superiorResourceInfos.size())));
result.setList(superiorResourceInfos);
}
return result;
}
/**
* Desc: 资源城市管理查询
* @param formDTO
* @author zxc
* @date 2022/7/29 08:37
*/
public PageInfo<ResourceInfoResultDTO> getCityManagePageInfo (CoverageHomeSearchFormDTO formDTO){
PageInfo<ResourceInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> govOrgService.getCityManageInfos(formDTO));
}else {
List<ResourceInfoResultDTO> cityManageInfos = govOrgService.getCityManageInfos(formDTO);
result.setTotal(Long.valueOf(String.valueOf(cityManageInfos.size())));
result.setList(cityManageInfos);
}
return result;
}
/**
* Desc: 资源公共服务查询
* @param formDTO
* @author zxc
* @date 2022/7/29 08:37
*/
public PageInfo<ResourceInfoResultDTO> getPublicServicePageInfo (CoverageHomeSearchFormDTO formDTO){
PageInfo<ResourceInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> govOrgService.getPublicServiceInfos(formDTO));
}else {
List<ResourceInfoResultDTO> publicServiceInfos = govOrgService.getPublicServiceInfos(formDTO);
result.setTotal(Long.valueOf(String.valueOf(publicServiceInfos.size())));
result.setList(publicServiceInfos);
}
return result;
}
/**
* Desc: 资源重点危化品企业查询
* @param formDTO
* @author zxc
* @date 2022/7/29 08:37
*/
public PageInfo<ResourceInfoResultDTO> getDangerousChemicalsPageInfo (CoverageHomeSearchFormDTO formDTO){
PageInfo<ResourceInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> govOrgService.getDangerousChemicalsInfos(formDTO));
}else {
List<ResourceInfoResultDTO> dangerousChemicalsInfos = govOrgService.getDangerousChemicalsInfos(formDTO);
result.setTotal(Long.valueOf(String.valueOf(dangerousChemicalsInfos.size())));
result.setList(dangerousChemicalsInfos);
}
return result;
}
/**
* Desc: 资源企事业单位查询
* @param formDTO
* @author zxc
* @date 2022/7/29 08:37
*/
public PageInfo<ResourceInfoResultDTO> getEnterpriseInfosPageInfo (CoverageHomeSearchFormDTO formDTO){
PageInfo<ResourceInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> govOrgService.getEnterpriseInfos(formDTO));
}else {
List<ResourceInfoResultDTO> enterpriseInfos = govOrgService.getEnterpriseInfos(formDTO);
result.setTotal(Long.valueOf(String.valueOf(enterpriseInfos.size())));
result.setList(enterpriseInfos);
}
return result;
}
/**
* Desc: 居民信息查询
*
* @param formDTO
* @author zxc
* @date 2022/7/29 08:34
*/
public PageInfo<UserInfoResultDTO> getIcUserPageInfo (CoverageHomeSearchFormDTO formDTO){
public PageInfo<UserInfoResultDTO> getIcUserPageInfo(CoverageHomeSearchFormDTO formDTO) {
PageInfo<UserInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
if (formDTO.getIsPage()) {
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> icResiService.getAllIcUser(formDTO));
}else {
} else {
List<UserInfoResultDTO> allIcUser = icResiService.getAllIcUser(formDTO);
result.setTotal(Long.valueOf(String.valueOf(allIcUser.size())));
result.setList(allIcUser);
}
if (CollectionUtils.isNotEmpty(result.getList())){
if (CollectionUtils.isNotEmpty(result.getList())) {
result.getList().forEach(r -> {
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(formDTO.getCustomerId(), r.getHomeId());
if (null == houseInfo){
throw new EpmetException("获取房屋信息失败:"+r.getHomeId());
if (null == houseInfo) {
throw new EpmetException("获取房屋信息失败:" + r.getHomeId());
}
r.setLongitude(houseInfo.getBuildingLongitude());
r.setLatitude(houseInfo.getBuildingLatitude());
@ -505,15 +419,16 @@ public class CoverageServiceImpl implements CoverageService {
/**
* Desc: 事件查询
*
* @param formDTO
* @author zxc
* @date 2022/7/28 16:03
*/
public PageInfo<EventInfoResultDTO> getEventInfo (CoverageHomeSearchFormDTO formDTO){
public PageInfo<EventInfoResultDTO> getEventInfo(CoverageHomeSearchFormDTO formDTO) {
PageInfo<EventInfoResultDTO> result = new PageInfo<>();
if (formDTO.getIsPage()){
if (formDTO.getIsPage()) {
result = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage()).doSelectPageInfo(() -> govProjectService.getEventInfos(formDTO));
}else {
} else {
List<EventInfoResultDTO> eventInfos = govProjectService.getEventInfos(formDTO);
result.setTotal(Long.valueOf(String.valueOf(eventInfos.size())));
result.setList(eventInfos);
@ -523,6 +438,7 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 从staff信息中获取工作人员的PIDS
*
* @param staffInfo
* @return
*/
@ -573,6 +489,7 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 计算数据条数
*
* @param customerId
* @param agencyId
* @param staffOrgIds
@ -582,18 +499,18 @@ public class CoverageServiceImpl implements CoverageService {
* @return
*/
public Integer doDataListCount(String customerId, String agencyId, String staffOrgIds, String placeType,
String categoryKey, String search,String gridId) {
String categoryKey, String search, String gridId) {
if (CoveragePlaceTypeEnum.RESI.getCode().equals(placeType)) {
// 使用分类查询居民信息
return icResiService.countResisByCategories4Coverage(customerId, agencyId,
staffOrgIds, categoryKey, search,gridId);
staffOrgIds, categoryKey, search, gridId);
} else if (CoveragePlaceTypeEnum.SPECIAL_RESI.getCode().equals(placeType)) {
// 特殊人群
return icResiService.countSpecialResisBySpecialType(customerId, agencyId, staffOrgIds, categoryKey, search,gridId);
return icResiService.countSpecialResisBySpecialType(customerId, agencyId, staffOrgIds, categoryKey, search, gridId);
} else if (CoveragePlaceTypeEnum.EVENT.getCode().equals(placeType)) {
// 难点痛点
return govProjectService.countIcEventEntities(customerId, staffOrgIds, search, true,gridId);
return govProjectService.countIcEventEntities(customerId, staffOrgIds, search, true, gridId);
} else if (CoveragePlaceTypeEnum.CITY_MANAGEMENT.getCode().equals(placeType)) {
// 城市资源管理
return orgCoverageService.countCityResourceEntities(customerId, staffOrgIds, search, categoryKey);
@ -612,7 +529,7 @@ public class CoverageServiceImpl implements CoverageService {
return orgCoverageService.countDangerousChemicalEntities(customerId, staffOrgIds, search, categoryKey);
} else if (CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode().equals(placeType)) {
// 企事业单位巡查
return orgCoverageService.countEnterprisePatrol(customerId, agencyId, staffOrgIds, search, categoryKey,null,null);
return orgCoverageService.countEnterprisePatrol(customerId, agencyId, staffOrgIds, search, categoryKey, null, null);
} else if (CoveragePlaceTypeEnum.GROUP_RENT.getCode().equals(placeType)) {
// 群租房。出租的房屋,住的人口超过5人属于群租房(是个规定
return orgCoverageService.countByResiNumber(customerId, staffOrgIds, search, 5, HOUSE_RENT_FLAG_RENT);
@ -622,11 +539,11 @@ public class CoverageServiceImpl implements CoverageService {
} else if (CoveragePlaceTypeEnum.SUPERIOR_RESOURCE.getCode().equals(placeType)) {
// 优势资源
return orgCoverageService.countSuporiorResourceEntities(customerId, staffOrgIds, search, categoryKey);
} else if(CoveragePlaceTypeEnum.ENTERPRISE_PATROL_UNQUALIFIED.getCode().equals(placeType)){
} else if (CoveragePlaceTypeEnum.ENTERPRISE_PATROL_UNQUALIFIED.getCode().equals(placeType)) {
// 企事业单位巡查
// 最新巡查结果【0:合格 1:不合格】
// 左侧用,可以到网格,
return orgCoverageService.countEnterprisePatrol(customerId, agencyId, staffOrgIds, search, categoryKey,NumConstant.ONE_STR,gridId);
return orgCoverageService.countEnterprisePatrol(customerId, agencyId, staffOrgIds, search, categoryKey, NumConstant.ONE_STR, gridId);
} else if (CoveragePlaceTypeEnum.VOLUNTEER.getCode().equals(placeType)) {
// 志愿者
String[] parts = categoryKey.split("_");
@ -634,9 +551,11 @@ public class CoverageServiceImpl implements CoverageService {
} else if (CoveragePlaceTypeEnum.VACCINE_POINT.getCode().equals(placeType)) {
// 疫苗接种点
return epmetUserService.countVaccinePoint(customerId, agencyId, staffOrgIds, search);
} else if (CoveragePlaceTypeEnum.NUCLEIC_POINT.getCode().equals(placeType)) {
} else if (CoveragePlaceTypeEnum.NUCLEIC_POINT.getCode().equals(placeType)) {
// 核酸检测点
return epmetUserService.countNucleicPoint(customerId, agencyId, staffOrgIds, search);
} else if (CoveragePlaceTypeEnum.KEY_UNIT.getCode().equals(placeType)) {
return govOrgService.countKeyEnterprise();//重点单位数量统计 日照专用
}
return 0;
@ -644,17 +563,18 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 执行数据查询
*
* @param customerId
* @param agencyId 查询的工作人员所在组织id
* @param agencyId 查询的工作人员所在组织id
* @param staffOrgIds 查询的工作人员所在组织的id path包含agencyId
* @param placeType 场所类型
* @param placeType 场所类型
* @param categoryKey 类别key
* @param search 关键词
* @param search 关键词
* @return
*/
public List<CoverageAnalisisDataListResultDTO> doDataListSearch(String customerId, String agencyId, String staffOrgIds,
String placeType, String categoryKey, String search,
Integer pageNo, Integer pageSize,Boolean isPage,
Integer pageNo, Integer pageSize, Boolean isPage,
CustomerAgencyEntity rootAgency) {
// 根据categoryKey查询类别名称
@ -747,7 +667,7 @@ public class CoverageServiceImpl implements CoverageService {
} else if (CoveragePlaceTypeEnum.ENTERPRISE_PATROL.getCode().equals(placeType)) {
// 企事业单位巡查
List<IcEnterisePatrolResultDTO> list = orgCoverageService.listEnterprisePatrol(
customerId, agencyId, staffOrgIds, search, categoryKey, isPage, pageNo, pageSize,null);
customerId, agencyId, staffOrgIds, search, categoryKey, isPage, pageNo, pageSize, null);
return list.stream()
.map(dc -> new CoverageAnalisisDataListResultDTO(dc.getEnterpriseId(), categoryKey,
@ -788,14 +708,14 @@ public class CoverageServiceImpl implements CoverageService {
.map(dc -> new CoverageAnalisisDataListResultDTO(dc.getId(), categoryKey,
isPage ? categoryDict.getCategoryName() : null, placeType, isPage ? dc.getName() : null, dc.getLatitude(), dc.getLongitude()))
.collect(Collectors.toList());
} else if(CoveragePlaceTypeEnum.ENTERPRISE_PATROL_UNQUALIFIED.getCode().equals(placeType)){
} else if (CoveragePlaceTypeEnum.ENTERPRISE_PATROL_UNQUALIFIED.getCode().equals(placeType)) {
//最新巡查结果【0:合格 1:不合格】
List<IcEnterisePatrolResultDTO> list = orgCoverageService.listEnterprisePatrol(
customerId, agencyId, staffOrgIds, search, categoryKey, isPage, pageNo, pageSize,NumConstant.ONE_STR);
customerId, agencyId, staffOrgIds, search, categoryKey, isPage, pageNo, pageSize, NumConstant.ONE_STR);
return list.stream()
.map(dc -> new CoverageAnalisisDataListResultDTO(dc.getEnterpriseId(), categoryKey,
isPage ? categoryDict.getCategoryName() : null, placeType, dc.getPlaceOrgName() ,
isPage ? categoryDict.getCategoryName() : null, placeType, dc.getPlaceOrgName(),
StringUtils.isNotBlank(dc.getLatitude()) ? dc.getLatitude() : rootAgency.getLatitude(),
StringUtils.isNotBlank(dc.getLongitude()) ? dc.getLongitude() : rootAgency.getLongitude()))
.collect(Collectors.toList());
@ -821,19 +741,26 @@ public class CoverageServiceImpl implements CoverageService {
.map(vp -> new CoverageAnalisisDataListResultDTO(vp.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null,
placeType, vp.getName(), vp.getLatitude(), vp.getLongitude()))
.collect(Collectors.toList());
} else if (CoveragePlaceTypeEnum.NUCLEIC_POINT.getCode().equals(placeType)) {
} else if (CoveragePlaceTypeEnum.NUCLEIC_POINT.getCode().equals(placeType)) {
// 核酸检测点
List<IcPointNucleicMonitoringEntity> nps = epmetUserService.listNucleicPoints(customerId, agencyId, staffOrgIds, search);
return nps.stream()
.map(np -> new CoverageAnalisisDataListResultDTO(np.getId(), categoryKey, isPage ? categoryDict.getCategoryName() : null,
placeType, np.getName(), np.getLatitude(), np.getLongitude()))
.collect(Collectors.toList());
} else if (CoveragePlaceTypeEnum.KEY_UNIT.getCode().equals(placeType)) {
List<KeyEnterpriseEntity> enterpriseList = govOrgService.getKeyEnterprise();
if (null != enterpriseList && enterpriseList.size() > 0) {
return enterpriseList.stream().map(enter -> new CoverageAnalisisDataListResultDTO(enter.getId(),
categoryKey, isPage ? categoryDict.getCategoryName() : null, placeType, enter.getUnitName(), enter.getLatitude(), enter.getLongitude())).collect(Collectors.toList());
}
}
return new ArrayList<>();
}
/**
* 获取用户的坐标信息
*
* @param resiId
* @param buildingId
* @param rootAgency 跟组织用于备选从其中获取坐标
@ -861,6 +788,7 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 五大图层-可视化-右侧分类树列表
*
* @return
*/
@Override
@ -932,7 +860,7 @@ public class CoverageServiceImpl implements CoverageService {
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
String userId = EpmetRequestHolder.getLoginUserId();
Map<String,String> stafInfoMap=getStaffPidsFromStaffInfo(customerId, userId, agencyId,OrgConstant.AGENCY);
Map<String, String> stafInfoMap = getStaffPidsFromStaffInfo(customerId, userId, agencyId, OrgConstant.AGENCY);
String staffOrgPath = stafInfoMap.get(OrgConstant.AGENC_PATH);
// 填充数量quantity字段
@ -978,8 +906,8 @@ public class CoverageServiceImpl implements CoverageService {
private void fillQuantities4ResourcesCategories(AnalysisResourceCategoriesResult coverage,
AnalysisResourceCategoriesResult.PlaceType placeType,
List<AnalysisResourceCategoriesResult.Category> categories,
String customerId, String agencyId, String staffOrgIds) {
List<AnalysisResourceCategoriesResult.Category> categories,
String customerId, String agencyId, String staffOrgIds) {
AtomicInteger total = new AtomicInteger();
@ -1064,7 +992,7 @@ public class CoverageServiceImpl implements CoverageService {
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
String staffId = EpmetRequestHolder.getLoginUserId();
Map<String,String> agencyMap=getStaffPidsFromStaffInfo(customerId,staffId,agencyId,OrgConstant.AGENCY);
Map<String, String> agencyMap = getStaffPidsFromStaffInfo(customerId, staffId, agencyId, OrgConstant.AGENCY);
String agencyPath = agencyMap.get(OrgConstant.AGENC_PATH);
// 再最后,多线程setQuantity
@ -1075,6 +1003,7 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 填充数量接收参数为多个placeType(对应左侧菜单的所有一级)
*
* @param results
*/
private void fillQuantities4GovernedTarges(List<AnalysisGovernedTargetsResult> results, String customerId, String agencyId, String staffOrgIds) {
@ -1103,6 +1032,7 @@ public class CoverageServiceImpl implements CoverageService {
/**
* 填充数量接收参数为左侧单个placeType
*
* @param targetsOfOnePlaceType
* @param customerId
* @param agencyId
@ -1132,7 +1062,6 @@ public class CoverageServiceImpl implements CoverageService {
}
/**
* 五大图层左侧菜单点击事件查询人.事的分布
*
@ -1150,7 +1079,7 @@ public class CoverageServiceImpl implements CoverageService {
);
List<CoverageAnalisisDataListResultDTOV2> list = new ArrayList<>();
if (CollectionUtils.isNotEmpty(page.getList())) {
Map<String, List<CoverageAnalisisDataListResultDTO>> group = page.getList().stream().collect(Collectors.groupingBy(x->Optional.ofNullable(x.getLongLat()).orElse("O")));
Map<String, List<CoverageAnalisisDataListResultDTO>> group = page.getList().stream().collect(Collectors.groupingBy(x -> Optional.ofNullable(x.getLongLat()).orElse("O")));
if (MapUtils.isNotEmpty(group)) {
for (Map.Entry<String, List<CoverageAnalisisDataListResultDTO>> entry : group.entrySet()) {
@ -1175,16 +1104,16 @@ public class CoverageServiceImpl implements CoverageService {
CoverageHomeSearchFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CoverageHomeSearchFormDTO.class);
UserInfoResultDTO result = new UserInfoResultDTO();
List<UserInfoResultDTO> allIcUser = icResiService.getAllIcUser(dto);
if (CollectionUtils.isNotEmpty(allIcUser)){
if (CollectionUtils.isNotEmpty(allIcUser)) {
result = allIcUser.get(NumConstant.ZERO);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(result.getGridId());
if (null == gridInfo){
throw new EpmetException("获取网格信息失败:"+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());
if (null == houseInfo) {
throw new EpmetException("获取房屋信息失败:" + result.getHomeId());
}
result.setHouseName(houseInfo.getAllName());
result.setLongitude(houseInfo.getBuildingLongitude());
@ -1198,11 +1127,11 @@ public class CoverageServiceImpl implements CoverageService {
CoverageHomeSearchFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CoverageHomeSearchFormDTO.class);
EventInfoResultDTO result = new EventInfoResultDTO();
List<EventInfoResultDTO> eventInfos = govProjectService.getEventInfos(dto);
if (CollectionUtils.isNotEmpty(eventInfos)){
if (CollectionUtils.isNotEmpty(eventInfos)) {
result = eventInfos.get(NumConstant.ZERO);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(result.getGridId());
if (null == gridInfo){
throw new EpmetException("获取网格信息失败:"+result.getGridId());
if (null == gridInfo) {
throw new EpmetException("获取网格信息失败:" + result.getGridId());
}
result.setGridName(gridInfo.getGridNamePath());
}
@ -1214,7 +1143,7 @@ public class CoverageServiceImpl implements CoverageService {
CoverageHomeSearchFormDTO dto = ConvertUtils.sourceToTarget(formDTO, CoverageHomeSearchFormDTO.class);
ResourceInfoResultDTO result = new ResourceInfoResultDTO();
List<ResourceInfoResultDTO> infos = new ArrayList<>();
switch (formDTO.getResourceType()){
switch (formDTO.getResourceType()) {
case "community_org":
infos = heartService.getCommunitySelOrgInfos(dto);
break;
@ -1236,7 +1165,7 @@ public class CoverageServiceImpl implements CoverageService {
default:
break;
}
if (CollectionUtils.isNotEmpty(infos)){
if (CollectionUtils.isNotEmpty(infos)) {
result = infos.get(NumConstant.ZERO);
}
return result;
@ -1250,26 +1179,26 @@ public class CoverageServiceImpl implements CoverageService {
*/
@Override
public List<DataListLeftSubTotalResDTO> dataListLeftSubTotal(DataListLeftSubTotalFormDTO formDTO) {
List<DataListLeftSubTotalResDTO> resultList=new ArrayList<>();
List<DataListLeftSubTotalResDTO> resultList = new ArrayList<>();
List<OrgInfoCommonDTO> list = SpringContextUtils.getBean(GovOrgService.class).queryNextOrgInfoDTO(formDTO.getCustomerId(), formDTO.getOrgId());
if(CollectionUtils.isNotEmpty(list)){
resultList=ConvertUtils.sourceToTarget(list,DataListLeftSubTotalResDTO.class);
for(DataListLeftSubTotalResDTO orgRes:resultList){
String gridId=StrConstant.EPMETY_STR;
String agencyId=StrConstant.EPMETY_STR;
String orgIdPath=StrConstant.EPMETY_STR;
if(OrgConstant.AGENCY.equals(orgRes.getOrgType())){
agencyId=orgRes.getOrgId();
AgencyInfoCache agencyInfoCache=CustomerOrgRedis.getAgencyInfo(orgRes.getOrgId());
if (CollectionUtils.isNotEmpty(list)) {
resultList = ConvertUtils.sourceToTarget(list, DataListLeftSubTotalResDTO.class);
for (DataListLeftSubTotalResDTO orgRes : resultList) {
String gridId = StrConstant.EPMETY_STR;
String agencyId = StrConstant.EPMETY_STR;
String orgIdPath = StrConstant.EPMETY_STR;
if (OrgConstant.AGENCY.equals(orgRes.getOrgType())) {
agencyId = orgRes.getOrgId();
AgencyInfoCache agencyInfoCache = CustomerOrgRedis.getAgencyInfo(orgRes.getOrgId());
if (StringUtils.isNotBlank(agencyInfoCache.getPids()) && !"0".equals(agencyInfoCache.getPids()) && !"0".equals(agencyInfoCache)) {
orgIdPath = agencyInfoCache.getPids().concat(":").concat(agencyId);
} else {
orgIdPath = agencyId;
}
}else{
gridId=orgRes.getOrgId();
GridInfoCache gridInfoCache=CustomerOrgRedis.getGridInfo(orgRes.getOrgId());
orgIdPath=gridInfoCache.getPids();
} else {
gridId = orgRes.getOrgId();
GridInfoCache gridInfoCache = CustomerOrgRedis.getGridInfo(orgRes.getOrgId());
orgIdPath = gridInfoCache.getPids();
}
int count = doDataListCount(formDTO.getCustomerId(), agencyId, orgIdPath, formDTO.getPlaceType(), formDTO.getCategoryKey(), null, gridId);
orgRes.setTotal(count);

24
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/KeyEnterpriseDao.xml

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dataaggre.dao.govorg.KeyEnterpriseDao">
<select id="countKeyEnterprise" resultType="java.lang.Integer">
select count(id) from key_enterprise where DEL_FLAG = 0
</select>
<select id="getList" resultType="com.epmet.dataaggre.entity.govorg.KeyEnterpriseEntity">
SELECT
ke.ID,
ke.UNIT_NAME,
ke.UNIT_TYPE,
ke.BUSINESS,
ke.LEGAL_PERSON,
ke.MOBILE,
ke.ADDRESS,
ke.LONGITUDE,
ke.LATITUDE
FROM key_enterprise ke
<where>
ke.DEL_FLAG = 0
</where>
</select>
</mapper>
Loading…
Cancel
Save