From 50c45048fc3a901bddbe41b8e8ed1f6fa9caa038 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 26 Aug 2020 18:11:53 +0800 Subject: [PATCH] =?UTF-8?q?detail=E6=B7=BB=E5=8A=A0code?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/indexcal/ExtremeValueDTO.java | 43 +++++++++++++++++++ .../controller/IndexCalculateController.java | 13 +++++- .../FactIndexPartyAblityCpcMonthlyDao.java | 4 ++ .../epmet/dao/screen/IndexCodeFieldReDao.java | 9 ++++ .../entity/screen/IndexCodeFieldReEntity.java | 12 ++++++ .../entity/screen/IndexGroupDetailEntity.java | 5 +++ .../IndexGroupDetailTemplateEntity.java | 5 +++ .../epmet/model/IndexExcelDataListener.java | 2 + .../screen/CpcIndexCalculateService.java | 18 ++++++++ .../impl/CpcIndexCalculateServiceImpl.java | 34 +++++++++++++++ .../FactIndexPartyAblityCpcMonthlyDao.xml | 32 ++++++++++++-- .../mapper/screen/IndexCodeFieIdReDao.xml | 6 +++ 12 files changed, 179 insertions(+), 4 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/ExtremeValueDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexCodeFieldReEntity.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/CpcIndexCalculateService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/CpcIndexCalculateServiceImpl.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/ExtremeValueDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/ExtremeValueDTO.java new file mode 100644 index 0000000000..4dbabbf958 --- /dev/null +++ b/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; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java index 6b9d8d45e1..4117f6dc75 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/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、党建能力-网格相关指标上报(按照月份) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java index 5d786e5113..7208c093aa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java +++ b/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 getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId); + + Map getExtremeValue(@Param("customerId") String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/screen/IndexCodeFieldReDao.java new file mode 100644 index 0000000000..edd402249f --- /dev/null +++ b/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 { +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexCodeFieldReEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexCodeFieldReEntity.java new file mode 100644 index 0000000000..1e563a118b --- /dev/null +++ b/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 { +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java index 1336dd050f..a789ae51e7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailEntity.java +++ b/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) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java index 20162b1198..d847f654c6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/screen/IndexGroupDetailTemplateEntity.java +++ b/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) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java index d19fb1d628..6e747b0766 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java @@ -207,10 +207,12 @@ public class IndexExcelDataListener extends AnalysisEventListener { 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)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/CpcIndexCalculateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/CpcIndexCalculateService.java new file mode 100644 index 0000000000..bb4bc6e397 --- /dev/null +++ b/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); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/screen/impl/CpcIndexCalculateServiceImpl.java new file mode 100644 index 0000000000..63a0105f28 --- /dev/null +++ b/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 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 list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId()); + return null; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml index 92b5a882fa..115e0ae4e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml @@ -13,7 +13,7 @@ - + @@ -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 @@ + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml new file mode 100644 index 0000000000..4186e0e155 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/screen/IndexCodeFieIdReDao.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file