Browse Source

项目-数据-机关日统计逻辑完善

master
sunyuchao 4 years ago
parent
commit
d17e6183de
  1. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java
  2. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  3. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java
  4. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java
  5. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  6. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  7. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  8. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml
  9. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java

@ -188,4 +188,11 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
List<IssueDTO> getIssueTotalList(@Param("customerId") String customerId, @Param("date") String date);
/**
* @Author sun
* @Description 查询议题库已删除网格下可能存在的项目Id集合
**/
List<String> selectProjectByGrids(@Param("gridIds") List<String> gridIds);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -89,4 +89,10 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
List<CustomerStaffGridDTO> getCustomerStaffGridList(@Param("customerId") String customerId);
List<String> getDelGridList(@Param("customerId") String customerId);
/**
* @Author sun
* @Description 查询客户已删除网格列表
**/
List<String> selectDelGridList(@Param("customerId") String customerId);
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java

@ -204,4 +204,10 @@ public interface IssueService {
* @return java.util.List<com.epmet.dto.issue.IssueDTO>
*/
List<IssueDTO> getIssueIncrList(String customerId, String date);
/**
* @Author sun
* @Description 查询议题库已删除网格下可能存在的项目Id集合
**/
List<String> getProjectByGrids(List<String> gridIds);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java

@ -197,4 +197,14 @@ public class IssueServiceImpl implements IssueService {
public List<IssueDTO> getIssueIncrList(String customerId, String date) {
return null;
}
/**
* @Author sun
* @Description 查询议题库已删除网格下可能存在的项目Id集合
**/
@Override
public List<String> getProjectByGrids(List<String> gridIds) {
return statsIssueDao.selectProjectByGrids(gridIds);
}
}

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.entity.project.ProjectProcessEntity;
import com.epmet.entity.stats.*;
import com.epmet.service.Issue.IssueService;
import com.epmet.service.StatsProjectService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.project.ProjectProcessService;
import com.epmet.service.project.ProjectService;
import com.epmet.service.stats.*;
@ -29,6 +30,7 @@ import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
* 数据统计-项目独立于任何具体数据源外层的service
@ -59,6 +61,8 @@ public class StatsProjectServiceImpl implements StatsProjectService {
private FactGridProjectDailyService factGridProjectDailyService;
@Autowired
private FactGridProjectMonthlyService factGridProjectMonthlyService;
@Autowired
private CustomerGridService customerGridService;
/**
* @Author sun
@ -123,6 +127,31 @@ public class StatsProjectServiceImpl implements StatsProjectService {
log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId);
List<ProjectProcessEntity> processList = projectProcessService.getProcessList(projectEntity);
//20210721 sun 业务逻辑调整,网格删除,组织没有删除情况,相应的组织层级数据统计应舍弃以删除网格数据 start
//处理逻辑:查询已删除网格下项目Id,将已查询的项目、节点数据中的脏数据剔除【项目库有张表有网格Id,可以查出每个项目所属网格,但是关联该表后sql查询效率极低固舍弃此方案】
//4-1.查询客户下已删除网格列表下存在的项目Id集合
List<String> list = customerGridService.getdelGridProjectIdList(customerId);
if (list.size() > NumConstant.ZERO) {
Map<String, String> map = list.stream().collect(Collectors.toMap(String::toString, v -> v, (c1, c2) -> c1));
//4-2.遍历删除项目主表查询的无效数据
Iterator<ProjectEntity> proiter = projectList.iterator();
while (proiter.hasNext()) {
ProjectEntity next = proiter.next();
if (map.containsKey(next.getId())) {
proiter.remove();
}
}
//4-3.遍历删除项目节点表查询的无效数据
Iterator<ProjectProcessEntity> iterator = processList.iterator();
while (iterator.hasNext()) {
ProjectProcessEntity next = iterator.next();
if (map.containsKey(next.getProjectId())) {
iterator.remove();
}
}
}
//20210721 sun end
//5:机关层级日月统计
if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) {
//5.1:执行机关日数据统计

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java

@ -70,4 +70,11 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @return java.util.List<java.lang.String>
*/
List<String> getDelGridList(String customerId);
/**
* @Author sun
* @Description 查询客户下已删除网格列表下存在的项目Id集合
**/
List<String> getdelGridProjectIdList(String customerId);
}

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.org.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.org.CustomerGridDao;
import com.epmet.dto.group.AgencyDTO;
@ -10,10 +11,12 @@ import com.epmet.dto.group.result.GridIdListByCustomerResultDTO;
import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.Issue.IssueService;
import com.epmet.service.org.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -23,6 +26,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Autowired
private CustomerGridDao customerGridDao;
@Autowired
private IssueService issueService;
@Override
public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) {
@ -92,4 +97,22 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public List<String> getDelGridList(String customerId) {
return null;
}
/**
* @Author sun
* @Description 查询客户下已删除网格列表下存在的项目Id集合
**/
@Override
public List<String> getdelGridProjectIdList(String customerId) {
List<String> resultList = new ArrayList<>();
//1.查询客户已删除网格列表
List<String> gridIds = customerGridDao.selectDelGridList(customerId);
if (gridIds.size() < NumConstant.ONE) {
return resultList;
}
//2.查询议题库已删除网格下可能存在的项目Id集合
resultList = issueService.getProjectByGrids(gridIds);
return resultList;
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml

@ -327,4 +327,17 @@
GROUP BY
ORG_ID, ISSUE_STATUS
</select>
<select id="selectProjectByGrids" resultType="java.lang.String">
SELECT DISTINCT
ipr.project_id
FROM
issue_project_relation ipr
INNER JOIN issue i ON ipr.issue_id = i.id
WHERE 1=1
<foreach collection="gridIds" item="id" open="AND (" separator=" OR " close=")">
i.grid_id = #{id}
</foreach>
</select>
</mapper>

11
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -115,4 +115,15 @@
DEL_FLAG = '1'
and customer_id = #{customerId}
</select>
<select id="selectDelGridList" resultType="java.lang.String">
SELECT
id
FROM
customer_grid
WHERE
del_flag != '0'
AND customer_id = #{customerId}
</select>
</mapper>
Loading…
Cancel
Save