|
|
@@ -1,6 +1,7 @@
|
|
|
package com.onemap.sanya.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.nacos.shaded.com.google.common.reflect.TypeToken;
|
|
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
@@ -17,14 +18,16 @@ import com.onemap.common.core.web.controller.BaseController;
|
|
|
import com.onemap.sanya.domain.*;
|
|
|
import com.onemap.sanya.domain.CQBC.CompensateEstimateReport;
|
|
|
import com.onemap.sanya.domain.GGP.*;
|
|
|
-import com.onemap.sanya.domain.business.ZtBillboardJt;
|
|
|
-import com.onemap.sanya.domain.business.ZtBillboardinfolist;
|
|
|
-import com.onemap.sanya.domain.business.ZtBillboardmodellist;
|
|
|
-import com.onemap.sanya.domain.business.ZtBillboardmodellisthistory;
|
|
|
+import com.onemap.sanya.domain.JZDJXZ.ZtJzdjxzInfoDto;
|
|
|
+import com.onemap.sanya.domain.JZDJXZ.xfytinfo;
|
|
|
+import com.onemap.sanya.domain.JZDJXZ.zTJzdjxzInfoDto.*;
|
|
|
+import com.onemap.sanya.domain.business.*;
|
|
|
import com.onemap.sanya.domain.mergeCell.JZDJTableRenderPolicy;
|
|
|
+import com.onemap.sanya.domain.spatial.C4Lxj;
|
|
|
import com.onemap.sanya.service.IZtBillboardJtService;
|
|
|
import com.onemap.sanya.service.IZtBillboardmodellistService;
|
|
|
import com.onemap.sanya.service.IZtBillboardmodellisthistoryService;
|
|
|
+import com.onemap.sanya.service.IZtJzdjxzListService;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -55,6 +58,8 @@ public class SanYaController extends BaseController {
|
|
|
private IZtBillboardJtService ztBillboardJtService;
|
|
|
@Autowired
|
|
|
private IZtBillboardmodellisthistoryService ztBillboardmodellisthistoryService;
|
|
|
+ @Autowired
|
|
|
+ private IZtJzdjxzListService ztJzdjxzListService;
|
|
|
/**
|
|
|
* 导出征收补偿预估报告word
|
|
|
* @param request
|
|
|
@@ -413,6 +418,127 @@ public class SanYaController extends BaseController {
|
|
|
ztBillboardmodellistDto.setTemplateBottomObj(TemplateBottom);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 导出基准地价修正报告word
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ @PostMapping("/exportWord5")
|
|
|
+ private void exportWord5(@RequestBody ZtJzdjxzResults ztJzdjxzResults, HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ if (ztJzdjxzResults == null) {
|
|
|
+ log.info("基准地价修正报告数据为空,导出失败!");
|
|
|
+ return ;
|
|
|
+ }
|
|
|
+ ZtJzdjxzList ztJzdjxzList= ztJzdjxzListService.selectZtJzdjxzListById(ztJzdjxzResults.getBenchmarkLandPriceid());
|
|
|
+ Gson gson = new Gson();
|
|
|
+ ZtJzdjxzInfoDto ztJzdjxzInfoDto=new ZtJzdjxzInfoDto();
|
|
|
+ //转换到Dto中
|
|
|
+ ztJzdjxzInfoDto.setProjectName(ztJzdjxzList.getProjectName());
|
|
|
+ ztJzdjxzInfoDto.setAnalysisDate(ztJzdjxzResults.getAnalysisDate());
|
|
|
+ if (ztJzdjxzResults.getAnalysisDate() != null && ztJzdjxzResults.getAnalysisDate() instanceof Date) {
|
|
|
+ // 将Date对象格式化为所需的字符串格式
|
|
|
+ // 例如: "yyyy-MM-dd HH:mm:ss"
|
|
|
+ String d= new SimpleDateFormat("yyyy-MM-dd").format((Date) ztJzdjxzResults.getAnalysisDate());
|
|
|
+ ztJzdjxzInfoDto.setAnalysisDateString(d);
|
|
|
+ }
|
|
|
+ ztJzdjxzInfoDto.setEstimatedDate(ztJzdjxzResults.getEstimatedDate());
|
|
|
+ if (ztJzdjxzResults.getEstimatedDate() != null && ztJzdjxzResults.getEstimatedDate() instanceof Date) {
|
|
|
+ // 将Date对象格式化为所需的字符串格式
|
|
|
+ // 例如: "yyyy-MM-dd HH:mm:ss"
|
|
|
+ String d= new SimpleDateFormat("yyyy-MM-dd").format((Date) ztJzdjxzResults.getEstimatedDate());
|
|
|
+ ztJzdjxzInfoDto.setEstimatedDateString(d);
|
|
|
+ }
|
|
|
+ ztJzdjxzInfoDto.setLandUseType(ztJzdjxzResults.getLandUseType());
|
|
|
+ ztJzdjxzInfoDto.setSelectLandUseType(JSON.parseObject(ztJzdjxzResults.getSelectLandUseType(),SelectLandUseType.class));
|
|
|
+ ztJzdjxzInfoDto.setUseArea(ztJzdjxzResults.getUseArea());
|
|
|
+ ztJzdjxzInfoDto.setNoRoutePriceFloorPrice(ztJzdjxzResults.getNoRoutePriceFloorPrice());
|
|
|
+ ztJzdjxzInfoDto.setRoutePriceFloorPrice(ztJzdjxzResults.getRoutePriceFloorPrice());
|
|
|
+ ztJzdjxzInfoDto.setRoutePriceFloorPriceInfo(JSON.parseObject(ztJzdjxzResults.getRoutePriceFloorPriceInfo(), C4Lxj.class));
|
|
|
+ ztJzdjxzInfoDto.setLandUseCorrectionFactor(ztJzdjxzResults.getLandUseCorrectionFactor());
|
|
|
+ ztJzdjxzInfoDto.setSelectLandUseCorrectionFactor(JSON.parseObject(ztJzdjxzResults.getSelectLandUseCorrectionFactor(), xfytinfo.class));
|
|
|
+ ztJzdjxzInfoDto.setCorrectionDate(ztJzdjxzResults.getCorrectionDate());
|
|
|
+ ztJzdjxzInfoDto.setQrxzcs(JSON.parseObject(ztJzdjxzResults.getQrxzcs(), Qrxzcs.class));
|
|
|
+ ztJzdjxzInfoDto.setRegionalImpactCorrection(ztJzdjxzResults.getRegionalImpactCorrection());
|
|
|
+ ztJzdjxzInfoDto.setRegionalImpactCorrectionType(ztJzdjxzResults.getRegionalImpactCorrectionType());
|
|
|
+ ztJzdjxzInfoDto.setRegionalImpactCorrectionList(JSON.parseArray(ztJzdjxzResults.getRegionalImpactCorrectionList(),RegionalImpactCorrectionList.class ));
|
|
|
+ ztJzdjxzInfoDto.setUseLifeCorrection(ztJzdjxzResults.getUseLifeCorrection());
|
|
|
+ ztJzdjxzInfoDto.setUseLife(ztJzdjxzResults.getUseLife());
|
|
|
+ ztJzdjxzInfoDto.setVolumeRatioCorrection(ztJzdjxzResults.getVolumeRatioCorrection());
|
|
|
+ ztJzdjxzInfoDto.setVolumeRatio(ztJzdjxzResults.getVolumeRatio());
|
|
|
+ ztJzdjxzInfoDto.setAreaConditionCorrection(ztJzdjxzResults.getAreaConditionCorrection());
|
|
|
+ ztJzdjxzInfoDto.setSelectAreaConditionCorrectionItem(JSON.parseObject(ztJzdjxzResults.getSelectAreaConditionCorrectionItem(),ZtJzdjxzMjxzsm.class));
|
|
|
+ ztJzdjxzInfoDto.setShapeCorrection(ztJzdjxzResults.getShapeCorrection());
|
|
|
+ ztJzdjxzInfoDto.setSelectShapeCorrectionItem(JSON.parseObject(ztJzdjxzResults.getSelectShapeCorrectionItem(),ZtJzdjxzXzxzsm.class));
|
|
|
+ ztJzdjxzInfoDto.setRoadWidthDepthRatio(ztJzdjxzResults.getRoadWidthDepthRatio());
|
|
|
+ ztJzdjxzInfoDto.setLlks(JSON.parseObject(ztJzdjxzResults.getLlks(), Llks.class));
|
|
|
+ ztJzdjxzInfoDto.setRoadSeaRiverMountainCorrection(ztJzdjxzResults.getRoadSeaRiverMountainCorrection());
|
|
|
+ ztJzdjxzInfoDto.setSelectroadSeaRiverMountainCorrectionItem(JSON.parseObject(ztJzdjxzResults.getSelectroadSeaRiverMountainCorrectionItem(),ZtJzdjxzLinlhhsxz.class));
|
|
|
+ ztJzdjxzInfoDto.setKffy(ztJzdjxzResults.getKffy());
|
|
|
+ ztJzdjxzInfoDto.setPhysicalGrade(ztJzdjxzResults.getPhysicalGrade());
|
|
|
+ ztJzdjxzInfoDto.setParcelType(ztJzdjxzResults.getParcelType());
|
|
|
+ ztJzdjxzInfoDto.setJcssptcdList(JSON.parseArray(ztJzdjxzResults.getJcssptcdList(), JcssptcdList.class));
|
|
|
+ ztJzdjxzInfoDto.setStreetBuildingArea(ztJzdjxzResults.getStreetBuildingArea());
|
|
|
+ ztJzdjxzInfoDto.setStreetBuildingAreaInfo(JSON.parseObject(ztJzdjxzResults.getStreetBuildingAreaInfo(),StreetBuildingAreaInfo.class));
|
|
|
+ ztJzdjxzInfoDto.setGrade(ztJzdjxzResults.getGrade());
|
|
|
+ ztJzdjxzInfoDto.setP1AllFloorPrice(ztJzdjxzResults.getP1AllFloorPrice());
|
|
|
+ ztJzdjxzInfoDto.setP2AllFloorPrice(ztJzdjxzResults.getP2AllFloorPrice());
|
|
|
+ ztJzdjxzInfoDto.setPi(ztJzdjxzResults.getPi());
|
|
|
+ ztJzdjxzInfoDto.setP1AllXS(ztJzdjxzResults.getP1AllXS());
|
|
|
+ ztJzdjxzInfoDto.setP2AllXS(ztJzdjxzResults.getP2AllXS());
|
|
|
+ ztJzdjxzInfoDto.setPiAllXS(ztJzdjxzResults.getPiAllXS());
|
|
|
+ ztJzdjxzInfoDto.setP1FloorPrice(ztJzdjxzResults.getP1FloorPrice());
|
|
|
+ ztJzdjxzInfoDto.setP2FloorPrice(ztJzdjxzResults.getP2FloorPrice());
|
|
|
+ ztJzdjxzInfoDto.setPicBase64List(ztJzdjxzResults.getPicBase64List());
|
|
|
+
|
|
|
+
|
|
|
+ if(ztJzdjxzInfoDto.getRoutePriceFloorPriceInfo()!=null){
|
|
|
+ ztJzdjxzInfoDto.setLxfw(ztJzdjxzInfoDto.getRoutePriceFloorPriceInfo().get路线范围());
|
|
|
+ ztJzdjxzInfoDto.setLmdj(ztJzdjxzInfoDto.getRoutePriceFloorPriceInfo().get楼面单价());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ List<PicData> picList = new ArrayList<>();
|
|
|
+ if(ztJzdjxzInfoDto.getPicBase64List()!=null&&!ztJzdjxzInfoDto.getPicBase64List().isEmpty()){
|
|
|
+ ObjectMapper objectMapper=new ObjectMapper();
|
|
|
+ List<String> picBase64List=objectMapper.readValue(ztJzdjxzInfoDto.getPicBase64List(), new TypeReference<List<String>>(){});
|
|
|
+
|
|
|
+ //将base64图片转为PictureRenderData
|
|
|
+ for (String base64ImageData:picBase64List) {
|
|
|
+
|
|
|
+ PictureRenderData pictureRenderData =Pictures.ofBase64(base64ImageData, PictureType.JPEG).size(400, 300).create();
|
|
|
+ picList.add(new PicData(pictureRenderData));
|
|
|
+ }
|
|
|
+ ztJzdjxzInfoDto.setPicList(picList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //读取需要的基准地价模板
|
|
|
+ Type SelectLandUseTypeType = new TypeToken<SelectLandUseType>() {}.getType();
|
|
|
+ SelectLandUseType selectLandUseType = gson.fromJson(ztJzdjxzResults.getSelectLandUseType(), SelectLandUseTypeType);
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("template/word/"+"基准地价报告模板-"+selectLandUseType.getToptdyt()+".docx");
|
|
|
+ InputStream inputStream = classPathResource.getInputStream();
|
|
|
+
|
|
|
+ //导入表格渲染配置
|
|
|
+ Configure configure = Configure.builder().useSpringEL()
|
|
|
+ .bind("RegionalImpactCorrectionList", new LoopRowTableRenderPolicy())
|
|
|
+ .bind("jcssptcdList", new LoopRowTableRenderPolicy()).build();
|
|
|
+ // 通过 XWPFTemplate 编译文件并渲染数据到模板中
|
|
|
+ XWPFTemplate template = XWPFTemplate.compile(inputStream, configure).render(ztJzdjxzInfoDto);
|
|
|
+
|
|
|
+
|
|
|
+ //生成文件名
|
|
|
+// String wordName = "04-基准地价报告-02" + "-" + System.currentTimeMillis();
|
|
|
+ String wordName = ztJzdjxzInfoDto.getProjectName();
|
|
|
+ writeWord(response, null, wordName, template);
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("基准地价报告导出异常,{}" + e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|