Browse Source

feat:查询支持审批超时条件的查询

master
buaixuexideshitongxue 4 weeks ago
parent
commit
7d2626cfcc
  1. 4
      src/main/java/com/biutag/supervision/pojo/param/NegativeQueryParam.java
  2. 31
      src/main/java/com/biutag/supervision/service/NegativeQueryService.java

4
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<String> 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;
}

31
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<String> 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<NegativeQueryVo>().setRecords(list).setTotal(page.getTotal());
}
private void buildTimeoutCondition(LambdaQueryWrapper<Negative> 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;
}
}
}

Loading…
Cancel
Save