diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java index 605f755064..42d0ce8fa3 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/AgencyScoreDTO.java @@ -69,12 +69,17 @@ public class AgencyScoreDTO implements Serializable { /** * 月维度Id: yyyyMM */ - private String monthId; + private String monthId; /** * 1:总分;0不是;默认0 */ - private String isTotal; + private String isTotal; + + /** + * 参与计算的原始值 + */ + private String originValue; /** * 分值 diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java index 2888cc7706..3ca91f2a98 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexCommunityScoreDTO.java @@ -67,22 +67,27 @@ public class FactIndexCommunityScoreDTO implements Serializable { /** * 月维度Id: yyyyMM */ - private String monthId; + private String monthId; /** * 1:总分;0不是;默认0 */ - private String isTotal; + private String isTotal; + + /** + * 参与计算指标的原始值 + */ + private String originValue; /** * 分值 */ - private BigDecimal score; + private BigDecimal score; /** * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;社区相关:shequxiangguan */ - private String indexCode; + private String indexCode; /** * 所有指标code拼接的字符串 冒号隔开 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 803b93525e..f610fb6801 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 @@ -33,6 +33,8 @@ import com.epmet.service.evaluationindex.extract.CalGridIndexService; import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.FactOriginTopicMainDailyService; import com.epmet.service.evaluationindex.indexcal.*; +import com.epmet.service.evaluationindex.indexcoll.IndexCollCommunityService; +import com.epmet.service.evaluationindex.indexcoll.IndexCollStreetService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.DimCustomerPartymemberService; import lombok.extern.slf4j.Slf4j; @@ -92,6 +94,10 @@ public class DemoController { private FactOriginTopicMainDailyService factOriginTopicMainDailyService; @Autowired private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + @Autowired + private IndexCollCommunityService indexCollCommunityService; + @Autowired + private IndexCollStreetService indexCollStreetService; @GetMapping("testAlarm") public void testAlarm() { @@ -614,5 +620,16 @@ public class DemoController { } return new Result(); } + @PostMapping("indexCollCommunity") + public Result indexCollCommunity(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ + indexCollCommunityService.saveCommunityAbility(formDTO.getCustomerId(), formDTO.getDateId()); + return new Result(); + } + + @PostMapping("indexCollStreet") + public Result indexCollStreet(@RequestBody CustomerIdAndDateIdFormDTO formDTO){ + indexCollStreetService.saveStreetAbility(formDTO.getCustomerId(), formDTO.getDateId()); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexOriginExtractController.java index f4fba2d6d5..1f2b86020a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexOriginExtractController.java @@ -1,8 +1,8 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; -import com.epmet.dto.extract.form.ExtractFormDTO; -import com.epmet.service.evaluationindex.extract.FactOriginExtractService; +import com.epmet.dto.extract.form.ExtractIndexFormDTO; +import com.epmet.service.evaluationindex.extract.dataToIndex.IndexOriginExtractService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -20,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("indexorigin") public class IndexOriginExtractController { @Autowired - private FactOriginExtractService factOriginExtractService; + private IndexOriginExtractService indexOriginExtractService; /** @@ -30,8 +30,8 @@ public class IndexOriginExtractController { * @return */ @PostMapping("extractall") - public Result extractAll(@RequestBody ExtractFormDTO extractFormDTO) { - factOriginExtractService.extractAll(extractFormDTO); + public Result extractAll(@RequestBody ExtractIndexFormDTO extractFormDTO) { + indexOriginExtractService.indexOriginExtractAll(extractFormDTO); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java index 0b58bc2220..0c24c6d79b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/DimDepartmentDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.DimDepartmentDTO; import com.epmet.entity.stats.DimDepartmentEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -44,4 +45,13 @@ public interface DimDepartmentDao extends BaseDao { DimDepartmentEntity getLatestCreatedDimEntity(); DimDepartmentEntity getLatestUpdatedDimEntity(); + + /** + * 获取区直部门 + * @author zhaoqifeng + * @date 2020/9/21 14:51 + * @param customerId + * @return java.util.List + */ + List getDistrictDepByCustomer(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java index 1cff4fa1a8..dd48aa0afc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactArticlePublishedDepartmentDailyDao.java @@ -18,10 +18,14 @@ package com.epmet.dao.stats; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; +import com.epmet.dto.stats.FactArticlePublishedDepartmentDailyDTO; import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.List; + /** * 文章发布数量【部门】日统计表 * @@ -38,4 +42,14 @@ public interface FactArticlePublishedDepartmentDailyDao extends BaseDao + */ + List selectDeptCount(@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/entity/evaluationindex/indexcal/AgencySubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java index d5ca30dc0e..8b87b26a4e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java @@ -62,25 +62,30 @@ public class AgencySubScoreEntity extends BaseEpmetEntity { */ private String quarterId; - /** - * 月维度Id: yyyyMM - */ - private String monthId; - - /** - * 1:总分;0不是;默认0 - */ - private String isTotal; - - /** - * 分值 - */ - private BigDecimal score; - - /** - * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;街道相关:jiedaoxiangguan;全区相关:quanquxiangguan - */ - private String indexCode; + /** + * 月维度Id: yyyyMM + */ + private String monthId; + + /** + * 1:总分;0不是;默认0 + */ + private String isTotal; + + /** + * 计算指标时的原始值 字符串类型 + */ + private String originValue; + + /** + * 分值 + */ + private BigDecimal score; + + /** + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;街道相关:jiedaoxiangguan;全区相关:quanquxiangguan + */ + private String indexCode; /** * 数据类型 district :全区;street:街道 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java index f1c79068a5..d140aca767 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/CpcSubScoreEntity.java @@ -68,6 +68,11 @@ public class CpcSubScoreEntity extends BaseEpmetEntity { */ private String userId; + /** + * 计算指标时的原始值 字符串类型 + */ + private String originValue; + /** * 分值 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java index 191ffb0157..c75fc82847 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSubScoreEntity.java @@ -67,6 +67,11 @@ public class DeptSubScoreEntity extends BaseEpmetEntity { */ private String monthId; + /** + * 计算指标时的原始值 字符串类型 + */ + private String originValue; + /** * 分值 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java index d8938d9018..82f8b0ae74 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/FactIndexCommunitySubScoreEntity.java @@ -48,6 +48,11 @@ public class FactIndexCommunitySubScoreEntity extends BaseEpmetEntity { */ private String monthId; + /** + * 计算指标时的原始值 字符串类型 + */ + private String originValue; + /** * 分值 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java index 3404fda77d..fa88df4ba7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/GridSubScoreEntity.java @@ -77,6 +77,11 @@ public class GridSubScoreEntity extends BaseEpmetEntity { */ private String isTotal; + /** + * 计算指标时的原始值 字符串类型 + */ + private String originValue; + /** * 分值 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectOrgPeriodDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectOrgPeriodDailyService.java new file mode 100644 index 0000000000..e27adb5447 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactOriginProjectOrgPeriodDailyService.java @@ -0,0 +1,26 @@ +package com.epmet.service.evaluationindex.extract; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/21 16:46 + */ +public interface FactOriginProjectOrgPeriodDailyService extends BaseService { + /** + * 项目响应度 + * @author zhaoqifeng + * @date 2020/9/21 16:57 + * @param customerId + * @param monthId + * @param level + * @param orgType + * @return java.util.List + */ + List getResponsiveness(String customerId, String monthId, String level, String orgType); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java index de984c0133..426fc04193 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java @@ -7,6 +7,7 @@ import com.epmet.dto.extract.form.ExtractIndexFormDTO; import com.epmet.service.evaluationindex.extract.CalCpcIndexService; import com.epmet.service.evaluationindex.extract.CalGridIndexService; import com.epmet.service.evaluationindex.extract.dataToIndex.IndexOriginExtractService; +import com.epmet.service.evaluationindex.indexcoll.IndexCollCommunityService; import com.epmet.service.evaluationindex.indexcoll.IndexCollStreetService; import com.epmet.service.stats.DimCustomerService; import com.epmet.util.DimIdGenerator; @@ -42,6 +43,8 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService private DimCustomerService dimCustomerService; @Autowired private IndexCollStreetService indexCollStreetService; + @Autowired + private IndexCollCommunityService indexCollCommunityService; /** * desc:从统计库对象抽取指标数据 @@ -58,13 +61,14 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService List customerIds = new ArrayList<>(); if (StringUtils.isNotBlank(customerId)) { customerIds.add(customerId); - } - int pageNo = NumConstant.ONE; - int pageSize = NumConstant.ONE_HUNDRED; - customerIds = dimCustomerService.selectCustomerIdPage(pageNo, pageSize); - if (CollectionUtils.isEmpty(customerIds)) { - log.error("indexOriginExtractAll 获取客户Id为空"); - return; + } else { + int pageNo = NumConstant.ONE; + int pageSize = NumConstant.ONE_HUNDRED; + customerIds = dimCustomerService.selectCustomerIdPage(pageNo, pageSize); + if (CollectionUtils.isEmpty(customerIds)) { + log.error("indexOriginExtractAll 获取客户Id为空"); + return; + } } String finalMonthId = monthId; @@ -108,6 +112,11 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService }catch (Exception e){ log.error("抽取【街道治理能力-街道党建能力】发生异常,参数:" + JSON.toJSONString(param), e); } + try{ + indexCollCommunityService.saveCommunityAbility(customerId, monthId); + }catch (Exception e){ + log.error("抽取【社区治理能力-社区党建能力】发生异常,参数:" + JSON.toJSONString(param), e); + } }); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java index 50781824a9..e324d93b58 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectLogDailyServiceImpl.java @@ -19,11 +19,13 @@ package com.epmet.service.evaluationindex.extract.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.extract.FactOriginProjectLogDailyDao; import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.FactOriginProjectLogDailyDTO; @@ -48,6 +50,7 @@ import java.util.stream.Collectors; * @since v1.0.0 2020-09-16 */ @Service +@DataSource(DataSourceConstant.STATS) public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl implements FactOriginProjectLogDailyService { @Autowired diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java index eef67a5b71..7ef8a7435d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectMainDailyServiceImpl.java @@ -19,11 +19,13 @@ package com.epmet.service.evaluationindex.extract.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.extract.FactOriginProjectMainDailyDao; import com.epmet.dto.extract.FactOriginProjectMainDailyDTO; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; @@ -47,6 +49,7 @@ import java.util.Map; * @since v1.0.0 2020-09-16 */ @Service +@DataSource(DataSourceConstant.STATS) public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl implements FactOriginProjectMainDailyService { @Override diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java new file mode 100644 index 0000000000..a8356acac7 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactOriginProjectOrgPeriodDailyServiceImpl.java @@ -0,0 +1,26 @@ +package com.epmet.service.evaluationindex.extract.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.entity.evaluationindex.extract.FactOriginProjectOrgPeriodDailyEntity; +import com.epmet.service.evaluationindex.extract.FactOriginProjectOrgPeriodDailyService; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/21 16:48 + */ +@Service +@DataSource(DataSourceConstant.STATS) +public class FactOriginProjectOrgPeriodDailyServiceImpl extends BaseServiceImpl implements FactOriginProjectOrgPeriodDailyService { + @Override + public List getResponsiveness(String customerId, String monthId, String level, String orgType) { + return baseDao.selectResponsiveness(customerId, monthId, level, orgType); + } +} 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 71359d8b32..a4aaf10692 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 @@ -314,6 +314,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService { child.setAllParentIndexCode(o.getAllParentIndexCode()); child.setScore(o.getScore()); child.setWeight(o.getWeight()); + child.setOriginValue(o.getOriginValue()); subList.add(child); }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index 6266d20651..c9e0411462 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -322,6 +322,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl joinIssueAblityMap = this.getJoinIssueAblityMap(formDTO); minValue = joinIssueAblityMap.get(StrConstant.MIN); maxValue = joinIssueAblityMap.get(StrConstant.MAX); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index d7777dd540..03e10c7748 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -458,6 +458,7 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni s.setScore(fiveDetail.getScore()); s.setAllParentIndexCode(fiveDetail.getAllParentIndexCode()); s.setWeight(fiveDetail.getWeight()); + s.setOriginValue(fiveDetail.getOriginValue()); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { s.setParentAgencyId(parentAgency); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 0309f40eda..d170c73df4 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -435,6 +435,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); s.setDataType(IndexCalConstant.DISTRICT_LEVEL); s.setWeight(streetScore.getWeight()); + s.setOriginValue(streetScore.getOriginValue()); pid.forEach((agency, parentAgency) -> { //todo 确认 if (k != null && k.equals(agency)) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index 5a4b2a8dcd..59920d55fa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -463,6 +463,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ s.setDataType(IndexCalConstant.STREET_LEVEL); s.setAllParentIndexCode(streetScore.getAllParentIndexCode()); s.setWeight(streetScore.getWeight()); + s.setOriginValue(streetScore.getOriginValue()); pid.forEach((agency, parentAgency) -> { if (k.equals(agency)) { s.setParentAgencyId(parentAgency); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java new file mode 100644 index 0000000000..bf8254d738 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyService.java @@ -0,0 +1,21 @@ +package com.epmet.service.evaluationindex.indexcoll; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/21 15:24 + */ +public interface FactIndexGovrnAblityDeptMonthlyService extends BaseService { + /** + * 根据客户清空数据 + * @author zhaoqifeng + * @date 2020/9/20 20:33 + * @param customerId + * @param monthId + * @return void + */ + void deleteByCustomer(String customerId, String monthId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java index 272da9faef..6e709fa4fb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexGovrnAblityOrgMonthlyService.java @@ -40,4 +40,13 @@ public interface FactIndexGovrnAblityOrgMonthlyService extends BaseService list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java index cc541f597f..9abeed8617 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyService.java @@ -39,4 +39,13 @@ public interface FactIndexPartyAblityOrgMonthlyService extends BaseService list); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollDistrictDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollDistrictDepartmentService.java index 8416ac208c..e022090391 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollDistrictDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/IndexCollDistrictDepartmentService.java @@ -7,4 +7,14 @@ package com.epmet.service.evaluationindex.indexcoll; * @date 2020/9/18 10:43 */ public interface IndexCollDistrictDepartmentService { + /** + * 区直部门能力统计 + * + * @param customerId + * @param dateId + * @return void + * @author zhaoqifeng + * @date 2020/9/21 14:42 + */ + void saveDepartmentAbility(String customerId, String dateId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java new file mode 100644 index 0000000000..a8df14af94 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityDeptMonthlyServiceImpl.java @@ -0,0 +1,24 @@ +package com.epmet.service.evaluationindex.indexcoll.impl; + +import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.constant.DataSourceConstant; +import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyService; +import org.springframework.stereotype.Service; + +/** + * @author zhaoqifeng + * @dscription + * @date 2020/9/21 15:25 + */ +@Service +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class FactIndexGovrnAblityDeptMonthlyServiceImpl extends BaseServiceImpl implements FactIndexGovrnAblityDeptMonthlyService { + + @Override + public void deleteByCustomer(String customerId, String monthId) { + baseDao.deleteFactIndexGovrnAblityDeptMonthly(customerId, monthId); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java index e2f2170f67..6f6d5f15a5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexGovrnAblityOrgMonthlyServiceImpl.java @@ -10,6 +10,7 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthly import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import java.util.List; @@ -39,4 +40,10 @@ public class FactIndexGovrnAblityOrgMonthlyServiceImpl extends BaseServiceImpl list) { + insertBatch(list); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java index 5c66bd92f9..f49196555d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexPartyAblityOrgMonthlyServiceImpl.java @@ -39,4 +39,10 @@ public class FactIndexPartyAblityOrgMonthlyServiceImpl extends BaseServiceImpl list) { + insertBatch(list); + } + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java index 71e16ac3a8..19a19e8639 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollCommunityServiceImpl.java @@ -1,11 +1,8 @@ package com.epmet.service.evaluationindex.indexcoll.impl; -import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; -import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; @@ -13,6 +10,7 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthly import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; +import com.epmet.service.evaluationindex.extract.FactOriginProjectOrgPeriodDailyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollCommunityService; @@ -37,7 +35,6 @@ import java.util.stream.Collectors; */ @Service @Slf4j -@DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexCollCommunityServiceImpl implements IndexCollCommunityService { @Autowired private DimAgencyService dimAgencyService; @@ -46,7 +43,7 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService @Autowired private FactOriginProjectLogDailyService factOriginProjectLogDailyService; @Autowired - private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; + private FactOriginProjectOrgPeriodDailyService factOriginProjectOrgPeriodDailyService; @Autowired private FactOriginProjectMainDailyService factOriginProjectMainDailyService; @Autowired @@ -57,7 +54,7 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService @Override public void saveCommunityAbility(String customerId, String dateId) { //当前日期前一天 - Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + Date date = DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMM); //获取日期相关维度 DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //获取社区列表 @@ -92,7 +89,7 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService } //社区项目响应度 - List responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(customerId, dimId.getMonthId(), + List responsiveness = factOriginProjectOrgPeriodDailyService.getResponsiveness(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY, OrgTypeConstant.AGENCY); if (null != responsiveness && !responsiveness.isEmpty()) { list.forEach(entity -> responsiveness.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(response -> { @@ -123,7 +120,7 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService if (sa.getCount() != NumConstant.ZERO) { BigDecimal count = new BigDecimal(sa.getCount()); BigDecimal sum = new BigDecimal(sa.getSum()); - entity.setOverdueProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); } })); } @@ -132,19 +129,20 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService Map agencyHandleCount = factOriginProjectLogDailyService.getProjectHandledAgency(customerId,dimId.getMonthId(),"month"); Map responseMap = factOriginProjectLogDailyService.getAgencyResponseRatio(customerId,dimId.getMonthId(),"month"); list.forEach(entity ->{ - entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId())); + entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId()) == null? NumConstant.ZERO : agencyHandleCount.get(entity.getAgencyId())); BigDecimal element = entity.getClosedProjectRatio(); - //办结率 - entity.setClosedProjectRatio( - element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP) - ); + if (entity.getTransferedCount() != NumConstant.ZERO) { + //办结率 + entity.setClosedProjectRatio( + element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP) + ); + } //响应度 - entity.setRespProjectRatio(responseMap.get(entity.getAgencyId())); }); factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); - factIndexGovrnAblityOrgMonthlyService.insertBatch(list); + factIndexGovrnAblityOrgMonthlyService.saveList(list); //2.党建能力 //获取社区发文数量 @@ -169,7 +167,7 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService })); } factIndexPartyAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY); - factIndexPartyAblityOrgMonthlyService.insertBatch(partyList); + factIndexPartyAblityOrgMonthlyService.saveList(partyList); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollDistrictDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollDistrictDepartmentServiceImpl.java index c5f62d4072..7777b6dfe7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollDistrictDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollDistrictDepartmentServiceImpl.java @@ -1,11 +1,32 @@ package com.epmet.service.evaluationindex.indexcoll.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.OrgTypeConstant; +import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; +import com.epmet.dto.stats.DimDepartmentDTO; +import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; +import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; +import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyService; +import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollDistrictDepartmentService; +import com.epmet.service.stats.DimDepartmentService; +import com.epmet.service.stats.FactArticlePublishedDepartmentDailyService; +import com.epmet.util.DimIdGenerator; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.util.Date; +import java.util.List; +import java.util.stream.Collectors; + /** * @author zhaoqifeng * @dscription @@ -13,6 +34,75 @@ import org.springframework.stereotype.Service; */ @Service @Slf4j -@DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexCollDistrictDepartmentServiceImpl implements IndexCollDistrictDepartmentService { + @Autowired + private DimDepartmentService dimDepartmentService; + @Autowired + private FactIndexGovrnAblityDeptMonthlyService factIndexGovrnAblityDeptMonthlyService; + @Autowired + private FactOriginProjectLogDailyService factOriginProjectLogDailyService; + @Autowired + private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; + @Autowired + private FactOriginProjectMainDailyService factOriginProjectMainDailyService; + @Autowired + private FactArticlePublishedDepartmentDailyService factArticlePublishedDepartmentDailyService; + @Autowired + private FactIndexPartyAblityOrgMonthlyService factIndexPartyAblityOrgMonthlyService; + + @Override + public void saveDepartmentAbility(String customerId, String dateId) { + { + //当前日期前一天 + Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMM)); + //获取日期相关维度 + DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); + //获取区直部门列表 + List departmentList = dimDepartmentService.getDistrictDepByCustomer(customerId); + //区直部门数据初始化 + List list = departmentList.stream().map(department ->{ + FactIndexGovrnAblityDeptMonthlyEntity entity = new FactIndexGovrnAblityDeptMonthlyEntity(); + entity.setCustomerId(customerId); + entity.setAgencyId(department.getAgencyId()); + entity.setDeptId(department.getId()); + entity.setYearId(dimId.getYearId()); + entity.setQuarterId(dimId.getQuarterId()); + entity.setMonthId(dimId.getMonthId()); + entity.setTransferedCount(NumConstant.ZERO); + entity.setRespProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setClosedProjectRatio(new BigDecimal(NumConstant.ZERO)); + entity.setSatisfactionRatio(new BigDecimal(NumConstant.ZERO)); + entity.setClosedProjectCount(NumConstant.ZERO); + entity.setHandleProjectRatio(new BigDecimal(NumConstant.ZERO)); + return entity; + }).collect(Collectors.toList()); + //1.治理能力 + //被吹哨次数统计 + List transferCount = factOriginProjectLogDailyService.getDepTransferCount(customerId, dimId.getMonthId(), + OrgTypeConstant.DISTRICT); + if (null != transferCount && !transferCount.isEmpty()) { + list.forEach(entity -> transferCount.stream().filter(dto -> dto.getOrgId().equals(entity.getDeptId())).forEach(count -> { + entity.setTransferedCount(count.getCount()); + })); + } + + //区直部门项目响应度 + List responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(customerId, dimId.getMonthId(), + OrgTypeConstant.DISTRICT, "dept"); + if (null != responsiveness && !responsiveness.isEmpty()) { + list.forEach(entity -> responsiveness.stream().filter(dto -> dto.getAgencyId().equals(entity.getDeptId())).forEach(response -> { + if (response.getCount() != NumConstant.ZERO) { + BigDecimal count = new BigDecimal(response.getCount()); + BigDecimal sum = new BigDecimal(response.getSum()); + entity.setRespProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + } + })); + } + + //TODO 区直部门办结项目满意度 暂时无法统计 + + factIndexGovrnAblityDeptMonthlyService.deleteByCustomer(customerId, dimId.getMonthId()); + factIndexGovrnAblityDeptMonthlyService.insertBatch(list); + } + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java index 00f4d71ce6..3931f8d344 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/IndexCollStreetServiceImpl.java @@ -1,11 +1,8 @@ package com.epmet.service.evaluationindex.indexcoll.impl; -import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.constant.DataSourceConstant; import com.epmet.constant.OrgTypeConstant; -import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao; import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.stats.DimAgencyDTO; import com.epmet.dto.stats.FactArticlePublishedAgencyDailyDTO; @@ -13,13 +10,13 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthly import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyEntity; import com.epmet.service.evaluationindex.extract.FactOriginProjectLogDailyService; import com.epmet.service.evaluationindex.extract.FactOriginProjectMainDailyService; +import com.epmet.service.evaluationindex.extract.FactOriginProjectOrgPeriodDailyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyService; import com.epmet.service.evaluationindex.indexcoll.IndexCollStreetService; import com.epmet.service.stats.DimAgencyService; import com.epmet.service.stats.FactArticlePublishedAgencyDailyService; import com.epmet.util.DimIdGenerator; -import io.swagger.models.auth.In; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -38,7 +35,6 @@ import java.util.stream.Collectors; */ @Service @Slf4j -@DataSource(DataSourceConstant.EVALUATION_INDEX) public class IndexCollStreetServiceImpl implements IndexCollStreetService { @Autowired private DimAgencyService dimAgencyService; @@ -47,7 +43,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { @Autowired private FactOriginProjectLogDailyService factOriginProjectLogDailyService; @Autowired - private FactOriginProjectOrgPeriodDailyDao factOriginProjectOrgPeriodDailyDao; + private FactOriginProjectOrgPeriodDailyService factOriginProjectOrgPeriodDailyService; @Autowired private FactOriginProjectMainDailyService factOriginProjectMainDailyService; @Autowired @@ -58,7 +54,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { @Override public void saveStreetAbility(String customerId, String dateId) { //当前日期前一天 - Date date = DateUtils.getBeforeDay(DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMMDD)); + Date date = DateUtils.stringToDate(dateId, DateUtils.DATE_PATTERN_YYYYMM); //获取日期相关维度 DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); //获取社区列表 @@ -96,7 +92,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { } //社区项目响应度 - List responsiveness = factOriginProjectOrgPeriodDailyDao.selectResponsiveness(customerId, dimId.getMonthId(), + List responsiveness = factOriginProjectOrgPeriodDailyService.getResponsiveness(customerId, dimId.getMonthId(), OrgTypeConstant.STREET, OrgTypeConstant.AGENCY); if (null != responsiveness && !responsiveness.isEmpty()) { list.forEach(entity -> responsiveness.stream().filter(dto -> dto.getAgencyId().equals(entity.getAgencyId())).forEach(response -> { @@ -115,7 +111,7 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { if (sa.getCount() != NumConstant.ZERO) { BigDecimal count = new BigDecimal(sa.getCount()); BigDecimal sum = new BigDecimal(sa.getSum()); - entity.setOverdueProjectRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setSatisfactionRatio(sum.divide(count, NumConstant.SIX, RoundingMode.HALF_UP)); } })); } @@ -123,18 +119,19 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { Map agencyHandleCount = factOriginProjectLogDailyService.getProjectHandledAgency(customerId,dimId.getMonthId(),"month"); Map responseMap = factOriginProjectLogDailyService.getAgencyResponseRatio(customerId,dimId.getMonthId(),"month"); list.forEach(entity ->{ - entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId())); + entity.setClosedProjectCount(agencyHandleCount.get(entity.getAgencyId()) == null? NumConstant.ZERO : agencyHandleCount.get(entity.getAgencyId())); BigDecimal element = entity.getClosedProjectRatio(); - //办结率 - entity.setClosedProjectRatio( - element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP) - ); + if (entity.getTransferedCount() != NumConstant.ZERO) { + //办结率 + entity.setClosedProjectRatio( + element.divide(new BigDecimal(entity.getTransferedCount()), NumConstant.SIX, RoundingMode.HALF_UP) + ); + } //响应度 - entity.setRespProjectRatio(responseMap.get(entity.getAgencyId())); }); factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); - factIndexGovrnAblityOrgMonthlyService.insertBatch(list); + factIndexGovrnAblityOrgMonthlyService.saveList(list); //2.党建能力 @@ -159,6 +156,6 @@ public class IndexCollStreetServiceImpl implements IndexCollStreetService { })); } factIndexPartyAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.STREET); - factIndexPartyAblityOrgMonthlyService.insertBatch(partyList); + factIndexPartyAblityOrgMonthlyService.saveList(partyList); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java index 767d5b8ffe..c1d5478153 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DimDepartmentService.java @@ -110,4 +110,14 @@ public interface DimDepartmentService extends BaseService { DimDepartmentEntity getLatestCreatedDimEntity(); DimDepartmentEntity getLatestUpdatedDimEntity(); + + /** + * 获取区直部门列表 + * @author zhaoqifeng + * @date 2020/9/21 14:50 + * @param customerId + * @return java.util.List + */ + List getDistrictDepByCustomer(String customerId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java index 40ae1d8002..28baf7be81 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactArticlePublishedDepartmentDailyService.java @@ -18,9 +18,11 @@ package com.epmet.service.stats; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.dto.stats.FactArticlePublishedDepartmentDailyDTO; import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; import java.util.Collection; +import java.util.List; /** * 文章发布数量【部门】日统计表 @@ -41,4 +43,14 @@ public interface FactArticlePublishedDepartmentDailyService extends BaseService< */ boolean deleteAndInsertBatch(String customerId, String dateId, Collection values); + /** + * 获取区直部门文章数量 + * @author zhaoqifeng + * @date 2020/9/20 22:49 + * @param customerId + * @param monthId + * @return java.util.List + */ + List getDeptCount(String customerId, String monthId); + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java index bbc261910c..5b05345a16 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimDepartmentServiceImpl.java @@ -158,4 +158,9 @@ public class DimDepartmentServiceImpl extends BaseServiceImpl getDistrictDepByCustomer(String customerId) { + return baseDao.getDistrictDepByCustomer(customerId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java index b21b0bb942..0630970f56 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactArticlePublishedDepartmentDailyServiceImpl.java @@ -21,6 +21,7 @@ import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.stats.FactArticlePublishedDepartmentDailyDao; +import com.epmet.dto.stats.FactArticlePublishedDepartmentDailyDTO; import com.epmet.entity.stats.FactArticlePublishedDepartmentDailyEntity; import com.epmet.service.stats.FactArticlePublishedDepartmentDailyService; import lombok.extern.slf4j.Slf4j; @@ -28,6 +29,7 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; import java.util.Collection; +import java.util.List; /** * 文章发布数量【部门】日统计表 @@ -51,4 +53,9 @@ public class FactArticlePublishedDepartmentDailyServiceImpl extends BaseServiceI this.insertBatch(values, 100); return true; } + + @Override + public List getDeptCount(String customerId, String monthId) { + return baseDao.selectDeptCount(customerId, monthId); + } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java index 786ec50233..a44f86d436 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/BatchScoreCalculator.java @@ -79,7 +79,7 @@ public class BatchScoreCalculator { result.setDetails(new ArrayList<>()); scoreCountOfSamples.put(sampleId, result); } - IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), normalizeValue, idx.getWeight()); + IndexScoreVo sampleScore = new IndexScoreVo(idx.getIndexId(), idx.getAllParentIndexCode(), String.valueOf(vo.getSampleValue()), normalizeValue, idx.getWeight()); result.getDetails().add(sampleScore); result.setTotalScore(result.getTotalScore().add(score).setScale(6, RoundingMode.HALF_UP)); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java index dd971eadc3..ab5a14088e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/support/normalizing/batch/IndexScoreVo.java @@ -22,6 +22,10 @@ public class IndexScoreVo implements Serializable { * 所有指标code拼接的字符串 冒号隔开 */ private String allParentIndexCode; + /** + * 参与计算的原始值 + */ + private String originValue; /** * 分值 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml index bf502d1af2..c5b8f718fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectOrgPeriodDailyDao.xml @@ -48,7 +48,7 @@ SELECT f.CUSTOMER_ID, f.ORG_ID AS "agencyId", - SUM( PERIOD_TILL_REPLY_FIRSTLY ) AS "sum", + SUM( TOTAL_PERIOD ) AS "sum", COUNT( f.ID ) AS "count" FROM fact_origin_project_org_period_daily f @@ -57,7 +57,7 @@ WHERE f.ORG_TYPE = #{orgType} AND DATE_FORMAT(INFORMED_DATE, '%Y%m') = #{monthId} - AND PERIOD_TILL_REPLY_FIRSTLY != 0 + AND TOTAL_PERIOD != 0 AND f.CUSTOMER_ID = #{customerId} GROUP BY f.CUSTOMER_ID, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml index 37b2450690..42e77b47a2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml @@ -5,7 +5,7 @@ - INSERT INTO fact_index_agency_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, + INSERT INTO fact_index_agency_sub_score (ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, DATA_TYPE, ORIGIN_VALUE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES @@ -18,6 +18,7 @@ #{item.quarterId}, #{item.monthId}, #{item.dataType}, + #{item.originValue}, #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml index bdf1146ae7..6a3b2da17f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml @@ -5,7 +5,7 @@ - INSERT INTO fact_index_community_sub_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, + INSERT INTO fact_index_community_sub_score ( ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, ORIGIN_VALUE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE, WEIGHT,DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME ) VALUES @@ -17,6 +17,7 @@ #{item.yearId}, #{item.quarterId}, #{item.monthId}, + #{item.originValue}, #{item.score}, #{item.indexCode}, #{item.allParentIndexCode}, diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml index 848323447a..ac0154854f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcSubScoreDao.xml @@ -14,24 +14,9 @@ - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml index 5050847753..aeef594371 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedAgencyDailyDao.xml @@ -31,7 +31,8 @@ MAX(f.ARTICLE_TOTAL_COUNT) AS "articleTotalCount" FROM fact_article_published_agency_daily f - INNER JOIN dim_agency da ON da.CUSTOMER_ID = #{customerId} + INNER JOIN dim_agency da ON f.AGENCY_ID = da.ID + AND da.CUSTOMER_ID = #{customerId} AND da.`LEVEL` = #{level} WHERE f.MONTH_ID = #{monthId} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml index abe5fafc0a..421a90c31b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactArticlePublishedDepartmentDailyDao.xml @@ -25,6 +25,19 @@ DELETE FROM fact_article_published_department_daily WHERE CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DATE_ID = #{dateId,jdbcType=VARCHAR} + \ No newline at end of file