Browse Source

处理【党员建群数,群成员数】不用按照月份抽取 这里指的是总数

dev_shibei_match
jianjun 5 years ago
parent
commit
2bc2167f0b
  1. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java
  2. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java
  3. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java
  4. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java
  5. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java

@ -18,13 +18,11 @@
package com.epmet.dao.evaluationindex.extract;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.GridGroupUserCountResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO;
import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
@ -164,12 +162,11 @@ public interface FactOriginGroupMainDailyDao extends BaseDao<FactOriginGroupMain
/**
* @param customerId
* @param monthId
* @Description 查询党员建组信息
* @author zxc
* @date 2020/9/25 9:46 上午
*/
List<ScreenPartyLinkMassesDataFormDTO> selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridIds") List<String> gridIds);
List<ScreenPartyLinkMassesDataFormDTO> selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("gridIds") List<String> gridIds);
/**
* desc: 获取所有网格的组中成员人数 去重
@ -202,4 +199,4 @@ public interface FactOriginGroupMainDailyDao extends BaseDao<FactOriginGroupMain
*/
List<OrgStatisticsResultDTO> selectOrgGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("level") String level);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java

@ -68,12 +68,11 @@ public interface FactOriginGroupMainDailyService extends BaseService<FactOriginG
/**
* @param customerId
* @param monthId
* @Description 查询党员建组信息
* @author zxc
* @date 2020/9/25 9:46 上午
*/
List<ScreenPartyLinkMassesDataFormDTO> selectPartyCreateGroupInfo(String customerId, String monthId, List<String> gridIds);
List<ScreenPartyLinkMassesDataFormDTO> selectPartyCreateGroupInfo(String customerId, List<String> gridIds);
/**
* desc: 获取客户下每个网格小组内的 去重人数
@ -106,4 +105,4 @@ public interface FactOriginGroupMainDailyService extends BaseService<FactOriginG
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getOrgGroupCount(String customerId, String monthId, String level);
}
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java

@ -21,8 +21,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao;
import com.epmet.dto.extract.FactOriginGroupMainDailyDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.extract.result.GridGroupUserCountResultDTO;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService;
@ -106,16 +106,15 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
}
/**
* @Description 查询党员建组信息
* @param customerId
* @param monthId
* @Description 查询党员建组信息
* @author zxc
* @date 2020/9/25 9:46 上午
*/
@Override
public List<ScreenPartyLinkMassesDataFormDTO> selectPartyCreateGroupInfo(String customerId, String monthId, List<String> gridIds) {
public List<ScreenPartyLinkMassesDataFormDTO> selectPartyCreateGroupInfo(String customerId, List<String> gridIds) {
if (!CollectionUtils.isEmpty(gridIds)) {
return baseDao.selectPartyCreateGroupInfo(customerId, monthId, gridIds);
return baseDao.selectPartyCreateGroupInfo(customerId, gridIds);
}
return new ArrayList<>();
}
@ -135,4 +134,4 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl<FactOri
return baseDao.selectOrgGroupCount(customerId, monthId, level);
}
}
}

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

@ -1,11 +1,9 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.ScreenConstant;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.extract.form.ScreenExtractFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.*;
@ -185,22 +183,22 @@ public class PartyGuideServiceImpl implements PartyGuideService {
// 判断当前级别agency是否为空
if (!CollectionUtils.isEmpty(agencyIdList)){
// 获取agencyIds
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
if (isGrid == true){
List<String> orgIds = agencyIdList.stream().map(CustomerAgencyInfoResultDTO::getAgencyId).collect(Collectors.toList());
if (isGrid) {
agencyIdList.forEach(agency -> {
// 计算社区级别的下级(实际就是网格)
GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, monthId, agency);
GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, agency);
orgIds.addAll(gridPartyGuideDTO.getOrgIds());
result.addAll(gridPartyGuideDTO.getResult());
});
// 根据agencyId分组,计算各个社区的
Map<String, List<ScreenPartyLinkMassesDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyLinkMassesDataFormDTO::getParentId));
groupByAgency.forEach((agencyId,gridList) -> {
groupByAgency.forEach((agencyId, gridList) -> {
ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO();
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds);
if (!CollectionUtils.isEmpty(orgNameAgencyList)){
orgNameAgencyList.forEach(name -> {
if (agencyId.equals(name.getAgencyId())){
if (agencyId.equals(name.getAgencyId())) {
form.setOrgName(name.getAgencyName());
form.setParentId(name.getParentId());
}
@ -210,8 +208,8 @@ public class PartyGuideServiceImpl implements PartyGuideService {
form.setCustomerId(customerId);
form.setDataEndTime(monthId);
form.setOrgType(ScreenConstant.AGENCY);
form.setCreateGroupTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal)));
form.setGroupUserTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal)));
form.setCreateGroupTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum());
form.setGroupUserTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum());
result.add(form);
});
delAndInsertLink(result,customerId,monthId,orgIds);
@ -227,15 +225,15 @@ public class PartyGuideServiceImpl implements PartyGuideService {
}
});
// 不为空 存在直属网格
if (!CollectionUtils.isEmpty(disGridIds)){
if (!CollectionUtils.isEmpty(disGridIds)) {
List<ScreenPartyLinkMassesDataFormDTO> gridResult = new ArrayList<>();
// 查询党员创建组,组内成员数
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds);
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList()));
if (!CollectionUtils.isEmpty(partyLinkMassesDataList)){
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds);
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(ScreenPartyLinkMassesDataFormDTO::getOrgId).collect(Collectors.toList()));
if (!CollectionUtils.isEmpty(partyLinkMassesDataList)) {
partyLinkMassesDataList.forEach(party -> {
orgNameList.forEach(org -> {
if (party.getOrgId().equals(org.getGridId())){
if (party.getOrgId().equals(org.getGridId())) {
party.setOrgName(org.getGridName());
}
});
@ -246,10 +244,10 @@ public class PartyGuideServiceImpl implements PartyGuideService {
delAndInsertLink(gridResult,customerId,monthId,disGridIds);
}
// 查询直属网格的信息 + 下级机关的信息 = agency的机关信息
List<ScreenPartyLinkMassesDataFormDTO> screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds);
List<ScreenPartyLinkMassesDataFormDTO> screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds);
List<ScreenPartyLinkMassesDataFormDTO> screenPartyLinkMassesDataList = linkMassesDataService.selectPartyLinkMassesInfo(customerId, monthId, agencyId);
screenPartyLinkMassesDataList.addAll(screenPartyLinkMassesDataGrid);
if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)){
if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)) {
ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO();
form.setOrgId(agencyId);
form.setOrgType(ScreenConstant.AGENCY);
@ -257,8 +255,8 @@ public class PartyGuideServiceImpl implements PartyGuideService {
form.setCustomerId(customerId);
form.setDataEndTime(monthId);
form.setParentId(screenPartyLinkMassesDataList.get(NumConstant.ZERO).getParentId());
form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal)));
form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal)));
form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum());
form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum());
result.add(form);
}
});
@ -431,24 +429,23 @@ public class PartyGuideServiceImpl implements PartyGuideService {
}
/**
* @Description 社区级别的处理
* @Description 社区级别的处理
* @Param customerId
* @Param monthId
* @Param agency
* @author zxc
* @date 2020/9/25 10:06 上午
*/
public GridPartyGuideDTO communityLevelSubGrid(String customerId, String monthId, CustomerAgencyInfoResultDTO agency){
public GridPartyGuideDTO communityLevelSubGrid(String customerId, CustomerAgencyInfoResultDTO 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);
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, gridIds);
List<ScreenPartyLinkMassesDataFormDTO> partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, gridIds);
List<String> orgIds = partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList());
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(orgIds);
partyLinkMassesDataList.forEach(party -> {
orgNameList.forEach(orgName -> {
if (party.getOrgId().equals(orgName.getGridId())){
if (party.getOrgId().equals(orgName.getGridId())) {
party.setOrgName(orgName.getGridName());
}
});

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml

@ -97,7 +97,7 @@
</foreach>
</where>
</delete>
<delete id="deleteSpecifiedDateData">
DELETE FROM
fact_origin_group_main_daily
@ -287,7 +287,6 @@
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND GROUP_STATE = 'approved'
AND
(
@ -338,4 +337,4 @@
AND f.GROUP_STATE = 'approved'
GROUP BY f.AGENCY_ID
</select>
</mapper>
</mapper>

Loading…
Cancel
Save