|
|
|
@ -30,6 +30,8 @@ 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; |
|
|
|
@ -37,11 +39,9 @@ import org.springframework.web.servlet.ModelAndView; |
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.text.ParseException; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.util.Arrays; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Optional; |
|
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @Description: 任务管理 |
|
|
|
@ -76,6 +76,9 @@ public class TaskController extends JeecgController<Task, ITaskService> { |
|
|
|
|
@Resource |
|
|
|
|
private IRulexService iRulexService; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private ITaskTypeService taskTypeService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页列表查询 |
|
|
|
|
* |
|
|
|
@ -89,11 +92,12 @@ public class TaskController extends JeecgController<Task, ITaskService> { |
|
|
|
|
@ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") |
|
|
|
|
@GetMapping(value = "/list") |
|
|
|
|
public Result<?> queryPageList(Task task, |
|
|
|
|
@RequestParam(name = "type",required = false) List<String> type, |
|
|
|
|
@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 = "pageSize", defaultValue = "10") Integer pageSize, |
|
|
|
|
HttpServletRequest req) { |
|
|
|
|
HttpServletRequest req) throws ParseException { |
|
|
|
|
QueryWrapper<Task> queryWrapper = new QueryWrapper<>(); |
|
|
|
|
Page<Task> page = new Page<Task>(pageNo, pageSize); |
|
|
|
|
|
|
|
|
@ -109,16 +113,79 @@ public class TaskController extends JeecgController<Task, ITaskService> { |
|
|
|
|
qw.or(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
List<SysUser> sysUsers = taskService.UserIdByUserName(userName); |
|
|
|
|
if (sysUsers != null && sysUsers.size() > 0) |
|
|
|
|
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(); |
|
|
|
|
// 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("*")) |
|
|
|
@ -127,9 +194,10 @@ public class TaskController extends JeecgController<Task, ITaskService> { |
|
|
|
|
} |
|
|
|
|
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)) { |
|
|
|
|
} 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); |
|
|
|
@ -158,6 +226,12 @@ public class TaskController extends JeecgController<Task, ITaskService> { |
|
|
|
|
e.setUpperTaskName(taskUpper.getTaskName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (StringUtils.isNotBlank(e.getTypeId())) { |
|
|
|
|
TaskType taskType = taskTypeService.getById(e.getTypeId()); |
|
|
|
|
if (ObjectUtils.isNotEmpty(taskType)) { |
|
|
|
|
e.setTypePid(taskType.getPid()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (e.getTaskFile() != null && !e.getTaskFile().equals("")) { |
|
|
|
|
e.setContentType("file"); |
|
|
|
|
} else if (e.getTaskPic() != null && !e.getTaskPic().equals("")) { |
|
|
|
|