|
@@ -1,69 +1,23 @@
|
|
|
package com.dayou;
|
|
|
|
|
|
-import com.alibaba.fastjson2.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.dayou.constants.HouseGuarantyParagraphTemp;
|
|
|
-import com.dayou.doc.house.ConditionDO;
|
|
|
-import com.dayou.doc.house.ConsignorLetterDO;
|
|
|
-import com.dayou.dto.HouseGuarantyTableDTO;
|
|
|
-import com.dayou.entity.CertificateLandUse;
|
|
|
import com.dayou.entity.HouseGuarantyTarget;
|
|
|
import com.dayou.service.CertificateLandUseService;
|
|
|
import com.dayou.service.HouseGuarantyTargetService;
|
|
|
import com.dayou.service.TmplHouseParagraphService;
|
|
|
-import com.dayou.utils.AsposeWordUtil;
|
|
|
-import com.dayou.utils.EasyExcelUtil;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.boot.test.context.SpringBootTest;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-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.Arrays;
|
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
import static com.dayou.constants.HouseGuarantyDoc.NO;
|
|
|
-import static com.dayou.constants.HouseGuarantyDoc.YES;
|
|
|
-import static com.dayou.constants.HouseGuarantyParagraphTemp.*;
|
|
|
|
|
|
@SpringBootTest
|
|
|
public class ConditionDocumentTest {
|
|
|
|
|
|
- @Test
|
|
|
- public void genConditionDocument() throws IOException {
|
|
|
-
|
|
|
- XSSFWorkbook workbook = new XSSFWorkbook("/Users/wuwei/opt/temp/collect1.xlsx");
|
|
|
- Map<String, String> valueMap = EasyExcelUtil.getExcelCellValue(workbook, "基本信息");
|
|
|
- ConditionDO conditionDO = JSON.parseObject(JSON.toJSONString(valueMap), ConditionDO.class);
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
- sb.append("1.").append(YBJS_P1_2)
|
|
|
- .append("2.").append(YBJS_P2)
|
|
|
- .append("3.").append(YBJS_P3)
|
|
|
- .append("4.").append(YBJS_P4)
|
|
|
- .append("5.").append(YBJS_P5)
|
|
|
- .append("6.") .append(YBJS_P6)
|
|
|
- .append("7.") .append(YBJS_P7)
|
|
|
- .append("8.") .append(YBJS_P8)
|
|
|
- .append("9.") .append(YBJS_P9)
|
|
|
- .append("10.") .append(YBJS_P10_1);
|
|
|
- conditionDO.setYBJS(sb.toString());
|
|
|
- byte[] tmplWordByte = Files.readAllBytes(Paths.get("/Users/wuwei/opt/temp/house/guaranty/temp/condition_letter.docx"));
|
|
|
-
|
|
|
|
|
|
- byte[] resultWordByte = AsposeWordUtil.fillWordDataByDomain(tmplWordByte, conditionDO);
|
|
|
-
|
|
|
-
|
|
|
- File resultFile = new File("/Users/wuwei/opt/temp/ct.docx");
|
|
|
- FileOutputStream fos = new FileOutputStream(resultFile);
|
|
|
- fos.write(resultWordByte);
|
|
|
- fos.close();
|
|
|
- }
|
|
|
|
|
|
@Autowired
|
|
|
private TmplHouseParagraphService tmplHouseParagraphService;
|