Browse Source

screenProjectData

dev_shibei_match
wangchao 5 years ago
parent
commit
ae1ce33407
  1. 106
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java
  2. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java
  3. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java
  5. 25
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java
  6. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java
  7. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java
  8. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java
  9. 55
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java
  10. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java
  11. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java
  12. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java
  13. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml
  14. 34
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml

106
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java

@ -0,0 +1,106 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* 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.
* <p>
* 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.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dto.issue;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 议题项目分类字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-12-08
*/
@Data
public class IssueProjectCategoryDictDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id, 产品默认default
*/
private String customerId;
/**
* 上级分类ID 顶级此列存储0
*/
private String pid;
/**
* 所有上级分类ID用逗号分开
*/
private String pids;
/**
* 分类编码分类编码+customer_id唯一
*/
private String categoryCode;
/**
* 分类名称
*/
private String categoryName;
/**
* 分类类别1,2,3,4....
*/
private String categoryType;
/**
* 排序
*/
private Integer sort;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectMainDailyDao.java

@ -287,6 +287,6 @@ public interface FactOriginProjectMainDailyDao extends BaseDao<FactOriginProject
* @author wangc
* @date 2021.03.04 22:56
*/
List<ScreenProjectDataDTO> initNewScreenProjectData(@Param("customerId")String customerId,@Param("dateId") String dateId);
List<ScreenProjectDataDTO> initNewScreenProjectData(@Param("customerId")String customerId,@Param("dateId") String dateId,@Param("dataEndTime")String dataEndTime);
}

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

@ -5,15 +5,13 @@ import com.epmet.dto.extract.result.IssueInfoResultDTO;
import com.epmet.dto.extract.result.IssueProcessInfoResultDTO;
import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO;
import com.epmet.dto.extract.result.SatisfactionInfoResultDTO;
import com.epmet.dto.issue.IssueAgencyDTO;
import com.epmet.dto.issue.IssueDTO;
import com.epmet.dto.issue.IssueGridDTO;
import com.epmet.dto.issue.IssueProjectDTO;
import com.epmet.dto.issue.*;
import com.epmet.entity.issue.IssueEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
@Mapper
public interface StatsIssueDao extends BaseDao<IssueEntity> {
@ -181,4 +179,6 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
* @date 2020/9/27 1:22 下午
*/
List<IssueVoteStatisticalResultDTO> selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<IssueProjectCategoryDictDTO> selectCategory(@Param("customerId") String customerId, @Param("ids") Set<String> set);
}

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

@ -182,5 +182,5 @@ public interface IssueService {
* @author wangc
* @date 2021.03.09 00:23
*/
Map<String,String> getIntegratedProjectCategory(Map<String, Set<String>> param);
Map<String,String> getIntegratedProjectCategory(Map<String, Set<String>> param,String customerId);
}

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

