Browse Source

党员基本情况抽取

dev_shibei_match
zxc 5 years ago
parent
commit
e7258961d6
  1. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridInfoResultDTO.java
  2. 23
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridPartyDTO.java
  3. 25
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgNameResultDTO.java
  4. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java
  5. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  6. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  7. 155
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java
  8. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCpcBaseDataService.java
  9. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  10. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  11. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java
  12. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  13. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  14. 34
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml
  15. 18
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  16. 37
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  17. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

19
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridInfoResultDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/24 2:59 下午
*/
@Data
public class GridInfoResultDTO implements Serializable {
private static final long serialVersionUID = -8146474744340303247L;
private String agencyId;
private String gridId;
}

23
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridPartyDTO.java

@ -0,0 +1,23 @@
package com.epmet.dto.extract.result;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/9/24 2:45 下午
*/
@Data
@AllArgsConstructor
public class GridPartyDTO implements Serializable {
private static final long serialVersionUID = -6699064424253966688L;
private List<String> orgIds;
private List<PartyBaseInfoFormDTO> result;
}

25
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/OrgNameResultDTO.java

@ -0,0 +1,25 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/24 1:23 下午
*/
@Data
public class OrgNameResultDTO implements Serializable {
private static final long serialVersionUID = -4815327768546033428L;
private String gridId;
private String agencyId;
private String gridName;
private String agencyName;
private String parentId;
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCpcBaseDataDao.java

@ -85,4 +85,12 @@ public interface ScreenCpcBaseDataDao extends BaseDao<ScreenCpcBaseDataEntity> {
* @date 2020/9/23 2:01 下午
*/
List<PartyInfoResultDTO> selectPartyInfo(@Param("customerId") String customerId,@Param("dateId") String dateId, String agencyId);
/**
* @Description 查询党员信息直属网格的
* @param gridIds
* @author zxc
* @date 2020/9/24 3:23 下午
*/
List<PartyInfoResultDTO> selectDirectGridPartyInfo(@Param("gridIds") List<String> gridIds,@Param("customerId") String customerId,@Param("dateId") String dateId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -20,6 +20,7 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
@ -152,4 +153,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllAgencyIdToParty(@Param("customerId")String customerId,@Param("dateId")String dateId);
/**
* @Description 查询org名称机关
* @param agencyIds
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgNameAgency(@Param("agencyIds") List<String> agencyIds);
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -20,6 +20,8 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.dto.screencoll.form.CustomerGridFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
@ -138,4 +140,20 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllGridIdToParty(String customerId, String dateId);
/**
* @Description 查询org名称
* @param gridIds
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgName(@Param("gridIds") List<String> gridIds);
/**
* @Description 查询机关的直属网格
* @param agencyIds
* @author zxc
* @date 2020/9/24 2:33 下午
*/
List<GridInfoResultDTO> selectDirectGrid(@Param("agencyIds") List<String> agencyIds);
}

155
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java

@ -2,10 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.PartyInfoResultDTO;
import com.epmet.dto.extract.result.PartyMemberInfoResultDTO;
import com.epmet.dto.extract.result.UserCountResultDTO;
import com.epmet.dto.extract.result.*;
import com.epmet.service.evaluationindex.extract.toscreen.PartyBaseInfoService;
import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
@ -109,17 +106,67 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
// 是 community 级别,子级为gridId
List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId);
agencyIdList.forEach(agency -> {
// 1. 处理社区下的所有网格中的党员信息
GridPartyDTO gridPartyDTO = gridParty(customerId, dateId, agency);
result.addAll(gridPartyDTO.getResult());
orgIds.addAll(gridPartyDTO.getOrgIds());
});
// 2. 处理社区级别的党员信息(因为网格级别的已算出,社区级别直接累加)
Map<String, List<PartyBaseInfoFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(PartyBaseInfoFormDTO::getParentId));
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(result.stream().map(m -> m.getParentId()).distinct().collect(Collectors.toList()));
groupByAgency.forEach((commAgencyId,party) -> {
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
if (!CollectionUtils.isEmpty(orgNameAgencyList)){
orgNameAgencyList.forEach(name -> {
if (commAgencyId.equals(name.getAgencyId())){
form.setOrgName(name.getAgencyName());
form.setParentId(name.getParentId());
}
});
}
form.setOrgId(commAgencyId);
form.setCustomerId(customerId);
form.setDataEndTime(dateId);
form.setOrgType(ScreenConstant.AGENCY);
form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1)));
form.setAgeLevel2(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel2)));
form.setAgeLevel3(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel3)));
form.setAgeLevel4(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel4)));
form.setAgeLevel5(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel5)));
form.setAgeLevel6(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel6)));
form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount)));
form.setResiTotal(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getResiTotal)));
form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount)));
result.add(form);
});
delAndInsert(result,customerId,dateId,orgIds);
}else {
// 级别为 street,district,city,province
List<String> agencyIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
List<GridInfoResultDTO> directGridIds = gridService.selectDirectGrid(agencyIds);
List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId);
agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId();
// 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId)
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
List<String> gridIds = (List<String>) agencyMap.get(agencyId);
orgIds.addAll(gridIds);
List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds);
List<String> dGridId = new ArrayList<>();
directGridIds.forEach(grid -> {
if (agencyId.equals(grid.getAgencyId())){
dGridId.add(grid.getGridId());
}
});
// 不为空 存在直属网格
if (!CollectionUtils.isEmpty(dGridId)){
List<PartyBaseInfoFormDTO> disGrid = new ArrayList<>();
List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, dGridId);
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyMemberInfoList.stream().map(m -> m.getGridId()).collect(Collectors.toList()));
if (!CollectionUtils.isEmpty(partyMemberInfoList)){
// 为每个人赋值年龄
partyMemberInfoList.forEach(party -> {
party.setAge(getAge(party.getBirthday()));
orgNameList.forEach(orgName -> {
if (party.getGridId().equals(orgName.getGridId())){
party.setGridName(orgName.getGridName());
party.setAgencyName(orgName.getAgencyName());
}
});
});
Map<String, List<PartyMemberInfoResultDTO>> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId));
groupByGridId.forEach((gridId,partyInfos) -> {
@ -145,38 +192,15 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
}
});
}
result.add(form);
disGrid.add(form);
});
}
});
// 2. 处理社区级别的党员信息(因为网格级别的已算出,社区级别直接累加)
Map<String, List<PartyBaseInfoFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(PartyBaseInfoFormDTO::getParentId));
groupByAgency.forEach((commAgencyId,party) -> {
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
form.setOrgName(party.get(NumConstant.ZERO).getOrgName());
form.setOrgId(commAgencyId);
form.setCustomerId(customerId);
form.setDataEndTime(dateId);
form.setOrgType(ScreenConstant.AGENCY);
form.setParentId(party.get(NumConstant.ZERO).getParentId());
form.setAgeLevel1(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel1)));
form.setAgeLevel2(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel2)));
form.setAgeLevel3(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel3)));
form.setAgeLevel4(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel4)));
form.setAgeLevel5(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel5)));
form.setAgeLevel6(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel6)));
form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount)));
form.setResiTotal(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getResiTotal)));
form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount)));
result.add(form);
});
delAndInsert(result,customerId,dateId,orgIds);
}else {
// 级别为 street,district,city,province
agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId();
// 查询下级机关的党员信息,直接累加
delAndInsert(disGrid,customerId,dateId,dGridId);
}
// 查询下级机关的党员信息,直接累加 【包括直属网格】
List<PartyInfoResultDTO> directGridList = cpcBaseDataService.selectDirectGridPartyInfo(dGridId, customerId, dateId);
List<PartyInfoResultDTO> partyInfoList = cpcBaseDataService.selectPartyInfo(customerId, dateId, agencyId);
partyInfoList.addAll(directGridList);
if (!CollectionUtils.isEmpty(partyInfoList)){
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
form.setOrgName(partyInfoList.get(NumConstant.ZERO).getOrgName());
@ -307,4 +331,57 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService {
cpcBaseDataService.insertPartyBaseInfo(p);
});
}
public GridPartyDTO gridParty(String customerId,String dateId,CustomerAgencyInfoResultDTO agency){
List<PartyBaseInfoFormDTO> result = new ArrayList<>();
List<String> orgIds = new ArrayList<>();
List<UserCountResultDTO> userCountList = userGridDailyService.selectUserCount(customerId, dateId);
// 1. 处理社区下的所有网格中的党员信息
String agencyId = agency.getAgencyId();
// 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId)
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
List<String> gridIds = (List<String>) agencyMap.get(agencyId);
orgIds.addAll(gridIds);
List<PartyMemberInfoResultDTO> partyMemberInfoList = partyMemberService.selectPartyMemberInfo(customerId, gridIds);
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyMemberInfoList.stream().map(m -> m.getGridId()).collect(Collectors.toList()));
if (!CollectionUtils.isEmpty(partyMemberInfoList)){
// 为每个人赋值年龄
partyMemberInfoList.forEach(party -> {
party.setAge(getAge(party.getBirthday()));
orgNameList.forEach(orgName -> {
if (party.getGridId().equals(orgName.getGridId())){
party.setGridName(orgName.getGridName());
party.setAgencyName(orgName.getAgencyName());
}
});
});
Map<String, List<PartyMemberInfoResultDTO>> groupByGridId = partyMemberInfoList.stream().collect(Collectors.groupingBy(PartyMemberInfoResultDTO::getGridId));
groupByGridId.forEach((gridId,partyInfos) -> {
PartyBaseInfoFormDTO form = new PartyBaseInfoFormDTO();
form.setOrgType(ScreenConstant.GRID);
form.setOrgId(gridId);
form.setOrgName(partyInfos.get(NumConstant.ZERO).getGridName());
form.setAgeLevel1(disposeAge(partyInfos,NumConstant.TWENTY,false));
form.setAgeLevel2(disposeAgeArea(partyInfos,NumConstant.TWENTY,NumConstant.THIRTY));
form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY));
form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY));
form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY));
form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true));
form.setCustomerId(customerId);
form.setDataEndTime(dateId);
form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId());
if (!CollectionUtils.isEmpty(userCountList)){
userCountList.forEach(user -> {
if (gridId.equals(user.getOrgId())){
form.setResiTotal(user.getResiTotal());
form.setRegisterUserCount(user.getRegisterUserCount());
form.setPartyMemberCount(user.getPartyMemberCount());
}
});
}
result.add(form);
});
}
return new GridPartyDTO(orgIds, result);
}
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCpcBaseDataService.java

