+ * 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.dto.extract.result;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * 网格项目main表数据
+ */
+@Data
+public class GridProjectToProjectMainDTO implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 项目ID
+ */
+ private String projectId;
+ /**
+ * 项目的发布日期yyyyMMdd
+ */
+ private String dateId;
+ /**
+ * 网格ID
+ */
+ private String gridId;
+ /**
+ * 状态
+ */
+ private String projectStatus;
+ /**
+ * resolved unresolved
+ * */
+ private String isResolved;
+
+
+}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java
index 87409a6607..61e8057193 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactAgencyProjectDailyDao.java
@@ -18,8 +18,10 @@
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
+import com.epmet.dto.extract.result.GridProjectToProjectMainDTO;
import com.epmet.dto.project.form.MonthProjectListFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity;
+import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.stats.FactAgencyProjectDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@@ -60,4 +62,10 @@ public interface FactAgencyProjectDailyDao extends BaseDao selectProjectCountByOrgLevel(@Param("orgLevel") String orgLevel, @Param("customerId") String customerId, @Param("dateId")String dateId );
+ /**
+ * @Author sun
+ * @Description 查询客户项目main表里是网格项目的数据
+ **/
+ List getGridProjectToProjectMain(ProjectEntity projectEntity);
+
}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
index 852fb8c47d..1891c55e7d 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
@@ -5,12 +5,11 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.PingYinConstant;
import com.epmet.constant.ProjectConstant;
-import com.epmet.dto.ProjectDTO;
import com.epmet.dto.StatsFormDTO;
+import com.epmet.dto.extract.result.GridProjectToProjectMainDTO;
import com.epmet.dto.project.form.MonthProjectListFormDTO;
import com.epmet.dto.stats.DimAgencyDTO;
import com.epmet.dto.stats.DimGridDTO;
-import com.epmet.entity.issue.IssueEntity;
import com.epmet.entity.org.CustomerAgencyEntity;
import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.project.ProjectProcessEntity;
@@ -677,26 +676,16 @@ public class StatsProjectServiceImpl implements StatsProjectService {
}
//2022.3.3 end sun
- //3:根据客户Id查询项目业务表已结案数据(查询传入日期及之前的数据)
- ProjectEntity projectEntity = new ProjectEntity();
- projectEntity.setCustomerId(customerId);
- projectEntity.setCreatedTime(date);
- projectEntity.setStatus(ProjectConstant.CLOSED);
- List projectList = projectService.getProjectList(projectEntity);
-
- //4:查询项目处理进展表中有效数据(创建日期截取yyyy-mm-dd格式字段值)(查询传入日期及之前的数据)
- List processList = projectProcessService.getProcessList(projectEntity);
-
- //5:网格层级日月统计
+ //3:网格层级日月统计
if (null != dimGridList && dimGridList.size() > NumConstant.ZERO) {
- //5.1:执行网格日数据统计
+ //3-1:执行网格日数据统计
try {
- gridDateProjectStats(customerId, dimId, date, dimGridList, projectList, processList);
+ gridDateProjectStats(customerId, dimId, date, dimGridList);
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridDateProjectStats", customerId, dimId.getDateId()), e);
}
- //5.2:执行网格月数据统计
+ //3-2:执行网格月数据统计
try {
gridMonthProjectStats(customerId, dimId, dimGridList);
} catch (Exception e) {
@@ -712,22 +701,44 @@ public class StatsProjectServiceImpl implements StatsProjectService {
* @Author sun
* @Description 数据-项目-网格日统计
**/
- private String gridDateProjectStats(String customerId, DimIdGenerator.DimIdBean dimId, Date date, List dimGridList, List projectList, List processList) {
+ private String gridDateProjectStats(String customerId, DimIdGenerator.DimIdBean dimId, Date date, List dimGridList) {
//批量网格日统计新增对象
List gridDateEntityList = new ArrayList<>();
//计算百分比使用,保留小数点后两位
NumberFormat numberFormat = NumberFormat.getInstance();
numberFormat.setMaximumFractionDigits(6);
- //1:根据客户Id查询议题库已转项目的网格项目关系数据
+ /*//1:根据客户Id查询议题库已转项目的网格项目关系数据
IssueEntity issueEntity = new IssueEntity();
issueEntity.setCustomerId(customerId);
issueEntity.setCreatedTime(date);
- List gridProjectList = issueService.getGridProjectList(issueEntity);
+ List gridProjectList = issueService.getGridProjectList(issueEntity);*/
- //2:遍历网格维度数据,统计每个网格各项指标数据
+ ProjectEntity projectEntity = new ProjectEntity();
+ projectEntity.setCustomerId(customerId);
+ projectEntity.setCreatedTime(date);
+ //2022.3.11 网格项目数据原先查的是来源议题的项目,现在网格的项目有来源议题、事件上报给网格、网格员在网格内上报事件,所以网格的项目统计改查询项目的main表中网格项目数据
+ //1.查询客户项目main表里是网格项目的数据
+ List gridProjectList = factAgencyProjectDailyService.getGridProjectToProjectMain(projectEntity);
+
+ //2.筛选出已结案项目,用于后续统计结案项目的已解决未解决数
+ List projectList = new ArrayList<>();
+ ProjectEntity entity = null;
+ for (GridProjectToProjectMainDTO gp : gridProjectList){
+ if(ProjectConstant.CLOSED.equals(gp.getProjectStatus())){
+ entity = new ProjectEntity();
+ entity.setId(gp.getProjectId() );
+ entity.setClosedStatus(gp.getProjectStatus());
+ projectList.add(entity);
+ }
+ }
+
+ //3.查询客户下项目节点表数据,用于统计不同状态项目数、日增量数
+ List processList = projectProcessService.getProcessList(projectEntity);
+
+ //4:遍历网格维度数据,统计每个网格各项指标数据
for (DimGridEntity grid : dimGridList) {
- //2.1:存放网格下的项目Id
+ //4-1:存放网格下的项目Id
Map map = new HashMap<>();
gridProjectList.forEach(gridProject -> {
if (grid.getId().equals(gridProject.getGridId())) {
@@ -748,7 +759,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
Map closeMap = new HashMap<>();
//存放前一日已结案项目Id,用于统计日增量中已结案项目的已解决、未解决数量
Map closeDateMap = new HashMap<>();
- //2.2:遍历进展数据,统计截止当日的项目总量、处理中总量、已结案总量以及日增量中的项目总量、处理中总量、已结案总量
+ //4-2:遍历进展数据,统计截止当日的项目总量、处理中总量、已结案总量以及日增量中的项目总量、处理中总量、已结案总量
//截止当日项目总数
projectTotal.addAndGet(map.size());
processList.forEach(process -> {
@@ -771,7 +782,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
}
}
});
- //2.3:遍历项目业务数据,统计截止当日的已结案已解决总量、已结案未解决总量以及日增量中的已结案已解决总量、已结案未解决总量
+ //4-3:遍历项目业务数据,统计截止当日的已结案已解决总量、已结案未解决总量以及日增量中的已结案已解决总量、已结案未解决总量
projectList.forEach(project -> {
//当前机关及下级
if (map.containsKey(project.getId())) {
@@ -798,7 +809,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
}
});
- //2.4:封装日数据对象
+ //4-4:封装日数据对象
FactGridProjectDailyEntity gridDailyEntity = new FactGridProjectDailyEntity();
gridDailyEntity.setCustomerId(customerId);
gridDailyEntity.setAgencyId(grid.getAgencyId());
@@ -830,16 +841,16 @@ public class StatsProjectServiceImpl implements StatsProjectService {
gridDateEntityList.add(gridDailyEntity);
}
- //3:批量新增数据,先删后增
+ //5:批量新增数据,先删后增
if (null != gridDateEntityList && gridDateEntityList.size() > NumConstant.ZERO) {
- //3.1:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据
+ //5-1:根据客户Id、日维度Id批量物理删除一下可能存在的历史数据
FactAgencyProjectDailyEntity delEntity = new FactAgencyProjectDailyEntity();
delEntity.setCustomerId(customerId);
delEntity.setDateId(dimId.getDateId());
log.info("StatsProjectServiceImpl.gridDateProjectStats-根据客户Id、日维度Id批量删除网格项目日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId());
factGridProjectDailyService.delDateProject(delEntity);
- //3.2:批量保存网格日统计数据
+ //5-2:批量保存网格日统计数据
log.info("StatsProjectServiceImpl.gridDateProjectStats-批量新增网格项目日统计表数据,对应客户Id:" + customerId + ",日维度Id:" + dimId.getDateId());
factGridProjectDailyService.insertBatch(gridDateEntityList);
}
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java
index f7df122755..2fc68f316a 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/FactAgencyProjectDailyService.java
@@ -18,7 +18,9 @@
package com.epmet.service.stats;
import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.dto.extract.result.GridProjectToProjectMainDTO;
import com.epmet.dto.project.form.MonthProjectListFormDTO;
+import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.stats.FactAgencyProjectDailyEntity;
import java.util.List;
@@ -44,4 +46,10 @@ public interface FactAgencyProjectDailyService extends BaseService getGridProjectToProjectMain(ProjectEntity projectEntity);
}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java
index ddf18955ec..a80d9f740b 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/FactAgencyProjectDailyServiceImpl.java
@@ -21,7 +21,9 @@ 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.FactAgencyProjectDailyDao;
+import com.epmet.dto.extract.result.GridProjectToProjectMainDTO;
import com.epmet.dto.project.form.MonthProjectListFormDTO;
+import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.stats.FactAgencyProjectDailyEntity;
import com.epmet.service.stats.FactAgencyProjectDailyService;
import org.springframework.stereotype.Service;
@@ -58,4 +60,14 @@ public class FactAgencyProjectDailyServiceImpl extends BaseServiceImpl getGridProjectToProjectMain(ProjectEntity projectEntity) {
+ return baseDao.getGridProjectToProjectMain(projectEntity);
+ }
+
}
\ No newline at end of file
diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml
index b2333a5451..89b2351bd5 100644
--- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml
+++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactAgencyProjectDailyDao.xml
@@ -44,5 +44,22 @@
AND DATE_ID = #{dateId}
+
+
\ No newline at end of file