对呼叫记录的查询优化,和对PDF导出的格式优化
parent
93aa8cd577
commit
bfeed98bc0
|
|
@ -24,6 +24,8 @@ public class AutoCallTask {
|
|||
public static final int ERRCODE_NO_PERSON = 1;
|
||||
public static final int ERRCODE_DB_ERROR = 2;
|
||||
|
||||
public static final int TASK_CANCEL = 6; //任务取消
|
||||
|
||||
@TableId(value = "ID", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
@TableField(value = "warn_id")
|
||||
|
|
|
|||
|
|
@ -87,7 +87,8 @@ public class AutoCallApiService {
|
|||
AutoCallTask.STATUS_GENERATED,
|
||||
AutoCallTask.STATUS_ANY_SUCCESS,
|
||||
AutoCallTask.STATUS_ALL_FAIL,
|
||||
AutoCallTask.STATUS_CANCELLED
|
||||
AutoCallTask.STATUS_CANCELLED,
|
||||
AutoCallTask.TASK_CANCEL
|
||||
);
|
||||
}
|
||||
Page pageParam = dto.getPage().getPage();
|
||||
|
|
@ -250,7 +251,7 @@ public class AutoCallApiService {
|
|||
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);
|
||||
document.setFont(font);
|
||||
document.add(new Paragraph("智能呼叫记录报表")
|
||||
|
|
@ -260,7 +261,6 @@ public class AutoCallApiService {
|
|||
.setMarginBottom(20));
|
||||
|
||||
// 创建头部布局(时间段和签名)
|
||||
Div headerDiv = new Div().setMarginBottom(15);
|
||||
float[] columnWidths1 = {1, 1};
|
||||
Table layoutTable = new Table(columnWidths1)
|
||||
.setWidth(UnitValue.createPercentValue(100))
|
||||
|
|
@ -290,11 +290,10 @@ public class AutoCallApiService {
|
|||
100 // 呼叫对象及职务
|
||||
};
|
||||
Table table = new Table(columnWidths);
|
||||
table.setKeepTogether(true);
|
||||
table.setSkipFirstHeader(false);
|
||||
// 添加表头
|
||||
addTableHeader(table);
|
||||
|
||||
|
||||
// 添加数据行
|
||||
addTableData(table, records);
|
||||
|
||||
|
|
@ -368,15 +367,15 @@ private void addTableHeader(Table table) {
|
|||
String formattedCreateTime = formatTime(record.getCreateTm());
|
||||
|
||||
// 添加行数据
|
||||
table.addCell(new Cell().add(new Paragraph(String.valueOf(serialNumber++)).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(record.getWarnName() != null ? record.getWarnName() : "").setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(formattedCreateTime).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(region).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(status.toString()).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(callTime.toString()).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(startTime.toString()).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(endTime.toString()).setFontSize(10)));
|
||||
table.addCell(new Cell().add(new Paragraph(callInfo.toString()).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)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(formattedCreateTime).setFontSize(10)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(region).setFontSize(10)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(status.toString()).setFontSize(10)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(callTime.toString()).setFontSize(10)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(startTime.toString()).setFontSize(10)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(endTime.toString()).setFontSize(10)).setKeepTogether(true));
|
||||
table.addCell(new Cell().add(new Paragraph(callInfo.toString()).setFontSize(10)).setKeepTogether(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@ import java.util.*;
|
|||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.whdc.model.entity.AutoCallTask.TASK_CANCEL;
|
||||
|
||||
/**
|
||||
* @author lyf
|
||||
* @since 2025-06-14
|
||||
|
|
@ -33,6 +35,10 @@ import java.util.stream.Collectors;
|
|||
public class AutoCallTaskService {
|
||||
private static final String[] excludeNames = new String[]{"高新", "开发", "自治", "技术", "旅游", "管理", "工业", "产业", "示范"};
|
||||
private static final AtomicBoolean isCalling = new AtomicBoolean(false);
|
||||
|
||||
|
||||
@Autowired
|
||||
private AutoCallTaskMapper autoCallTaskMapper;
|
||||
@Autowired
|
||||
private WarningResponderMapper warningResponderMapper;
|
||||
@Autowired
|
||||
|
|
@ -406,13 +412,20 @@ public class AutoCallTaskService {
|
|||
|
||||
|
||||
private List<Integer> mapWarnSignalLevel(String warnSignalLevel) {
|
||||
/**
|
||||
* 目前需求不区分预警级别,固定查取 1 2 3 4级,全部都呼叫
|
||||
*/
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
if ("红色".equals(warnSignalLevel)) {
|
||||
ret.add(3);
|
||||
} else {
|
||||
ret.add(1);
|
||||
ret.add(2);
|
||||
}
|
||||
ret.add(1);
|
||||
ret.add(2);
|
||||
ret.add(3);
|
||||
ret.add(4);
|
||||
// if ("红色".equals(warnSignalLevel)) {
|
||||
// ret.add(3);
|
||||
// } else {
|
||||
// ret.add(1);
|
||||
// ret.add(2);
|
||||
// }
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
@ -496,13 +509,14 @@ public class AutoCallTaskService {
|
|||
|
||||
@Transactional
|
||||
public void setCallIsPutList(CallPutDto dto) {
|
||||
LambdaQueryWrapper<WarnCallMap> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(WarnCallMap::getId,dto.getTaskIds());
|
||||
List<WarnCallMap> warnCallMaps = warnCallMapMapper.selectList(queryWrapper);
|
||||
for (WarnCallMap warnCallMap : warnCallMaps) {
|
||||
warnCallMap.setCalled(1);//设置为已接通
|
||||
warnCallMap.setCallIsPut(1);
|
||||
warnCallMapMapper.updateById(warnCallMap);
|
||||
LambdaQueryWrapper<AutoCallTask> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AutoCallTask::getId,dto.getTaskIds());
|
||||
List<AutoCallTask> autoCallTasks = autoCallTaskMapper.selectList(queryWrapper);
|
||||
for (AutoCallTask autoCallTask : autoCallTasks) {
|
||||
//告警任务取消
|
||||
autoCallTask.setStatus(TASK_CANCEL);
|
||||
autoCallTask.setRemark("告警任务取消");
|
||||
autoCallTaskMapper.updateById(autoCallTask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,8 +101,13 @@ public class AutoCallTaskService2 {
|
|||
personMapper.updateById(person);
|
||||
}
|
||||
|
||||
/**
|
||||
* 步骤1:生成呼叫任务
|
||||
*/
|
||||
public void step1GenerateTask() {
|
||||
|
||||
//切记要设置task的status
|
||||
//去气象预警表中,查询在气象报警但是没有建立拨号任务的数据
|
||||
List<QXWarning> warnList = taskMapper.listWarnsThatNotGeneratedTask();
|
||||
boolean enable = configMapper.isEnable();
|
||||
for (QXWarning warn : warnList) {
|
||||
|
|
@ -201,13 +206,20 @@ public class AutoCallTaskService2 {
|
|||
}
|
||||
|
||||
private List<Integer> mapWarnSignalLevel(String warnSignalLevel) {
|
||||
/**
|
||||
* 目前需求不区分预警级别,固定查取 1 2 3 4级,全部都呼叫
|
||||
*/
|
||||
List<Integer> ret = new ArrayList<>();
|
||||
if ("红色".equals(warnSignalLevel)) {
|
||||
ret.add(3);
|
||||
} else {
|
||||
ret.add(1);
|
||||
ret.add(2);
|
||||
}
|
||||
ret.add(1);
|
||||
ret.add(2);
|
||||
ret.add(3);
|
||||
ret.add(4);
|
||||
// if ("红色".equals(warnSignalLevel)) {
|
||||
// ret.add(3);
|
||||
// } else {
|
||||
// ret.add(1);
|
||||
// ret.add(2);
|
||||
// }
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue