Browse Source

组织月度指数接口调整兼容大屏

dev_shibei_match
sunyuchao 5 years ago
parent
commit
442941a670
  1. 6
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java
  2. 9
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  3. 10
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

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

@ -21,13 +21,15 @@ public class IndexScoreFormDTO implements Serializable {
private String orgId; private String orgId;
/** /**
* 类型组织agency 网格grid * 类型组织agency 网格grid
* 大屏接口此字段值为空
*/ */
@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class}) //@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String orgType; private String orgType;
/** /**
* 月份Id eg202009 * 月份Id eg202009
* 大屏接口此字段值为空
*/ */
@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class}) //@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String monthId; private String monthId;
public interface AddUserInternalGroup {} public interface AddUserInternalGroup {}

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

@ -2,6 +2,7 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; 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.utils.DateUtils;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataMonthlyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao; import com.epmet.datareport.dao.evaluationindex.screen.ScreenIndexDataYearlyDao;
@ -268,13 +269,17 @@ public class IndexServiceImpl implements IndexService {
@Override @Override
public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) { public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) {
//screen_index_data_monthly 根据组织id和月份获取月度指标得分 //screen_index_data_monthly 根据组织id和月份获取月度指标得分
//1.根据组织或网格Id以及月份Id查询各项月度指数得分 //1.大屏接口 orgType和monthId字段不传值,默认查询上一个月数据
if(null==formDTO.getMonthId()||"".equals(formDTO.getMonthId())){
formDTO.setMonthId(DateUtils.getBeforeNMonth(1));
}
//2.根据组织或网格Id以及月份Id查询各项月度指数得分
IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO); IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO);
if (null == resultDTO) { if (null == resultDTO) {
return resultDTO; return resultDTO;
} }
//2.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比 //3.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比
NumberFormat nf = NumberFormat.getPercentInstance(); NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1); nf.setMaximumFractionDigits(1);

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

@ -176,18 +176,20 @@
<select id="selectMonthData" resultType="com.epmet.evaluationindex.screen.dto.result.IndexScoreResultDTO"> <select id="selectMonthData" resultType="com.epmet.evaluationindex.screen.dto.result.IndexScoreResultDTO">
SELECT SELECT
index_total AS "total", index_total AS "total",
party_dev_ablity AS "party", (party_dev_ablity * party_dev_weight) AS "party",
party_dev_weight AS "partyDevAbilityWeight", party_dev_weight AS "partyDevAbilityWeight",
govern_ablity AS "govern", (govern_ablity * govern_ablity_weight) AS "govern",
govern_ablity_weight AS "governAbilityWeight", govern_ablity_weight AS "governAbilityWeight",
service_ablity AS "service", (service_ablity * service_ablity_weight) AS "service",
service_ablity_weight AS "serviceAbilityWeight" service_ablity_weight AS "serviceAbilityWeight"
FROM FROM
screen_index_data_monthly screen_index_data_monthly
WHERE WHERE
del_flag = '0' del_flag = '0'
AND org_id = #{orgId} AND org_id = #{orgId}
AND org_type = #{orgType} <if test="orgType != null and orgType != '' ">
AND org_type = #{orgType}
</if>
AND month_id = #{monthId} AND month_id = #{monthId}
</select> </select>

Loading…
Cancel
Save