@ -60,4 +60,12 @@ public interface ScreenCpcBaseDataService extends BaseService<ScreenCpcBaseDataE
*/
List<PartyInfoResultDTO> selectPartyInfo(String customerId, String dateId,String agencyId);
/**
* @Description 查询党员信息直属网格的
* @param gridIds
* @author zxc
* @date 2020/9/24 3:23 下午
*/
List<PartyInfoResultDTO> selectDirectGridPartyInfo(List<String> gridIds,String customerId,String dateId);
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java

@ -21,6 +21,8 @@ import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import java.util.List;
import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
@ -75,4 +77,20 @@ public interface ScreenCustomerAgencyService{
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllAgencyIdToParty(String customerId,String dateId);
/**
* @Description 查询org名称网格
* @param gridIds
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgNameGrid(List<String> gridIds);
/**
* @Description 查询org名称机关
* @param agencyIds
* @author zxc
* @date 2020/9/24 1:27 下午
*/
List<OrgNameResultDTO> selectOrgNameAgency(List<String> agencyIds);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java

@ -20,6 +20,7 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
@ -46,4 +47,12 @@ public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGri
* @date 2020/9/23 3:10 下午
*/
List<PartyBaseInfoFormDTO> selectAllGridIdToParty(String customerId, String dateId);
/**
* @Description 查询机关的直属网格
* @param agencyIds
* @author zxc
* @date 2020/9/24 2:33 下午
*/
List<GridInfoResultDTO> selectDirectGrid(List<String> agencyIds);
}

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCpcBaseDataServiceImpl.java

