对呼叫记录的查询优化,和对PDF导出的格式优化

master
yangzhe123 2025-07-24 13:24:54 +08:00
parent 93aa8cd577
commit bfeed98bc0
4 changed files with 60 additions and 33 deletions

View File

@ -24,6 +24,8 @@ public class AutoCallTask {
public static final int ERRCODE_NO_PERSON = 1; public static final int ERRCODE_NO_PERSON = 1;
public static final int ERRCODE_DB_ERROR = 2; public static final int ERRCODE_DB_ERROR = 2;
public static final int TASK_CANCEL = 6; //任务取消
@TableId(value = "ID", type = IdType.AUTO) @TableId(value = "ID", type = IdType.AUTO)
private Integer id; private Integer id;
@TableField(value = "warn_id") @TableField(value = "warn_id")

View File

@ -87,7 +87,8 @@ public class AutoCallApiService {
AutoCallTask.STATUS_GENERATED, AutoCallTask.STATUS_GENERATED,
AutoCallTask.STATUS_ANY_SUCCESS, AutoCallTask.STATUS_ANY_SUCCESS,
AutoCallTask.STATUS_ALL_FAIL, AutoCallTask.STATUS_ALL_FAIL,
AutoCallTask.STATUS_CANCELLED AutoCallTask.STATUS_CANCELLED,
AutoCallTask.TASK_CANCEL
); );
} }
Page pageParam = dto.getPage().getPage(); Page pageParam = dto.getPage().getPage();
@ -250,7 +251,7 @@ public class AutoCallApiService {
Document document = new Document(pdfDoc, PageSize.A4.rotate())) { Document document = new Document(pdfDoc, PageSize.A4.rotate())) {
// 添加标题 // 添加标题
String fontPath = "/fonts/ChineseFonts.ttf"; String fontPath = "/fonts/ChineseFonts.ttf";//设置中文字体(没有这个,中文会乱码)
PdfFont font = PdfFontFactory.createFont(fontPath, PdfEncodings.IDENTITY_H); PdfFont font = PdfFontFactory.createFont(fontPath, PdfEncodings.IDENTITY_H);
document.setFont(font); document.setFont(font);
document.add(new Paragraph("智能呼叫记录报表") document.add(new Paragraph("智能呼叫记录报表")
@ -260,7 +261,6 @@ public class AutoCallApiService {
.setMarginBottom(20)); .setMarginBottom(20));
// 创建头部布局(时间段和签名) // 创建头部布局(时间段和签名)
Div headerDiv = new Div().setMarginBottom(15);
float[] columnWidths1 = {1, 1}; float[] columnWidths1 = {1, 1};
Table layoutTable = new Table(columnWidths1) Table layoutTable = new Table(columnWidths1)
.setWidth(UnitValue.createPercentValue(100)) .setWidth(UnitValue.createPercentValue(100))
@ -290,11 +290,10 @@ public class AutoCallApiService {
100 // 呼叫对象及职务 100 // 呼叫对象及职务
}; };
Table table = new Table(columnWidths); Table table = new Table(columnWidths);
table.setKeepTogether(true);
table.setSkipFirstHeader(false); table.setSkipFirstHeader(false);
// 添加表头 // 添加表头
addTableHeader(table); addTableHeader(table);
// 添加数据行 // 添加数据行
addTableData(table, records); addTableData(table, records);
@ -368,15 +367,15 @@ private void addTableHeader(Table table) {
String formattedCreateTime = formatTime(record.getCreateTm()); String formattedCreateTime = formatTime(record.getCreateTm());
// 添加行数据 // 添加行数据
table.addCell(new Cell().add(new Paragraph(String.valueOf(serialNumber++)).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(String.valueOf(serialNumber++)).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(record.getWarnName() != null ? record.getWarnName() : "").setFontSize(10))); table.addCell(new Cell().add(new Paragraph(record.getWarnName() != null ? record.getWarnName() : "").setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(formattedCreateTime).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(formattedCreateTime).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(region).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(region).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(status.toString()).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(status.toString()).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(callTime.toString()).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(callTime.toString()).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(startTime.toString()).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(startTime.toString()).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(endTime.toString()).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(endTime.toString()).setFontSize(10)).setKeepTogether(true));
table.addCell(new Cell().add(new Paragraph(callInfo.toString()).setFontSize(10))); table.addCell(new Cell().add(new Paragraph(callInfo.toString()).setFontSize(10)).setKeepTogether(true));
} }
} }

