Compare commits

..

No commits in common. 'dd55a401d128823585893cbbf0d56bd3f600ad06' and '5778035c74d54e84defd69f2eda17c11cf73becf' have entirely different histories.

  1. 25
      ant-design-vue-jeecg/src/views/task/TaskList.vue
  2. 193
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/controller/TaskController.java
  3. 1
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java
  4. 5
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/ITaskService.java
  5. 15
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/service/impl/TaskServiceImpl.java

@ -21,22 +21,7 @@
style="width: 100%"></j-dict-select-tag> style="width: 100%"></j-dict-select-tag>
</a-form-item> </a-form-item>
</a-col> </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="4" :sm="12"> <a-col :md="4" :sm="12">
<a-form-item label="责任人"> <a-form-item label="责任人">
<j-dict-select-tag v-model="queryParam.managerUsers" placeholder="请选责任人" <j-dict-select-tag v-model="queryParam.managerUsers" placeholder="请选责任人"
@ -50,13 +35,7 @@
<j-input placeholder="" v-model="queryParam.taskName"></j-input> <j-input placeholder="" v-model="queryParam.taskName"></j-input>
</a-form-item> </a-form-item>
</a-col> </a-col>
<a-col :md="6" :sm="12">
<a-form-item label="日期">
<j-dict-select-tag v-model="queryParam.time" placeholder="请选择日期"
dict-code="time_status"
style="width: 100%"></j-dict-select-tag>
</a-form-item>
</a-col>
<a-col :md="6" :sm="8"> <a-col :md="6" :sm="8">
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons"> <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button> <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>

