|
@@ -3,19 +3,9 @@ package com.rongwei.bscommon.sys.utils;
|
|
|
import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONException;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
-import com.rongwei.bsentity.dto.luckysheet.AssembleCellParam;
|
|
|
-import com.rongwei.bsentity.dto.project.ProjectSummaryParamExcelDto;
|
|
|
-import com.rongwei.bsentity.dto.project.SheetInfoParam;
|
|
|
-import com.rongwei.rwcommon.utils.StringUtils;
|
|
|
-
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.Arrays;
|
|
|
import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
public class LuckySheet4SummaryHelp {
|
|
|
|
|
@@ -111,653 +101,4 @@ public class LuckySheet4SummaryHelp {
|
|
|
|
|
|
return ymdSb.toString();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * {
|
|
|
- * "c": 0,
|
|
|
- * "r": 0,
|
|
|
- * "v": {
|
|
|
- * "m": "1002000938马士基埃及桥吊项目整改文字版",
|
|
|
- * "v": "1002000938马士基埃及桥吊项目整改文字版",
|
|
|
- * "bg": "rgb(51, 102, 255)",
|
|
|
- * "bl": 1,
|
|
|
- * "ct": {
|
|
|
- * "t": "g",
|
|
|
- * "fa": "General"
|
|
|
- * },
|
|
|
- * "fc": "rgb(0, 0, 0)",
|
|
|
- * "ff": 5,
|
|
|
- * "fs": 16,
|
|
|
- * "ht": 0,
|
|
|
- * "it": 0,
|
|
|
- * "mc": {
|
|
|
- * "c": 0,
|
|
|
- * "r": 0,
|
|
|
- * "cs": 58,
|
|
|
- * "rs": 1
|
|
|
- * },
|
|
|
- * "vt": 0* }
|
|
|
- * }
|
|
|
- *
|
|
|
- * @param fileName
|
|
|
- * @param colSize
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleFirstTitle(String fileName, int colSize) {
|
|
|
-
|
|
|
- AssembleCellParam cellParam = AssembleCellParam.builder()
|
|
|
- .fontsize(16)
|
|
|
- .startRowPos(0)
|
|
|
- .startColPos(0)
|
|
|
- .rowSize(1)
|
|
|
- .colSize(colSize)
|
|
|
- .value(fileName)
|
|
|
- .build();
|
|
|
- return assembleMergeTitle(cellParam);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * {
|
|
|
- * "c": 0,
|
|
|
- * "r": 1,
|
|
|
- * "v": {
|
|
|
- * "m": "总序号",
|
|
|
- * "v": "总序号",
|
|
|
- * "bg": "rgb(204, 255, 204)",
|
|
|
- * "bl": 0,
|
|
|
- * "ct": {
|
|
|
- * "t": "g",
|
|
|
- * "fa": "General"
|
|
|
- * },
|
|
|
- * "fc": "rgb(0, 0, 0)",
|
|
|
- * "ff": 5,
|
|
|
- * "fs": 11,
|
|
|
- * "ht": 0,
|
|
|
- * "it": 0,
|
|
|
- * "mc": {
|
|
|
- * "c": 0,
|
|
|
- * "r": 1,
|
|
|
- * "cs": 1,
|
|
|
- * "rs": 2
|
|
|
- * },
|
|
|
- * "vt": 0
|
|
|
- * }
|
|
|
- * }
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleCommonCol1() {
|
|
|
-
|
|
|
- JSONArray result = new JSONArray();
|
|
|
-
|
|
|
- for(int m = 0, n = MAIN_TITLE_FIRST.length; m < n; m++) {
|
|
|
- //一级标题
|
|
|
- JSONObject remark2 = new JSONObject();
|
|
|
- remark2.put("c", m);
|
|
|
- remark2.put("r", 1);
|
|
|
- JSONObject remark2v = new JSONObject();
|
|
|
- remark2v.put("m", MAIN_TITLE_FIRST[m]);
|
|
|
- remark2v.put("v", MAIN_TITLE_FIRST[m]);
|
|
|
- remark2v.put("bg", "rgb(204, 255, 204)");
|
|
|
- remark2v.put("bl", 1);
|
|
|
- remark2v.put("fc", "rgb(0, 0, 0)");
|
|
|
- remark2v.put("ff", 5);
|
|
|
- remark2v.put("fs", 11);
|
|
|
- remark2v.put("ht", 0);
|
|
|
- remark2v.put("it", 0);
|
|
|
- remark2v.put("vt", 1);
|
|
|
-
|
|
|
- JSONObject ct = new JSONObject();
|
|
|
- ct.put("t", "g");
|
|
|
- ct.put("fa", "General");
|
|
|
- remark2v.put("ct", ct);
|
|
|
-
|
|
|
- JSONObject mc = new JSONObject();
|
|
|
- mc.put("c", m);
|
|
|
- mc.put("r", 1);
|
|
|
- mc.put("cs", 1);
|
|
|
- mc.put("rs", 2);
|
|
|
- remark2v.put("mc", mc);
|
|
|
-
|
|
|
- remark2.put("v", remark2v);
|
|
|
- result.add(remark2);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 第三行开头
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleCommonRow2Col1() {
|
|
|
-
|
|
|
- JSONArray result = new JSONArray();
|
|
|
-
|
|
|
- for(int m = 0; m < MAIN_TITLE_FIRST.length; m++) {
|
|
|
- JSONObject temp = new JSONObject();
|
|
|
-
|
|
|
- JSONObject mc2 = new JSONObject();
|
|
|
- mc2.put("c", m);
|
|
|
- mc2.put("r", 1);
|
|
|
-
|
|
|
- JSONObject v = new JSONObject();
|
|
|
- v.put("mc", mc2);
|
|
|
-
|
|
|
- temp.put("c", m);
|
|
|
- temp.put("r", 2);
|
|
|
- temp.put("v", v);
|
|
|
- result.add(temp);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 状态 提出日期 整改期限 提出者 备注1 备注2
|
|
|
- * {
|
|
|
- * "c": 57,
|
|
|
- * "r": 2,
|
|
|
- * "v": {
|
|
|
- * "m": "备注2",
|
|
|
- * "v": "备注2",
|
|
|
- * "bl": 1,
|
|
|
- * "ct": {
|
|
|
- * "t": "g",
|
|
|
- * "fa": "General"
|
|
|
- * },
|
|
|
- * "fc": "rgb(0, 0, 0)",
|
|
|
- * "ff": 5,
|
|
|
- * "fs": 11,
|
|
|
- * "ht": 0,
|
|
|
- * "it": 0,
|
|
|
- * "vt": 1
|
|
|
- * }
|
|
|
- * }
|
|
|
- *
|
|
|
- * @param startColPosition 起始位置
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleCommonCol2(int startColPosition) {
|
|
|
- return assembleSingleTitle(startColPosition, 2, MAIN_TITLE_SECOND);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 第二行最后六个
|
|
|
- * {
|
|
|
- * "c": 56,
|
|
|
- * "r": 1,
|
|
|
- * "v": {
|
|
|
- * "m": "",
|
|
|
- * "bg": "rgb(204, 255, 204)",
|
|
|
- * "bl": 1,
|
|
|
- * "fc": "rgb(0, 0, 0)",
|
|
|
- * "ff": 5,
|
|
|
- * "fs": 11,
|
|
|
- * "ht": 0,
|
|
|
- * "it": 0,
|
|
|
- * "vt": 0
|
|
|
- * }
|
|
|
- * }
|
|
|
- *
|
|
|
- * @param startColPosition
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleCommonRow1Col2(int startColPosition) {
|
|
|
-
|
|
|
- JSONArray result = new JSONArray();
|
|
|
-
|
|
|
- for(int m = 0, n = 6; m < n; m++) {
|
|
|
- //备注2
|
|
|
- JSONObject remark2 = new JSONObject();
|
|
|
- remark2.put("c", startColPosition + m);
|
|
|
- remark2.put("r", 1);
|
|
|
-
|
|
|
- JSONObject remark2v = new JSONObject();
|
|
|
- remark2v.put("m", "");
|
|
|
- remark2v.put("bl", 1);
|
|
|
- remark2v.put("fc", "rgb(0, 0, 0)");
|
|
|
- remark2v.put("ff", 5);
|
|
|
- remark2v.put("fs", 11);
|
|
|
- remark2v.put("ht", 0);
|
|
|
- remark2v.put("it", 0);
|
|
|
- remark2v.put("vt", 0);
|
|
|
-
|
|
|
- remark2.put("v", remark2v);
|
|
|
- result.add(remark2);
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 机号一级标题
|
|
|
- *
|
|
|
- * @param startColPosition
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray genDeviceNumberFirstTitle(String cellName, int startColPosition) {
|
|
|
- AssembleCellParam cellParam = AssembleCellParam.builder()
|
|
|
- .fontsize(11)
|
|
|
- .startRowPos(1)
|
|
|
- .startColPos(startColPosition)
|
|
|
- .rowSize(1)
|
|
|
- .colSize(MACHINE_TITLE_COLS.length)
|
|
|
- .value(cellName)
|
|
|
- .build();
|
|
|
- return assembleMergeTitle(cellParam);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 生成机号标题
|
|
|
- *
|
|
|
- * @param startColPosition
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleDeviceNumberSecondTitle(int startColPosition) {
|
|
|
- return assembleSingleTitle(startColPosition, 2, MACHINE_TITLE_COLS);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 生成单个单元格
|
|
|
- *
|
|
|
- * @param startColPosition
|
|
|
- * @param cols
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleSingleTitle(int startColPosition, int startRowPosition, String[] cols) {
|
|
|
-
|
|
|
- JSONArray result = new JSONArray();
|
|
|
-
|
|
|
- for(int m = 0, n = cols.length; m < n; m++) {
|
|
|
- //备注2
|
|
|
- JSONObject remark2 = new JSONObject();
|
|
|
- remark2.put("c", startColPosition + m);
|
|
|
- remark2.put("r", startRowPosition);
|
|
|
- JSONObject remark2v = new JSONObject();
|
|
|
- remark2v.put("m", cols[m]);
|
|
|
- remark2v.put("v", cols[m]);
|
|
|
- remark2v.put("bl", 1);
|
|
|
- remark2v.put("fc", "rgb(0, 0, 0)");
|
|
|
- remark2v.put("ff", 5);
|
|
|
- remark2v.put("fs", 11);
|
|
|
- remark2v.put("ht", 0);
|
|
|
- remark2v.put("it", 0);
|
|
|
- remark2v.put("vt", 1);
|
|
|
- JSONObject ct = new JSONObject();
|
|
|
- ct.put("t", "g");
|
|
|
- ct.put("fa", "General");
|
|
|
- remark2v.put("ct", ct);
|
|
|
- remark2.put("v", remark2v);
|
|
|
- result.add(remark2);
|
|
|
- }
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 组装合并单元格
|
|
|
- *
|
|
|
- * @param param
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray assembleMergeTitle(AssembleCellParam param) {
|
|
|
- JSONArray result = new JSONArray();
|
|
|
- //一级标题
|
|
|
- JSONObject remark2 = new JSONObject();
|
|
|
- remark2.put("c", param.getStartColPos());
|
|
|
- remark2.put("r", param.getStartRowPos());
|
|
|
- JSONObject remark2v = new JSONObject();
|
|
|
- remark2v.put("m", param.getValue());
|
|
|
- remark2v.put("v", param.getValue());
|
|
|
- remark2v.put("bl", 1);
|
|
|
- remark2v.put("fc", "rgb(0, 0, 0)");
|
|
|
- remark2v.put("ff", 5);
|
|
|
- remark2v.put("fs", param.getFontsize());
|
|
|
- remark2v.put("ht", 0);
|
|
|
- remark2v.put("it", 0);
|
|
|
- remark2v.put("vt", 1);
|
|
|
- JSONObject ct = new JSONObject();
|
|
|
- ct.put("t", "g");
|
|
|
- ct.put("fa", "General");
|
|
|
- remark2v.put("ct", ct);
|
|
|
-
|
|
|
- JSONObject mc = new JSONObject();
|
|
|
- mc.put("c", param.getStartColPos());
|
|
|
- mc.put("r", param.getStartRowPos());
|
|
|
- mc.put("cs", param.getColSize());
|
|
|
- mc.put("rs", param.getRowSize());
|
|
|
- remark2v.put("mc", mc);
|
|
|
-
|
|
|
- remark2.put("v", remark2v);
|
|
|
- result.add(remark2);
|
|
|
-
|
|
|
- /**
|
|
|
- * {
|
|
|
- * "c": 1,
|
|
|
- * "r": 0,
|
|
|
- * "v": {
|
|
|
- * "mc": {
|
|
|
- * "c": 0,
|
|
|
- * "r": 0
|
|
|
- * }
|
|
|
- * }
|
|
|
- * }
|
|
|
- */
|
|
|
- for(int m = 1; m < param.getColSize(); m++) {
|
|
|
- JSONObject temp = new JSONObject();
|
|
|
-
|
|
|
- JSONObject mc2 = new JSONObject();
|
|
|
- mc2.put("c", param.getStartColPos());
|
|
|
- mc2.put("r", param.getStartRowPos());
|
|
|
-
|
|
|
- JSONObject v = new JSONObject();
|
|
|
- v.put("mc", mc2);
|
|
|
-
|
|
|
- temp.put("c", m + param.getStartColPos());
|
|
|
- temp.put("r", param.getStartRowPos());
|
|
|
- temp.put("v", v);
|
|
|
- result.add(temp);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取空的sheet对象
|
|
|
- *
|
|
|
- * {
|
|
|
- * "row": 84,
|
|
|
- * "name": "Sheet2",
|
|
|
- * "chart": [],
|
|
|
- * "color": "",
|
|
|
- * "index": "2",
|
|
|
- * "order": 1,
|
|
|
- * "column": 60,
|
|
|
- * "config": {},
|
|
|
- * "status": 0,
|
|
|
- * "celldata": [],
|
|
|
- * "ch_width": 4748,
|
|
|
- * "rowsplit": [],
|
|
|
- * "rh_height": 1790,
|
|
|
- * "scrollTop": 0,
|
|
|
- * "scrollLeft": 0,
|
|
|
- * "visibledatarow": [],
|
|
|
- * "visibledatacolumn": [],
|
|
|
- * "jfgird_select_save": [{
|
|
|
- * "row": [4, 4],
|
|
|
- * "top": 85,
|
|
|
- * "left": 0,
|
|
|
- * "width": 73,
|
|
|
- * "column": [0, 0],
|
|
|
- * "height": 19,
|
|
|
- * "top_move": 85,
|
|
|
- * "left_move": 0,
|
|
|
- * "row_focus": 4,
|
|
|
- * "width_move": 73,
|
|
|
- * "height_move": 19,
|
|
|
- * "column_focus": 0
|
|
|
- * }],
|
|
|
- * "jfgrid_selection_range": {}
|
|
|
- * }
|
|
|
- *
|
|
|
- * @param param
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONObject getEmptySheet(SheetInfoParam param) {
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
- obj.put("row", 84);
|
|
|
- obj.put("name", param.getSheetName());
|
|
|
- obj.put("chart", new JSONArray());
|
|
|
- obj.put("color", "");
|
|
|
- obj.put("index", param.getIndex());
|
|
|
- obj.put("order", param.getOrder());
|
|
|
- obj.put("column", 60);
|
|
|
- obj.put("config", new JSONObject());
|
|
|
- obj.put("status", 0);
|
|
|
- obj.put("celldata", new JSONArray());
|
|
|
- obj.put("ch_width", 4748);
|
|
|
- obj.put("rowsplit", new JSONArray());
|
|
|
- obj.put("rh_height", 1790);
|
|
|
- obj.put("scrollTop", 0);
|
|
|
- obj.put("scrollLeft", 0);
|
|
|
- obj.put("dataVerification", new JSONObject());
|
|
|
- obj.put("visibledatarow", new JSONArray());
|
|
|
- obj.put("visibledatacolumn", new JSONArray());
|
|
|
-
|
|
|
- /**
|
|
|
- * {
|
|
|
- * "row": [4, 4],
|
|
|
- * "top": 85,
|
|
|
- * "left": 0,
|
|
|
- * "width": 73,
|
|
|
- * "column": [0, 0],
|
|
|
- * "height": 19,
|
|
|
- * "top_move": 85,
|
|
|
- * "left_move": 0,
|
|
|
- * "row_focus": 4,
|
|
|
- * "width_move": 73,
|
|
|
- * "height_move": 19,
|
|
|
- * "column_focus": 0
|
|
|
- * }
|
|
|
- */
|
|
|
- JSONObject selectSave = new JSONObject();
|
|
|
- selectSave.put("row", new String[]{"4", "4"});
|
|
|
- selectSave.put("top", 85);
|
|
|
- selectSave.put("left", 0);
|
|
|
- selectSave.put("width", 73);
|
|
|
- selectSave.put("column", new String[]{"0", "0"});
|
|
|
- selectSave.put("height", 19);
|
|
|
- selectSave.put("top_move", 85);
|
|
|
- selectSave.put("left_move", 0);
|
|
|
- selectSave.put("row_focus", 4);
|
|
|
- selectSave.put("width_move", 73);
|
|
|
- selectSave.put("height_move", 19);
|
|
|
- selectSave.put("column_focus", 0);
|
|
|
-
|
|
|
- JSONArray selectSaves = new JSONArray();
|
|
|
- selectSaves.add(selectSave);
|
|
|
-
|
|
|
- obj.put("jfgird_select_save", selectSaves);
|
|
|
- obj.put("jfgrid_selection_range", new JSONObject());
|
|
|
-
|
|
|
- return obj;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取合并配置
|
|
|
- * "0_0": {
|
|
|
- * "c": 0,
|
|
|
- * "r": 0,
|
|
|
- * "cs": 58,
|
|
|
- * "rs": 1
|
|
|
- * },
|
|
|
- *
|
|
|
- * @param deviceNumberList
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONObject getMergeConfig(List<String> deviceNumberList) {
|
|
|
- JSONObject result = new JSONObject();
|
|
|
-
|
|
|
- int colSize = deviceNumberList.size() * MACHINE_TITLE_COLS.length
|
|
|
- + MAIN_TITLE_FIRST.length
|
|
|
- + MAIN_TITLE_SECOND.length;
|
|
|
-
|
|
|
- //第一行 标题
|
|
|
- JSONObject row0Title = new JSONObject();
|
|
|
- row0Title.put("c", 0);
|
|
|
- row0Title.put("r", 0);
|
|
|
- row0Title.put("cs", colSize);
|
|
|
- row0Title.put("rs", 1);
|
|
|
- result.put("0_0", row0Title);
|
|
|
-
|
|
|
- //第二行 前4列
|
|
|
- for(int m = 0, n = MAIN_TITLE_FIRST.length; m < n; m++) {
|
|
|
- JSONObject row1Col0Title = new JSONObject();
|
|
|
- row1Col0Title.put("c", m);
|
|
|
- row1Col0Title.put("r", 1);
|
|
|
- row1Col0Title.put("cs", 1);
|
|
|
- row1Col0Title.put("rs", 2);
|
|
|
- result.put("1_".concat(String.valueOf(m)), row1Col0Title);
|
|
|
- }
|
|
|
-
|
|
|
- //第二行机号
|
|
|
- for(int m = 0, n = deviceNumberList.size(); m < n; m++) {
|
|
|
- JSONObject deviceNumObj = new JSONObject();
|
|
|
- int colPos = MAIN_TITLE_FIRST.length + m * MACHINE_TITLE_COLS.length;
|
|
|
- deviceNumObj.put("c", colPos);
|
|
|
- deviceNumObj.put("r", 1);
|
|
|
- deviceNumObj.put("cs", MACHINE_TITLE_COLS.length);
|
|
|
- deviceNumObj.put("rs", 1);
|
|
|
- result.put("1_".concat(String.valueOf(colPos)), deviceNumObj);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * {
|
|
|
- * "value": {
|
|
|
- * "b": {
|
|
|
- * "color": "rgb(0, 0, 0)",
|
|
|
- * "style": 1
|
|
|
- * },
|
|
|
- * "l": {
|
|
|
- * "color": "rgb(0, 0, 0)",
|
|
|
- * "style": 1
|
|
|
- * },
|
|
|
- * "t": {
|
|
|
- * "color": "rgb(0, 0, 0)",
|
|
|
- * "style": 1
|
|
|
- * },
|
|
|
- * "col_index": 0,
|
|
|
- * "row_index": 0
|
|
|
- * },
|
|
|
- * "rangeType": "cell"
|
|
|
- * }
|
|
|
- *
|
|
|
- * @param deviceNumberList
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONArray getBorderInfo(List<String> deviceNumberList) {
|
|
|
- JSONArray result = new JSONArray();
|
|
|
-
|
|
|
- //计算列行
|
|
|
- int rowsSize = 3, colsSize = deviceNumberList.size() * MACHINE_TITLE_COLS.length
|
|
|
- + MAIN_TITLE_FIRST.length
|
|
|
- + MAIN_TITLE_SECOND.length;;
|
|
|
-
|
|
|
- //行
|
|
|
- for(int m = 0; m < rowsSize; m++) {
|
|
|
- for(int n = 0; n < colsSize; n++) {
|
|
|
- JSONObject value = new JSONObject();
|
|
|
- JSONObject b = new JSONObject();
|
|
|
- b.put("color", "rgb(0, 0, 0)");
|
|
|
- b.put("style", 1);
|
|
|
- value.put("b", b);
|
|
|
-
|
|
|
- JSONObject l = new JSONObject();
|
|
|
- l.put("color", "rgb(0, 0, 0)");
|
|
|
- l.put("style", 1);
|
|
|
- value.put("l", l);
|
|
|
-
|
|
|
- JSONObject t = new JSONObject();
|
|
|
- t.put("color", "rgb(0, 0, 0)");
|
|
|
- t.put("style", 1);
|
|
|
- value.put("t", t);
|
|
|
-
|
|
|
- value.put("col_index", n);
|
|
|
- value.put("row_index", m);
|
|
|
-
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
- obj.put("rangeType", "cell");
|
|
|
- obj.put("value", value);
|
|
|
- result.add(obj);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 数据校验
|
|
|
- *
|
|
|
- * @param paramExcelDto
|
|
|
- * @return
|
|
|
- */
|
|
|
- public static JSONObject getDataVerification(ProjectSummaryParamExcelDto paramExcelDto) {
|
|
|
- JSONObject result = new JSONObject();
|
|
|
-
|
|
|
- //部门
|
|
|
- List<String> departList = paramExcelDto.getWorkshopList().stream()
|
|
|
- .map(item -> item.getString("SHORTNAME"))
|
|
|
- .collect(Collectors.toList());
|
|
|
- String departChose = StringUtils.join(departList, ",");
|
|
|
-
|
|
|
- for(int m = 0, n = paramExcelDto.getDeviceNumberList().size() - 1; m <= n; m++) {
|
|
|
- int colPos = MAIN_TITLE_FIRST.length + m * MACHINE_TITLE_COLS.length;
|
|
|
-// int departColPos = 4 + 4 * m;
|
|
|
- for(int startRows = 3, endRows = 200; startRows < endRows; startRows++) {
|
|
|
-
|
|
|
- //状态
|
|
|
- /**
|
|
|
- * "3_4": {
|
|
|
- * "type": "dropdown",
|
|
|
- * "remote": false,
|
|
|
- * "value1": "OK,X,√",
|
|
|
- * "value2": "",
|
|
|
- * "checked": false,
|
|
|
- * "hintShow": false,
|
|
|
- * "hintText": "",
|
|
|
- * "prohibitInput": false
|
|
|
- * }
|
|
|
- */
|
|
|
- JSONObject statusObj = getNewDataVerification("OK,X,√");
|
|
|
- result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(colPos)), statusObj);
|
|
|
-
|
|
|
- //部门
|
|
|
- /**
|
|
|
- * "3_4": {
|
|
|
- * "type": "dropdown",
|
|
|
- * "remote": false,
|
|
|
- * "value1": "OK,X,√",
|
|
|
- * "value2": "",
|
|
|
- * "checked": false,
|
|
|
- * "hintShow": false,
|
|
|
- * "hintText": "",
|
|
|
- * "prohibitInput": false
|
|
|
- * }
|
|
|
- */
|
|
|
- //施工部门
|
|
|
- JSONObject departObj = getNewDataVerification(departChose);
|
|
|
- result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(colPos + 1)), departObj);
|
|
|
-
|
|
|
- //责任部门
|
|
|
- JSONObject depart2Obj = getNewDataVerification(departChose);
|
|
|
- result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(colPos + 3)), depart2Obj);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //总状态
|
|
|
- int statusColIndex = MAIN_TITLE_FIRST.length + paramExcelDto.getDeviceNumberList().size() * MACHINE_TITLE_COLS.length;
|
|
|
- for(int startRows = 3, endRows = 200; startRows < endRows; startRows++) {
|
|
|
- JSONObject statusObj = getNewDataVerification("OK,X,√");
|
|
|
- result.put(String.valueOf(startRows).concat("_").concat(String.valueOf(statusColIndex)), statusObj);
|
|
|
- }
|
|
|
-
|
|
|
- return result;
|
|
|
- }
|
|
|
-
|
|
|
- public static JSONObject getNewDataVerification(String options) {
|
|
|
- JSONObject departObj = new JSONObject();
|
|
|
- departObj.put("type", "dropdown");
|
|
|
- departObj.put("remote", false);
|
|
|
- departObj.put("value1", options);
|
|
|
- departObj.put("value2", "");
|
|
|
- departObj.put("checked", false);
|
|
|
- departObj.put("hintShow", false);
|
|
|
- departObj.put("hintText", "");
|
|
|
- departObj.put("prohibitInput", false);
|
|
|
- return departObj;
|
|
|
- }
|
|
|
}
|