Sfoglia il codice sorgente

2023 08 29 bug修改

zhuwei 2 anni fa
parent
commit
d1cbec6afb

+ 44 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/DateFormat.java

@@ -0,0 +1,44 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.manager.vo;
+
+import io.swagger.annotations.ApiModel;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 参数信息表实体类
+ *
+ * @author BladeX
+ * @since 2022-06-17
+ */
+@Data
+@ApiModel(value = "日期格式", description = "日期格式")
+public class DateFormat implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 名称
+     */
+    private String name;
+    /**
+     * 值
+     */
+    private String val;
+}

+ 4 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/TextdictDataInfoVO.java

@@ -54,4 +54,8 @@ public class TextdictDataInfoVO implements Serializable {
     @ApiModelProperty(value = "字段Id")
     private List<TextdictInfo_vo> textInfo;
 
+    @ApiModelProperty(value = "时间格式组合")
+    private List<DateFormat> dateFormat;
+
+
 }

+ 2 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -297,8 +297,6 @@ public class ExcelTabController extends BladeController {
         FileUtils.excelInfo(file.getInputStream(),exceUrl,thmlUrl,"1");
         // 上传excel文件
         BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(),exceUrl);
-      //  R<BladeFile> bladeFile = iossClient.addFileInfo(file);
-      //  BladeFile bladeFile1 = bladeFile.getData();
         detail.setExtension(file.getOriginalFilename());
         detail.setFileUrl(bladeFile.getLink());
         detail.setFileType(3); // 表示为清表信息  1 表示祖节点  2 表示为节点信息 3 表示清表
