|
@@ -8,10 +8,12 @@ import cn.cslg.report.common.utils.*;
|
|
|
import cn.cslg.report.common.utils.SecurityUtils.LoginUtils;
|
|
|
import cn.cslg.report.entity.Report;
|
|
|
import cn.cslg.report.entity.ReportDocument;
|
|
|
+import cn.cslg.report.entity.ValueObject;
|
|
|
import cn.cslg.report.entity.invalidReReport.InvalidReasonField;
|
|
|
import cn.cslg.report.service.business.InvalidReReport.InvalidReasonFieldService;
|
|
|
import cn.cslg.report.service.business.InvalidReReport.InvalidReasonService;
|
|
|
import cn.hutool.core.util.IdUtil;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.config.Configure;
|
|
@@ -93,19 +95,48 @@ public class ExportArgumentsScenariosService {
|
|
|
WordUtil.setParagraph(doc, report.getName() + "无效理由", "宋体", 16, 10, true, ParagraphAlignment.CENTER);
|
|
|
//设置副标题
|
|
|
WordUtil.setParagraph(doc, "生成时间:" + new Date().toString(), "宋体", 10, 10, true, ParagraphAlignment.RIGHT);
|
|
|
- int colTotalCount = fields.size() + 5;
|
|
|
+ int fieldTableCount = 0;
|
|
|
+ if (fields.size() > 1) {
|
|
|
+ fieldTableCount = (fields.size() - 1) * 4 + 1;
|
|
|
+ }
|
|
|
+ int colTotalCount = fieldTableCount + 5;
|
|
|
+
|
|
|
//总条数
|
|
|
int dataCount = queryInvalidReasonVOS.size();
|
|
|
//创建表格
|
|
|
- XWPFTable xTable = doc.createTable(1, colTotalCount);
|
|
|
+ XWPFTable xTable = doc.createTable(2, colTotalCount);
|
|
|
CTTblPr tblPr = xTable.getCTTbl().addNewTblPr();
|
|
|
tblPr.addNewJc().setVal(STJc.CENTER);
|
|
|
//设置边框
|
|
|
WordUtil.setTableBolder(xTable, 10, "000000");
|
|
|
// 创建表头数据
|
|
|
+ int startIndex = 6;
|
|
|
+ int nameListIndex = 6;
|
|
|
+ String[] valueArr = new String[4];
|
|
|
+ valueArr[0] = "起诉人意见";
|
|
|
+ valueArr[1] = "被诉人意见";
|
|
|
+ valueArr[2] = "第三方机构意见";
|
|
|
+ valueArr[3] = "法院意见";
|
|
|
+ int valueArrIndex = 0;
|
|
|
for (int j = 0; j < colTotalCount; j++) {
|
|
|
- WordUtil.setCellText(xTable.getRow(0).getCell(j), nameList.get(j), 1200, "宋体", 10, true);
|
|
|
+ if (j < 6) {
|
|
|
+ WordUtil.setCellText(xTable.getRow(0).getCell(j), nameList.get(j), 1200, "宋体", 10, true);
|
|
|
+ WordUtil.setCellText(xTable.getRow(1).getCell(j), nameList.get(j), 1200, "宋体", 10, true);
|
|
|
+ WordUtil.mergeCellsVertically(xTable, j, 0, 1);
|
|
|
+ } else {
|
|
|
+ WordUtil.setCellText(xTable.getRow(0).getCell(j), nameList.get(nameListIndex), 1200, "宋体", 10, true);
|
|
|
+ WordUtil.setCellText(xTable.getRow(1).getCell(j), valueArr[valueArrIndex], 1200, "宋体", 10, true);
|
|
|
+ valueArrIndex++;
|
|
|
+ if (j - startIndex == 3) {
|
|
|
+ valueArrIndex = 0;
|
|
|
+ WordUtil.mergeCellsHorizontal(xTable, 0, startIndex, j);
|
|
|
+ startIndex = j + 1;
|
|
|
+ nameListIndex++;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//记录对比文件文件内容map
|
|
|
Map<Integer, String> fileMap = new TreeMap<>();
|
|
|
//记录合并数据map
|
|
@@ -121,7 +152,10 @@ public class ExportArgumentsScenariosService {
|
|
|
map.put(name, map.get(name) + 1);
|
|
|
}
|
|
|
List<InvalidReasonFieldValueDTO> fieldValueDTOS = queryInvalidReasonVO.getFields();
|
|
|
- XWPFTableRow row = xTable.insertNewTableRow(i2 + 1);
|
|
|
+ XWPFTableRow row = xTable.insertNewTableRow(i2 + 2);
|
|
|
+ startIndex = 6;
|
|
|
+ valueArrIndex = 0;
|
|
|
+ nameListIndex = 0;
|
|
|
for (int j = 0; j < colTotalCount; j++) {
|
|
|
XWPFTableCell cell = row.createCell();
|
|
|
XWPFRun run;
|
|
@@ -137,13 +171,12 @@ public class ExportArgumentsScenariosService {
|
|
|
run.setText("不具备创造性");
|
|
|
} else if (name == 3) {
|
|
|
run.setText("不具备新颖性");
|
|
|
- }
|
|
|
- else if (name == 4) {
|
|
|
+ } else if (name == 4) {
|
|
|
run.setText("重复授权");
|
|
|
}
|
|
|
} else if (j == 2) {
|
|
|
- int content = queryInvalidReasonVO.getContent();
|
|
|
- if (content == -1) {
|
|
|
+ Integer content = queryInvalidReasonVO.getContent();
|
|
|
+ if (content == null || content == -1) {
|
|
|
run.setText("说明书");
|
|
|
} else {
|
|
|
run.setText("权要" + (content + 1));
|
|
@@ -182,7 +215,7 @@ public class ExportArgumentsScenariosService {
|
|
|
}
|
|
|
}
|
|
|
//记录对比文件名称字典
|
|
|
- if (fileMap.get(proofIn.getSort()) == null&&proofIn.getId()!=0) {
|
|
|
+ if (fileMap.get(proofIn.getSort()) == null && proofIn.getId() != 0) {
|
|
|
fileMap.put(proofIn.getSort(), proofIn.getFileName());
|
|
|
}
|
|
|
}
|
|
@@ -192,20 +225,83 @@ public class ExportArgumentsScenariosService {
|
|
|
run.setText(stringBuilder.toString());
|
|
|
}
|
|
|
} else if (j == 4) {
|
|
|
- map1.put("argument" + nameCount, queryInvalidReasonVO.getArgumentStr());
|
|
|
+ String value = queryInvalidReasonVO.getArgumentStr();
|
|
|
+ String argumentStr = "";
|
|
|
+ try {
|
|
|
+ List<String> list = JSONObject.parseObject(value, List.class);
|
|
|
+ argumentStr = list.get(0);
|
|
|
+ if (argumentStr == null) {
|
|
|
+ argumentStr = "";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ argumentStr = value;
|
|
|
+ }
|
|
|
+ map1.put("argument" + nameCount, argumentStr);
|
|
|
run.setText("{{argument" + nameCount + "}}");
|
|
|
nameCount = nameCount + 1;
|
|
|
} else {
|
|
|
- InvalidReasonField field = fields.get(j - 5);
|
|
|
+ InvalidReasonField field;
|
|
|
+ if (j == 5) {
|
|
|
+ field = fields.get(nameListIndex);
|
|
|
+ nameListIndex++;
|
|
|
+ } else {
|
|
|
+ field = fields.get(nameListIndex);
|
|
|
+ if (j - startIndex == 3) {
|
|
|
+ nameListIndex++;
|
|
|
+ }
|
|
|
+ }
|
|
|
InvalidReasonFieldValueDTO valueDTO = fieldValueDTOS.stream().filter(item -> item.getFieldId().equals(field.getId())).findFirst().orElse(new InvalidReasonFieldValueDTO());
|
|
|
- map1.put(valueDTO.getFieldKey() + nameCount, valueDTO.getFieldValue());
|
|
|
- run.setText("{{" + valueDTO.getFieldKey() + nameCount + "}}");
|
|
|
+ String value = valueDTO.getFieldValue();
|
|
|
+ String str = "";
|
|
|
+ if (j == 5) { //复审委意见
|
|
|
+ try {
|
|
|
+ List<String> list = JSONObject.parseObject(value, List.class);
|
|
|
+ str = list.get(0);
|
|
|
+ if (str == null) {
|
|
|
+ str = "";
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ str = value;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ int count = j - startIndex;
|
|
|
+ try {
|
|
|
+ ValueObject valueObject = JSONObject.parseObject(value, ValueObject.class);
|
|
|
+ List<String> suggestion = null;
|
|
|
+ switch (count) {
|
|
|
+ case 0:
|
|
|
+ suggestion = valueObject.getProsecutor();
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ suggestion = valueObject.getRespondent();
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ suggestion = valueObject.getInstitution();
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ suggestion = valueObject.getCourt();
|
|
|
+ }
|
|
|
+ if (suggestion == null) {
|
|
|
+ str = "";
|
|
|
+ } else {
|
|
|
+ str = suggestion.get(0);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (count == 3) {
|
|
|
+ str = value;
|
|
|
+ } else {
|
|
|
+ str = "";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ map1.put(valueDTO.getFieldKey() + j + nameCount, str);
|
|
|
+ run.setText("{{" + valueDTO.getFieldKey() + j + nameCount + "}}");
|
|
|
nameCount = nameCount + 1;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//添加文件说明行
|
|
|
- XWPFTableRow row = xTable.insertNewTableRow(dataCount + 1);
|
|
|
+ XWPFTableRow row = xTable.insertNewTableRow(dataCount + 2);
|
|
|
XWPFTableCell cell = row.createCell();
|
|
|
XWPFRun run;
|
|
|
run = WordUtil.setTableCellStyle(cell, "1200", ParagraphAlignment.CENTER, "微软雅黑", 9, false);
|
|
@@ -220,9 +316,9 @@ public class ExportArgumentsScenariosService {
|
|
|
XWPFRun runTem;
|
|
|
runTem = WordUtil.setTableCellStyle(cellTem, "1200", ParagraphAlignment.CENTER, "微软雅黑", 9, false);
|
|
|
}
|
|
|
- WordUtil.mergeCellsHorizontal(xTable, dataCount + 1, 0, colTotalCount - 1);
|
|
|
+ WordUtil.mergeCellsHorizontal(xTable, dataCount + 2, 0, colTotalCount - 1);
|
|
|
//记录合并起始位置
|
|
|
- Integer t = 1;
|
|
|
+ Integer t = 2;
|
|
|
for (int i : map.keySet()) {
|
|
|
int end = t + map.get(i) - 1;
|
|
|
WordUtil.mergeCellsVertically(xTable, 1, t, end);
|