|
@@ -117,7 +117,6 @@ public class ExcelTabController extends BladeController {
|
|
// pdf转换
|
|
// pdf转换
|
|
private final CommonFileClient commonFileClient;
|
|
private final CommonFileClient commonFileClient;
|
|
|
|
|
|
- private final FileUtilsClient fileUtilsClient;
|
|
|
|
|
|
|
|
private final IWbsParamService wbsParamService;
|
|
private final IWbsParamService wbsParamService;
|
|
|
|
|
|
@@ -350,12 +349,12 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 清表编辑 - 下拉框 树节点
|
|
|
|
|
|
+ * 后管 -- 清表保存
|
|
*/
|
|
*/
|
|
@PostMapping("/sava-dataInfo")
|
|
@PostMapping("/sava-dataInfo")
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperationSupport(order = 13)
|
|
@ApiOperation(value = "编辑-保存", notes = "编辑-保存")
|
|
@ApiOperation(value = "编辑-保存", notes = "编辑-保存")
|
|
- public R<List<WbsTreeVO>> savaDataInfo(@Valid @RequestBody WbsExclTabParmVO wbsExclTabParmVO, BladeUser bladeUser) {
|
|
|
|
|
|
+ public R<List<WbsTreeVO>> savaDataInfo(@Valid @RequestBody WbsExclTabParmVO wbsExclTabParmVO, BladeUser bladeUser) throws IOException {
|
|
// 保存节点信息
|
|
// 保存节点信息
|
|
ExcelTab excelTab = new ExcelTab();
|
|
ExcelTab excelTab = new ExcelTab();
|
|
if(wbsExclTabParmVO.getId()!=null){// 修改
|
|
if(wbsExclTabParmVO.getId()!=null){// 修改
|
|
@@ -378,15 +377,27 @@ public class ExcelTabController extends BladeController {
|
|
List<ExcelTabWbsTypeVO> linkDataInfo = wbsExclTabParmVO.getLinkDataInfo();
|
|
List<ExcelTabWbsTypeVO> linkDataInfo = wbsExclTabParmVO.getLinkDataInfo();
|
|
|
|
|
|
if(linkDataInfo!=null && linkDataInfo.size()>=1){
|
|
if(linkDataInfo!=null && linkDataInfo.size()>=1){
|
|
|
|
+ // 判断是否上传excle
|
|
|
|
+ if((excelTab.getFileUrl()!=null || excelTab.getFileUrl()!="") && excelTab.getFileType()!=3){
|
|
|
|
+ return R.fail("请上传清表!");
|
|
|
|
+ }
|
|
for (ExcelTabWbsTypeVO info : linkDataInfo){
|
|
for (ExcelTabWbsTypeVO info : linkDataInfo){
|
|
String[] pk_id = info.getLinkIds().split(",");
|
|
String[] pk_id = info.getLinkIds().split(",");
|
|
for(String pkInfo : pk_id){
|
|
for(String pkInfo : pk_id){
|
|
|
|
+
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
String [] pk_type = pkInfo.trim().split("_");
|
|
String [] pk_type = pkInfo.trim().split("_");
|
|
updateWrapper.in("p_key_id",Long.parseLong(pk_type[0]));
|
|
updateWrapper.in("p_key_id",Long.parseLong(pk_type[0]));
|
|
|
|
+
|
|
|
|
+ if(pk_type[1].equals("2")){
|
|
|
|
+ this.saveLinkeTab(excelTab.getId() ,Long.parseLong(pk_type[0]));
|
|
|
|
+ }
|
|
|
|
+
|
|
updateWrapper.set("is_link_table",Integer.parseInt(pk_type[1]));
|
|
updateWrapper.set("is_link_table",Integer.parseInt(pk_type[1]));
|
|
updateWrapper.set("excel_id",excelTab.getId());
|
|
updateWrapper.set("excel_id",excelTab.getId());
|
|
|
|
+
|
|
wbsTreePrivateService.update(updateWrapper);
|
|
wbsTreePrivateService.update(updateWrapper);
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -416,12 +427,13 @@ public class ExcelTabController extends BladeController {
|
|
@ApiImplicitParam(name = "exceTabId", value = "清表id", required = true),
|
|
@ApiImplicitParam(name = "exceTabId", value = "清表id", required = true),
|
|
@ApiImplicitParam(name = "tabId", value = "表Id", required = true)
|
|
@ApiImplicitParam(name = "tabId", value = "表Id", required = true)
|
|
})
|
|
})
|
|
- public R<List<ExceTabTreVO>> saveLinkeTab(Long exceTabId, Long tabId, BladeUser bladeUser) throws IOException {
|
|
|
|
|
|
+ public R<List<ExceTabTreVO>> saveLinkeTab(Long exceTabId, Long tabId) throws IOException {
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
// 查询私有项目信息
|
|
// 查询私有项目信息
|
|
WbsTreePrivate wbsTree = new WbsTreePrivate();
|
|
WbsTreePrivate wbsTree = new WbsTreePrivate();
|
|
wbsTree.setPKeyId(tabId);
|
|
wbsTree.setPKeyId(tabId);
|
|
WbsTreePrivate aPrivate = wbsTreePrivateService.getOne(Condition.getQueryWrapper(wbsTree));
|
|
WbsTreePrivate aPrivate = wbsTreePrivateService.getOne(Condition.getQueryWrapper(wbsTree));
|
|
|
|
+ aPrivate.setExcelId(exceTabId);
|
|
|
|
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
updateWrapper.in("p_key_id",tabId);
|
|
updateWrapper.in("p_key_id",tabId);
|
|
@@ -512,7 +524,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 清表生成html
|
|
|
|
|
|
+ * 质检 获取html接口
|
|
*/
|
|
*/
|
|
@GetMapping("/get-excel-html_buss")
|
|
@GetMapping("/get-excel-html_buss")
|
|
@ApiOperationSupport(order = 16)
|
|
@ApiOperationSupport(order = 16)
|
|
@@ -535,6 +547,7 @@ public class ExcelTabController extends BladeController {
|
|
|
|
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
htmlString = htmlString.replaceAll("placeholder","placeholderxx");
|
|
htmlString = htmlString.replaceAll("placeholder","placeholderxx");
|
|
|
|
+ // htmlString = htmlString.replaceAll("@focu","@focu212");
|
|
// 解析 style
|
|
// 解析 style
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Document doc = Jsoup.parse(htmlString);
|
|
Element table = doc.select("table").first();
|
|
Element table = doc.select("table").first();
|
|
@@ -1275,6 +1288,10 @@ public class ExcelTabController extends BladeController {
|
|
// 获取清表信息
|
|
// 获取清表信息
|
|
ExcelTab excelTab = excelTabService.getById(wbsTreeContract.getExcelId());
|
|
ExcelTab excelTab = excelTabService.getById(wbsTreeContract.getExcelId());
|
|
|
|
|
|
|
|
+ if(excelTab==null){
|
|
|
|
+ return R.fail("失败");
|
|
|
|
+ }
|
|
|
|
+
|
|
Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId).getData();
|
|
Map<String, Object> DataInfo = (Map<String, Object>) getBussDataInfo(pkeyId).getData();
|
|
|
|
|
|
// 获取excel流 和 html流
|
|
// 获取excel流 和 html流
|
|
@@ -1373,7 +1390,7 @@ public class ExcelTabController extends BladeController {
|
|
tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
|
|
|
|
|
|
|
- List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl()!=null).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> dataListPdf = tableFileList.stream().filter(tableFile -> tableFile.getDomainPdfUrl()!=null && (tableFile.getType()==1 || tableFile.getType()==2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
String pdfPath2 = file_path+"/pdf//"+pkeyId+"_2.pdf";
|
|
String pdfPath2 = file_path+"/pdf//"+pkeyId+"_2.pdf";
|
|
|
|
|
|
@@ -1408,16 +1425,20 @@ public class ExcelTabController extends BladeController {
|
|
.eq(WbsTreeContract::getId,wbsTreeContract.getId())
|
|
.eq(WbsTreeContract::getId,wbsTreeContract.getId())
|
|
.eq(WbsTreeContract::getContractId,wbsTreeContract.getContractId())
|
|
.eq(WbsTreeContract::getContractId,wbsTreeContract.getContractId())
|
|
.eq(WbsTreeContract::getParentId,wbsTreeContract.getParentId()));
|
|
.eq(WbsTreeContract::getParentId,wbsTreeContract.getParentId()));
|
|
|
|
+ List<WbsTreeContract> wbsTreeContractList2 = wbsTreeContractList.stream().sorted(Comparator.comparing(WbsTreeContract::getCreateTime).reversed()).collect(Collectors.toList());
|
|
|
|
+
|
|
|
|
|
|
long newPkId = SnowFlakeUtil.getId();
|
|
long newPkId = SnowFlakeUtil.getId();
|
|
Long id = wbsTreeContract.getId();
|
|
Long id = wbsTreeContract.getId();
|
|
wbsTreeContract.setPKeyId(newPkId);
|
|
wbsTreeContract.setPKeyId(newPkId);
|
|
wbsTreeContract.setCreateTime(new Date());
|
|
wbsTreeContract.setCreateTime(new Date());
|
|
- String deptName = wbsTreeContract.getDeptName();
|
|
|
|
|
|
+ String deptName = wbsTreeContractList2.get(0).getDeptName();
|
|
|
|
+
|
|
if(deptName.indexOf("__")>=0){
|
|
if(deptName.indexOf("__")>=0){
|
|
- deptName = deptName.split("__")[0]+"__"+wbsTreeContractList.size();
|
|
|
|
|
|
+ String oldName[] = deptName.split("__");
|
|
|
|
+ deptName = oldName[0]+"__"+ (Integer.parseInt(oldName[1])+1);
|
|
}else{
|
|
}else{
|
|
- deptName = deptName +"__"+wbsTreeContractList.size();
|
|
|
|
|
|
+ deptName = deptName +"__"+1;
|
|
}
|
|
}
|
|
wbsTreeContract.setDeptName(deptName);
|
|
wbsTreeContract.setDeptName(deptName);
|
|
wbsTreeContract.setIsCopeTab(2);
|
|
wbsTreeContract.setIsCopeTab(2);
|
|
@@ -1520,7 +1541,7 @@ public class ExcelTabController extends BladeController {
|
|
tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
tableFileList.sort(Comparator.comparing(TableFile::getType));
|
|
|
|
|
|
//
|
|
//
|
|
- List<String> dataListPdf = tableFileList.stream().filter(tableFile1 -> tableFile1.getDomainPdfUrl()!=null).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> dataListPdf = tableFileList.stream().filter(tableFile1 -> tableFile1.getDomainPdfUrl()!=null && (tableFile1.getType()==1 || tableFile1.getType()==2)).map(TableFile::getDomainPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
String pdfPath2 = file_path+"/pdf//"+pkeyId+"_2.pdf";
|
|
String pdfPath2 = file_path+"/pdf//"+pkeyId+"_2.pdf";
|
|
File tabpdf2 = ResourceUtil.getFile(pdfPath2);
|
|
File tabpdf2 = ResourceUtil.getFile(pdfPath2);
|
|
@@ -1572,23 +1593,30 @@ public class ExcelTabController extends BladeController {
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
|
|
// 获取有权限的节点信息
|
|
// 获取有权限的节点信息
|
|
List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
|
|
List<WbsTreeContract> wbsTreeContractList = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
|
|
- List<String> data = wbsTreeContractList.stream().filter(wbsTreeContract -> wbsTreeContract.getPdfUrl()!=null && wbsTreeContract.getIsBussShow()!=2).map(WbsTreeContract::getPdfUrl).collect(Collectors.toList());
|
|
|
|
|
|
+ List<String> data = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ if(wbsTreeContractList!=null && wbsTreeContractList.size()>=1){
|
|
|
|
+ for(WbsTreeContract wbsInfo:wbsTreeContractList){
|
|
|
|
+ // 隐藏的不生成pdf
|
|
|
|
+ if(wbsInfo.getIsBussShow()!=2){ //
|
|
|
|
+ if(wbsInfo.getPdfUrl()==null ||wbsInfo.getPdfUrl().equals("")){
|
|
|
|
+ data.add(wbsInfo.getPdfUrl());
|
|
|
|
+ }else{
|
|
|
|
+ R bussPdfInfo = this.getBussPdfInfo(wbsInfo.getPKeyId());
|
|
|
|
+ if (bussPdfInfo.getCode()==200){
|
|
|
|
+ data.add(bussPdfInfo.getData()+"");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
String listPdf = file_path+"pdf/"+nodeId+".pdf";
|
|
String listPdf = file_path+"pdf/"+nodeId+".pdf";
|
|
File tabpdf2 = ResourceUtil.getFile(listPdf);
|
|
File tabpdf2 = ResourceUtil.getFile(listPdf);
|
|
if(tabpdf2.exists()){
|
|
if(tabpdf2.exists()){
|
|
tabpdf2.delete();
|
|
tabpdf2.delete();
|
|
}
|
|
}
|
|
- // 添加从来没有预览过的pdf
|
|
|
|
- for (WbsTreeContract wbsTreeContract:wbsTreeContractList){
|
|
|
|
- if((wbsTreeContract.getPdfUrl()==null ||wbsTreeContract.getPdfUrl().equals("")) && wbsTreeContract.getIsBussShow()!=2){
|
|
|
|
- R bussPdfInfo = this.getBussPdfInfo(wbsTreeContract.getPKeyId());
|
|
|
|
-
|
|
|
|
- data.add(bussPdfInfo.getData()+"");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
FileUtils.mergePdfPublicMethods(data,listPdf);
|
|
FileUtils.mergePdfPublicMethods(data,listPdf);
|
|
-
|
|
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId+".pdf", listPdf);
|
|
BladeFile bladeFile = this.newIOSSClient.uploadFile(nodeId+".pdf", listPdf);
|
|
|
|
|
|
// 合并pdf集合
|
|
// 合并pdf集合
|
|
@@ -1626,7 +1654,6 @@ public class ExcelTabController extends BladeController {
|
|
fontProvider.addFont(fontProgram);
|
|
fontProvider.addFont(fontProgram);
|
|
properties.setFontProvider(fontProvider);
|
|
properties.setFontProvider(fontProvider);
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
- // log.error("creat base font erro" , e );
|
|
|
|
System.out.println("creat base font erro");
|
|
System.out.println("creat base font erro");
|
|
}
|
|
}
|
|
return properties;
|
|
return properties;
|