|
|
|
@@ -21,6 +21,8 @@ import org.apache.commons.io.FileUtils; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument; |
|
|
|
import org.flowable.engine.RuntimeService; |
|
|
|
import org.flowable.engine.TaskService; |
|
|
|
import org.flowable.task.api.Task; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@@ -81,6 +83,9 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
@Autowired |
|
|
|
RuntimeService runtimeService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private TaskService taskService; |
|
|
|
|
|
|
|
@Override |
|
|
|
public Map<String, Object> listAsPage(WxRentContract record, Integer pageIndex, Integer pageSize) { |
|
|
|
Object rentContractStatusInfo = getRentContractStatusInfo(record); |
|
|
|
@@ -503,7 +508,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
public void download(HttpServletRequest request, HttpServletResponse response, String tenantId) { |
|
|
|
String id = request.getParameter("id"); |
|
|
|
WxRentContract wxRentContract = wxRentContractMapper.selectByPrimaryKey(id); |
|
|
|
logger.info("----------id:{},getFilename:{}",id,wxRentContract.getFilename()); |
|
|
|
String filesuffix = wxRentContract.getFilepath().substring(wxRentContract.getFilepath().lastIndexOf(".")); |
|
|
|
String filename = UUID.randomUUID() + filesuffix; |
|
|
|
String filepath = Constant.fileDirectory; |
|
|
|
@@ -623,38 +627,35 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
List<Long> collect = wxRentContractMapper.getRentInvalidList(wxRentContract).stream() |
|
|
|
.map(r -> r.getId()).collect(Collectors.toList()); |
|
|
|
if (!CollectionUtils.isEmpty(collect)) { |
|
|
|
// 结束审批流 by luozukai |
|
|
|
WxFlowRecord wxFlowRecord = new WxFlowRecord(); |
|
|
|
wxFlowRecord.setIds(collect); |
|
|
|
List<WxFlowRecord> flowRecordList = wxFlowRecordService.findList(wxFlowRecord); |
|
|
|
if (!CollectionUtils.isEmpty(flowRecordList)) { |
|
|
|
for (WxFlowRecord flowRecord:flowRecordList) { |
|
|
|
try { |
|
|
|
runtimeService.deleteProcessInstance(flowRecord.getProcessInstanceId(), "合同作废"); |
|
|
|
// 修改合同审核状态 |
|
|
|
WxRentContract rentContract = new WxRentContract(); |
|
|
|
rentContract.setId(flowRecord.getBusinessId()); |
|
|
|
rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode()); |
|
|
|
updateApplyStatus(rentContract); |
|
|
|
|
|
|
|
// 保存审批历史入 |
|
|
|
WxFlowRecord updateRecord = new WxFlowRecord(); |
|
|
|
updateRecord.setBusinessId(flowRecord.getBusinessId()); |
|
|
|
updateRecord.setTaskId(flowRecord.getTaskId()); |
|
|
|
updateRecord.setProcessInstanceId(flowRecord.getProcessInstanceId()); |
|
|
|
updateRecord.setRemark(flowRecord.getRemark()); |
|
|
|
updateRecord.setUserId(flowRecord.getUserId()); |
|
|
|
updateRecord.setStatus(EnumFlowRecordStatus.CANCLE.getCode()); |
|
|
|
updateRecord.setBusinessType(flowRecord.getBusinessType()); |
|
|
|
updateRecord.setUserName(flowRecord.getUserName()); |
|
|
|
updateRecord.setTaskKey(flowRecord.getTaskKey()); |
|
|
|
updateRecord.setTaskName(flowRecord.getTaskName()); |
|
|
|
wxFlowRecordService.saveOrUpdate(updateRecord); |
|
|
|
}catch (Exception e){ |
|
|
|
logger.error("deleteProcessInstance error",e); |
|
|
|
for (Long id:collect) { |
|
|
|
try { |
|
|
|
logger.info("合同id:{},开始停止...",id); |
|
|
|
//结束审批流 by luozukai |
|
|
|
List<Task> tasks = taskService.createTaskQuery().processDefinitionKey(WxFlowServiceImpl.getFlowKeyByType(1)) |
|
|
|
.processVariableValueEquals("businessId",id).list(); |
|
|
|
if (!CollectionUtils.isEmpty(tasks)) { |
|
|
|
for (Task task:tasks) { |
|
|
|
logger.info("合同id:{},taskid:{}",id,task.getId()); |
|
|
|
runtimeService.deleteProcessInstance(task.getProcessInstanceId(), "合同作废"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 修改合同审核状态 |
|
|
|
WxRentContract rentContract = new WxRentContract(); |
|
|
|
rentContract.setId(id); |
|
|
|
rentContract.setApplyStatus(EnumRentContractAppStatus.CANCLE.getCode()); |
|
|
|
updateApplyStatus(rentContract); |
|
|
|
|
|
|
|
// 保存审批历史入 |
|
|
|
WxFlowRecord updateRecord = new WxFlowRecord(); |
|
|
|
updateRecord.setBusinessId(id); |
|
|
|
updateRecord.setStatus(EnumFlowRecordStatus.CANCLE.getCode()); |
|
|
|
updateRecord.setBusinessType(1); |
|
|
|
wxFlowRecordService.saveOrUpdate(updateRecord); |
|
|
|
}catch (Exception e){ |
|
|
|
logger.error("deleteProcessInstance error",e); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//把状态为签约而商户未关联的数据改为待签约状态 |
|
|
|
|