|
@@ -32,6 +32,8 @@ import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
|
import org.jsoup.select.Elements;
|
|
|
+import org.springblade.common.utils.CommonUtil;
|
|
|
+import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
import org.springblade.core.secure.BladeUser;
|
|
@@ -40,10 +42,13 @@ import org.springblade.core.tool.utils.*;
|
|
|
import org.springblade.manager.entity.WbsFormElement;
|
|
|
import org.springblade.manager.entity.WbsTreeContract;
|
|
|
import org.springblade.manager.entity.WbsTreePrivate;
|
|
|
+import org.springblade.manager.excel.WbsExcelBatchUtil;
|
|
|
import org.springblade.manager.mapper.WbsTreePrivateMapper;
|
|
|
+import org.springblade.manager.utils.CopyUtil;
|
|
|
import org.springblade.manager.vo.TextdictBy345VO;
|
|
|
import org.springblade.manager.vo.TextdictDataInfoVO;
|
|
|
import org.springblade.manager.vo.TextdictInfo_vo;
|
|
|
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
@@ -61,6 +66,7 @@ import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 参数信息表 控制器
|
|
@@ -146,37 +152,66 @@ public class TextdictInfoController extends BladeController {
|
|
|
/**
|
|
|
* 删除 参数信息表
|
|
|
*/
|
|
|
- @PostMapping("/remove")
|
|
|
- @ApiOperationSupport(order = 7)
|
|
|
- @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
- public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) throws FileNotFoundException {
|
|
|
-
|
|
|
- TextdictInfo textdictInfo = textdictInfoService.getById(ids);
|
|
|
- if(textdictInfo.getType()==5){
|
|
|
- // 获取 节点信息
|
|
|
- WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(Long.parseLong(textdictInfo.getTabId()));
|
|
|
+ @PostMapping("/remove")
|
|
|
+ @ApiOperationSupport(order = 7)
|
|
|
+ @ApiOperation(value = "逻辑删除", notes = "传入ids")
|
|
|
+ public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) throws FileNotFoundException {
|
|
|
+ //获取节点信息
|
|
|
+ TextdictInfo textdictInfo = textdictInfoService.getById(ids);
|
|
|
+ WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(Long.parseLong(textdictInfo.getTabId()));
|
|
|
+
|
|
|
+ //获取当前项目下引用相同模板的元素表信息
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
+ .eq(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
|
+ .eq(WbsTreePrivate::getStatus, 1));
|
|
|
+ List<Long> pKeyIds = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
+ String pIds = StringUtils.join(pKeyIds, ",");
|
|
|
+
|
|
|
+ //获取当前项目下相同模板的默认、提示信息
|
|
|
+ String sql = "select * from m_textdict_info where tab_id in (" + pIds + ")";
|
|
|
+ List<TextdictInfo> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(TextdictInfo.class));
|
|
|
+
|
|
|
+ List<String> delIds = new ArrayList<>();
|
|
|
+ for (TextdictInfo info : query) {
|
|
|
+ if (info.getName().equals(textdictInfo.getName())
|
|
|
+ && info.getType().equals(textdictInfo.getType())
|
|
|
+ && info.getColKey().equals(textdictInfo.getColKey())
|
|
|
+ && info.getColName().equals(textdictInfo.getColName())
|
|
|
+ && info.getSigRoleName().equals(textdictInfo.getSigRoleName())
|
|
|
+ && info.getPyzbx() == textdictInfo.getPyzbx()
|
|
|
+ && info.getPyzby() == textdictInfo.getPyzby()
|
|
|
+ && !info.getId().equals(textdictInfo.getId())
|
|
|
+ && !info.getTabId().equals(textdictInfo.getTabId())) {
|
|
|
+ delIds.add(info.getId().toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- // 读取html页面信息
|
|
|
+ if (textdictInfo.getType() == 5) {
|
|
|
+ //读取html页面信息
|
|
|
File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
- // 样式集合
|
|
|
+ //样式集合
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
//解析
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements trs = table.select("tr");
|
|
|
- String trtd[] = textdictInfo.getColKey().split("__");
|
|
|
- Element element = trs.get(Integer.parseInt(trtd[1].split("_")[0])).select("td").get(Integer.parseInt(trtd[1].split("_")[1]));
|
|
|
- if(element.html().indexOf("el-tooltip")>=0){
|
|
|
- Element newele = element.children().get(0).children().get(0);
|
|
|
- element.empty().append(newele+"");
|
|
|
- File writefile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
- FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ String trTd[] = textdictInfo.getColKey().split("__");
|
|
|
+ Element element = trs.get(Integer.parseInt(trTd[1].split("_")[0])).select("td").get(Integer.parseInt(trTd[1].split("_")[1]));
|
|
|
+ if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ Element newEle = element.children().get(0).children().get(0);
|
|
|
+ element.empty().append(newEle + "");
|
|
|
+ File writeFile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
+ FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- textdictInfoService.deleDataInfoById(ids);
|
|
|
- return R.success("成功");
|
|
|
- }
|
|
|
+ //批量删除
|
|
|
+ delIds.add(ids);
|
|
|
+ textdictInfoService.getBaseMapper().deleteBatchIds(delIds);
|
|
|
+
|
|
|
+ return R.success("成功");
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -244,13 +279,13 @@ public class TextdictInfoController extends BladeController {
|
|
|
List<TextdictInfo_vo> optionList = textdictInfo.getTextInfo();
|
|
|
if (optionList != null && optionList.size() >= 1) {
|
|
|
JSONArray objs = new JSONArray();
|
|
|
- for (int i = 0; i < optionList.size(); i++){
|
|
|
+ for (int i = 0; i < optionList.size(); i++) {
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("key",optionList.get(i).getDictValue());
|
|
|
- jsonObject.put("name",optionList.get(i).getDictValue());
|
|
|
+ jsonObject.put("key", optionList.get(i).getDictValue());
|
|
|
+ jsonObject.put("name", optionList.get(i).getDictValue());
|
|
|
objs.add(jsonObject);
|
|
|
}
|
|
|
- String checkbox = "<hc-form-checkbox-group :objs='"+objs+"' @change='checkboxGroupChange' :val=" + vmode + " v-model=" + vmode + " keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + " x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "> </hc-form-checkbox-group>";
|
|
|
+ String checkbox = "<hc-form-checkbox-group :objs='" + objs + "' @change='checkboxGroupChange' :val=" + vmode + " v-model=" + vmode + " keyname=" + keyname + " weighing=" + weighing + " placeholder=" + placeholder + " trIndex=" + trindex + " tdIndex=" + tdindex + " x1=" + x1 + " x2=" + x2 + " y1=" + y1 + " y2=" + y2 + "> </hc-form-checkbox-group>";
|
|
|
element.empty().append(checkbox);
|
|
|
}
|
|
|
} else if (textdictInfo.getTextId().equals("date")) { // 日期--年月日时分秒
|
|
@@ -261,22 +296,20 @@ public class TextdictInfoController extends BladeController {
|
|
|
element.empty().append("<el-time-picker v-model=" + vmode + " type='date' format='HH:mm:ss' value-format='HH:mm:ss' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + " @contextmenu.prevent.native='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("dateSM")) { // 日期--时分
|
|
|
element.empty().append("<el-time-picker v-model=" + vmode + " type='date' format='HH:mm' value-format='HH:mm' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + " @contextmenu.prevent.native='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("dateMDHM")) { // 日期--月日时分
|
|
|
+ } else if (textdictInfo.getTextId().equals("dateMDHM")) { // 日期--月日时分
|
|
|
element.empty().append("<el-date-picker 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='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")) { // 日期--日时分
|
|
|
+ } else if (textdictInfo.getTextId().equals("dateDHM")) { // 日期--日时分
|
|
|
element.empty().append("<el-date-picker v-model=" + vmode + " type='datetime' format='DD日 HH:mm' value-format='DD HH:mm' placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + " @contextmenu.prevent.native='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 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")) { // 时间段 /
|
|
|
element.empty().append("<el-date-picker 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")) {
|
|
|
- element.empty().append("<hc-table-form-upload :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> ");
|
|
|
- }else if (textdictInfo.getTextId().equals("searchSelect")) { //搜索框
|
|
|
+ } else if (textdictInfo.getTextId().equals("img")) {
|
|
|
+ element.empty().append("<hc-table-form-upload :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> ");
|
|
|
+ } else if (textdictInfo.getTextId().equals("searchSelect")) { //搜索框
|
|
|
element.empty().append("<hc-form-select-search type='dap_site_data' :val=" + vmode + " contractId='' pkeyId='' @change='formRemoteChange' v-model=" + vmode + " placeholder=" + placeholder + " keyname=" + keyname + " weighing=" + weighing + " @contextmenu.prevent.native='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 + ")");
|
|
@@ -288,7 +321,7 @@ public class TextdictInfoController extends BladeController {
|
|
|
String tabName = wbsTreePrivate.getInitTableName();
|
|
|
String isExitSql = " select * from information_schema.TABLES where TABLE_NAME='" + tabName + "'";
|
|
|
List<Map<String, Object>> tablist = jdbcTemplate.queryForList(isExitSql);
|
|
|
- if (tablist != null && tablist.size() > 0 && wbsTreePrivate.getType()!=10) {
|
|
|
+ if (tablist != null && tablist.size() > 0 && wbsTreePrivate.getType() != 10) {
|
|
|
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);
|
|
|
}
|
|
@@ -304,15 +337,24 @@ public class TextdictInfoController extends BladeController {
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
@ApiOperation(value = "保存电签", notes = "保存电签")
|
|
|
public R<String> saveSigInfo(@Valid @RequestBody JSONObject dataInfo) throws IOException {
|
|
|
-
|
|
|
JSONArray jsonArray = dataInfo.getJSONArray("dataInfo");
|
|
|
Long tableId = dataInfo.getLong("tabId");
|
|
|
- // 删除
|
|
|
- textdictInfoService.getBaseMapper().delete(Wrappers.<TextdictInfo>query().lambda()
|
|
|
- .eq(TextdictInfo::getTabId, tableId).in(TextdictInfo::getType,2,6));
|
|
|
-
|
|
|
|
|
|
+ //当前清表信息
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(tableId);
|
|
|
+
|
|
|
+ //获取当前项目下引用相同模板的元素表信息
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
+ .eq(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
|
+ .eq(WbsTreePrivate::getStatus, 1));
|
|
|
+ List<Long> pKeyIds = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
+ String ids = StringUtils.join(pKeyIds, ",");
|
|
|
+
|
|
|
+ //删除引用当前模板所有电签信息
|
|
|
+ String delSql = "delete from m_textdict_info where tab_id in(" + ids + ") and type in(2,6)";
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
+
|
|
|
// 读取html页面信息
|
|
|
File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
@@ -325,56 +367,64 @@ public class TextdictInfoController extends BladeController {
|
|
|
Elements trs = table.select("tr");
|
|
|
|
|
|
Elements onlyInfo = doc.select("[:readonly]");
|
|
|
- if(onlyInfo!=null && onlyInfo.size()>=1){
|
|
|
- for(Element element :onlyInfo ){
|
|
|
- element.removeAttr(":readonly");
|
|
|
- }
|
|
|
+ if (onlyInfo != null && onlyInfo.size() >= 1) {
|
|
|
+ for (Element element : onlyInfo) {
|
|
|
+ element.removeAttr(":readonly");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Elements tryInfo = doc.select("td[dqid]");
|
|
|
- if(tryInfo!=null && tryInfo.size()>=1){
|
|
|
- for(Element element :tryInfo ){
|
|
|
+ if (tryInfo != null && tryInfo.size() >= 1) {
|
|
|
+ for (Element element : tryInfo) {
|
|
|
element.removeAttr("dqid");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if(jsonArray==null || jsonArray.size()==0 ){
|
|
|
+ if (jsonArray == null || jsonArray.size() == 0) {
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
- List<TextdictInfo> textdictInfos = new ArrayList<>();
|
|
|
-
|
|
|
- for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
- JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
- TextdictInfo textdictInfo = new TextdictInfo();
|
|
|
- String[] trtd = jsonObject.getString("colKey").split("__")[1].split("_");
|
|
|
- Element element = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
|
|
|
-
|
|
|
- String id = element.children().get(0).attr("keyname");
|
|
|
- textdictInfo.setName("电签位置配置");
|
|
|
- textdictInfo.setType(jsonObject.getInteger("type"));
|
|
|
- textdictInfo.setColKey(id);
|
|
|
- textdictInfo.setSigRoleId(jsonObject.getString("sigRoleId"));
|
|
|
- textdictInfo.setTabId(jsonObject.getString("tabId"));
|
|
|
- textdictInfo.setColName(jsonObject.getString("colName"));
|
|
|
- textdictInfo.setSigRoleName(jsonObject.getString("sigRoleName"));
|
|
|
- textdictInfo.setPyzbx(jsonObject.getDouble("pyzbx"));
|
|
|
- textdictInfo.setPyzby(jsonObject.getDouble("pyzby"));
|
|
|
- textdictInfo.setIsDeleted(0);
|
|
|
- textdictInfoService.saveOrUpdate(textdictInfo);
|
|
|
- element.removeAttr("dqId");
|
|
|
- element.attr("dqId", textdictInfo.getId() + "");
|
|
|
- if(jsonObject.getInteger("type")==2){ //个人签字 不能用户输入
|
|
|
- if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
- element.children().get(0).children().get(0).attr(":readonly","true");
|
|
|
- }else{
|
|
|
- element.children().get(0).attr(":readonly","true");
|
|
|
+
|
|
|
+ //当前项目下引用相同清表,同步保存电签信息
|
|
|
+ for (Long pKeyId : pKeyIds) {
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ TextdictInfo textdictInfo = new TextdictInfo();
|
|
|
+ String[] trtd = jsonObject.getString("colKey").split("__")[1].split("_");
|
|
|
+ Element element = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
|
|
|
+
|
|
|
+ String id = element.children().get(0).attr("keyname");
|
|
|
+
|
|
|
+ textdictInfo.setId(SnowFlakeUtil.getId());
|
|
|
+ textdictInfo.setName("电签位置配置");
|
|
|
+ textdictInfo.setType(jsonObject.getInteger("type"));
|
|
|
+ textdictInfo.setColKey(id);
|
|
|
+ textdictInfo.setSigRoleId(jsonObject.getString("sigRoleId"));
|
|
|
+
|
|
|
+ textdictInfo.setTabId(pKeyId.toString());
|
|
|
+
|
|
|
+ textdictInfo.setColName(jsonObject.getString("colName"));
|
|
|
+ textdictInfo.setSigRoleName(jsonObject.getString("sigRoleName"));
|
|
|
+ textdictInfo.setPyzbx(jsonObject.getDouble("pyzbx"));
|
|
|
+ textdictInfo.setPyzby(jsonObject.getDouble("pyzby"));
|
|
|
+ textdictInfo.setIsDeleted(0);
|
|
|
+ textdictInfoService.saveOrUpdate(textdictInfo);
|
|
|
+
|
|
|
+ element.removeAttr("dqId");
|
|
|
+ element.attr("dqId", textdictInfo.getId() + "");
|
|
|
+ if (jsonObject.getInteger("type") == 2) { //个人签字 不能用户输入
|
|
|
+ if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ element.children().get(0).children().get(0).attr(":readonly", "true");
|
|
|
+ } else {
|
|
|
+ element.children().get(0).attr(":readonly", "true");
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 写入 excel
|
|
|
- File writefile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
- FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ //写入excel
|
|
|
+ File writeFile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
+ FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
@@ -384,20 +434,27 @@ public class TextdictInfoController extends BladeController {
|
|
|
@PostMapping("/save_defaulVal")
|
|
|
@ApiOperationSupport(order = 7)
|
|
|
@ApiOperation(value = "保存默认值", notes = "保存默认值")
|
|
|
- public R<String> saveDefaulVal(@Valid @RequestBody TextdictBy345VO textdictInfo) throws IOException {
|
|
|
+ public R<String> saveDefaulVal(@Valid @RequestBody TextdictBy345VO textdictInfo) throws IOException, ClassNotFoundException {
|
|
|
+ //当前清表信息
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(textdictInfo.getTableId());
|
|
|
|
|
|
- // 读取html页面信息
|
|
|
+ //获取当前项目下引用相同模板的元素表信息
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
+ .eq(WbsTreePrivate::getHtmlUrl, wbsTreePrivate.getHtmlUrl())
|
|
|
+ .eq(WbsTreePrivate::getStatus, 1));
|
|
|
+ List<Long> pKeyIds = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
+
|
|
|
+ //读取html页面信息
|
|
|
File file1 = ResourceUtil.getFile(wbsTreePrivate.getHtmlUrl());
|
|
|
String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
- // 样式集合
|
|
|
+ //样式集合
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
//解析
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements trs = table.select("tr");
|
|
|
Element element = trs.get(textdictInfo.getTrIndex()).select("td").get(textdictInfo.getTdIndex());
|
|
|
|
|
|
- //
|
|
|
String placeholder = "";
|
|
|
String id = element.children().get(0).attr("keyname");
|
|
|
if (element.html().indexOf("el-tooltip") >= 0) {
|
|
@@ -408,41 +465,71 @@ public class TextdictInfoController extends BladeController {
|
|
|
id = element.children().get(0).attr("keyname");
|
|
|
}
|
|
|
|
|
|
- TextdictInfo textdictBean = new TextdictInfo();
|
|
|
- textdictBean.setIsDeleted(0);
|
|
|
- textdictBean.setTabId(textdictInfo.getTableId() + "");
|
|
|
+ //查询当前类型该表的所有默认 或 提示信息
|
|
|
+ List<TextdictInfo> textDictInfosOld = textdictInfoService.getBaseMapper().selectList(Wrappers.<TextdictInfo>lambdaQuery()
|
|
|
+ .eq(TextdictInfo::getTabId, textdictInfo.getTableId())
|
|
|
+ .eq(TextdictInfo::getType, textdictInfo.getType()));
|
|
|
|
|
|
- textdictBean.setColKey(id);
|
|
|
- textdictBean.setColName(placeholder);
|
|
|
- textdictBean.setSigRoleName(textdictInfo.getTextId());
|
|
|
+ for (Long pKeyId : pKeyIds) {
|
|
|
|
|
|
- if (textdictInfo.getType() == 4) { //默认值
|
|
|
- textdictBean.setType(4);
|
|
|
- textdictBean.setName("编辑默认值");
|
|
|
- }
|
|
|
- if (textdictInfo.getType() == 5) { // 提示语
|
|
|
- textdictBean.setType(5);
|
|
|
- textdictBean.setName("提示信息");
|
|
|
- String lastHmtl = "";
|
|
|
- if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
- element.children().attr("content", textdictInfo.getTextId());
|
|
|
- } else {
|
|
|
- lastHmtl = " <el-tooltip content='" + textdictInfo.getTextId() + "' placement='top' effect='customized'>" + element.html() + "</el-tooltip>";
|
|
|
- element.empty().append(lastHmtl);
|
|
|
+ List<TextdictInfo> textDictInfosNew = CommonUtil.deepCopy(textDictInfosOld);
|
|
|
+
|
|
|
+ TextdictInfo textDictBean = new TextdictInfo();
|
|
|
+ textDictBean.setColKey(id);
|
|
|
+ textDictBean.setColName(placeholder);
|
|
|
+ textDictBean.setSigRoleName(textdictInfo.getTextId());
|
|
|
+ textDictBean.setIsDeleted(0);
|
|
|
+
|
|
|
+ if (textdictInfo.getType() == 4) { //默认值
|
|
|
+ textDictBean.setType(4);
|
|
|
+ textDictBean.setName("编辑默认值");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (textdictInfo.getType() == 5) { // 提示语
|
|
|
+ textDictBean.setType(5);
|
|
|
+ textDictBean.setName("提示信息");
|
|
|
+ String lastHtml = "";
|
|
|
+ if (element.html().indexOf("el-tooltip") >= 0) {
|
|
|
+ element.children().attr("content", textdictInfo.getTextId());
|
|
|
+ } else {
|
|
|
+ lastHtml = " <el-tooltip content='" + textdictInfo.getTextId() + "' placement='top' effect='customized'>" + element.html() + "</el-tooltip>";
|
|
|
+ element.empty().append(lastHtml);
|
|
|
+ }
|
|
|
+ File writeFile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
+ FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
+ }
|
|
|
+
|
|
|
+ textDictInfosNew.add(textDictBean);
|
|
|
+
|
|
|
+ //重新构造赋值
|
|
|
+ if (textDictBean.getType() == 4) {
|
|
|
+ for (TextdictInfo obj : textDictInfosNew) {
|
|
|
+ obj.setId(SnowFlakeUtil.getId());
|
|
|
+ obj.setTabId(pKeyId.toString());
|
|
|
+ obj.setType(4);
|
|
|
+ obj.setName("编辑默认值");
|
|
|
+ }
|
|
|
+ } else if (textDictBean.getType() == 5) {
|
|
|
+ for (TextdictInfo obj : textDictInfosNew) {
|
|
|
+ obj.setId(SnowFlakeUtil.getId());
|
|
|
+ obj.setTabId(pKeyId.toString());
|
|
|
+ obj.setType(5);
|
|
|
+ obj.setName("提示信息");
|
|
|
+ }
|
|
|
}
|
|
|
- File writefile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
- FileUtil.writeToFile(writefile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
- }
|
|
|
|
|
|
- // 删除
|
|
|
- textdictInfoService.getBaseMapper().delete(Wrappers.<TextdictInfo>query().lambda().eq(TextdictInfo::getTabId, textdictInfo.getTableId())
|
|
|
- .eq(TextdictInfo::getType, textdictInfo.getType()).eq(TextdictInfo::getColKey, id));
|
|
|
+ //删除当前类型
|
|
|
+ textdictInfoService.getBaseMapper().delete(Wrappers.<TextdictInfo>query().lambda()
|
|
|
+ .eq(TextdictInfo::getTabId, pKeyId)
|
|
|
+ .eq(TextdictInfo::getType, textdictInfo.getType()));
|
|
|
|
|
|
- textdictInfoService.saveOrUpdate(textdictBean);
|
|
|
+ //批量新增
|
|
|
+ textdictInfoService.saveBatch(textDictInfosNew);
|
|
|
+ }
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
-/* public static void main(String[] args) throws FileNotFoundException {
|
|
|
+ /*public static void main(String[] args) throws FileNotFoundException {
|
|
|
File file1 = ResourceUtil.getFile("/Users/hongchuangyanfa/Desktop/privateUrl/1567789917445029888.html");
|
|
|
String htmlString = IoUtil.readToString(new FileInputStream(file1));
|
|
|
// 样式集合
|
|
@@ -463,4 +550,5 @@ public class TextdictInfoController extends BladeController {
|
|
|
|
|
|
System.out.println();
|
|
|
}*/
|
|
|
+
|
|
|
}
|