|
|
@@ -17,6 +17,7 @@ import cn.vber.device.mapper.StatisticsInspectionMissedMapper;
|
|
|
import cn.vber.device.service.IInspectionRuleService;
|
|
|
import cn.vber.device.service.IStatisticsInspectionMissedService;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
@@ -54,8 +55,8 @@ public class StatisticsInspectionMissedServiceImpl implements IStatisticsInspect
|
|
|
*/
|
|
|
@Override
|
|
|
public TableDataInfo<StatisticsInspectionMissedVo> queryPageList(StatisticsInspectionMissedBo bo, PageQuery pageQuery) {
|
|
|
- LambdaQueryWrapper<StatisticsInspectionMissed> lqw = buildQueryWrapper(bo);
|
|
|
- Page<StatisticsInspectionMissedVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
+ QueryWrapper<StatisticsInspectionMissed> qw = buildQueryWrapper(bo);
|
|
|
+ Page<StatisticsInspectionMissedVo> result = baseMapper.selectListVoPage(pageQuery.build(), qw);
|
|
|
return TableDataInfo.build(result);
|
|
|
}
|
|
|
|
|
|
@@ -64,62 +65,21 @@ public class StatisticsInspectionMissedServiceImpl implements IStatisticsInspect
|
|
|
*/
|
|
|
@Override
|
|
|
public List<StatisticsInspectionMissedVo> queryList(StatisticsInspectionMissedBo bo) {
|
|
|
- LambdaQueryWrapper<StatisticsInspectionMissed> lqw = buildQueryWrapper(bo);
|
|
|
- return baseMapper.selectVoList(lqw);
|
|
|
+ QueryWrapper<StatisticsInspectionMissed> qw = buildQueryWrapper(bo);
|
|
|
+ return baseMapper.selectListVo(qw);
|
|
|
}
|
|
|
|
|
|
- private LambdaQueryWrapper<StatisticsInspectionMissed> buildQueryWrapper(StatisticsInspectionMissedBo bo) {
|
|
|
- Map<String, Object> params = bo.getParams();
|
|
|
- LambdaQueryWrapper<StatisticsInspectionMissed> lqw = Wrappers.lambdaQuery();
|
|
|
- lqw.eq(bo.getRuleId() != null, StatisticsInspectionMissed::getRuleId, bo.getRuleId());
|
|
|
- lqw.eq(bo.getInspectorId() != null, StatisticsInspectionMissed::getInspectorId, bo.getInspectorId());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getStatCycle()), StatisticsInspectionMissed::getStatCycle, bo.getStatCycle());
|
|
|
- lqw.eq(bo.getMissedCount() != null, StatisticsInspectionMissed::getMissedCount, bo.getMissedCount());
|
|
|
- lqw.eq(bo.getMissedDuration() != null, StatisticsInspectionMissed::getMissedDuration, bo.getMissedDuration());
|
|
|
- return lqw;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增点检漏检情况统计
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Boolean insertByBo(StatisticsInspectionMissedBo bo) {
|
|
|
- StatisticsInspectionMissed add = MapstructUtils.convert(bo, StatisticsInspectionMissed.class);
|
|
|
- validEntityBeforeSave(add);
|
|
|
- boolean flag = baseMapper.insert(add) > 0;
|
|
|
- if (flag) {
|
|
|
- bo.setId(add.getId());
|
|
|
+ private QueryWrapper<StatisticsInspectionMissed> buildQueryWrapper(StatisticsInspectionMissedBo bo) {
|
|
|
+ QueryWrapper<StatisticsInspectionMissed> qw = Wrappers.query();
|
|
|
+ qw.lambda()
|
|
|
+ .eq(StringUtils.isNotBlank(bo.getStatCycle()), StatisticsInspectionMissed::getStatCycle, bo.getStatCycle())
|
|
|
+ .like(StringUtils.isNotBlank(bo.getRuleName()), StatisticsInspectionMissed::getRuleName, bo.getRuleName());
|
|
|
+ if (StringUtils.isNotBlank(bo.getInspectorName())) {
|
|
|
+ qw.like("u.nick_name", bo.getInspectorName());
|
|
|
}
|
|
|
- return flag;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 修改点检漏检情况统计
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Boolean updateByBo(StatisticsInspectionMissedBo bo) {
|
|
|
- StatisticsInspectionMissed update = MapstructUtils.convert(bo, StatisticsInspectionMissed.class);
|
|
|
- validEntityBeforeSave(update);
|
|
|
- return baseMapper.updateById(update) > 0;
|
|
|
+ return qw;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 保存前的数据校验
|
|
|
- */
|
|
|
- private void validEntityBeforeSave(StatisticsInspectionMissed entity) {
|
|
|
- //TODO 做一些数据校验,如唯一约束
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 批量删除点检漏检情况统计
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
- if (isValid) {
|
|
|
- //TODO 做一些业务上的校验,判断是否需要校验
|
|
|
- }
|
|
|
- return baseMapper.deleteByIds(ids) > 0;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 生成设备故障统计列表
|
|
|
@@ -135,7 +95,7 @@ public class StatisticsInspectionMissedServiceImpl implements IStatisticsInspect
|
|
|
ruleList.forEach(rule -> {
|
|
|
inspectionRuleService.checkin(rule.getId(), null, true);
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
//删除周期内的旧数据
|
|
|
baseMapper.delete(new LambdaQueryWrapper<StatisticsInspectionMissed>()
|
|
|
.eq(StatisticsInspectionMissed::getStatCycle, cycle));
|