diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java new file mode 100644 index 0000000000..196837f220 --- /dev/null +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.evaluationindex.screen.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * 评价指标字典表数据--接口返参 + * @Author sun + */ +@Data +public class IndexDictResultDTO implements Serializable { + + private static final long serialVersionUID = 3860268744336541373L; + + /** + * 指标名 + */ + private String indexName; + /** + * 指标code + */ + private String indexCode; + /** + * 指标值类型 百分比:percent + */ + private String valueType; + +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java index 70c5614f65..4e2449c81c 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java @@ -45,4 +45,20 @@ public interface FactConstant { * 网格相关 */ String WANG_GE_XIANG_GUAN = "wanggexiangguan"; + /** + * 评价指标类型-无 + */ + String NONE = "none"; + /** + * 评价指标类型-整数 + */ + String INTEGER = "integer"; + /** + * 评价指标类型-小数 + */ + String DECIMAL = "decimal"; + /** + * 评价指标类型-百分比 + */ + String PERCENT = "percent"; } diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java new file mode 100644 index 0000000000..893820cf1c --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java @@ -0,0 +1,49 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.datareport.dao.fact; + +import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * 评价指标字典 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-09-02 + */ +@Mapper +public interface IndexDictDao { + + /** + * @param + * @Description 查询指标字典表是百分比类型的数据 + * @author sun + */ + List selectList(); + + /** + * @param + * @Description 根据indexCode查询指标字典表具体数据 + * @author sun + */ + IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode); +} diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java index 523bf3a7e5..68b3fd1f60 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java @@ -15,12 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; +import java.text.NumberFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.LinkedList; -import java.util.List; +import java.util.*; /** * 数据改版api @@ -47,6 +45,8 @@ public class FactIndexServiceImpl implements FactIndexService { private FactIndexGridScoreDao factIndexGridScoreDao; @Autowired private FactIndexGridSubScoreDao factIndexGridSubScoreDao; + @Autowired + private IndexDictDao indexDictDao; /** * @param formDTO @@ -125,19 +125,27 @@ public class FactIndexServiceImpl implements FactIndexService { AblityIndexResultDTO nl = new AblityIndexResultDTO(); nl.setIndexCode(FactConstant.NLZB); nl.setScoreList(nlList); - if(null != nlList){resultList.add(nl);} + if (null != nlList) { + resultList.add(nl); + } AblityIndexResultDTO dj = new AblityIndexResultDTO(); dj.setIndexCode(FactConstant.DJNL); dj.setScoreList(djList); - if(null != djList){resultList.add(dj);} + if (null != djList) { + resultList.add(dj); + } AblityIndexResultDTO zl = new AblityIndexResultDTO(); zl.setIndexCode(FactConstant.ZLNL); zl.setScoreList(zlList); - if(null != zlList){resultList.add(zl);} + if (null != zlList) { + resultList.add(zl); + } AblityIndexResultDTO fw = new AblityIndexResultDTO(); fw.setIndexCode(FactConstant.FWNL); fw.setScoreList(fwList); - if(null != fwList){resultList.add(fw);} + if (null != fwList) { + resultList.add(fw); + } return resultList; } @@ -203,9 +211,15 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } //5.封装数据并返回 - if(null != dj){resultList.add(dj);} - if(null != zl){resultList.add(zl);} - if(null != fw){resultList.add(fw);} + if (null != dj) { + resultList.add(dj); + } + if (null != zl) { + resultList.add(zl); + } + if (null != fw) { + resultList.add(fw); + } return resultList; } @@ -278,15 +292,21 @@ public class FactIndexServiceImpl implements FactIndexService { MonthScoreListResultDTO dj = new MonthScoreListResultDTO(); dj.setIndexCode(FactConstant.DJNL); dj.setScoreList(djList); - if(null != djList){resultList.add(dj);} + if (null != djList) { + resultList.add(dj); + } MonthScoreListResultDTO zl = new MonthScoreListResultDTO(); zl.setIndexCode(FactConstant.ZLNL); zl.setScoreList(zlList); - if(null != zlList){resultList.add(zl);} + if (null != zlList) { + resultList.add(zl); + } MonthScoreListResultDTO fw = new MonthScoreListResultDTO(); fw.setIndexCode(FactConstant.FWNL); fw.setScoreList(fwList); - if(null != fwList){resultList.add(fw);} + if (null != fwList) { + resultList.add(fw); + } return resultList; } @@ -333,7 +353,28 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("按月查询各项指标数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //4.调用方法判断各项指标是数字指标还是百分比指标 //TODO 记得value值保留一位小数 是数的保留零位小数 是百分比的保留一位小数 + //4.查询指标字典表数据 + List list = indexDictDao.selectList(); + //5.遍历数据,判断数据类型并处理 + /*NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1);*/ + resultList.forEach(result -> { + list.forEach(l -> { + if (result.getKey().equals(l.getIndexCode())) { + //小数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num.toString()); + } + //百分数类型,四舍五入保留小数点后一位并转成百分比 + if (FactConstant.PERCENT.equals(l.getValueType())) { + BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setValue(num+"%"); + } + } + }); + }); + return resultList; } @@ -373,7 +414,30 @@ public class FactIndexServiceImpl implements FactIndexService { throw new RenException(String.format("按月查询各项指标最近12个月数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType())); } - //6.调用方法判断各项指标是数字指标还是百分比指标//TODO 记得value值保留一位小数 是数的保留零位小数 是百分比的保留一位小数 + //6.查询指标字典表具体数据 + IndexDictResultDTO dictDTO = indexDictDao.selectIndexDict(formDTO.getKey()); + if (null == dictDTO) { + throw new RenException(String.format("根据评价指标indexCode未查询到字典表数据,indexCode值:%s", formDTO.getKey())); + } + + //7.遍历数据,判断数据类型并处理 + /*NumberFormat nf = NumberFormat.getPercentInstance(); + nf.setMaximumFractionDigits(1);*/ + //小数类型,四舍五入保留小数点后一位 + if (FactConstant.DECIMAL.equals(dictDTO.getValueType())) { + resultList.forEach(result -> { + BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setAblity(num.toString()); + }); + } + //百分数类型,四舍五入保留小数点后一位并转成百分比 + if (FactConstant.PERCENT.equals(dictDTO.getValueType())) { + resultList.forEach(result -> { + BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP); + result.setAblity(num+"%"); + }); + } + return resultList; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml index 879d8b521e..9744157016 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml @@ -6,7 +6,7 @@ SELECT fact.month_id AS "monthId", - IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity" + IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity" FROM fact_index_agency_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml index 8c8e780259..197b6f9bf9 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml @@ -6,7 +6,7 @@ SELECT fact.month_id AS "monthId", - IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity" + IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity" FROM fact_index_community_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml index d48f24966e..1b317e2791 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml @@ -6,7 +6,7 @@ SELECT fact.month_id AS "monthId", - IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity" + IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity" FROM fact_index_grid_sub_score fact LEFT JOIN index_dict dict ON fact.index_code = dict.index_code diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml new file mode 100644 index 0000000000..0784877dda --- /dev/null +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java index 06b95d02d2..72f9456cf8 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java @@ -88,6 +88,9 @@ public class ScreenPartyBranchDataFormDTO implements Serializable { private String updatedBy; public ScreenPartyBranchDataFormDTO() { + this.organizeCount = NumConstant.ZERO; + this.joinUserCount = NumConstant.ZERO; + this.averageJoinUserCount = NumConstant.ZERO; this.delFlag = NumConstant.ZERO_STR; this.revision = NumConstant.ZERO; this.createdBy = "APP_USER"; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CpcScoreResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CpcScoreResultDTO.java new file mode 100644 index 0000000000..31b115caab --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CpcScoreResultDTO.java @@ -0,0 +1,27 @@ +package com.epmet.dto.indexcal; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Description 党员指标得分查询DTO + * @ClassName CpcScoreResultDTO + * @Auth wangc + * @Date 2020-09-25 16:52 + */ +@Data +public class CpcScoreResultDTO implements Serializable { + private static final long serialVersionUID = -7129757727997430029L; + + /** + * 用户Id + * */ + private String userId; + + /** + * 党员指标得分 + * */ + private BigDecimal score; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java index 06bc4d9cca..993c4ef354 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java @@ -38,4 +38,14 @@ public class GridInfoDTO implements Serializable { * agencyId的pids */ private String pids; + + /** + * 网格名称 + * */ + private String gridName; + + /** + * 机关名称 + * */ + private String orgName; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/point/UserPointDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/point/UserPointDTO.java new file mode 100644 index 0000000000..067ebbf254 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/point/UserPointDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.point; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 用户积分DTO + * @ClassName UserPointDTO + * @Auth wangc + * @Date 2020-09-25 15:42 + */ +@Data +public class UserPointDTO implements Serializable { + private static final long serialVersionUID = 6976982699085437418L; + + /** + * 用户Id + * */ + private String userId; + + /** + * 用户累计积分 + * */ + private Integer pointTotal; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java index 9abd6012d6..b160224471 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form; import lombok.Data; import java.io.Serializable; +import java.math.BigDecimal; /** * 11、基层治理-公众参与 入参 @@ -47,7 +48,7 @@ public class UserJoinFormDTO implements Serializable { /** * 人均议题 */ - private Integer avgIssue; + private BigDecimal avgIssue; /** * 总的参与次数 @@ -57,5 +58,5 @@ public class UserJoinFormDTO implements Serializable { /** * 平均参与度 */ - private Integer avgJoin; + private BigDecimal avgJoin; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index d67cded1db..8b0dc2156a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -17,6 +17,7 @@ import com.epmet.dao.stats.DimDateDao; import com.epmet.dao.stats.DimMonthDao; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.extract.form.ScreenExtractFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; @@ -651,8 +652,8 @@ public class DemoController { private PartyGuideService partyGuideService; @PostMapping("zxczxc") - public Result getZxcZxc(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ -// partyGuideService.partyGuideExtract(formDTO.getCustomerId(),formDTO.getDateId()); + public Result getZxcZxc(@RequestBody ScreenExtractFormDTO formDTO){ + partyGuideService.partyGuideExtract(formDTO); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java index c03786ecfe..c1b8e5b479 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.CpcScoreResultDTO; import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -83,4 +84,13 @@ public interface CpcScoreDao extends BaseDao { List getPartScore(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode, @Param("offset") int offset, @Param("pageSize") int pageSize); int insertBatch(@Param("list") Collection values); + + /** + * @Description 查询客户下的党员指标得分 + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 17:13 + **/ + List selectCpcScore(@Param("customerId") String customerId,@Param("monthId") String monthId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyBranchDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyBranchDataDao.java index 8c5211cefc..9911306d4e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyBranchDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyBranchDataDao.java @@ -65,4 +65,34 @@ public interface ScreenPartyBranchDataDao extends BaseDao lists); + + /** + * @Description 删除旧的建设情况数据 + * @Param customerId + * @Param monthId + * @Param orgIds + * @author zxc + * @date 2020/9/27 9:04 上午 + */ + Integer deleteOldScreenPartyBranchData(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("orgIds") List orgIds); + + /** + * @Description 根据orgId查询建设情况数据 + * @Param customerId + * @Param monthId + * @Param orgIds + * @author zxc + * @date 2020/9/27 9:38 上午 + */ + List selectScreenPartyBranchDataByOrgId(@Param("customerId") String customerId, @Param("monthId") String monthId,@Param("orgIds") List orgIds); + + /** + * @Description 根据parentId查询建设情况数据 + * @Param customerId + * @Param monthId + * @Param parentId + * @author zxc + * @date 2020/9/27 9:38 上午 + */ + List selectScreenPartyBranchDataByParentId(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("parentId") String parentId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java index 586ab1d0a8..14e2e781bc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java @@ -68,12 +68,11 @@ public interface ScreenPartyLinkMassesDataDao extends BaseDao orgIds); + Integer deleteOldPartyLinkInfo(@Param("customerId") String customerId, @Param("orgIds") List orgIds); /** * @Description 查询党员联系群众信息 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java index 518c3fa795..35132261cc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java @@ -45,6 +45,15 @@ public interface ScreenPartyUserRankDataDao extends BaseDao list,@Param("customerId")String customerId); + + /** + * @Description 批量插入 + * @param list + * @return void + * @author wangc + * @date 2020.09.27 10:06 + */ + void insertBatch(List list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java index 32cbbaf408..a88a330439 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java @@ -20,6 +20,6 @@ public interface ActUserRelationDao { * @author zxc * @date 2020/9/25 5:19 下午 */ - List selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId); + List selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("orgType") String orgType); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/point/PointDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/point/PointDao.java new file mode 100644 index 0000000000..fe777344aa --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/point/PointDao.java @@ -0,0 +1,27 @@ +package com.epmet.dao.point; + +import com.epmet.dto.point.UserPointDTO; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 积分查询DAO + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface PointDao { + + /** + * @Description 查询客户下的用户积分 + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 15:51 + **/ + List selectUserPointByCustomerId(@Param("customerId") String customerId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java index cd84b6d3b0..fd0b7d2a86 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java @@ -48,13 +48,4 @@ public interface FactParticipationUserGridDailyDao extends BaseDao selectUserCount(String customerId, String dateId); - - /** - * @Description 根据机构级别查询用户数与党员数 - * @param orgLevel - * @return - * @author wangc - * @date 2020.09.24 14:59 - **/ - List selectUserAndPartymemberByOrgLevel(@Param("orgLevel") String orgLevel,@Param("customerId") String customerId, @Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java index f06c4c1179..ba2c53eb2c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.stats.user; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.stats.user.FactRegUserGridDailyDTO; +import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; import com.epmet.entity.stats.user.FactRegUserGridDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -38,4 +39,12 @@ public interface FactRegUserGridDailyDao extends BaseDao selectUserAndPartymemberByOrgLevel(@Param("orgLevel") String orgLevel, @Param("customerId") String customerId, @Param("dateId")String dateId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java index 28c0a2c389..b9162c30a2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java @@ -3,6 +3,7 @@ package com.epmet.dao.user; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -121,4 +122,13 @@ public interface UserDao { * @Date 2020/9/21 13:46 **/ List selectGridRegUserIds(@Param("customerId") String customerId, @Param("gridId") String gridId); + + /** + * @Description 获取客户下的网格注册居民 + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 13:54 + **/ + List selectRegisteredUserByCustomerId(@Param("customerId") String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexDictEntity.java index 149c4c128c..d05a586f76 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexDictEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexDictEntity.java @@ -59,4 +59,9 @@ public class IndexDictEntity extends BaseEpmetEntity { * 正相关:positive;负相关:negative */ private String correlation; + + /** + * 指标值类型 无:none;整数:integer;小数: decimal;百分比:percent + */ + private String valueType; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPartyUserRankDataEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPartyUserRankDataEntity.java index 4d70bf29ff..93b3a98577 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPartyUserRankDataEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPartyUserRankDataEntity.java @@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import lombok.Data; import lombok.EqualsAndHashCode; +import java.math.BigDecimal; + /** * 党建引领|基层治理-市民(党员)积分排行榜 * @@ -90,6 +92,10 @@ public class ScreenPartyUserRankDataEntity extends BaseEpmetEntity { */ private Integer pointTotal; + /** + * 党员指标得分 + * */ + private BigDecimal indexScore; /** * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java index 75668a1215..138e19cd30 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java @@ -90,7 +90,7 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { /** * 人均议题 */ - private Integer avgIssue; + private BigDecimal avgIssue; /** * 人均议题较上月增长率(采集的时候后台自己计算) @@ -105,7 +105,7 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity { /** * 平均参与度 */ - private Integer avgJoin; + private BigDecimal avgJoin; /** * 平均参与度较上月增长率(采集的时候后台自己计算) 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 fc8ec41c57..ea56c96a37 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 @@ -42,7 +42,6 @@ public class IndexExcelDataListener extends AnalysisEventListener { List indexModelList = new ArrayList<>(); private String preWheight; - private Integer wheightSum = 0; /** * 假设这个是一个DAO,当然有业务逻辑这个也可以是一个service。当然如果不用存储这个对象没用。 */ @@ -104,6 +103,17 @@ public class IndexExcelDataListener extends AnalysisEventListener { } } + //指标值类型 无:none;整数:integer;小数: decimal;百分比:percent + if (StringUtils.isNotBlank(data.getValueType())) { + if ("整数".equals(data.getValueType())) { + data.setValueType("integer"); + } else if ("小数".equals(data.getValueType())) { + data.setValueType("decimal"); + } else if ("百分比".equals(data.getValueType())) { + data.setValueType("percent"); + } + } + IndexDictEntity entity = new IndexDictEntity(); IndexDictEntity entity2 = new IndexDictEntity(); IndexDictEntity entity3 = new IndexDictEntity(); @@ -306,6 +316,7 @@ public class IndexExcelDataListener extends AnalysisEventListener { entity5.setCorrelation(data.getCorrelation()); entity5.setLevel("5"); entity5.setIndexCode(Pinyin4jUtil.getSpellPinYin(data.getLevel5Index(), false, 4)); + entity.setValueType(data.getValueType()); indexDicMap.put(data.getLevel5Index(), entity5); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java index b2e124ff09..cc1aed7759 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java @@ -26,6 +26,11 @@ public class IndexModel { //没有阈值:无,有就是百分数 @ExcelProperty(value = "阈值") private String threshold; + /** + * 指标值类型 无:none;整数:integer;小数: decimal;百分比:percent + */ + @ExcelProperty(value = "五级指标值类型") + private String valueType; /** * 正相关:positive;负相关:negative */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java index af4b583eec..cb9552dd4d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java @@ -1,5 +1,7 @@ package com.epmet.service.evaluationindex.extract.dataToIndex; +import java.util.Map; + /** * 党员相关 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java index a837550337..41c21e6b68 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.extract.dataToIndex.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dto.indexcal.CpcScoreResultDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService; import com.epmet.service.evaluationindex.extract.todata.*; @@ -126,7 +127,6 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { factIndexPartyAblityCpcMonthlyService.delAndSavePartyAblityCpcMonthly(customerId,monthId,indexPartyAblityCpcList); } - /** * @param customerId * @param partyMemberList @@ -400,4 +400,6 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService { + + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java index 8391e684b7..6cd619a2fd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java @@ -134,18 +134,18 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService BigDecimal element = new BigDecimal(entity.getClosedProjectCount()); //分母,即机关参与过的项目数(去重) Integer denominator = agencyParticipatedCount.get(entity.getAgencyId()); - if (agencyParticipatedCount.get(entity.getAgencyId()) != NumConstant.ZERO) { + if (null != denominator && denominator != NumConstant.ZERO) { //办结率 entity.setClosedProjectRatio( element.divide(new BigDecimal(denominator), NumConstant.SIX, RoundingMode.HALF_UP) ); + }else{ + entity.setClosedProjectRatio(BigDecimal.ZERO); } //办结效率 entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId())); }); - - factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); factIndexGovrnAblityOrgMonthlyService.saveList(list); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java new file mode 100644 index 0000000000..56c73b2de5 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java @@ -0,0 +1,29 @@ +package com.epmet.service.evaluationindex.extract.toscreen; + +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; + +/** + * 基层治理 + * 热心市民积分 党员能力值 + * 难点赌点 + * */ +public interface ScreenGrassrootsGovernDataAbsorptionService { + + /** + * @Description 用户积分、党员分值数据中转站 + * @param param + * @return + * @author wangc + * @date 2020.09.25 09:53 + **/ + void userScoreDataHub(ScreenCentralZoneDataFormDTO param); + + /** + * @Description 难点赌点数据中转站 + * @param param + * @return + * @author wangc + * @date 2020.09.25 10:00 + **/ + void difficultyDataHub(ScreenCentralZoneDataFormDTO param); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java index 57d1556e55..12a37d90a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.ScreenConstant; import com.epmet.dto.extract.form.ScreenExtractFormDTO; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; @@ -75,7 +76,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { } String monthId = screenExtractFormDTO.getMonthId(); if (StringUtils.isEmpty(monthId)){ - monthId = LocalDate.now().toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); + monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX); } if (!CollectionUtils.isEmpty(customerIds)){ String finalMonthId = monthId; @@ -272,8 +273,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { if (!CollectionUtils.isEmpty(agencyIdList)){ List result = new ArrayList<>(); List orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); + List joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY); + List screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds); if (isGrid == true){ - List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId); + List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); agencyIdList.forEach(agency -> { String agencyId = agency.getAgencyId(); Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); @@ -285,14 +288,14 @@ public class PartyGuideServiceImpl implements PartyGuideService { joinUserCountList.forEach(join -> { if (party.getOrgId().equals(join.getOrgId())){ party.setAverageJoinUserCount(join.getJoinUserCount()); - party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount()); + party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); + party.setYearId(DateUtils.getYearId(monthId)); } }); }); } result.addAll(screenPartyBranchDataList); }); - // 社区级别的 Map> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId)); List orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); @@ -309,18 +312,94 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setOrgId(agencyId); form.setCustomerId(customerId); form.setOrgType(ScreenConstant.AGENCY); + form.setMonthId(monthId); + form.setYearId(DateUtils.getYearId(monthId)); form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); - form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount()); + screenPartyBranchDataByAgencyList.forEach(organize -> { + if (organize.getOrgId().equals(agencyId)){ + form.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); + } + }); + joinUserCountByAgencyList.forEach(join -> { + if (join.getOrgId().equals(agencyId)){ + form.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); + } + }); + form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); result.add(form); }); - + delAndInsertOrganize(result,customerId,monthId,orgIds); }else { - + List directGridIds = gridService.selectDirectGrid(orgIds); + agencyIdList.forEach(agency -> { + String agencyId = agency.getAgencyId(); + List disGridIds = new ArrayList<>(); + directGridIds.forEach(grid -> { + if (agencyId.equals(grid.getAgencyId())){ + disGridIds.add(grid.getGridId()); + } + }); + // 存在直属网格 + if (!CollectionUtils.isEmpty(disGridIds)){ + orgIds.addAll(disGridIds); + List gridResult = new ArrayList<>(); + List joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID); + List screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds); + if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ + screenPartyBranchDataList.forEach(party -> { + joinUserCountList.forEach(join -> { + if (party.getOrgId().equals(join.getOrgId())){ + party.setAverageJoinUserCount(join.getJoinUserCount()); + party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount()); + party.setYearId(DateUtils.getYearId(monthId)); + } + }); + ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class); + gridResult.add(copyParty); + }); + } + } + List disPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByOrgId(customerId, monthId, disGridIds); + List screenPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByParentId(customerId, monthId, agencyId); + screenPartyBranchDataList.addAll(disPartyBranchDataList); + if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){ + ScreenPartyBranchDataFormDTO form = new ScreenPartyBranchDataFormDTO(); + form.setOrgId(agencyId); + form.setOrgType(ScreenConstant.AGENCY); + form.setOrgName(screenPartyBranchDataList.get(NumConstant.ZERO).getOrgName()); + form.setCustomerId(customerId); + form.setMonthId(monthId); + form.setYearId(DateUtils.getYearId(monthId)); + form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId()); + form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))); + form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))); + screenPartyBranchDataByAgencyList.forEach(organize -> { + if (organize.getOrgId().equals(agencyId)){ + form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)))); + } + }); + joinUserCountByAgencyList.forEach(join -> { + if (join.getOrgId().equals(agencyId)){ + form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)))); + } + }); + form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount())); + result.add(form); + } + }); + delAndInsertOrganize(result,customerId,monthId,orgIds); } } } + public Integer calAdd(Integer a, Integer b){ + if (null != a && null != b){ + return a + b; + } + return NumConstant.ZERO; + } + /** * @Description 社区级别的处理 * @Param customerId @@ -381,7 +460,7 @@ public class PartyGuideServiceImpl implements PartyGuideService { } Integer delNum; do { - delNum = linkMassesDataService.deleteOldPartyLinkInfo(customerId, monthId, orgIds); + delNum = linkMassesDataService.deleteOldPartyLinkInfo(customerId, orgIds); }while (delNum > NumConstant.ZERO); List> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); partition.forEach(p -> { @@ -403,6 +482,31 @@ public class PartyGuideServiceImpl implements PartyGuideService { List screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId); List screenPartyBranchDataList = gridService.selectAllGridIdToOrganize(customerId, monthId); screenPartyBranchDataList.addAll(screenPartyBranchData); + List finalResult = new ArrayList<>(); + screenPartyBranchDataList.forEach(rl -> { + orgIds.forEach(orgId -> { + if (rl.getOrgId().equals(orgId)){ + finalResult.add(rl); + } + }); + }); + if (!CollectionUtils.isEmpty(result)){ + finalResult.forEach(fr -> { + result.forEach(r -> { + if (fr.getOrgId().equals(r.getOrgId())){ + BeanUtils.copyProperties(r,fr); + } + }); + }); + } + Integer delNum; + do { + delNum = partyBranchDataService.deleteOldScreenPartyBranchData(customerId, monthId, orgIds); + }while (delNum > NumConstant.ZERO); + List> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED); + partition.forEach(p -> { + partyBranchDataService.insertScreenPartyBranchData(p); + }); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java index 3fd70b4e5a..bb94830ba1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java @@ -53,7 +53,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { /** * desc: 【月】抽取公众参与 人均议题 总次数和平均参与度 * target:screen_user_join - * 总参与:统计周期内议题表决的人数 + * 总参与:统计周期内议题表决(虽然可以评价 但是只有表决的人可以评价 所以按表决人数算)的人数 * 百人人均议题:统计周期内总的议题数/(注册用户数/100) * 百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 * 不考虑市北:人均议题:统计周期内议题总数/发过议题的人数 参与度:各个行为(表决)的总数/发生行为的人数 @@ -102,7 +102,12 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { //百人人均议题:统计周期内总的议题数/(注册用户数/100) BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getUserCount()).divide(new BigDecimal(NumConstant.ONE_HUNDRED))); // 需要修改字段类型 - //entity.setAvgIssue(avgIssueCount); + entity.setAvgIssue(avgIssueCount); + + //百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数 + + + entity.setAvgJoin(new BigDecimal(0)); }); @@ -144,10 +149,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService { entity.setJoinTotal(0); entity.setJoinTotalUpRate(new BigDecimal("0")); entity.setJoinTotalUpFlag(""); - entity.setAvgIssue(0); + entity.setAvgIssue(new BigDecimal(0)); entity.setAvgIssueUpRate(new BigDecimal("0")); entity.setAvgIssueUpFlag(""); - entity.setAvgJoin(0); + entity.setAvgJoin(new BigDecimal(0)); entity.setAgvgJoinUpRate(new BigDecimal("0")); entity.setAgvgJoinUpFlag(""); result.put(entity.getOrgId(), entity); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java new file mode 100644 index 0000000000..563a8c65cc --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java @@ -0,0 +1,119 @@ +package com.epmet.service.evaluationindex.extract.toscreen.impl; + +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.dto.org.GridInfoDTO; +import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; +import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService; +import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService; +import com.epmet.service.evaluationindex.screen.ScreenPartyUserRankDataService; +import com.epmet.service.org.CustomerGridService; +import com.epmet.service.point.UserPointService; +import com.epmet.service.user.UserService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; +import org.springframework.util.StringUtils; + +import java.math.BigDecimal; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + + +/** + * @Description 基层治理数据 + * @ClassName ScreenGrassrootsGovernDataAbsorptionServiceImpl + * @Auth wangc + * @Date 2020-09-25 09:48 + */ + +@Service +@Slf4j +public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGrassrootsGovernDataAbsorptionService { + + @Autowired + private UserService userService; + @Autowired + private CustomerGridService customerGridService; + @Autowired + private UserPointService userPointService; + @Autowired + private CpcIndexCalculateService cpcIndexCalculateService; + @Autowired + private ScreenPartyUserRankDataService screenPartyUserRankDataService; + /** + * @Description 用户积分、党员分值数据中转站 + * @param param + * @return + * @author wangc + * @date 2020.09.25 09:53 + **/ + @Override + public void userScoreDataHub(ScreenCentralZoneDataFormDTO param) { + //1.查询出客户下的网格注册用户 + List registeredUsers = userService.getRegisteredUserList(param.getCustomerId()); + + //2.查询出客户下网格的相关信息 + List gridList = customerGridService.queryGridInfoList(param.getCustomerId()); + Map gridMap = new HashMap<>(); + gridList.forEach(grid -> {gridMap.put(grid.getGridId(),grid);}); + + //3.查询出客户下用户的累计积分(累计值,没有时间概念,否则需要查询积分明细计算出评价周期末的得分) + Map pointMap = userPointService.getUserPointMap(param.getCustomerId()); + //4.查询出客户下党员的分值 + String dateId = param.getDateId(); + if(StringUtils.isEmpty(dateId)){ + //如果没有传月份,则使用当前时间的上一个月 + dateId = DateUtils.getBeforeNMonth(NumConstant.ONE); + }else{ + String dateType = DateUtils.identifyTimeDimension(dateId); + if(StringUtils.isEmpty(dateType) || !org.apache.commons.lang3.StringUtils.equalsAny(dateType,"date","month")){ + dateId = DateUtils.getBeforeNMonth(NumConstant.ONE); + }else if(org.apache.commons.lang3.StringUtils.equals(dateType,"date")){ + dateId = dateId.substring(NumConstant.ZERO,dateId.length() - NumConstant.TWO); + } + } + final String finalDateId = dateId; + + Map scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId); + + //5.整合数据 + if(!CollectionUtils.isEmpty(registeredUsers)){ + registeredUsers.forEach(user -> { + GridInfoDTO gridInfo = gridMap.get(user.getGridId()); + if(null != gridInfo){ + user.setGridName(gridInfo.getGridName()); + user.setOrgId(gridInfo.getAgencyId()); + user.setOrgName(gridInfo.getOrgName()); + user.setAllParentIds(gridInfo.getPids()); + } + Integer point = pointMap.get(user.getUserId()); + BigDecimal score = scoreMap.get(user.getUserId()); + + user.setPointTotal(null == point ? NumConstant.ZERO : point); + user.setIndexScore(null == score ? new BigDecimal(NumConstant.ZERO) : score); + + user.setDataEndTime(finalDateId); + }); + + } + + //6.存入数据库 + screenPartyUserRankDataService.dataClean(registeredUsers,param.getCustomerId(),dateId); + } + + /** + * @Description 难点赌点数据中转站 + * @param param + * @return + * @author wangc + * @date 2020.09.25 10:00 + **/ + @Override + public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) { + + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/CpcIndexCalculateService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/CpcIndexCalculateService.java index 3cd66eccf5..29acca93a9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/CpcIndexCalculateService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/CpcIndexCalculateService.java @@ -2,6 +2,9 @@ package com.epmet.service.evaluationindex.indexcal; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import java.math.BigDecimal; +import java.util.Map; + /** * 党员指标计算service * @@ -15,4 +18,14 @@ public interface CpcIndexCalculateService { * @return */ Boolean cpcIndexCalculate(CalculateCommonFormDTO formDTO); + + /** + * @Description 获取党员指标得分 + * @param customerId + * @param monthId + * @return + * @author wangc + * @date 2020.09.25 16:48 + **/ + Map getCpcScore(String customerId, String monthId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java index a4aaf10692..278c4a2236 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.dao.evaluationindex.indexcal.CpcScoreDao; import com.epmet.dao.evaluationindex.indexcal.CpcSubScoreDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.CpcScoreResultDTO; import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity; import com.epmet.entity.evaluationindex.indexcal.CpcSubScoreEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; @@ -66,6 +67,24 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { return true; } + /** + * @Description 获取党员指标得分 + * @param customerId + * @param monthId + * @return + * @author wangc + * @date 2020.09.25 16:48 + **/ + @Override + public Map getCpcScore(String customerId, String monthId) { + List scores = cpcScoreDao.selectCpcScore(customerId,monthId); + Map map = new HashMap<>(); + if(!CollectionUtils.isEmpty(scores)){ + scores.forEach(score -> {map.put(score.getUserId(),score.getScore());}); + } + return map; + } + /** * desc: 计算总分 * diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyBranchDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyBranchDataService.java index 68197d665c..1fc80f30ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyBranchDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyBranchDataService.java @@ -39,4 +39,34 @@ public interface ScreenPartyBranchDataService extends BaseService lists); + /** + * @Description 删除旧的建设情况数据 + * @Param customerId + * @Param monthId + * @Param orgIds + * @author zxc + * @date 2020/9/27 9:04 上午 + */ + Integer deleteOldScreenPartyBranchData(String customerId, String monthId, List orgIds); + + /** + * @Description 根据orgId查询建设情况数据 + * @Param customerId + * @Param monthId + * @Param orgIds + * @author zxc + * @date 2020/9/27 9:38 上午 + */ + List selectScreenPartyBranchDataByOrgId(String customerId, String monthId, List orgIds); + + /** + * @Description 根据parentId查询建设情况数据 + * @Param customerId + * @Param monthId + * @Param parentId + * @author zxc + * @date 2020/9/27 9:38 上午 + */ + List selectScreenPartyBranchDataByParentId(String customerId, String monthId, String parentId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyLinkMassesDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyLinkMassesDataService.java index f03255904a..77b8cdb3eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyLinkMassesDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyLinkMassesDataService.java @@ -42,12 +42,11 @@ public interface ScreenPartyLinkMassesDataService extends BaseService orgIds); + Integer deleteOldPartyLinkInfo(String customerId, List orgIds); /** * @Description 查询党员联系群众信息 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java index 41cda44da2..a454c51734 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java @@ -20,6 +20,8 @@ package com.epmet.service.evaluationindex.screen; import com.epmet.commons.mybatis.service.BaseService; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; +import java.util.List; + /** * 党建引领|基层治理-市民(党员)积分排行榜 * @@ -28,4 +30,15 @@ import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; */ public interface ScreenPartyUserRankDataService extends BaseService { + + /** + * @Description 用户参与排行数据清洗 + * @param dataList + * @param customerId + * @return + * @author wangc + * @date 2020.09.27 09:44 + **/ + void dataClean(List dataList,String customerId,String dateId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java index 0a79ebf476..d506856d0e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java @@ -175,7 +175,7 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ @Override public List selectAllAgencyIdToOrganize(String customerId, String monthId) { - return null; + return screenCustomerAgencyDao.selectAllAgencyIdToOrganize(customerId, monthId); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyBranchDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyBranchDataServiceImpl.java index 271ac60c71..afd2e8aee3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyBranchDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyBranchDataServiceImpl.java @@ -18,7 +18,10 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenPartyBranchDataDao; import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenPartyBranchDataEntity; @@ -26,6 +29,7 @@ import com.epmet.service.evaluationindex.screen.ScreenPartyBranchDataService; import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +import java.util.ArrayList; import java.util.List; /** @@ -35,6 +39,7 @@ import java.util.List; * @since v1.0.0 2020-09-22 */ @Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenPartyBranchDataServiceImpl extends BaseServiceImpl implements ScreenPartyBranchDataService { /** @@ -49,4 +54,49 @@ public class ScreenPartyBranchDataServiceImpl extends BaseServiceImpl orgIds) { + if (!CollectionUtils.isEmpty(orgIds)){ + return baseDao.deleteOldScreenPartyBranchData(customerId, monthId, orgIds); + } + return NumConstant.ZERO; + } + + /** + * @Description 根据orgId查询建设情况数据 + * @Param customerId + * @Param monthId + * @Param orgIds + * @author zxc + * @date 2020/9/27 9:38 上午 + */ + @Override + public List selectScreenPartyBranchDataByOrgId(String customerId, String monthId, List orgIds) { + if (!CollectionUtils.isEmpty(orgIds)){ + return baseDao.selectScreenPartyBranchDataByOrgId(customerId, monthId, orgIds); + } + return new ArrayList<>(); + } + + /** + * @Description 根据parentId查询建设情况数据 + * @Param customerId + * @Param monthId + * @Param parentId + * @author zxc + * @date 2020/9/27 9:38 上午 + */ + @Override + public List selectScreenPartyBranchDataByParentId(String customerId, String monthId, String parentId) { + return baseDao.selectScreenPartyBranchDataByParentId(customerId, monthId, parentId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyLinkMassesDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyLinkMassesDataServiceImpl.java index 2aec948249..2915297086 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyLinkMassesDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyLinkMassesDataServiceImpl.java @@ -57,14 +57,13 @@ public class ScreenPartyLinkMassesDataServiceImpl extends BaseServiceImpl orgIds) { - return baseDao.deleteOldPartyLinkInfo(customerId, monthId, orgIds); + public Integer deleteOldPartyLinkInfo(String customerId, List orgIds) { + return baseDao.deleteOldPartyLinkInfo(customerId, orgIds); } /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java index 6e171bbe80..a543e07fff 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java @@ -19,11 +19,15 @@ package com.epmet.service.evaluationindex.screen.impl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.NumConstant; import com.epmet.dao.evaluationindex.screen.ScreenPartyUserRankDataDao; import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.service.evaluationindex.screen.ScreenPartyUserRankDataService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.List; + /** * 党建引领|基层治理-市民(党员)积分排行榜 * @@ -33,5 +37,23 @@ import org.springframework.stereotype.Service; @Service public class ScreenPartyUserRankDataServiceImpl extends BaseServiceImpl implements ScreenPartyUserRankDataService { + @Autowired + ScreenPartyUserRankDataDao screenPartyUserRankDataDao; + /** + * @Description 用户参与排行数据清洗 + * @param dataList + * @param customerId + * @return + * @author wangc + * @date 2020.09.27 09:44 + **/ + @Override + public void dataClean(List dataList, String customerId, String dateId) { + int affectedRows; + do{ + affectedRows = baseDao.deleteBatchByCustomerIdAndDateId(customerId,dateId); + }while (affectedRows > NumConstant.ZERO); + baseDao.insertBatch(dataList); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java index b21e39c716..63d3810047 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java @@ -18,12 +18,15 @@ package com.epmet.service.evaluationindex.screen.impl; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.screen.ScreenUserTotalDataDao; import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; import com.epmet.service.evaluationindex.screen.ScreenUserTotalDataService; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.List; @@ -35,6 +38,7 @@ import java.util.List; * @since v1.0.0 2020-09-22 */ @Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenUserTotalDataServiceImpl extends BaseServiceImpl implements ScreenUserTotalDataService { /** @@ -45,11 +49,12 @@ public class ScreenUserTotalDataServiceImpl extends BaseServiceImpl list,String customerId) { int deleteNum; do { deleteNum = baseDao.deleteUserTotalData(customerId); - } while (deleteNum <= NumConstant.ZERO); + } while (deleteNum > NumConstant.ZERO); if(!CollectionUtils.isEmpty(list)){ baseDao.insertBatch(list); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java index 4a5e9697fb..9438f4c3ea 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java @@ -413,15 +413,35 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { * @Author zhangyong * @Date 15:38 2020-08-21 **/ - private BigDecimal calculateGrowthRateNumber(Integer old, Integer now){ - if (NumConstant.ZERO == old){ + private BigDecimal calculateGrowthRateNumber(Integer old, Integer now) { + if (NumConstant.ZERO == old) { return new BigDecimal(now * NumConstant.ONE_HUNDRED); } BigDecimal bignum1 = new BigDecimal((now - old) * NumConstant.ONE_HUNDRED); - BigDecimal bignum2 = bignum1.divide(new BigDecimal(old),2,BigDecimal.ROUND_HALF_UP); + BigDecimal bignum2 = bignum1.divide(new BigDecimal(old), 2, BigDecimal.ROUND_HALF_UP); return bignum2; } + /** + * 计算 本月数值 相较于 上月数值,的增长率 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.math.BigDecimal + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private BigDecimal calculateGrowthRateNumber(BigDecimal old, BigDecimal now) { + BigDecimal oneHundred = new BigDecimal(NumConstant.ONE_HUNDRED); + if (old.compareTo(new BigDecimal(NumConstant.ZERO)) == NumConstant.ZERO) { + return now.multiply(oneHundred); + } + BigDecimal bignum1 = now.subtract(old).multiply(oneHundred); + BigDecimal bignum2 = bignum1.divide(old, 2, BigDecimal.ROUND_HALF_UP); + return bignum2; + } + + /** * 计算 本月数值 相较于 上月数值,的增长率, 得出标识 * @@ -431,10 +451,29 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { * @Author zhangyong * @Date 15:38 2020-08-21 **/ - private String calculateGrowthRateFlag(Integer old, Integer now){ - if (old > now){ + private String calculateGrowthRateFlag(Integer old, Integer now) { + if (old > now) { + return CompareConstant.DECR_STR; + } else if (old < now) { + return CompareConstant.INCR_STR; + } else { + return CompareConstant.EQ_STR; + } + } + + /** + * 计算 本月数值 相较于 上月数值,的增长率, 得出标识 + * + * @param old 上月数值 + * @param now 本月数值 + * @return java.util.String + * @Author zhangyong + * @Date 15:38 2020-08-21 + **/ + private String calculateGrowthRateFlag(BigDecimal old, BigDecimal now) { + if (old.compareTo(now) == 1) { return CompareConstant.DECR_STR; - } else if (old < now){ + } else if (old.compareTo(now) == -1) { return CompareConstant.INCR_STR; } else { return CompareConstant.EQ_STR; @@ -448,7 +487,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService { if (formDTO.getIsFirst()) { int deleteNum; do { - deleteNum = screenPioneerDataDao.deletePioneerDataByCustomerId(customerId,IndexCalConstant.DELETE_SIZE); + deleteNum = screenPioneerDataDao.deletePioneerDataByCustomerId(customerId, IndexCalConstant.DELETE_SIZE); } while (deleteNum != NumConstant.ZERO); } if (!CollectionUtils.isEmpty(formDTO.getDataList())) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java index 7875323b3c..c7cb47c47a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java @@ -17,6 +17,6 @@ public interface ActUserRelationService { * @author zxc * @date 2020/9/25 5:19 下午 */ - List selectJoinUserCount(String customerId,String monthId); + List selectJoinUserCount(String customerId,String monthId, String orgType); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java index 570967a3c0..b9b5165260 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java @@ -29,7 +29,7 @@ public class ActUserRelationServiceImpl implements ActUserRelationService { * @date 2020/9/25 5:19 下午 */ @Override - public List selectJoinUserCount(String customerId, String monthId) { - return actUserRelationDao.selectJoinUserCount(customerId, monthId); + public List selectJoinUserCount(String customerId, String monthId, String orgType) { + return actUserRelationDao.selectJoinUserCount(customerId, monthId, orgType); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/UserPointService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/UserPointService.java new file mode 100644 index 0000000000..ce185cad6a --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/UserPointService.java @@ -0,0 +1,18 @@ +package com.epmet.service.point; + +import java.util.Map; + +/** + * 用户积分库 + * */ +public interface UserPointService { + + /** + * @Description 根据客户Id查询用户积分Map + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 16:00 + **/ + Map getUserPointMap(String customerId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/impl/UserPointServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/impl/UserPointServiceImpl.java new file mode 100644 index 0000000000..0402afe418 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/impl/UserPointServiceImpl.java @@ -0,0 +1,46 @@ +package com.epmet.service.point.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.point.PointDao; +import com.epmet.dto.point.UserPointDTO; +import com.epmet.service.point.UserPointService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @Description + * @ClassName UserPointServiceImpl + * @Auth wangc + * @Date 2020-09-25 15:54 + */ +@Service +@Slf4j +@DataSource(DataSourceConstant.EPMET_POINT) +public class UserPointServiceImpl implements UserPointService { + + @Autowired + private PointDao pointDao; + /** + * @Description 根据客户Id查询用户积分Map + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 16:00 + **/ + @Override + public Map getUserPointMap(String customerId) { + List points = pointDao.selectUserPointByCustomerId(customerId); + Map map = new HashMap<>(); + if(!CollectionUtils.isEmpty(points)){ + points.forEach(point -> {map.put(point.getUserId(),point.getPointTotal());}); + } + return map; + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java index a36695b6b0..24811db736 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java @@ -5,12 +5,11 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.stats.*; -import com.epmet.dao.stats.topic.FactTopicTotalAgencyDailyDao; import com.epmet.dao.stats.topic.FactTopicTotalGridDailyDao; -import com.epmet.dao.stats.user.FactParticipationUserGridDailyDao; +import com.epmet.dao.stats.user.FactRegUserGridDailyDao; import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity; import com.epmet.service.stats.ScreenCentralZoneDataExtractService; import lombok.extern.slf4j.Slf4j; @@ -35,7 +34,7 @@ import java.util.stream.Collectors; public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZoneDataExtractService { @Autowired - private FactParticipationUserGridDailyDao factParticipationUserGridDailyDao; + private FactRegUserGridDailyDao factRegUserGridDailyDao; @Autowired private FactGroupGridDailyDao factGroupGridDailyDao; @Autowired @@ -63,20 +62,22 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon //1.查询用户与党员数据,判断dimId是否为昨天,如果根据这个dimId没有查询出结果,则取前天的数据 //如果还是查不出数据,继续向下执行,这部分数据设置默认值 + + //注册用户数 List result = - factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); + factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId); if(CollectionUtils.isEmpty(result)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ - result = factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); + result = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } if(null == result) result = new LinkedList<>(); } List gridUserResult = - factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); + factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId); if(CollectionUtils.isEmpty(gridUserResult)){ if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){ - gridUserResult = factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); + gridUserResult = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } if(!CollectionUtils.isEmpty(gridUserResult)){ @@ -145,15 +146,22 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon gridProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_GRID,customerId,DateUtils.getBeforeNDay(NumConstant.TWO)); } } - Map projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal)); - projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal))); + Map projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal)); + projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal))); result.forEach(o -> { String orgId = o.getOrgId(); - o.setGroupTotal(groupMap.get(orgId)); - o.setTopicTotal(topicMap.get(orgId)); - o.setIssueTotal(issueMap.get(orgId)); - o.setProjectTotal(projectMap.get(orgId)); + Integer count = groupMap.get(orgId); + o.setGroupTotal(null == count ? NumConstant.ZERO : count); + + count = topicMap.get(orgId); + o.setTopicTotal(null == count ? NumConstant.ZERO : count); + + count = issueMap.get(orgId); + o.setIssueTotal(null == count ? NumConstant.ZERO : count); + + count = projectMap.get(orgId); + o.setProjectTotal(null == count ? NumConstant.ZERO : count); o.setDataEndTime(dimId); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java index 29521f2f2c..767af842b0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java @@ -3,6 +3,7 @@ package com.epmet.service.user; import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.stats.user.result.UserStatisticalData; +import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.util.DimIdGenerator; import org.apache.ibatis.annotations.Param; @@ -65,4 +66,13 @@ public interface UserService { * @Date 2020/9/21 16:44 **/ List getGridRegUserIds(String customerId, String gridId); + + /** + * @Description 获取客户下的网格注册居民 + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 13:54 + **/ + List getRegisteredUserList(String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java index 12616b584c..faf43458cd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java @@ -11,6 +11,7 @@ import com.epmet.dto.extract.result.UserPartyResultDTO; import com.epmet.dto.stats.user.*; import com.epmet.dto.stats.user.result.UserStatisticalData; import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO; +import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity; import com.epmet.service.user.UserService; import com.epmet.util.DimIdGenerator; import com.epmet.util.ModuleConstant; @@ -23,7 +24,6 @@ import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.text.NumberFormat; -import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -357,10 +357,6 @@ public class UserServiceImpl implements UserService { dataPacket.setPartiAgencyDailyList(list); } - - - - FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO(); regAgencyM.setCustomerId(customerId); regAgencyM.setAgencyId(agencyId); @@ -695,32 +691,9 @@ public class UserServiceImpl implements UserService { } - } - public static void main(String[] args) { - - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd"); - Calendar calendar = Calendar.getInstance(); - calendar.setTime(new Date()); - //calendar.set(Calendar.DAY_OF_MONTH, 1); - calendar.set(Calendar.HOUR_OF_DAY, 0); - calendar.set(Calendar.MINUTE, 0); - calendar.set(Calendar.SECOND, 0); - System.out.println(format.format(calendar.getTime())); - - - - calendar.setTime(calendar.getTime()); - calendar.add(Calendar.DATE, -1); - System.out.println(calendar.getTime()); - System.out.println(format.format(calendar.getTime())); - System.out.println(format2.format(calendar.getTime())); - } - - /** * @return java.util.List * @param customerId @@ -735,4 +708,25 @@ public class UserServiceImpl implements UserService { return userDao.selectGridRegUserIds(customerId,gridId); } + /** + * @Description 获取客户下的网格注册居民 + * @param customerId + * @return + * @author wangc + * @date 2020.09.25 13:54 + **/ + @Override + public List getRegisteredUserList(String customerId) { + List userList = userDao.selectRegisteredUserByCustomerId(customerId); + List partyList = userDao.selectPartymembersByCustomerId(customerId); + if(!CollectionUtils.isEmpty(userList)){ + userList.forEach(user -> { + if(partyList.contains(user.getUserId())){ + user.setPartyFlag(NumConstant.ONE); + } + }); + } + return userList; + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml index 8fbb50a81d..bf0cfd3d51 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml @@ -148,4 +148,18 @@ ) + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 594ded8702..1c1907e4a7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -328,7 +328,8 @@ AGENCY_NAME AS orgName, CUSTOMER_ID AS customerId, PID AS parentId, - #{monthId} AS dataEndTime + #{monthId} AS monthId, + SUBSTR(#{monthId},1,4) AS yearId FROM screen_customer_agency WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index 7f4df45113..ae09cefb52 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -319,7 +319,8 @@ grid_name AS orgName, CUSTOMER_ID AS customerId, PARENT_AGENCY_ID AS parentId, - #{monthId} AS dataEndTime + #{monthId} AS monthId, + SUBSTR(#{monthId},1,4) AS yearId FROM screen_customer_grid WHERE diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml index 92b2b888b7..5c5741a289 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml @@ -109,4 +109,63 @@ ) + + + + delete from screen_party_branch_data + where CUSTOMER_ID = #{customerId} + and MONTH_ID = #{monthId} + and + ( + + org_id = #{orgId} + + ) + LIMIT 1000 + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml index 20d7c3f7e7..f2c7adcb3d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml @@ -13,7 +13,6 @@ delete from screen_party_link_masses_data where CUSTOMER_ID = #{customerId} - and DATA_END_TIME = #{monthId} and ( diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml index d4089fcc30..6ca1f5da66 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml @@ -9,6 +9,13 @@ limit 1000; + + delete from screen_party_user_rank_data + where CUSTOMER_ID = #{customerId} + AND DATA_END_TIME = #{dateId} + limit 1000; + + insert into screen_party_user_rank_data ( @@ -59,4 +66,56 @@ + + insert into screen_party_user_rank_data + ( + ID, + CUSTOMER_ID, + GRID_ID, + GRID_NAME, + ORG_ID, + ORG_NAME, + PARTY_FLAG, + USER_ID, + SURNAME, + `NAME`, + USER_NAME, + POINT_TOTAL, + INDEX_SCORE, + DEL_FLAG, + REVISION, + CREATED_BY, + CREATED_TIME, + UPDATED_BY, + UPDATED_TIME, + DATA_END_TIME, + ALL_PARENT_IDS + ) values + + ( + (SELECT REPLACE(UUID(), '-', '') AS id), + #{customerId}, + #{item.gridId}, + #{item.gridName}, + #{item.orgId}, + #{item.orgName}, + #{item.partyFlag}, + #{item.userId}, + #{item.surname}, + #{item.name}, + #{item.userName}, + #{item.pointTotal}, + #{item.indexScore}, + '0', + 0, + 'CRAWLER_ROBOT', + now(), + 'CRAWLER_ROBOT', + now(), + #{item.dataEndTime}, + #{item.allParentIds} + ) + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml index ae81f1cbe2..cc1254716e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml @@ -18,7 +18,7 @@ AND asr.REWARD_FLAG = 'agree' AND ai.CUSTOMER_ID = #{customerId} AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId} - AND ai.SPONSOR_TYPE = 'agency' + AND ai.SPONSOR_TYPE = #{orgType} GROUP BY ai.SPONSOR_ID diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml index 41ce69835f..ea0d0fc48b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml @@ -74,8 +74,10 @@ cg.ID as GRID_ID, cg.PID as AGENCY_ID, ca.PID AS PID, - CG.CUSTOMER_ID, - cg.PIDS as PIDS + cg.CUSTOMER_ID, + cg.PIDS as PIDS, + cg.GRID_NAME, + ca.ORGANIZATION_NAME as ORG_NAME FROM customer_grid cg LEFT JOIN customer_agency ca ON ( cg.PID = CA.ID ) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml new file mode 100644 index 0000000000..418d4dd49f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml index c8e631ed88..7b4c669324 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml @@ -80,11 +80,10 @@ - - \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml index f8d85b7ab9..855007785a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml @@ -106,4 +106,47 @@ + + + + + + + + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml index 03f525d12d..55bc599470 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml @@ -459,6 +459,8 @@ + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx index ea2e9e044c..7f624f10bb 100644 Binary files a/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx and b/epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx differ