@ -26,7 +26,9 @@ import com.epmet.dto.extract.result.PartyInfoResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCpcBaseDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenCpcBaseDataService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
@ -71,4 +73,18 @@ public class ScreenCpcBaseDataServiceImpl extends BaseServiceImpl<ScreenCpcBaseD
public List<PartyInfoResultDTO> selectPartyInfo(String customerId, String dateId, String agencyId) {
return baseDao.selectPartyInfo(customerId, dateId, agencyId);
}
/**
* @Description 查询党员信息直属网格的
* @param gridIds
* @author zxc
* @date 2020/9/24 3:23 下午
*/
@Override
public List<PartyInfoResultDTO> selectDirectGridPartyInfo(List<String> gridIds,String customerId,String dateId) {
if (!CollectionUtils.isEmpty(gridIds)){
return baseDao.selectDirectGridPartyInfo(gridIds, customerId, dateId);
}
return new ArrayList<>();
}
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java

@ -17,13 +17,16 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.constant.ScreenConstant;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
@ -50,6 +53,7 @@ import java.util.stream.Collectors;
*/
@Service
@Slf4j
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyService {
@Autowired
@ -159,6 +163,34 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ
return screenCustomerAgencyDao.selectAllAgencyIdToParty(customerId,dateId);
}
/**
* @Description 查询org名称
* @param gridIds
* @author zxc
* @date 2020/9/24 1:27 下午
*/
@Override
public List<OrgNameResultDTO> selectOrgNameGrid(List<String> gridIds) {
if (!CollectionUtils.isEmpty(gridIds)){
return screenCustomerGridDao.selectOrgName(gridIds);
}
return new ArrayList<>();
}
/**
* @Description 查询org名称机关
* @param agencyIds
* @author zxc
* @date 2020/9/24 1:27 下午
*/
@Override
public List<OrgNameResultDTO> selectOrgNameAgency(List<String> agencyIds) {
if (!CollectionUtils.isEmpty(agencyIds)){
return screenCustomerAgencyDao.selectOrgNameAgency(agencyIds);
}
return new ArrayList<>();
}
private void updateAgency(ScreenCustomerAgencyEntity exists) {
screenCustomerAgencyDao.updateById(exists);
}
@ -193,4 +225,6 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ
public List<CustomerAgencyInfoResultDTO> selectAllAgencyId(String customerId) {
return screenCustomerAgencyDao.selectAllAgencyId(customerId);
}
}

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java

