Browse Source

党建引领【组织次数,参与人数】

master
zxc 5 years ago
parent
commit
253774d5f7
  1. 19
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenExtractFormDTO.java
  2. 90
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/ActInfoResultDTO.java
  3. 22
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/JoinUserCountResultDTO.java
  4. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  5. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  6. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java
  7. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java
  8. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyGuideService.java
  9. 189
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java
  10. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  11. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerGridService.java
  12. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  13. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  14. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java
  15. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java
  16. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java
  17. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java
  18. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  19. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  20. 28
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml
  21. 24
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml

19
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenExtractFormDTO.java

@ -0,0 +1,19 @@
package com.epmet.dto.extract.form;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/25 4:17 下午
*/
@Data
public class ScreenExtractFormDTO implements Serializable {
private static final long serialVersionUID = -6092830982601961936L;
private String customerId;
private String monthId;
}

90
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/ActInfoResultDTO.java

@ -0,0 +1,90 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/25 3:38 下午
*/
@Data
public class ActInfoResultDTO implements Serializable {
private static final long serialVersionUID = 2322961372193392320L;
/**
* 客户ID
*/
private String customerId;
/**
* 组织IDgridId或agencyId
*/
private String orgId;
/**
* 组织类型agencygrid
*/
private String orgType;
/**
* 组织名称
*/
private String orgName;
/**
* 年度ID
*/
private String yearId;
/**
* 月度ID
*/
private String monthId;
/**
* 父级ID
*/
private String parentId;
/**
* 组织次数
*/
private Integer organizeCount;
/**
* 会议分类Id
*/
private String meetCategoryId;
/**
* 会议分类名称三会党课主题党日.....等等
*/
private String meetCategoryName;
/**
* 平均参加人数
*/
private Integer averageJoinUserCount;
/**
* 删除状态
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 更新人
*/
private String updatedBy;
}

22
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/JoinUserCountResultDTO.java

@ -0,0 +1,22 @@
package com.epmet.dto.extract.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2020/9/25 5:14 下午
*/
@Data
public class JoinUserCountResultDTO implements Serializable {
private static final long serialVersionUID = 3961393565082322770L;
private String orgId;
/**
* 参与人数
*/
private Integer joinUserCount;
}

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

@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.dto.extract.result.OrgNameResultDTO;
@ -162,7 +163,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @author zxc * @author zxc
* @date 2020/9/25 10:39 上午 * @date 2020/9/25 10:39 上午
*/ */
List<ScreenPartyLinkMassesDataFormDTO> selectAllAgencyIdToPartyLinkMessage(String customerId, String monthId); List<ScreenPartyLinkMassesDataFormDTO> selectAllAgencyIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllAgencyIdToOrganize(@Param("customerId") String customerId,@Param("monthId") String monthId);
/** /**
* @Description 查询org名称机关 * @Description 查询org名称机关

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

@ -19,10 +19,7 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.ScreenCustomerGridDTO; import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.*;
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.indexcal.PageQueryGridFormDTO; import com.epmet.dto.indexcal.PageQueryGridFormDTO;
@ -152,6 +149,7 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @date 2020/9/25 10:43 上午 * @date 2020/9/25 10:43 上午
*/ */
List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId); List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(@Param("customerId") String customerId,@Param("monthId") String monthId);
/** /**
* @Description 查询org名称 * @Description 查询org名称

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java

@ -17,6 +17,7 @@
package com.epmet.dao.heart; package com.epmet.dao.heart;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -50,4 +51,14 @@ public interface ActInfoDao{
* @Date 2020/9/21 13:55 * @Date 2020/9/21 13:55
**/ **/
List<String> selectGridRegUserVolunteer(@Param("list") List<String> regUserIds); List<String> selectGridRegUserVolunteer(@Param("list") List<String> regUserIds);
/**
* @Description 查询组织次数
* @Param customerId
* @Param monthId
* @Param orgType
* @author zxc
* @date 2020/9/25 4:00 下午
*/
List<ScreenPartyBranchDataFormDTO> selectActInfo(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("orgType") String orgType,@Param("orgIds") List<String> orgIds);
} }

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java

