手机端-查询待办任务接口-条件处理。

This commit is contained in:
wangzhijiang
2023-06-13 09:16:17 +08:00
parent c254f3ffe6
commit 6cd9e3d7a8
6 changed files with 97 additions and 12 deletions
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.modules.phone.service.IToDoCenterService;
import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
@@ -1,9 +1,12 @@
package com.jero.modules.phone.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
import java.util.Map;
public interface IToDoCenterService {
IPage queryTodoTaskPage(Map<String, Object> params);
IPage<ProjectCertificationInventoryEO> queryPreHomoPage(Map<String,Object> params);
}
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.phone.service.ITaskStatisticsService;
import com.jero.modules.project.enums.CertificationFlowNodeEnum;
import com.jero.modules.project.enums.TaskStatusEnum;
import com.jero.modules.system.util.StringUtils;
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
@@ -4,19 +4,25 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.YesOrNoEnum;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.DateUtils;
import com.jero.modules.phone.service.IToDoCenterService;
import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectTaskInventoryDetailEO;
import com.jero.modules.project.enums.CertificationFlowNodeEnum;
import com.jero.modules.project.enums.CertificationInventoryFlowStatusEnum;
import com.jero.modules.project.enums.ProjectInventoryFieldEnum;
import com.jero.modules.project.enums.TaskStatusEnum;
import com.jero.modules.project.service.IProjectCertificationInventoryEOService;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.project.service.IProjectTaskInventoryDetailEOService;
import com.jero.modules.project.service.IProjectTaskInventoryEOService;
import com.jero.modules.system.entity.SysCategory;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.enums.ProjectRoleEnum;
import com.jero.modules.system.service.ISysCategoryService;
import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
@@ -62,12 +68,36 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
private ISysCategoryService sysCategoryService;
@Autowired
private SysDictItemServiceImpl sysDictItemServiceImpl;
@Autowired
private IProjectCertificationInventoryEOService projectCertificationInventoryEOService;
@Override
public IPage queryTodoTaskPage(Map<String, Object> params) {
String cut = (String) params.get("cut");
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
String mobileProcessing = (String) params.get("mobileProcessing");
Integer monthNum = Integer.parseInt((String) params.get("selectModel"));
if(monthNum > 0){
// 创建一个Calendar对象,表示当前时间
Calendar calendar = Calendar.getInstance();
// 往后推算日期
calendar.add(Calendar.MONTH, monthNum);
// 将时间设置为0点0分0秒
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
// 将日期格式化为字符串并输出
String frontEndTime = DateUtils.date_sdf.get().format(new Date());
String afterEndTime = DateUtils.date_sdf.get().format(calendar.getTime());
params.put("frontEndTime",frontEndTime);
params.put("afterEndTime",afterEndTime);
}
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<String> flowTypeList = new ArrayList<>();
@@ -80,7 +110,9 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
params.put("currentUserId", currentUser.getId());
List<String> qdqrFlowTypeValue = new ArrayList<>();
qdqrFlowTypeValue.add(FlowTypeEnum.QDQR.getValue());
if(StringUtils.equals(mobileProcessing,YesOrNoEnum.NO.getValue()) || StringUtils.isEmpty(mobileProcessing)){
qdqrFlowTypeValue.add(FlowTypeEnum.QDQR.getValue());
}
qdqrFlowTypeValue.add(FlowTypeEnum.CERTIFICATION_LC.getValue());
params.put("qdqrFlowTypeValue", qdqrFlowTypeValue);
@@ -95,13 +127,13 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
}
private void disposeData(String cut, List<ProcessInfoVO> datas) {
if(CollectionUtils.isNotEmpty(datas)){
if (CollectionUtils.isNotEmpty(datas)) {
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
QueryWrapper<ProcessInfoDetailEO> pidQueryWrap = new QueryWrapper<>();
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType,FlowTypeEnum.CERTIFICATION_LC.getValue());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getUserId,currentUser.getId());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus,TaskStatusEnum.NOT_DONE.getValue());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getFlowType, FlowTypeEnum.CERTIFICATION_LC.getValue());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getUserId, currentUser.getId());
pidQueryWrap.lambda().eq(ProcessInfoDetailEO::getStatus, TaskStatusEnum.NOT_DONE.getValue());
List<ProcessInfoDetailEO> pidEoList = this.processInfoDetailEOService.list(pidQueryWrap);
Iterator<ProcessInfoVO> datasIt = datas.iterator();
List<ProcessInfoVO> datasTemp = new ArrayList<>();
@@ -114,13 +146,13 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
}).collect(Collectors.toList());
// 判断当前用户在这个认证流程中 有几个任务。 责任人 接受、责任人 提交交付物、认证工程审批
if(CollectionUtils.isNotEmpty(pidEos)){
if (CollectionUtils.isNotEmpty(pidEos)) {
List<ProcessInfoDetailEO> zrrjsrwPidEos = pidEos.stream().filter(pidEo -> {
return StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.ZRRJSRW.getKey());
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(zrrjsrwPidEos)){
if (CollectionUtils.isNotEmpty(zrrjsrwPidEos)) {
ProcessInfoVO processInfoVOTemp = new ProcessInfoVO();
BeanUtils.copyProperties(data,processInfoVOTemp);
BeanUtils.copyProperties(data, processInfoVOTemp);
processInfoVOTemp.setTaskDefinitionKey(CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey());
datasTemp.add(processInfoVOTemp);
}
@@ -128,9 +160,9 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
List<ProcessInfoDetailEO> rzgcsscPidEos = pidEos.stream().filter(pidEo -> {
return StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.RZGCSSC.getKey());
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(rzgcsscPidEos)){
if (CollectionUtils.isNotEmpty(rzgcsscPidEos)) {
ProcessInfoVO processInfoVOTemp = new ProcessInfoVO();
BeanUtils.copyProperties(data,processInfoVOTemp);
BeanUtils.copyProperties(data, processInfoVOTemp);
processInfoVOTemp.setTaskDefinitionKey(CertificationFlowNodeEnum.TASK_REVIEW.getKey());
datasTemp.add(processInfoVOTemp);
}
@@ -138,9 +170,9 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
List<ProcessInfoDetailEO> zrrtjrwPidEos = pidEos.stream().filter(pidEo -> {
return StringUtils.equals(pidEo.getTaskDefinitionKey(), CertificationFlowNodeEnum.ZRRTJRW.getKey());
}).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(zrrtjrwPidEos)){
if (CollectionUtils.isNotEmpty(zrrtjrwPidEos)) {
ProcessInfoVO processInfoVOTemp = new ProcessInfoVO();
BeanUtils.copyProperties(data,processInfoVOTemp);
BeanUtils.copyProperties(data, processInfoVOTemp);
processInfoVOTemp.setTaskDefinitionKey(CertificationFlowNodeEnum.TASK_HANDLING.getKey());
datasTemp.add(processInfoVOTemp);
}
@@ -397,4 +429,38 @@ public class ToDoCenterServiceImpl implements IToDoCenterService {
});
}
}
@Override
public IPage<ProjectCertificationInventoryEO> queryPreHomoPage(Map<String,Object> params) {
ProjectCertificationInventoryEO pciEo = new ProjectCertificationInventoryEO();
String cut = (String) params.get("cut");
String projectLibraryId = (String) params.get("projectLibraryId");
String taskDefinitionKey = (String) params.get("taskDefinitionKey");
Integer pageNo = Integer.parseInt((String) params.get("pageNo"));
Integer pageSize = Integer.parseInt((String) params.get("pageSize"));
QueryWrapper<ProjectCertificationInventoryEO> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getProjectLibraryId, projectLibraryId);
queryWrapper.orderByDesc("create_time");
if (StringUtils.equals(taskDefinitionKey, CertificationFlowNodeEnum.TASK_RESPONSIBILITY_CONFIRMATION.getKey())) {
pciEo.setRoleCode(ProjectRoleEnum.PERSON_LIABLE.getValue());
queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus, CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
} else if (StringUtils.equals(taskDefinitionKey, CertificationFlowNodeEnum.TASK_HANDLING.getKey())) {
pciEo.setRoleCode(ProjectRoleEnum.PERSON_LIABLE.getValue());
queryWrapper.and(queryWrap -> {
queryWrap.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus, CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue());
queryWrap.or().lambda().eq(ProjectCertificationInventoryEO::getFlowStatus, CertificationInventoryFlowStatusEnum.REVIEW_AND_RETURN.getValue());
});
} else if (StringUtils.equals(taskDefinitionKey, CertificationFlowNodeEnum.TASK_REVIEW.getKey())) {
pciEo.setRoleCode(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue());
queryWrapper.lambda().eq(ProjectCertificationInventoryEO::getFlowStatus, CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_REVIEWED.getValue());
}
Page<ProjectCertificationInventoryEO> page = new Page<ProjectCertificationInventoryEO>(pageNo, pageSize);
IPage<ProjectCertificationInventoryEO> pageList = this.projectCertificationInventoryEOService.queryPage(queryWrapper, page, pciEo, cut);
return pageList;
}
}
@@ -2015,6 +2015,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRTJRW.getKey());
detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList);
detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue());
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date());
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername());
this.processInfoDetailEOService.update(detailUpdateWrap);
// 给认证工程师分配待办中心的任务 认证工程师审查
@@ -2101,6 +2103,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRJSRW.getKey());
detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList);
detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue());
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date());
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername());
this.processInfoDetailEOService.update(detailUpdateWrap);
// 给责任人分配待办中心的任务 (待提交)
@@ -2216,6 +2220,8 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
detailUpdateWrap.eq(ProcessInfoDetailEO::getTaskDefinitionKey,CertificationFlowNodeEnum.ZRRJSRW.getKey());
detailUpdateWrap.in(ProcessInfoDetailEO::getProjectLawsInventoryId,certificationIdList);
detailUpdateWrap.set(ProcessInfoDetailEO::getStatus,TaskStatusEnum.HAVE_DONE.getValue());
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateTime,new Date());
detailUpdateWrap.set(ProcessInfoDetailEO::getUpdateBy,currentUser.getUsername());
this.processInfoDetailEOService.update(detailUpdateWrap);
this.certificationInventoryEOListSortByInventoryVerifyEndTimeAsc(projectCertificationInventoryEOList);
@@ -38,6 +38,14 @@
<if test="params.status != null and params.status !=''">
and temp.status = #{params.status}
</if>
<if test="params.frontEndTime != null and params.frontEndTime !=''">
and (
temp.end_time &gt;= #{params.frontEndTime}
<if test="params.afterEndTime != null and params.afterEndTime !=''">
and temp.end_time &lt;= #{params.afterEndTime}
</if>
)
</if>
</where>
</sql>