|
|
|
@@ -255,13 +255,45 @@ public class WxAgileContractController extends WxContractBaseController { |
|
|
|
} |
|
|
|
ResultData result = wxAgileContractService.saveOrUpdate(wxRentContract, user); |
|
|
|
//如果是有效的合同编辑,则复制其他设置到影子合同 |
|
|
|
if (result.code == Result.SUCCESS && null != oldRentContract && isValidEdit) { |
|
|
|
wxAgileContractService.copyContractConfig(false,wxRentContract, oldRentContract, user, false); |
|
|
|
if (result.code == Result.SUCCESS && null != oldRentContract) { |
|
|
|
|
|
|
|
//有效的合同编辑,则复制其他设置到影子合同 |
|
|
|
if(isValidEdit) { |
|
|
|
wxAgileContractService.copyContractConfig(false,wxRentContract, oldRentContract, user, false); |
|
|
|
}else { |
|
|
|
//如果修改了合同时间,则所有费用需要重置。 |
|
|
|
if (isResetFees(wxRentContract,oldRentContract)) { |
|
|
|
wxAgileContractService.deleteContractFees(wxRentContract.getId(),wxRentContract); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private boolean isResetFees(WxRentContract newContract,WxRentContract oldContract) { |
|
|
|
if (newContract.getType().intValue() != oldContract.getType().intValue() || newContract.getDayPriceCalcute().intValue() != oldContract.getDayPriceCalcute().intValue() |
|
|
|
|| (newContract.getDayPriceCalcute().intValue() == oldContract.getDayPriceCalcute().intValue() && newContract.getMonthAverageDays().intValue() != oldContract.getMonthAverageDays().intValue()) |
|
|
|
|| newContract.getRentalStartDate().compareTo(oldContract.getRentalStartDate()) != 0 || newContract.getRentalEndDate().compareTo(oldContract.getRentalEndDate()) != 0) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
Map<Long, BigDecimal> newShopAreaMap = newContract.getRentShopArea(); |
|
|
|
Map<Long, BigDecimal> oldShopAreaMap = oldContract.getRentShopArea(); |
|
|
|
if (newShopAreaMap.size() != oldShopAreaMap.size()) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
for (Iterator<Long> it = newShopAreaMap.keySet().iterator();it.hasNext();) { |
|
|
|
Long shopId = it.next(); |
|
|
|
BigDecimal nsa = newShopAreaMap.get(shopId); |
|
|
|
BigDecimal osa = oldShopAreaMap.get(shopId); |
|
|
|
if (null == osa || nsa.compareTo(nsa) != 0 ) { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
private void handleSaveData(WxRentContract wxRentContract) { |
|
|
|
if (null == wxRentContract.getDayPriceCalcute()) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"请选择日均单价计费规则"); |
|
|
|
|