@ -0,0 +1,23 @@
package com.epmet.dao.heart;
import com.epmet.dto.extract.result.JoinUserCountResultDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/9/25 5:21 下午
*/
public interface ActUserRelationDao {
/**
* @Description 查询参与人数
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 5:19 下午
*/
List<JoinUserCountResultDTO> selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/PartyGuideService.java

@ -1,5 +1,7 @@
package com.epmet.service.evaluationindex.extract.toscreen; package com.epmet.service.evaluationindex.extract.toscreen;
import com.epmet.dto.extract.form.ScreenExtractFormDTO;
/** /**
* @Author zxc * @Author zxc
* @DateTime 2020/9/24 5:05 下午 * @DateTime 2020/9/24 5:05 下午
@ -8,11 +10,10 @@ public interface PartyGuideService {
/** /**
* @Description 党建引领抽取 * @Description 党建引领抽取
* @param customerId * @param screenExtractFormDTO
* @param monthId
* @author zxc * @author zxc
* @date 2020/9/24 5:10 下午 * @date 2020/9/24 5:10 下午
*/ */
Boolean partyGuideExtract(String customerId,String monthId); Boolean partyGuideExtract(ScreenExtractFormDTO screenExtractFormDTO);
} }

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

@ -3,7 +3,8 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.ScreenConstant; import com.epmet.constant.ScreenConstant;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; 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.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.*; import com.epmet.dto.extract.result.*;
import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService;
@ -12,6 +13,9 @@ import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService; import com.epmet.service.evaluationindex.screen.ScreenCustomerGridService;
import com.epmet.service.evaluationindex.screen.ScreenPartyBranchDataService; import com.epmet.service.evaluationindex.screen.ScreenPartyBranchDataService;
import com.epmet.service.evaluationindex.screen.ScreenPartyLinkMassesDataService; import com.epmet.service.evaluationindex.screen.ScreenPartyLinkMassesDataService;
import com.epmet.service.heart.ActInfoService;
import com.epmet.service.heart.ActUserRelationService;
import com.epmet.service.stats.DimCustomerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -19,7 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -43,16 +49,52 @@ public class PartyGuideServiceImpl implements PartyGuideService {
private ScreenCustomerAgencyService agencyService; private ScreenCustomerAgencyService agencyService;
@Autowired @Autowired
private ScreenCustomerGridService gridService; private ScreenCustomerGridService gridService;
@Autowired
private ActInfoService actInfoService;
@Autowired
private DimCustomerService dimCustomerService;
@Autowired
private ActUserRelationService actUserRelationService;
/** /**
* @Description 党建引领抽取 * @Description 党建引领抽取
* @param customerId * @param screenExtractFormDTO
* @param monthId
* @author zxc * @author zxc
* @date 2020/9/24 5:10 下午 * @date 2020/9/24 5:10 下午
*/ */
@Override @Override
public Boolean partyGuideExtract(String customerId, String monthId) { public Boolean partyGuideExtract(ScreenExtractFormDTO screenExtractFormDTO) {
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIds = new ArrayList<>();
String customerId = screenExtractFormDTO.getCustomerId();
if (!StringUtils.isEmpty(customerId)){
customerIds.add(customerId);
}else {
customerIds = dimCustomerService.selectCustomerIdPage(pageNo, pageSize);
}
String monthId = screenExtractFormDTO.getMonthId();
if (StringUtils.isEmpty(monthId)){
monthId = LocalDate.now().toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX);
}
if (!CollectionUtils.isEmpty(customerIds)){
String finalMonthId = monthId;
customerIds.forEach(oneCustomerId -> {
partyGuideExtractParty(oneCustomerId, finalMonthId);
partyGuideExtractOrganize(oneCustomerId,finalMonthId);
});
}
return true;
}
/**
* @Description 党员建群数群成员数
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 4:26 下午
*/
public void partyGuideExtractParty(String customerId, String monthId){
//【党员建群数,群成员数】 //【党员建群数,群成员数】
List<CustomerAgencyInfoResultDTO> agencyIdList = agencyService.selectAllAgencyId(customerId); List<CustomerAgencyInfoResultDTO> agencyIdList = agencyService.selectAllAgencyId(customerId);
if (!CollectionUtils.isEmpty(agencyIdList)){ if (!CollectionUtils.isEmpty(agencyIdList)){
@ -61,34 +103,74 @@ public class PartyGuideServiceImpl implements PartyGuideService {
if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){ if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){
// 社区级别 // 社区级别
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY); List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY);
disPose(customerGridInfoList,true,customerId,monthId); disPoseParty(customerGridInfoList,true,customerId,monthId);
} }
if (groupByLevel.containsKey(ScreenConstant.STREET)){ if (groupByLevel.containsKey(ScreenConstant.STREET)){
// 街道级别 // 街道级别
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.STREET); List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.STREET);
disPose(customerGridInfoList,false,customerId,monthId); disPoseParty(customerGridInfoList,false,customerId,monthId);
} }
if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){ if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){
// 区级 // 区级
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT); List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT);
disPose(customerGridInfoList,false,customerId,monthId); disPoseParty(customerGridInfoList,false,customerId,monthId);
} }
if (groupByLevel.containsKey(ScreenConstant.CITY)){ if (groupByLevel.containsKey(ScreenConstant.CITY)){
// 市级 // 市级
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.CITY); List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.CITY);
disPose(customerGridInfoList,false,customerId,monthId); disPoseParty(customerGridInfoList,false,customerId,monthId);
} }
if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){ if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){
// 省级 // 省级
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE); List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE);
disPose(customerGridInfoList,false,customerId,monthId); disPoseParty(customerGridInfoList,false,customerId,monthId);
} }
} }
return true;
} }
/** /**
* @Description 处理 * @Description 参与人数组织次数
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 4:26 下午
*/
public void partyGuideExtractOrganize(String customerId, String monthId){
//【参与人数,组织次数】
List<CustomerAgencyInfoResultDTO> agencyIdList = agencyService.selectAllAgencyId(customerId);
if (!CollectionUtils.isEmpty(agencyIdList)){
// 根据组织级别分组
Map<String, List<CustomerAgencyInfoResultDTO>> groupByLevel = agencyIdList.stream().collect(Collectors.groupingBy(CustomerAgencyInfoResultDTO::getLevel));
if (groupByLevel.containsKey(ScreenConstant.COMMUNITY)){
// 社区级别
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.COMMUNITY);
disPoseOrganize(customerGridInfoList,true,customerId,monthId);
}
if (groupByLevel.containsKey(ScreenConstant.STREET)){
// 街道级别
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.STREET);
disPoseOrganize(customerGridInfoList,false,customerId,monthId);
}
if (groupByLevel.containsKey(ScreenConstant.DISTRICT)){
// 区级
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.DISTRICT);
disPoseOrganize(customerGridInfoList,false,customerId,monthId);
}
if (groupByLevel.containsKey(ScreenConstant.CITY)){
// 市级
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.CITY);
disPoseOrganize(customerGridInfoList,false,customerId,monthId);
}
if (groupByLevel.containsKey(ScreenConstant.PROVINCE)){
// 省级
List<CustomerAgencyInfoResultDTO> customerGridInfoList = groupByLevel.get(ScreenConstant.PROVINCE);
disPoseOrganize(customerGridInfoList,false,customerId,monthId);
}
}
}
/**
* @Description 处理党员建群数群成员数
* @Param agencyIdList * @Param agencyIdList
* @Param isGrid * @Param isGrid
* @Param customerId * @Param customerId
@ -96,7 +178,7 @@ public class PartyGuideServiceImpl implements PartyGuideService {
* @author zxc * @author zxc
* @date 2020/9/25 2:57 下午 * @date 2020/9/25 2:57 下午
*/ */
public void disPose(List<CustomerAgencyInfoResultDTO> agencyIdList, Boolean isGrid, String customerId, String monthId) { public void disPoseParty(List<CustomerAgencyInfoResultDTO> agencyIdList, Boolean isGrid, String customerId, String monthId) {
List<ScreenPartyLinkMassesDataFormDTO> result = new ArrayList<>(); List<ScreenPartyLinkMassesDataFormDTO> result = new ArrayList<>();
if (!CollectionUtils.isEmpty(agencyIdList)){ if (!CollectionUtils.isEmpty(agencyIdList)){
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
@ -109,7 +191,7 @@ public class PartyGuideServiceImpl implements PartyGuideService {
Map<String, List<ScreenPartyLinkMassesDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyLinkMassesDataFormDTO::getParentId)); Map<String, List<ScreenPartyLinkMassesDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyLinkMassesDataFormDTO::getParentId));
groupByAgency.forEach((agencyId,gridList) -> { groupByAgency.forEach((agencyId,gridList) -> {
ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO();
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(result.stream().map(m -> m.getParentId()).distinct().collect(Collectors.toList())); List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds);
if (!CollectionUtils.isEmpty(orgNameAgencyList)){ if (!CollectionUtils.isEmpty(orgNameAgencyList)){
orgNameAgencyList.forEach(name -> { orgNameAgencyList.forEach(name -> {
if (agencyId.equals(name.getAgencyId())){ if (agencyId.equals(name.getAgencyId())){
@ -177,6 +259,68 @@ public class PartyGuideServiceImpl implements PartyGuideService {
} }
} }
/**
* @Description 处理参与人数组织次数
* @Param agencyIdList
* @Param isGrid
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 4:28 下午
*/
public void disPoseOrganize(List<CustomerAgencyInfoResultDTO> agencyIdList, Boolean isGrid, String customerId, String monthId){
if (!CollectionUtils.isEmpty(agencyIdList)){
List<ScreenPartyBranchDataFormDTO> result = new ArrayList<>();
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
if (isGrid == true){
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId);
agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId();
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
List<String> gridIds = (List<String>) agencyMap.get(agencyId);
orgIds.addAll(gridIds);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, gridIds);
if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){
screenPartyBranchDataList.forEach(party -> {
joinUserCountList.forEach(join -> {
if (party.getOrgId().equals(join.getOrgId())){
party.setAverageJoinUserCount(join.getJoinUserCount());
party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount());
}
});
});
}
result.addAll(screenPartyBranchDataList);
});
// 社区级别的
Map<String, List<ScreenPartyBranchDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId));
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds);
groupByAgency.forEach((agencyId,actList) -> {
ScreenPartyBranchDataFormDTO form = new ScreenPartyBranchDataFormDTO();
if (!CollectionUtils.isEmpty(orgNameAgencyList)){
orgNameAgencyList.forEach(name -> {
if (agencyId.equals(name.getAgencyId())){
form.setOrgName(name.getAgencyName());
form.setParentId(name.getParentId());
}
});
}
form.setOrgId(agencyId);
form.setCustomerId(customerId);
form.setOrgType(ScreenConstant.AGENCY);
form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)));
form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)));
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount());
result.add(form);
});
}else {
}
}
}
/** /**
* @Description 社区级别的处理 * @Description 社区级别的处理
* @Param customerId * @Param customerId
@ -245,9 +389,20 @@ public class PartyGuideServiceImpl implements PartyGuideService {
}); });
} }
/**
* @Description
* @Param result
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/25 5:50 下午
*/
@Transactional(rollbackFor = Exception.class)
public void delAndInsertOrganize(List<ScreenPartyBranchDataFormDTO> result,String customerId, String monthId, List<String> orgIds){
List<ScreenPartyBranchDataFormDTO> screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = gridService.selectAllGridIdToOrganize(customerId, monthId);
screenPartyBranchDataList.addAll(screenPartyBranchData);
}
// TODO 党员志愿服务【参与人数,组织次数】
} }

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

