Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_screen_data_2.0

master
wangchao 5 years ago
parent
commit
d9ac797feb
  1. 1
      epmet-gateway/src/main/resources/bootstrap.yml
  2. 31
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java
  3. 53
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java
  4. 11
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  5. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  6. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  7. 33
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  8. 23
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  9. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java
  10. 45
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  11. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  13. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java
  14. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  15. 14
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  16. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java
  17. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  18. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java
  19. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java
  20. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  21. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  22. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  23. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  24. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  25. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  26. 8
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenIndexDataMonthlyDao.xml

1
epmet-gateway/src/main/resources/bootstrap.yml

@ -441,6 +441,7 @@ epmet:
# 外部应用认证,使用AccessToken等头进行认证
externalAuthUrls:
- /data/report/**
- /data/stats/**
- /epmetuser/customerstaff/customerlist
swaggerUrls:

31
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/AdvancedBranchRankFormDTO.java

@ -0,0 +1,31 @@
package com.epmet.evaluationindex.screen.dto.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* 先进排行-先进支部排行--接口入参
* @Author sun
*/
@Data
public class AdvancedBranchRankFormDTO implements Serializable {
private static final long serialVersionUID = -8674763412362557239L;
/**
* 机关Id
* */
@NotBlank(message = "机关Id不能为空" , groups = AdvancedBranchRankFormDTO.AddUserInternalGroup.class)
private String agencyId;
/**
* 显示多少条
* */
@Min(value = 1, message = "查询条数必须大于0", groups = {AdvancedBranchRankFormDTO.AddUserInternalGroup.class })
private Integer topNum;
/**
* 月份Id
* */
private String monthId;
public interface AddUserInternalGroup {}
}

53
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexAdvanceBranchRankResultDTO.java

@ -0,0 +1,53 @@
package com.epmet.evaluationindex.screen.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 先进排行-先进支部排行--接口返参
*
* @Author sun
*/
@Data
public class IndexAdvanceBranchRankResultDTO implements Serializable {
private static final long serialVersionUID = 330099297596334388L;
/**
* 名称 XXXX社区党委
*/
private String name;
/**
* 指标得分
*/
@JsonIgnore
private String totalScore;
private BigDecimal scroe;
/**
* 党员数
*/
private Integer partyMemberNum;
/**
* 议题数
*/
private Integer issueNum;
/**
* 项目数
*/
private Integer projectNum;
/**
* 满意度 90.64% 返回字符串前端直接显示
*/
private String satisfactionRatio;
/**
* 结案率 94.3% 返回字符串前端直接显示
*/
private String closedProjectRatio;
}

11
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -113,5 +113,16 @@ public class IndexController {
return new Result<IndexScoreResultDTO>().ok(indexService.indexScore(formDTO));
}
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
@PostMapping("advancedbranchrank")
Result<List<IndexAdvanceBranchRankResultDTO>> advancedBranchRank(@RequestBody AdvancedBranchRankFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, AdvancedBranchRankFormDTO.AddUserInternalGroup.class);
return new Result<List<IndexAdvanceBranchRankResultDTO>>().ok(indexService.advancedBranchRank(formDTO));
}
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java

@ -88,4 +88,11 @@ public interface ScreenIndexDataMonthlyDao{
* @author sun
*/
IndexScoreResultDTO selectMonthData(IndexScoreFormDTO formDTO);
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
List<IndexAdvanceBranchRankResultDTO> selectRankList(AdvancedBranchRankFormDTO formDTO);
}

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java

@ -69,4 +69,11 @@ public interface IndexService {
* @author sun
*/
IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO);
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
List<IndexAdvanceBranchRankResultDTO> advancedBranchRank(AdvancedBranchRankFormDTO formDTO);
}

