Browse Source

detail添加code

dev_shibei_match
jianjun 5 years ago
parent
commit
50c45048fc
  1. 43
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/ExtremeValueDTO.java
  2. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java
  4. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java
  5. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexCodeFieldReEntity.java
  6. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java
  7. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java
  9. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/CpcIndexCalculateService.java
  10. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/CpcIndexCalculateServiceImpl.java
  11. 32
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml
  12. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml

43
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/ExtremeValueDTO.java

@ -0,0 +1,43 @@
package com.epmet.dto.indexcal;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 最值通用DTO
*
* @author yinzuomei@elink-cn.com
* @date 2020/8/26 10:39
*/
@Data
public class ExtremeValueDTO implements Serializable {
private static final long serialVersionUID = -2227402439857459667L;
/**
* 最小值
*/
private BigDecimal minValue1;
private BigDecimal minValue2;
private BigDecimal minValue3;
private BigDecimal minValue4;
private BigDecimal minValue5;
private BigDecimal minValue6;
private BigDecimal minValue7;
private BigDecimal minValue8;
private BigDecimal minValue9;
private BigDecimal minValue10;
private BigDecimal maxValue1;
private BigDecimal maxValue2;
private BigDecimal maxValue3;
private BigDecimal maxValue4;
private BigDecimal maxValue5;
private BigDecimal maxValue6;
private BigDecimal maxValue7;
private BigDecimal maxValue8;
private BigDecimal maxValue9;
private BigDecimal maxValue10;
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java

@ -2,7 +2,9 @@ package com.epmet.controller;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.screen.form.IndexCalculateForm;
import com.epmet.service.screen.CpcIndexCalculateService;
import com.epmet.service.screen.IndexCalculateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@ -21,7 +23,10 @@ import org.springframework.web.bind.annotation.RestController;
public class IndexCalculateController {
@Autowired
private IndexCalculateService indexCalculateService;
private IndexCalculateService indexCalculateService;
@Autowired
private CpcIndexCalculateService cpcIndexCalculateService;
/**
* 1按照客户计算指标(按照月份)
@ -37,6 +42,12 @@ public class IndexCalculateController {
indexCalculateService.indexCalculate(formDTO);
return new Result();
}
@PostMapping("getMax")
public Result getMax(){
CalculateCommonFormDTO calculateCommonFormDTO = new CalculateCommonFormDTO("c1","202008");
cpcIndexCalculateService.cpcIndexCalculate(calculateCommonFormDTO);
return new Result();
}
/* *//**
* 2党建能力-网格相关指标上报(按照月份)

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java

@ -23,7 +23,9 @@ import com.epmet.entity.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 党建能力-党员相关的事实表
@ -69,4 +71,6 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
@Param("customerId") String customerId);
List<FactIndexPartyAblityCpcMonthlyEntity> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId);
Map<String, BigDecimal> getExtremeValue(@Param("customerId") String customerId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java

@ -0,0 +1,9 @@
package com.epmet.dao.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.screen.IndexCodeFieldReEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface IndexCodeFieldReDao extends BaseDao<IndexCodeFieldReEntity> {
}

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexCodeFieldReEntity.java

@ -0,0 +1,12 @@
package com.epmet.entity.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("index_code_field_re")
public class IndexCodeFieldReEntity extends BaseEpmetEntity {
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java

@ -52,6 +52,11 @@ public class IndexGroupDetailEntity extends BaseEpmetEntity {
*/
private String indexId;
/**
* 指标code
*/
private String indexCode;
/**
* 权重同一组权重总和=1
*/

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java

@ -47,6 +47,11 @@ public class IndexGroupDetailTemplateEntity extends BaseEpmetEntity {
*/
private String indexId;
/**
* 指标code
*/
private String indexCode;
/**
* 权重同一组权重总和=1
*/

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java

@ -207,10 +207,12 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
templateEntity.setIndexId(indexDictEntity.getId());
if (level == 5) {
templateEntity.setIndexCode(Pinyin4jUtil.getFirstSpellPinYin(index.getLevel5Index(),true));
String level5WeightStr = index.getLevel5Weight().replace("%", "");
templateEntity.setWeight(new BigDecimal(level5WeightStr).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP));
indexGroupDetailMap.put(index.getLevel5Index(), templateEntity);
} else {
templateEntity.setIndexCode(Pinyin4jUtil.getFirstSpellPinYin(indexDictEntity.getIndexName(),true));
indexGroupDetailMap.put(indexDictEntity.getIndexName(), templateEntity);
templateEntity.setWeight(new BigDecimal(index.getWeight()).divide(new BigDecimal(100), 4, RoundingMode.HALF_UP));
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/CpcIndexCalculateService.java

@ -0,0 +1,18 @@
package com.epmet.service.screen;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
/**
* 党员指标计算service
*
* @author liujianjun@elink-cn.com
* @date 2020/8/18 10:25
*/
public interface CpcIndexCalculateService {
/**
* desc计算党员相关指标
* @param formDTO
* @return
*/
Boolean cpcIndexCalculate(CalculateCommonFormDTO formDTO);
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/CpcIndexCalculateServiceImpl.java

@ -0,0 +1,34 @@
package com.epmet.service.screen.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.dao.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.service.screen.CpcIndexCalculateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@Slf4j
@Service
public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
@Autowired
private FactIndexPartyAblityCpcMonthlyDao factIndexPartyAblityCpcMonthlyDao;
@Override
public Boolean cpcIndexCalculate(CalculateCommonFormDTO formDTO) {
//计算最大最小值
Map<String, BigDecimal> minAndMaxList = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO.getCustomerId());
if (CollectionUtils.isEmpty(minAndMaxList)){
log.warn("customerId:{} have not any record",formDTO.getCustomerId());
return false;
}
log.info(JSON.toJSONString(minAndMaxList));
List<FactIndexPartyAblityCpcMonthlyEntity> list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId());
return null;
}
}

32
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml

@ -13,7 +13,7 @@
<result property="quarterId" column="QUARTER_ID"/>
<result property="yearId" column="YEAR_ID"/>
<result property="createTopicCount" column="CREATE_TOPIC_COUNT"/>
<result property="joinTopicCount" column="JOIN__TOPIC_COUNT"/>
<result property="joinTopicCount" column="JOIN_TOPIC_COUNT"/>
<result property="shiftIssueCount" column="SHIFT_ISSUE_COUNT"/>
<result property="shiftProjectCount" column="SHIFT_PROJECT_COUNT"/>
<result property="joinThreeMeetsCount" column="JOIN_THREE_MEETS_COUNT"/>
@ -48,7 +48,7 @@
QUARTER_ID,
YEAR_ID,
CREATE_TOPIC_COUNT,
JOIN__TOPIC_COUNT,
JOIN_TOPIC_COUNT,
SHIFT_ISSUE_COUNT,
SHIFT_PROJECT_COUNT,
JOIN_THREE_MEETS_COUNT,
@ -97,7 +97,7 @@
<select id="getCountByMonthId" resultMap="factIndexPartyAblityCpcMonthlyMap">
SELECT
CREATE_TOPIC_COUNT,
JOIN__TOPIC_COUNT,
JOIN_TOPIC_COUNT,
SHIFT_ISSUE_COUNT,
SHIFT_PROJECT_COUNT,
JOIN_THREE_MEETS_COUNT,
@ -112,4 +112,30 @@
AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
</select>
<select id="getExtremeValue" resultType="java.util.Map">
SELECT
MIN( CREATE_TOPIC_COUNT ) minValue1,
MAX( CREATE_TOPIC_COUNT ) maxValue1,
MAX( JOIN_TOPIC_COUNT ) minValue2,
MAX( JOIN_TOPIC_COUNT ) maxValue2,
MIN( SHIFT_ISSUE_COUNT ) minValue3,
MAX( SHIFT_ISSUE_COUNT ) maxValue3,
MIN( SHIFT_PROJECT_COUNT ) minValue4,
MAX( SHIFT_PROJECT_COUNT ) maxValue4,
MIN( JOIN_THREE_MEETS_COUNT ) minValue5,
MAX( JOIN_THREE_MEETS_COUNT ) maxValue5,
MIN( GROUP_USER_COUNT ) minValue6,
MAX( GROUP_USER_COUNT ) maxValue6,
MIN( GROUP_ACTIVE_USER_COUNT ) minValue7,
MAX( GROUP_ACTIVE_USER_COUNT ) maxValue7,
MIN( GROUP_TOPIC_COUNT ) minValue8,
MAX( GROUP_TOPIC_COUNT ) maxValue8,
MIN( TOPIC_TO_ISSUE_RATIO ) minValue9,
MAX( TOPIC_TO_ISSUE_RATIO ) maxValue9
FROM
fact_index_party_ablity_cpc_monthly
WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DEL_FLAG = '0'
</select>
</mapper>

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.screen.IndexCodeFieldReDao">
</mapper>
Loading…
Cancel
Save