@ -25,13 +25,16 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -102,4 +105,18 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
public List<PartyBaseInfoFormDTO> selectAllGridIdToParty(String customerId, String dateId) {
return screenCustomerGridDao.selectAllGridIdToParty(customerId, dateId);
}
/**
* @Description 查询机关的直属网格
* @param agencyIds
* @author zxc
* @date 2020/9/24 2:33 下午
*/
@Override
public List<GridInfoResultDTO> selectDirectGrid(List<String> agencyIds) {
if (!CollectionUtils.isEmpty(agencyIds)){
return screenCustomerGridDao.selectDirectGrid(agencyIds);
}
return new ArrayList<>();
}
}

34
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCpcBaseDataDao.xml

@ -38,6 +38,40 @@
AND PARENT_ID = #{agencyId}
</select>
<!-- 查询党员信息【直属网格的】 -->
<select id="selectDirectGridPartyInfo" resultType="com.epmet.dto.extract.result.PartyInfoResultDTO">
SELECT
scbd.CUSTOMER_ID,
scbd.ORG_TYPE,
scbd.PARENT_ID AS orgId,
scbd.REGISTER_USER_COUNT,
scbd.RESI_TOTAL,
scbd.PARTY_MEMBER_COUNT,
scbd.AGE_LEVEL_1,
scbd.AGE_LEVEL_2,
scbd.AGE_LEVEL_3,
scbd.AGE_LEVEL_4,
scbd.AGE_LEVEL_5,
scbd.AGE_LEVEL_6,
scg.PARENT_AGENCY_ID AS parentId,
scg.GRID_NAME AS orgName
FROM
screen_cpc_base_data scbd
LEFT JOIN screen_customer_grid scg ON scg.GRID_ID = scbd.ORG_ID
WHERE
scbd.del_flag = '0'
AND scg.DEL_FLAG = 0
AND scbd.ORG_TYPE = 'grid'
AND scbd.DATA_END_TIME = #{dateId}
AND scbd.CUSTOMER_ID = #{customerId}
AND
(
<foreach collection="gridIds" item="gridId" separator=" OR ">
scbd.ORG_ID = #{gridId}
</foreach>
)
</select>
<insert id="batchInsertCpcBaseData" parameterType="map">
insert into screen_cpc_base_data
(

18
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -286,4 +286,22 @@
del_flag = '0'
AND CUSTOMER_ID = #{customerId}
</select>
<!-- 查询org名称【机关】 -->
<select id="selectOrgNameAgency" resultType="com.epmet.dto.extract.result.OrgNameResultDTO">
SELECT
AGENCY_ID,
AGENCY_NAME,
PID AS parentId
FROM
screen_customer_agency
WHERE
DEL_FLAG = 0
AND
(
<foreach collection="agencyIds" item="agencyId" separator=" or ">
agency_id = #{agencyId}
</foreach>
)
</select>
</mapper>

37
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

@ -233,4 +233,41 @@
del_flag = '0'
AND CUSTOMER_ID = #{customerId}
</select>
<!-- 查询org名称 -->
<select id="selectOrgName" resultType="com.epmet.dto.extract.result.OrgNameResultDTO">
SELECT
scg.GRID_NAME,
scg.GRID_ID,
sca.AGENCY_NAME
FROM
screen_customer_grid scg
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = scg.PARENT_AGENCY_ID
WHERE
scg.DEL_FLAG = 0
AND sca.DEL_FLAG = 0
AND
(
<foreach collection="gridIds" item="gridId" separator=" OR ">
scg.grid_id = #{gridId}
</foreach>
)
</select>
<!-- 查询机关的直属网格 -->
<select id="selectDirectGrid" resultType="com.epmet.dto.extract.result.GridInfoResultDTO">
SELECT
PARENT_AGENCY_ID AS agencyId,
GRID_ID
FROM
screen_customer_grid
WHERE
DEL_FLAG = 0
AND
(
<foreach collection="agencyIds" item="agencyId" separator=" OR ">
PARENT_AGENCY_ID = #{agencyId}
</foreach>
)
</select>
</mapper>

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimCustomerPartymemberDao.xml

@ -96,16 +96,10 @@
dcp.GRID_ID,
dcp.AGENCY_ID,
dcp.PARENT_ID,
dcp.BIRTHDAY,
scg.GRID_NAME,
sca.AGENCY_NAME
dcp.BIRTHDAY
FROM dim_customer_partymember dcp
LEFT JOIN screen_customer_grid scg ON scg.GRID_ID = dcp.GRID_ID
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = dcp.AGENCY_ID
WHERE
dcp.DEL_FLAG = '0'
AND scg.DEL_FLAG = 0
AND sca.DEL_FLAG = 0
AND dcp.CUSTOMER_ID = #{customerId}
AND
(

Loading…
Cancel
Save