54 changed files with 1840 additions and 18 deletions
@ -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; |
|||
|
|||
} |
|||
@ -0,0 +1,97 @@ |
|||
/** |
|||
* 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.project; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 项目所属分类表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-12-25 |
|||
*/ |
|||
@Data |
|||
public class ProjectCategoryDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 主键 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 客户id |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 来源网格id |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 项目id |
|||
*/ |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 分类id |
|||
*/ |
|||
private String categoryId; |
|||
|
|||
/** |
|||
* 分类对应的所有上级,英文逗号隔开 |
|||
*/ |
|||
private String categoryPids; |
|||
|
|||
/** |
|||
* 删除标识 0未删除、1已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
|||
@ -0,0 +1,122 @@ |
|||
/** |
|||
* 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.project; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
import java.util.Date; |
|||
|
|||
|
|||
/** |
|||
* 项目人员关联表 |
|||
* |
|||
* @author generator generator@elink-cn.com |
|||
* @since v1.0.0 2020-05-11 |
|||
*/ |
|||
@Data |
|||
public class ProjectStaffDTO implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** |
|||
* 唯一标识 |
|||
*/ |
|||
private String id; |
|||
|
|||
/** |
|||
* 项目ID |
|||
*/ |
|||
private String projectId; |
|||
|
|||
/** |
|||
* 项目处理进展ID |
|||
*/ |
|||
private String processId; |
|||
|
|||
/** |
|||
* 客户ID |
|||
*/ |
|||
private String customerId; |
|||
|
|||
/** |
|||
* 机关ID |
|||
*/ |
|||
private String orgId; |
|||
|
|||
/** |
|||
* 部门ID |
|||
*/ |
|||
private String departmentId; |
|||
|
|||
/** |
|||
* 网格ID |
|||
*/ |
|||
private String gridId; |
|||
|
|||
/** |
|||
* 所属机关(11:22:33) |
|||
*/ |
|||
private String orgIdPath; |
|||
|
|||
/** |
|||
* 人员ID |
|||
*/ |
|||
private String staffId; |
|||
|
|||
/** |
|||
* 部门名 |
|||
*/ |
|||
private String departmentName; |
|||
|
|||
/** |
|||
* 是否处理:未处理unhandled,已处理handle |
|||
*/ |
|||
private String isHandle; |
|||
|
|||
/** |
|||
* 删除标识:0.未删除 1.已删除 |
|||
*/ |
|||
private String delFlag; |
|||
|
|||
/** |
|||
* 乐观锁 |
|||
*/ |
|||
private Integer revision; |
|||
|
|||
/** |
|||
* 创建人 |
|||
*/ |
|||
private String createdBy; |
|||
|
|||
/** |
|||
* 创建时间 |
|||
*/ |
|||
private Date createdTime; |
|||
|
|||
/** |
|||
* 更新人 |
|||
*/ |
|||
private String updatedBy; |
|||
|
|||
/** |
|||
* 更新时间 |
|||
*/ |
|||
private Date updatedTime; |
|||
|
|||
} |
|||
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.project.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 客户项目超期相关参数 |
|||
* @ClassName ProjectExceedParamsResultDTO |
|||
* @Auth wangc |
|||
* @Date 2021-03-05 17:02 |
|||
*/ |
|||
@Data |
|||
public class ProjectExceedParamsResultDTO implements Serializable { |
|||
private static final long serialVersionUID = 7621539816482416776L; |
|||
|
|||
private Integer defaultExceedLimit; |
|||
|
|||
private Integer defaultAbout2ExceedLimit; |
|||
|
|||
private Integer exceedLimit; |
|||
|
|||
private Integer about2ExceedLimit; |
|||
} |
|||
@ -0,0 +1,27 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen; |
|||
|
|||
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; |
|||
|
|||
/** |
|||
* @Description |
|||
* 给【screen_project_data】 |
|||
* 【screen_project_process_attachment】 |
|||
* 【screen_project_img_data】 |
|||
* 【screen_project_process】这四个表定时整理数据 |
|||
* @author wangc |
|||
* @date 2021.03.04 13:38 |
|||
*/ |
|||
|
|||
public interface ScreenProjectSettleService { |
|||
|
|||
|
|||
/** |
|||
* @Description 抽取项目数据到screen_project_* |
|||
* @param param |
|||
* @return void |
|||
* @author wangc |
|||
* @date 2021.03.04 23:09 |
|||
*/ |
|||
void extractScreenData(ScreenCentralZoneDataFormDTO param); |
|||
|
|||
} |
|||
@ -0,0 +1,160 @@ |
|||
package com.epmet.service.evaluationindex.extract.toscreen.impl; |
|||
|
|||
import com.epmet.commons.tools.constant.NumConstant; |
|||
import com.epmet.dto.project.result.ProjectExceedParamsResultDTO; |
|||
import com.epmet.dto.screen.ScreenProjectDataDTO; |
|||
import com.epmet.dto.screen.ScreenProjectImgDataDTO; |
|||
import com.epmet.dto.screen.ScreenProjectProcessAttachmentDTO; |
|||
import com.epmet.dto.screen.ScreenProjectProcessDTO; |
|||
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.FactOriginProjectMainDailyService; |
|||
import com.epmet.service.evaluationindex.extract.toscreen.ScreenProjectSettleService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenProjectImgDataService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenProjectProcessAttachmentService; |
|||
import com.epmet.service.evaluationindex.screen.ScreenProjectProcessService; |
|||
import com.epmet.service.project.ProjectProcessService; |
|||
import com.epmet.service.project.ProjectService; |
|||
import com.epmet.service.topic.TopicService; |
|||
import com.epmet.service.user.UserService; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
import org.springframework.util.CollectionUtils; |
|||
|
|||
import java.util.*; |
|||
import java.util.stream.Collectors; |
|||
|
|||
/** |
|||
* @Description |
|||
* @ClassName ScreenProjectSettleServiceImpl |
|||
* @Auth wangc |
|||
* @Date 2021-03-04 23:10 |
|||
*/ |
|||
public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleService { |
|||
|
|||
|
|||
@Autowired |
|||
private ScreenProjectDataService targetDbService; |
|||
@Autowired |
|||
private FactOriginProjectMainDailyService originMainService; |
|||
@Autowired |
|||
private ProjectService projectService; |
|||
@Autowired |
|||
private ProjectProcessService processService; |
|||
@Autowired |
|||
private TopicService topicService; |
|||
@Autowired |
|||
private UserService userService; |
|||
@Autowired |
|||
private IssueService issueService; |
|||
@Autowired |
|||
private ScreenProjectProcessService targetProcessService; |
|||
@Autowired |
|||
private ScreenProjectImgDataService targetImgService; |
|||
@Autowired |
|||
private ScreenProjectProcessAttachmentService targetAttachmentService; |
|||
|
|||
/** |
|||
* @Description 抽取项目数据到screen_project_* |
|||
* @param param |
|||
* @return void |
|||
* @author wangc |
|||
* @date 2021.03.04 23:09 |
|||
*/ |
|||
@Override |
|||
@Transactional |
|||
public void extractScreenData(ScreenCentralZoneDataFormDTO param) { |
|||
int rows = targetDbService.checkIfExisted(param.getCustomerId()); |
|||
List<ProjectExceedParamsResultDTO> exceedParams = projectService.getProjectExceedParams(param.getCustomerId()); |
|||
Integer exceedLimit = NumConstant.FIVE; |
|||
Integer about2ExceedLimit = NumConstant.FIVE; |
|||
|
|||
|
|||
if(!CollectionUtils.isEmpty(exceedParams)){ |
|||
for(ProjectExceedParamsResultDTO ex :exceedParams){ |
|||
if(null != ex.getDefaultExceedLimit()){ |
|||
exceedLimit = null == ex.getExceedLimit() ? ex.getDefaultExceedLimit() : ex.getExceedLimit(); |
|||
} |
|||
if(null != ex.getDefaultAbout2ExceedLimit()){ |
|||
about2ExceedLimit = null == ex.getAbout2ExceedLimit() ? ex.getDefaultAbout2ExceedLimit() : ex.getDefaultAbout2ExceedLimit(); |
|||
} |
|||
} |
|||
} |
|||
//因为即将超期提醒时间(天)就是即将超期期限,在表中存储的是超期前多少天
|
|||
//所以这里要换算成滞留日
|
|||
about2ExceedLimit = exceedLimit >= about2ExceedLimit ? exceedLimit - about2ExceedLimit : exceedLimit; |
|||
List<ScreenProjectDataDTO> metaData = |
|||
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())); |
|||
if(!CollectionUtils.isEmpty(info)){ |
|||
metaData.stream().flatMap(meta -> info.stream().filter(nature -> StringUtils.equals(meta.getProjectId(), |
|||
nature.getId())).map(projectInfo -> { |
|||
meta.setProjectCreateTime(projectInfo.getCreatedTime()); |
|||
meta.setProjectTitle(projectInfo.getTitle()); |
|||
return null; |
|||
})); |
|||
} |
|||
topicService.fillScreenProjectData(metaData); |
|||
//metaData = Optional.ofNullable(topicService.getScreenProjectData(metaData)).orElse(metaData);
|
|||
userService.fillScreenProjectData(metaData); |
|||
//metaData = Optional.ofNullable(userService.getScreenProjectData(metaData)).orElse(metaData);
|
|||
} |
|||
ScreenProjectDataDTO orientCase = new ScreenProjectDataDTO(); |
|||
orientCase.setCustomerId(param.getCustomerId()); |
|||
//待更新的数据 需要检测更新的字段为:①projectStatusCode ②closeCaseTime ③allCategoryName ④projectLevel
|
|||
List<ScreenProjectDataDTO> orientData = |
|||
targetDbService.getPending(orientCase); |
|||
|
|||
// 给metaData和orientData赋上分类信息
|
|||
List<String> projectIds = |
|||
Optional.ofNullable(metaData.stream().map(ScreenProjectDataDTO::getProjectId).distinct().collect(Collectors.toList())).orElse(new ArrayList<>()); |
|||
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())); |
|||
}); |
|||
} |
|||
} |
|||
|
|||
//重新计算orientData的级别 有现成的方法 fact_origin_project_org_period_daily
|
|||
originMainService.computerIfExceed(orientData, exceedLimit,about2ExceedLimit); |
|||
processService.updateProjectCloseTime(metaData); |
|||
//更新结案时间和结案状态
|
|||
processService.updateProjectStatus(orientData,param.getDateId(),param.getCustomerId()); |
|||
//FIXME release here
|
|||
targetDbService.insertOrUpdateBatch(param.getCustomerId(),param.getDateId(),metaData,orientData); |
|||
|
|||
if(!CollectionUtils.isEmpty(metaData)){ |
|||
List<ScreenProjectImgDataDTO> imgs = topicService.buildNewScreenProjectImgData(metaData); |
|||
if(CollectionUtils.isEmpty(imgs)){ |
|||
//FIXME release here
|
|||
targetImgService.insertBatch(imgs); |
|||
} |
|||
} |
|||
|
|||
//
|
|||
List<ScreenProjectProcessDTO> processes = processService.buildNewScreenProjectProcessData(param.getCustomerId(), param.getDateId(),!targetProcessService.checkIfHistoricalDataExists(param.getCustomerId())); |
|||
if(!CollectionUtils.isEmpty(processes)){ |
|||
//FIXME release here
|
|||
targetProcessService.insertBatch(processes,param.getCustomerId(),param.getDateId()); |
|||
List<ScreenProjectProcessAttachmentDTO> attachments = processService.buildProcessAttachmentData(processes.stream().map(ScreenProjectProcessDTO::getProcessId).distinct().collect(Collectors.toList())); |
|||
if(!CollectionUtils.isEmpty(attachments)){ |
|||
//FIXME release here
|
|||
targetAttachmentService.insertBatch(attachments); |
|||
} |
|||
} |
|||
|
|||
|
|||
} |
|||
} |
|||
Loading…
Reference in new issue