| | |
| | | package cn.shlanbao.qms.service.impl; |
| | | |
| | | import cn.shlanbao.qms.domain.LbSensorResult; |
| | | import cn.shlanbao.qms.domain.vo.LbSensorResultVo; |
| | | import cn.shlanbao.qms.mapper.LbSensorResultMapper; |
| | | import cn.shlanbao.qms.service.ILbTestResultService; |
| | | import org.dromara.common.core.utils.MapstructUtils; |
| | | import org.dromara.common.core.utils.StringUtils; |
| | |
| | | public class LbBatchServiceImpl implements ILbBatchService { |
| | | |
| | | private final LbBatchMapper baseMapper; |
| | | |
| | | private final LbSensorResultMapper sensorResultMapper; |
| | | private final ILbTestResultService testResultService; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public LbBatchVo queryById(Long id){ |
| | | return baseMapper.selectVoById(id); |
| | | LbBatchVo lbBatchVo = baseMapper.selectVoById(id); |
| | | if(lbBatchVo!=null){ |
| | | LambdaQueryWrapper<LbSensorResult> sensorResultWrapper = new LambdaQueryWrapper<>(); |
| | | sensorResultWrapper.eq(LbSensorResult::getBatchCode, lbBatchVo.getBatchCode()); |
| | | List<LbSensorResultVo> sensorResultVoList = sensorResultMapper.selectVoList(sensorResultWrapper); |
| | | long okCount = sensorResultVoList.stream() |
| | | .filter(vo -> "OK".equals(vo.getJudgeResult())) |
| | | .count(); |
| | | |
| | | long ngCount = sensorResultVoList.stream() |
| | | .filter(vo -> "NG".equals(vo.getJudgeResult())) |
| | | .count(); |
| | | lbBatchVo.setOkNum(okCount); |
| | | lbBatchVo.setNgNum(ngCount); |
| | | } |
| | | return lbBatchVo; |
| | | } |
| | | |
| | | /** |
| | |
| | | lqw.eq(bo.getUserId() != null, LbBatch::getUserId, bo.getUserId()); |
| | | lqw.eq(bo.getNum() != null, LbBatch::getNum, bo.getNum()); |
| | | lqw.orderByDesc(LbBatch::getBatchCode); |
| | | if(params!=null && params.containsKey("startTime")&¶ms.containsKey("endTime")) { |
| | | lqw.between(LbBatch::getBatchTime,params.get("startTime"),params.get("endTime")); |
| | | } |
| | | return lqw; |
| | | } |
| | | |