|
@@ -2,7 +2,6 @@ package com.om.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
-import cn.hutool.core.collection.ListUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.om.entity.dto.DiaLogQueryPageDTO;
|
|
|
import com.om.entity.po.*;
|
|
@@ -14,6 +13,7 @@ import com.om.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.om.utils.HuaweiObsUtil;
|
|
|
import com.om.utils.Result;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -55,30 +55,36 @@ public class DiagnosticLogServiceImpl extends ServiceImpl<DiagnosticLogMapper, D
|
|
|
//从dto中获取数据
|
|
|
Integer pageIndex = dto.getPageIndex();
|
|
|
Integer pageSize = dto.getPageSize();
|
|
|
- String account = dto.getAccount();
|
|
|
- String vciSn = dto.getVciSn();
|
|
|
LocalDateTime beginTime = dto.getBeginTime();
|
|
|
LocalDateTime endTime = dto.getEndTime();
|
|
|
- User one = null;
|
|
|
- if (account != null) {
|
|
|
+ User one = new User();
|
|
|
+ if (StringUtils.isNotBlank(dto.getAccount())) {
|
|
|
//根据用户名查询用户
|
|
|
one = userService.lambdaQuery()
|
|
|
- .eq(User::getUsername, account)
|
|
|
+ .eq(User::getUsername, dto.getAccount())
|
|
|
.one();
|
|
|
+
|
|
|
+ if (BeanUtil.isEmpty(one)){
|
|
|
+ throw new BadReqException("该查询用户不存在");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
- VciInfo vciInfo = null;
|
|
|
- if (vciSn != null) {
|
|
|
+ VciInfo vciInfo = new VciInfo();
|
|
|
+ if (StringUtils.isNotBlank(dto.getVciSn())) {
|
|
|
//根据vciSn查询VCI
|
|
|
vciInfo = vciInfoService.lambdaQuery()
|
|
|
- .eq(VciInfo::getVciNum, vciSn)
|
|
|
+ .eq(VciInfo::getVciNum, dto.getVciSn())
|
|
|
.one();
|
|
|
+
|
|
|
+ if (BeanUtil.isEmpty(vciInfo)){
|
|
|
+ throw new BadReqException("该查询vci不存在");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
Page<DiagnosticLog> page = this.lambdaQuery()
|
|
|
- .like(one != null, DiagnosticLog::getUserId, one.getId())
|
|
|
- .like(vciInfo != null, DiagnosticLog::getVciId, vciInfo.getId())
|
|
|
+ .like(StringUtils.isNotBlank(dto.getAccount()), DiagnosticLog::getUserId, one.getId())
|
|
|
+ .like(StringUtils.isNotBlank(dto.getVciSn()), DiagnosticLog::getVciId, vciInfo.getId())
|
|
|
.ge(beginTime != null, DiagnosticLog::getCreateTime, beginTime)
|
|
|
.le(endTime != null, DiagnosticLog::getCreateTime, endTime)
|
|
|
.orderByDesc(DiagnosticLog::getCreateTime)
|
|
@@ -90,7 +96,7 @@ public class DiagnosticLogServiceImpl extends ServiceImpl<DiagnosticLogMapper, D
|
|
|
vo.setPages((int) page.getPages());
|
|
|
vo.setTotal((int) page.getTotal());
|
|
|
|
|
|
- if (account != null || vciSn != null || beginTime != null || endTime != null) {
|
|
|
+ if (dto.getAccount() != null || dto.getVciSn()!= null || beginTime != null || endTime != null) {
|
|
|
vo.setSearchCount(true);
|
|
|
}
|
|
|
|