Lius
2024-08-22 f59452ac384766a21500857e89928a8abc0e75b5
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
package org.jeecg.modules.mdcJc.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.mdcJc.entity.MdcUnderLineQueue;
import org.jeecg.modules.mdcJc.entity.UnderLineQueue;
import org.jeecg.modules.mdcJc.mapper.MdcUnderLineQueueMapper;
import org.jeecg.modules.mdcJc.service.IClassMonthlyScheduleService;
import org.jeecg.modules.mdcJc.service.IMdcUnderLineQueueService;
import org.jeecg.modules.utils.BeanMapper;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author Lius
 * @date 2024/8/8 15:09
 */
@Service
public class MdcUnderLineQueueServiceImpl extends ServiceImpl<MdcUnderLineQueueMapper, MdcUnderLineQueue> implements IMdcUnderLineQueueService {
 
    @Resource
    private IClassMonthlyScheduleService classMonthlyScheduleService;
 
    /**
     * 自动下线
     * @return
     */
    @Override
    public boolean saveUnderLineQueue() {
        MdcUnderLineQueue mdcUnderLineQueue = this.baseMapper.findLastOne();
        List<UnderLineQueue> underLineQueueList = new ArrayList<>();
        if (mdcUnderLineQueue == null) {
            // 首次
            underLineQueueList = classMonthlyScheduleService.underLineQueueList();
        } else {
            underLineQueueList = classMonthlyScheduleService.findListUnderLineQueue(mdcUnderLineQueue.getId());
        }
        if (underLineQueueList == null || underLineQueueList.isEmpty()) {
            return true;
        }
        List<MdcUnderLineQueue> mdcU = new ArrayList<>();
        for (UnderLineQueue u : underLineQueueList) {
            MdcUnderLineQueue mdc = new MdcUnderLineQueue();
            BeanMapper.copy(u, mdc);
            mdcU.add(mdc);
        }
        return this.saveBatch(mdcU);
    }
}