Merge branch 'dev_4newlayout' of http://182.92.169.222:3000/zhc077/projectManagement into dev_4newlayout

dev
deng 1 year ago
commit 0c461adacf
  1. 21
      ant-design-vue-jeecg/src/views/task/TaskList.vue
  2. 40
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
  3. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java
  4. 18
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java

@ -21,11 +21,32 @@
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="任务等级">
<!-- <j-input placeholder="" v-model="queryParam.moduleId"></j-input>-->
<j-dict-select-tag v-model="queryParam.workStatus" placeholder="请选择等级"
dict-code="task_work_status"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="任务类型">
<!-- <j-input placeholder="" v-model="queryParam.moduleId"></j-input>-->
<j-dict-select-tag v-model="queryParam.typeId" placeholder="请选择任务类型"
dict-code="task_type,type_name,id"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="任务名称">
<j-input placeholder="" v-model="queryParam.taskName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="12">
<a-form-item label="责任人">
<j-input placeholder="" v-model="queryParam.userName"></j-input>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">

@ -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<Task, ITaskService> {
@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<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap());
QueryWrapper<Task> queryWrapper = new QueryWrapper<>();
Page<Task> page = new Page<Task>(pageNo, pageSize);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (!StringUtils.equals(ADMIN, user.getUsername())) {
queryWrapper.like("manager_users", user.getId());
}
List<SysUser> 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<Task> pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> {
@ -157,7 +178,7 @@ public class TaskController extends JeecgController<Task, ITaskService> {
@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<Task, ITaskService> {
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<Task>().eq(Task::getUpperId, task.getId()));
if (count > 0) {
throw new JeecgBootException("存在子任务暂不可删除");

@ -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<Task> {
Result<?> fabu(String id);
String fillTaskName(String projectId, String typeId);
List<SysUser> UserIdByUserName(String userName);
}

@ -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<TaskMapper, Task> implements IT
@Resource
private ITaskTypeService iTaskTypeService;
@Resource
private ISysUserService sysUserService;
/**
* 责任人回显
*/
@ -145,4 +151,16 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
String fillName = taskType.getTypeName() + "-" + projectx.getProjectName();
return fillName;
}
@Override
public List<SysUser> UserIdByUserName(String userName) {
if (userName==null)
return null;
LambdaQueryWrapper<SysUser> wrapper=new LambdaQueryWrapper<>();
if(userName.startsWith("*")&&userName.endsWith("*"))
userName = userName.substring(1, userName.length() - 1);
wrapper.eq(SysUser::getUsername,userName);
return sysUserService.list(wrapper);
}
}

Loading…
Cancel
Save