|
@ -1,9 +1,8 @@ |
|
|
package com.epmet.service.evaluationindex.extract.impl; |
|
|
package com.epmet.service.evaluationindex.extract.impl; |
|
|
|
|
|
|
|
|
import com.epmet.commons.dynamic.datasource.annotation.DataSource; |
|
|
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
import com.epmet.constant.DataSourceConstant; |
|
|
import com.epmet.commons.tools.utils.DateUtils; |
|
|
import com.epmet.constant.ExtractConstant; |
|
|
import com.epmet.constant.ExtractConstant; |
|
|
import com.epmet.constant.ProjectEvaluateConstant; |
|
|
import com.epmet.constant.ProjectEvaluateConstant; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; |
|
|
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; |
|
@ -13,11 +12,13 @@ import com.epmet.dto.extract.form.GridIssueCountResultDTO; |
|
|
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; |
|
|
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; |
|
|
import com.epmet.dto.extract.result.*; |
|
|
import com.epmet.dto.extract.result.*; |
|
|
import com.epmet.service.evaluationindex.extract.*; |
|
|
import com.epmet.service.evaluationindex.extract.*; |
|
|
|
|
|
import com.epmet.service.stats.FactArticlePublishedGridDailyService; |
|
|
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; |
|
|
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
import org.springframework.beans.BeanUtils; |
|
|
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.transaction.annotation.Transactional; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
@ -33,15 +34,17 @@ import java.util.stream.Collectors; |
|
|
*/ |
|
|
*/ |
|
|
@Service |
|
|
@Service |
|
|
@Slf4j |
|
|
@Slf4j |
|
|
@DataSource(DataSourceConstant.EVALUATION_INDEX) |
|
|
//@DataSource(DataSourceConstant.EVALUATION_INDEX)
|
|
|
public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
|
|
|
|
|
|
@Autowired |
|
|
@Autowired |
|
|
private IssueExtractService issueExtractService; |
|
|
private IssueExtractService issueExtractService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactIndexGovrnAblityGridMonthlyDao governAbilityDao; |
|
|
private FactIndexGovernAbilityGridMonthlyService governAbilityGridMonthlyService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FactIndexPartyAbilityGridMonthlyService partyAbilityGridMonthlyService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactIndexPartyAblityGridMonthlyDao partyAbilityGridDao; |
|
|
private FactIndexGovrnAblityGridMonthlyDao governAbilityDao; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactOriginProjectMainDailyService projectMainService; |
|
|
private FactOriginProjectMainDailyService projectMainService; |
|
|
@Autowired |
|
|
@Autowired |
|
@ -50,6 +53,10 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
private FactRegUserGridMonthlyService userGridMonthlyService; |
|
|
private FactRegUserGridMonthlyService userGridMonthlyService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private FactOriginTopicMainDailyService topicMainService; |
|
|
private FactOriginTopicMainDailyService topicMainService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private FactArticlePublishedGridDailyService articlePublishedGridDailyService; |
|
|
|
|
|
@Autowired |
|
|
|
|
|
private GroupExtractService groupExtractService; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @Description 计算网格指标党建能力 |
|
|
* @Description 计算网格指标党建能力 |
|
@ -70,11 +77,24 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
List<CreateTopicCountResultDTO> partyCreateTopicCountList = topicMainService.selectCreateTopicCount(customerId, monthId, NumConstant.ONE); |
|
|
List<CreateTopicCountResultDTO> partyCreateTopicCountList = topicMainService.selectCreateTopicCount(customerId, monthId, NumConstant.ONE); |
|
|
// 网格群众人均提出话题数
|
|
|
// 网格群众人均提出话题数
|
|
|
List<CreateTopicCountResultDTO> massCreateTopicCountList = topicMainService.selectCreateTopicCount(customerId, monthId, NumConstant.ZERO); |
|
|
List<CreateTopicCountResultDTO> massCreateTopicCountList = topicMainService.selectCreateTopicCount(customerId, monthId, NumConstant.ZERO); |
|
|
|
|
|
// 网格党员人均提出的议题转项目数
|
|
|
|
|
|
List<ShiftProjectCountResultDTO> partyShiftProjectCountList = issueExtractService.selectShiftProjectCountPlus(customerId, monthId, NumConstant.ONE); |
|
|
|
|
|
// 网格群众人均提出的议题转项目数
|
|
|
|
|
|
List<ShiftProjectCountResultDTO> massShiftProjectCountList = issueExtractService.selectShiftProjectCountPlus(customerId, monthId, NumConstant.ZERO); |
|
|
|
|
|
// 网格的发文数量
|
|
|
|
|
|
List<PublishCountResultDTO> publishCountList = articlePublishedGridDailyService.selectArticlePublishCount(customerId, monthId); |
|
|
|
|
|
// 网格议题转项目率
|
|
|
|
|
|
List<GridIssueCountResultDTO> gridIssueTotalList = issueExtractService.selectIssueTotal(customerId, monthId); |
|
|
|
|
|
List<GridProjectCountResultDTO> gridProjectTotalList = issueExtractService.selectGridProjectCount(customerId, monthId, ExtractConstant.SHIFT_PROJECT); |
|
|
|
|
|
List<GridProjectCountResultDTO> gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalList, gridProjectTotalList); |
|
|
|
|
|
// 建群党员数
|
|
|
|
|
|
List<PartyCreateGroupCountResultDTO> partyCreateGroupCountList = groupExtractService.selectPartyCreateGroupCount(customerId, monthId); |
|
|
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
result.forEach(r -> { |
|
|
result.forEach(r -> { |
|
|
|
|
|
r.setMonthId(monthId); |
|
|
|
|
|
r.setQuarterId(quarterId); |
|
|
|
|
|
r.setYearId(yearId); |
|
|
// 1. 网格群众用户数 , 网格党员用户数
|
|
|
// 1. 网格群众用户数 , 网格党员用户数
|
|
|
if (!CollectionUtils.isEmpty(gridUserCountList)){ |
|
|
if (!CollectionUtils.isEmpty(gridUserCountList)){ |
|
|
gridUserCountList.forEach(count -> { |
|
|
gridUserCountList.forEach(count -> { |
|
@ -99,9 +119,48 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
// 4. 网格党员人均提出的议题转项目数
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(partyShiftProjectCountList)){ |
|
|
|
|
|
partyShiftProjectCountList.forEach(party -> { |
|
|
|
|
|
if (r.getGridId().equals(party.getGridId())){ |
|
|
|
|
|
r.setPartyAvgShiftProjectCount(party.getShiftProjectCount()); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 5. 网格群众人均提出的议题转项目数
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(massShiftProjectCountList)){ |
|
|
|
|
|
massShiftProjectCountList.forEach(mass -> { |
|
|
|
|
|
if (r.getGridId().equals(mass.getGridId())){ |
|
|
|
|
|
r.setPartyAvgShiftProjectCount(mass.getShiftProjectCount()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 6. 网格的发文数量
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(publishCountList)){ |
|
|
|
|
|
publishCountList.forEach(publish -> { |
|
|
|
|
|
if (r.getGridId().equals(publish.getGridId())){ |
|
|
|
|
|
r.setPublishArticleCount(publish.getPublishCount()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 7. 网格议题转项目率
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(gridIssueShiftProjectRatio)){ |
|
|
|
|
|
gridIssueShiftProjectRatio.forEach(ratio -> { |
|
|
|
|
|
if (r.getGridId().equals(ratio.getGridId())){ |
|
|
|
|
|
r.setIssueToProjectRatio(ratio.getIssueToProjectRatio()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
// 8. 建群党员数
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(partyCreateGroupCountList)){ |
|
|
|
|
|
partyCreateGroupCountList.forEach(party -> { |
|
|
|
|
|
if (r.getGridId().equals(party.getGridId())){ |
|
|
|
|
|
r.setCreateGroupPartyCount(party.getPartyCreateGroupCount()); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
delAndInsertPartyAbility(result,customerId,monthId); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -124,15 +183,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
//网格总项目数
|
|
|
//网格总项目数
|
|
|
List<GridProjectCountResultDTO> gridProjectTotalList = issueExtractService.selectGridProjectCount(customerId, monthId, ExtractConstant.SHIFT_PROJECT); |
|
|
List<GridProjectCountResultDTO> gridProjectTotalList = issueExtractService.selectGridProjectCount(customerId, monthId, ExtractConstant.SHIFT_PROJECT); |
|
|
//网格议题转项目率
|
|
|
//网格议题转项目率
|
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList) && !CollectionUtils.isEmpty(gridProjectTotalList)) { |
|
|
List<GridProjectCountResultDTO> gridIssueShiftProjectRatio = getGridIssueShiftProjectRatio(gridIssueTotalList, gridProjectTotalList); |
|
|
gridProjectTotalList.forEach(project -> { |
|
|
|
|
|
gridIssueTotalList.forEach(issue -> { |
|
|
|
|
|
if (project.getGridId().equals(issue.getGridId())) { |
|
|
|
|
|
project.setIssueToProjectRatio(getRound(new BigDecimal(project.getProjectTotal() / issue.getIssueTotal()))); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
//网格自治项目数 从议题创建到项目关闭,包括处理人,自始至终没有出过议题所属网格
|
|
|
//网格自治项目数 从议题创建到项目关闭,包括处理人,自始至终没有出过议题所属网格
|
|
|
List<AutoNoMyResultDTO> projectAutoNoMyList = projectLogService.selectProjectAutoNoMy(customerId, monthId); |
|
|
List<AutoNoMyResultDTO> projectAutoNoMyList = projectLogService.selectProjectAutoNoMy(customerId, monthId); |
|
|
Map<String,Integer> autoMap = new HashMap<>(16); |
|
|
Map<String,Integer> autoMap = new HashMap<>(16); |
|
@ -160,9 +211,9 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
List<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSED); |
|
|
List<GridProjectClosedTotalResultDTO> gridProjectClosedTotalList = projectMainService.selectGridClosedProject(customerId, monthId, ExtractConstant.CLOSED); |
|
|
//网格吹哨部门准确率 【没被退回的项目数/项目总数 】
|
|
|
//网格吹哨部门准确率 【没被退回的项目数/项目总数 】
|
|
|
List<NotReturnProjectResultDTO> notReturnProjectList = projectLogService.selectNotReturnProject(customerId, monthId, ExtractConstant.RETURN_ACTION_CODE, ExtractConstant.GRID_ORG_TYPE); |
|
|
List<NotReturnProjectResultDTO> notReturnProjectList = projectLogService.selectNotReturnProject(customerId, monthId, ExtractConstant.RETURN_ACTION_CODE, ExtractConstant.GRID_ORG_TYPE); |
|
|
if (!CollectionUtils.isEmpty(gridProjectTotalList) && !CollectionUtils.isEmpty(notReturnProjectList)){ |
|
|
if (!CollectionUtils.isEmpty(gridIssueShiftProjectRatio) && !CollectionUtils.isEmpty(notReturnProjectList)){ |
|
|
notReturnProjectList.forEach(not -> { |
|
|
notReturnProjectList.forEach(not -> { |
|
|
gridProjectTotalList.forEach(total -> { |
|
|
gridIssueShiftProjectRatio.forEach(total -> { |
|
|
if (not.getGridId().equals(total.getGridId())){ |
|
|
if (not.getGridId().equals(total.getGridId())){ |
|
|
not.setTransferRightRatio(getRound(new BigDecimal(not.getNotReturnProject()/total.getProjectTotal()))); |
|
|
not.setTransferRightRatio(getRound(new BigDecimal(not.getNotReturnProject()/total.getProjectTotal()))); |
|
|
} |
|
|
} |
|
@ -202,8 +253,12 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
resultSatisfactionScore.put(gridId,getRound(new BigDecimal(allScore.get()/scoreMap.size()))); |
|
|
resultSatisfactionScore.put(gridId,getRound(new BigDecimal(allScore.get()/scoreMap.size()))); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
String quarterId = DateUtils.getQuarterId(monthId); |
|
|
|
|
|
String yearId = DateUtils.getYearId(monthId); |
|
|
result.forEach(r -> { |
|
|
result.forEach(r -> { |
|
|
|
|
|
r.setMonthId(monthId); |
|
|
|
|
|
r.setQuarterId(quarterId); |
|
|
|
|
|
r.setYearId(yearId); |
|
|
// 1. 网格总议题数目,网格人均议题数目
|
|
|
// 1. 网格总议题数目,网格人均议题数目
|
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList)) { |
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList)) { |
|
|
gridIssueTotalList.forEach(total -> { |
|
|
gridIssueTotalList.forEach(total -> { |
|
@ -214,7 +269,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
} |
|
|
} |
|
|
// 2. 网格总项目数,网格议题转项目率
|
|
|
// 2. 网格总项目数,网格议题转项目率
|
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList)){ |
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList)){ |
|
|
gridProjectTotalList.forEach(projectTotal -> { |
|
|
gridIssueShiftProjectRatio.forEach(projectTotal -> { |
|
|
if (r.getGridId().equals(projectTotal.getGridId())){ |
|
|
if (r.getGridId().equals(projectTotal.getGridId())){ |
|
|
r.setProjectTotal(projectTotal.getProjectTotal()); |
|
|
r.setProjectTotal(projectTotal.getProjectTotal()); |
|
|
r.setIssueToProjectRatio(projectTotal.getIssueToProjectRatio()); |
|
|
r.setIssueToProjectRatio(projectTotal.getIssueToProjectRatio()); |
|
@ -254,6 +309,7 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
delAndInsertGovernAbility(result,customerId,monthId); |
|
|
return true; |
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -278,4 +334,52 @@ public class CalGridIndexServiceImpl implements CalGridIndexService { |
|
|
public BigDecimal getRound(BigDecimal d){ |
|
|
public BigDecimal getRound(BigDecimal d){ |
|
|
return d.setScale(NumConstant.SIX, BigDecimal.ROUND_HALF_UP); |
|
|
return d.setScale(NumConstant.SIX, BigDecimal.ROUND_HALF_UP); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description |
|
|
|
|
|
* @param gridIssueTotalList |
|
|
|
|
|
* @param gridProjectTotalList |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2020/9/19 2:53 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
public List<GridProjectCountResultDTO> getGridIssueShiftProjectRatio(List<GridIssueCountResultDTO> gridIssueTotalList,List<GridProjectCountResultDTO> gridProjectTotalList){ |
|
|
|
|
|
if (!CollectionUtils.isEmpty(gridIssueTotalList) && !CollectionUtils.isEmpty(gridProjectTotalList)) { |
|
|
|
|
|
gridProjectTotalList.forEach(project -> { |
|
|
|
|
|
gridIssueTotalList.forEach(issue -> { |
|
|
|
|
|
if (project.getGridId().equals(issue.getGridId())) { |
|
|
|
|
|
project.setIssueToProjectRatio(getRound(new BigDecimal(project.getProjectTotal() / issue.getIssueTotal()))); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
return gridProjectTotalList; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 删除并插入党建能力的记录 |
|
|
|
|
|
* @param result |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2020/9/19 4:06 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void delAndInsertPartyAbility(List<PartyAbilityGridMonthlyFormDTO> result,String customerId,String monthId){ |
|
|
|
|
|
if (!CollectionUtils.isEmpty(result)){ |
|
|
|
|
|
partyAbilityGridMonthlyService.deleteOldPartyAbility(customerId, monthId); |
|
|
|
|
|
partyAbilityGridMonthlyService.insertPartyAbility(result); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @Description 删除并插入治理能力的记录 |
|
|
|
|
|
* @param result |
|
|
|
|
|
* @author zxc |
|
|
|
|
|
* @date 2020/9/19 4:06 下午 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public void delAndInsertGovernAbility(List<GovernAbilityGridMonthlyFormDTO> result,String customerId,String monthId){ |
|
|
|
|
|
if (!CollectionUtils.isEmpty(result)){ |
|
|
|
|
|
governAbilityGridMonthlyService.deleteOldGovernAbilityRecord(customerId, monthId); |
|
|
|
|
|
governAbilityGridMonthlyService.insertGovernAbilityRecord(result); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|