|
@@ -1,8 +1,10 @@
|
|
|
package com.mixsmart.utils;
|
|
|
|
|
|
|
|
|
-import cn.hutool.json.JSONObject;
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.jfireel.expression.Expression;
|
|
|
import org.apache.commons.lang.math.NumberUtils;
|
|
|
import org.apache.http.*;
|
|
@@ -37,6 +39,7 @@ import org.jsoup.nodes.Document;
|
|
|
import org.springblade.common.utils.BaseUtils;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
import org.springblade.core.tool.utils.*;
|
|
|
+import org.springblade.manager.bean.TableInfo;
|
|
|
import org.springblade.manager.dto.Coords;
|
|
|
import org.springblade.manager.dto.ElementData;
|
|
|
import org.springblade.manager.dto.FormData;
|
|
@@ -888,5 +891,159 @@ public static Map<String,List<Long>> relatedPages(List<FormData> curFormDatas ,L
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public static List<TableInfo> getTableInfoList(JSONArray dataArray) {
|
|
|
+ if (dataArray != null && !dataArray.isEmpty()) {
|
|
|
+ List<TableInfo> result = new ArrayList<>();
|
|
|
+ for (int m = 0; m < dataArray.size(); m++) {
|
|
|
+ TableInfo tableInfo = new TableInfo();
|
|
|
+ com.alibaba.fastjson.JSONObject dataInfo2 = dataArray.getJSONObject(m);
|
|
|
+ //
|
|
|
+ tableInfo.setContractId(dataInfo2.getString("contractId"));
|
|
|
+ tableInfo.setPkeyId(dataInfo2.getString("pkeyId"));
|
|
|
+ tableInfo.setProjectId(dataInfo2.getString("projectId"));
|
|
|
+ //huangjn 填报的类型,施工或监理
|
|
|
+ tableInfo.setClassify(dataInfo2.getString("classify"));
|
|
|
+
|
|
|
+ //设置首件信息
|
|
|
+ setFirstData(dataInfo2, tableInfo);
|
|
|
+ //设置日志信息
|
|
|
+ setTheLogData(dataInfo2, tableInfo);
|
|
|
+
|
|
|
+ dataInfo2.fluentRemove("contractId")
|
|
|
+ .fluentRemove("pkeyId")
|
|
|
+ .fluentRemove("p_key_id")
|
|
|
+ .fluentRemove("projectId")
|
|
|
+ .fluentRemove("classify")
|
|
|
+ .fluentRemove("pickerKey")
|
|
|
+ .fluentRemove("id")
|
|
|
+ .fluentRemove("isFirst")
|
|
|
+ .fluentRemove("firstNodeId")
|
|
|
+ .fluentRemove("isTheLog")
|
|
|
+ .fluentRemove("theLogId")
|
|
|
+ .fluentRemove("linkTabIds")
|
|
|
+ .fluentRemove("recordTime")
|
|
|
+ .fluentRemove("businessId")
|
|
|
+ .fluentRemove("sourceUrl")
|
|
|
+ .fluentRemove("pdfUrl")
|
|
|
+ .fluentRemove("firstFileName")
|
|
|
+ .fluentRemove("");
|
|
|
+ // 计算数据
|
|
|
+ LinkedHashMap<String, List<String>> dataMap = dataInfo2.keySet().stream().filter(e -> e.contains("__")).collect(Collectors.groupingBy(e -> e.split("__")[0], LinkedHashMap<String, List<String>>::new, Collectors.toList()));
|
|
|
+ LinkedHashMap<String, String> dataMap2 = new LinkedHashMap<>();
|
|
|
+ // 字段组合
|
|
|
+ for (String k : dataMap.keySet()) {
|
|
|
+ if (dataMap.get(k).size() > 1 && !dataMap.get(k).contains("000Z")) {
|
|
|
+ String[] ziduan = dataMap.get(k).toArray(new String[]{});
|
|
|
+ String temp = "";
|
|
|
+ for (int i = 0; i < ziduan.length - 1; i++) {
|
|
|
+ for (int j = 0; j < ziduan.length - i - 1; j++) {
|
|
|
+ Integer tr = Integer.parseInt((ziduan[j].split("__")[1]).split("_")[0]);
|
|
|
+ Integer td = Integer.parseInt(ziduan[j].split("__")[1].split("_")[1]);
|
|
|
+
|
|
|
+ Integer tr_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[0]);
|
|
|
+ Integer td_1 = Integer.parseInt(ziduan[j + 1].split("__")[1].split("_")[1]);
|
|
|
+
|
|
|
+ if (tr > tr_1 && td.equals(td_1)) { //纵向排序
|
|
|
+ temp = ziduan[j];
|
|
|
+ ziduan[j] = ziduan[j + 1];
|
|
|
+ ziduan[j + 1] = temp;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String lastStr = dataInfo2.getString(ziduan[0]) + "_^_" + ziduan[0].split("__")[1];
|
|
|
+ for (int i = 1; i < ziduan.length; i++) {
|
|
|
+ String keyData = dataInfo2.getString(ziduan[i]);
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(keyData) && !keyData.equals("")) {
|
|
|
+ lastStr += "☆" + dataInfo2.getString(ziduan[i]) + "_^_" + ziduan[i].split("__")[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ dataMap2.put(k, lastStr);
|
|
|
+ } else {
|
|
|
+ String dataVal = dataInfo2.getString(dataMap.get(k).get(0));
|
|
|
+ if (org.apache.commons.lang.StringUtils.isNotEmpty(dataVal)) {
|
|
|
+ if (dataVal.contains("Ljava")) {
|
|
|
+ Object o = dataInfo2.get(dataMap.get(k).get(0));
|
|
|
+ dataVal = JSON.toJSONString(o).replace("\"", "");
|
|
|
+ }
|
|
|
+ dataMap2.put(k, dataVal + "_^_" + dataMap.get(k).get(0).split("__")[1]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataInfo2.put("p_key_id", tableInfo.getPkeyId());
|
|
|
+ dataInfo2.put("classify",tableInfo.getClassify());
|
|
|
+ dataInfo2.put("contractId",tableInfo.getContractId());
|
|
|
+ dataInfo2.put("projectId",tableInfo.getProjectId());
|
|
|
+ tableInfo.setDataMap(dataMap2);
|
|
|
+ result.add(tableInfo);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ public static void setFirstData(com.alibaba.fastjson.JSONObject dataInfo2, TableInfo tableInfo) {
|
|
|
+ //huangjn 判断是否是首件
|
|
|
+ if (dataInfo2.containsKey("isFirst")) {
|
|
|
+ tableInfo.setIsFirst(dataInfo2.getString("isFirst"));
|
|
|
+ }
|
|
|
+ //huangjn 判断是否是首件
|
|
|
+
|
|
|
+ //首件资料绑定的节点
|
|
|
+ if (dataInfo2.containsKey("firstNodeId")) {
|
|
|
+ tableInfo.setFirstNodeId(dataInfo2.getString("firstNodeId"));
|
|
|
+ }
|
|
|
+ //首件ID(编辑时有值,新增时为空)
|
|
|
+ if (dataInfo2.containsKey("firstId")) {
|
|
|
+ tableInfo.setFirstId(dataInfo2.getString("firstId"));
|
|
|
+ }
|
|
|
+ //源文件
|
|
|
+ if (dataInfo2.containsKey("sourceUrl")) {
|
|
|
+ tableInfo.setSourceUrl(dataInfo2.getString("sourceUrl"));
|
|
|
+ }
|
|
|
+ //pdfUrl
|
|
|
+ if (dataInfo2.containsKey("pdfUrl")) {
|
|
|
+ tableInfo.setPdfUrl(dataInfo2.getString("pdfUrl"));
|
|
|
+ }
|
|
|
+ //文件名称
|
|
|
+ if (dataInfo2.containsKey("firstFileName")) {
|
|
|
+ tableInfo.setFirstFileName(dataInfo2.getString("firstFileName"));
|
|
|
+ }
|
|
|
+ //关联的信息
|
|
|
+ if (dataInfo2.containsKey("linkProcessList")) {
|
|
|
+ tableInfo.setLinkProcessList(dataInfo2.getJSONArray("linkProcessList"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ public static void setTheLogData(JSONObject dataInfo2, TableInfo tableInfo) {
|
|
|
+ //huangjn 判断是否是日志
|
|
|
+ if (dataInfo2.containsKey("isTheLog")) {
|
|
|
+ tableInfo.setIsTheLog(dataInfo2.getString("isTheLog"));
|
|
|
+ }
|
|
|
+ //huangjn 判断是否是日志
|
|
|
+
|
|
|
+ //huangjn 日志ID
|
|
|
+ if (dataInfo2.containsKey("theLogId")) {
|
|
|
+ tableInfo.setTheLogId(dataInfo2.getString("theLogId"));
|
|
|
+ }
|
|
|
+ //huangjn 日志ID
|
|
|
+
|
|
|
+ //huangjn 日志勾选的工序
|
|
|
+ if (dataInfo2.containsKey("linkTabIds")) {
|
|
|
+ tableInfo.setLinkTabIds(dataInfo2.getJSONArray("linkTabIds"));
|
|
|
+ }
|
|
|
+ //huangjn 日志勾选的工序
|
|
|
+
|
|
|
+ //huangjn 日志所选时间
|
|
|
+ if (dataInfo2.containsKey("recordTime")) {
|
|
|
+ tableInfo.setRecordTime(dataInfo2.getString("recordTime"));
|
|
|
+ }
|
|
|
+ //huangjn 日志所选时间
|
|
|
+ //huangjn 每份填报数据的id,目前日志专用
|
|
|
+ if (dataInfo2.containsKey("id")) {
|
|
|
+ tableInfo.setBusinessId(dataInfo2.getString("id"));
|
|
|
+ }
|
|
|
+ //huangjn 每份填报数据的id,目前日志专用
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|