@@ -466,9 +464,7 @@ public class ExcelTabController extends BladeController {
         updateWrapper.set("excel_id", exceTabId);
 
         // 复制模版htmlURL
-
         File file_in = ResourceUtil.getFile(excelTab.getHtmlUrl());
-
         String filecode = SnowFlakeUtil.getId() + "";
         String thmlUrl = file_path + "/privateUrl/" + filecode + ".html";
         File file_out = ResourceUtil.getFile(thmlUrl);
@@ -488,6 +484,7 @@ public class ExcelTabController extends BladeController {
             updateWrapper.set("init_table_id", excelTab.getTabId());
             org.springblade.manager.entity.TableInfo tableInfo = tableInfoService.getById(excelTab.getTabId());
             updateWrapper.set("init_table_name", tableInfo.getTabEnName());
+            aPrivate.setInitTableName(tableInfo.getTabEnName());
         } else {
             if (aPrivate.getInitTableId() == null) {
                 org.springblade.manager.entity.TableInfo tableInfo = tableInfoService.getOne(new LambdaQueryWrapper<org.springblade.manager.entity.TableInfo>()
@@ -919,7 +916,6 @@ public class ExcelTabController extends BladeController {
                             zikey.add(dataInfo);
                         }
                     } else { //空行
-
                         List<Map<String, String>> left = new ArrayList<>();
                         List<Map<String, String>> top = new ArrayList<>();
                         for (int k = 0; k < zikey.size(); k++) {
@@ -3584,7 +3580,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "WBS私有库的pkeyId", required = true),
             @ApiImplicitParam(name = "tabId", value = "表信息id", required = true)
     })
-    public R<List<WbsFormElement>> getUnMatchField(Long pkeyId,Long tabId) throws FileNotFoundException {
+    public R<List<WbsFormElement>> getUnMatchField(Long pkeyId,Long tabId) throws Exception {
         return R.data(excelTabService.getUnMatchField(pkeyId,tabId));
     }
 

+ 5 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/LinkdataInfoController.java

@@ -39,6 +39,7 @@ import org.springblade.manager.entity.WbsTreePrivate;
 import org.springblade.manager.mapper.WbsTreePrivateMapper;
 import org.springblade.manager.service.ILinkdataInfoService;
 import org.springblade.manager.service.IWbsFormElementService;
+import org.springblade.manager.utils.FileUtils;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 
@@ -46,6 +47,7 @@ import javax.validation.Valid;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.io.InputStream;
 import java.util.List;
 import java.util.Map;
 
@@ -256,16 +258,15 @@ public class LinkdataInfoController extends BladeController {
     @PostMapping("/saveTabColInfo2")
     @ApiOperationSupport(order = 9)
     @ApiOperation(value = "编辑表单-替换元素||删除文本信息 保存", notes = "传入linkdataInfo数组")
-    public R saveTabColInfo2(@Valid @RequestBody List<LinkdataInfo> list) throws IOException {
+    public R saveTabColInfo2(@Valid @RequestBody List<LinkdataInfo> list) throws Exception {
         if (list != null && list.size() > 0) {
             // 获取 节点信息
             WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(list.get(0).getTabId());
             // 获取元素基本信息
             WbsFormElement wbsFormElement = wbsFormElementService.getById(list.get(0).getHtmlType());
             // 读取html页面信息
-            File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
-//                File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1696003315218776064.html");
-            FileInputStream inputStream = new FileInputStream(file1);
+
+            InputStream inputStream = FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl());
             String htmlString = IoUtil.readToString(inputStream);
             // 样式集合
             Document doc = Jsoup.parse(htmlString);
@@ -333,7 +334,6 @@ public class LinkdataInfoController extends BladeController {
 
             }
             File writefile = new File(wbsTreePrivate.getHtmlUrl());
-//                File writefile = new File("C:\\Users\\泓创研发01\\Desktop\\privateUrl\\1696003315218776064.html");
             FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
             inputStream.close();
             return R.success("操作成功");

+ 12 - 14
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/TextdictInfoController.java

@@ -235,22 +235,16 @@ public class TextdictInfoController extends BladeController {
     @ApiOperationSupport(order = 9)
     @ApiOperation(value = "新增或修改", notes = "传入textdictInfo")
     public R saveTextInfo(@Valid @RequestBody TextdictDataInfoVO textdictInfo) throws Exception {
-        String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
-        String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
+
         // 获取 节点信息
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(textdictInfo.getTableId());
 
         // 读取html页面信息
         String path = "";
         String fileUrl = wbsTreePrivate.getHtmlUrl();
-        File file1 = ResourceUtil.getFile(fileUrl);
-        InputStream fileInputStream;
-        if (file1.exists()) {
-            fileInputStream = new FileInputStream(file1);
-        } else {
-            path = sys_file_net_url + fileUrl.replaceAll("//", "/").replaceAll(file_path, "");
-            fileInputStream = CommonUtil.getOSSInputStream(path);
-        }
+
+        InputStream fileInputStream = FileUtils.getInputStreamByUrl(fileUrl);
+
         String htmlString = IoUtil.readToString(fileInputStream);
         // 样式集合
         Document doc = Jsoup.parse(htmlString);
@@ -318,8 +312,11 @@ public class TextdictInfoController extends BladeController {
                 element.empty().append(checkbox);
             }
         } else if (textdictInfo.getTextId().equals("date")) { // 日期--年月日时分秒
+
             element.empty().append("<el-date-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='datetime' format='YYYY年MM月DD日 HH:mm:ss' value-format='YYYY年MM月DD日 HH:mm:ss' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='contextmenuClick(" + parm + ")'  @mouseup.right='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'   placeholder='" + placeholder + "'> </el-date-picker>");
-        } else if (textdictInfo.getTextId().equals("dateYMD")) { // 日期--年月日
+        }
+
+        /*else if (textdictInfo.getTextId().equals("dateYMD")) { // 日期--年月日
             element.empty().append("<el-date-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='date' format='YYYY年MM月DD日' value-format='YYYY年MM月DD日' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='contextmenuClick(" + parm + ")'  @mouseup.right='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'   placeholder='" + placeholder + "'> </el-date-picker>");
         } else if (textdictInfo.getTextId().equals("dateHMS")) { // 日期--时分秒
             element.empty().append("<el-time-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='date' format='HH:mm:ss' value-format='HH:mm:ss' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='contextmenuClick(" + parm + ")'  @mouseup.right='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'   placeholder='" + placeholder + "'> </el-time-picker>");
@@ -329,7 +326,9 @@ public class TextdictInfoController extends BladeController {
             element.empty().append("<el-date-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='datetime' format='MM月DD日 HH:mm' value-format='MM月DD日 HH:mm' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='contextmenuClick(" + parm + ")'  @mouseup.right='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'   placeholder='" + placeholder + "'> </el-time-picker>");
         } else if (textdictInfo.getTextId().equals("dateDHM")) { // 日期--日时分
             element.empty().append("<el-date-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='datetime' format='DD日 HH:mm' value-format='DD日 HH:mm' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + "  @contextmenu.prevent.native='contextmenuClick(" + parm + ")'  @mouseup.right='RightClick(" + parm + ")' trIndex=" + trindex + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + " style='width:100%;height:100%'   placeholder='" + placeholder + "'> </el-time-picker>");
-        } else if (textdictInfo.getTextId().equals("daterange")) { // 时间段
+        }*/
+
+        else if (textdictInfo.getTextId().equals("daterange")) { // 时间段
             element.empty().append("<el-date-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='datetimerange' placeholder=" + placeholder + "  start-placeholder='开始日期'  end-placeholder='结束日期' format='YYYY年MM月DD日' trIndex=" + trindex + " keyname=" + keyname + " weighing=" + weighing + " tdIndex=" + tdindex + "  x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + ">");
             element.children().get(0).attr("@change", "datePickerChange($event,'" + keyname + "')");
         } else if (textdictInfo.getTextId().equals("daterangeYMD")) { // 时间段 /
@@ -358,9 +357,7 @@ public class TextdictInfoController extends BladeController {
         } else {
             FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
         }
-
         Thread.sleep(300);
-
         // 清空相关的保存数据
         String tabName = wbsTreePrivate.getInitTableName();
         String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
@@ -369,6 +366,7 @@ public class TextdictInfoController extends BladeController {
             String clarSql = "update  " + tabName + " set " + keyname.split("__")[0] + "=null where p_key_id in(SELECT p_key_id FROM m_wbs_tree_contract WHERE id ='" + wbsTreePrivate.getId() + "' and project_id='" + wbsTreePrivate.getProjectId() + "' )";
             jdbcTemplate.execute(clarSql);
         }
+        fileInputStream.close();
         return R.success("操作成功");
     }
 

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -401,6 +401,7 @@
         set excel_id= #{aPrivate.excelId},
             node_name = #{aPrivate.nodeName},
             full_name = #{aPrivate.fullName},
+            init_table_name = #{aPrivate.initTableName},
             is_link_table = 2,
             html_url = #{aPrivate.htmlUrl}
         where type = 2

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IExcelTabService.java

@@ -174,5 +174,5 @@ public interface IExcelTabService extends BaseService<ExcelTab> {
      */
     void gsColor(Long pKeyId, String nodeId, String projectId, Document doc);
 
-    List<WbsFormElement> getUnMatchField(Long pkeyId, Long tabId) throws FileNotFoundException;
+    List<WbsFormElement> getUnMatchField(Long pkeyId, Long tabId) throws Exception;
 }

+ 2 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -727,13 +727,12 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
      * @return
      */
     @Override
-    public List<WbsFormElement> getUnMatchField(Long pkeyId, Long tabId) throws FileNotFoundException {
+    public List<WbsFormElement> getUnMatchField(Long pkeyId, Long tabId) throws Exception {
         // 获取 节点信息
         WbsTreePrivate wbsTreePrivate = wbsTreePrivateService.getOne(
                 new LambdaQueryWrapper<WbsTreePrivate>().eq(WbsTreePrivate::getPKeyId,pkeyId));
         // 读取html页面信息
-        File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
-        FileInputStream inputStream = new FileInputStream(file1);
+        InputStream  inputStream = FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl());
         String htmlString = IoUtil.readToString(inputStream);
         // 样式集合
         Document doc = Jsoup.parse(htmlString);

+ 15 - 13
blade-service/blade-manager/src/main/java/org/springblade/manager/utils/FileUtils.java

@@ -415,21 +415,22 @@ public class FileUtils {
     }
 
 
-    public static void main123(String[] args) throws Exception {
-       String excelUrl = "/Users/hongchuangyanfa/Downloads/C4.13路基压实度汇总表.xlsx";
+    public static void main(String[] args) throws Exception {
+       String excelUrl = "/Users/hongchuangyanfa/Downloads/C10.28隧道注浆施工记录表.xlsx";
         String old_html = "/Users/hongchuangyanfa/Desktop/pdf/old_html.html";
         String old_xlsx = "/Users/hongchuangyanfa/Desktop/pdf/old_html.xlsx";
 
-      //  File data = new File(excelUrl);
-      //  InputStream inputStream = new FileInputStream(data);
-      //  excelInfo(inputStream,old_xlsx,old_html,"1");
+        File data = new File(excelUrl);
+        InputStream inputStream = new FileInputStream(data);
+        excelInfo(inputStream,old_xlsx,old_html,"1");
+
 
-        String new_html = "/Users/hongchuangyanfa/Desktop/pdf/new_html.html";
+/*        String new_html = "/Users/hongchuangyanfa/Desktop/pdf/new_html.html";
         String new_xlsx = "/Users/hongchuangyanfa/Desktop/pdf/new_html.xlsx";
 
         File data = new File(old_xlsx);
         InputStream inputStream = new FileInputStream(data);
-        excelInfo(inputStream,new_xlsx,new_html,"2");
+        excelInfo(inputStream,new_xlsx,new_html,"2");*/
     }
 
 
@@ -489,7 +490,6 @@ public class FileUtils {
                 CellRange oldcell = mergedCells[i];
                 CellRange mergedCell = sheet.getCellRange(oldcell.getRow(), oldcell.getColumn());
                 String data = mergedCell.getDataValidation().getErrorMessage();
-                System.out.println(mergedCell.getValue()+"---"+data);
                 if (StringUtils.isEmpty(data)) {
                     if(maxVal<=0){
                         j = j + 1;
@@ -507,7 +507,7 @@ public class FileUtils {
                 // 目标表添加备注信息
                 sheet2.getCellRange(oldcell.getRow(), oldcell.getColumn()).getDataValidation().setErrorMessage(j+"");
                 mergedCell.getDataValidation().setErrorMessage(j+"");
-                mergedCell.setValue(j + "");
+                mergedCell.setText(j + "");
                 dataMap.put("x1", mergedCell.getRow());
                 dataMap.put("x2", mergedCell.getLastRow());
                 dataMap.put("y1", mergedCell.getColumn());
@@ -537,7 +537,7 @@ public class FileUtils {
                 }
                 sheet2.getCellRange(oldcell.getRow(), oldcell.getColumn()).getDataValidation().setErrorMessage(j+"");
                 oldcell.getComment().getRichText().setText(j + "");
-                mergedCell.setValue(j + "");
+                mergedCell.setText(j + "");
                 dataMap.put("x1", mergedCell.getRow());
                 dataMap.put("x2", mergedCell.getLastRow());
                 dataMap.put("y1", mergedCell.getColumn());
@@ -569,9 +569,11 @@ public class FileUtils {
                 Elements td2 = trs2.get(i).select("td");
                 for (int x = 0; x < td1.size(); x++) {
                     Element cell1 = td1.get(x);
-                    if (cell1.children().size() >= 1) {
+                    /*if (cell1.children().size() >= 1) {
+                        String data = cell1.text();
                         cell1.empty();
-                    }
+                        cell1.text(data);
+                    }*/
                     Element cell2 = td2.get(x);
                     String html = cell2.text();
                     Map<String, Integer> xyMap = xyList.get(html);
@@ -588,7 +590,7 @@ public class FileUtils {
             File writeFile = new File(htmlUrl);
             FileUtil.writeToFile(writeFile, doc1.html(), Boolean.parseBoolean("UTF-8"));
             if (html2.exists()) {
-                html2.delete();
+               // html2.delete();
             }
             fileInputStream.close();
             wb2.dispose();