content: package com.ruoyi.flowable.handler;
  
  import com.ruoyi.common.enums.FlowMenuEnum;
  import com.ruoyi.common.enums.ProcessStatus;
  import com.ruoyi.flowable.api.domain.WfBusinessProcess;
  import com.ruoyi.flowable.api.domain.vo.WorkSignVo;
  import com.ruoyi.flowable.api.service.IWorkSignServiceApi;
  import com.ruoyi.flowable.service.IWfBusinessProcessService;
  import lombok.RequiredArgsConstructor;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.context.annotation.Lazy;
  import org.springframework.stereotype.Component;
  import org.springframework.transaction.annotation.Transactional;
  
  import java.util.List;
  
  /**
   * 删除业务流程处理类
   *
   * @author fengcheng
   */
  @RequiredArgsConstructor
  @Component("deleteProcessBusinessHandler")
  public class DeleteProcessBusinessHandler {
  
      @Autowired
      @Lazy
      private IWfBusinessProcessService wfBusinessProcessService;
      @Autowired
      @Lazy
      private IWorkSignServiceApi workSignServiceApi;
  
      /**
       * 删除业务流程
       *
       * @param ids
       */
      @Transactional(rollbackFor = Exception.class)
      public void delete(List<String> ids) {
          List<WfBusinessProcess> list = wfBusinessProcessService.selectWfBusinessProcessListByProcessId(ids);
  
          for (WfBusinessProcess wfBusinessProcess : list) {
              // 电子签章
              if (FlowMenuEnum.SIGN_FLOW_MENU.getCode().equals(wfBusinessProcess.getBusinessProcessType())) {
                  WorkSignVo workSignVo = new WorkSignVo();
                  workSignVo.setSignId(Long.valueOf(wfBusinessProcess.getBusinessId()));
                  workSignVo.setSchedule(ProcessStatus.UNAPPROVED.getStatus());
                  workSignServiceApi.updateWorkSign(workSignVo);
              }
              wfBusinessProcessService.deleteWfBusinessProcessByBusinessId(wfBusinessProcess.getBusinessId(), wfBusinessProcess.getBusinessProcessType());
          }
      }
  }
  