package org.jeecg.modules.mdcJc.service.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import org.jeecg.modules.mdcJc.entity.MdcOnLineQueue;
|
import org.jeecg.modules.mdcJc.entity.OnLineQueue;
|
import org.jeecg.modules.mdcJc.mapper.MdcOnLineQueueMapper;
|
import org.jeecg.modules.mdcJc.service.IClassMonthlyScheduleService;
|
import org.jeecg.modules.mdcJc.service.IMdcOnLineQueueService;
|
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:02
|
*/
|
@Service
|
public class MdcOnLineQueueServiceImpl extends ServiceImpl<MdcOnLineQueueMapper, MdcOnLineQueue> implements IMdcOnLineQueueService {
|
|
@Resource
|
private IClassMonthlyScheduleService classMonthlyScheduleService;
|
|
/**
|
* 自动上线
|
* @return
|
*/
|
@Override
|
public boolean saveOnLineQueueList() {
|
MdcOnLineQueue mdcOnLineQueue = this.baseMapper.findLastOne();
|
List<OnLineQueue> onLineQueueList = new ArrayList<>();
|
if (mdcOnLineQueue == null) {
|
// 首次
|
onLineQueueList = classMonthlyScheduleService.onLineQueueList();
|
} else {
|
onLineQueueList = classMonthlyScheduleService.findListOnLineQueue(mdcOnLineQueue.getId());
|
}
|
if (onLineQueueList == null || onLineQueueList.isEmpty()) {
|
return true;
|
}
|
List<MdcOnLineQueue> mesO = new ArrayList<>();
|
for (OnLineQueue o : onLineQueueList) {
|
MdcOnLineQueue mdc = new MdcOnLineQueue();
|
BeanMapper.copy(o, mdc);
|
mesO.add(mdc);
|
}
|
return this.saveBatch(mesO);
|
}
|
}
|