|
@@ -21,7 +21,9 @@ import com.dayou.entity.*;
|
|
|
import com.dayou.enums.DocumentType;
|
|
|
import com.dayou.enums.BusinessEnum;
|
|
|
import com.dayou.exception.ErrorCode;
|
|
|
+import com.dayou.mapper.HouseTargetEntityMapper;
|
|
|
import com.dayou.service.*;
|
|
|
+import com.dayou.table.HouseEntityTable;
|
|
|
import com.dayou.utils.*;
|
|
|
import com.dayou.utils.table.WordTableHelper;
|
|
|
import com.dayou.vo.HouseTargetVO;
|
|
@@ -34,10 +36,8 @@ import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Paths;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Collections;
|
|
|
+import java.util.*;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.dayou.constants.HouseGuarantyDoc.*;
|
|
@@ -78,6 +78,12 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
@Autowired
|
|
|
private CertificateLandUseService certificateLandUseService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private HouseTargetEntityService houseTargetEntityService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private HouseTargetEntityMapper houseTargetEntityMapper;
|
|
|
+
|
|
|
@Override
|
|
|
public Long createTableWord(HouseGuarantyTableDTO houseGuarantyTableDTO) {
|
|
|
try {
|
|
@@ -335,11 +341,13 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
guarantyResultDO.setCreditCode((String) jsonObject.get("统一社会信用代码"));
|
|
|
|
|
|
Map<Object, List<Object>> collect = array.stream().collect(Collectors.groupingBy(x -> ((JSONObject) x).get(ID.getZhName())));
|
|
|
- String targetScope = HouseDocumentUtil.combinationTargetDescription(collect);
|
|
|
|
|
|
- guarantyResultDO.setTargetScope(targetScope);
|
|
|
+ guarantyResultDO.setTargetScope(HouseDocumentUtil.combinationTargetDescription(collect));
|
|
|
|
|
|
+ List<HouseTargetEntity> entities = houseTargetEntityMapper.getListById(id);
|
|
|
|
|
|
+ //土地实物状况描述
|
|
|
+ guarantyResultDO.setLandInfo(HouseDocumentUtil.getLandInfoDesc(entities));
|
|
|
|
|
|
byte[] tmplWordByte = Files.readAllBytes(Paths.get(baseDir
|
|
|
+ fileNetConfig.getHouseGuarantyTemplatePath() + GUARANTY_RESULT_TEMPLATE));
|
|
@@ -351,6 +359,52 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
FileOutputStream fos = new FileOutputStream(resultFile);
|
|
|
fos.write(resultWordByte);
|
|
|
fos.close();
|
|
|
+
|
|
|
+ Thread.sleep(1000);
|
|
|
+
|
|
|
+ //生成文档中的表格
|
|
|
+ //1. 实物状况表格
|
|
|
+
|
|
|
+ Document doc = new Document(baseDir + guarantyResultName);
|
|
|
+
|
|
|
+ List<HouseEntityTable> entityTables = entities.stream().map(x -> {
|
|
|
+ String location = UNKNOWN;
|
|
|
+ String acreage = UNKNOWN;
|
|
|
+ String useTo = UNKNOWN;
|
|
|
+ String structure = UNKNOWN;
|
|
|
+ CertificateFixedAssets fa = certificateFixedAssetsService.getOne(new LambdaQueryWrapper<CertificateFixedAssets>()
|
|
|
+ .eq(CertificateFixedAssets::getBusinessId, x.getBusinessId())
|
|
|
+ .eq(CertificateFixedAssets::getTid, x.getTid())
|
|
|
+ .eq(CertificateFixedAssets::getTno, x.getTno())
|
|
|
+ .select(CertificateFixedAssets::getLocation, CertificateFixedAssets::getAcreageDesc, CertificateFixedAssets::getUseTo));
|
|
|
+ if (fa == null) {
|
|
|
+ CertificateHouseOwn certHouse = certificateHouseOwnService.getOne(new LambdaQueryWrapper<CertificateHouseOwn>()
|
|
|
+ .eq(CertificateHouseOwn::getBusinessId, x.getBusinessId())
|
|
|
+ .eq(CertificateHouseOwn::getTid, x.getTid())
|
|
|
+ .eq(CertificateHouseOwn::getTno, x.getTno())
|
|
|
+ .select(CertificateHouseOwn::getLocation, CertificateHouseOwn::getAcreage, CertificateHouseOwn::getUseTo));
|
|
|
+ if (certHouse != null) {
|
|
|
+ location = certHouse.getLocation();
|
|
|
+ acreage = certHouse.getAcreage();
|
|
|
+ useTo = certHouse.getUseTo();
|
|
|
+ structure = certHouse.getStructure();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ location = fa.getLocation();
|
|
|
+ acreage = fa.getAcreageDesc();
|
|
|
+ useTo = fa.getUseTo();
|
|
|
+ structure = "/";
|
|
|
+ }
|
|
|
+
|
|
|
+ HouseEntityTable entityTable = HouseEntityTable.builder().tid(x.getTid()).tno(x.getTno())
|
|
|
+ .useTo(useTo).acreage(acreage).structure(structure)
|
|
|
+ .location(location).desc(HouseDocumentUtil.targetEntityDesc(location, useTo, acreage, x)).build();
|
|
|
+ return entityTable;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ AsposeWordUtil.createTable(doc, HouseEntityTable.class, entityTables, "buildingInfo");
|
|
|
+ doc.save(baseDir + guarantyResultName);
|
|
|
+
|
|
|
//更新过程文档url
|
|
|
HouseGuarantyProcess houseGuarantyProcess = new HouseGuarantyProcess();
|
|
|
houseGuarantyProcess.setProcessName(GUARANTY_RESULT_REPORT.getMsg());
|
|
@@ -439,4 +493,63 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
}
|
|
|
return certificateTypes;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 不动产证 0
|
|
|
+ * 房新&土新 1
|
|
|
+ * 房新&土老 2
|
|
|
+ * 房老&土新 3
|
|
|
+ * 房老&土老 4
|
|
|
+ * 房新&土无 5
|
|
|
+ * 房老&土无 6
|
|
|
+ * @param businessId
|
|
|
+ * @param tid
|
|
|
+ * @param tno
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private Integer getCertificateCombination(Long businessId,String tid,String tno){
|
|
|
+ int imm = certificateFixedAssetsService.count(new LambdaQueryWrapper<CertificateFixedAssets>()
|
|
|
+ .eq(CertificateFixedAssets::getBusinessType, GUARANTY)
|
|
|
+ .eq(CertificateFixedAssets::getBusinessId, businessId)
|
|
|
+ .eq(CertificateFixedAssets::getTid,tid)
|
|
|
+ .eq(CertificateFixedAssets::getTno,tno));
|
|
|
+ if (imm == 0) {
|
|
|
+ CertificateHouseOwn certHouseOwn = certificateHouseOwnService.getOne(new LambdaQueryWrapper<CertificateHouseOwn>()
|
|
|
+ .eq(CertificateHouseOwn::getBusinessType, GUARANTY)
|
|
|
+ .eq(CertificateHouseOwn::getBusinessId, businessId)
|
|
|
+ .eq(CertificateHouseOwn::getTid, tid)
|
|
|
+ .eq(CertificateHouseOwn::getTno, tno)
|
|
|
+ .select(CertificateHouseOwn::getIsNew));
|
|
|
+
|
|
|
+ CertificateLandUse certLandUse = certificateLandUseService.getOne(new LambdaQueryWrapper<CertificateLandUse>()
|
|
|
+ .eq(CertificateLandUse::getBusinessType, GUARANTY)
|
|
|
+ .eq(CertificateLandUse::getBusinessId, businessId)
|
|
|
+ .eq(CertificateLandUse::getTid, tid)
|
|
|
+ .eq(CertificateLandUse::getTno, tno)
|
|
|
+ .select(CertificateLandUse::getIsNew));
|
|
|
+
|
|
|
+
|
|
|
+ if (certHouseOwn != null && certLandUse != null) {
|
|
|
+ if (certHouseOwn.getIsNew() && certLandUse.getIsNew()) {
|
|
|
+ return 1;
|
|
|
+ } else if (certHouseOwn.getIsNew()) {
|
|
|
+ return 2;
|
|
|
+ } else if (certLandUse.getIsNew()) {
|
|
|
+ return 3;
|
|
|
+ } else {
|
|
|
+ return 4;
|
|
|
+ }
|
|
|
+ } else if (certHouseOwn != null) {
|
|
|
+ if (certHouseOwn.getIsNew()) {
|
|
|
+ return 5;
|
|
|
+ } else {
|
|
|
+ return 6;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ErrorCode.throwBusinessException(ErrorCode.CUSTOM_ERROR, "缺失权属证件信息");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
}
|
|
|
+
|