zhongrj
2024-04-22 2423ac966273e5b7530b140cc6ed28d36e42d4d3
src/main/java/org/springblade/flow/business/service/impl/FlowBusinessServiceImpl.java
@@ -1,23 +1,8 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.flow.business.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.flowable.engine.HistoryService;
import org.flowable.engine.TaskService;
import org.flowable.engine.history.HistoricProcessInstance;
@@ -38,7 +23,6 @@
import org.springblade.flow.engine.entity.FlowProcess;
import org.springblade.flow.engine.utils.FlowCache;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
@@ -100,7 +84,7 @@
      buildFlowTaskList(bladeFlow, flowList, todoQuery, FlowEngineConstant.STATUS_TODO);
      // 计算总数
      long count = todoQuery.count();
      long count = flowList.size();
      // 设置页数
      page.setSize(count);
      // 设置总数
@@ -237,8 +221,43 @@
               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());
//         }
         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();
@@ -316,7 +335,32 @@
         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);
         }
      });
   }