+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.service.evaluationindex.screen.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.constant.OrgTypeConstant;
+import com.epmet.dao.evaluationindex.screen.ScreenGovernRankDataDailyDao;
+import com.epmet.dto.screen.ScreenGovernRankDataDailyDTO;
+import com.epmet.entity.evaluationindex.screen.ScreenGovernRankDataDailyEntity;
+import com.epmet.entity.evaluationindex.screen.ScreenGovernRankDataEntity;
+import com.epmet.service.evaluationindex.screen.ScreenGovernRankDataDailyService;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 基层治理-治理能力排行数据(按月统计)
+ *
+ * @author generator generator@elink-cn.com
+ * @since v1.0.0 2021-05-24
+ */
+@Service
+@Slf4j
+@DataSource(DataSourceConstant.EVALUATION_INDEX)
+public class ScreenGovernRankDataDailyServiceImpl extends BaseServiceImpl implements ScreenGovernRankDataDailyService {
+
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, ScreenGovernRankDataDailyDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, ScreenGovernRankDataDailyDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public ScreenGovernRankDataDailyDTO get(String id) {
+ ScreenGovernRankDataDailyEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, ScreenGovernRankDataDailyDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(ScreenGovernRankDataDailyDTO dto) {
+ ScreenGovernRankDataDailyEntity entity = ConvertUtils.sourceToTarget(dto, ScreenGovernRankDataDailyEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(ScreenGovernRankDataDailyDTO dto) {
+ ScreenGovernRankDataDailyEntity entity = ConvertUtils.sourceToTarget(dto, ScreenGovernRankDataDailyEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ /**
+ * 构造screen_govern_rank_data 初始数据,先赋值为0
+ *
+ * @param customerId
+ * @param orgType
+ * @param agencyLevel
+ * @return java.util.List
+ * @author zhaoqifeng
+ * @date 2020/9/24 14:41
+ */
+ @Override
+ public List initList(String customerId, String orgType, String agencyLevel) {
+ List list = new ArrayList<>();
+ switch (orgType) {
+ case OrgTypeConstant.AGENCY:
+ log.info("组织级别统计");
+ list = baseDao.initAgencyDataList(customerId, agencyLevel);
+ break;
+ case OrgTypeConstant.GRID:
+ log.info("网格级别统计");
+ list = baseDao.initGridDataList(customerId);
+ break;
+ default:
+ log.info("部门级别统计");
+ break;
+ }
+ return list;
+ }
+
+ /**
+ * 保存抽取结果
+ *
+ * @param customerId
+ * @param orgType
+ * @param dateId
+ * @param deleteSize
+ * @param entityList
+ * @return void
+ * @author zhaoqifeng
+ * @date 2020/9/25 10:32
+ */
+ @Override
+ public void delAndSaveRankData(String customerId, String orgType, String dateId, Integer deleteSize,
+ List entityList) {
+ if (CollectionUtils.isEmpty(entityList)) {
+ return;
+ }
+ List orgIds = new ArrayList<>();
+ for (ScreenGovernRankDataDailyEntity entity : entityList) {
+ orgIds.add(entity.getOrgId());
+ }
+ int deleteNum;
+ do {
+ deleteNum = baseDao.deleteRankData(customerId, orgType, dateId, deleteSize, orgIds);
+ } while (deleteNum != NumConstant.ZERO);
+
+ insertBatch(entityList);
+ }
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
index 56a99d5257..36c3ebd05b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectService.java
@@ -23,6 +23,7 @@ import com.epmet.dto.ProjectDTO;
import com.epmet.dto.project.ProjectAgencyDTO;
import com.epmet.dto.project.ProjectGridDTO;
import com.epmet.dto.project.result.ProjectExceedParamsResultDTO;
+import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.project.ProjectEntity;
import org.apache.ibatis.annotations.Param;
@@ -152,4 +153,13 @@ public interface ProjectService extends BaseService {
*/
List getProjectCategoryData(String customerId, String dateId);
+ /**
+ * 获取项目满意度
+ * @author zhaoqifeng
+ * @date 2021/5/21 10:04
+ * @param customerId
+ * @return java.util.List
+ */
+ List getProjectSatisfaction(String customerId);
+
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
index d2a3ff001d..3581f920b1 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectServiceImpl.java
@@ -26,17 +26,16 @@ import com.epmet.dto.ProjectDTO;
import com.epmet.dto.project.ProjectAgencyDTO;
import com.epmet.dto.project.ProjectCategoryDTO;
import com.epmet.dto.project.ProjectGridDTO;
+import com.epmet.dto.project.ProjectPointDTO;
import com.epmet.dto.project.result.ProjectExceedParamsResultDTO;
+import com.epmet.entity.evaluationindex.extract.FactOriginProjectMainDailyEntity;
import com.epmet.entity.project.ProjectEntity;
import com.epmet.service.project.ProjectService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
import java.util.stream.Collectors;
/**
@@ -163,5 +162,39 @@ public class ProjectServiceImpl extends BaseServiceImpl
+ * @author zhaoqifeng
+ * @date 2021/5/21 10:04
+ */
+ @Override
+ public List getProjectSatisfaction(String customerId) {
+ List list = baseDao.selectProjectSatisfaction(customerId);
+ if (org.apache.commons.collections4.CollectionUtils.isEmpty(list)) {
+ return Collections.emptyList();
+ }
+ //获取项目满意指标
+ String value = baseDao.selectValueByKey(customerId, "satisfaction");
+ if (null == value) {
+ //客户没有自定义配置的话取默认配置
+ value = baseDao.selectValueByKey("default", "satisfaction");
+ }
+
+ String finalValue = value;
+ return list.stream().map(item -> {
+ FactOriginProjectMainDailyEntity entity = new FactOriginProjectMainDailyEntity();
+ entity.setId(item.getProjectId());
+ if (item.getPoint() < Integer.parseInt(finalValue)) {
+ entity.setIsSatisfied(NumConstant.ZERO);
+ } else {
+ entity.setIsSatisfied(NumConstant.ONE);
+ }
+ return entity;
+ }).collect(Collectors.toList());
+ }
+
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml
index 7b2a4f9ae7..4d913d3edf 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml
@@ -362,33 +362,22 @@
+
+ SELECT
+ a.GRID_ID AS "orgId",
+ a.count AS "sum",
+ IFNULL(b.count,0) AS "count"
+ FROM
+ (SELECT
+ fm.GRID_ID,
+ COUNT( fm.ID ) AS "count"
+ FROM
+ fact_origin_project_main_daily fm
+ WHERE
+ fm.PROJECT_STATUS = 'close'
+ AND fm.GRID_ID != ''
+ AND fm.CUSTOMER_ID = #{customerId}
+ AND fm.DATE_ID <= #{dateId}
+ GROUP BY
+ fm.GRID_ID) a
+ LEFT JOIN
+ (SELECT
+ fm.GRID_ID,
+ COUNT( fm.ID ) AS "count"
+ FROM
+ fact_origin_project_main_daily fm
+ WHERE
+ fm.PROJECT_STATUS = 'close'
+ AND fm.GRID_ID != ''
+ AND fm.CUSTOMER_ID = #{customerId}
+ AND fm.DATE_ID <= #{dateId}
+ AND fm.IS_RESOLVED = 'resolved'
+ GROUP BY
+ fm.GRID_ID) b
+ ON a.GRID_ID = b.GRID_ID
+
+
+ SELECT
+ a.AGENCY_ID,
+ a.count AS "sum",
+ IFNULL(b.count,0) AS "count"
+ FROM
+ (SELECT
+ fm.AGENCY_ID,
+ COUNT( fm.ID ) AS "count"
+ FROM
+ fact_origin_project_main_daily fm
+ INNER JOIN dim_agency da ON fm.AGENCY_ID = da.ID
+ AND da.`LEVEL` = #{level}
+ WHERE
+ fm.PROJECT_STATUS = 'closed'
+ AND fm.CUSTOMER_ID = #{customerId}
+ AND fm.DATE_ID <= #{dateId}
+ GROUP BY
+ fm.AGENCY_ID) a
+ LEFT JOIN
+ (SELECT
+ fm.AGENCY_ID,
+ COUNT( fm.ID ) AS "count"
+ FROM
+ fact_origin_project_main_daily fm
+ INNER JOIN dim_agency da ON fm.AGENCY_ID = da.ID
+ AND da.`LEVEL` = #{level}
+ WHERE
+ fm.PROJECT_STATUS = 'closed'
+ AND fm.CUSTOMER_ID = #{customerId}
+ AND fm.DATE_ID <= #{dateId}
+ AND fm.FINISH_ORG_IDS LIKE CONCAT('%', fm.AGENCY_ID,'%')
+ GROUP BY
+ fm.AGENCY_ID) b
+ ON a.AGENCY_ID = b.AGENCY_ID
+
+
+ SELECT
+ a.AGENCY_ID,
+ a.count AS "sum",
+ IFNULL(b.count,0) AS "count"
+ FROM
+ (SELECT
+ fm.AGENCY_ID,
+ COUNT( fm.ID ) AS "count"
+ FROM
+ fact_origin_project_main_daily fm
+ INNER JOIN dim_agency da ON fm.AGENCY_ID = da.ID
+ AND da.`LEVEL` = #{level}
+ WHERE
+ fm.PROJECT_STATUS = 'close'
+ AND fm.CUSTOMER_ID = #{customerId}
+ AND fm.DATE_ID <= #{dateId}
+ GROUP BY
+ fm.AGENCY_ID) a
+ LEFT JOIN
+ (SELECT
+ fm.AGENCY_ID,
+ COUNT( fm.ID ) AS "count"
+ FROM
+ fact_origin_project_main_daily fm
+ INNER JOIN dim_agency da ON fm.AGENCY_ID = da.ID
+ AND da.`LEVEL` = #{level}
+ WHERE
+ fm.PROJECT_STATUS = 'close'
+ AND fm.CUSTOMER_ID = #{customerId}
+ AND fm.DATE_ID <= #{dateId}
+ AND fm.IS_RESOLVED = 'resolved'
+ GROUP BY
+ fm.AGENCY_ID) b
+ ON a.AGENCY_ID = b.AGENCY_ID
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml
index 755e3aab60..1285067483 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityGridMonthlyDao.xml
@@ -256,6 +256,21 @@
CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
+
+ SELECT
+ GRID_ID,
+ MONTH_ID,
+ YEAR_ID,
+ PROJECT_TOTAL,
+ SELF_SOLVE_PROJECT_COUNT,
+ RESOLVE_PROJECT_COUNT,
+ SATISFACTION_RATIO
+ FROM
+ fact_index_govrn_ablity_grid_monthly
+ WHERE
+ CUSTOMER_ID = #{customerId}
+ AND DATE_ID <= #{dateId}
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml
new file mode 100644
index 0000000000..eec63e765b
--- /dev/null
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenGovernRankDataDailyDao.xml
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ delete from screen_govern_rank_data
+ where CUSTOMER_ID = #{customerId}
+ AND DATE_ID <= #{dateId}
+
+ and ORG_TYPE=#{orgType}
+
+
+ and
+ (
+
+ ORG_ID = #{orgId}
+
+ )
+
+ limit #{deleteSize}
+
+
+
+ SELECT DISTINCT
+ CUSTOMER_ID,
+ 'agency' AS ORG_TYPE,
+ AGENCY_ID AS ORG_ID,
+ PID AS PARENT_ID,
+ AGENCY_NAME AS ORG_NAME,
+ 0 AS RESPONSE_RATIO,
+ 0 AS RESOLVED_RATIO,
+ 0 AS GOVERN_RATIO,
+ 0 AS SATISFACTION_RATIO
+ FROM
+ screen_customer_agency
+ WHERE
+ CUSTOMER_ID = #{customerId}
+ AND `LEVEL` = #{level}
+
+
+ SELECT DISTINCT
+ CUSTOMER_ID,
+ 'grid' AS ORG_TYPE,
+ GRID_ID AS ORG_ID,
+ PARENT_AGENCY_ID AS PARENT_ID,
+ GRID_NAME AS ORG_NAME,
+ 0 AS RESPONSE_RATIO,
+ 0 AS RESOLVED_RATIO,
+ 0 AS GOVERN_RATIO,
+ 0 AS SATISFACTION_RATIO
+ FROM
+ screen_customer_grid
+ WHERE
+ CUSTOMER_ID = #{customerId}
+
+
+
+
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
index 58dd19a9e5..3c5ebd884f 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/project/ProjectDao.xml
@@ -145,4 +145,21 @@
AND DATE_FORMAT(CREATED_TIME,'%Y%m%d')=#{dateId}
+
+ SELECT
+ PROJECT_ID,
+ ( PERFECT_COUNT * 100 + (SHOULD_EVALUATE_COUNT-PERFECT_COUNT-BAD_COUNT) * 80 + BAD_COUNT * 60 ) DIV SHOULD_EVALUATE_COUNT AS point
+ FROM
+ project_satisfaction_statistics
+ WHERE CUSTOMER_ID = #{customerId}
+
+
+ select
+ PARAMETER_VALUE
+ from
+ customer_project_parameter
+ where DEL_FLAG = '0'
+ and CUSTOMER_ID = #{customerId}
+ and PARAMETER_KEY = #{parameterKey}
+
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml
index 209d13e228..821ca24983 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridMonthlyDao.xml
@@ -131,6 +131,17 @@
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
+
+ SELECT
+ GRID_ID,
+ PARTYMEMBER_TOTAL
+ FROM
+ fact_reg_user_grid_daily
+ WHERE
+ DEL_FLAG = '0'
+ AND CUSTOMER_ID = #{customerId}
+ AND DATE_ID <= #{dateId}
+
\ No newline at end of file