|
|
|
@@ -321,68 +321,58 @@ public class WxRentContractServiceImpl implements WxRentContractService { |
|
|
|
wxBillRent.setIsPreview(EnumIsPreview.YES.getCode()); |
|
|
|
List<WxBillRent> resultList = wxBillRentMapper.findList(wxBillRent); |
|
|
|
|
|
|
|
// 更新 |
|
|
|
//更新 |
|
|
|
ResultData resultData = getResultDataForUpdate(record, userId); |
|
|
|
if (resultData.code != Result.SUCCESS) { |
|
|
|
return resultData; |
|
|
|
} |
|
|
|
|
|
|
|
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null |
|
|
|
&& !record.getReceivePeriod().equals(0) && !record.getLease().equals(0) && !record.getPrice().equals(0)) { |
|
|
|
if (dbRent.getRentShopType().equals(EnumRentShopType.SHOP.getCode())) { |
|
|
|
//删除预账单,重新生成 |
|
|
|
wxBillRentMapper.deletePreviewBill(record); |
|
|
|
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); |
|
|
|
//有改变,删除预账单,重新生成 |
|
|
|
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null) { |
|
|
|
boolean change = false; |
|
|
|
if (CollectionUtils.isEmpty(resultList)) { |
|
|
|
change = true; |
|
|
|
} else if (record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()) { |
|
|
|
change = true; |
|
|
|
} else { |
|
|
|
boolean change = false; |
|
|
|
if (CollectionUtils.isEmpty(resultList)) { |
|
|
|
change = true; |
|
|
|
} else if (record.getAdjustPeriod().intValue() != dbRent.getAdjustPeriod().intValue()) { |
|
|
|
change = true; |
|
|
|
} else { |
|
|
|
if (record.getReceivePeriod() != null && record.getLease() != null && record.getPrice() != null) { |
|
|
|
if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) { |
|
|
|
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) |
|
|
|
|| !record.getLease().equals(dbRent.getLease()) |
|
|
|
|| !record.getType().equals(dbRent.getType()) |
|
|
|
|| !record.getPrice().equals(dbRent.getPrice()) |
|
|
|
|| !record.getAdjustRatio().replaceAll("\\s*", "").equals(dbRent.getAdjustRatio().replaceAll("\\s*", "")) |
|
|
|
|| !DateUtils.date2String(record.getRentalStartDate(), "yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(), "yyyy-MM-dd")) |
|
|
|
) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
} else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { |
|
|
|
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) |
|
|
|
|| !record.getLease().equals(dbRent.getLease()) |
|
|
|
|| !record.getType().equals(dbRent.getType()) |
|
|
|
|| !record.getRevenue().equals(dbRent.getRevenue()) |
|
|
|
|| !record.getPayRatio().equals(dbRent.getPayRatio()) |
|
|
|
|| !DateUtils.date2String(record.getRentalStartDate(), "yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(), "yyyy-MM-dd")) |
|
|
|
) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
} else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { |
|
|
|
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) |
|
|
|
|| !record.getLease().equals(dbRent.getLease()) |
|
|
|
|| !record.getType().equals(dbRent.getType()) |
|
|
|
|| !record.getPrice().equals(dbRent.getPrice()) |
|
|
|
|| !record.getPayRatio().equals(dbRent.getPayRatio()) |
|
|
|
|| !DateUtils.date2String(record.getRentalStartDate(), "yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(), "yyyy-MM-dd")) |
|
|
|
) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (record.getType().equals(EnumRentContractType.RENT_BY_AREA.getCode())) { |
|
|
|
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) |
|
|
|
|| !record.getLease().equals(dbRent.getLease()) |
|
|
|
|| !record.getType().equals(dbRent.getType()) |
|
|
|
|| !record.getPrice().equals(dbRent.getPrice()) |
|
|
|
|| !record.getAdjustRatio().replaceAll("\\s*", "").equals(dbRent.getAdjustRatio().replaceAll("\\s*", "")) |
|
|
|
|| !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd")) |
|
|
|
) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
} else if (record.getType().equals(EnumRentContractType.RENT_BY_JOINT.getCode())) { |
|
|
|
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) |
|
|
|
|| !record.getLease().equals(dbRent.getLease()) |
|
|
|
|| !record.getType().equals(dbRent.getType()) |
|
|
|
|| !record.getRevenue().equals(dbRent.getRevenue()) |
|
|
|
|| !record.getPayRatio().equals(dbRent.getPayRatio()) |
|
|
|
|| !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd")) |
|
|
|
) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
} else if (record.getType().equals(EnumRentContractType.RENT_BY_AREA_AND_JOINT.getCode())) { |
|
|
|
if (!record.getReceivePeriod().equals(dbRent.getReceivePeriod()) |
|
|
|
|| !record.getLease().equals(dbRent.getLease()) |
|
|
|
|| !record.getType().equals(dbRent.getType()) |
|
|
|
|| !record.getPrice().equals(dbRent.getPrice()) |
|
|
|
|| !record.getPayRatio().equals(dbRent.getPayRatio()) |
|
|
|
|| !DateUtils.date2String(record.getRentalStartDate(),"yyyy-MM-dd").equals(DateUtils.date2String(dbRent.getRentalStartDate(),"yyyy-MM-dd")) |
|
|
|
) { |
|
|
|
change = true; |
|
|
|
} |
|
|
|
} |
|
|
|
//有改变,删除预账单,重新生成 |
|
|
|
if (change) { |
|
|
|
wxBillRentMapper.deletePreviewBill(record); |
|
|
|
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (change) { |
|
|
|
wxBillRentMapper.deletePreviewBill(record); |
|
|
|
resultList = buildRent(new WxMerchant(), null, record, EnumIsPreview.YES.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//启动审批流 |
|
|
|
if(record.getFlowParams() != null){ |
|
|
|
record.getFlowParams().put("businessId",record.getId().toString()); |
|
|
|
@@ -1085,6 +1075,40 @@ 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); |
|
|
|
|