Compare commits
4 Commits
e9e7fc15ad
...
4057e9abf7
Author | SHA1 | Date |
---|---|---|
|
4057e9abf7 | |
|
8c70789814 | |
|
0b0116ef6e | |
|
b527936b30 |
|
@ -4,6 +4,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import tech.unissense.pms.business.examine.config.domain.ExamineConfig;
|
||||
import tech.unissense.pms.business.examine.task.domain.ExamineTask;
|
||||
import tech.unissense.pms.business.examine.task.domain.TaskQueryDto;
|
||||
import tech.unissense.pms.business.examine.task.service.TaskService;
|
||||
|
@ -36,6 +37,7 @@ public class TaskSetUpController extends BaseController {
|
|||
List<ExamineTask> tasks = taskService.getTasks(queryDto);
|
||||
return getDataTable(tasks);
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
public AjaxResult listTask(TaskQueryDto queryDto) {
|
||||
return success(taskService.listTask(queryDto));
|
||||
|
@ -51,6 +53,12 @@ public class TaskSetUpController extends BaseController {
|
|||
return AjaxResult.success(taskService.updateTask(updatedTask));
|
||||
}
|
||||
|
||||
// 编辑任务
|
||||
@PutMapping("/config/update")
|
||||
public AjaxResult updateConfigTask(@RequestBody List<ExamineConfig> list) {
|
||||
return AjaxResult.success(taskService.updateConfigTask(list));
|
||||
}
|
||||
|
||||
// 删除任务
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult deleteTask(@PathVariable Integer id) {
|
||||
|
@ -58,7 +66,7 @@ public class TaskSetUpController extends BaseController {
|
|||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
//指标配置
|
||||
//获取指标配置
|
||||
@GetMapping("/target/{id}")
|
||||
public AjaxResult getTarget(@PathVariable Integer id){
|
||||
return AjaxResult.success(taskService.getTarget(id));
|
||||
|
|
|
@ -40,5 +40,7 @@ public class ExamineTask implements Serializable {
|
|||
|
||||
|
||||
private List<Integer> userIdList;
|
||||
|
||||
private Integer year;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,4 +8,6 @@ public class TaskQueryDto extends BaseEntity {
|
|||
private String taskName;
|
||||
|
||||
private Integer taskStatus;
|
||||
|
||||
private Integer year;
|
||||
}
|
||||
|
|
|
@ -19,4 +19,6 @@ public interface TaskService {
|
|||
List<ExamineConfig> getTarget(Integer id);
|
||||
|
||||
Map<Integer,List<ExamineTask>> listTask(TaskQueryDto queryDto);
|
||||
|
||||
List<ExamineConfig> updateConfigTask(List<ExamineConfig> list);
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
@Resource
|
||||
private ExamineUserMapper userMapper;
|
||||
|
||||
@Autowired
|
||||
private ExamineUserServiceImpl examineUserService;
|
||||
|
||||
@Override
|
||||
|
@ -63,7 +65,17 @@ public class TaskServiceImpl implements TaskService {
|
|||
|
||||
@Override
|
||||
public List<ExamineTask> getTasks(TaskQueryDto queryDto) {
|
||||
return examineTaskDao.getTasks(queryDto);
|
||||
List<ExamineTask> tasks = examineTaskDao.getTasks(queryDto);
|
||||
tasks.forEach(item -> {
|
||||
ExamineUser examineUser = new ExamineUser();
|
||||
examineUser.setTaskId(item.getId());
|
||||
List<ExamineUser> existingUsers = userMapper.list(examineUser);
|
||||
List<Integer> existingUserIds = existingUsers.stream()
|
||||
.map(ExamineUser::getUserId)
|
||||
.collect(Collectors.toList());
|
||||
item.setUserIdList(existingUserIds);
|
||||
});
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -100,6 +112,12 @@ public class TaskServiceImpl implements TaskService {
|
|||
public void deleteTask(Integer id) {
|
||||
examineTaskDao.deleteTask(id);
|
||||
examineUserService.deleteUserByTaskId(id);
|
||||
ExamineConfig examineConfig = new ExamineConfig();
|
||||
examineConfig.setExamineTaskId(id);
|
||||
List<ExamineConfig> list = examineConfigMapper.list(examineConfig);
|
||||
for (ExamineConfig config : list) {
|
||||
examineConfigMapper.deleteById(config.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -130,4 +148,15 @@ public class TaskServiceImpl implements TaskService {
|
|||
}
|
||||
return examineTasks.stream().collect(Collectors.groupingBy(ExamineTask::getTaskStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamineConfig> updateConfigTask(List<ExamineConfig> list) {
|
||||
for (ExamineConfig examineConfig : list) {
|
||||
if (examineConfig.getId() == null) {
|
||||
continue;
|
||||
}
|
||||
examineConfigMapper.update(examineConfig);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
<if test="taskStatus != null">
|
||||
AND task_status = #{taskStatus}
|
||||
</if>
|
||||
<if test="year != null">
|
||||
AND year = #{year}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
<select id="listTask" resultType="ExamineTask">
|
||||
|
|
Loading…
Reference in New Issue