|
@@ -1,6 +1,7 @@
|
|
|
package org.springblade.manager.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -13,6 +14,7 @@ import com.itextpdf.io.font.FontProgram;
|
|
|
import com.itextpdf.io.font.FontProgramFactory;
|
|
|
import com.itextpdf.kernel.geom.PageSize;
|
|
|
import com.itextpdf.kernel.pdf.PdfDocument;
|
|
|
+import com.itextpdf.kernel.pdf.PdfPage;
|
|
|
import com.itextpdf.kernel.pdf.PdfWriter;
|
|
|
import com.itextpdf.layout.font.FontProvider;
|
|
|
import com.spire.xls.Workbook;
|
|
@@ -25,6 +27,7 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.business.feign.FileUtilsClient;
|
|
|
import org.springblade.business.feign.InformationQueryClient;
|
|
|
import org.springblade.common.utils.MathUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
@@ -39,6 +42,7 @@ import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
import org.springblade.manager.service.*;
|
|
|
+import org.springblade.manager.unit.FileUtils;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.manager.wrapper.ExcelTabWrapper;
|
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
@@ -59,6 +63,7 @@ import java.io.IOException;
|
|
|
import java.util.*;
|
|
|
import java.util.regex.Matcher;
|
|
|
import java.util.regex.Pattern;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 清表基础数据表 控制器
|
|
@@ -108,6 +113,8 @@ public class ExcelTabController extends BladeController {
|
|
|
// pdf转换
|
|
|
private final CommonFileClient commonFileClient;
|
|
|
|
|
|
+ private final FileUtilsClient fileUtilsClient;
|
|
|
+
|
|
|
/**
|
|
|
* 详情
|
|
|
*/
|
|
@@ -367,13 +374,11 @@ public class ExcelTabController extends BladeController {
|
|
|
updateWrapper.in("p_key_id",Long.parseLong(pkInfo));
|
|
|
updateWrapper.set("is_link_table",2);
|
|
|
updateWrapper.set("excel_id",excelTab.getId());
|
|
|
-
|
|
|
wbsTreePrivateService.update(updateWrapper);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return R.success("添加成功!");
|
|
|
}
|
|
|
|
|
@@ -563,23 +568,33 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiOperationSupport(order = 13)
|
|
|
@ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
|
|
|
public R<String> saveBussData(@Valid @RequestBody JSONObject dataInfo, BladeUser bladeUser) {
|
|
|
+ JSONObject jsonObject = dataInfo.getJSONObject("dataInfo");
|
|
|
+ JSONArray dataArray = new JSONArray();
|
|
|
+ if(jsonObject.containsKey("orderList")){ // 节点保存
|
|
|
+ dataArray = jsonObject.getJSONArray("orderList");
|
|
|
+ }else{ // 单个保存
|
|
|
+ dataArray.add(jsonObject);
|
|
|
+ }
|
|
|
+
|
|
|
+ for(int m=0;m<dataArray.size();m++){
|
|
|
+ JSONObject dataInfo2= dataArray.getJSONObject(m);
|
|
|
//
|
|
|
- String contractId = dataInfo.getString("contractId");
|
|
|
- String pkeyId = dataInfo.getString("pkeyId");
|
|
|
- String projectId = dataInfo.getString("projectId");
|
|
|
+ String contractId = dataInfo2.getString("contractId");
|
|
|
+ String pkeyId = dataInfo2.getString("pkeyId");
|
|
|
+ String projectId = dataInfo2.getString("projectId");
|
|
|
//huangjn 填报的类型,施工或监理
|
|
|
- String classify = dataInfo.getString("classify");
|
|
|
+ String classify = dataInfo2.getString("classify");
|
|
|
|
|
|
//huangjn 填报的类型,施工或监理
|
|
|
// 去掉
|
|
|
- dataInfo.remove("contractId");
|
|
|
- dataInfo.remove("pkeyId");
|
|
|
- dataInfo.remove("projectId");
|
|
|
- dataInfo.remove("classify");
|
|
|
+ dataInfo2.remove("contractId");
|
|
|
+ dataInfo2.remove("pkeyId");
|
|
|
+ dataInfo2.remove("projectId");
|
|
|
+ dataInfo2.remove("classify");
|
|
|
|
|
|
// 计算数据
|
|
|
Map<String,String> dataMap = new HashMap<>();
|
|
|
- for(String k:dataInfo.keySet()){
|
|
|
+ for(String k:dataInfo2.keySet()){
|
|
|
String key = k.split("__")[0];
|
|
|
if(dataMap.containsKey(key)){
|
|
|
dataMap.put(key,dataMap.get(key)+","+k);
|
|
@@ -612,24 +627,27 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String lastStr = dataInfo.getString(ziduan[0])+"__"+ziduan[0].split("__")[1];
|
|
|
+ String lastStr = dataInfo2.getString(ziduan[0])+"__"+ziduan[0].split("__")[1];
|
|
|
for (int i=1 ;i<ziduan.length;i++){
|
|
|
- String keyData = dataInfo.getString(ziduan[i]);
|
|
|
+ String keyData = dataInfo2.getString(ziduan[i]);
|
|
|
if(!keyData.equals("")){
|
|
|
- lastStr+=","+dataInfo.getString(ziduan[i])+"__"+ziduan[i].split("__")[1];
|
|
|
+ lastStr+=","+dataInfo2.getString(ziduan[i])+"__"+ziduan[i].split("__")[1];
|
|
|
}
|
|
|
|
|
|
}
|
|
|
dataMap2.put(k,lastStr);
|
|
|
}else{
|
|
|
- if(!(dataInfo.getString(dataMap.get(k))).equals("")) {
|
|
|
- dataMap2.put(k, dataInfo.getString(dataMap.get(k)));
|
|
|
+ if(!(dataInfo2.getString(dataMap.get(k))).equals("")) {
|
|
|
+ dataMap2.put(k, dataInfo2.getString(dataMap.get(k)));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+ if(wbsTreeContract == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
String tabName = wbsTreeContract.getInitTableName();
|
|
|
|
|
@@ -651,11 +669,20 @@ public class ExcelTabController extends BladeController {
|
|
|
valStr=valStr.substring(0,valStr.lastIndexOf(","));
|
|
|
sqlInfo = sqlInfo + keyStr+") VALUES (" +valStr +")";
|
|
|
|
|
|
+
|
|
|
+ WbsTreeContract wbsTreeContractByP = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId,contractId));
|
|
|
+
|
|
|
+
|
|
|
+ UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("p_key_id",pkeyId);
|
|
|
+ updateWrapper.set("is_tab_pdf",2);
|
|
|
+ wbsTreeContractService.update(updateWrapper);
|
|
|
+
|
|
|
//huangjn 保存成功后调用生成资料查询列表数据
|
|
|
- this.informationQueryClient.saveOrUpdateInformationQueryData(pkeyId, "文件名称(后面再完善)", Integer.parseInt(classify), 2);
|
|
|
+ this.informationQueryClient.saveOrUpdateInformationQueryData(wbsTreeContractByP.getPKeyId()+"", "文件名称(后面再完善)", Integer.parseInt(classify), 2);
|
|
|
}else{ //更新
|
|
|
sqlInfo = "update "+tabName+" set ";
|
|
|
-
|
|
|
for (String keys : dataMap2.keySet()){
|
|
|
sqlInfo += keys+"='"+dataMap2.get(keys)+"',";
|
|
|
}
|
|
@@ -663,8 +690,9 @@ public class ExcelTabController extends BladeController {
|
|
|
sqlInfo = sqlInfo + " where p_key_id="+pkeyId;
|
|
|
}
|
|
|
|
|
|
- System.out.println(sqlInfo);
|
|
|
jdbcTemplate.execute(sqlInfo);
|
|
|
+
|
|
|
+ }
|
|
|
return R.success("1");
|
|
|
}
|
|
|
|
|
@@ -1150,21 +1178,54 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
String pdfPath="/Users/hongchuangyanfa/Desktop/pdf//"+pkeyId+".pdf";
|
|
|
+
|
|
|
File pdffile = ResourceUtil.getFile(pdfPath);
|
|
|
PdfWriter writer = new PdfWriter(pdffile);
|
|
|
com.itextpdf.kernel.pdf.PdfDocument pdf = new PdfDocument(writer);
|
|
|
PageSize pageSize = new PageSize(795,842);
|
|
|
pdf.setDefaultPageSize(pageSize);
|
|
|
-
|
|
|
HtmlConverter.convertToPdf(doc.html(),writer,properties);
|
|
|
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
+
|
|
|
+ //
|
|
|
+ TableFile tableFile1 = tableFileService.getBaseMapper().selectOne(Wrappers.<TableFile>query().lambda()
|
|
|
+ .eq(TableFile::getTabId, pkeyId).eq(TableFile::getType,1));
|
|
|
+ if(tableFile1!=null){
|
|
|
+ tableFile1.setDomainPdfUrl(bladeFile.getLink());
|
|
|
+ tableFileService.saveOrUpdate(tableFile1);
|
|
|
+ }else{
|
|
|
+ TableFile tableFile = new TableFile();
|
|
|
+ String fileExtension = FileUtil.getFileExtension(wbsTreeContract.getFullName()+".pdf");
|
|
|
+ tableFile.setTabId(pkeyId+"");
|
|
|
+ tableFile.setName(wbsTreeContract.getFullName()+".pdf");
|
|
|
+ tableFile.setType(1);
|
|
|
+ tableFile.setDomainUrl(bladeFile.getLink());
|
|
|
+ tableFile.setIsDeleted(0);
|
|
|
+ tableFile.setExtension(fileExtension);
|
|
|
+ tableFile.setDomainPdfUrl(bladeFile.getLink());
|
|
|
+ tableFileService.saveOrUpdate(tableFile);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<TableFile> tableFileList = tableFileService.getBaseMapper().selectList(Wrappers.<TableFile>query().lambda().eq(TableFile::getTabId, pkeyId));
|
|
|
+ tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
+
|
|
|
+ //
|
|
|
+ List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl()!=null).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
+
|
|
|
+ String pdfPath2 = "/Users/hongchuangyanfa/Desktop/pdf//"+pkeyId+"_2.pdf";
|
|
|
+
|
|
|
+ FileUtils.mergePdfPublicMethods(dataListPdf,pdfPath2);
|
|
|
+
|
|
|
+ BladeFile bladeFile2 = newIOSSClient.uploadFile(pkeyId + "2.pdf", pdfPath2);
|
|
|
+
|
|
|
UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
updateWrapper.in("p_key_id",pkeyId);
|
|
|
- updateWrapper.set("pdf_url",bladeFile.getLink());
|
|
|
-
|
|
|
+ updateWrapper.set("pdf_url",bladeFile2.getLink());
|
|
|
wbsTreeContractService.update(updateWrapper);
|
|
|
- return R.data(bladeFile.getLink());
|
|
|
+
|
|
|
+
|
|
|
+ return R.data(bladeFile2.getLink());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -1189,6 +1250,7 @@ public class ExcelTabController extends BladeController {
|
|
|
deptName = deptName +"__"+wbsTreeContractList.size();
|
|
|
}
|
|
|
wbsTreeContract.setDeptName(deptName);
|
|
|
+ wbsTreeContract.setIsCopeTab(2);
|
|
|
wbsTreeContractService.save(wbsTreeContract);
|
|
|
return R.data("成功");
|
|
|
}
|
|
@@ -1242,6 +1304,15 @@ public class ExcelTabController extends BladeController {
|
|
|
tableFile.setStatus("finished");
|
|
|
tableFileService.save(tableFile);
|
|
|
|
|
|
+ WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
+ .eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
+
|
|
|
+ UpdateWrapper<WbsTreeContract> updateWrapper = new UpdateWrapper<>();
|
|
|
+ updateWrapper.in("p_key_id",pkeyId);
|
|
|
+ updateWrapper.set("tab_file_type",2);
|
|
|
+ updateWrapper.set("is_tab_pdf",2);
|
|
|
+ wbsTreeContractService.update(updateWrapper);
|
|
|
+
|
|
|
return R.data(tableFile.getId());
|
|
|
}
|
|
|
|
|
@@ -1268,14 +1339,39 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParams(value = {
|
|
|
@ApiImplicitParam(name = "nodeId", value = "当前节点Id", required = true),
|
|
|
@ApiImplicitParam(name = "classify", value = "填报的类型(施工或监理)", required = true),
|
|
|
+ @ApiImplicitParam(name = "projectId", value = "项目ID", required = true),
|
|
|
@ApiImplicitParam(name = "contractId", value = "合同段Id", required = true)
|
|
|
})
|
|
|
- public R getBussPdfs(Long nodeId,String classify,long contractId) throws FileNotFoundException {
|
|
|
+ public R getBussPdfs(String nodeId,String classify,String contractId,String projectId){
|
|
|
|
|
|
+ // 获取有权限的节点信息
|
|
|
+ List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
|
|
|
+ List<String> data = wbsTreeContractList.stream().filter(wbsTreeContract -> wbsTreeContract.getPdfUrl()!=null).map(WbsTreeContract::getPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
+ String listPdf = "/Users/hongchuangyanfa/Desktop/pdf/"+nodeId+".pdf";
|
|
|
|
|
|
+ FileUtils.mergePdfPublicMethods(data,listPdf);
|
|
|
|
|
|
- return R.data("成功");
|
|
|
+ BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId+".pdf", listPdf);
|
|
|
+
|
|
|
+ // 合并pdf集合
|
|
|
+ String sql = "update u_information_query set pdf_url ='"+bladeFile.getLink()+"' where classify='"+classify+"' and wbs_id='"+nodeId+"' and contract_id ='"+contractId+"' ";
|
|
|
+ jdbcTemplate.execute(sql);
|
|
|
+ // 返回路径地址
|
|
|
+ return R.data(bladeFile.getLink());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户端删除复制信息表
|
|
|
+ */
|
|
|
+ @PostMapping("/remove-buss-tabInfo")
|
|
|
+ @ApiOperationSupport(order = 22)
|
|
|
+ @ApiOperation(value = "用户端删除复制信息表", notes = "pkeyid")
|
|
|
+ @ApiImplicitParams(value = {
|
|
|
+ @ApiImplicitParam(name = "pkeyid", value = "当前节点Id", required = true)
|
|
|
+ })
|
|
|
+ public R removeBussTabInfo(String pkeyid) {
|
|
|
+ return R.status(this.excelTabService.removeBussTabInfoById(pkeyid));
|
|
|
}
|
|
|
|
|
|
|