@ -18,6 +18,7 @@
package com.epmet.service.evaluationindex.screen; package com.epmet.service.evaluationindex.screen;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
@ -86,7 +87,9 @@ public interface ScreenCustomerAgencyService{
* @author zxc * @author zxc
* @date 2020/9/25 10:39 上午 * @date 2020/9/25 10:39 上午
*/ */
List<ScreenPartyLinkMassesDataFormDTO> selectAllAgencyIdToPartyLinkMessage(String customerId, String dateId); List<ScreenPartyLinkMassesDataFormDTO> selectAllAgencyIdToPartyLinkMessage(String customerId, String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllAgencyIdToOrganize(String customerId, String monthId);
/** /**
* @Description 查询org名称网格 * @Description 查询org名称网格

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

@ -19,10 +19,7 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.*;
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity;
@ -59,6 +56,7 @@ public interface ScreenCustomerGridService extends BaseService<ScreenCustomerGri
* @date 2020/9/25 10:43 上午 * @date 2020/9/25 10:43 上午
*/ */
List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(String customerId, String monthId); List<ScreenPartyLinkMassesDataFormDTO> selectAllGridIdToPartyLinkMessage(String customerId, String monthId);
List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(String customerId, String monthId);
/** /**
* @Description 查询机关的直属网格 * @Description 查询机关的直属网格

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

@ -26,6 +26,7 @@ import com.epmet.constant.ScreenConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO; import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO; import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.extract.result.OrgNameResultDTO; import com.epmet.dto.extract.result.OrgNameResultDTO;
@ -172,6 +173,11 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ
return screenCustomerAgencyDao.selectAllAgencyIdToPartyLinkMessage(customerId, monthId); return screenCustomerAgencyDao.selectAllAgencyIdToPartyLinkMessage(customerId, monthId);
} }
@Override
public List<ScreenPartyBranchDataFormDTO> selectAllAgencyIdToOrganize(String customerId, String monthId) {
return null;
}
/** /**
* @Description 查询org名称 * @Description 查询org名称
* @param gridIds * @param gridIds

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

@ -24,10 +24,7 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgSourceTypeConstant; import com.epmet.constant.OrgSourceTypeConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao; import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.*;
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.form.PartyBaseInfoFormDTO;
import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO;
import com.epmet.dto.extract.result.GridInfoResultDTO; import com.epmet.dto.extract.result.GridInfoResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity;
@ -122,6 +119,11 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
return screenCustomerGridDao.selectAllGridIdToPartyLinkMessage(customerId, monthId); return screenCustomerGridDao.selectAllGridIdToPartyLinkMessage(customerId, monthId);
} }
@Override
public List<ScreenPartyBranchDataFormDTO> selectAllGridIdToOrganize(String customerId, String monthId) {
return screenCustomerGridDao.selectAllGridIdToOrganize(customerId, monthId);
}
/** /**
* @Description 查询机关的直属网格 * @Description 查询机关的直属网格
* @param agencyIds * @param agencyIds

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActInfoService.java

@ -1,5 +1,7 @@
package com.epmet.service.heart; package com.epmet.service.heart;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -28,4 +30,14 @@ public interface ActInfoService {
* @Date 2020/9/21 16:43 * @Date 2020/9/21 16:43
**/ **/
Map<String, Integer> calActivityCountMap(String customerId, String monthId); Map<String, Integer> calActivityCountMap(String customerId, String monthId);
/**
* @Description 查询组织次数
* @Param customerId
* @Param monthId
* @Param orgType
* @author zxc
* @date 2020/9/25 4:00 下午
*/
List<ScreenPartyBranchDataFormDTO> selectActInfo(String customerId, String monthId, String orgType, List<String> orgIds);
} }

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java

