winter 10 месяцев назад
Родитель
Сommit
f6876cd05c
3 измененных файлов: 42 добавлений и 2 удалений
  1. +34
    -2
      mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java
  3. +6
    -0
      mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java

+ 34
- 2
mallinkAdmin/src/main/java/com/iformall/controller/contract/WxAgileContractController.java Просмотреть файл

@@ -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(),"请选择日均单价计费规则");


+ 2
- 0
mallinkService/src/main/java/com/iformall/service/WxAgileContractService.java Просмотреть файл

@@ -90,4 +90,6 @@ public interface WxAgileContractService {
List<WxRentContractYearsVo> getRentContractYears(WxRentContract rentContract);
void deleteContract(Long id,TenantEntity tenantEntity);
void deleteContractFees(Long id,TenantEntity tenantEntity);
}

+ 6
- 0
mallinkService/src/main/java/com/iformall/service/impl/WxAgileContractServiceImpl.java Просмотреть файл

@@ -1459,6 +1459,12 @@ public class WxAgileContractServiceImpl implements WxAgileContractService {
csq.setContractId(id);
wxContractShopMapper.deleteByCondition(csq);
deleteContractFees(id,tenantEntity);
}
@Transactional(rollbackFor = {Exception.class})
@Override
public void deleteContractFees(Long id, TenantEntity tenantEntity) {
WxRentContractAgileDeposit cadq = new WxRentContractAgileDeposit();
cadq.updateTenantInfo(tenantEntity);
cadq.setRentContractId(id);


Загрузка…
Отмена
Сохранить