You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
2.4 KiB
64 lines
2.4 KiB
package com.iflytop.nuclear.service.impl;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.iflytop.nuclear.mapper.TaskMapper;
|
|
import com.iflytop.nuclear.model.Account;
|
|
import com.iflytop.nuclear.model.NuclearCoreConfig;
|
|
import com.iflytop.nuclear.model.Task;
|
|
import com.iflytop.nuclear.service.NuclearCoreConfigService;
|
|
import com.iflytop.nuclear.service.TaskService;
|
|
import com.iflytop.nuclear.vo.TaskVO;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @author cool
|
|
* @date 2023/6/28 14:04
|
|
*/
|
|
@Service
|
|
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {
|
|
|
|
@Autowired
|
|
NuclearCoreConfigService nuclearCoreConfigService;
|
|
|
|
@Override
|
|
public List<TaskVO> getTaskInfoByUsername(String username, String user_role) {
|
|
List<Task> list = null;
|
|
if (user_role == "ROLE_USER"){
|
|
QueryWrapper<Task> taskQueryWrapper = new QueryWrapper<>();
|
|
taskQueryWrapper.eq("operator_id", username);
|
|
list = this.list(taskQueryWrapper);
|
|
}else {
|
|
list = this.list();
|
|
}
|
|
List<TaskVO> result= new ArrayList<>();
|
|
for (Task task: list) {
|
|
// 查询该task上传过excel吗
|
|
QueryWrapper<NuclearCoreConfig> nuclearCoreConfigQueryWrapper = new QueryWrapper<>();
|
|
nuclearCoreConfigQueryWrapper.eq("task_id", task.getId());
|
|
List<NuclearCoreConfig> nuclearCoreConfigList = nuclearCoreConfigService.list(nuclearCoreConfigQueryWrapper);
|
|
boolean canUpload = true;
|
|
if (nuclearCoreConfigList.size() > 0) {
|
|
canUpload = false;
|
|
}
|
|
TaskVO taskVO = TaskVO.builder()
|
|
.taskName(task.getTaskName())
|
|
.checkOrder(task.getCheckOrder())
|
|
.id(task.getId())
|
|
.nuclearCoreName("1")
|
|
.nuclearStationName("2")
|
|
.publishTime(task.getPublishTime())
|
|
.operatorName(task.getOperatorId())
|
|
.startTime(task.getStartTime())
|
|
.endTime(task.getEndTime())
|
|
.canUpload(canUpload)
|
|
.build();
|
|
result.add(taskVO);
|
|
}
|
|
return result;
|
|
}
|
|
}
|