| | |
| | | */ |
| | | package org.springblade.flow.business.service.impl; |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import lombok.AllArgsConstructor; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.TaskService; |
| | | import org.flowable.engine.history.HistoricProcessInstance; |
| | |
| | | import org.flowable.task.api.TaskQuery; |
| | | import org.flowable.task.api.history.HistoricTaskInstance; |
| | | import org.flowable.task.api.history.HistoricTaskInstanceQuery; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.Func; |
| | |
| | | import org.springblade.flow.engine.constant.FlowEngineConstant; |
| | | import org.springblade.flow.engine.entity.FlowProcess; |
| | | import org.springblade.flow.engine.utils.FlowCache; |
| | | import org.springblade.modules.district.entity.DistrictEntity; |
| | | import org.springblade.modules.district.service.IDistrictService; |
| | | import org.springblade.modules.property.entity.PropertyCapitalApplyEntity; |
| | | import org.springblade.modules.property.service.IPropertyCapitalApplyService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.LinkedList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 流程业务实现类 |
| | |
| | | buildFlowTaskList(bladeFlow, flowList, todoQuery, FlowEngineConstant.STATUS_TODO); |
| | | |
| | | // 计算总数 |
| | | long count = todoQuery.count(); |
| | | long count = flowList.size(); |
| | | // 设置页数 |
| | | page.setSize(count); |
| | | // 设置总数 |
| | |
| | | flow.setProcessIsFinished(FlowEngineConstant.STATUS_UNFINISHED); |
| | | } |
| | | } |
| | | // IPropertyCapitalApplyService bean = SpringUtils.getBean(IPropertyCapitalApplyService.class); |
| | | // PropertyCapitalApplyEntity capitalApplyEntity = bean.getOne(Wrappers.<PropertyCapitalApplyEntity>lambdaQuery().eq(PropertyCapitalApplyEntity::getProcessInstanceId, historicTaskInstance.getProcessInstanceId())); |
| | | // if (capitalApplyEntity != null) { |
| | | // flow.setName(capitalApplyEntity.getName()); |
| | | // flow.setDistrictId(capitalApplyEntity.getDistrictId()); |
| | | // flow.setLinkman(capitalApplyEntity.getLinkman()); |
| | | // flow.setLinkPhone(capitalApplyEntity.getLinkPhone()); |
| | | // } |
| | | |
| | | IPropertyCapitalApplyService bean = SpringUtils.getBean(IPropertyCapitalApplyService.class); |
| | | PropertyCapitalApplyEntity capitalApplyEntity = bean.getOne(Wrappers.<PropertyCapitalApplyEntity>lambdaQuery().eq(PropertyCapitalApplyEntity::getProcessInstanceId, historicTaskInstance.getProcessInstanceId())); |
| | | if (capitalApplyEntity != null) { |
| | | flow.setName(capitalApplyEntity.getName()); |
| | | flow.setDistrictId(capitalApplyEntity.getDistrictId()); |
| | | IDistrictService bean1 = SpringUtils.getBean(IDistrictService.class); |
| | | DistrictEntity one = bean1.getOne(Wrappers.<DistrictEntity>lambdaQuery().eq(DistrictEntity::getId, capitalApplyEntity.getDistrictId())); |
| | | if (one != null) { |
| | | flow.setDistrictName(one.getName()); |
| | | } |
| | | flow.setLinkman(capitalApplyEntity.getLinkman()); |
| | | flow.setLinkPhone(capitalApplyEntity.getLinkPhone()); |
| | | } |
| | | |
| | | flow.setStatus(FlowEngineConstant.STATUS_FINISH); |
| | | flowList.add(flow); |
| | | // flowList.add(flow); |
| | | Boolean districtNameFlag = true; |
| | | Boolean nameFlag = true; |
| | | Boolean dateFlag = true; |
| | | Boolean isFilter = false; |
| | | |
| | | if (StringUtils.isNotBlank(bladeFlow.getDistrictName())) { |
| | | isFilter = true; |
| | | // 小区、项目名称、申请时间 |
| | | districtNameFlag = flow.getDistrictName().contains(bladeFlow.getDistrictName()); |
| | | } else if (StringUtils.isNotBlank(bladeFlow.getName())) { |
| | | isFilter = true; |
| | | // 小区、项目名称、申请时间 |
| | | nameFlag = flow.getName().contains(bladeFlow.getName()); |
| | | } else if (bladeFlow.getStartTimes() != null && bladeFlow.getEndTimes() != null) { |
| | | isFilter = true; |
| | | // 小区、项目名称、申请时间 |
| | | dateFlag = flow.getCreateTime().after(bladeFlow.getStartTimes()) |
| | | && flow.getCreateTime().before(bladeFlow.getEndTimes()); |
| | | } |
| | | if (isFilter ) { |
| | | if(districtNameFlag && nameFlag && dateFlag){ |
| | | flowList.add(flow); |
| | | } |
| | | } else { |
| | | flowList.add(flow); |
| | | } |
| | | }); |
| | | // 计算总数 |
| | | long count = doneQuery.count(); |
| | |
| | | flow.setBusinessTable(businessKey[0]); |
| | | flow.setBusinessId(businessKey[1]); |
| | | } |
| | | IPropertyCapitalApplyService bean = SpringUtils.getBean(IPropertyCapitalApplyService.class); |
| | | PropertyCapitalApplyEntity capitalApplyEntity = bean.getOne(Wrappers.<PropertyCapitalApplyEntity>lambdaQuery().eq(PropertyCapitalApplyEntity::getProcessInstanceId, task.getProcessInstanceId())); |
| | | if (capitalApplyEntity != null) { |
| | | flow.setName(capitalApplyEntity.getName()); |
| | | flow.setDistrictId(capitalApplyEntity.getDistrictId()); |
| | | IDistrictService bean1 = SpringUtils.getBean(IDistrictService.class); |
| | | DistrictEntity one = bean1.getOne(Wrappers.<DistrictEntity>lambdaQuery().eq(DistrictEntity::getId, capitalApplyEntity.getDistrictId())); |
| | | if (one != null) { |
| | | flow.setDistrictName(one.getName()); |
| | | } |
| | | flow.setLinkman(capitalApplyEntity.getLinkman()); |
| | | flow.setLinkPhone(capitalApplyEntity.getLinkPhone()); |
| | | } |
| | | |
| | | FlowProcess processDefinition = FlowCache.getProcessDefinition(task.getProcessDefinitionId()); |
| | | flow.setCategory(processDefinition.getCategory()); |
| | |
| | | flow.setProcessDefinitionVersion(processDefinition.getVersion()); |
| | | flow.setProcessInstanceId(task.getProcessInstanceId()); |
| | | flow.setStatus(status); |
| | | flowList.add(flow); |
| | | Boolean districtNameFlag = true; |
| | | Boolean nameFlag = true; |
| | | Boolean dateFlag = true; |
| | | Boolean isFilter = false; |
| | | |
| | | if (StringUtils.isNotBlank(bladeFlow.getDistrictName())) { |
| | | isFilter = true; |
| | | // 小区、项目名称、申请时间 |
| | | districtNameFlag = flow.getDistrictName().contains(bladeFlow.getDistrictName()); |
| | | } else if (StringUtils.isNotBlank(bladeFlow.getName())) { |
| | | isFilter = true; |
| | | // 小区、项目名称、申请时间 |
| | | nameFlag = flow.getName().contains(bladeFlow.getName()); |
| | | } else if (bladeFlow.getStartTimes() != null && bladeFlow.getEndTimes() != null) { |
| | | isFilter = true; |
| | | // 小区、项目名称、申请时间 |
| | | dateFlag = flow.getCreateTime().after(bladeFlow.getStartTimes()) |
| | | && flow.getCreateTime().before(bladeFlow.getEndTimes()); |
| | | } |
| | | if (isFilter ) { |
| | | if(districtNameFlag && nameFlag && dateFlag){ |
| | | flowList.add(flow); |
| | | } |
| | | } else { |
| | | flowList.add(flow); |
| | | } |
| | | }); |
| | | } |
| | | |