Browse Source

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

master
zxc 5 years ago
parent
commit
c89fe0d928
  1. 3
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java
  3. 51
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java
  5. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java
  6. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml
  7. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml

3
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java

@ -88,6 +88,9 @@ public class ScreenPartyBranchDataFormDTO implements Serializable {
private String updatedBy; private String updatedBy;
public ScreenPartyBranchDataFormDTO() { public ScreenPartyBranchDataFormDTO() {
this.organizeCount = NumConstant.ZERO;
this.joinUserCount = NumConstant.ZERO;
this.averageJoinUserCount = NumConstant.ZERO;
this.delFlag = NumConstant.ZERO_STR; this.delFlag = NumConstant.ZERO_STR;
this.revision = NumConstant.ZERO; this.revision = NumConstant.ZERO;
this.createdBy = "APP_USER"; this.createdBy = "APP_USER";

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

@ -20,6 +20,6 @@ public interface ActUserRelationDao {
* @author zxc * @author zxc
* @date 2020/9/25 5:19 下午 * @date 2020/9/25 5:19 下午
*/ */
List<JoinUserCountResultDTO> selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId); List<JoinUserCountResultDTO> selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("orgType") String orgType);
} }

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

@ -76,7 +76,7 @@ public class PartyGuideServiceImpl implements PartyGuideService {
} }
String monthId = screenExtractFormDTO.getMonthId(); String monthId = screenExtractFormDTO.getMonthId();
if (StringUtils.isEmpty(monthId)){ if (StringUtils.isEmpty(monthId)){
monthId = LocalDate.now().toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX);
} }
if (!CollectionUtils.isEmpty(customerIds)){ if (!CollectionUtils.isEmpty(customerIds)){
String finalMonthId = monthId; String finalMonthId = monthId;
@ -273,8 +273,10 @@ public class PartyGuideServiceImpl implements PartyGuideService {
if (!CollectionUtils.isEmpty(agencyIdList)){ if (!CollectionUtils.isEmpty(agencyIdList)){
List<ScreenPartyBranchDataFormDTO> result = new ArrayList<>(); List<ScreenPartyBranchDataFormDTO> result = new ArrayList<>();
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
List<JoinUserCountResultDTO> joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds);
if (isGrid == true){ if (isGrid == true){
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID);
agencyIdList.forEach(agency -> { agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId(); String agencyId = agency.getAgencyId();
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
@ -286,7 +288,7 @@ public class PartyGuideServiceImpl implements PartyGuideService {
joinUserCountList.forEach(join -> { joinUserCountList.forEach(join -> {
if (party.getOrgId().equals(join.getOrgId())){ if (party.getOrgId().equals(join.getOrgId())){
party.setAverageJoinUserCount(join.getJoinUserCount()); party.setAverageJoinUserCount(join.getJoinUserCount());
party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount()); party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount());
party.setYearId(DateUtils.getYearId(monthId)); party.setYearId(DateUtils.getYearId(monthId));
} }
}); });
@ -314,7 +316,17 @@ public class PartyGuideServiceImpl implements PartyGuideService {
form.setYearId(DateUtils.getYearId(monthId)); form.setYearId(DateUtils.getYearId(monthId));
form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)));
form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)));
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); screenPartyBranchDataByAgencyList.forEach(organize -> {
if (organize.getOrgId().equals(agencyId)){
form.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))));
}
});
joinUserCountByAgencyList.forEach(join -> {
if (join.getOrgId().equals(agencyId)){
form.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))));
}
});
form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount()));
result.add(form); result.add(form);
}); });
delAndInsertOrganize(result,customerId,monthId,orgIds); delAndInsertOrganize(result,customerId,monthId,orgIds);
@ -330,15 +342,17 @@ public class PartyGuideServiceImpl implements PartyGuideService {
}); });
// 存在直属网格 // 存在直属网格
if (!CollectionUtils.isEmpty(disGridIds)){ if (!CollectionUtils.isEmpty(disGridIds)){
orgIds.addAll(disGridIds);
List<ScreenPartyBranchDataFormDTO> gridResult = new ArrayList<>(); List<ScreenPartyBranchDataFormDTO> gridResult = new ArrayList<>();
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID);
List<OrgNameResultDTO> orgNameList = agencyService.selectOrgNameGrid(disGridIds);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds);
if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){
screenPartyBranchDataList.forEach(party -> { screenPartyBranchDataList.forEach(party -> {
orgNameList.forEach(org -> { joinUserCountList.forEach(join -> {
if (party.getOrgId().equals(org.getGridId())){ if (party.getOrgId().equals(join.getOrgId())){
party.setOrgName(org.getGridName()); party.setAverageJoinUserCount(join.getJoinUserCount());
party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount());
party.setYearId(DateUtils.getYearId(monthId));
} }
}); });
ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class); ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class);
@ -360,7 +374,17 @@ public class PartyGuideServiceImpl implements PartyGuideService {
form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId()); form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId());
form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)));
form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)));
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); screenPartyBranchDataByAgencyList.forEach(organize -> {
if (organize.getOrgId().equals(agencyId)){
form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))));
}
});
joinUserCountByAgencyList.forEach(join -> {
if (join.getOrgId().equals(agencyId)){
form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))));
}
});
form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount()));
result.add(form); result.add(form);
} }
}); });
@ -369,6 +393,13 @@ public class PartyGuideServiceImpl implements PartyGuideService {
} }
} }
public Integer calAdd(Integer a, Integer b){
if (null != a && null != b){
return a + b;
}
return NumConstant.ZERO;
}
/** /**
* @Description 社区级别的处理 * @Description 社区级别的处理
* @Param customerId * @Param customerId

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

@ -17,6 +17,6 @@ public interface ActUserRelationService {
* @author zxc * @author zxc
* @date 2020/9/25 5:19 下午 * @date 2020/9/25 5:19 下午
*/ */
List<JoinUserCountResultDTO> selectJoinUserCount(String customerId,String monthId); List<JoinUserCountResultDTO> selectJoinUserCount(String customerId,String monthId, String orgType);
} }

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

