|
|
@@ -6,17 +6,19 @@ 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.hz.pm.api.sys.mapper.EarlyWarningRecordsMapper; |
|
|
|
import com.hz.pm.api.sys.model.entity.WflowEarlyWarningRecords; |
|
|
|
import com.hz.pm.api.sys.model.req.WarningListReq; |
|
|
|
import com.hz.pm.api.sys.model.vo.WflowEarlyWarningRecordsVO; |
|
|
|
import com.hz.pm.api.sys.service.IEarlyWarningRecordsService; |
|
|
|
import com.ningdatech.basic.model.PageVo; |
|
|
|
import com.wflow.enums.WarningRuleTypeEnum; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.stream.Collectors; |
|
|
@@ -41,25 +43,34 @@ public class EarlyWarningRecordsServiceImpl extends ServiceImpl<EarlyWarningReco |
|
|
|
Page<WflowEarlyWarningRecords> page = req.page(); |
|
|
|
LambdaQueryWrapper<WflowEarlyWarningRecords> wrapper = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
.eq(WflowEarlyWarningRecords::getRuleType, ruleType) |
|
|
|
.eq(StringUtils.isNotBlank(req.getAreaCode()),WflowEarlyWarningRecords::getAreaCode,req.getAreaCode()) |
|
|
|
.eq(Objects.nonNull(req.getMhUnitId()),WflowEarlyWarningRecords::getMhUnitId,req.getMhUnitId()) |
|
|
|
.eq(StringUtils.isNotBlank(req.getAreaCode()), WflowEarlyWarningRecords::getAreaCode, req.getAreaCode()) |
|
|
|
.eq(Objects.nonNull(req.getMhUnitId()), WflowEarlyWarningRecords::getMhUnitId, req.getMhUnitId()) |
|
|
|
.like(StringUtils.isNotBlank(req.getProjectName()), WflowEarlyWarningRecords::getProjectName, req.getProjectName()) |
|
|
|
.like(StringUtils.isNotBlank(req.getBuildOrgName()), WflowEarlyWarningRecords::getBuildOrgName, req.getBuildOrgName()) |
|
|
|
.eq(StringUtils.isNotBlank(req.getBuildOrgCode()), WflowEarlyWarningRecords::getBuildOrgCode, req.getBuildOrgCode()) |
|
|
|
.ge(Objects.nonNull(req.getStartTime()),WflowEarlyWarningRecords::getWarningTime,req.getStartTime()) |
|
|
|
.le(Objects.nonNull(req.getEndTime()),WflowEarlyWarningRecords::getWarningTime,req.getEndTime()) |
|
|
|
.ge(Objects.nonNull(req.getStartTime()), WflowEarlyWarningRecords::getWarningTime, req.getStartTime()) |
|
|
|
.le(Objects.nonNull(req.getEndTime()), WflowEarlyWarningRecords::getWarningTime, req.getEndTime()) |
|
|
|
.orderByDesc(WflowEarlyWarningRecords::getCreateOn); |
|
|
|
|
|
|
|
this.page(page,wrapper); |
|
|
|
this.page(page, wrapper); |
|
|
|
|
|
|
|
if(CollUtil.isEmpty(page.getRecords())){ |
|
|
|
if (CollUtil.isEmpty(page.getRecords())) { |
|
|
|
return PageVo.empty(); |
|
|
|
} |
|
|
|
|
|
|
|
List<WflowEarlyWarningRecordsVO> res = page.getRecords().stream() |
|
|
|
.map(p -> BeanUtil.copyProperties(p,WflowEarlyWarningRecordsVO.class)) |
|
|
|
.map(p -> BeanUtil.copyProperties(p, WflowEarlyWarningRecordsVO.class)) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
return PageVo.of(res,page.getTotal()); |
|
|
|
return PageVo.of(res, page.getTotal()); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<WflowEarlyWarningRecords> listProjectLastWarningRecords(Collection<String> projectCodes, WarningRuleTypeEnum ruleType) { |
|
|
|
LambdaQueryWrapper<WflowEarlyWarningRecords> query = Wrappers.lambdaQuery(WflowEarlyWarningRecords.class) |
|
|
|
.in(WflowEarlyWarningRecords::getProjectCode, projectCodes) |
|
|
|
.eq(WflowEarlyWarningRecords::getRuleType, ruleType.getCode()); |
|
|
|
return baseMapper.selectProjectLastWarningRecords(query); |
|
|
|
} |
|
|
|
|
|
|
|
} |