|
|
@@ -1,13 +1,25 @@ |
|
|
|
package com.ningdatech.pmapi.sys.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.ningdatech.pmapi.sys.mapper.EarlyWarningRecordsMapper; |
|
|
|
import com.ningdatech.pmapi.sys.model.entity.WflowEarlyWarningRecords; |
|
|
|
import com.ningdatech.pmapi.sys.model.req.WarningListReq; |
|
|
|
import com.ningdatech.pmapi.sys.model.vo.WflowEarlyWarningRecordsVO; |
|
|
|
import com.ningdatech.pmapi.sys.service.IEarlyWarningRecordsService; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* <p> |
|
|
@@ -23,4 +35,26 @@ import org.springframework.stereotype.Service; |
|
|
|
public class EarlyWarningRecordsServiceImpl extends ServiceImpl<EarlyWarningRecordsMapper, WflowEarlyWarningRecords> |
|
|
|
implements IEarlyWarningRecordsService { |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageVo<WflowEarlyWarningRecordsVO> records(Integer ruleType, WarningListReq req) { |
|
|
|
Page<WflowEarlyWarningRecords> page = req.page(); |
|
|
|
LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
.eq(WflowEarlyWarningRecords::getRuleType, ruleType) |
|
|
|
.like(StringUtils.isNotBlank(req.getProjectName()), WflowEarlyWarningRecords::getProjectName, req.getProjectName()) |
|
|
|
.like(StringUtils.isNotBlank(req.getBuildOrgName()), WflowEarlyWarningRecords::getBuildOrgName, req.getBuildOrgName()) |
|
|
|
.ge(Objects.nonNull(req.getStartTime()),WflowEarlyWarningRecords::getWarningTime,req.getStartTime()) |
|
|
|
.le(Objects.nonNull(req.getEndTime()),WflowEarlyWarningRecords::getWarningTime,req.getEndTime()); |
|
|
|
|
|
|
|
this.page(page,wrapper); |
|
|
|
|
|
|
|
if(0L == page.getTotal()){ |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<WflowEarlyWarningRecordsVO> res = page.getRecords().stream() |
|
|
|
.map(p -> BeanUtil.copyProperties(p,WflowEarlyWarningRecordsVO.class)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
return PageVo.of(res,page.getTotal()); |
|
|
|
} |
|
|
|
} |