@ -29,7 +29,7 @@ public class ActUserRelationServiceImpl implements ActUserRelationService {
* @date 2020/9/25 5:19 下午 * @date 2020/9/25 5:19 下午
*/ */
@Override @Override
public List<JoinUserCountResultDTO> selectJoinUserCount(String customerId, String monthId) { public List<JoinUserCountResultDTO> selectJoinUserCount(String customerId, String monthId, String orgType) {
return actUserRelationDao.selectJoinUserCount(customerId, monthId); return actUserRelationDao.selectJoinUserCount(customerId, monthId, orgType);
} }
} }

8
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml

@ -128,8 +128,8 @@
<select id="selectScreenPartyBranchDataByOrgId" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO"> <select id="selectScreenPartyBranchDataByOrgId" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO">
SELECT SELECT
ORG_ID, ORG_ID,
ORGANIZE_COUNT, ORGANIZE_COUNT AS organizeCount,
JOIN_USER_COUNT JOIN_USER_COUNT AS joinUserCount
FROM FROM
screen_party_branch_data screen_party_branch_data
WHERE WHERE
@ -154,8 +154,8 @@
spbd.PARENT_ID AS orgId, spbd.PARENT_ID AS orgId,
spbd.ORG_TYPE, spbd.ORG_TYPE,
sca.AGENCY_NAME AS orgName, sca.AGENCY_NAME AS orgName,
spbd.ORGANIZE_COUNT, IFNULL(spbd.ORGANIZE_COUNT,0) AS organizeCount,
spbd.JOIN_USER_COUNT IFNULL(spbd.JOIN_USER_COUNT,0) AS joinUserCount
FROM FROM
screen_party_branch_data spbd screen_party_branch_data spbd
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = spbd.PARENT_ID LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = spbd.PARENT_ID

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml

@ -18,7 +18,7 @@
AND asr.REWARD_FLAG = 'agree' AND asr.REWARD_FLAG = 'agree'
AND ai.CUSTOMER_ID = #{customerId} AND ai.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId} AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId}
AND ai.SPONSOR_TYPE = 'agency' AND ai.SPONSOR_TYPE = #{orgType}
GROUP BY ai.SPONSOR_ID GROUP BY ai.SPONSOR_ID
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save