Browse Source

数据改版-接口自测问题修改

dev_shibei_match
sunyuchao 5 years ago
parent
commit
d5d5489906
  1. 34
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/IndexScoreFormDTO.java
  2. 55
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexScoreResultDTO.java
  3. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  4. 12
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenIndexDataMonthlyDao.java
  5. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/IndexService.java
  6. 32
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  7. 19
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  8. 12
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

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

@ -0,0 +1,34 @@
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 IndexScoreFormDTO implements Serializable {
private static final long serialVersionUID = -2880432640584616651L;
/**
* 组织或网格Id
*/
@NotBlank(message = "组织或网格ID不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String orgId;
/**
* 类型组织agency 网格grid
*/
@NotBlank(message = "数据类型不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String orgType;
/**
* 月份Id eg202009
*/
@NotBlank(message = "月份Id不能为空",groups = {IndexScoreFormDTO.AddUserInternalGroup.class})
private String monthId;
public interface AddUserInternalGroup {}
}

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

@ -0,0 +1,55 @@
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 IndexScoreResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 年度平均指数(保留一位小数)
*/
@JsonIgnore
private String total;
private BigDecimal totalScore;
/**
* 党建能力(保留一位小数)
*/
@JsonIgnore
private String party;
private BigDecimal partyDevAbility;
/**
* 党建能力权重(保留一位小数)
*/
private String partyDevAbilityWeight;
/**
* 治理能力(保留一位小数)
*/
@JsonIgnore
private String govern;
private BigDecimal governAbility;
/**
* 治理能力权重(保留一位小数)
*/
private String governAbilityWeight;
/**
* 服务能力(保留一位小数)
*/
@JsonIgnore
private String service;
private BigDecimal serviceAbility;
/**
* 服务能力权重(保留一位小数)
*/
private String serviceAbilityWeight;
}

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

@ -1,5 +1,7 @@
package com.epmet.datareport.controller.screen;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.eum.OrgTypeEnum;
@ -100,4 +102,16 @@ public class IndexController {
return new Result<List<SubAgencyIndexRankResultDTO>>().ok(indexService.selectIndexRankByOrgType(formDTO));
}
/**
* @param tokenDTO
* @Description 组织月度指数得分
* @author sun
*/
@PostMapping("month/indexscore")
public Result<IndexScoreResultDTO> indexScore(@LoginUser TokenDto tokenDTO, @RequestBody IndexScoreFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, IndexScoreFormDTO.AddUserInternalGroup.class);
return new Result<IndexScoreResultDTO>().ok(indexService.indexScore(formDTO));
}
}

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

@ -17,10 +17,7 @@
package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.evaluationindex.screen.dto.form.GridIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.PeerComparisonFormDTO;
import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankFormDTO;
import com.epmet.evaluationindex.screen.dto.form.SubAgencyIndexRankYMFormDTO;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -84,4 +81,11 @@ public interface ScreenIndexDataMonthlyDao{
* @author sun
*/
List<PeerComparisonResultDTO> selectScoreList(PeerComparisonFormDTO formDTO);
/**
* @param formDTO
* @Description 根据组织或网格Id以及月份Id查询各项月度指数得分
* @author sun
*/
IndexScoreResultDTO selectMonthData(IndexScoreFormDTO formDTO);
}

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

@ -62,4 +62,11 @@ public interface IndexService {
* @return
*/
List<SubAgencyIndexRankResultDTO> selectIndexRankByOrgType(GridIndexRankFormDTO formDTO);
/**
* @param formDTO
* @Description 组织月度指数得分
* @author sun
*/
IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO);
}

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

@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Comparator;
@ -258,4 +259,35 @@ public class IndexServiceImpl implements IndexService {
BigDecimal b = bigDecimal.setScale(NumConstant.ONE, BigDecimal.ROUND_HALF_UP);
return Double.valueOf(b.toString());
}
/**
* @param formDTO
* @Description 组织月度指数得分
* @author sun
*/
@Override
public IndexScoreResultDTO indexScore(IndexScoreFormDTO formDTO) {
//screen_index_data_monthly 根据组织id和月份获取月度指标得分
//1.根据组织或网格Id以及月份Id查询各项月度指数得分
IndexScoreResultDTO resultDTO = screenIndexDataMonthlyDao.selectMonthData(formDTO);
//2.将数据改成正确格式 四舍五入保留一位小数 权重转成百分比
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())));
BigDecimal num2 = new BigDecimal(resultDTO.getGovern()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setGovernAbility(num2);
resultDTO.setGovernAbilityWeight(nf.format(Double.parseDouble(resultDTO.getGovernAbilityWeight())));
BigDecimal num3 = new BigDecimal(resultDTO.getService()).setScale(1, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
resultDTO.setServiceAbility(num3);
resultDTO.setServiceAbilityWeight(nf.format(Double.parseDouble(resultDTO.getServiceAbilityWeight())));
return resultDTO;
}
}

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

@ -165,4 +165,23 @@
</if>
LIMIT #{pageSize}
</select>
<select id="selectMonthData" resultType="com.epmet.evaluationindex.screen.dto.result.IndexScoreResultDTO">
SELECT
index_total AS "total",
party_dev_ablity AS "party",
party_dev_weight AS "partyDevAbilityWeight",
govern_ablity AS "govern",
govern_ablity_weight AS "governAbilityWeight",
service_ablity AS "service",
service_ablity_weight AS "serviceAbilityWeight"
FROM
screen_index_data_monthly
WHERE
del_flag = '0'
AND org_id = #{orgId}
AND org_type = #{orgType}
AND month_id = #{monthId}
</select>
</mapper>

12
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyUserRankDataDao.xml

@ -58,11 +58,11 @@
screen_party_user_rank_data
WHERE
del_flag = '0'
<if test="orgType != null and orgType !='' and orgType = 'agency'">
<if test="orgType = 'agency'">
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
AND org_id = #{orgId}
</if>
<if test="orgType = 'grid'">
<if test="orgType == 'grid'">
AND grid_id = #{orgId}
</if>
</if>
@ -85,11 +85,11 @@
WHERE
del_flag = '0'
AND party_flag = '1'<!-- 是否是党员标志:1是。0不是党员 -->
<if test="orgType != null and orgType !='' and orgType = 'agency'">
<if test="orgType = 'agency'">
<if test="orgType != null and orgType !=''">
<if test="orgType == 'agency'">
AND org_id = #{orgId}
</if>
<if test="orgType = 'grid'">
<if test="orgType == 'grid'">
AND grid_id = #{orgId}
</if>
</if>

Loading…
Cancel
Save