| | |
| | | @Autowired |
| | | private MultifileMapper multifileMapper; |
| | | @Autowired |
| | | private YwWorkorderLogMapper ywWorkorderLogMapper; |
| | | @Autowired |
| | | private CompanyMapper companyMapper; |
| | | @Autowired |
| | | private YwProjectMapper projectMapper; |
| | |
| | | ywContractMapper.insert(model); |
| | | dealDetailListBiz(model);//处理条款信息 |
| | | dealMultifileBiz(model);//处理附件信息 |
| | | dealLogBiz(model,Constants.YwLogType.CONTRACT_CREATE,null,null);//记录新建日志 |
| | | return model.getId(); |
| | | } |
| | | /** |
| | | * 退租提交 |
| | | * @param model |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = {BusinessException.class,Exception.class}) |
| | | public Integer backRent(YwContract model){ |
| | | isParamValidCreated(model); |
| | | |
| | | model.setCreator(model.getLoginUserInfo().getId()); |
| | | model.setIsdeleted(Constants.ZERO); |
| | | model.setCreateDate(new Date()); |
| | | model.setStatus(Constants.ZERO); |
| | | model.setEditDate(model.getCreateDate()); |
| | | model.setEditor(model.getCreator()); |
| | | model.setStatus(Constants.ZERO);//待执行 |
| | | ywContractMapper.insert(model); |
| | | dealDetailListBiz(model);//处理条款信息 |
| | | dealMultifileBiz(model);//处理附件信息 |
| | | dealLogBiz(model,Constants.YwLogType.CONTRACT_CREATE,null,null);//记录新建日志 |
| | | return model.getId(); |
| | | } |
| | | |
| | |
| | | this.updateById(ywContract); |
| | | } |
| | | } |
| | | |
| | | private void dealLogBiz(YwContract model,Constants.YwLogType type,String param1,String param2) { |
| | | YwWorkorderLog log = new YwWorkorderLog(); |
| | | log.setCreateDate(model.getEditDate()); |
| | | log.setCreator(model.getCreator()); |
| | | log.setJobId(model.getId()); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | log.setObjId(model.getId()+""); |
| | | log.setObjType(type.getKey()); |
| | | log.setParam1(param1); |
| | | log.setParam2(param2); |
| | | log.setTitle(type.getNoteinfo()); |
| | | ywWorkorderLogMapper.insert(log); |
| | | } |
| | | @Override |
| | | public YwContract findById(Integer id) { |
| | | MPJLambdaWrapper<YwContract> queryWrapper = new MPJLambdaWrapper<>(); |
| | |
| | | .leftJoin(YwCustomer.class,YwCustomer::getId,YwContract::getRenterId); |
| | | YwContract model = ywContractMapper.selectJoinOne(YwContract.class,queryWrapper); |
| | | if(model != null){ |
| | | //合同附件 |
| | | initFiles(model); |
| | | //查询房源信息数据 |
| | | MPJLambdaWrapper<YwRoom> rw = new MPJLambdaWrapper<>(); |
| | | rw.selectAll(YwRoom.class ) |
| | | .selectAs(YwProject::getName,YwRoom::getProjectName) |
| | | .selectAs(YwFloor::getName,YwRoom::getFloorName) |
| | | .selectAs(YwBuilding::getName,YwRoom::getBuildingName) |
| | | .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId) |
| | | .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId) |
| | | .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor) |
| | | .eq(YwRoom::getIsdeleted,Constants.ZERO) |
| | | .exists("(select a.id from yw_contract_room a where a.isdeleted=1 and a.room_id=t.id and a.contract_id="+model.getId()+")"); |
| | | model.setRoomList(roomMapper.selectJoinList(YwRoom.class,rw)); |
| | | |
| | | //查询租賃条款信息 |
| | | MPJLambdaWrapper<YwContractDetail> dw = new MPJLambdaWrapper<>(); |
| | | dw.selectAll(YwContractDetail.class ) |
| | | .eq(YwContractDetail::getIsdeleted,Constants.ZERO) |
| | | .eq(YwContractDetail::getContractId,model.getId()) |
| | | .in(YwContractDetail::getType,Constants.ZERO,Constants.TWO) |
| | | .orderByAsc(YwContractDetail::getSortnum); |
| | | model.setZlDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class,dw)); |
| | | //查询物業条款信息 |
| | | dw = new MPJLambdaWrapper<>(); |
| | | dw.selectAll(YwContractDetail.class ) |
| | | .eq(YwContractDetail::getIsdeleted,Constants.ZERO) |
| | | .eq(YwContractDetail::getContractId,model.getId()) |
| | | .in(YwContractDetail::getType,Constants.ONE,Constants.THREE) |
| | | .orderByAsc(YwContractDetail::getSortnum); |
| | | model.setWyDetailList(ywContractDetailMapper.selectJoinList(YwContractDetail.class,dw)); |
| | | |
| | | //查询操作日志记录 |
| | | YwWorkorderLog log = new YwWorkorderLog(); |
| | | log.setJobId(model.getId()); |
| | | log.setIsdeleted(Constants.ZERO); |
| | | model.setLogList(ywWorkorderLogMapper.selectList(new QueryWrapper<YwWorkorderLog>(log) |
| | | .lambda() |
| | | .in(YwWorkorderLog::getObjType,Constants.YwLogType.CONTRACT_BACK.getKey() |
| | | ,Constants.YwLogType.CONTRACT_CREATE.getKey() |
| | | ,Constants.YwLogType.CONTRACT_UPDATE.getKey()) |
| | | .orderByAsc(YwWorkorderLog::getCreateDate))); |
| | | |
| | | //查询账单集合 |
| | | model.setBillList(ywContractBillMapper.selectJoinList(YwContractBill.class,new MPJLambdaWrapper<YwContractBill>() |
| | | .selectAll(YwContractBill.class ) |
| | | .eq( YwContractBill::getContractId,model.getId()) |
| | | .eq(YwContractBill::getIsdeleted,Constants.ZERO) |
| | | .orderByAsc(YwContractBill::getSortnum,YwContractBill::getCreateDate))); |
| | | } |
| | | |
| | | return model; |