@ -42,7 +42,10 @@ import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Optional;
/** /**
* @Description: 任务管理 * @Description: 任务管理
@ -98,114 +101,17 @@ public class TaskController extends JeecgController<Task, ITaskService> {
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") @ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询")
@GetMapping(value = "/list") @GetMapping(value = "/list")
public Result<?> queryPageList(Task task, public Result<?> queryPageList(Task task,
@RequestParam(name = "type", required = false) List<String> type,
@RequestParam(name = "userName", defaultValue = "") String userName,
@RequestParam(name = "time", required = false) Integer time,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) throws ParseException { HttpServletRequest req) {
QueryWrapper<Task> queryWrapper = new QueryWrapper<>(); QueryWrapper<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap());
Page<Task> page = new Page<Task>(pageNo, pageSize); Page<Task> page = new Page<Task>(pageNo, pageSize);
LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (!StringUtils.equals(ADMIN, user.getUsername())) { if (!StringUtils.equals(ADMIN, user.getUsername())) {
queryWrapper.like("manager_users", user.getId()); queryWrapper.like("manager_users", user.getId());
} }
if (type != null && type.size() > 0) queryWrapper.orderByDesc("create_time");
queryWrapper.and(qw -> {
for (int i = 0; i < type.size(); i++) {
qw.eq("type_id", type.get(i));
if (i != type.size() - 1)
qw.or();
}
});
// projectId
Calendar now = Calendar.getInstance();
int year = now.get(Calendar.YEAR);
int month = now.get(Calendar.MONTH) + 1;
int day = now.get(Calendar.DAY_OF_MONTH);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if (time != null) {
switch (time) {
case 1: {//当前天
Date startTime = sdf.parse(year + "-" + month + "-" + day + " 00:00:00");
Date endTime = sdf.parse(year + "-" + month + "-" + day + " 23:59:59");
queryWrapper.ge("start_time", startTime);
queryWrapper.le("start_time", endTime);
break;
}
case 2: {//当前周
Calendar now1 = Calendar.getInstance();
now1.set(Calendar.DAY_OF_WEEK, 2);
int year1 = now1.get(Calendar.YEAR);
int month1 = now1.get(Calendar.MONTH) + 1;
int day1 = now1.get(Calendar.DAY_OF_MONTH);
now1.set(Calendar.DATE, now1.get(Calendar.DATE) + 6);
int year2 = now1.get(Calendar.YEAR);
int month2 = now1.get(Calendar.MONTH) + 1;
int day2 = now1.get(Calendar.DAY_OF_MONTH);
Date startTime = sdf.parse(year1 + "-" + month1 + "-" + day1 + " 00:00:00");
Date endTime = sdf.parse(year2 + "-" + month2 + "-" + day2 + " 23:59:59");
queryWrapper.ge("start_time", startTime);
queryWrapper.le("start_time", endTime);
}
case 3: {//当前月
int minDay = now.getActualMinimum(Calendar.DAY_OF_MONTH);
int lastDay = now.getActualMaximum(Calendar.DAY_OF_MONTH);
Date startTime = sdf.parse(year + "-" + month + "-" + minDay + " 00:00:00");
Date endTime = sdf.parse(year + "-" + month + "-" + lastDay + " 23:59:59");
queryWrapper.ge("start_time", startTime);
queryWrapper.le("start_time", endTime);
break;
}
// case 4: {
// Date startTime = sdf.parse(year + "-" + month + "-" + day + " 00:00:00");
// Date endTime = sdf.parse(year + "-" + month + "-" + day + " 23:59:59");
// queryWrapper.ge("create_time", startTime);
// queryWrapper.le("create_time", endTime);
// break;
// }
}
}
if (task != null && StringUtils.isNotBlank(task.getModuleId())) {
String moduleId = task.getModuleId();
queryWrapper.like("module_id", moduleId);
}
if (task != null && StringUtils.isNotBlank(task.getProjectId())) {
String projectId = task.getProjectId();
queryWrapper.like("project_id", projectId);
}
if (task != null && StringUtils.isNotBlank(task.getTypeId())) {
String typeId = task.getTypeId();
queryWrapper.like("type_id", typeId);
}
if (task != null && StringUtils.isNotBlank(task.getManagerUsers())) {
String managerUsers = task.getManagerUsers();
queryWrapper.like("manager_users", managerUsers);
}
// List<SysUser> sysUsers = taskService.UserIdByUserName(userName);
// queryWrapper.and(qw -> {
// for (int i = 0; i < sysUsers.size(); i++) {
// qw.like("manager_users", sysUsers.get(i).getId());
// if (i != sysUsers.size() - 1)
// qw.or();
// }
// });
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);
} else if (task != null && task.getWorkStatus() != null && (task.getWorkStatus() == 2 || task.getWorkStatus() == 9)) {
queryWrapper.in("work_status", 2, 9);
} else if (task != null && task.getWorkStatus() != null) {
queryWrapper.eq("work_status", task.getWorkStatus());
}
queryWrapper.orderByDesc("update_time");
IPage<Task> pageList = taskService.page(page, queryWrapper); IPage<Task> pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> { pageList.getRecords().stream().forEach(e -> {
String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT)); String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT));
@ -232,89 +138,18 @@ public class TaskController extends JeecgController<Task, ITaskService> {
e.setUpperTaskName(taskUpper.getTaskName()); e.setUpperTaskName(taskUpper.getTaskName());
} }
} }
if (e.getTaskFile() != null && !e.getTaskFile().equals("")) { if (e.getTaskFile()!=null&& !e.getTaskFile().equals("")){
e.setContentType("file"); e.setContentType("file");
} else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) { }else if(e.getTaskPic()!=null&& !e.getTaskPic().equals("")){
e.setContentType("image"); e.setContentType("image");
} else { }else{
e.setContentType("text");
}
String managerUsers = e.getManagerUsers();
if (managerUsers != null && !managerUsers.equals("")) {
String[] managerUsers1 = managerUsers.split(",");
StringBuilder avatars = new StringBuilder();
for (String managerUser : managerUsers1) {
SysUser byId = iSysUserService.getById(managerUser);
if (byId != null)
avatars.append(byId.getAvatar()).append(",");
}
avatars = new StringBuilder(avatars.substring(0, avatars.length() - 1));
e.setHeadpic(avatars.toString());
}
});
return Result.OK(pageList);
}
@AutoLog(value = "任务管理-分页列表查询")
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询")
@GetMapping(value = "/list1")
public Result<?> queryPageList1(Task task,
@RequestParam(name = "userId") String userId,
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<Task> queryWrapper = QueryGenerator.initQueryWrapper(task, req.getParameterMap());
Page<Task> page = new Page<Task>(pageNo, pageSize);
queryWrapper.like("manager_users", userId);
queryWrapper.like("work_status", 3);
queryWrapper.orderByDesc("update_time");
IPage<Task> pageList = taskService.page(page, queryWrapper);
pageList.getRecords().stream().forEach(e -> {
String startDate = DateUtils.date2Str(e.getStartTime(), new SimpleDateFormat(FORMAT));
String endDate = DateUtils.date2Str(e.getExpectedEndTime(), new SimpleDateFormat(FORMAT));
String startEndTime = startDate + "-" + endDate;
e.setStartEndTime(startEndTime);
Projectx projectx = iProjectxService.getById(e.getProjectId());
e.setUnion(projectx.getProjectName());
if (StringUtils.isNotBlank(e.getModuleId())) {
Modulex modulex = iModulexService.getById(e.getModuleId());
e.setUnion(e.getUnion() + "-" + modulex.getModuleName());
}
if (StringUtils.isNotBlank(e.getFunctionId())) {
Functionx functionx = iFunctionxService.getById(e.getFunctionId());
e.setUnion(e.getUnion() + "-" + functionx.getFunctionName());
}
if (StringUtils.isNotBlank(e.getRuleId())) {
Rulex rulex = iRulexService.getById(e.getRuleId());
e.setUnion(e.getUnion() + "-" + rulex.getRuleCode());
}
if (StringUtils.isNotBlank(e.getUpperId())) {
Task taskUpper = taskService.getById(e.getUpperId());
if (ObjectUtils.isNotEmpty(taskUpper)) {
e.setUpperTaskName(taskUpper.getTaskName());
}
}
if (e.getTaskFile() != null && !e.getTaskFile().equals("")) {
e.setContentType("file");
} else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) {
e.setContentType("image");
} else {
e.setContentType("text"); e.setContentType("text");
} }
String managerUsers = e.getManagerUsers(); String managerUsers = e.getManagerUsers();
if (managerUsers != null && !managerUsers.equals("")) { if (managerUsers!=null&&!managerUsers.equals("")) {
String[] managerUsers1 = managerUsers.split(","); SysUser byId = iSysUserService.getById(managerUsers);
StringBuilder avatars = new StringBuilder(); if (byId!=null)
for (String managerUser : managerUsers1) { e.setHeadpic(byId.getAvatar());
SysUser byId = iSysUserService.getById(managerUser);
if (byId != null)
avatars.append(byId.getAvatar()).append(",");
}
avatars = new StringBuilder(avatars.substring(0, avatars.length() - 1));
e.setHeadpic(avatars.toString());
} }
}); });

@ -97,7 +97,6 @@ public class Task implements Serializable {
*/ */
@Excel(name = "模块id", width = 15) @Excel(name = "模块id", width = 15)
@ApiModelProperty(value = "模块id") @ApiModelProperty(value = "模块id")
@Dict(dictTable = "modulex", dicText = "module_name",dicCode = "id")
private java.lang.String moduleId; private java.lang.String moduleId;
/** /**
* 功能id * 功能id

@ -2,11 +2,8 @@ package org.jeecg.modules.task.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.task.entity.Task; import org.jeecg.modules.task.entity.Task;
import java.util.List;
/** /**
* @Description: 任务管理 * @Description: 任务管理
* @Author: jeecg-boot * @Author: jeecg-boot
@ -29,6 +26,4 @@ public interface ITaskService extends IService<Task> {
Result<?> fabu(String id); Result<?> fabu(String id);
String fillTaskName(String projectId, String typeId); String fillTaskName(String projectId, String typeId);
// List<SysUser> UserIdByUserName(String userName);
} }

@ -6,8 +6,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.projectx.entity.Projectx; import org.jeecg.modules.projectx.entity.Projectx;
import org.jeecg.modules.projectx.service.IProjectxService; 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.entity.Task;
import org.jeecg.modules.task.mapper.TaskMapper; import org.jeecg.modules.task.mapper.TaskMapper;
import org.jeecg.modules.task.service.ITaskService; import org.jeecg.modules.task.service.ITaskService;
@ -37,10 +35,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
@Resource @Resource
private ITaskTypeService iTaskTypeService; private ITaskTypeService iTaskTypeService;
// @Resource
// private ISysUserService sysUserService;
/** /**
* 责任人回显
* 责任人回显 * 责任人回显
*/ */
@Override @Override
@ -150,14 +145,4 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements IT
String fillName = taskType.getTypeName() + "-" + projectx.getProjectName(); String fillName = taskType.getTypeName() + "-" + projectx.getProjectName();
return fillName; 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