@ -0,0 +1,22 @@
package com.epmet.service.heart;
import com.epmet.dto.extract.result.JoinUserCountResultDTO;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/9/25 5:17 下午
*/
public interface ActUserRelationService {
/**
* @Description 查询参与人数
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 5:19 下午
*/
List<JoinUserCountResultDTO> selectJoinUserCount(String customerId,String monthId);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActInfoServiceImpl.java

@ -3,11 +3,14 @@ package com.epmet.service.heart.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.heart.ActInfoDao; import com.epmet.dao.heart.ActInfoDao;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.service.heart.ActInfoService; import com.epmet.service.heart.ActInfoService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -58,4 +61,20 @@ public class ActInfoServiceImpl implements ActInfoService {
} }
return resultMap; return resultMap;
} }
/**
* @Description 查询组织次数
* @Param customerId
* @Param monthId
* @Param orgType
* @author zxc
* @date 2020/9/25 4:00 下午
*/
@Override
public List<ScreenPartyBranchDataFormDTO> selectActInfo(String customerId, String monthId, String orgType, List<String> orgIds) {
if (!CollectionUtils.isEmpty(orgIds)){
return baseDao.selectActInfo(customerId, monthId, orgType, orgIds);
}
return new ArrayList<>();
}
} }

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java

