|
@@ -8,9 +8,13 @@ import com.aspose.cells.Workbook;
|
|
|
import com.aspose.words.*;
|
|
|
import com.dayou.config.FileNetConfig;
|
|
|
import com.dayou.doc.house.ConsignorLetterDO;
|
|
|
+import com.dayou.dto.HouseGuarantyTableDTO;
|
|
|
+import com.dayou.entity.DocumentProduction;
|
|
|
import com.dayou.entity.HouseGuarantyProcess;
|
|
|
+import com.dayou.enums.DocumentType;
|
|
|
+import com.dayou.enums.MainBusiness;
|
|
|
import com.dayou.exception.ErrorCode;
|
|
|
-import com.dayou.mapper.HouseGuarantyProcessMapper;
|
|
|
+import com.dayou.service.DocumentProductionService;
|
|
|
import com.dayou.service.HouseGuarantyProcessService;
|
|
|
import com.dayou.service.HouseGuarantyService;
|
|
|
import com.dayou.utils.AsposeWordUtil;
|
|
@@ -24,12 +28,10 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
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.List;
|
|
|
import java.util.Map;
|
|
|
-import java.util.UUID;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static com.dayou.constants.HouseGuarantyDoc.*;
|
|
@@ -49,10 +51,12 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
private FileNetConfig fileNetConfig;
|
|
|
|
|
|
@Autowired
|
|
|
- private HouseGuarantyProcessMapper houseGuarantyProcessMapper;
|
|
|
+ private DocumentProductionService documentProductionService;
|
|
|
|
|
|
@Override
|
|
|
- public Long createTableWord(String html,String homePath) {
|
|
|
+ public Long createTableWord(HouseGuarantyTableDTO houseGuarantyTableDTO) {
|
|
|
+ String html = houseGuarantyTableDTO.getHtml();
|
|
|
+ String homePath = houseGuarantyTableDTO.getHomePath();
|
|
|
html = wordTableHelper.htmlTableFormat(html);
|
|
|
HouseGuarantyProcess hgp = new HouseGuarantyProcess();
|
|
|
hgp.setHome(homePath);
|
|
@@ -92,11 +96,13 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
//读取基本信息
|
|
|
XSSFWorkbook workbook = new XSSFWorkbook(home + COLLECT1_XLSX);
|
|
|
Map<String, String> valueMap = EasyExcelUtil.getExcelCellValue(workbook, BASE_INFO_ZH);
|
|
|
- //更新文档编号
|
|
|
- houseGuarantyProcessMapper.updateDocNo(id,valueMap.get("docNo"));
|
|
|
+ String projectName = HouseDocumentUtil.getProjectName(array);
|
|
|
+ String docNo = valueMap.get("docNo");
|
|
|
+ String consignor = valueMap.get("consignor");
|
|
|
|
|
|
ConsignorLetterDO clDO = JSON.parseObject(JSON.toJSONString(valueMap), ConsignorLetterDO.class);
|
|
|
- clDO.setProjectName(HouseDocumentUtil.getProjectName(array));
|
|
|
+
|
|
|
+ clDO.setProjectName(projectName);
|
|
|
Map<Object, List<Object>> collect = array.stream().collect(Collectors.groupingBy(x -> ((JSONObject) x).get(ID.getZhName())));
|
|
|
String actDesc = "";
|
|
|
int index = 1;
|
|
@@ -131,6 +137,8 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
fos.write(resultWordByte);
|
|
|
fos.close();
|
|
|
insetTargetTableWord(consignorLetterName,home + TARGETS_DOCX,removeBlank);
|
|
|
+
|
|
|
+ documentProductionService.save(buildDocumentProduction(id,projectName,docNo,consignorLetterName,consignor));
|
|
|
return consignorLetterName;
|
|
|
} catch (Exception e) {
|
|
|
throw new RuntimeException(e);
|
|
@@ -182,4 +190,17 @@ public class HouseGuarantyServiceImpl implements HouseGuarantyService {
|
|
|
currentParagraph1.remove();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private DocumentProduction buildDocumentProduction(Long id,String docName,String docNo,String docUrl,String consignor){
|
|
|
+ DocumentProduction dp = new DocumentProduction();
|
|
|
+ dp.setBusinessType(MainBusiness.HOUSE.getCode());
|
|
|
+ dp.setBusinessCate(MainBusiness.HouseSubBusiness.GUARANTY.getCode());
|
|
|
+ dp.setBusinessId(id);
|
|
|
+ dp.setDocName(docName);
|
|
|
+ dp.setDocType(DocumentType.REPORT.getName());
|
|
|
+ dp.setDocUrl(docUrl);
|
|
|
+ dp.setDocNo(docNo);
|
|
|
+ dp.setConsignor(consignor);
|
|
|
+ return dp;
|
|
|
+ }
|
|
|
}
|