|
|
|
@@ -13,7 +13,10 @@ import com.iformall.domain.po.*; |
|
|
|
import com.iformall.enums.*; |
|
|
|
import com.iformall.exception.MallinkException; |
|
|
|
import com.iformall.mapper.*; |
|
|
|
import com.iformall.service.*; |
|
|
|
import com.iformall.service.WxFlowRecordService; |
|
|
|
import com.iformall.service.WxFlowService; |
|
|
|
import com.iformall.service.WxMerchantService; |
|
|
|
import com.iformall.service.WxRentContractService; |
|
|
|
import com.iformall.utils.Constant; |
|
|
|
import com.iformall.utils.DateUtils; |
|
|
|
import org.apache.commons.collections.map.HashedMap; |
|
|
|
@@ -30,6 +33,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import java.io.*; |
|
|
|
@@ -605,6 +609,46 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
record.setStatus(EnumRentContractStatus.INVALID.getCode()); |
|
|
|
wxRentContractMapper.updateRentInvalidStatus(record); |
|
|
|
} |
|
|
|
updateInvalidStatus(wxRentContract); |
|
|
|
} |
|
|
|
|
|
|
|
public void updateInvalidStatus(WxRentContract wxRentContract) { |
|
|
|
WxRentContract record = new WxRentContract(); |
|
|
|
record.setTenantId(wxRentContract.getTenantId()); |
|
|
|
record.setStatus(EnumRentContractStatus.INVALID.getCode()); |
|
|
|
//审核流程中止 |
|
|
|
List<Long> collect = wxRentContractMapper.select(record).stream() |
|
|
|
.map(r -> r.getId()).collect(Collectors.toList()); |
|
|
|
if (!CollectionUtils.isEmpty(collect)) { |
|
|
|
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 = record; |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@@ -1040,40 +1084,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
int allCount = wxRentContractMapper.selectCount(wxRentContract); |
|
|
|
resultData.put("allCount", allCount); |
|
|
|
|
|
|
|
//审核流程中止 |
|
|
|
List<Long> collect = wxRentContractMapper.getRentInvalidList(wxRentContract).stream() |
|
|
|
.map(r -> r.getId()).collect(Collectors.toList()); |
|
|
|
if (!CollectionUtils.isEmpty(collect)) { |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//待签约 |
|
|
|
wxRentContract.setStatus(EnumRentContractStatus.WAIT_SIGN.getCode()); |
|
|
|
int waitSignCount = wxRentContractMapper.queryRentContractWaitSignStatus(wxRentContract); |
|
|
|
|