@ -0,0 +1,35 @@
package com.epmet.service.heart.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.heart.ActUserRelationDao;
import com.epmet.dto.extract.result.JoinUserCountResultDTO;
import com.epmet.service.heart.ActUserRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Author zxc
* @DateTime 2020/9/25 5:17 下午
*/
@Service
@DataSource(DataSourceConstant.EPMET_HEART)
public class ActUserRelationServiceImpl implements ActUserRelationService {
@Autowired
private ActUserRelationDao actUserRelationDao;
/**
* @Description 查询参与人数
* @Param customerId
* @Param monthId
* @author zxc
* @date 2020/9/25 5:19 下午
*/
@Override
public List<JoinUserCountResultDTO> selectJoinUserCount(String customerId, String monthId) {
return actUserRelationDao.selectJoinUserCount(customerId, monthId);
}
}

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

@ -320,4 +320,19 @@
del_flag = '0' del_flag = '0'
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
</select> </select>
<select id="selectAllAgencyIdToOrganize" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO">
SELECT
agency_id as orgId,
'agency' AS orgType,
AGENCY_NAME AS orgName,
CUSTOMER_ID AS customerId,
PID AS parentId,
#{monthId} AS dataEndTime
FROM
screen_customer_agency
WHERE
del_flag = '0'
AND CUSTOMER_ID = #{customerId}
</select>
</mapper> </mapper>

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

