| @@ -507,7 +507,7 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| } | } | ||||
| try { | try { | ||||
| wxPropertyContractService.renewal(contract,user); | |||||
| wxPropertyContractService.renewal(contract,user,false); | |||||
| }catch(Exception e) { | }catch(Exception e) { | ||||
| logger.error("renewal error.",e); | logger.error("renewal error.",e); | ||||
| return new ResultData(Result.ERROR,e.getMessage()); | return new ResultData(Result.ERROR,e.getMessage()); | ||||
| @@ -599,35 +599,16 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| //转签 | //转签 | ||||
| @PostMapping("transfer") | @PostMapping("transfer") | ||||
| public ResultData transfer(@RequestBody WxRentContract wxRentContract) { | public ResultData transfer(@RequestBody WxRentContract wxRentContract) { | ||||
| if (null == wxRentContract.getCustomerType() || StringUtils.isBlank(wxRentContract.getCustomerName()) || StringUtils.isBlank(wxRentContract.getCustomerPhone())){ | |||||
| if (null == wxRentContract.getId() || null == wxRentContract.getCustomerType() || | |||||
| StringUtils.isBlank(wxRentContract.getCustomerName()) || StringUtils.isBlank(wxRentContract.getCustomerPhone())){ | |||||
| return new ResultData(Result.ERROR, "缺少参数"); | return new ResultData(Result.ERROR, "缺少参数"); | ||||
| } | } | ||||
| if (null == wxRentContract.getRentalStartDate() || null == wxRentContract.getRentalEndDate()){ | |||||
| return new ResultData(Result.ERROR, "请选择租赁开始日期和截止日期"); | |||||
| } | |||||
| if (null == wxRentContract.getStartDate()){ | |||||
| return new ResultData(Result.ERROR, "请选择计租日期"); | |||||
| } | |||||
| if (null == wxRentContract.getSignDate()){ | |||||
| return new ResultData(Result.ERROR, "请选择签约日期"); | |||||
| } | |||||
| WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | WxRentContract rentContract = wxRentContractMapper.selectById(wxRentContract.getId()); | ||||
| if (null == rentContract) { | if (null == rentContract) { | ||||
| return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); | return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); | ||||
| } | } | ||||
| if (!(rentContract.getRentalEndDate().before(wxRentContract.getRentalStartDate()))) { | |||||
| return new ResultData(Result.ERROR, "续租合同开始日期要大于原合同截止日期"); | |||||
| } | |||||
| if (rentContract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { | |||||
| return new ResultData(Result.ERROR,"租金合同未完善,请先完善。"); | |||||
| } | |||||
| if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | ||||
| if (null == wxRentContract.getPropertyId()) { | if (null == wxRentContract.getPropertyId()) { | ||||
| return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); | return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); | ||||
| @@ -72,7 +72,7 @@ public interface WxPropertyContractService { | |||||
| ResultData apply(WxPropertyContract wxPropertyContract,MallUserInfo user); | ResultData apply(WxPropertyContract wxPropertyContract,MallUserInfo user); | ||||
| void renewal(WxPropertyContract wxPropertyContract,MallUserInfo user); | |||||
| void renewal(WxPropertyContract wxPropertyContract,MallUserInfo user,boolean aliasRentContract); | |||||
| void outDateContract(WxMall wxMall); | void outDateContract(WxMall wxMall); | ||||
| @@ -1452,7 +1452,7 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| @Override | @Override | ||||
| @Transactional(rollbackFor = {Exception.class}) | @Transactional(rollbackFor = {Exception.class}) | ||||
| public void renewal(WxPropertyContract record, MallUserInfo user) { | |||||
| public void renewal(WxPropertyContract record, MallUserInfo user,boolean aliasRentContract) { | |||||
| final IdWorker idWorker = IdWorker.get(); | final IdWorker idWorker = IdWorker.get(); | ||||
| Long newContractId = idWorker.nextId(); | Long newContractId = idWorker.nextId(); | ||||
| //拷贝 | //拷贝 | ||||
| @@ -1485,8 +1485,13 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| record.setFirstBillReceiveDate(null); | record.setFirstBillReceiveDate(null); | ||||
| int[] array = DateUtils.getDiff(record.getRentalStartDate(),record.getRentalEndDate()); | int[] array = DateUtils.getDiff(record.getRentalStartDate(),record.getRentalEndDate()); | ||||
| record.setLease(array[0]); | record.setLease(array[0]); | ||||
| record.setRentContractId(null); | |||||
| record.setCreateType(EnumPropertyCreateType.BY_SHOP.getCode()); | |||||
| if (aliasRentContract) { | |||||
| //record.setRentContractId(null); | |||||
| record.setCreateType(EnumPropertyCreateType.BY_RENT.getCode()); | |||||
| }else { | |||||
| record.setRentContractId(null); | |||||
| record.setCreateType(EnumPropertyCreateType.BY_SHOP.getCode()); | |||||
| } | |||||
| wxPropertyContractMapper.insert(record); | wxPropertyContractMapper.insert(record); | ||||
| } | } | ||||
| @@ -2087,7 +2087,8 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| propertyContract.setSignDate(rentContract.getSignDate()); | propertyContract.setSignDate(rentContract.getSignDate()); | ||||
| propertyContract.setStartDate(rentContract.getStartDate()); | propertyContract.setStartDate(rentContract.getStartDate()); | ||||
| propertyContract.setEndDate(rentContract.getStartDate()); | propertyContract.setEndDate(rentContract.getStartDate()); | ||||
| wxPropertyContractService.renewal(propertyContract, user); | |||||
| propertyContract.setRentContractId(newContractId); | |||||
| wxPropertyContractService.renewal(propertyContract, user,true); | |||||
| } | } | ||||
| } | } | ||||