|
@@ -33,7 +33,11 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.common.constant.CommonConstant;
|
|
|
+import org.springblade.common.utils.CommonUtil;
|
|
|
+import org.springblade.common.utils.FileUtils;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.common.utils.SystemUtils;
|
|
|
import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
@@ -48,6 +52,7 @@ import org.springblade.manager.service.impl.WbsTreePrivateServiceImpl;
|
|
|
import org.springblade.manager.vo.TextdictBy345VO;
|
|
|
import org.springblade.manager.vo.TextdictDataInfoVO;
|
|
|
import org.springblade.manager.vo.TextdictInfo_vo;
|
|
|
+import org.springblade.system.cache.ParamCache;
|
|
|
import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -57,10 +62,7 @@ import org.springblade.manager.vo.TextdictInfoVO;
|
|
|
import org.springblade.manager.service.ITextdictInfoService;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.FileNotFoundException;
|
|
|
-import java.io.IOException;
|
|
|
+import java.io.*;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -231,14 +233,24 @@ public class TextdictInfoController extends BladeController {
|
|
|
@PostMapping("/saveTextInfo")
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入textdictInfo")
|
|
|
- public R saveTextInfo(@Valid @RequestBody TextdictDataInfoVO textdictInfo) throws FileNotFoundException, InterruptedException {
|
|
|
-
|
|
|
+ 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页面信息
|
|
|
- File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
- String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
// 样式集合
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
|
|
@@ -323,14 +335,27 @@ public class TextdictInfoController extends BladeController {
|
|
|
element.empty().append("<el-date-picker @keyDowns='dateKeydown()' v-model=" + vmode + " type='datetimerange' range-separator='/' 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("img")) {
|
|
|
+ } else if (textdictInfo.getTextId().equals("img")) { //图片
|
|
|
element.empty().append("<hc-table-form-upload @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' :src='" + vmode + "' placeholder=" + placeholder + " v-model=" + vmode + " keyName=" + keyname + " weighing=" + weighing + " @success='formUploadSuccess' @del='delTableFormFile' trIndex=" + trindex + " tdIndex=" + tdindex + " x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "></hc-table-form-upload> ");
|
|
|
+ element.removeAttr("style");
|
|
|
} else if (textdictInfo.getTextId().equals("searchSelect")) { //搜索框
|
|
|
element.empty().append("<hc-form-select-search id=" + keyname + " @keydown.shift.up='keyupShiftUp' @keydown.shift.down='keyupShiftDown' @keydown.shift.left='keyupShiftLeft' @keydown.shift.right='keyupShiftRight' type='dap_site_data' :val=" + vmode + " contractId='' pkeyId='' @change='formRemoteChange' v-model=" + vmode + " 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%' > </hc-form-select-search>");
|
|
|
}
|
|
|
element.attr("@click", "getInformation(" + oncklickText + ")");
|
|
|
- File writefile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
- FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+
|
|
|
+ File writeFile = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
+ if (!writeFile.exists()) {
|
|
|
+ if (StringUtils.isNotEmpty(path)) {
|
|
|
+ File file = new File(path);
|
|
|
+ if (!file.exists()) {
|
|
|
+ file.mkdirs();
|
|
|
+ }
|
|
|
+ FileUtil.writeToFile(file, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ }
|
|
|
+
|
|
|
Thread.sleep(300);
|
|
|
|
|
|
// 清空相关的保存数据
|