View File

@ -24,6 +24,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.whdc.model.entity.AutoCallTask.TASK_CANCEL;
/** /**
* @author lyf * @author lyf
* @since 2025-06-14 * @since 2025-06-14
@ -33,6 +35,10 @@ import java.util.stream.Collectors;
public class AutoCallTaskService { public class AutoCallTaskService {
private static final String[] excludeNames = new String[]{"高新", "开发", "自治", "技术", "旅游", "管理", "工业", "产业", "示范"}; private static final String[] excludeNames = new String[]{"高新", "开发", "自治", "技术", "旅游", "管理", "工业", "产业", "示范"};
private static final AtomicBoolean isCalling = new AtomicBoolean(false); private static final AtomicBoolean isCalling = new AtomicBoolean(false);
@Autowired
private AutoCallTaskMapper autoCallTaskMapper;
@Autowired @Autowired
private WarningResponderMapper warningResponderMapper; private WarningResponderMapper warningResponderMapper;
@Autowired @Autowired
@ -406,13 +412,20 @@ public class AutoCallTaskService {
private List<Integer> mapWarnSignalLevel(String warnSignalLevel) { private List<Integer> mapWarnSignalLevel(String warnSignalLevel) {
/**
* 1 2 3 4
*/
List<Integer> ret = new ArrayList<>(); List<Integer> ret = new ArrayList<>();
if ("红色".equals(warnSignalLevel)) { ret.add(1);
ret.add(3); ret.add(2);
} else { ret.add(3);
ret.add(1); ret.add(4);
ret.add(2); // if ("红色".equals(warnSignalLevel)) {
} // ret.add(3);
// } else {
// ret.add(1);
// ret.add(2);
// }
return ret; return ret;
} }
@ -496,13 +509,14 @@ public class AutoCallTaskService {
@Transactional @Transactional
public void setCallIsPutList(CallPutDto dto) { public void setCallIsPutList(CallPutDto dto) {
LambdaQueryWrapper<WarnCallMap> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<AutoCallTask> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(WarnCallMap::getId,dto.getTaskIds()); queryWrapper.in(AutoCallTask::getId,dto.getTaskIds());
List<WarnCallMap> warnCallMaps = warnCallMapMapper.selectList(queryWrapper); List<AutoCallTask> autoCallTasks = autoCallTaskMapper.selectList(queryWrapper);
for (WarnCallMap warnCallMap : warnCallMaps) { for (AutoCallTask autoCallTask : autoCallTasks) {
warnCallMap.setCalled(1);//设置为已接通 //告警任务取消
warnCallMap.setCallIsPut(1); autoCallTask.setStatus(TASK_CANCEL);
warnCallMapMapper.updateById(warnCallMap); autoCallTask.setRemark("告警任务取消");
autoCallTaskMapper.updateById(autoCallTask);
} }
} }
} }

View File

@ -101,8 +101,13 @@ public class AutoCallTaskService2 {
personMapper.updateById(person); personMapper.updateById(person);
} }
/**
* 1
*/
public void step1GenerateTask() { public void step1GenerateTask() {
//切记要设置task的status //切记要设置task的status
//去气象预警表中,查询在气象报警但是没有建立拨号任务的数据
List<QXWarning> warnList = taskMapper.listWarnsThatNotGeneratedTask(); List<QXWarning> warnList = taskMapper.listWarnsThatNotGeneratedTask();
boolean enable = configMapper.isEnable(); boolean enable = configMapper.isEnable();
for (QXWarning warn : warnList) { for (QXWarning warn : warnList) {
@ -201,13 +206,20 @@ public class AutoCallTaskService2 {
} }
private List<Integer> mapWarnSignalLevel(String warnSignalLevel) { private List<Integer> mapWarnSignalLevel(String warnSignalLevel) {
/**
* 1 2 3 4
*/
List<Integer> ret = new ArrayList<>(); List<Integer> ret = new ArrayList<>();
if ("红色".equals(warnSignalLevel)) { ret.add(1);
ret.add(3); ret.add(2);
} else { ret.add(3);
ret.add(1); ret.add(4);
ret.add(2); // if ("红色".equals(warnSignalLevel)) {
} // ret.add(3);
// } else {
// ret.add(1);
// ret.add(2);
// }
return ret; return ret;
} }