zhoushihao
2025-05-12 fbd31387721424c65b173cbb23b03202f3e7dce6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.mes.bigstoragecagetask.service.impl;
 
 
import cn.hutool.core.collection.CollectionUtil;
import cn.smallbun.screw.core.util.StringUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.bigstoragecagetask.entity.BigStorageCageHistoryTask;
import com.mes.bigstoragecagetask.entity.request.BigStorageCageHistoryRequest;
import com.mes.bigstoragecagetask.mapper.BigStorageCageHistoryTaskMapper;
import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.entity.RunTime;
import com.mes.tools.DateUtil;
import org.springframework.stereotype.Service;
 
import java.text.SimpleDateFormat;
import java.util.List;
 
/**
 * (BigStorageCageHistoryTask)表服务实现类
 *
 * @author makejava
 * @since 2024-11-13 22:46:56
 */
@Service
public class BigStorageCageHistoryTaskServiceImpl extends ServiceImpl<BigStorageCageHistoryTaskMapper, BigStorageCageHistoryTask> implements BigStorageCageHistoryTaskService {
 
    @Override
    public Page<BigStorageCageHistoryTask> queryBigStorageCageHistoryTask(BigStorageCageHistoryRequest request) {
        if (null == request.getBeginDate()) {
            request.setBeginDate(DateUtil.getBeginDate());
            request.setEndDate(DateUtil.getEndDate());
        }
        Page<BigStorageCageHistoryTask> page = new Page<>(request.getPageNo(), request.getPageSize());
        LambdaQueryWrapper<BigStorageCageHistoryTask> wrapper = new LambdaQueryWrapper<BigStorageCageHistoryTask>()
                .like(StringUtils.isNotBlank(request.getGlassId()), BigStorageCageHistoryTask::getGlassId, request.getGlassId())
                .eq(request.getStartSlot() != 0, BigStorageCageHistoryTask::getStartSlot, request.getStartSlot())
                .eq(request.getTargetSlot() != 0, BigStorageCageHistoryTask::getTargetSlot, request.getTargetSlot())
                .in(CollectionUtil.isNotEmpty(request.getTaskStateList()), BigStorageCageHistoryTask::getTaskState, request.getTaskStateList())
                .in(CollectionUtil.isNotEmpty(request.getTaskTypeList()), BigStorageCageHistoryTask::getTaskType, request.getTaskTypeList())
                .between(BigStorageCageHistoryTask::getCreateTime, request.getBeginDate(), request.getEndDate())
                .orderByAsc(BigStorageCageHistoryTask::getId);
        return this.page(page, wrapper);
    }
 
    @Override
    public DailyProductionVO queryBigDailyProduction(BigStorageCageHistoryRequest request) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String beginDate = null;
        String endDate = null;
        if (com.baomidou.mybatisplus.core.toolkit.StringUtils.checkValNotNull(request.getBeginDate())) {
            beginDate = sdf.format(request.getBeginDate());
            endDate = sdf.format(request.getEndDate());
        }
        return baseMapper.queryBigDailyProduction(beginDate, endDate);
    }
 
    @Override
    public List<RunTime> queryRunTimes(){
        return baseMapper.queryRunTimes();
    }
 
}