|
@@ -7,18 +7,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zksy.property.domain.AContractInfo;
|
|
import com.zksy.property.domain.AContractInfo;
|
|
|
import com.zksy.property.domain.AHouseInfoDetail;
|
|
import com.zksy.property.domain.AHouseInfoDetail;
|
|
|
import com.zksy.property.domain.ASimplifiedHouseInfo;
|
|
import com.zksy.property.domain.ASimplifiedHouseInfo;
|
|
|
|
|
+import com.zksy.property.domain.ATenantInfo;
|
|
|
import com.zksy.property.domain.bo.*;
|
|
import com.zksy.property.domain.bo.*;
|
|
|
import com.zksy.property.domain.dto.ContractFormDTO;
|
|
import com.zksy.property.domain.dto.ContractFormDTO;
|
|
|
import com.zksy.property.factory.ContractFactory;
|
|
import com.zksy.property.factory.ContractFactory;
|
|
|
import com.zksy.property.mapper.AContractInfoMapper;
|
|
import com.zksy.property.mapper.AContractInfoMapper;
|
|
|
-import com.zksy.property.service.AContractInfoService;
|
|
|
|
|
-import com.zksy.property.service.AHouseInfoDetailService;
|
|
|
|
|
-import com.zksy.property.service.ARentalContractService;
|
|
|
|
|
-import com.zksy.property.service.ASimplifiedHouseInfoService;
|
|
|
|
|
|
|
+import com.zksy.property.service.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -33,6 +35,8 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
@Autowired
|
|
@Autowired
|
|
|
@Lazy
|
|
@Lazy
|
|
|
private ASimplifiedHouseInfoService aSimplifiedHouseInfoService;
|
|
private ASimplifiedHouseInfoService aSimplifiedHouseInfoService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private ATenantInfoService aTenantInfoService;
|
|
|
|
|
|
|
|
@Override
|
|
@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) {
|
|
@@ -67,23 +71,45 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
private AHouseInfoDetailService aHouseInfoDetailService;
|
|
private AHouseInfoDetailService aHouseInfoDetailService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
|
+ @Transactional
|
|
|
public String signContract(ContractFormDTO dto) {
|
|
public String signContract(ContractFormDTO dto) {
|
|
|
AHouseInfoDetail houseInfoDetail = aHouseInfoDetailService.getBySimplifiedHouseId(dto.getHouseId());
|
|
AHouseInfoDetail houseInfoDetail = aHouseInfoDetailService.getBySimplifiedHouseId(dto.getHouseId());
|
|
|
ASimplifiedHouseInfo aSimplifiedHouseInfo = aSimplifiedHouseInfoService.getById(dto.getHouseId());
|
|
ASimplifiedHouseInfo aSimplifiedHouseInfo = aSimplifiedHouseInfoService.getById(dto.getHouseId());
|
|
|
|
|
+
|
|
|
|
|
+ if (!"空闲".equals(aSimplifiedHouseInfo.getStatus())) {
|
|
|
|
|
+ throw new RuntimeException("此房屋已存在合同");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
Contract baseContract = ContractFactory.createContract(aSimplifiedHouseInfo.getAssetType());
|
|
Contract baseContract = ContractFactory.createContract(aSimplifiedHouseInfo.getAssetType());
|
|
|
BeanUtil.copyProperties(dto.getContractData(), baseContract);
|
|
BeanUtil.copyProperties(dto.getContractData(), baseContract);
|
|
|
RentalTempBo bo = new RentalTempBo();
|
|
RentalTempBo bo = new RentalTempBo();
|
|
|
var resPath = "";
|
|
var resPath = "";
|
|
|
if (baseContract instanceof ContractA) {
|
|
if (baseContract instanceof ContractA) {
|
|
|
- processContractA((ContractA) baseContract,aSimplifiedHouseInfo,houseInfoDetail, bo);
|
|
|
|
|
|
|
+ processContractA((ContractA) baseContract, aSimplifiedHouseInfo, houseInfoDetail, bo);
|
|
|
resPath = fillContractData(bo, aSimplifiedHouseInfo.getAssetType());
|
|
resPath = fillContractData(bo, aSimplifiedHouseInfo.getAssetType());
|
|
|
} else if (baseContract instanceof ContractB) {
|
|
} else if (baseContract instanceof ContractB) {
|
|
|
- processContractB((ContractB) baseContract,aSimplifiedHouseInfo,houseInfoDetail, bo);
|
|
|
|
|
|
|
+ processContractB((ContractB) baseContract, aSimplifiedHouseInfo, houseInfoDetail, bo);
|
|
|
resPath = fillContractData(bo, aSimplifiedHouseInfo.getAssetType());
|
|
resPath = fillContractData(bo, aSimplifiedHouseInfo.getAssetType());
|
|
|
} else if (baseContract instanceof ContractC) {
|
|
} else if (baseContract instanceof ContractC) {
|
|
|
processContractC((ContractC) baseContract, bo);
|
|
processContractC((ContractC) baseContract, bo);
|
|
|
resPath = fillContractData(bo, aSimplifiedHouseInfo.getAssetType());
|
|
resPath = fillContractData(bo, aSimplifiedHouseInfo.getAssetType());
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ aSimplifiedHouseInfo.setStatus("已租");
|
|
|
|
|
+ aSimplifiedHouseInfoService.updateById(aSimplifiedHouseInfo);
|
|
|
|
|
+
|
|
|
|
|
+ ATenantInfo aTenantInfo = new ATenantInfo();
|
|
|
|
|
+ aTenantInfo.setTenantName(dto.getRentalInfo().getRentalName());
|
|
|
|
|
+ aTenantInfo.setTenantNumber(dto.getRentalInfo().getRentalPhone());
|
|
|
|
|
+ aTenantInfo.setTenantIdCard(dto.getRentalInfo().getRentalIdCard());
|
|
|
|
|
+ aTenantInfo.setTenantInDate(LocalDate.parse(dto.getRentalInfo().getRentalTimeStart()));
|
|
|
|
|
+ aTenantInfo.setTenantTime(dto.getRentalInfo().getRentalTime());
|
|
|
|
|
+ aTenantInfo.setTenantRent(new BigDecimal(dto.getRentalInfo().getRentalRect()));
|
|
|
|
|
+ aTenantInfo.setSimplifiedHouseId(dto.getHouseId());
|
|
|
|
|
+ aTenantInfo.setCreateTime(LocalDateTime.now());
|
|
|
|
|
+ aTenantInfo.setUpdateTime(LocalDateTime.now());
|
|
|
|
|
+ aTenantInfoService.save(aTenantInfo);
|
|
|
|
|
+
|
|
|
return resPath;
|
|
return resPath;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -119,7 +145,7 @@ public class AContractInfoServiceImpl extends ServiceImpl<AContractInfoMapper, A
|
|
|
bo.setC27("");
|
|
bo.setC27("");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private static void processContractB(ContractB baseContract, ASimplifiedHouseInfo aSimplifiedHouseInfo, AHouseInfoDetail houseDetailInfo,RentalTempBo bo) {
|
|
|
|
|
|
|
+ private static void processContractB(ContractB baseContract, ASimplifiedHouseInfo aSimplifiedHouseInfo, AHouseInfoDetail houseDetailInfo, RentalTempBo bo) {
|
|
|
ContractB contractB = baseContract;
|
|
ContractB contractB = baseContract;
|
|
|
//todo 处理bo
|
|
//todo 处理bo
|
|
|
bo.setB1(contractB.getPurpose());
|
|
bo.setB1(contractB.getPurpose());
|