From fbfb89873a326fd5429a2f21f61e659ab80dc03d Mon Sep 17 00:00:00 2001 From: renkang <8417338+k94314517@user.noreply.gitee.com> Date: 星期二, 03 十二月 2024 19:04:48 +0800 Subject: [PATCH] 客户资料 巡检任务业务 --- server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java | 61 +++++++++++++++++++++++++++--- 1 files changed, 54 insertions(+), 7 deletions(-) diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java index 90cf756..2e5a8ff 100644 --- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java +++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwContractServiceImpl.java @@ -91,6 +91,7 @@ } private void dealRoomsForContract(YwContract model) { + this.dealRoomsValid(model); List<YwContractRoom> list = new ArrayList<>(); for(YwRoom room :model.getRoomList()){ YwContractRoom t = new YwContractRoom(); @@ -106,6 +107,46 @@ } ywContractRoomMapper.insert(list); } + + private void dealRoomsValid(YwContract model){ + List<Integer> roomIds = model.getRoomList().stream().map(i->i.getId()).collect(Collectors.toList()); + if(com.github.xiaoymin.knife4j.core.util.CollectionUtils.isNotEmpty(roomIds)){ + if(ywContractMapper.selectJoinCount(new MPJLambdaWrapper<YwContract>() + .leftJoin(YwContractRoom.class,YwContractRoom::getContractId,YwContract::getId) + .eq(YwContractRoom::getType,Constants.ZERO) + .in(YwContractRoom::getRoomId,roomIds) + .in(YwContract::getStatus,Constants.ZERO,Constants.ONE,Constants.TWO) + .apply(" (" + + " ( t.START_DATE < '"+DateUtil.getFomartDate(model.getEndDate(),"yyyy-MM-dd HH:mm:ss")+"' and t.END_DATE > '"+DateUtil.getFomartDate(model.getStartDate(),"yyyy-MM-dd HH:mm:ss")+"' ) " + + "or " + + " ( t.START_DATE < '"+DateUtil.getFomartDate(model.getEndDate(),"yyyy-MM-dd HH:mm:ss")+"' and t.END_DATE > '"+DateUtil.getFomartDate(model.getStartDate(),"yyyy-MM-dd HH:mm:ss")+"' ) " + + " ) ") + + )>Constants.ZERO){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鎴挎簮宸茶鍗犵敤璇峰埛鏂伴噸璇�"); + }; + + if(ywContractMapper.selectJoinCount(new MPJLambdaWrapper<YwContract>() + .leftJoin(YwContractRoom.class,YwContractRoom::getContractId,YwContract::getId) + .eq(YwContractRoom::getType,Constants.ZERO) + .in(YwContractRoom::getRoomId,roomIds) + .in(YwContract::getStatus,Constants.THREE) + .apply(" ( t.START_DATE < '"+DateUtil.getFomartDate(model.getBtDate(),"yyyy-MM-dd HH:mm:ss")+"' " + + " and t.END_DATE > '"+DateUtil.getFomartDate(model.getStartDate(),"yyyy-MM-dd HH:mm:ss")+"' ) " ) + )>Constants.ZERO){ + throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鎴挎簮宸茶鍗犵敤璇峰埛鏂伴噸璇�"); + }; + + + + } + + + + + + } + @Override public List<YwContractBill> getBillList(YwContract model){ @@ -311,9 +352,6 @@ update.setBtFee(param.getBtFee()); update.setBtRemark(getbackRentRemarkByParam(param)); ywContractMapper.updateById(update); -// if(1==1){ -// throw new BusinessException(ResponseStatus.NOT_ALLOWED); -// } dealLogBiz(param,Constants.YwLogType.CONTRACT_BACK, param.getLoginUserInfo().getRealname(),getbackRentLogByParam(param)); return param.getId(); } @@ -441,12 +479,17 @@ totalBackFee = totalBackFee.add(fee);//绱閫�娆鹃噾棰� } } + List<YwContractBill> ywContractBillList = ywContractBillMapper.selectList(new QueryWrapper<YwContractBill>() + .lambda().eq(YwContractBill::getContractId,param.getId()).orderByDesc(YwContractBill::getId)); + Integer sortNum = ywContractBillList.size(); if(param.getAddBillList()!=null && param.getAddBillList().size()>0){ for(YwContractBill addBill : param.getAddBillList()){ + sortNum = sortNum + 1 ; addBill.setIsdeleted(Constants.ZERO); addBill.setContractId(param.getId()); addBill.setType(Constants.ONE); addBill.setStatus(Constants.ZERO); + addBill.setTotleFee(addBill.getReceivableFee()); if(Constants.equalsInteger(addBill.getFeeType(),Constants.ONE)){ addBill.setStartDate(addBill.getPlanPayDate()); addBill.setEndDate(addBill.getPlanPayDate()); @@ -470,6 +513,7 @@ addBill.setBtUserId(param.getBtUserId()); addBill.setBtSignDate(param.getBtSignDate()); addBill.setBtType(param.getBtType()); + addBill.setSortnum(sortNum ); newBills.add(addBill); } ywContractBillMapper.insert(param.getAddBillList());//鎵归噺鎻掑叆鏁版嵁 @@ -648,12 +692,15 @@ } int num =1; for(int i=0;i<billList1.size();i++){ - billList1.get(i).setSortnum(num); - num++; + if(Constants.equalsInteger( billList1.get(i).getCostType(),Constants.ZERO)){ + billList1.get(i).setSortnum(num++); + } } + num =1; for(int i=0;i<billList2.size();i++){ - billList2.get(i).setSortnum(num); - num++; + if(Constants.equalsInteger( billList2.get(i).getCostType(),Constants.ONE)){ + billList2.get(i).setSortnum(num++); + } } if(model.getId()!=null){ ywContractBillMapper.insert(billList1); -- Gitblit v1.9.3