@ -1,22 +1,24 @@
package com.epmet.service.Issue.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.issue.StatsIssueDao;
import com.epmet.dto.extract.result.IssueInfoResultDTO;
import com.epmet.dto.extract.result.IssueProcessInfoResultDTO;
import com.epmet.dto.extract.result.IssueVoteStatisticalResultDTO;
import com.epmet.dto.extract.result.SatisfactionInfoResultDTO;
import com.epmet.dto.issue.IssueAgencyDTO;
import com.epmet.dto.issue.IssueDTO;
import com.epmet.dto.issue.IssueGridDTO;
import com.epmet.dto.issue.IssueProjectDTO;
import com.epmet.dto.issue.*;
import com.epmet.entity.issue.IssueEntity;
import com.epmet.service.Issue.IssueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author zhaoqifeng
@ -143,4 +145,19 @@ public class IssueServiceImpl implements IssueService {
public List<IssueVoteStatisticalResultDTO> selectIssueVoteStatis(String customerId, String dateId) {
return statsIssueDao.selectIssueVoteStatis(customerId, dateId);
}
@Override
public Map<String, String> getIntegratedProjectCategory(Map<String, Set<String>> param,String customerId) {
Map<String, String> map = new HashMap<>();
param.forEach((projectId,categoryIds) -> {
List<IssueProjectCategoryDictDTO> categories = statsIssueDao.selectCategory(customerId, categoryIds);
if(!CollectionUtils.isEmpty(categories)){
StringBuilder str = new StringBuilder();
categories.forEach(category -> {str.append(category.getCategoryName()).append("-");});
map.put(projectId,str.substring(NumConstant.ZERO,str.length() - NumConstant.TWO));
}
});
return map;
}
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java

@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.extract.FactOriginProjectLogDailyDTO;
import com.epmet.dto.extract.result.*;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity;
import java.math.BigDecimal;

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectMainDailyService.java

@ -328,6 +328,7 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
*
* 这是只查询指定天新增的项目对于需要更新状态的项目对历史数据流转中的项目进行遍历查询
* @param customerId
* @param rows
* @param dateId
* @param exceedLimit 超期上线
* @param about2exceedLimit 即将超期参数
@ -335,5 +336,8 @@ public interface FactOriginProjectMainDailyService extends BaseService<FactOrigi
* @author wangc
* @date 2021.03.04 22:56
*/
List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,String dateId,Integer exceedLimit,Integer about2exceedLimit);
List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,Integer rows ,String dateId,Integer exceedLimit,Integer about2exceedLimit);
void computerIfExceed(List<ScreenProjectDataDTO> list,Integer exceedLimit,Integer about2exceedLimit);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.dao.evaluationindex.extract.FactOriginProjectLogDailyDao;
import com.epmet.dao.evaluationindex.extract.FactOriginProjectOrgPeriodDailyDao;
import com.epmet.dto.extract.FactOriginProjectLogDailyDTO;
import com.epmet.dto.extract.result.*;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService;
import org.apache.commons.lang3.StringUtils;

55
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectMainDailyServiceImpl.java

@ -376,6 +376,7 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
*
* 这是只查询指定天新增的项目对于需要更新状态的项目对历史数据流转中的项目进行遍历查询
* @param customerId
* @param rows
* @param dateId
* @param exceedLimit 超期上线
* @param about2exceedLimit 即将超期参数
@ -384,33 +385,41 @@ public class FactOriginProjectMainDailyServiceImpl extends BaseServiceImpl<FactO
* @date 2021.03.04 22:56
*/
@Override
public List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId, String dateId,Integer exceedLimit,Integer about2exceedLimit) {
public List<ScreenProjectDataDTO> initNewScreenProjectData(String customerId,Integer rows , String dateId,Integer exceedLimit,Integer about2exceedLimit) {
boolean ifYesterday = true;
if(!StringUtils.equals(DateUtils.getBeforeNDay(NumConstant.ONE).substring(0,8),dateId)){
if(!StringUtils.equals(DateUtils.getBeforeNDay(NumConstant.ONE),dateId)){
ifYesterday = false;
}
List<ScreenProjectDataDTO> projects = baseDao.initNewScreenProjectData(customerId, dateId);
List<ScreenProjectDataDTO> projects = baseDao.initNewScreenProjectData(customerId, rows == NumConstant.ZERO && ifYesterday ? "" : dateId, dateId);
//如果不是昨天立项
if(!CollectionUtils.isEmpty(projects) && !ifYesterday){
Result<List<CostDayResultDTO>> costDays = epmetCommonServiceOpenFeignClient.costWorkDays(periodDao.selectProjectNodeStartStopTime(projects.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList())));
if(null != costDays && !CollectionUtils.isEmpty(costDays.getData())){
Map<String,List<CostDayResultDTO>> projectPeriodMap
= costDays.getData().stream().collect(Collectors.groupingBy(CostDayResultDTO :: getId));
projects.stream().map(o -> {
List<CostDayResultDTO> days = projectPeriodMap.get(o.getProjectId());
if(!CollectionUtils.isEmpty(days)){
Integer max = days.stream().max(Comparator.comparing(CostDayResultDTO::getDetentionDays)).get().getDetentionDays();
//事件级别 红色1级:已超期;黄色2级:即将超期;绿色3级:未超期
if(max > exceedLimit)
o.setProjectLevel(NumConstant.ONE);
else if(max >= about2exceedLimit)
o.setProjectLevel(NumConstant.TWO);
}
return null;
});
}
}
if(!CollectionUtils.isEmpty(projects) && !ifYesterday)
computerIfExceed(projects,exceedLimit,about2exceedLimit);
return projects;
}
@Override
public void computerIfExceed(List<ScreenProjectDataDTO> list,Integer exceedLimit,Integer about2exceedLimit){
if(CollectionUtils.isEmpty(list)) return;
Result<List<CostDayResultDTO>> costDays = epmetCommonServiceOpenFeignClient.costWorkDays(periodDao.selectProjectNodeStartStopTime(list.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList())));
if(null != costDays && !CollectionUtils.isEmpty(costDays.getData())){
Map<String,List<CostDayResultDTO>> projectPeriodMap
= costDays.getData().stream().collect(Collectors.groupingBy(CostDayResultDTO :: getId));
list.stream().map(o -> {
List<CostDayResultDTO> days = projectPeriodMap.get(o.getProjectId());
if(!CollectionUtils.isEmpty(days)){
Integer max = days.stream().max(Comparator.comparing(CostDayResultDTO::getDetentionDays)).get().getDetentionDays();
//事件级别 红色1级:已超期;黄色2级:即将超期;绿色3级:未超期
if(max > exceedLimit)
o.setProjectLevel(NumConstant.ONE);
else if(max >= about2exceedLimit)
o.setProjectLevel(NumConstant.TWO);
}
return null;
});
}
}
}

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java

