|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi.sim.service.impl;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
@@ -59,14 +60,14 @@ public class TaskService {
|
|
|
String simType = t.getSimType();
|
|
|
BeanUtils.copyProperties(t, vo);
|
|
|
// 查询获得数据结构。
|
|
|
- List<FaultTreeVo> listToQ = (List<FaultTreeVo>) faultService.listAllTreeStyleBySimType(simType).get(AjaxResult.DATA_TAG);
|
|
|
+ List<FaultTreeVo> listToQ = (List<FaultTreeVo>) faultService.listAllARTreeStyleBySimType(simType).get(AjaxResult.DATA_TAG);
|
|
|
// 变成扁平list
|
|
|
List<FaultTreeVo> listToF = FaultService.flatten(listToQ);
|
|
|
for (FaultTreeVo o : listToF) {
|
|
|
if (o == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- if (Fault.TYPE_3.equals(o.getFaultType())) {
|
|
|
+ if (Fault.Type.TYPE_GZBW.equals(o.getFaultType())) {
|
|
|
TaskFault tf = o.getTaskFault();
|
|
|
TaskFault tfQ = taskFaultService.selectUniqueTaskFault(taskId, tf.getFaultId());
|
|
|
// 存在就设置上数据库中TaskFault值。
|
|
@@ -84,11 +85,31 @@ public class TaskService {
|
|
|
/**
|
|
|
* 查询任务列表
|
|
|
*
|
|
|
- * @param task 任务
|
|
|
+ * @param q 任务
|
|
|
* @return 任务
|
|
|
*/
|
|
|
- public List<Task> selectTaskList(Task task) {
|
|
|
- return taskMapper.selectTaskList(task);
|
|
|
+ public List<TaskVo> list(TaskVo q) {
|
|
|
+ Task qT = new Task();
|
|
|
+ BeanUtils.copyProperties(q, qT);
|
|
|
+ List<Task> listT = taskMapper.selectTaskList(qT);
|
|
|
+ List<TaskVo> listTVo = new ArrayList<>(listT.size());
|
|
|
+ Long taskId = q.getTaskId();
|
|
|
+ listT.stream().forEach(t -> {
|
|
|
+ TaskVo vo = new TaskVo();
|
|
|
+ BeanUtils.copyProperties(t, vo);
|
|
|
+ {
|
|
|
+ int countGZXX = 0;
|
|
|
+ int countGZBW = 0;
|
|
|
+ //
|
|
|
+ countGZBW = taskFaultService.countTypeGZBW(taskId);
|
|
|
+ // todo:故障现象
|
|
|
+ // countGZXX = faultService.listType1ByType3
|
|
|
+ vo.setCountGZXX(countGZXX);
|
|
|
+ vo.setCountGZBW(countGZBW);
|
|
|
+ }
|
|
|
+ listTVo.add(vo);
|
|
|
+ });
|
|
|
+ return listTVo;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -104,7 +125,7 @@ public class TaskService {
|
|
|
return AjaxResult.error("TaskVo empty!");
|
|
|
}
|
|
|
if (!simService.checkSimTypeOk(tv.getSimType())) {
|
|
|
- return AjaxResult.error("simType error!");
|
|
|
+ return AjaxResult.error("getSimType error!");
|
|
|
}
|
|
|
if (!Task.Type.TEACHER_ADD.equals(tv.getTaskType())) {
|
|
|
return AjaxResult.error("taskType value error!");
|
|
@@ -128,7 +149,7 @@ public class TaskService {
|
|
|
if (ftv == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- if (!Fault.TYPE_3.equals(ftv.getFaultType())) {
|
|
|
+ if (!Fault.Type.TYPE_GZBW.equals(ftv.getFaultType())) {
|
|
|
continue;
|
|
|
}
|
|
|
TaskFault tf = ftv.getTaskFault();
|
|
@@ -194,19 +215,18 @@ public class TaskService {
|
|
|
*/
|
|
|
@Transactional
|
|
|
public AjaxResult insertTaskByTeacher(TaskVo tv) {
|
|
|
- l.info("insertTaskByTeacher " + tv);
|
|
|
// check
|
|
|
if (tv == null) {
|
|
|
return AjaxResult.error("TaskVo empty!");
|
|
|
}
|
|
|
if (!simService.checkSimTypeOk(tv.getSimType())) {
|
|
|
- return AjaxResult.error("simType error!");
|
|
|
+ return AjaxResult.error("getSimType error!");
|
|
|
}
|
|
|
if (!Task.Type.TEACHER_ADD.equals(tv.getTaskType())) {
|
|
|
- return AjaxResult.error("taskType value error!");
|
|
|
+ return AjaxResult.error("getTaskType value error!");
|
|
|
}
|
|
|
if (StringUtils.isEmpty(tv.getName())) {
|
|
|
- return AjaxResult.error("name isEmpty!");
|
|
|
+ return AjaxResult.error("getName isEmpty!");
|
|
|
}
|
|
|
//
|
|
|
tv.setCreateByUserId(SecurityUtils.getUserId());
|
|
@@ -214,7 +234,6 @@ public class TaskService {
|
|
|
tv.setCreateTime(DateUtils.getNowDate());
|
|
|
tv.setUpdateBy(SecurityUtils.getUsername());
|
|
|
tv.setUpdateTime(DateUtils.getNowDate());
|
|
|
- tv.setRemark("");
|
|
|
taskMapper.insertTask(tv);
|
|
|
List<FaultTreeVo> selectedData = tv.getSelectedData();
|
|
|
if (selectedData != null) {
|
|
@@ -223,7 +242,7 @@ public class TaskService {
|
|
|
if (ftv == null) {
|
|
|
continue;
|
|
|
}
|
|
|
- if (!Fault.TYPE_3.equals(ftv.getFaultType())) {
|
|
|
+ if (!Fault.Type.TYPE_GZBW.equals(ftv.getFaultType())) {
|
|
|
continue;
|
|
|
}
|
|
|
TaskFault tf = ftv.getTaskFault();
|
|
@@ -243,7 +262,7 @@ public class TaskService {
|
|
|
}
|
|
|
// todo:选中数量限制
|
|
|
|
|
|
- // todo:故障部位冲突
|
|
|
+ // 故障部位冲突 暂时没有故障部位冲突。
|
|
|
tf.setTaskId(tv.getTaskId());
|
|
|
taskFaultService.insertOrUpdateTaskFault(tf);
|
|
|
}
|
|
@@ -265,9 +284,10 @@ public class TaskService {
|
|
|
return AjaxResult.error("simType value error!");
|
|
|
}
|
|
|
// query obj.
|
|
|
- List<FaultTreeVo> ftList = (List<FaultTreeVo>) faultService.listAllTreeStyleBySimType(simType).get(AjaxResult.DATA_TAG);
|
|
|
+ List<FaultTreeVo> ftList = faultService.listAllListTreeStyleBySimType(simType);
|
|
|
TaskVo t = new TaskVo();
|
|
|
t.setTaskId(Task.EMPTY_TASK_ID);
|
|
|
+ t.setSimType(simType);
|
|
|
t.setSelectedData(ftList);
|
|
|
return AjaxResult.success(t);
|
|
|
}
|