Browse Source

根据区域和月份分页查询缺陷库

zhongwei
段飞宇 1 year ago
parent
commit
a74a794b38
  1. 33
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java
  2. 30
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/OperPhenomenonVo.java

33
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/controller/web/AreaMonthlyDetailsController.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.main.controller.web;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -38,6 +39,9 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.support.BladePage; import org.springblade.core.mp.support.BladePage;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -210,6 +214,29 @@ public class AreaMonthlyDetailsController {
OperPhenomenonVo entity, String taskIds, Date findTimeEnd) { OperPhenomenonVo entity, String taskIds, Date findTimeEnd) {
Page<OperPhenomenonEntity> operDefectEntityPage = new Page<>(page, size); Page<OperPhenomenonEntity> operDefectEntityPage = new Page<>(page, size);
LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<OperPhenomenonEntity> queryWrapper = new LambdaQueryWrapper<>();
//部门
if (CollectionUtils.isNotEmpty(entity.getCreateDept())) {
queryWrapper.in(BaseEntity::getCreateDept, entity.getCreateDept());
}
if (StringUtils.isNotEmpty(entity.getDefectCode())) {
queryWrapper.eq(OperPhenomenonEntity::getDefectCode, entity.getDefectCode());
}
if (StringUtils.isNotEmpty(entity.getSourceCode())) {
queryWrapper.eq(OperPhenomenonEntity::getSourceCode, entity.getSourceCode());
}
if (StringUtils.isNotEmpty(entity.getFaultName())) {
queryWrapper.eq(OperPhenomenonEntity::getFaultName, entity.getFaultName());
}
if (ObjectUtils.isNotEmpty(entity.getDefectLevel())){
queryWrapper.eq(OperPhenomenonEntity::getDefectLevel, entity.getDefectLevel());
}
if (StringUtil.isNotBlank(taskIds)) { if (StringUtil.isNotBlank(taskIds)) {
queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(","))); queryWrapper.in(OperPhenomenonEntity::getId, Lists.newArrayList(taskIds.split(",")));
} }
@ -240,14 +267,14 @@ public class AreaMonthlyDetailsController {
queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime); queryWrapper.orderByDesc(OperPhenomenonEntity::getUpdateTime);
IPage<OperPhenomenonEntity> pages = phenomenonService.page(operDefectEntityPage, queryWrapper); IPage<OperPhenomenonEntity> pages = phenomenonService.page(operDefectEntityPage, queryWrapper);
Integer defect = entity.getDefect() == null ? 0 : entity.getDefect(); Integer defect = entity.getDefect() == null ? 0 : entity.getDefect();
Integer conclusionStatusNum = entity.getConclusionStatusNum() == null ? 1 : entity.getConclusionStatusNum(); Integer conclusionStatusNum = entity.getConclusionStatusNum() == null ? 1 : entity.getConclusionStatusNum();
//过滤 //过滤
List<OperPhenomenonEntity> collect = List<OperPhenomenonEntity> collect =
pages.getRecords().stream().filter(item -> (defect.equals(item.getIsDefect()) || pages.getRecords().stream().filter(item -> (defect.equals(item.getIsDefect()) ||
conclusionStatusNum.equals(item.getDiscriminateStatus() != null ? conclusionStatusNum.equals(item.getDiscriminateStatus() != null ?
Integer.parseInt(item.getDiscriminateStatus()) : null))) Integer.parseInt(item.getDiscriminateStatus()) : null)))
.collect(Collectors.toList()); .collect(Collectors.toList());
pages.setRecords(collect); pages.setRecords(collect);
pages.setTotal(collect.size()); pages.setTotal(collect.size());

30
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/vo/OperPhenomenonVo.java

@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
import java.time.YearMonth; import java.time.YearMonth;
import java.util.Date; import java.util.Date;
import java.util.List;
/** /**
* @Author WL * @Author WL
@ -19,6 +20,34 @@ import java.util.Date;
public class OperPhenomenonVo { public class OperPhenomenonVo {
/** /**
* 缺陷等级
*/
private String defectLevel;
/**
* 故障
*/
private String faultName;
/**
* 缺陷来源
*/
private String sourceCode;
/**
* 所属机构
*/
private List<String> createDept;
/**
* 缺陷编码
*/
private String defectCode;
/**
* 发现时间 * 发现时间
*/ */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ -48,7 +77,6 @@ public class OperPhenomenonVo {
private Date planEndTime; private Date planEndTime;
@ApiModelProperty(value = "年月") @ApiModelProperty(value = "年月")
@TableField(exist = false) @TableField(exist = false)
private YearMonth yearMonth; private YearMonth yearMonth;

Loading…
Cancel
Save