@ -6,6 +6,7 @@ import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.entity.project.ProjectEntity;
import com.epmet.service.Issue.IssueService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectLogDailyService;
import com.epmet.service.evaluationindex.extract.todata.FactOriginProjectMainDailyService;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenProjectSettleService;
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService;
@ -38,6 +39,8 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
@Autowired
private FactOriginProjectMainDailyService originMainService;
@Autowired
private FactOriginProjectLogDailyService logService;
@Autowired
private ProjectService projectService;
@Autowired
private ProjectProcessService processService;
@ -76,7 +79,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
}
List<ScreenProjectDataDTO> metaData =
originMainService.initNewScreenProjectData(param.getCustomerId(), rows <= NumConstant.ZERO ? null : param.getDateId(),exceedLimit,about2ExceedLimit);
originMainService.initNewScreenProjectData(param.getCustomerId(), rows , param.getDateId(),exceedLimit,about2ExceedLimit);
if(!CollectionUtils.isEmpty(metaData)) {
List<ProjectEntity> info = projectService.getProjectInfo(metaData.stream().map(ScreenProjectDataDTO::getProjectId).collect(Collectors.toList()));
@ -98,13 +101,24 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
List<ScreenProjectDataDTO> orientData =
targetDbService.getPending(orientCase);
//TODO 给metaData和orientData赋上分类信息
// 给metaData和orientData赋上分类信息
List<String> projectIds = metaData.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList());
projectIds.addAll(orientData.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList()));
Map<String, Set<String>> categoryMap = projectService.getProjectCategory(projectIds);
if(!CollectionUtils.isEmpty(categoryMap)){
Map<String, String> integratedProjectCategoryMap = issueService.getIntegratedProjectCategory(categoryMap, param.getCustomerId());
if(!CollectionUtils.isEmpty(integratedProjectCategoryMap)){
metaData.forEach(meta -> {
meta.setAllCategoryName(integratedProjectCategoryMap.get(meta.getProjectId()));
});
orientData.forEach(orient -> {
orient.setAllCategoryName(integratedProjectCategoryMap.get(orient.getProjectId()));
});
}
}
//TODO 重新计算orientData的级别 有现成的方法 fact_origin_project_org_period_daily
//重新计算orientData的级别 有现成的方法 fact_origin_project_org_period_daily
originMainService.computerIfExceed(orientData, exceedLimit,about2ExceedLimit);
//TODO 更新结案时间和结案状态

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/ProjectProcessService.java

