| @@ -389,6 +389,62 @@ public class WxAgileContractController extends WxContractBaseController { | |||||
| record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | record.setSortColumns(BaseEntity.SortField.CreateDate_DESC); | ||||
| return new ResultData(wxAgileContractService.getContractCustomersList(record, pageNum, pageSize)); | return new ResultData(wxAgileContractService.getContractCustomersList(record, pageNum, pageSize)); | ||||
| } | } | ||||
| /** | |||||
| * 续签 | |||||
| */ | |||||
| @PostMapping("renewal") | |||||
| public ResultData renewal(@RequestBody WxRentContract wxRentContract) { | |||||
| if (null == wxRentContract.getId()){ | |||||
| return new ResultData(Result.ERROR, "合同ID不能为空"); | |||||
| } | |||||
| 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()); | |||||
| if (null == rentContract) { | |||||
| return new ResultData(Result.ERROR, "编号["+wxRentContract.getId()+"]未找到租金合同"); | |||||
| } | |||||
| if (!(rentContract.getRentalEndDate().before(wxRentContract.getRentalStartDate()))) { | |||||
| return new ResultData(Result.ERROR, "续租合同开始日期要大于原合同截止日期"); | |||||
| } | |||||
| MallUserInfo user = getUser(); | |||||
| rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); | |||||
| rentContract.setRentalEndDate(wxRentContract.getRentalEndDate()); | |||||
| rentContract.setSignDate(wxRentContract.getSignDate()); | |||||
| rentContract.setStartDate(wxRentContract.getStartDate()); | |||||
| rentContract.setEndDate(wxRentContract.getStartDate()); | |||||
| rentContract.setFixStartDate(wxRentContract.getFixStartDate()); | |||||
| rentContract.setFixEndDate(wxRentContract.getFixEndDate()); | |||||
| try { | |||||
| rentContractValidShop(rentContract); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| try { | |||||
| wxAgileContractService.renewalAgile(rentContract,user); | |||||
| }catch(Exception e) { | |||||
| logger.error("renewal error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| } | } | ||||
| @@ -292,7 +292,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| @PostMapping("/unvalid") | @PostMapping("/unvalid") | ||||
| @SystemControllerLog(description = "物业合同-作废合同") | |||||
| public ResultData unvalid(@RequestBody WxPropertyContract proertyContract) { | public ResultData unvalid(@RequestBody WxPropertyContract proertyContract) { | ||||
| WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | ||||
| if (null == contract) { | if (null == contract) { | ||||
| @@ -339,7 +338,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| * @return | * @return | ||||
| */ | */ | ||||
| @PostMapping("setEndContractTime") | @PostMapping("setEndContractTime") | ||||
| @SystemControllerLog(description = "物业合同-设置定时终止合同时间") | |||||
| public ResultData setEndContractTime(@RequestBody WxPropertyContract proertyContract) { | public ResultData setEndContractTime(@RequestBody WxPropertyContract proertyContract) { | ||||
| wxPropertyContractService.setEndContractTime(proertyContract); | wxPropertyContractService.setEndContractTime(proertyContract); | ||||
| return new ResultData(); | return new ResultData(); | ||||
| @@ -347,7 +345,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| @PostMapping("effective") | @PostMapping("effective") | ||||
| @ApiImplicitParams({}) | @ApiImplicitParams({}) | ||||
| @SystemControllerLog(description = "物业合同-合同生效") | |||||
| public ResultData effective(@RequestBody WxPropertyContract proertyContract) { | public ResultData effective(@RequestBody WxPropertyContract proertyContract) { | ||||
| WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | ||||
| if (null == contract) { | if (null == contract) { | ||||
| @@ -416,7 +413,6 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| } | } | ||||
| @PostMapping("apply") | @PostMapping("apply") | ||||
| @SystemControllerLog(description = "物业合同-提交审批") | |||||
| public ResultData apply(@RequestBody WxPropertyContract proertyContract) { | public ResultData apply(@RequestBody WxPropertyContract proertyContract) { | ||||
| MallUserInfo user = getUser(); | MallUserInfo user = getUser(); | ||||
| WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | ||||
| @@ -460,6 +456,66 @@ public class WxPropertyContractController extends WxContractBaseController { | |||||
| return wxPropertyContractService.apply(contract,user); | return wxPropertyContractService.apply(contract,user); | ||||
| } | } | ||||
| @PostMapping("renewal") | |||||
| public ResultData renewal(@RequestBody WxPropertyContract proertyContract) { | |||||
| MallUserInfo user = getUser(); | |||||
| if (null == proertyContract.getId()){ | |||||
| return new ResultData(Result.ERROR, "合同ID不能为空"); | |||||
| } | |||||
| if (null == proertyContract.getRentalStartDate() || null == proertyContract.getRentalEndDate()){ | |||||
| return new ResultData(Result.ERROR, "请选择租赁开始日期和截止日期"); | |||||
| } | |||||
| if (null == proertyContract.getStartDate()){ | |||||
| return new ResultData(Result.ERROR, "请选择计租日期"); | |||||
| } | |||||
| if (null == proertyContract.getSignDate()){ | |||||
| return new ResultData(Result.ERROR, "请选择签约日期"); | |||||
| } | |||||
| WxPropertyContract contract = wxPropertyContractService.getSimpleDetail(proertyContract.getId()); | |||||
| if (null == contract) { | |||||
| return new ResultData(Result.ERROR, "编号["+contract.getContractNumber()+"]未找到租金合同"); | |||||
| } | |||||
| if (contract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | |||||
| return new ResultData(Result.ERROR, "编号["+contract.getContractNumber()+"]未找到租金合同"); | |||||
| } | |||||
| if (!(contract.getRentalEndDate().before(proertyContract.getRentalStartDate()))) { | |||||
| return new ResultData(Result.ERROR, "续租合同开始日期要大于原合同截止日期"); | |||||
| } | |||||
| if (contract.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { | |||||
| return new ResultData(Result.ERROR,"租金合同未完善,请先完善。"); | |||||
| } | |||||
| contract.setRentalStartDate(proertyContract.getRentalStartDate()); | |||||
| contract.setRentalEndDate(proertyContract.getRentalEndDate()); | |||||
| contract.setSignDate(proertyContract.getSignDate()); | |||||
| contract.setStartDate(proertyContract.getStartDate()); | |||||
| contract.setEndDate(proertyContract.getStartDate()); | |||||
| try { | |||||
| propertyContractValidShop(contract); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| try { | |||||
| wxPropertyContractService.renewal(contract,user); | |||||
| }catch(Exception e) { | |||||
| logger.error("renewal error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @GetMapping("/del") | @GetMapping("/del") | ||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | ||||
| @@ -525,6 +525,79 @@ public class WxRentContractController extends WxContractBaseController { | |||||
| return wxRentContractService.apply(rentContract,user); | return wxRentContractService.apply(rentContract,user); | ||||
| } | } | ||||
| //续签 | |||||
| @PostMapping("renewal") | |||||
| public ResultData renewal(@RequestBody WxRentContract wxRentContract) { | |||||
| if (null == wxRentContract.getId()){ | |||||
| return new ResultData(Result.ERROR, "合同ID不能为空"); | |||||
| } | |||||
| 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()); | |||||
| if (null == rentContract) { | |||||
| 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 (null == wxRentContract.getPropertyId()) { | |||||
| return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); | |||||
| } | |||||
| WxPropertyContract property = wxPropertyContractService.getSimpleDetail(wxRentContract.getPropertyId()); | |||||
| if (null == property) { | |||||
| return new ResultData(Result.ERROR,"未创建物业合同,请先完善。"); | |||||
| } | |||||
| if (property.getStatus().intValue() == EnumRentContractStatus.UNWRITE.getCode().intValue()) { | |||||
| return new ResultData(Result.ERROR,"物业合同未完善,请先完善。"); | |||||
| } | |||||
| } | |||||
| MallUserInfo user = getUser(); | |||||
| rentContract.setRentalStartDate(wxRentContract.getRentalStartDate()); | |||||
| rentContract.setRentalEndDate(wxRentContract.getRentalEndDate()); | |||||
| rentContract.setSignDate(wxRentContract.getSignDate()); | |||||
| rentContract.setStartDate(wxRentContract.getStartDate()); | |||||
| rentContract.setEndDate(wxRentContract.getStartDate()); | |||||
| rentContract.setFixStartDate(wxRentContract.getFixStartDate()); | |||||
| rentContract.setFixEndDate(wxRentContract.getFixEndDate()); | |||||
| try { | |||||
| rentContractValidShop(rentContract); | |||||
| } catch (Exception e) { | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| try { | |||||
| wxRentContractService.renewal(rentContract,user); | |||||
| }catch(Exception e) { | |||||
| logger.error("renewal error.",e); | |||||
| return new ResultData(Result.ERROR,e.getMessage()); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @GetMapping("getRentContractList") | @GetMapping("getRentContractList") | ||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @@ -46,4 +46,6 @@ public interface WxAgileContractService { | |||||
| WxContractCustomers findCustomers(TenantEntity tenantEntity,Long customerId); | WxContractCustomers findCustomers(TenantEntity tenantEntity,Long customerId); | ||||
| PageInfo<WxContractCustomers> getContractCustomersList(WxContractCustomers record, Integer pageIndex, Integer pageSize); | PageInfo<WxContractCustomers> getContractCustomersList(WxContractCustomers record, Integer pageIndex, Integer pageSize); | ||||
| void renewalAgile(WxRentContract wxRentContract,MallUserInfo user); | |||||
| } | } | ||||
| @@ -72,6 +72,8 @@ public interface WxPropertyContractService { | |||||
| ResultData apply(WxPropertyContract wxPropertyContract,MallUserInfo user); | ResultData apply(WxPropertyContract wxPropertyContract,MallUserInfo user); | ||||
| void renewal(WxPropertyContract wxPropertyContract,MallUserInfo user); | |||||
| void outDateContract(WxMall wxMall); | void outDateContract(WxMall wxMall); | ||||
| void readyToNomal(WxMall wxMall); | void readyToNomal(WxMall wxMall); | ||||
| @@ -120,7 +120,9 @@ public interface WxRentContractService { | |||||
| ResultData getContractByContractNumber(WxRentContract wxRentContract); | ResultData getContractByContractNumber(WxRentContract wxRentContract); | ||||
| ResultData apply(WxRentContract wxRentContract,MallUserInfo user); | ResultData apply(WxRentContract wxRentContract,MallUserInfo user); | ||||
| void renewal(WxRentContract wxRentContract,MallUserInfo user); | |||||
| /** | /** | ||||
| * 合同正常到期 | * 合同正常到期 | ||||
| * @param | * @param | ||||
| @@ -20,6 +20,7 @@ import com.iformall.domain.po.WxRentContractAgileDeposit; | |||||
| import com.iformall.domain.po.WxRentContractAgileDepositShop; | import com.iformall.domain.po.WxRentContractAgileDepositShop; | ||||
| import com.iformall.domain.po.WxRentContractAgileUnDeposit; | import com.iformall.domain.po.WxRentContractAgileUnDeposit; | ||||
| import com.iformall.domain.po.WxRentContractAgileUnDepositItem; | import com.iformall.domain.po.WxRentContractAgileUnDepositItem; | ||||
| import com.iformall.domain.po.WxRentContractRevenueJump; | |||||
| import com.iformall.domain.po.WxShop; | import com.iformall.domain.po.WxShop; | ||||
| import com.iformall.domain.po.WxShopUsers; | import com.iformall.domain.po.WxShopUsers; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| @@ -832,5 +833,129 @@ public class WxAgileContractServiceImpl implements WxAgileContractService { | |||||
| PageInfo<WxContractCustomers> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxContractCustomersMapper.findList(record)); | PageInfo<WxContractCustomers> pageInfo = PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxContractCustomersMapper.findList(record)); | ||||
| return pageInfo; | return pageInfo; | ||||
| } | } | ||||
| @Override | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public void renewalAgile(WxRentContract rentContract,MallUserInfo user) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| Long newContractId = idWorker.nextId(); | |||||
| //拷贝 | |||||
| WxContractShop csq = new WxContractShop(); | |||||
| csq.updateTenantInfo(rentContract); | |||||
| csq.setContractId(rentContract.getId()); | |||||
| List<WxContractShop> csqlist = wxContractShopMapper.findList(csq); | |||||
| if (null != csqlist && csqlist.size() > 0 ){ | |||||
| for ( int i = 0 ; i< csqlist.size() ; i ++) { | |||||
| WxContractShop cs = csqlist.get(i); | |||||
| cs.setId(idWorker.nextId()); | |||||
| cs.setContractId(newContractId); | |||||
| cs.setCreateDate(new Date()); | |||||
| cs.setUpdateDate(new Date()); | |||||
| wxContractShopMapper.insert(cs); | |||||
| } | |||||
| } | |||||
| //WxContractCustomers ccq = new WxContractCustomers(); | |||||
| WxRentContractAgileDeposit cadq = new WxRentContractAgileDeposit(); | |||||
| cadq.updateTenantInfo(rentContract); | |||||
| cadq.setRentContractId(rentContract.getId()); | |||||
| List<WxRentContractAgileDeposit> depositList = wxRentContractAgileDepositMapper.findList(cadq); | |||||
| if (null != depositList && depositList.size() > 0 ){ | |||||
| for ( int i = 0 ; i< depositList.size() ; i ++) { | |||||
| WxRentContractAgileDeposit rad = depositList.get(i); | |||||
| Long oldId = rad.getId(); | |||||
| rad.setId(idWorker.nextId()); | |||||
| rad.setRentContractId(newContractId); | |||||
| rad.setCreatetime(new Date()); | |||||
| rad.setUpdatetime(new Date()); | |||||
| wxRentContractAgileDepositMapper.insert(rad); | |||||
| WxRentContractAgileDepositShop radsq = new WxRentContractAgileDepositShop(); | |||||
| radsq.updateTenantInfo(rentContract); | |||||
| radsq.setRentContractId(rentContract.getId()); | |||||
| radsq.setRentDepositId(oldId); | |||||
| List<WxRentContractAgileDepositShop> dslist = wxRentContractAgileDepositShopMapper.findList(radsq); | |||||
| if (null != dslist && dslist.size() > 0 ){ | |||||
| for ( int j = 0 ; j< dslist.size() ; j ++) { | |||||
| WxRentContractAgileDepositShop ds = dslist.get(j); | |||||
| ds.setId(idWorker.nextId()); | |||||
| ds.setRentContractId(newContractId); | |||||
| ds.setRentDepositId(rad.getId()); | |||||
| ds.setCreatetime(new Date()); | |||||
| ds.setUpdatetime(new Date()); | |||||
| wxRentContractAgileDepositShopMapper.insert(ds); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| WxRentContractAgileUnDeposit raudq = new WxRentContractAgileUnDeposit(); | |||||
| raudq.updateTenantInfo(rentContract); | |||||
| raudq.setRentContractId(rentContract.getId()); | |||||
| List<WxRentContractAgileUnDeposit> undepositList = wxRentContractAgileUnDepositMapper.findList(raudq); | |||||
| if (null != undepositList && undepositList.size() > 0 ) { | |||||
| for ( int i = 0 ; i< undepositList.size() ; i ++) { | |||||
| WxRentContractAgileUnDeposit raud = undepositList.get(i); | |||||
| raud.setId(idWorker.nextId()); | |||||
| raud.setRentContractId(newContractId); | |||||
| raud.setCreatetime(new Date()); | |||||
| raud.setUpdatetime(new Date()); | |||||
| wxRentContractAgileUnDepositMapper.insert(raud); | |||||
| if (raud.getSettingMethod().intValue() == EnumRentContractAgilSettingMethod.BY_CONTRACT.getCode().intValue()) { | |||||
| WxRentContractAgileUnDepositItem item = generateUnDepositItem(idWorker,rentContract,raud.getId(),raud.getFeesId(),null); | |||||
| wxRentContractAgileUnDepositItemMapper.insert(item); | |||||
| }else { | |||||
| List<Long> shopIdList = rentContract.shopIdsByRentInfo(); | |||||
| for (int j = 0 ; j < shopIdList.size(); j++ ){ | |||||
| WxRentContractAgileUnDepositItem item = generateUnDepositItem(idWorker,rentContract,raud.getId(),raud.getFeesId(),shopIdList.get(j)); | |||||
| wxRentContractAgileUnDepositItemMapper.insert(item); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| rentContract.setId(newContractId); | |||||
| rentContract.setCreatetime(new Date()); | |||||
| rentContract.setCreateBy(user.getId()); | |||||
| rentContract.setCreateByName(user.getName()); | |||||
| rentContract.setUpdatetime(new Date()); | |||||
| rentContract.setUpdateBy(user.getId()); | |||||
| rentContract.setUpdateByName(user.getName()); | |||||
| rentContract.setStatus(EnumRentContractStatus.DRAFT.getCode()); | |||||
| rentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||||
| rentContract.setEndContractTime(null); | |||||
| rentContract.setFirstBillDateStart(null); | |||||
| rentContract.setFirstBillDateEnd(null); | |||||
| rentContract.setFirstBillReceiveDate(null); | |||||
| int[] array = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); | |||||
| rentContract.setLease(array[0]); | |||||
| //rentContract.setAdjustRatio(); | |||||
| //rentContract.setRevenueRatioSet(); | |||||
| //rentContract.set | |||||
| wxRentContractMapper.insert(rentContract); | |||||
| } | |||||
| private WxRentContractAgileUnDepositItem generateUnDepositItem(IdWorker idWorker,WxRentContract rentContract,Long undepositId,Long feesId,Long shopId) { | |||||
| WxRentContractAgileUnDepositItem raudi = new WxRentContractAgileUnDepositItem(); | |||||
| raudi.setId(idWorker.nextId()); | |||||
| raudi.updateTenantInfo(rentContract); | |||||
| raudi.setRentContractId(rentContract.getId()); | |||||
| raudi.setUnDepositId(undepositId); | |||||
| raudi.setFeesId(feesId); | |||||
| raudi.setShopId(shopId); | |||||
| raudi.setBeginTime(rentContract.getRentalStartDate()); | |||||
| raudi.setEndTime(rentContract.getRentalEndDate()); | |||||
| raudi.setPrice("0"); | |||||
| raudi.setPriceUnit(EnumRentContractAgilPriceUnit.MM_MONTH.getCode()); | |||||
| raudi.setCreatetime(new Date()); | |||||
| raudi.setUpdatetime(new Date()); | |||||
| raudi.setIsFree(EnumYesOrNo.NO.getCode()); | |||||
| raudi.setRentArea(rentContract.getRentArea()); | |||||
| raudi.setIsFather(EnumYesOrNo.YES.getCode()); | |||||
| return raudi; | |||||
| } | |||||
| } | } | ||||
| @@ -1449,6 +1449,46 @@ public class WxPropertyContractServiceImpl implements WxPropertyContractService | |||||
| return new ResultData(Result.ERROR, "编号["+record.getId()+"]物业合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); | return new ResultData(Result.ERROR, "编号["+record.getId()+"]物业合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); | ||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public void renewal(WxPropertyContract record, MallUserInfo user) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| Long newContractId = idWorker.nextId(); | |||||
| //拷贝 | |||||
| WxContractShop csq = new WxContractShop(); | |||||
| csq.updateTenantInfo(record); | |||||
| csq.setContractId(record.getId()); | |||||
| List<WxContractShop> csqlist = wxContractShopMapper.findList(csq); | |||||
| if (null != csqlist && csqlist.size() > 0 ){ | |||||
| for ( int i = 0 ; i< csqlist.size() ; i ++) { | |||||
| WxContractShop cs = csqlist.get(i); | |||||
| cs.setId(idWorker.nextId()); | |||||
| cs.setContractId(newContractId); | |||||
| cs.setCreateDate(new Date()); | |||||
| cs.setUpdateDate(new Date()); | |||||
| wxContractShopMapper.insert(cs); | |||||
| } | |||||
| } | |||||
| record.setId(newContractId); | |||||
| record.setCreatetime(new Date()); | |||||
| record.setCreateBy(user.getId()); | |||||
| record.setCreateByName(user.getName()); | |||||
| record.setUpdatetime(new Date()); | |||||
| record.setUpdateBy(user.getId()); | |||||
| record.setUpdateByName(user.getName()); | |||||
| record.setStatus(EnumRentContractStatus.UNWRITE.getCode()); | |||||
| record.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||||
| record.setEndContractTime(null); | |||||
| record.setFirstBillDateStart(null); | |||||
| record.setFirstBillDateEnd(null); | |||||
| record.setFirstBillReceiveDate(null); | |||||
| int[] array = DateUtils.getDiff(record.getRentalStartDate(),record.getRentalEndDate()); | |||||
| record.setLease(array[0]); | |||||
| record.setRentContractId(null); | |||||
| record.setCreateType(EnumPropertyCreateType.BY_SHOP.getCode()); | |||||
| wxPropertyContractMapper.insert(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public void outDateContract(WxMall wxMall) { | public void outDateContract(WxMall wxMall) { | ||||
| @@ -2012,7 +2012,87 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return new ResultData(Result.ERROR, "编号["+rentContract.getId()+"]租金合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); | return new ResultData(Result.ERROR, "编号["+rentContract.getId()+"]租金合同状态不能提交审批.允许提交的状态为 [草稿],[履约中+审批驳回]"); | ||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| @Transactional(rollbackFor = {Exception.class}) | |||||
| public void renewal(WxRentContract rentContract,MallUserInfo user) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| Long newContractId = idWorker.nextId(); | |||||
| //拷贝 | |||||
| WxContractShop csq = new WxContractShop(); | |||||
| csq.updateTenantInfo(rentContract); | |||||
| csq.setContractId(rentContract.getId()); | |||||
| List<WxContractShop> csqlist = wxContractShopMapper.findList(csq); | |||||
| if (null != csqlist && csqlist.size() > 0 ){ | |||||
| for ( int i = 0 ; i< csqlist.size() ; i ++) { | |||||
| WxContractShop cs = csqlist.get(i); | |||||
| cs.setId(idWorker.nextId()); | |||||
| cs.setContractId(newContractId); | |||||
| cs.setCreateDate(new Date()); | |||||
| cs.setUpdateDate(new Date()); | |||||
| wxContractShopMapper.insert(cs); | |||||
| } | |||||
| } | |||||
| //WxContractCustomers ccq = new WxContractCustomers(); | |||||
| WxRentContractRevenueJump crjq = new WxRentContractRevenueJump(); | |||||
| crjq.updateTenantInfo(rentContract); | |||||
| crjq.setRentContractId(rentContract.getId()); | |||||
| List<WxRentContractRevenueJump> jumpList = wxRentContractRevenueJumpMapper.findList(crjq); | |||||
| if ( null != jumpList && jumpList.size() > 0 ) { | |||||
| for (int i = 0 ; i < jumpList.size(); i++) { | |||||
| WxRentContractRevenueJump rj = jumpList.get(i); | |||||
| rj.setRentContractId(newContractId); | |||||
| rj.setId(idWorker.nextId()); | |||||
| rj.setCreateTime(new Date()); | |||||
| rj.setUpdateTime(new Date()); | |||||
| wxRentContractRevenueJumpMapper.insert(rj); | |||||
| } | |||||
| } | |||||
| //WxRentContractFreePeriod cfpq = new WxRentContractFreePeriod(); | |||||
| Long oldId = rentContract.getId(); | |||||
| rentContract.setId(newContractId); | |||||
| rentContract.setCreatetime(new Date()); | |||||
| rentContract.setCreateBy(user.getId()); | |||||
| rentContract.setCreateByName(user.getName()); | |||||
| rentContract.setUpdatetime(new Date()); | |||||
| rentContract.setUpdateBy(user.getId()); | |||||
| rentContract.setUpdateByName(user.getName()); | |||||
| rentContract.setStatus(EnumRentContractStatus.UNWRITE.getCode()); | |||||
| rentContract.setApplyStatus(EnumRentContractAppStatus.DEFAULT.getCode()); | |||||
| rentContract.setEndContractTime(null); | |||||
| rentContract.setFirstBillDateStart(null); | |||||
| rentContract.setFirstBillDateEnd(null); | |||||
| rentContract.setFirstBillReceiveDate(null); | |||||
| int[] array = DateUtils.getDiff(rentContract.getRentalStartDate(),rentContract.getRentalEndDate()); | |||||
| rentContract.setLease(array[0]); | |||||
| //rentContract.setAdjustRatio(); | |||||
| //rentContract.setRevenueRatioSet(); | |||||
| //rentContract.set | |||||
| wxRentContractMapper.insert(rentContract); | |||||
| if (rentContract.getOperationType().intValue() == EnumContractOperationType.WHOLE.getCode().intValue()) { | |||||
| WxPropertyContract pq = new WxPropertyContract(); | |||||
| pq.updateTenantInfo(rentContract); | |||||
| pq.setOperationType(EnumContractOperationType.WHOLE.getCode()); | |||||
| pq.setRentContractId(oldId); | |||||
| List<WxPropertyContract> pclist = wxPropertyContractService.findList(pq); | |||||
| if (null != pclist && pclist.size() > 0 ) { | |||||
| WxPropertyContract propertyContract = pclist.get(0); | |||||
| propertyContract.setRentalStartDate(rentContract.getRentalStartDate()); | |||||
| propertyContract.setRentalEndDate(rentContract.getRentalEndDate()); | |||||
| propertyContract.setSignDate(rentContract.getSignDate()); | |||||
| propertyContract.setStartDate(rentContract.getStartDate()); | |||||
| propertyContract.setEndDate(rentContract.getStartDate()); | |||||
| wxPropertyContractService.renewal(propertyContract, user); | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| public void outDateContract(WxMall wxMall) { | public void outDateContract(WxMall wxMall) { | ||||
| try { | try { | ||||
| @@ -2495,19 +2575,6 @@ public class WxRentContractServiceImpl implements WxRentContractService { | |||||
| return unitPropertyPrice; | return unitPropertyPrice; | ||||
| } | } | ||||
| public static void main(String[] args) { | |||||
| Date startDate = DateUtils.stringToDate("2023-12-20 00:00:00", DateUtils.DATE_TIME_PATTERN); | |||||
| Date endDate = DateUtils.stringToDate("2024-12-19 00:00:00", DateUtils.DATE_TIME_PATTERN); | |||||
| int days = DateUtils.daysBetween(startDate, endDate)+1; | |||||
| System.out.println(days); | |||||
| Date realEndStart = DateUtils.getDaySet(endDate, Calendar.SECOND, 1); | |||||
| int[] diffs = DateUtils.getDiff(startDate, realEndStart); | |||||
| Date preextraStartDay = DateUtils.getTimeAfterMonths(diffs[0], startDate); | |||||
| int predays = DateUtils.daysBetween(preextraStartDay, endDate)+1; | |||||
| System.out.println(diffs[0]+">>>>" +diffs[1]+ ">>>>"+predays); | |||||
| } | |||||
| private BigDecimal[] calcuteReveneuJump(BigDecimal sales,WxRentContract rentcontract,Date startDate,Date endDate,List<Date> freePeriods) { | private BigDecimal[] calcuteReveneuJump(BigDecimal sales,WxRentContract rentcontract,Date startDate,Date endDate,List<Date> freePeriods) { | ||||
| BigDecimal revenueDecimal = new BigDecimal(0); | BigDecimal revenueDecimal = new BigDecimal(0); | ||||
| BigDecimal rentDecimal = new BigDecimal(0); | BigDecimal rentDecimal = new BigDecimal(0); | ||||