|
|
@@ -1610,6 +1610,23 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
@Override
|
|
|
public void buildPdf(Long taskId) {
|
|
|
AccessPdfVO accessPdfVO = baseMapper.selectTask(taskId);
|
|
|
+ if (accessPdfVO == null) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<CoreMonitoringTaskRegistration> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(CoreMonitoringTaskRegistration::getTaskId, taskId);
|
|
|
+ List<CoreMonitoringTaskRegistration> list = coreMonitoringTaskRegistrationMapper.selectList(wrapper);
|
|
|
+ if (CollectionUtils.isEmpty(list)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ Double sum = list.stream()
|
|
|
+ .filter(r -> ObjectUtil.isNotNull(r.getAverageDuration()))
|
|
|
+ .mapToDouble(CoreMonitoringTaskRegistration::getAverageDuration)
|
|
|
+ .sum();
|
|
|
+ accessPdfVO.setDurationTotal(sum);
|
|
|
+ list.stream().max(Comparator.comparing(CoreMonitoringTaskRegistration::getCreateTime)).ifPresent(r -> {
|
|
|
+ accessPdfVO.setCheckUser(r.getCreateBy());
|
|
|
+ });
|
|
|
createSafetyCheckRegisterBookPdf(accessPdfVO);
|
|
|
}
|
|
|
|
|
|
@@ -1649,17 +1666,16 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
* 获取任务所有的调阅记录
|
|
|
*/
|
|
|
QueryWrapper<CoreMonitoringTaskRegistration> qw = new QueryWrapper<>();
|
|
|
- qw.lambda().eq(CoreMonitoringTaskRegistration::getTaskId,accessPdfVO.getTaskId());
|
|
|
+ qw.lambda().eq(CoreMonitoringTaskRegistration::getTaskId, accessPdfVO.getTaskId());
|
|
|
List<CoreMonitoringTaskRegistration> registers = coreMonitoringTaskRegistrationMapper.selectList(qw);
|
|
|
List<String> times = new ArrayList<>();
|
|
|
- if(!registers.isEmpty()){
|
|
|
+ if (!registers.isEmpty()) {
|
|
|
for (CoreMonitoringTaskRegistration registration : registers) {
|
|
|
String rel = dealTime(registration.getTaskStartTime(), registration.getTaskEndTime());
|
|
|
times.add(rel);
|
|
|
}
|
|
|
}
|
|
|
-// accessPdf.setTaskTimes( "调阅时间(" + totalTime(accessPdfVO.getDurationTotal().longValue()) + ")");
|
|
|
- accessPdf.setTaskTimes( "调阅时间");
|
|
|
+ accessPdf.setTaskTimes( "调阅时长(" + totalTime(accessPdfVO.getDurationTotal().longValue()) + ")");
|
|
|
accessPdf.setTimes(times);
|
|
|
accessPdf.setCheckUser(accessPdfVO.getCheckUser());
|
|
|
accessPdf.setOrgId(accessPdfVO.getOrgId());
|
|
|
@@ -1681,7 +1697,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
return accessPdf;
|
|
|
}
|
|
|
|
|
|
- private String totalTime(long milliseconds){
|
|
|
+ private String totalTime(long milliseconds) {
|
|
|
long totalSeconds = milliseconds / 1000;
|
|
|
long totalMinutes = totalSeconds / 60;
|
|
|
long totalHours = totalMinutes / 60;
|
|
|
@@ -1689,19 +1705,19 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
// 计算剩余的分钟数和秒数
|
|
|
long remainingMinutes = totalMinutes % 60;
|
|
|
long remainingSeconds = totalSeconds % 60;
|
|
|
- if(totalHours == 0){
|
|
|
- if(totalMinutes == 0){
|
|
|
+ if (totalHours == 0) {
|
|
|
+ if (totalMinutes == 0) {
|
|
|
return String.format("%02d秒", remainingSeconds);
|
|
|
}
|
|
|
return String.format("%02d分钟%02d秒", remainingMinutes, remainingSeconds);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
|
|
|
return String.format("%02d小时%02d分钟%02d秒", totalHours, remainingMinutes, remainingSeconds);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- private String dealTime(Date start,Date end){
|
|
|
+ private String dealTime(Date start, Date end) {
|
|
|
final SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分");
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(end);
|