@ -312,4 +312,18 @@
del_flag = '0' del_flag = '0'
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
</select> </select>
<select id="selectAllGridIdToOrganize" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO">
SELECT
grid_id as orgId,
'grid' AS orgType,
grid_name AS orgName,
CUSTOMER_ID AS customerId,
PARENT_AGENCY_ID AS parentId,
#{monthId} AS dataEndTime
FROM
screen_customer_grid
WHERE
del_flag = '0'
AND CUSTOMER_ID = #{customerId}
</select>
</mapper> </mapper>

28
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml

@ -32,4 +32,32 @@
vi.USER_ID =#{userId} vi.USER_ID =#{userId}
</foreach> </foreach>
</select> </select>
<!-- 查询组织次数 -->
<select id="selectActInfo" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO">
SELECT
CUSTOMER_ID,
SUBSTR( #{monthId}, 1, 4 ) AS yearId,
#{monthId} AS monthId,
SPONSOR_TYPE AS orgType,
SPONSOR_ID AS orgId,
SPONSOR_NAME AS orgName,
PID AS parentId ,
COUNT(ID) AS organizeCount
FROM
act_info
WHERE
DEL_FLAG = 0
AND ACT_STATUS = 'finished'
AND CUSTOMER_ID = #{customerId}
AND DATE_FORMAT( ACTUAL_END_TIME, '%Y%m' ) = #{monthId}
AND SPONSOR_TYPE = #{orgType}
AND
(
<foreach collection="orgIds" item="orgId" separator=" OR ">
SPONSOR_ID = #{orgId}
</foreach>
)
GROUP BY SPONSOR_ID
</select>
</mapper> </mapper>

24
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.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.dao.heart.ActUserRelationDao">
<!-- 查询参与人数 -->
<select id="selectJoinUserCount" resultType="com.epmet.dto.extract.result.JoinUserCountResultDTO">
SELECT
ai.SPONSOR_ID AS orgId,
COUNT(asr.USER_ID) AS joinUserCount
FROM
act_user_relation asr
LEFT JOIN act_info ai ON asr.ACT_ID = ai.ID
WHERE
ai.DEL_FLAG = 0
AND asr.DEL_FLAG = '0'
AND ai.ACT_STATUS = 'finished'
AND asr.REWARD_FLAG = 'agree'
AND ai.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId}
AND ai.SPONSOR_TYPE = 'agency'
GROUP BY ai.SPONSOR_ID
</select>
</mapper>
Loading…
Cancel
Save