|
@@ -528,112 +528,101 @@ public class TextdictInfoController extends BladeController {
|
|
|
throw new ServiceException("请勿重复提交,请3秒后再尝试");
|
|
|
}
|
|
|
JSONArray jsonArray = dataInfo.getJSONArray("dataInfo");
|
|
|
- Long tableId = dataInfo.getLong("tabId"); //节点pkid
|
|
|
|
|
|
+ // -------- 移除所有html 的dqid -----
|
|
|
+ Long tableId = dataInfo.getLong("tabId"); //节点pkid
|
|
|
//当前清表信息
|
|
|
WbsTreePrivate wbsTreePrivate = wbsTreePrivateMapper.getByPKeyId(tableId);
|
|
|
-
|
|
|
- //获取当前项目下引用相同模板的元素表信息
|
|
|
- List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
- .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
- .eq(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId()));
|
|
|
-// .eq(WbsTreePrivate::getStatus, 1));
|
|
|
- List<Long> pKeyIds = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getPKeyId).collect(Collectors.toList());
|
|
|
- String ids = StringUtils.join(pKeyIds, ",");
|
|
|
- if (StringUtils.isNotEmpty(ids)) {
|
|
|
- //删除引用当前模板所有电签信息
|
|
|
- String delSql = "delete from m_textdict_info where tab_id in(" + ids + ") and type in(2,6)";
|
|
|
- jdbcTemplate.execute(delSql);
|
|
|
- }
|
|
|
-
|
|
|
- // 读取html页面信息
|
|
|
-
|
|
|
InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(wbsTreePrivate.getHtmlUrl());
|
|
|
String htmlString = IoUtil.readToString(inputStreamByUrl);
|
|
|
-
|
|
|
// 样式集合
|
|
|
Document doc = Jsoup.parse(htmlString);
|
|
|
-
|
|
|
//解析
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements trs = table.select("tr");
|
|
|
-
|
|
|
+ //解析
|
|
|
Elements onlyInfo = doc.select("[: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) {
|
|
|
element.removeAttr("dqid");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
if (jsonArray == null || jsonArray.size() == 0) {
|
|
|
return R.success("操作成功");
|
|
|
}
|
|
|
|
|
|
- //当前项目下引用相同清表,同步保存电签信息
|
|
|
- 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 delSql = "delete from m_textdict_info where tab_id in(SELECT p_key_id from m_wbs_tree_contract where p_key_id!='"+tableId+"' and project_id="+wbsTreePrivate.getProjectId()+" and excel_id="+wbsTreePrivate.getExcelId()+") and type in(2,6) and excel_id is null";
|
|
|
+ jdbcTemplate.execute(delSql);
|
|
|
|
|
|
- String id = element.children().get(0).attr("keyname");
|
|
|
+ // ------- 查询数据库是否存在 该该电签信息 ---------
|
|
|
+ for (int i = 0; i < jsonArray.size(); i++) {
|
|
|
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
|
|
|
+ TextdictInfo textdictInfo = new TextdictInfo();
|
|
|
|
|
|
- textdictInfo.setId(SnowFlakeUtil.getId());
|
|
|
- textdictInfo.setName("电签位置配置");
|
|
|
- textdictInfo.setType(jsonObject.getInteger("type"));
|
|
|
- textdictInfo.setColKey(id);
|
|
|
- textdictInfo.setSigRoleId(jsonObject.getString("sigRoleId"));
|
|
|
-
|
|
|
- textdictInfo.setTabId(pKeyId.toString());
|
|
|
+ String[] trtd = jsonObject.getString("colKey").split("__")[1].split("_");
|
|
|
+ Element element = trs.get(Integer.parseInt(trtd[0])).select("td").get(Integer.parseInt(trtd[1]));
|
|
|
|
|
|
- textdictInfo.setColName(jsonObject.getString("colName"));
|
|
|
- textdictInfo.setSigRoleName(jsonObject.getString("sigRoleName"));
|
|
|
- textdictInfo.setPyzbx(jsonObject.getDouble("pyzbx"));
|
|
|
- textdictInfo.setPyzby(jsonObject.getDouble("pyzby"));
|
|
|
+ String id = element.children().get(0).attr("keyname");
|
|
|
+ if(jsonObject.containsKey("id")){
|
|
|
+ textdictInfo.setId(jsonObject.getLong("id"));
|
|
|
+ }else{
|
|
|
+ textdictInfo.setId(SnowFlakeUtil.getId());
|
|
|
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");
|
|
|
- }
|
|
|
+ }
|
|
|
+ textdictInfo.setName("电签位置配置");
|
|
|
+ textdictInfo.setType(jsonObject.getInteger("type"));
|
|
|
+ textdictInfo.setColKey(id);
|
|
|
+ textdictInfo.setSigRoleId(jsonObject.getString("sigRoleId"));
|
|
|
+
|
|
|
+ textdictInfo.setTabId(tableId.toString());
|
|
|
+ textdictInfo.setExcelId(wbsTreePrivate.getExcelId()+"");
|
|
|
+
|
|
|
+ textdictInfo.setColName(jsonObject.getString("colName"));
|
|
|
+ textdictInfo.setSigRoleName(jsonObject.getString("sigRoleName"));
|
|
|
+ textdictInfo.setPyzbx(jsonObject.getDouble("pyzbx"));
|
|
|
+ textdictInfo.setPyzby(jsonObject.getDouble("pyzby"));
|
|
|
+ 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
|
|
|
- FileUtils.getSysLocalFileUrl();
|
|
|
File writeFile = new File(wbsTreePrivate.getHtmlUrl());
|
|
|
FileUtil.writeToFile(writeFile, doc.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
|
|
|
String str1 = wbsTreePrivate.getHtmlUrl().replace("Desktop//privateUrl", "Desktop/privateUrl");
|
|
|
String replace = str1.replace("\\", "\\\\");
|
|
|
- if (StringUtils.isNotEmpty(ids)) {
|
|
|
- //修改所有节点的htmlUrl
|
|
|
- String updateSqlP = "update m_wbs_tree_private set html_url = '" + replace + "' where p_key_id in (" + ids + ")";
|
|
|
- jdbcTemplate.execute(updateSqlP);
|
|
|
- }
|
|
|
+
|
|
|
+ //修改同几点的数据
|
|
|
+ String updateSqlP = "update m_wbs_tree_private set html_url = '" + replace + "' where p_key_id in (SELECT p_key_id from m_wbs_tree_contract where project_id="+wbsTreePrivate.getProjectId()+" and excel_id="+wbsTreePrivate.getExcelId()+")";
|
|
|
+ jdbcTemplate.execute(updateSqlP);
|
|
|
+
|
|
|
+ List<WbsTreePrivate> wbsTreePrivatesEqual = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery()
|
|
|
+ .eq(WbsTreePrivate::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
+ .eq(WbsTreePrivate::getExcelId, wbsTreePrivate.getExcelId()));
|
|
|
|
|
|
//修改对应合同段的htmlUrl,当前项目下对应合同段的节点
|
|
|
List<Long> cIdsList = wbsTreePrivatesEqual.stream().map(WbsTreePrivate::getId).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
List<Long> cPkeyIds = wbsTreeContractService.getBaseMapper().selectList(Wrappers.<WbsTreeContract>lambdaQuery()
|
|
|
.eq(WbsTreeContract::getProjectId, wbsTreePrivate.getProjectId())
|
|
|
.eq(WbsTreeContract::getExcelId, wbsTreePrivate.getExcelId())
|
|
|
-// .eq(WbsTreeContract::getStatus, 1)
|
|
|
.in(WbsTreeContract::getId, cIdsList)).stream().map(WbsTreeContract::getPKeyId).collect(Collectors.toList());
|
|
|
String cPkeyIdsStr = StringUtils.join(cPkeyIds, ",");
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(cPkeyIdsStr)) {
|
|
|
String updateSqlC = "update m_wbs_tree_contract set html_url = '" + replace + "' where p_key_id in (" + cPkeyIdsStr + ")";
|
|
|
jdbcTemplate.execute(updateSqlC);
|
|
@@ -646,7 +635,7 @@ public class TextdictInfoController extends BladeController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 保存电签
|
|
|
+ * 保存默认值
|
|
|
*/
|
|
|
@PostMapping("/save_defaulVal")
|
|
|
@ApiOperationSupport(order = 7)
|