33
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -11,9 +11,11 @@ import com.epmet.evaluationindex.screen.constant.ScreenConstant;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.commons.lang3.StringUtils;
import org.jsoup.helper.DataUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.unit.DataUnit;
import java.math.BigDecimal;
import java.text.NumberFormat;
@ -283,8 +285,6 @@ public class IndexServiceImpl implements IndexService {
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);
BigDecimal num = new BigDecimal(resultDTO.getTotal()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setTotalScore(num);
BigDecimal num1 = new BigDecimal(resultDTO.getParty()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setPartyDevAbility(num1);
resultDTO.setPartyDevAbilityWeight(nf.format(Double.parseDouble(resultDTO.getPartyDevAbilityWeight())));
@ -294,8 +294,37 @@ public class IndexServiceImpl implements IndexService {
BigDecimal num3 = new BigDecimal(resultDTO.getService()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setServiceAbility(num3);
resultDTO.setServiceAbilityWeight(nf.format(Double.parseDouble(resultDTO.getServiceAbilityWeight())));
Double db = num1.doubleValue() + num2.doubleValue() + num3.doubleValue();
BigDecimal num = new BigDecimal(db.toString()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setTotalScore(num);
return resultDTO;
}
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @author sun
*/
@Override
public List<IndexAdvanceBranchRankResultDTO> advancedBranchRank(AdvancedBranchRankFormDTO formDTO) {
//根据当前所选组织,查询screen_index_data_monthly中类型为网格的按照总指数倒序,关联screen_org_rank_data表取其他数据
//1.级联查询组织下所有网格的先进支部排行数据,按总指数降序
formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
List<IndexAdvanceBranchRankResultDTO> list = screenIndexDataMonthlyDao.selectRankList(formDTO);
//2.遍历数据,小数保留一位小数,百分数添加百分号
NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);
list.forEach(l->{
BigDecimal num = new BigDecimal(l.getTotalScore()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
l.setScroe(num);
BigDecimal num1 = new BigDecimal(l.getSatisfactionRatio()).setScale(1, BigDecimal.ROUND_HALF_UP);
l.setSatisfactionRatio(num1 + "%");
BigDecimal num2 = new BigDecimal(l.getClosedProjectRatio()).setScale(1, BigDecimal.ROUND_HALF_UP);
l.setClosedProjectRatio(num2 + "%");
});
return list;
}
}

23
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -193,4 +193,27 @@
AND month_id = #{monthId}
</select>
<select id="selectRankList" resultType="com.epmet.evaluationindex.screen.dto.result.IndexAdvanceBranchRankResultDTO">
SELECT
dm.org_name AS "name",
dm.index_total AS "totalScore",
rd.party_total AS "partyMemberNum",
rd.issue_total AS "issueNum",
rd.project_total AS "projectNum",
rd.close_project_ratio AS "closedProjectRatio",
rd.satisfaction_ratio AS "satisfactionRatio"
FROM
screen_index_data_monthly dm
INNER JOIN screen_org_rank_data rd ON dm.org_id = rd.org_id
AND dm.month_id = rd.month_id
WHERE
dm.del_flag = '0'
AND rd.del_flag = '0'
AND dm.org_type = 'grid'
AND dm.month_id = #{monthId}
AND dm.all_parent_ids LIKE concat('%', #{agencyId}, '%')
ORDER BY dm.index_total DESC
LIMIT #{topNum}
</select>
</mapper>

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/IndexDataMonthlyFormDTO.java

@ -41,6 +41,11 @@ public class IndexDataMonthlyFormDTO implements Serializable {
*/
private String parentId;
/**
* 所有上级ID用英文逗号分开
*/
private String allParentIds;
/**
* 组织名称
*/

45
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -11,21 +11,23 @@ import com.epmet.dao.evaluationindex.indexcal.GridScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerGridDao;
import com.epmet.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.dao.stats.DimCustomerDao;
import com.epmet.dao.stats.DimDateDao;
import com.epmet.dao.stats.DimMonthDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.dto.extract.form.ScreenExtractFormDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity;
import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity;
import com.epmet.entity.stats.DimAgencyEntity;
import com.epmet.entity.stats.DimCustomerEntity;
import com.epmet.entity.stats.DimDateEntity;
@ -37,8 +39,6 @@ import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollCommunityS
import com.epmet.service.evaluationindex.extract.dataToIndex.IndexCollStreetService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginTopicMainDailyService;
import com.epmet.service.evaluationindex.extract.todata.GroupExtractService;
import com.epmet.service.evaluationindex.extract.todata.ProjectExtractService;
import com.epmet.service.evaluationindex.extract.toscreen.*;
import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.stats.DimAgencyService;
@ -718,5 +718,42 @@ public class DemoController {
}
@Autowired
private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
/**
* @return com.epmet.commons.tools.utils.Result
* @param
* @author yinzuomei
* @description screen_index_data_monthly 赋值ALL_PARENT_IDS
* @Date 2020/10/10 17:59
**/
@DataSource(DataSourceConstant.EVALUATION_INDEX)
@PostMapping("updateDeptIndexMonthly")
public Result updateDeptIndexMonthly(){
QueryWrapper<ScreenIndexDataMonthlyEntity> wrapper = new QueryWrapper<>();
wrapper.eq("ORG_TYPE", "department");
List<ScreenIndexDataMonthlyEntity> list=screenIndexDataMonthlyDao.selectList(wrapper);
int updateNum=0;
for(ScreenIndexDataMonthlyEntity entity:list){
if(StringUtils.isNotBlank(entity.getParentId())){
ScreenCustomerAgencyEntity agencyEntity=screenCustomerAgencyDao.selectByAgencyId(entity.getParentId());
if(null!=agencyEntity){
//根组织下的部门
if("0".equals(agencyEntity.getPid())){
log.info("根组织下的部门");
entity.setAllParentIds(agencyEntity.getAgencyId());
}else{
entity.setAllParentIds(agencyEntity.getPids().concat(",").concat(agencyEntity.getAgencyId()));
}
updateNum+=screenIndexDataMonthlyDao.updateParentIdsById(entity.getId(),entity.getAllParentIds());
}
}
}
log.info("影响行数="+updateNum);
return new Result();
}
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java

@ -113,7 +113,8 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
* @param customerId
* @param gridId
* @param communityId
* @param closedStatus
* @param closedStatus :resolved unresolved
* @param projectStatus :pending closed
* @author yinzuomei
* @description 具体某个网格或者社区内的项目
* @Date 2020/9/23 18:18
@ -121,20 +122,23 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
Integer getGridOrCommunityClosedProjectTotal(@Param("customerId")String customerId,
@Param("gridId") String gridId,
@Param("communityId") String communityId,
@Param("closedStatus") String closedStatus);
@Param("closedStatus") String closedStatus,
@Param("projectStatus") String projectStatus);
/**
* @return int
* @param customerId
* @param agencyPath
* @param closedStatus
* @param closedStatus :resolved unresolved
* @param projectStatus :pending closed
* @author yinzuomei
* @description 组织下已解决项目 or 已结案项目总数
* @Date 2020/9/24 17:38
**/
int getAgencyClosedProjectTotal(@Param("customerId") String customerId,
@Param("agencyPath")String agencyPath,
@Param("closedStatus")String closedStatus);
@Param("closedStatus")String closedStatus,
@Param("projectStatus") String projectStatus);
/**
* 组织自治项目数

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java

@ -95,4 +95,6 @@ public interface ScreenIndexDataMonthlyDao extends BaseDao<ScreenIndexDataMonthl
Integer deleteIndexDataMonthlyByOrgType(@Param("customerId") String customerId,
@Param("monthId") String monthId,
@Param("orgType") String orgType);
int updateParentIdsById(@Param("id") String id, @Param("allParentIds") String allParentIds);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenIndexDataMonthlyEntity.java

@ -109,4 +109,6 @@ public class ScreenIndexDataMonthlyEntity extends BaseEpmetEntity {
* 治理能力分数权重
*/
private BigDecimal governAblityWeight;
private String allParentIds;
}

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

@ -25,7 +25,6 @@ import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.screen.form.ProjectSourceMapFormDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import java.util.List;
import java.util.Map;
@ -171,23 +170,25 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
* @return java.lang.Integer
* @param customerId
* @param gridId
* @param closedStatus
* @param closedStatus :resolved unresolved
* @param projectStatus :pending closed
* @author yinzuomei
* @description 具体某个网格内的项目
* @Date 2020/9/23 18:17
**/
Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId, String communityId,String closedStatus);
Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId, String communityId,String closedStatus,String projectStatus);
/**
* @return int
* @param customerId
* @param agencyPath
* @param closedStatus
* @param closedStatus :resolved unresolved
* @param projectStatus :pending closed
* @author yinzuomei
* @description 组织下已解决项目 or 已结案项目总数
* @Date 2020/9/24 17:37
**/
int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus);
int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus,String projectStatus);
/**
* 自治项目数

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

@ -176,29 +176,31 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
/**
* @param customerId
* @param gridId
* @param closedStatus
* @param closedStatus :resolved unresolved
* @param projectStatus :pending closed
* @return java.lang.Integer
* @author yinzuomei
* @description 具体某个网格内的项目
* @Date 2020/9/23 18:17
**/
@Override
public Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId,String communityId, String closedStatus) {
return baseDao.getGridOrCommunityClosedProjectTotal(customerId,gridId,communityId,closedStatus);
public Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId,String communityId, String closedStatus,String projectStatus) {
return baseDao.getGridOrCommunityClosedProjectTotal(customerId,gridId,communityId,closedStatus,projectStatus);
}
/**
* @param customerId
* @param agencyPath
* @param closedStatus
* @param closedStatus :resolved unresolved
* @param projectStatus :pending closed
* @return int
* @author yinzuomei
* @description 组织下已解决项目 or 已结案项目总数
* @Date 2020/9/24 17:37
**/
@Override
public int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus) {
return baseDao.getAgencyClosedProjectTotal(customerId,agencyPath,closedStatus);
public int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus,String projectStatus) {
return baseDao.getAgencyClosedProjectTotal(customerId,agencyPath,closedStatus,projectStatus);
}
@Override

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

