diff --git a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java index 33a7e2d..c23a097 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ApplyCompletionAction.java @@ -70,7 +70,8 @@ public class ApplyCompletionAction implements Action { .set(Negative::getCurrentProcessingObject, negative.getIsSecondHandle() ? "市局专班" : String.format("%s专班", negative.getHandleSecondDepartName())) .set(Negative::getHandleTime, LocalDateTime.now()) .set(Negative::getHandleTimeout, Objects.isNull(remainingDuration) || remainingDuration >= 0 ? 0 : -remainingDuration) - .set(Negative::getVerifyTime, LocalDateTime.now()); + .set(Negative::getVerifyTime, LocalDateTime.now()) + .set(Negative::getLatestProcessTime, LocalDateTime.now()); negativeService.update(updateWrapper); } diff --git a/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java b/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java index ead16c8..eb8a468 100644 --- a/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/ConfirmationCompletionAction.java @@ -14,6 +14,7 @@ import com.biutag.supervision.pojo.entity.NegativeScorePolice; import com.biutag.supervision.pojo.entity.NegativeWork; import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.service.*; +import com.biutag.supervision.util.TimeUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -98,6 +99,12 @@ public class ConfirmationCompletionAction implements Action { } public void updateNegative(String negativeId, ConfirmationCompletionData completionData) { + Negative negative = negativeService.getById(negativeId); + LocalDateTime now = LocalDateTime.now(); + Long firstApproveTime = negative.getFirstApproveTime() == null ? 0L : negative.getFirstApproveTime(); + if (negative.getLatestProcessTime() != null) { + firstApproveTime = firstApproveTime + TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); + } LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .eq(Negative::getId, negativeId) .set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) @@ -107,7 +114,8 @@ public class ConfirmationCompletionAction implements Action { .set(StrUtil.isNotEmpty(completionData.getReportId()),Negative::getReportId,completionData.getReportId()) .set(StrUtil.isNotEmpty(completionData.getReportNumber()),Negative::getReportNumber,completionData.getReportNumber()) .set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) - .set(Negative::getUpdTime, LocalDateTime.now()); + .set(Negative::getUpdTime, LocalDateTime.now()) + .set(Negative::getFirstApproveTime, firstApproveTime); negativeService.update(updateWrapper); } public void doneWork(Integer workId, String negativeId) { diff --git a/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java b/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java index 80b39b1..85d220b 100644 --- a/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/FirstApproveReturnAction.java @@ -14,6 +14,7 @@ import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.service.NegativeApproveService; import com.biutag.supervision.service.NegativeService; import com.biutag.supervision.service.NegativeWorkService; +import com.biutag.supervision.util.TimeUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -44,12 +45,19 @@ public class FirstApproveReturnAction implements Action { public void updateNegative(String negativeId, String nextFlowKey) { Negative negative = negativeService.getById(negativeId); + LocalDateTime now = LocalDateTime.now(); + Long firstApproveTime = negative.getFirstApproveTime() == null ? 0L : negative.getFirstApproveTime(); + if (negative.getLatestProcessTime() != null) { + firstApproveTime = firstApproveTime + TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); + } negativeService.update(new LambdaUpdateWrapper() .set(Negative::getFlowKey, negative.getIsSecondHandle() ? FlowNodeEnum.VERIFY.getKey() : nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) // 当前处理对象 .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleSecondDepartName())) - .eq(Negative::getId, negativeId)); + .eq(Negative::getId, negativeId) + .set(Negative::getFirstApproveTime, firstApproveTime) + .set(Negative::getLatestProcessTime, now)); } public void addApprove(String negativeId, String comments, Integer workId) { diff --git a/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java b/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java index 000916a..64e8da7 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SecondApproveAction.java @@ -15,6 +15,7 @@ import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.service.NegativeApproveService; import com.biutag.supervision.service.NegativeService; import com.biutag.supervision.service.NegativeWorkService; +import com.biutag.supervision.util.TimeUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -50,17 +51,25 @@ public class SecondApproveAction implements Action { } public void updateNegative(String negativeId, String nextFlowKey) { + Negative negative = negativeService.getById(negativeId); + LocalDateTime now = LocalDateTime.now(); + Long secondApprovalTime = negative.getSecondApprovalTime() == null ? 0L : negative.getSecondApprovalTime(); + if (negative.getLatestProcessTime() != null) { + secondApprovalTime = secondApprovalTime + TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); + } LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper() .set(Negative::getFlowKey, nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) + .set(Negative::getSecondApprovalTime, secondApprovalTime) .eq(Negative::getId, negativeId); - Negative negative = negativeService.getById(negativeId); +// Negative negative = negativeService.getById(negativeId); if (ApprovalFlowEnum.SECOND_APPROVAL.getValue().equals(negative.getApprovalFlow())) { updateWrapper.set(Negative::getFlowKey, FlowNodeEnum.COMPLETED.getKey()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.completed.name()) .set(Negative::getCompleteDate, LocalDateTime.now()); } else { updateWrapper.set(Negative::getFlowKey, nextFlowKey) + .set(Negative::getLatestProcessTime, now) .set(Negative::getCurrentProcessingObject, "市局专班"); } negativeService.update(updateWrapper); diff --git a/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java b/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java index d22f116..5ac468d 100644 --- a/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java +++ b/src/main/java/com/biutag/supervision/flow/action/SecondApproveReturnAction.java @@ -15,6 +15,7 @@ import com.biutag.supervision.pojo.model.UserAuth; import com.biutag.supervision.service.NegativeApproveService; import com.biutag.supervision.service.NegativeService; import com.biutag.supervision.service.NegativeWorkService; +import com.biutag.supervision.util.TimeUtil; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -45,12 +46,18 @@ public class SecondApproveReturnAction implements Action { public void updateNegative(String negativeId, String nextFlowKey) { Negative negative = negativeService.getById(negativeId); + LocalDateTime now = LocalDateTime.now(); + Long secondApprovalTime = negative.getSecondApprovalTime() == null ? 0L : negative.getSecondApprovalTime(); + if (negative.getLatestProcessTime() != null) { + secondApprovalTime = secondApprovalTime + TimeUtil.calculateWorkdayDuration(negative.getLatestProcessTime(), now); + } negativeService.update(new LambdaUpdateWrapper() .set(Negative::getFlowKey, nextFlowKey) .set(Negative::getUpdTime, LocalDateTime.now()) .set(Negative::getProcessingStatus, ProcessingStatusEnum.processing.name()) // 当前处理对象 .set(Negative::getCurrentProcessingObject, String.format("%s专班", negative.getHandleThreeDepartName())) + .set(Negative::getSecondApprovalTime, secondApprovalTime) .eq(Negative::getId, negativeId)); } diff --git a/src/main/java/com/biutag/supervision/pojo/entity/Negative.java b/src/main/java/com/biutag/supervision/pojo/entity/Negative.java index dc8114f..31f8772 100644 --- a/src/main/java/com/biutag/supervision/pojo/entity/Negative.java +++ b/src/main/java/com/biutag/supervision/pojo/entity/Negative.java @@ -370,4 +370,23 @@ public class Negative { @Schema(description = "下发单位名字") @TableField("issuingDepartName") private String issuingDepartName; + + /** + * 最后一次审批节点操作时间 + */ + @TableField("latest_process_time") + private LocalDateTime latestProcessTime; + + /** + * 2级审批累计时长(秒) + */ + @TableField("second_approval_time") + private Long secondApprovalTime; + + + /** + * 市局审批累计时长(秒) + */ + @TableField("first_approve_time") + private Long firstApproveTime; } diff --git a/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionQueryParam.java index dc9307d..d0e2ff7 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionQueryParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/ComplaintCollection/ComplaintCollectionQueryParam.java @@ -2,6 +2,7 @@ package com.biutag.supervision.pojo.param.ComplaintCollection; import com.biutag.supervision.pojo.enums.complaintCollection.ComplaintCollectionSourceTableEnum; import com.biutag.supervision.pojo.param.BasePage; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Getter; import lombok.Setter; @@ -112,6 +113,12 @@ public class ComplaintCollectionQueryParam extends BasePage { private List involveProblemIdList = new ArrayList<>(); + @Schema(description = "录入时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private List createTimeList = new ArrayList<>(); + + + // @Schema(description = "部门ID集合") // private Set secondDepartIds; diff --git a/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java b/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java index 4569db6..a6cc988 100644 --- a/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java +++ b/src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java @@ -117,6 +117,9 @@ public class NegativeQueryParam extends BasePage { @TableField("issuingDepartName") private String issuingDepartName; + @Schema(description = "审批超时状态集合: city_timeout/city_normal/branch_timeout/branch_normal") + private List approvalTimeoutStatus; + private UserAuth currentUser; @@ -135,6 +138,7 @@ public class NegativeQueryParam extends BasePage { target.setThreeLevelCode(this.threeLevelCode == null ? null : new ArrayList<>(this.threeLevelCode)); target.setProblemSourcesCode(this.problemSourcesCode == null ? null : new ArrayList<>(this.problemSourcesCode)); target.setInvolveDepartIds(this.involveDepartIds == null ? null : Set.copyOf(this.involveDepartIds)); + target.setApprovalTimeoutStatus(this.approvalTimeoutStatus == null ? null : new ArrayList<>(this.approvalTimeoutStatus)); return target; } diff --git a/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionPageRequest.java b/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionPageRequest.java index 2a8229c..7686ccf 100644 --- a/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionPageRequest.java +++ b/src/main/java/com/biutag/supervision/pojo/request/complaintCollection/ComplaintCollectionPageRequest.java @@ -82,6 +82,11 @@ public class ComplaintCollectionPageRequest extends BasePage implements ParamChe @Schema(description = "涉嫌问题List") private List involveProblemIdList = new ArrayList<>(); + @Schema(description = "录入时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private List createTimeList = new ArrayList<>(); + + @Override public void check() { if (CollectionUtil.isNotEmpty(discoveryTimeList)){ diff --git a/src/main/java/com/biutag/supervision/pojo/vo/ExportNegativeVo.java b/src/main/java/com/biutag/supervision/pojo/vo/ExportNegativeVo.java index d527fc4..13398f0 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/ExportNegativeVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/ExportNegativeVo.java @@ -132,4 +132,13 @@ public class ExportNegativeVo { @ExcelProperty({"","办理超时情况"}) private String handleTimeout; + + @ExcelProperty({"核办情况","分局审批时长"}) + private String secondApprovalTime; + + // 问题类型 + @ExcelProperty({"核办情况","市局审批时长"}) + private String firstApproveTime; + + } diff --git a/src/main/java/com/biutag/supervision/pojo/vo/NegativeQueryVo.java b/src/main/java/com/biutag/supervision/pojo/vo/NegativeQueryVo.java index 466e481..62a8e66 100644 --- a/src/main/java/com/biutag/supervision/pojo/vo/NegativeQueryVo.java +++ b/src/main/java/com/biutag/supervision/pojo/vo/NegativeQueryVo.java @@ -212,4 +212,18 @@ public class NegativeQueryVo { @Schema(description = "二级部门ID") private String secondInvolveDepartId; + + @Schema(description = "最后一次审批节点操作时间") + @TableField("latest_process_time") + private LocalDateTime latestProcessTime; + + @Schema(description = "2级审批累计时长(秒)") + @TableField("second_approval_time") + private Long secondApprovalTime; + + + @Schema(description = "市局审批累计时长(秒)") + @TableField("first_approve_time") + private Long firstApproveTime; + } diff --git a/src/main/java/com/biutag/supervision/repository/complaintCollection/ComplaintCollectionResourceService.java b/src/main/java/com/biutag/supervision/repository/complaintCollection/ComplaintCollectionResourceService.java index 77cf32f..e3d9114 100644 --- a/src/main/java/com/biutag/supervision/repository/complaintCollection/ComplaintCollectionResourceService.java +++ b/src/main/java/com/biutag/supervision/repository/complaintCollection/ComplaintCollectionResourceService.java @@ -66,6 +66,9 @@ public class ComplaintCollectionResourceService extends BaseDAO { && param.getDiscoveryTimeList().get(1) != null) { qw.between(ComplaintCollection::getDiscoveryTime, param.getDiscoveryTimeList().get(0), param.getDiscoveryTimeList().get(1)); } + if (CollectionUtil.size(param.getCreateTimeList()) == 2){ + qw.between(ComplaintCollection::getCreateTime, param.getCreateTimeList().get(0), param.getCreateTimeList().get(1)); + } // 来件人信息 if (StrUtil.isNotBlank(param.getPersonInfo())) { String kw = param.getPersonInfo(); diff --git a/src/main/java/com/biutag/supervision/service/ModelClueService.java b/src/main/java/com/biutag/supervision/service/ModelClueService.java index fe42203..503d1b5 100644 --- a/src/main/java/com/biutag/supervision/service/ModelClueService.java +++ b/src/main/java/com/biutag/supervision/service/ModelClueService.java @@ -115,6 +115,7 @@ public class ModelClueService extends ServiceImpl { } // 手动下发 + @Transactional(rollbackFor = Exception.class) public boolean distributionByManuel(ModelClueTaskDistribute taskDistribute) { List modelClues = taskDistribute.getModelClues(); Model model = modelMapper.selectById(modelClues.get(0).getModelId()); diff --git a/src/main/java/com/biutag/supervision/service/NegativeQueryService.java b/src/main/java/com/biutag/supervision/service/NegativeQueryService.java index bd1f51c..e42a42a 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeQueryService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeQueryService.java @@ -204,6 +204,20 @@ public class NegativeQueryService { ); queryWrapper.in(Negative::getProcessingStatus,List.of("completed", "approval")); } + // 审批超时查询(支持多选) + if (CollectionUtil.isNotEmpty(param.getApprovalTimeoutStatus())) { + queryWrapper.and(wrapper -> { + List statuses = param.getApprovalTimeoutStatus(); + for (int i = 0; i < statuses.size(); i++) { + String status = statuses.get(i); + if (i == 0) { + wrapper.and(q -> buildTimeoutCondition(q, status)); + } else { + wrapper.or(q -> buildTimeoutCondition(q, status)); + } + } + }); + } // 排序 queryWrapper.orderBy("crtTime".equals(param.getOrderProp()), OrderEnum.ascending.name().equals(param.getOrder()), Negative::getCrtTime) .orderBy("discoveryTime".equals(param.getOrderProp()), OrderEnum.ascending.name().equals(param.getOrder()), Negative::getDiscoveryTime);; @@ -223,4 +237,21 @@ public class NegativeQueryService { return new Page().setRecords(list).setTotal(page.getTotal()); } + private void buildTimeoutCondition(LambdaQueryWrapper queryWrapper, String status) { + switch (status) { + case "city_timeout": + queryWrapper.gt(Negative::getFirstApproveTime, TimeUtil.SECONDS_OF_A_DAY); + break; + case "city_normal": + queryWrapper.le(Negative::getFirstApproveTime, TimeUtil.SECONDS_OF_A_DAY).or().isNull(Negative::getFirstApproveTime); + break; + case "branch_timeout": + queryWrapper.gt(Negative::getSecondApprovalTime, TimeUtil.SECONDS_OF_A_DAY); + break; + case "branch_normal": + queryWrapper.le(Negative::getSecondApprovalTime, TimeUtil.SECONDS_OF_A_DAY).or().isNull(Negative::getSecondApprovalTime); + break; + } + } + } diff --git a/src/main/java/com/biutag/supervision/service/NegativeTaskService.java b/src/main/java/com/biutag/supervision/service/NegativeTaskService.java index 068addd..b1c5c66 100644 --- a/src/main/java/com/biutag/supervision/service/NegativeTaskService.java +++ b/src/main/java/com/biutag/supervision/service/NegativeTaskService.java @@ -3,6 +3,7 @@ package com.biutag.supervision.service; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.IdUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; @@ -24,6 +25,7 @@ import com.biutag.supervision.pojo.vo.ExportNegativeBlameLeaderVo; import com.biutag.supervision.pojo.vo.ExportNegativeBlameVo; import com.biutag.supervision.pojo.vo.ExportNegativeVo; import com.biutag.supervision.pojo.vo.NegativeQueryVo; +import com.biutag.supervision.util.TimeUtil; import lombok.RequiredArgsConstructor; import org.springframework.beans.BeanUtils; import org.springframework.scheduling.annotation.Async; @@ -204,6 +206,8 @@ public class NegativeTaskService extends ServiceImpl complaintCollectionList = complaintCollectionResourceService.query(complaintCollectionQueryParam); ComplaintCollection complaintCollection = complaintCollectionList.get(0); - LocalDateTime discoveryTime = complaintCollection.getDiscoveryTime(); + LocalDateTime discoveryTime = complaintCollection.getCreateTime(); long maxSeconds = CHECK_LIMIT_DAYS * TimeUtil.SECONDS_OF_A_DAY; long remainingAtInitial = TimeUtil.getRemainingDuration(discoveryTime, LocalDateTime.now(), maxSeconds); String initialReviewStatus = (remainingAtInitial < 0) ? @@ -1309,7 +1309,7 @@ public class ComplaintCollectionServiceImpl implements ComplaintCollectionServic if (dto == null || StrUtil.isBlank(dto.getId())) { return; } - LocalDateTime discoveryTime = dto.getDiscoveryTime(); + LocalDateTime discoveryTime = dto.getCreateTime(); if (discoveryTime == null) { dto.setRemainingDuration(null); return; diff --git a/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java b/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java index 312a039..e2e9832 100644 --- a/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/datav/DatavServiceImpl.java @@ -421,15 +421,16 @@ public class DatavServiceImpl implements DatavService { negativeQueryParam.setProblemSourcesCode(List.of(SPDC.getValue())); negativeQueryParam.setCrtTime(List.of(request.getBeginTime(), request.getEndTime())); List negatives = negativeResourceService.query(negativeQueryParam); - List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); +// List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); + List njssList = completedList.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); // 使用统一的问责次数统计口径,便于核对大屏与导出逻辑差异 AccountabilityCountUtil.AccountabilityCountResult accountabilityCountResult = accountabilityCountUtil.buildAccountabilityCountResult(negatives); VideoSuperviseCountVo overview = new VideoSuperviseCountVo(); overview.setTotal(negatives.size()); overview.setCompletionProblem((long) completedList.size()); - overview.setDiscoverProblem((long) ssList.size()); + overview.setDiscoverProblem((long) njssList.size()); overview.setRelativeOrg(accountabilityCountResult.newUnitCount()); overview.setRelativePer(accountabilityCountResult.newPersonTotalCount()); JSONObject data = new JSONObject().fluentPut("overview", overview); @@ -449,14 +450,15 @@ public class DatavServiceImpl implements DatavService { for (SupDepart fxsj : fxsjDw) { List negatives = negativeMapper.getNegativeListData(fxsj.getId(), request.getBeginTime(), request.getEndTime(), proCode); - List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); +// List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); + List njssList = completedList.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); // 使用统一的问责次数统计口径,便于核对大屏与导出逻辑差异 AccountabilityCountUtil.AccountabilityCountResult accountabilityCountResult = accountabilityCountUtil.buildAccountabilityCountResult(negatives); VideoSuperviseMapIconVo videoSuperviseMapIconVo = new VideoSuperviseMapIconVo(); videoSuperviseMapIconVo.setName(fxsj.getShortName()); videoSuperviseMapIconVo.setDepartId(fxsj.getId()); - videoSuperviseMapIconVo.setDiscoverProblem(ssList.size()); + videoSuperviseMapIconVo.setDiscoverProblem(njssList.size()); videoSuperviseMapIconVo.setCompletionProblem(completedList.size()); videoSuperviseMapIconVo.setRelativeOrg(Math.toIntExact(accountabilityCountResult.newUnitCount())); videoSuperviseMapIconVo.setRelativePer(Math.toIntExact(accountabilityCountResult.newPersonTotalCount())); diff --git a/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java b/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java index a33c4bc..b7cf566 100644 --- a/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java +++ b/src/main/java/com/biutag/supervision/service/subDatav/SubDatavServiceImpl.java @@ -471,15 +471,16 @@ public class SubDatavServiceImpl implements SubDatavService { @Override public Result getSubOneAllVideoSuperviseCount(SubDataVRequest request) { List negatives = negativeMapper.getNegativeListData(request.getDepartId(), request.getBeginTime(), request.getEndTime(), List.of(SPDC.getValue())); - List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); +// List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); + List njssList = completedList.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); // 与 DatavServiceImpl 保持一致:按“有效问题 + 多处理结果拆分 + negativeId/对象/处理结果去重”的口径统计。 AccountabilityCountUtil.AccountabilityCountResult accountabilityCountResult = accountabilityCountUtil.buildAccountabilityCountResult(negatives); VideoSuperviseCountVo overview = new VideoSuperviseCountVo(); overview.setTotal(negatives.size()); overview.setCompletionProblem((long) completedList.size()); - overview.setDiscoverProblem((long) ssList.size()); + overview.setDiscoverProblem((long) njssList.size()); overview.setRelativeOrg(accountabilityCountResult.newUnitCount()); overview.setRelativePer(accountabilityCountResult.newPersonTotalCount()); JSONObject data = new JSONObject().fluentPut("overview", overview); @@ -503,15 +504,15 @@ public class SubDatavServiceImpl implements SubDatavService { List negatives = negativeMapper.getNegativeListData(pcs.getId(), request.getBeginTime(), request.getEndTime(), proCode); - List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); +// List ssList = negatives.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); List completedList = negatives.stream().filter(item -> ProcessingStatusEnum.completed.name().equals(item.getProcessingStatus())).toList(); // 与 DatavServiceImpl 保持一致:按“有效问题 + 多处理结果拆分 + negativeId/对象/处理结果去重”的口径统计。 AccountabilityCountUtil.AccountabilityCountResult accountabilityCountResult = accountabilityCountUtil.buildAccountabilityCountResult(negatives); - + List njssList = completedList.stream().filter(one -> CheckStatusEnum.TRUE_SET.contains(one.getCheckStatusCode()) || CheckStatusEnum.PART_TRUE_SET.contains(one.getCheckStatusCode())).toList(); VideoSuperviseMapIconVo videoSuperviseMapIconVo = new VideoSuperviseMapIconVo(); videoSuperviseMapIconVo.setName(pcs.getShortName()); videoSuperviseMapIconVo.setDepartId(pcs.getId()); - videoSuperviseMapIconVo.setDiscoverProblem(ssList.size()); + videoSuperviseMapIconVo.setDiscoverProblem(njssList.size()); videoSuperviseMapIconVo.setCompletionProblem(completedList.size()); videoSuperviseMapIconVo.setRelativeOrg(Math.toIntExact(accountabilityCountResult.newUnitCount())); videoSuperviseMapIconVo.setRelativePer(Math.toIntExact(accountabilityCountResult.newPersonTotalCount())); diff --git a/src/main/java/com/biutag/supervision/util/TimeUtil.java b/src/main/java/com/biutag/supervision/util/TimeUtil.java index 2a0019d..77145eb 100644 --- a/src/main/java/com/biutag/supervision/util/TimeUtil.java +++ b/src/main/java/com/biutag/supervision/util/TimeUtil.java @@ -109,4 +109,77 @@ public class TimeUtil { public static String formatDate(Date date) { return new SimpleDateFormat("yyyy年MM月dd日").format(date); } + + + /** + * 计算两个时间之间的工作日时长(秒) + * @param beginTime 开始时间 + * @param endTime 结束时间 + * @return 工作日时长(秒) + */ + public static long calculateWorkdayDuration(LocalDateTime beginTime, LocalDateTime endTime) { + if (Objects.isNull(beginTime) || Objects.isNull(endTime)) { + return 0; + } + HolidayService holidayService = SpringUtil.getBean(HolidayService.class); + long duration = 0; + for (LocalDateTime time = beginTime; time.isBefore(endTime.with(LocalTime.MAX)); time = time.plusDays(1)) { + if (holidayService.isHoliday(DatePattern.NORM_DATE_FORMATTER.format(time))) { + continue; + } + if (beginTime.toLocalDate().equals(endTime.toLocalDate())) { + duration += ChronoUnit.SECONDS.between(beginTime, endTime); + } else if (time.equals(beginTime)) { + duration += ChronoUnit.SECONDS.between(time, time.with(LocalTime.MAX)); + } else if (time.toLocalDate().equals(endTime.toLocalDate())) { + duration += ChronoUnit.SECONDS.between(time.with(LocalTime.MIN), endTime); + } else { + duration += SECONDS_OF_A_DAY; + } + } + return duration; + } + + /** + * 将秒数格式化为时分秒字符串 + * @param seconds 秒数 + * @return 时分秒字符串,如:2时30分15秒、15分30秒、45秒 + */ + public static String formatDuration(long seconds) { + if (seconds <= 0) { + return "0"; + } + // 秒 + if (seconds < 60) { + return seconds + "秒"; + } + // 分钟 + if (seconds < 3600) { + return (seconds / 60) + "分" + (seconds % 60) + "秒"; + } + // 小时 + if (seconds < 86400) { + return (seconds / 3600) + "时" + ((seconds % 3600) / 60) + "分"; + } + // 天 + return (seconds / 86400) + "天" + ((seconds % 86400) / 3600) + "时"; + } + + + /** + * 判断指定时长是否超时(以 1 天为边界) + * @param usedSeconds 已用时长(秒),例如从任务开始到现在的总耗时 + * @return 格式:"未超时/剩余时分秒" 或 "已超时/超出时分秒" + * 剩余/超出时长通过 {@link #formatDuration(long)} 格式化 + */ + public static String getTimeoutStatus(long usedSeconds) { + long limit = SECONDS_OF_A_DAY; // 86400秒 = 1天 + long diff = limit - usedSeconds; // diff > 0 表示剩余时间,diff < 0 表示超出时间 + if (diff >= 0) { + return "未超时/用时:" + formatDuration(usedSeconds); + } else { + return "已超时/用时:" + formatDuration(usedSeconds); + } + } + }