diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue
index c23913d..3634336 100644
--- a/ant-design-vue-jeecg/src/views/task/TaskList.vue
+++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue
@@ -21,11 +21,32 @@
style="width: 100%">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
index 8f8eb5d..c7f3431 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
@@ -30,8 +30,6 @@ import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.task.entity.Task;
import org.jeecg.modules.task.service.ITaskService;
-import org.jeecg.modules.taskType.entity.TaskType;
-import org.jeecg.modules.taskType.service.ITaskTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
@@ -91,16 +89,39 @@ public class TaskController extends JeecgController {
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询")
@GetMapping(value = "/list")
public Result> queryPageList(Task task,
+ @RequestParam(name = "userName",defaultValue = "") String userName,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
- QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap());
+ QueryWrapper queryWrapper = new QueryWrapper<>();
Page page = new Page(pageNo, pageSize);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (!StringUtils.equals(ADMIN, user.getUsername())) {
queryWrapper.like("manager_users", user.getId());
}
+ List sysUsers = taskService.UserIdByUserName(userName);
+ if(sysUsers!=null&& sysUsers.size() > 0)
+ for (int i = 0; i < sysUsers.size(); i++) {
+ queryWrapper.like("manager_users", sysUsers.get(i).getId());
+ if (i != sysUsers.size() - 1)
+ queryWrapper.or();
+ }
+ if (task != null && StringUtils.isNotBlank(task.getTypeId())) {
+ queryWrapper.eq("type_id", task.getTypeId());
+ }
+ if (task != null && StringUtils.isNotBlank(task.getTaskName())) {
+ String tas = task.getTaskName();
+ if(tas.startsWith("*")&&tas.endsWith("*"))
+ tas = tas.substring(1, tas.length() - 1);
+ queryWrapper.like("task_name", tas);
+ }
+ if (task != null && task.getWorkStatus() != null && (task.getWorkStatus() == 0 || task.getWorkStatus() == 1)) {
+ queryWrapper.in("work_status", 0, 1);
+ }
+ if (task != null && task.getWorkStatus() != null && (task.getWorkStatus() == 2 || task.getWorkStatus() == 9)) {
+ queryWrapper.in("work_status", 2, 9);
+ }
queryWrapper.orderByDesc("create_time");
IPage pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> {
@@ -157,7 +178,7 @@ public class TaskController extends JeecgController {
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询")
@GetMapping(value = "/list1")
public Result> queryPageList1(Task task,
- @RequestParam(name = "userId", defaultValue = "1") String userId,
+ @RequestParam(name = "userId") String userId,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
@@ -269,6 +290,17 @@ public class TaskController extends JeecgController {
public Result> delete(@RequestParam(name = "id", required = true) String id) {
Task task = taskService.getById(id);
Optional.ofNullable(task).orElseThrow(() -> new JeecgBootException(id + ":任务不存在"));
+ if (task.getWorkStatus() == 2 || task.getWorkStatus() == 3 || task.getWorkStatus() == 4) {
+ throw new JeecgBootException("该状态下不可删除");
+ }
+ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+ if (!StringUtils.equals(ADMIN, user.getUsername())) {
+ if (StringUtils.equals(ADMIN, task.getCreateBy())) {
+ throw new JeecgBootException("非管理员不可删除");
+ } else if (!StringUtils.equals(user.getUsername(), task.getCreateBy())) {
+ throw new JeecgBootException("不可删除他人的任务");
+ }
+ }
int count = taskService.count(new LambdaQueryWrapper().eq(Task::getUpperId, task.getId()));
if (count > 0) {
throw new JeecgBootException("存在子任务暂不可删除");
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java
index 52aae34..409e28c 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java
@@ -2,8 +2,11 @@ package org.jeecg.modules.task.service;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.task.entity.Task;
+import java.util.List;
+
/**
* @Description: 任务管理
* @Author: jeecg-boot
@@ -26,4 +29,6 @@ public interface ITaskService extends IService {
Result> fabu(String id);
String fillTaskName(String projectId, String typeId);
+
+ List UserIdByUserName(String userName);
}
diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java
index 2a63008..a37867e 100644
--- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java
+++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java
@@ -2,10 +2,13 @@ package org.jeecg.modules.task.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.service.IProjectxService;
+import org.jeecg.modules.system.entity.SysUser;
+import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.task.entity.Task;
import org.jeecg.modules.task.mapper.TaskMapper;
import org.jeecg.modules.task.service.ITaskService;
@@ -35,6 +38,9 @@ public class TaskServiceImpl extends ServiceImpl implements IT
@Resource
private ITaskTypeService iTaskTypeService;
+ @Resource
+ private ISysUserService sysUserService;
+
/**
* 责任人回显
*/
@@ -145,4 +151,16 @@ public class TaskServiceImpl extends ServiceImpl implements IT
String fillName = taskType.getTypeName() + "-" + projectx.getProjectName();
return fillName;
}
+
+ @Override
+ public List UserIdByUserName(String userName) {
+ if (userName==null)
+ return null;
+ LambdaQueryWrapper wrapper=new LambdaQueryWrapper<>();
+ if(userName.startsWith("*")&&userName.endsWith("*"))
+ userName = userName.substring(1, userName.length() - 1);
+ wrapper.eq(SysUser::getUsername,userName);
+ return sysUserService.list(wrapper);
+ }
+
}