@ -22,6 +22,7 @@ import com.epmet.dto.project.FinishOrgDTO;
import com.epmet.dto.project.ProcessInfoDTO;
import com.epmet.dto.project.result.ProjectLatestOperationResultDTO;
import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.project.ProjectProcessEntity;
@ -124,4 +125,6 @@ public interface ProjectProcessService extends BaseService<ProjectProcessEntity>
* @date 2020.09.28 14:44
*/
Map<String,ProjectLatestOperationResultDTO> getLatestOperation(List<String> list, String customerId);
void updateProjectStatus(List<ScreenProjectDataDTO> list, String dateId);
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/project/impl/ProjectProcessServiceImpl.java

@ -30,6 +30,7 @@ import com.epmet.dto.project.ProjectOrgRelationDTO;
import com.epmet.dto.project.result.ProjectLatestOperationResultDTO;
import com.epmet.dto.project.result.ProjectOrgPeriodResultDTO;
import com.epmet.dto.project.result.ProjectOrgRelationWhenResponseResultDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.entity.project.ProjectEntity;
import com.epmet.entity.project.ProjectProcessEntity;
import com.epmet.service.project.ProjectProcessService;
@ -125,4 +126,10 @@ public class ProjectProcessServiceImpl extends BaseServiceImpl<ProjectProcessDao
return operations.stream().collect(Collectors.toMap(ProjectLatestOperationResultDTO :: getProjectId,o->o,(a,n)-> a));
}
}
@Override
public void updateProjectStatus(List<ScreenProjectDataDTO> list,String dateId) {
if(CollectionUtils.isEmpty(list)) return;
}
}

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml

@ -550,7 +550,8 @@
IF(data.PROJECT_STATUS = 'closed','closed_case',data.PROJECT_STATUS) as projectStatusCode,
3 as projectLevel,
IF(data.PIDS IS NULL || TRIM(data.PIDS) = '',data.AGENCY_ID,CONCAT(REPLACE(data.PIDS,':',','),',',data.AGENCY_ID)) as allParentIds,
data.TOPIC_ID
data.TOPIC_ID,
#{dataEndTime} as dataEndTime
FROM `fact_origin_project_main_daily` data
LEFT JOIN DIM_AGENCY agency on data.agency_id = agency.id
@ -561,6 +562,9 @@
<if test='null != dateId and "" != dateId'>
AND data.DATE_ID = #{dateId}
</if>
<if test='(null == dateId or "" == dateId) and null != dataEndTime and "" != dataEndTime'>
AND CAST(data.DATE_ID AS SIGNED) <![CDATA[ <= ]]> CAST(#{dataEndTime} AS SIGNED)
</if>
</select>
</mapper>

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

@ -287,4 +287,38 @@
AND DATE_FORMAT(ivd.CREATED_TIME,'%Y%m%d') = #{dateId}
</select>
<select id="selectCategory" resultType="com.epmet.dto.issue.IssueProjectCategoryDictDTO">
SELECT
*
FROM (
SELECT
*
FROM issue_project_category_dict
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
<foreach collection="ids" item="id" open="AND (" separator=" OR " close=")">
id = #{id}
</foreach>
UNION
SELECT
*
FROM issue_project_category_dict outter
WHERE outter.DEL_FLAG = '0'
AND outter.CUSTOMER_ID = 'default'
<foreach collection="ids" item="id" open="AND (" separator=" OR " close=")">
outter.id = #{id}
</foreach>
AND NOT EXIST (
SELECT * FROM issue_project_category_dict WHERE del_flag = '0' AND
customer_id = #{customerId} and id = outter.id
)
) temp
order by temp.category_type,temp.sort
</select>
</mapper>
Loading…
Cancel
Save