|
@@ -43,6 +43,7 @@ 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.unit.HtmlToPdf;
|
|
|
import org.springblade.manager.vo.*;
|
|
|
import org.springblade.manager.wrapper.ExcelTabWrapper;
|
|
|
import org.springblade.resource.feign.CommonFileClient;
|
|
@@ -82,7 +83,7 @@ public class ExcelTabController extends BladeController {
|
|
|
// wes 基本信息表
|
|
|
private final IWbsTreeService wbsTreeService;
|
|
|
// excel 解析结构
|
|
|
- //private final IExctabCellService exctabCellService;
|
|
|
+ private final IExctabCellService exctabCellService;
|
|
|
|
|
|
private final IOSSClient iossClient;
|
|
|
|
|
@@ -284,9 +285,9 @@ public class ExcelTabController extends BladeController {
|
|
|
@GetMapping("/getWbsTypeList")
|
|
|
@ApiOperationSupport(order = 10)
|
|
|
@ApiOperation(value = "清表编辑 wbs 下拉框选择", notes = "传入excelTab")
|
|
|
- @ApiImplicitParams(value = {@ApiImplicitParam(name = "wbstype", value = "wbstype", required = true)})
|
|
|
- public R getWbsTypeList(Integer wbstype) {
|
|
|
- List<ExcelTabWbsTypeVO> wbsTypeList= excelTabService.getWbsTypeList(wbstype);
|
|
|
+ @ApiImplicitParams(value = {@ApiImplicitParam(name = "wbsType", value = "wbsType", required = true)})
|
|
|
+ public R getWbsTypeList(Integer wbsType) {
|
|
|
+ List<ExcelTabWbsTypeVO> wbsTypeList= excelTabService.getWbsTypeList(wbsType);
|
|
|
return R.data(wbsTypeList);
|
|
|
}
|
|
|
|
|
@@ -309,7 +310,7 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
if(wbsType==2){ // 私有项目wbs 树
|
|
|
- List<WbsTreeVO> tree = excelTabService.lazyTree(wbsId, Func.toStrWithEmpty(null, bladeUser.getTenantId()), parentId);
|
|
|
+ List<WbsTreeVO> tree = excelTabService.lazyTreeByPri(wbsId, Func.toStrWithEmpty(null, bladeUser.getTenantId()), parentId);
|
|
|
if (tree != null && tree.size() > 0) {
|
|
|
return R.data(tree);
|
|
|
}
|
|
@@ -369,10 +370,10 @@ public class ExcelTabController extends BladeController {
|
|
|
for (ExcelTabWbsTypeVO info : linkDataInfo){
|
|
|
String[] pk_id = info.getLinkIds().split(",");
|
|
|
for(String pkInfo : pk_id){
|
|
|
-
|
|
|
UpdateWrapper<WbsTreePrivate> updateWrapper = new UpdateWrapper<>();
|
|
|
- updateWrapper.in("p_key_id",Long.parseLong(pkInfo));
|
|
|
- updateWrapper.set("is_link_table",2);
|
|
|
+ String [] pk_type = pkInfo.trim().split("_");
|
|
|
+ updateWrapper.in("p_key_id",Long.parseLong(pk_type[0]));
|
|
|
+ updateWrapper.set("is_link_table",Integer.parseInt(pk_type[1]));
|
|
|
updateWrapper.set("excel_id",excelTab.getId());
|
|
|
wbsTreePrivateService.update(updateWrapper);
|
|
|
}
|
|
@@ -568,12 +569,13 @@ 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")){ // 节点保存
|
|
|
+ if(dataInfo.containsKey("dataInfo")){ // 节点保存
|
|
|
+ JSONObject jsonObject = dataInfo.getJSONObject("dataInfo");
|
|
|
dataArray = jsonObject.getJSONArray("orderList");
|
|
|
}else{ // 单个保存
|
|
|
- dataArray.add(jsonObject);
|
|
|
+ dataArray.add(dataInfo);
|
|
|
}
|
|
|
|
|
|
for(int m=0;m<dataArray.size();m++){
|
|
@@ -696,7 +698,7 @@ public class ExcelTabController extends BladeController {
|
|
|
return R.success("1");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ // 上传解析 html
|
|
|
public void expailHtmlInfo(String thmlUrl,Long excelId) throws FileNotFoundException {
|
|
|
|
|
|
// 读取
|
|
@@ -835,7 +837,6 @@ public class ExcelTabController extends BladeController {
|
|
|
List<Map<String,String>> top = new ArrayList<>();
|
|
|
for(int k=0 ; k< zikey.size() ;k++){
|
|
|
String name = zikey.get(k).get("name");
|
|
|
- // String name2 = zikey.get(k).get("name").replaceAll("[^\u4E00-\u9FA5]", "");
|
|
|
int xx1 = Integer.parseInt( zikey.get(k).get("x1"));
|
|
|
int xx2 = Integer.parseInt( zikey.get(k).get("x2"));
|
|
|
int yy1 = Integer.parseInt( zikey.get(k).get("y1"));
|
|
@@ -896,59 +897,75 @@ public class ExcelTabController extends BladeController {
|
|
|
exctabCell.setExctabId(excelId);
|
|
|
exctabCell.setTextInfo("签字时间");
|
|
|
exctabCell.setIsDeleted(0);
|
|
|
- exctabCell.setTrIndex(i);
|
|
|
- exctabCell.setTdIndex(j);
|
|
|
+ exctabCell.setXys(i+"_"+j);
|
|
|
+ colTitle.add(exctabCell);
|
|
|
}else {
|
|
|
String parm = i+","+j+","+x1+","+x2+","+y1+","+y2+",$event";
|
|
|
if(index_state){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}else{
|
|
|
if(j==0 ){
|
|
|
if(colspan ==maxCol && i>=1 && i<=2){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}
|
|
|
}else{
|
|
|
Element bforData = tds.get(j-1);
|
|
|
if(!bforData.text().isEmpty()){
|
|
|
if(rowspan>=1){
|
|
|
- data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='textarea' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;' :rows="+rowspan*2+" placeholder=''> </el-input>");
|
|
|
}else{
|
|
|
- data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;background-color: #edc9a2' placeholder=''> </el-input>");
|
|
|
+ data.empty().append("<el-input type='text' @contextmenu.prevent.native='RightClick("+parm+")' trIndex="+i+" tdIndex="+j+" x1="+x1+" x2="+x2+" y1="+y1+" y2="+y2+" style='width:100%;height:100%;' placeholder=''> </el-input>");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- exctabCell.setExctabId(excelId);
|
|
|
- exctabCell.setTextInfo(inputText.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
|
|
|
- exctabCell.setIsDeleted(0);
|
|
|
- exctabCell.setTrIndex(i);
|
|
|
- exctabCell.setTdIndex(j);
|
|
|
+ if(!inputText.equals("")){
|
|
|
+ System.out.println(inputText);
|
|
|
+ exctabCell.setExctabId(excelId);
|
|
|
+ exctabCell.setTextInfo(inputText.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
|
|
|
+ exctabCell.setIsDeleted(0);
|
|
|
+ exctabCell.setXys(i+"_"+j);
|
|
|
+ colTitle.add(exctabCell);
|
|
|
+ }
|
|
|
}
|
|
|
data.attr("title",inputText.replaceAll("[^(\u4E00-\u9FA5_)]", ""));
|
|
|
- colTitle.add(exctabCell);
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 去掉重复的数据
|
|
|
- //colTitle.stream().collect(toMap(ExctabCell::getTextInfo, identity());
|
|
|
- // List<ExctabCell> distinctList = colTitle.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(ExctabCell::getTextInfo))), ArrayList::new));
|
|
|
- // exctabCellService.saveBatch(colTitle);
|
|
|
+
|
|
|
+ Map<String, String> groupMap2 = colTitle.stream()
|
|
|
+ .collect(Collectors.groupingBy(ExctabCell::getTextInfo, Collectors.mapping(ExctabCell::getXys, Collectors.joining(","))));
|
|
|
+
|
|
|
+ exctabCellService.DeletExcelByTableId(excelId+"");
|
|
|
+
|
|
|
+ List<ExctabCell> colTitle2 = new ArrayList<>();
|
|
|
+ for (String title:groupMap2.keySet()){
|
|
|
+ ExctabCell exctabCell = new ExctabCell();
|
|
|
+ exctabCell.setExctabId(excelId);
|
|
|
+ exctabCell.setIsDeleted(0);
|
|
|
+ exctabCell.setTextInfo(title);
|
|
|
+ exctabCell.setXys(groupMap2.get(title));
|
|
|
+ colTitle2.add(exctabCell);
|
|
|
+ }
|
|
|
+ exctabCellService.saveBatch(colTitle2);
|
|
|
+
|
|
|
// 保存
|
|
|
File writefile = new File(thmlUrl);
|
|
|
FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//计算区域坐标
|
|
|
public static String getTrInfo(Elements tds,Map<String ,String > styleMap,boolean index_state,Integer xy_type,int maxCol){
|
|
|
|
|
@@ -1125,8 +1142,7 @@ public class ExcelTabController extends BladeController {
|
|
|
@ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
|
|
|
})
|
|
|
public R getBussPdfInfo(Long pkeyId) throws IOException {
|
|
|
- String fontPath ="/Users/hongchuangyanfa/tool/simhei.ttf";
|
|
|
- ConverterProperties properties = creatBaseFont(fontPath);
|
|
|
+
|
|
|
WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
|
|
|
.eq(WbsTreeContract::getPKeyId, pkeyId));
|
|
|
|
|
@@ -1178,13 +1194,13 @@ public class ExcelTabController extends BladeController {
|
|
|
}
|
|
|
|
|
|
String pdfPath="/Users/hongchuangyanfa/Desktop/pdf//"+pkeyId+".pdf";
|
|
|
+ String pdfHtmlPath="/Users/hongchuangyanfa/Desktop/pdfHtml//"+pkeyId+".pdf";
|
|
|
+
|
|
|
+ File writefile = new File(pdfHtmlPath);
|
|
|
+ FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
|
|
|
- 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);
|
|
|
+ HtmlToPdf html = new HtmlToPdf();
|
|
|
+ html.tomPdf(pdfHtmlPath,pdfPath);
|
|
|
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
|