Browse Source

得分说明-代码暂存

dev_shibei_match
jianjun 4 years ago
parent
commit
61e0c6780b
  1. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java
  2. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java
  3. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java
  4. 50
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java
  5. 15
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml
  6. 15
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml
  7. 19
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexAgencySubScoreDao.java

@ -17,6 +17,8 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.index.form.IndexScoreFormDTO;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO;
@ -48,4 +50,6 @@ public interface FactIndexAgencySubScoreDao {
* @author sun
*/
LinkedList<MonthAblityListResultDTO> selectMonthAblityList(MonthAblityListFormDTO formDTO);
List<IndexScoreResult> selectSubScore(IndexScoreFormDTO ablityListFormDTO);
}

12
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexCommunitySubScoreDao.java

@ -17,6 +17,8 @@
package com.epmet.datareport.dao.fact;
import com.epmet.evaluationindex.index.form.IndexScoreFormDTO;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import com.epmet.evaluationindex.screen.dto.form.AblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.form.MonthAblityListFormDTO;
import com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO;
@ -48,4 +50,14 @@ public interface FactIndexCommunitySubScoreDao {
* @author sun
*/
LinkedList<MonthAblityListResultDTO> selectCommunityMonthAblityList(MonthAblityListFormDTO formDTO);
/**
* desc: 查询分数
*
* @param ablityListFormDTO
* @return java.util.List<com.epmet.evaluationindex.index.result.IndexScoreResult>
* @author LiuJanJun
* @date 2021/5/14 2:07 下午
*/
List<IndexScoreResult> selectSubScore(IndexScoreFormDTO ablityListFormDTO);
}

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/FactIndexGridSubScoreDao.java

@ -59,5 +59,5 @@ public interface FactIndexGridSubScoreDao {
* @author LiuJanJun
* @date 2021/5/14 2:07 下午
*/
List<IndexScoreResult> selectGridSubScore(IndexScoreFormDTO ablityListFormDTO);
List<IndexScoreResult> selectSubScore(IndexScoreFormDTO ablityListFormDTO);
}

50
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/index/impl/IndexExplainServiceImpl.java