@ -5,6 +5,7 @@ import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.constant.DimObjectStatusConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.entity.evaluationindex.screen.ScreenPioneerDataEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueLogDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginIssueMainDailyService;
@ -284,7 +285,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
//组织下:已解决项目 or 已结案项目总数
private int getAgencyClosedProjectTotal(String customerId, String agencyPath, String closedStatus) {
return factOriginProjectMainDailyService.getAgencyClosedProjectTotal(customerId,agencyPath,closedStatus);
return factOriginProjectMainDailyService.getAgencyClosedProjectTotal(customerId,agencyPath,closedStatus, ProjectConstant.CLOSED);
}
//组织下:议题转项目数
@ -317,7 +318,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService
* @description 网格或者社区下: 已解决项目
**/
private Integer getGridOrCommunityClosedProjectTotal(String customerId, String gridId, String communityId, String closedStatus) {
return factOriginProjectMainDailyService.getGridOrCommunityClosedProjectTotal(customerId, gridId, communityId, closedStatus);
return factOriginProjectMainDailyService.getGridOrCommunityClosedProjectTotal(customerId, gridId, communityId, closedStatus,ProjectConstant.CLOSED);
}
/**

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java

@ -134,7 +134,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
//获取该能力下的分数
List<DeptSubScoreEntity> subScore = deptSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java

@ -123,7 +123,7 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
//获取该能力下的分数
List<GridSubScoreEntity> subScore = gridSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
log.warn("calculateSelfSubScore gridSubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java

@ -132,7 +132,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
//获取该能力下的分数
List<FactIndexCommunitySubScoreEntity> subScore = communitySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();
@ -204,7 +204,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
if (IndexCodeEnum.XIA_SHU_SUO_YOU_WGDDJNLPJZ.getCode().equals(detail.getIndexCode())) {
List<SubGridAvgResultDTO> subGridPartyAvgScore = factIndexGridScoreDao.selectSubGridAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.error(IndexCalConstant.GRID_PARTY_AVG_NULL);
log.warn(IndexCalConstant.GRID_PARTY_AVG_NULL);
} else {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubGridAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE);
@ -298,7 +298,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
// 治理能力的六个五级指标
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL);
if (CollectionUtils.isEmpty(communityGovernAbility)){
log.error(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL);
log.warn(IndexCalConstant.COMMUNITY_GOVERN_ABILITY_NULL);
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -370,7 +370,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni
} else {
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.COMMUNITY_LEVEL);
if (CollectionUtils.isEmpty(communityActivityCountList)) {
log.error(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL);
log.warn(IndexCalConstant.COMMUNITY_SERVICE_ABILITY_NULL);
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java

@ -130,7 +130,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
//获取该能力下的分数
List<AgencySubScoreEntity> subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.DISTRICT, levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();
@ -202,7 +202,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(subGridPartyAvgScore)) {
log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL);
log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL);
} else if (subGridPartyAvgScore.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE);
@ -283,7 +283,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
}
}
if (CollectionUtils.isEmpty(districtGovernAvgList)) {
log.error("查询所有街道治理能力平均值集合为空");
log.warn("查询所有街道治理能力平均值集合为空");
} else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE);
@ -363,7 +363,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
}
}
if (CollectionUtils.isEmpty(subStreetAvgList)) {
log.error("查询区下属街道服务能力汇总平均值集合为空");
log.warn("查询区下属街道服务能力汇总平均值集合为空");
} else{
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList()));
List<List<SubAgencyScoreAvgResultDTO>> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE);

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java

@ -133,7 +133,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
//获取该能力下的分数
List<AgencySubScoreEntity> subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.STREET, levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
log.warn("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();
@ -205,7 +205,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
if (IndexCodeEnum.JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ.getCode().equals(detail.getIndexCode())) {
List<SubCommunityAvgResultDTO> subCommPartyAvgScore = communityScoreDao.selectSubCommAvgScore(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode());
if (CollectionUtils.isEmpty(subCommPartyAvgScore)) {
log.error(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL);
log.warn(IndexCalConstant.COMMUNITY_PARTY_AVG_NULL);
} else if (subCommPartyAvgScore.size() > NumConstant.ZERO) {
MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subCommPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList()));
Integer indexEnd = NumConstant.TEN;
@ -299,7 +299,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
// 治理能力的六个五级指标
List<Map<String, Object>> communityGovernAbility = factIndexGovrnAblityOrgMonthlyDao.selectCommunityGovernAbility(customerId, monthId,IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(communityGovernAbility)){
log.error(IndexCalConstant.STREET_GOVERN_ABILITY_NULL);
log.warn(IndexCalConstant.STREET_GOVERN_ABILITY_NULL);
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {
@ -371,7 +371,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
} else {
List<Map<String, Object>> communityActivityCountList = factIndexServiceAblityOrgMonthlyDao.selectActivityCountMap(customerId, monthId,IndexCalConstant.STREET_LEVEL);
if (CollectionUtils.isEmpty(communityActivityCountList)) {
log.error(IndexCalConstant.STREET_SERVICE_ABILITY_NULL);
log.warn(IndexCalConstant.STREET_SERVICE_ABILITY_NULL);
}else{
String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode());
if (StringUtils.isEmpty(fieldNameByIndexCode)) {

75
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant;
@ -23,16 +24,20 @@ import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
@ -43,6 +48,7 @@ import java.util.stream.Collectors;
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class FactIndexCollectServiceImpl implements FactIndexCollectService {
Cache<String, String> allParentIds = CacheBuilder.newBuilder().expireAfterWrite(2, TimeUnit.HOURS).build();
@Autowired
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao;
@ -219,6 +225,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly
this.insertIndexDataYear(monthId, customerId);
allParentIds.invalidateAll();
}
/**
@ -283,6 +290,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 补充表中其他字段
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScoreDTOS.get(i).getGridId(),
gridScoreDTOS.get(i).getParentAgencyId(), gridScoreDTOS.get(i).getGridName(), monthlyDTO);
monthlyDTO.setAllParentIds(gridScoreDTOS.get(i).getAllParentIds());
monthlyFormDTOList.add(monthlyDTO);
}
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
@ -298,21 +306,26 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS){
private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS) {
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据
Map<String, List<FactIndexGridScoreDTO>> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId));
// 查询网格的 上级组织id 和 组织名称
List<ScreenCustomerGridDTO> parentGridList = screenCustomerGridDao.selectListGridInfo(customerId);
for(Map.Entry<String,List<FactIndexGridScoreDTO>> gridScore : collect.entrySet()){
if (!CollectionUtils.isEmpty(parentGridList)) {
parentGridList.forEach(o -> {
allParentIds.put(o.getGridId(), o.getGridId());
});
}
for (Map.Entry<String, List<FactIndexGridScoreDTO>> gridScore : collect.entrySet()) {
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 给4个指数 赋默认值
monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO);
for ( int i = 0; i < gridScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())){
for (int i = 0; i < gridScore.getValue().size(); i++) {
if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())) {
// 是总分
if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())){
if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())) {
// 总指数 = 网格相关
monthlyFormDTO.setIndexTotal(gridScore.getValue().get(i).getScore());
}
@ -339,6 +352,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.GRID, gridScore.getKey(),
parentAgencyId, gridName, monthlyFormDTO);
monthlyFormDTO.setAllParentIds(allParentIds.getIfPresent(monthlyFormDTO.getOrgId()));
monthlyFormDTOList.add(monthlyFormDTO);
}
if (monthlyFormDTOList.size() > NumConstant.ZERO){
@ -409,6 +423,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 补充表中其他字段
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScoreDTOS.get(i).getAgencyId(),
communityScoreDTOS.get(i).getPid(), communityScoreDTOS.get(i).getAgencyName(), monthlyDTO);
monthlyDTO.setAllParentIds(communityScoreDTOS.get(i).getPids());
monthlyFormDTOList.add(monthlyDTO);
}
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
@ -424,20 +439,25 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List<FactIndexCommunityScoreDTO> communityScoreDTOS){
private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List<FactIndexCommunityScoreDTO> communityScoreDTOS) {
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map<String, List<FactIndexCommunityScoreDTO>> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId));
// 根据客户id,查询区/街道 组织名称、id
List<ScreenCustomerAgencyEntity> parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId);
for(Map.Entry<String,List<FactIndexCommunityScoreDTO>> communityScore : collect.entrySet()){
if (!CollectionUtils.isEmpty(parentAgencyList)) {
parentAgencyList.forEach(o -> {
allParentIds.put(o.getAgencyId(), o.getPids());
});
}
for (Map.Entry<String, List<FactIndexCommunityScoreDTO>> communityScore : collect.entrySet()) {
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 给4个指数 赋默认值
monthlyFormDTO = this.setIndexDefaultValueFor(monthlyFormDTO);
for ( int i = 0; i < communityScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())){
for (int i = 0; i < communityScore.getValue().size(); i++) {
if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())) {
// 是总分
if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())){
if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())) {
// 总指数 = 社区相关
monthlyFormDTO.setIndexTotal(communityScore.getValue().get(i).getScore());
}
@ -465,6 +485,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, communityScore.getKey(),
parentAgencyId, agencyName, monthlyFormDTO);
monthlyFormDTO.setAllParentIds(allParentIds.getIfPresent(monthlyFormDTO.getOrgId()));
// 补充表中其他字段
monthlyFormDTOList.add(monthlyFormDTO);
}
@ -497,7 +518,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null);
}
if (!CollectionUtils.isEmpty(mismatchDeptList)){
if (!CollectionUtils.isEmpty(mismatchDeptList)) {
mismatchDeptList.forEach(o -> {
String pids = allParentIds.getIfPresent(o.getParentAgencyId());
if (!StringUtils.isEmpty(pids)) {
allParentIds.put(o.getDeptId(), pids.concat(StrConstant.COLON).concat(o.getParentAgencyId()));
}
});
// 如果进行不匹配查询,查到了其他部门信息,一律赋默认值
this.insertIndexMonthlyByDeptDefaultScore(monthId, customerId, mismatchDeptList);
}
@ -534,6 +561,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 补充表中其他字段
monthlyDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScoreDTOS.get(i).getDeptId(),
deptScoreDTOS.get(i).getParentAgencyId(), deptScoreDTOS.get(i).getDeptName(), monthlyDTO);
monthlyDTO.setAllParentIds(allParentIds.getIfPresent(monthlyDTO.getOrgId()));
monthlyFormDTOList.add(monthlyDTO);
}
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
@ -579,12 +607,18 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
deptName = deptEntity.getDeptName();
}
}
if ("".equals(parentAgencyId)){
throw new RuntimeException("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey());
if ("".equals(parentAgencyId)) {
log.error("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey());
continue;
}
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.DEPARTMENT, deptScore.getKey(),
parentAgencyId, deptName, monthlyFormDTO);
//部门表没有 allParentIds 所以直接获取 然后拼接
String ppIds = allParentIds.getIfPresent(monthlyFormDTO.getParentId());
if (!StringUtils.isEmpty(ppIds)) {
monthlyFormDTO.setAllParentIds(ppIds.concat(StrConstant.COLON).concat(monthlyFormDTO.getParentId()));
}
monthlyFormDTOList.add(monthlyFormDTO);
}
if (monthlyFormDTOList.size() > NumConstant.ZERO){
@ -634,13 +668,18 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List<AgencyScoreDTO> agencyScoreDTOS){
private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List<AgencyScoreDTO> agencyScoreDTOS) {
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map<String, List<AgencyScoreDTO>> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId));
List<ScreenCustomerAgencyEntity> parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId);
int j = 0;
for(Map.Entry<String,List<AgencyScoreDTO>> agencyScore : collect.entrySet()){
if (!CollectionUtils.isEmpty(parentAgencyList)) {
parentAgencyList.forEach(o -> {
allParentIds.put(o.getAgencyId(), o.getPids());
});
}
for (Map.Entry<String, List<AgencyScoreDTO>> agencyScore : collect.entrySet()) {
if (NumConstant.ZERO_STR.equals(agencyScore.getKey())) {
log.warn("insertIndexDataMonthlyByAgencyScore agencyyId is 0");
continue;
@ -669,12 +708,16 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
agencyName = agencyScoreDTO.getAgencyName();
}
}
if ("".equals(agencyName)){
if ("".equals(agencyName)) {
throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey());
}
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(monthId, OrgTypeConstant.AGENCY, agencyScore.getKey(),
parentAgencyId, agencyName, monthlyFormDTO);
if ("S2-C1".equals(monthlyFormDTO.getOrgId())) {
System.out.println("======" + allParentIds.getIfPresent(monthlyFormDTO.getOrgId()));
}
monthlyFormDTO.setAllParentIds(allParentIds.getIfPresent(monthlyFormDTO.getOrgId()));
monthlyFormDTOList.add(monthlyFormDTO);
}
if (monthlyFormDTOList.size() > NumConstant.ZERO){

10
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -160,7 +160,10 @@
and t1.AGENCY_ID=#{communityId}
</if>
<if test='null != closedStatus and "" != closedStatus'>
and t1.CLOSED_STATUS=#{closedStatus}
and t1.IS_RESOLVED=#{closedStatus}
</if>
<if test='null != projectStatus and "" != projectStatus'>
and t1.PROJECT_STATUS=#{projectStatus}
</if>
</select>
@ -175,7 +178,10 @@
AND T1.CUSTOMER_ID = #{customerId}
and t1.PIDS LIKE CONCAT(#{agencyPath},'%')
<if test='null != closedStatus and "" != closedStatus'>
and t1.CLOSED_STATUS=#{closedStatus}
and t1.IS_RESOLVED=#{closedStatus}
</if>
<if test='null != projectStatus and "" != projectStatus'>
and t1.PROJECT_STATUS=#{projectStatus}
</if>
</select>
<select id="getSelfProject" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">

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

@ -81,7 +81,8 @@
<select id="selectListAgencyInfo" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity">
SELECT
AGENCY_ID agencyId,
AGENCY_NAME agencyName
AGENCY_NAME agencyName,
PIDS pids
FROM
screen_customer_agency
WHERE

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

@ -126,7 +126,8 @@
SELECT
GRID_ID gridId,
GRID_NAME gridName,
PARENT_AGENCY_ID parentAgencyId
PARENT_AGENCY_ID parentAgencyId,
ALL_PARENT_IDS allParentIds
FROM
screen_customer_grid
WHERE

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

@ -19,6 +19,7 @@
ORG_TYPE,
ORG_ID,
PARENT_ID,
ALL_PARENT_IDS,
ORG_NAME,
INDEX_TOTAL,
PARTY_DEV_ABLITY,
@ -43,6 +44,7 @@
#{item.orgType},
#{item.orgId},
#{item.parentId},
#{item.allParentIds},
#{item.orgName},
#{item.indexTotal},
@ -99,4 +101,10 @@
where CUSTOMER_ID = #{customerId} AND MONTH_ID = #{monthId} AND ORG_TYPE = #{orgType}
limit 1000;
</delete>
<update id="updateParentIdsById" parameterType="map">
update screen_index_data_monthly m3
SET m3.ALL_PARENT_IDS =#{allParentIds}
where m3.id=#{id}
</update>
</mapper>

Loading…
Cancel
Save