|
|
@ -20,6 +20,7 @@ package com.epmet.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
@ -30,14 +31,15 @@ import com.epmet.dao.ProjectDao; |
|
|
|
import com.epmet.dto.CustomerProjectParameterDTO; |
|
|
|
import com.epmet.dto.ProjectDTO; |
|
|
|
import com.epmet.dto.ProjectStaffDTO; |
|
|
|
import com.epmet.dto.form.ProjectDetailFromDTO; |
|
|
|
import com.epmet.dto.form.ProjectListFromDTO; |
|
|
|
import com.epmet.dto.form.WorkDayFormDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.ProjectEntity; |
|
|
|
import com.epmet.entity.ProjectProcessEntity; |
|
|
|
import com.epmet.entity.ProjectStaffEntity; |
|
|
|
import com.epmet.feign.CommonFeignClient; |
|
|
|
import com.epmet.redis.ProjectRedis; |
|
|
|
import com.epmet.service.CustomerProjectParameterService; |
|
|
|
import com.epmet.service.ProjectProcessService; |
|
|
|
import com.epmet.service.ProjectService; |
|
|
|
import com.epmet.service.ProjectStaffService; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
@ -65,6 +67,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
private CommonFeignClient commonFeignClient; |
|
|
|
@Autowired |
|
|
|
private ProjectStaffService projectStaffService; |
|
|
|
@Autowired |
|
|
|
private ProjectProcessService projectProcessService; |
|
|
|
|
|
|
|
private final static String ONE_DAY = "<1"; |
|
|
|
|
|
|
@ -124,6 +128,10 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
public List<PendProjectListResultDTO> getPendProjectList(ProjectListFromDTO fromDTO) { |
|
|
|
List<PendProjectListResultDTO> list = new ArrayList<>(); |
|
|
|
|
|
|
|
//查询条件
|
|
|
|
int pageIndex = (fromDTO.getPageNo() - NumConstant.ONE) * fromDTO.getPageSize(); |
|
|
|
fromDTO.setPageNo(pageIndex); |
|
|
|
|
|
|
|
List<ProjectDTO> projectList = baseDao.selectPendList(fromDTO); |
|
|
|
//获取客户定制的可滞留天数
|
|
|
|
Integer finalDays = getDays(fromDTO); |
|
|
@ -149,6 +157,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
@Override |
|
|
|
public List<CreatedListResultDTO> getCreatedList(ProjectListFromDTO fromDTO) { |
|
|
|
List<CreatedListResultDTO> list = new ArrayList<>(); |
|
|
|
|
|
|
|
//查询条件
|
|
|
|
int pageIndex = (fromDTO.getPageNo() - NumConstant.ONE) * fromDTO.getPageSize(); |
|
|
|
fromDTO.setPageNo(pageIndex); |
|
|
|
|
|
|
|
List<ProjectDTO> projectList = baseDao.selectCreatedList(fromDTO); |
|
|
|
//获取客户定制的可滞留天数
|
|
|
|
Integer finalDays = getDays(fromDTO); |
|
|
@ -156,6 +169,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
CreatedListResultDTO created = new CreatedListResultDTO(); |
|
|
|
created.setProjectId(p.getId()); |
|
|
|
created.setProjectTitle(p.getTitle()); |
|
|
|
created.setProjectStatus(p.getStatus()); |
|
|
|
created.setPublicReply(p.getPublicReply()); |
|
|
|
created.setProjectTime(p.getCreatedTime().getTime()); |
|
|
|
String detentionDays = getDetentionDays(p); |
|
|
|
if (!ONE_DAY.equals(detentionDays) && Integer.parseInt(detentionDays) > finalDays) { |
|
|
@ -181,6 +196,11 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
@Override |
|
|
|
public List<InvolvedListResultDTO> getInvolvedList(ProjectListFromDTO fromDTO) { |
|
|
|
List<InvolvedListResultDTO> list = new ArrayList<>(); |
|
|
|
|
|
|
|
//查询条件
|
|
|
|
int pageIndex = (fromDTO.getPageNo() - NumConstant.ONE) * fromDTO.getPageSize(); |
|
|
|
fromDTO.setPageNo(pageIndex); |
|
|
|
|
|
|
|
List<ProjectDTO> projectList = baseDao.selectCreatedList(fromDTO); |
|
|
|
//获取客户定制的可滞留天数
|
|
|
|
Integer finalDays = getDays(fromDTO); |
|
|
@ -188,6 +208,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
InvolvedListResultDTO involved = new InvolvedListResultDTO(); |
|
|
|
involved.setProjectId(p.getId()); |
|
|
|
involved.setProjectTitle(p.getTitle()); |
|
|
|
involved.setProjectStatus(p.getStatus()); |
|
|
|
involved.setPublicReply(p.getPublicReply()); |
|
|
|
involved.setProjectTime(p.getCreatedTime().getTime()); |
|
|
|
String detentionDays = getDetentionDays(p); |
|
|
|
if (!ONE_DAY.equals(detentionDays) && Integer.parseInt(detentionDays) > finalDays) { |
|
|
@ -228,13 +250,84 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//获取当前跟进部门
|
|
|
|
List<String> departmentNameList = new ArrayList<>(); |
|
|
|
if (ProjectConstant.CLOSED.equals(resultDTO.getProjectStatus())) { |
|
|
|
//项目已结案,跟进部门为空
|
|
|
|
resultDTO.setDepartmentNameList(departmentNameList); |
|
|
|
} else { |
|
|
|
//项目未结案,找出所有跟进部门
|
|
|
|
ProjectDTO projectDTO = new ProjectDTO(); |
|
|
|
projectDTO.setId(fromDTO.getProjectId()); |
|
|
|
departmentNameList = baseDao.selectDepartmentNameList(projectDTO); |
|
|
|
resultDTO.setDepartmentNameList(departmentNameList); |
|
|
|
} |
|
|
|
|
|
|
|
return resultDTO; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void closed(ProjectClosedFromDTO fromDTO) { |
|
|
|
//更新项目表状态
|
|
|
|
ProjectEntity projectEntity = baseDao.selectById(fromDTO.getProjectId()); |
|
|
|
projectEntity.setStatus(ProjectConstant.CLOSED); |
|
|
|
projectEntity.setClosedStatus(fromDTO.getClosedStatus()); |
|
|
|
baseDao.updateById(projectEntity); |
|
|
|
|
|
|
|
//更新项目关联表
|
|
|
|
ProjectStaffEntity projectStaffEntity = new ProjectStaffEntity(); |
|
|
|
projectStaffEntity.setId(fromDTO.getProjectStaffId()); |
|
|
|
projectStaffEntity.setIsHandle(ProjectConstant.HANDLE); |
|
|
|
projectStaffService.updateById(projectStaffEntity); |
|
|
|
|
|
|
|
//结案记录加入项目进展表
|
|
|
|
ProjectProcessEntity projectProcessEntity = new ProjectProcessEntity(); |
|
|
|
projectProcessEntity.setProjectId(fromDTO.getProjectId()); |
|
|
|
projectProcessEntity.setDepartmentName(fromDTO.getDepartmentName()); |
|
|
|
projectProcessEntity.setEndTime(new Date()); |
|
|
|
projectProcessEntity.setOperation(ProjectConstant.OPERATION_CLOSE); |
|
|
|
projectProcessEntity.setOperationName(ProjectConstant.OPERATION_CLOSE_NAME); |
|
|
|
projectProcessEntity.setPublicReply(fromDTO.getPublicReply()); |
|
|
|
projectProcessEntity.setInternalRemark(fromDTO.getInternalRemark()); |
|
|
|
projectProcessEntity.setStaffId(fromDTO.getUserId()); |
|
|
|
projectProcessEntity.setCostWorkdays(getDetentionDays(ConvertUtils.sourceToTarget(projectEntity, ProjectDTO.class))); |
|
|
|
projectProcessService.insert(projectProcessEntity); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void projectReturn(ReturnFromDTO fromDTO) { |
|
|
|
//更新项目关联表
|
|
|
|
ProjectStaffEntity projectStaffEntity = new ProjectStaffEntity(); |
|
|
|
projectStaffEntity.setId(fromDTO.getProjectStaffId()); |
|
|
|
projectStaffEntity.setIsHandle(ProjectConstant.HANDLE); |
|
|
|
projectStaffService.updateById(projectStaffEntity); |
|
|
|
|
|
|
|
//结案记录加入项目进展表
|
|
|
|
ProjectProcessEntity projectProcessEntity = new ProjectProcessEntity(); |
|
|
|
projectProcessEntity.setProjectId(fromDTO.getProjectId()); |
|
|
|
projectProcessEntity.setDepartmentName(fromDTO.getDepartmentName()); |
|
|
|
projectProcessEntity.setOperation(ProjectConstant.OPERATION_RETURN); |
|
|
|
projectProcessEntity.setOperationName(ProjectConstant.OPERATION_RETURN_NAME); |
|
|
|
projectProcessEntity.setPublicReply(fromDTO.getPublicReply()); |
|
|
|
projectProcessEntity.setInternalRemark(fromDTO.getInternalRemark()); |
|
|
|
projectProcessEntity.setStaffId(fromDTO.getUserId()); |
|
|
|
projectProcessService.insert(projectProcessEntity); |
|
|
|
|
|
|
|
//将人员关系添加到项目关联表
|
|
|
|
ProjectStaffDTO projectStaffDTO = projectStaffService.getProjectStaffInfo(fromDTO.getProjectProcessId()); |
|
|
|
ProjectStaffEntity projectStaff = ConvertUtils.sourceToTarget(projectStaffDTO, ProjectStaffEntity.class); |
|
|
|
projectStaff.setId(null); |
|
|
|
projectStaff.setIsHandle(ProjectConstant.UNHANDLED); |
|
|
|
projectStaffService.insert(projectStaff); |
|
|
|
|
|
|
|
//TODO 通知
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取客户定制的可滞留天数 |
|
|
|
* |
|
|
|
* @param fromDTO |
|
|
|
* @param fromDTO 参数 |
|
|
|
* @return java.lang.Integer |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/5/12 16:20 |
|
|
@ -255,7 +348,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
/** |
|
|
|
* 工作日计算 |
|
|
|
* |
|
|
|
* @param projectDTO |
|
|
|
* @param projectDTO 参数 |
|
|
|
* @return java.lang.String |
|
|
|
* @author zhaoqifeng |
|
|
|
* @date 2020/5/12 16:20 |
|
|
@ -266,7 +359,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit |
|
|
|
List<WorkDayFormDTO> list = new ArrayList<>(); |
|
|
|
WorkDayFormDTO workDayFormDTO = new WorkDayFormDTO(); |
|
|
|
workDayFormDTO.setId(projectDTO.getId()); |
|
|
|
workDayFormDTO.setStartDate(format.format(projectDTO.getCreatedTime())); |
|
|
|
workDayFormDTO.setStartDate(format.format(projectDTO.getUpdatedTime())); |
|
|
|
workDayFormDTO.setEndDate(format.format(new Date())); |
|
|
|
Result<List<WorkDayResultDTO>> detentionDays = commonFeignClient.detentionDays(list); |
|
|
|
return detentionDays.getData().get(0).getDetentionDays(); |
|
|
|