Browse Source

fix: 颜色修改

master
buaixuexideshitongxue 1 month ago
parent
commit
b13b289249
  1. 10
      src/main/java/com/biutag/supervision/service/ModifiedVerifyContentCellWriteHandler.java
  2. 2
      src/main/java/com/biutag/supervision/service/NegativeReturnExportService.java

10
src/main/java/com/biutag/supervision/service/ModifiedVerifyContentCellWriteHandler.java

@ -9,6 +9,8 @@ import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.IndexedColors; import org.apache.poi.ss.usermodel.IndexedColors;
import org.apache.poi.ss.usermodel.RichTextString; import org.apache.poi.ss.usermodel.RichTextString;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.apache.poi.xssf.usermodel.XSSFFont;
public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler { public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler {
@ -35,11 +37,11 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler {
String[] lines = content.split("\\n", -1); String[] lines = content.split("\\n", -1);
int offset = 0; int offset = 0;
for (String line : lines) { for (String line : lines) {
int separatorIndex = line.indexOf(''); int separatorIndex = line.indexOf('\uFF1A');
if (separatorIndex > 0) { if (separatorIndex > 0) {
richText.applyFont(offset, offset + separatorIndex, getLabelFont(workbook)); richText.applyFont(offset, offset + separatorIndex, getLabelFont(workbook));
} }
int arrowIndex = line.indexOf('', separatorIndex + 1); int arrowIndex = line.indexOf('\u2192', separatorIndex + 1);
if (arrowIndex >= 0) { if (arrowIndex >= 0) {
richText.applyFont(offset + arrowIndex, offset + arrowIndex + 1, getArrowFont(workbook)); richText.applyFont(offset + arrowIndex, offset + arrowIndex + 1, getArrowFont(workbook));
} }
@ -63,8 +65,12 @@ public class ModifiedVerifyContentCellWriteHandler implements CellWriteHandler {
if (arrowFont == null) { if (arrowFont == null) {
arrowFont = workbook.createFont(); arrowFont = workbook.createFont();
arrowFont.setBold(true); arrowFont.setBold(true);
if (arrowFont instanceof XSSFFont xssfFont) {
xssfFont.setColor(new XSSFColor(new byte[]{(byte) 255, 0, 0}, null));
} else {
arrowFont.setColor(IndexedColors.RED.getIndex()); arrowFont.setColor(IndexedColors.RED.getIndex());
} }
}
return arrowFont; return arrowFont;
} }

2
src/main/java/com/biutag/supervision/service/NegativeReturnExportService.java

@ -58,7 +58,7 @@ public class NegativeReturnExportService {
returnVo.setReturnTime(history.getCrtTime()); returnVo.setReturnTime(history.getCrtTime());
returnVo.setReturnUser(history.getCrtName()); returnVo.setReturnUser(history.getCrtName());
returnVo.setReturnOpinion(parsedHistory.comments()); returnVo.setReturnOpinion(parsedHistory.comments());
returnVo.setModifiedVerifyContent("尚未再次提交"); returnVo.setModifiedVerifyContent(null);
returnRecords.add(returnVo); returnRecords.add(returnVo);
pendingReturn = new PendingReturn(parsedHistory.actionKey(), latestSnapshot, returnVo); pendingReturn = new PendingReturn(parsedHistory.actionKey(), latestSnapshot, returnVo);
} else if (pendingReturn != null && parsedHistory.snapshot() != null) { } else if (pendingReturn != null && parsedHistory.snapshot() != null) {

Loading…
Cancel
Save