diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java index b12a8f46f5..0f28cda5b2 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/screen/dto/result/TreeResultDTO.java @@ -29,6 +29,20 @@ public class TreeResultDTO implements Serializable { @JsonIgnore private String pids; + /** + * 中心点位 + */ + private List centerMark; + + /** + * 机关级别 + */ + @JsonIgnore + private String level; + + @JsonIgnore + private String centerMarkA; + /** * 子目录 */ diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java index 4e57c2f71d..ec6a2e7ee1 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/screen/ScreenCustomerGridDao.java @@ -17,10 +17,7 @@ package com.epmet.datareport.dao.screen; -import com.epmet.screen.dto.result.AgencyDistributionResultDTO; -import com.epmet.screen.dto.result.BranchResultDTO; -import com.epmet.screen.dto.result.ParymemberDistributionResultDTO; -import com.epmet.screen.dto.result.UserDistributionResultDTO; +import com.epmet.screen.dto.result.*; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -66,5 +63,13 @@ public interface ScreenCustomerGridDao { * @date 2020/8/19 10:30 上午 */ List selectParymemberDistribution(@Param("parentId")String parentId); + + /** + * @Description 查询机关下的网格 + * @param agencyId + * @author zxc + * @date 2020/8/26 5:29 下午 + */ + List selectGridInfo(@Param("agencyId")String agencyId); } \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java index 0e1d557215..8ee16c42f6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/screen/impl/AgencyServiceImpl.java @@ -15,6 +15,7 @@ import com.epmet.datareport.service.screen.AgencyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.ArrayList; import java.util.List; /** @@ -52,11 +53,37 @@ public class AgencyServiceImpl implements AgencyService { if (null == rootAgency){ return new TreeResultDTO(); } - List departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue():rootAgency.getPids().concat(",").concat(rootAgency.getValue())); - rootAgency.setChildren(departmentList); + List centerMark = this.getCenterMark(rootAgency.getCenterMarkA()); + rootAgency.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark); + if (rootAgency.getLevel().equals(ScreenConstant.COMMUNITY)){ + List treeResultDTOS = screenCustomerGridDao.selectGridInfo(rootAgency.getValue()); + rootAgency.setChildren(treeResultDTOS); + }else { + List departmentList = this.getDepartmentList(("".equals(rootAgency.getPids()) || rootAgency.getPids().equals(NumConstant.ZERO_STR)) ? rootAgency.getValue() : rootAgency.getPids().concat(",").concat(rootAgency.getValue())); + rootAgency.setChildren(departmentList); + } return rootAgency; } + /** + * @Description 处理centerMark + * @param centerMark + * @author zxc + * @date 2020/8/26 5:18 下午 + */ + public List getCenterMark(String centerMark){ + if (centerMark.length() == NumConstant.ZERO) { + return new ArrayList<>(); + } + List result = new ArrayList<>(); + String substring = centerMark.substring(2, centerMark.length() - 2); + String[] split = substring.split(","); + for (String s : split) { + result.add(Double.valueOf(s)); + } + return result; + } + /** * @Description 递归查询填充下级 * @param subAgencyPids @@ -66,10 +93,21 @@ public class AgencyServiceImpl implements AgencyService { private List getDepartmentList(String subAgencyPids) { List subAgencyList = screenCustomerAgencyDao.selectSubAgencyList(subAgencyPids); if (subAgencyList.size() > NumConstant.ZERO) { - for (TreeResultDTO sub : subAgencyList) { - List subAgency = getDepartmentList(sub.getPids() + "," + sub.getValue()); - sub.setChildren(subAgency); - } + subAgencyList.forEach(sub -> { + List centerMark = this.getCenterMark(sub.getCenterMarkA()); + sub.setCenterMark(centerMark.size() == NumConstant.ZERO ? new ArrayList<>() : centerMark); + if (sub.getLevel().equals(ScreenConstant.COMMUNITY)){ + List treeResultDTOS = screenCustomerGridDao.selectGridInfo(sub.getValue()); + treeResultDTOS.forEach(tree -> { + List centerMarkTree = this.getCenterMark(tree.getCenterMarkA()); + tree.setCenterMark(centerMarkTree.size() == NumConstant.ZERO ? new ArrayList<>() : centerMarkTree); + }); + sub.setChildren(treeResultDTOS); + }else { + List subAgency = getDepartmentList(sub.getPids() + "," + sub.getValue()); + sub.setChildren(subAgency); + } + }); } return subAgencyList; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index cfdb8da6de..f66aef3609 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -8,7 +8,9 @@ SELECT agency_name AS label, agency_id AS value, - pids AS pids + pids AS pids, + IFNULL(center_mark,'') AS centerMarkA, + level AS level FROM screen_customer_agency WHERE @@ -22,7 +24,9 @@ SELECT agency_id AS value, agency_name AS label, - pids AS pids + pids AS pids, + IFNULL(center_mark,'') AS centerMarkA, + level AS level FROM screen_customer_agency WHERE diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index 1e45902a79..123fbbbc75 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -67,4 +67,19 @@ AND scg.del_flag = 0 AND sutd.parent_id = #{parentId} + + + \ No newline at end of file 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