|
|
@@ -2,6 +2,7 @@ package com.zksy.property.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
@@ -16,7 +17,6 @@ import com.zksy.property.factory.ContractFactory;
|
|
|
import com.zksy.property.mapper.AContractInfoMapper;
|
|
|
import com.zksy.property.service.*;
|
|
|
import com.zksy.service.MinioFileStorageService;
|
|
|
-import com.zksy.utils.exception.BusinessException;
|
|
|
import lombok.SneakyThrows;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
@@ -51,6 +51,8 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
|
|
|
@Autowired
|
|
|
private ARefundService aRefundService;
|
|
|
+ @Autowired
|
|
|
+ private AContractInfoMapper baseMapper;
|
|
|
|
|
|
@Override
|
|
|
public String returnRent(String houseId) {
|
|
|
@@ -92,12 +94,12 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
|
|
|
@Override
|
|
|
public String getReceipt(String contractId, ReceiptDto dto) {
|
|
|
- LambdaQueryWrapper<AReceiptInfo> aReceiptInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ /*LambdaQueryWrapper<AReceiptInfo> aReceiptInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
aReceiptInfoLambdaQueryWrapper.eq(AReceiptInfo::getContractId,contractId);
|
|
|
var res = aReceiptInfoService.getOne(aReceiptInfoLambdaQueryWrapper);
|
|
|
if(res != null){
|
|
|
throw new BusinessException(999,"此合同已生成收据",res.getAttachmentUrl());
|
|
|
- }
|
|
|
+ }*/
|
|
|
AContractInfo contractInfo = this.getById(contractId);
|
|
|
if (contractInfo == null){
|
|
|
throw new RuntimeException("数据不存在");
|
|
|
@@ -125,8 +127,10 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
DateTimeFormatter outputFormatter = DateTimeFormatter.ofPattern("yyyy年M月d日");
|
|
|
LocalDate rzrqDate = LocalDate.parse(dto.getRzrq(), inputFormatter);
|
|
|
bo.setD13(rzrqDate.format(outputFormatter));
|
|
|
- bo.setD14(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
|
|
|
- bo.setD15(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
|
|
|
+ LocalDate startDate = LocalDate.parse(dto.getStartDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
+ bo.setD14(startDate.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
|
|
|
+ LocalDate endDate = LocalDate.parse(dto.getEndDate(), DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
+ bo.setD15(endDate.format(DateTimeFormatter.ofPattern("yyyy年M月d日")));
|
|
|
|
|
|
String attachmentUrl = aRentalContractService.generatorRental("4", bo, true);
|
|
|
AReceiptInfo receiptInfo = new AReceiptInfo();
|
|
|
@@ -139,12 +143,18 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
receiptInfo.setPropertyFee(dto.getWyf());
|
|
|
receiptInfo.setDeposit(dto.getYj());
|
|
|
receiptInfo.setWaterFee(dto.getSf());
|
|
|
- receiptInfo.setAccountingDate(LocalDate.parse(dto.getRzrq()));
|
|
|
+ if (StringUtils.isNotBlank(dto.getRzrq())){
|
|
|
+ receiptInfo.setAccountingDate(LocalDate.parse(dto.getRzrq()));
|
|
|
+ }
|
|
|
receiptInfo.setReceiptReason(dto.getPaymentReason());
|
|
|
receiptInfo.setAttachmentUrl(attachmentUrl);
|
|
|
receiptInfo.setGenerationDate(LocalDate.now());
|
|
|
- receiptInfo.setStartDate(LocalDate.parse(dto.getStartDate()));
|
|
|
- receiptInfo.setEndDate(LocalDate.parse(dto.getEndDate()));
|
|
|
+ if(StringUtils.isNotBlank(dto.getStartDate())){
|
|
|
+ receiptInfo.setStartDate(LocalDate.parse(dto.getStartDate()));
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(dto.getEndDate())){
|
|
|
+ receiptInfo.setEndDate(LocalDate.parse(dto.getEndDate()));
|
|
|
+ }
|
|
|
receiptInfo.setCreateTime(LocalDateTime.now());
|
|
|
receiptInfo.setUpdateTime(LocalDateTime.now());
|
|
|
aReceiptInfoService.save(receiptInfo);
|
|
|
@@ -187,12 +197,12 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
|
|
|
@Override
|
|
|
public String getReturnReceipt(String contractId, ReturnReceiptDto dto) {
|
|
|
- LambdaQueryWrapper<ARefund> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ /*LambdaQueryWrapper<ARefund> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
queryWrapper.eq(ARefund::getContractId,contractId);
|
|
|
var res = aRefundService.getOne(queryWrapper);
|
|
|
if(res != null){
|
|
|
throw new BusinessException(999,"此合同已生成退据",res.getAttachmentUrl());
|
|
|
- }
|
|
|
+ }*/
|
|
|
AContractInfo contractInfo = this.getById(contractId);
|
|
|
if (contractInfo == null){
|
|
|
throw new RuntimeException("数据不存在");
|
|
|
@@ -229,6 +239,37 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
return attachmentUrl;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean removeBatchId(String[] ids) {
|
|
|
+ try {
|
|
|
+ for (String id : ids){
|
|
|
+ // 查询是否绑定了退据
|
|
|
+ ARefund refund = aRefundService.getOne(new LambdaQueryWrapper<ARefund>().eq(ARefund::getContractId,id),false);
|
|
|
+ if(refund != null){
|
|
|
+ throw new RuntimeException("该房屋已存在退据,请先删除退据");
|
|
|
+ }
|
|
|
+ // 查询是否绑定收据
|
|
|
+ AReceiptInfo receiptInfo = aReceiptInfoService.getOne(new LambdaQueryWrapper<AReceiptInfo>().eq(AReceiptInfo::getContractId,id),false);
|
|
|
+ if(receiptInfo != null){
|
|
|
+ throw new RuntimeException("该房屋已存在收据,请先删除收据");
|
|
|
+ }
|
|
|
+ AContractInfo contractInfo = this.getById(id);
|
|
|
+ // 删除原合同
|
|
|
+ minioFileStorageService.deleteFile(contractInfo.getOriginalContractUrl());
|
|
|
+ // 删除签订后的合同
|
|
|
+ minioFileStorageService.deleteFile(contractInfo.getSignContractUrl());
|
|
|
+ boolean remove = this.removeById(id);
|
|
|
+ if(!remove){
|
|
|
+ throw new RuntimeException("删除失败");
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
@Autowired
|
|
|
@Lazy
|
|
|
private ASimplifiedHouseInfoService aSimplifiedHouseInfoService;
|
|
|
@@ -236,15 +277,12 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
private ATenantInfoService aTenantInfoService;
|
|
|
|
|
|
@Override
|
|
|
- public Page<AContractInfo> findByPage(long pageNum, long pageSize, String contractNumber, String contractDate, String contractStatus) {
|
|
|
+ public Page<AContractInfo> findByPage(long pageNum, long pageSize,
|
|
|
+ String contractNumber, String contractDate,
|
|
|
+ String contractStatus,String assetType,String building,String floor, String houseName) {
|
|
|
Page<AContractInfo> page = new Page<>(pageNum, pageSize);
|
|
|
- LambdaQueryWrapper<AContractInfo> queryWrapper = new LambdaQueryWrapper();
|
|
|
- queryWrapper.like(contractNumber != null, AContractInfo::getContractNumber, contractNumber);
|
|
|
- queryWrapper.eq(contractDate != null, AContractInfo::getContractDate, contractDate);
|
|
|
- queryWrapper.like(contractStatus != null, AContractInfo::getContractStatus, contractStatus);
|
|
|
- queryWrapper.orderByDesc(AContractInfo::getUpdateTime);
|
|
|
- Page<AContractInfo> page1 = this.page(page, queryWrapper);
|
|
|
- return page1;
|
|
|
+ IPage<AContractInfo> iPage = baseMapper.selectContractWithHouse(page, contractNumber, contractDate, contractStatus,assetType, building, floor, houseName);
|
|
|
+ return (Page<AContractInfo>) iPage;
|
|
|
}
|
|
|
|
|
|
@Override
|