@ -24,6 +24,8 @@ import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.constant.IndexConstant;
import com.epmet.datareport.dao.evaluationindex.index.IndexExplainDao;
import com.epmet.datareport.dao.evaluationindex.index.IndexGroupDetailDao;
import com.epmet.datareport.dao.fact.FactIndexAgencySubScoreDao;
import com.epmet.datareport.dao.fact.FactIndexCommunitySubScoreDao;
import com.epmet.datareport.dao.fact.FactIndexCpcSubScoreDao;
import com.epmet.datareport.dao.fact.FactIndexGridSubScoreDao;
import com.epmet.datareport.service.evaluationindex.index.IndexExplainService;
@ -34,6 +36,7 @@ import com.epmet.evaluationindex.index.result.IndexExplainResult;
import com.epmet.evaluationindex.index.result.IndexGroupDetailResult;
import com.epmet.evaluationindex.index.result.IndexScoreDetailResult;
import com.epmet.evaluationindex.index.result.IndexScoreResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -51,6 +54,7 @@ import java.util.stream.Collectors;
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-05-12
*/
@Slf4j
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class IndexExplainServiceImpl implements IndexExplainService {
@ -63,6 +67,10 @@ public class IndexExplainServiceImpl implements IndexExplainService {
private FactIndexGridSubScoreDao gridSubScoreDao;
@Autowired
private FactIndexCpcSubScoreDao factIndexCpcSubScoreDao;
@Autowired
private FactIndexCommunitySubScoreDao communitySubScoreDao;
@Autowired
private FactIndexAgencySubScoreDao agencySubScoreDao;
@Override
@ -104,6 +112,11 @@ public class IndexExplainServiceImpl implements IndexExplainService {
String type = explainDTO.getType();
String orgLevel = formDTO.getOrgLevel();
String allIndexCodePath = explainDTO.getIndexCode();
//设置表头
List<String> tableHeaders = getTableHeaders(type, allIndexCodePath, orgLevel);
result.setTableTileList(tableHeaders);
IndexScoreFormDTO ablityListFormDTO = new IndexScoreFormDTO();
ablityListFormDTO.setCustomerId(formDTO.getCustomerId());
@ -111,32 +124,40 @@ public class IndexExplainServiceImpl implements IndexExplainService {
ablityListFormDTO.setMonthId(StringUtils.isBlank(formDTO.getMonthId()) ? DateUtils.getCurrentTimeBeforeMonthId() : formDTO.getMonthId());
switch (orgLevel) {
case "grid":
String allIndexCodePath = null;
if (IndexConstant.ZI_SHEN.equals(type)) {
allIndexCodePath = explainDTO.getIndexCode();
if (IndexConstant.ZI_SHEN.equals(type)) {
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath);
//不下钻
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
realScoreList = gridSubScoreDao.selectGridSubScore(ablityListFormDTO);
realScoreList = gridSubScoreDao.selectSubScore(ablityListFormDTO);
} else if (IndexConstant.XIA_JI.equals(type)) {
allIndexCodePath = explainDTO.getIndexCode();
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath);
//下钻到党员
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
realScoreList = factIndexCpcSubScoreDao.selecCpcAvgScore(ablityListFormDTO);
}
List<String> tableHeaders = getTableHeaders(type, allIndexCodePath, orgLevel);
result.setTableTileList(tableHeaders);
break;
case "community":
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath);
//不下钻
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
realScoreList = communitySubScoreDao.selectSubScore(ablityListFormDTO);
break;
case "street":
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath);
//不下钻
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO);
break;
case "district":
setDefaultTableData(orgLevel, type, detailEntityMap, result, allIndexCodePath);
//不下钻
ablityListFormDTO.setAllParentIndexCode(allIndexCodePath);
realScoreList = agencySubScoreDao.selectSubScore(ablityListFormDTO);
break;
default:
@ -174,6 +195,10 @@ public class IndexExplainServiceImpl implements IndexExplainService {
private List<IndexScoreDetailResult> setDefaultTableData(String orgLevel, String type, Map<String, List<IndexGroupDetailResult>> detailEntityMap, IndexExplainResult result, String allIndexCodePath) {
List<IndexGroupDetailResult> indexGroupDetailEntities = detailEntityMap.get(allIndexCodePath);
if (CollectionUtils.isEmpty(indexGroupDetailEntities)){
log.warn("setDefaultTableData allINdexCodePath:{} is config error",allIndexCodePath);
return null;
}
List<IndexScoreDetailResult> tableList = new ArrayList<>();
List<String> threlodList = new ArrayList<>();
indexGroupDetailEntities.forEach(index -> {
@ -181,6 +206,9 @@ public class IndexExplainServiceImpl implements IndexExplainService {
if ("grid".equals(orgLevel) && IndexConstant.ZI_SHEN.equals(type) && index.getAllIndexCodePath().contains(IndexConstant.XIA_JI)) {
return;
}
if (!"grid".equals(orgLevel) && !index.getAllIndexCodePath().contains(type)){
return;
}
table.setIndexCode(index.getIndexCode());
table.setIndexName(index.getIndexName());
table.setOriginValue(NumConstant.ZERO_STR);

15
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

@ -40,5 +40,20 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectSubScore" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
fact.index_code,
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value,
round(fact.score,2) AS score,
round(fact.WEIGHT,2) AS weight
FROM
fact_index_agency_sub_score fact
WHERE
fact.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND agency_id = #{orgId}
AND month_id = #{monthId}
</select>
</mapper>

15
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml

@ -40,5 +40,20 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectSubScore" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
fact.index_code,
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value,
round(fact.score,2) AS score,
round(fact.WEIGHT,2) AS weight
FROM
fact_index_community_sub_score fact
WHERE
fact.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND AGENCY_ID = #{orgId}
AND month_id = #{monthId}
</select>
</mapper>

19
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml

@ -40,21 +40,7 @@
ORDER BY
fact.month_id ASC
</select>
<select id="selectGridSubScore" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
<!-- SELECT
fact.index_code,
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value,
round(fact.SCORE,2) AS score,
round(fact.WEIGHT,2) AS weight
FROM
fact_index_grid_sub_score fact
WHERE
fact.del_flag = '0'
AND fact.all_parent_index_code = #{allParentIndexCode}
AND customer_id = #{customerId}
AND grid_id = #{orgId}
AND month_id = #{monthId}-->
<select id="selectSubScore" resultType="com.epmet.evaluationindex.index.result.IndexScoreResult">
SELECT
fact.index_code,
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS origin_value,
@ -68,9 +54,6 @@
AND customer_id = #{customerId}
AND grid_id = #{orgId}
AND month_id = #{monthId}
</select>
</mapper>

Loading…
Cancel
Save