From a7bb0d7d43b8dc22c089f4658fd18103b6451376 Mon Sep 17 00:00:00 2001 From: shiji <1913712590@qq.com> Date: Wed, 19 Jul 2023 16:15:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/task/TaskList.vue | 7 ++ .../task/controller/TaskController.java | 72 ++++++++++++++++--- .../org/jeecg/modules/task/entity/Task.java | 1 + 3 files changed, 71 insertions(+), 9 deletions(-) diff --git a/ant-design-vue-jeecg/src/views/task/TaskList.vue b/ant-design-vue-jeecg/src/views/task/TaskList.vue index 3634336..044b232 100644 --- a/ant-design-vue-jeecg/src/views/task/TaskList.vue +++ b/ant-design-vue-jeecg/src/views/task/TaskList.vue @@ -47,6 +47,13 @@ + + + + + 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 2c71306..d20bd8e 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 @@ -37,11 +37,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: 任务管理 @@ -89,11 +87,12 @@ public class TaskController extends JeecgController { @ApiOperation(value = "任务管理-分页列表查询", notes = "任务管理-分页列表查询") @GetMapping(value = "/list") public Result queryPageList(Task task, - @RequestParam(name = "type",required = false) List type, + @RequestParam(name = "type", required = false) List 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 queryWrapper = new QueryWrapper<>(); Page page = new Page(pageNo, pageSize); @@ -109,6 +108,62 @@ public class TaskController extends JeecgController { 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("create_time", startTime); + queryWrapper.le("create_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("create_time", startTime); + queryWrapper.le("create_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("create_time", startTime); + queryWrapper.le("create_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); + } List sysUsers = taskService.UserIdByUserName(userName); if (sysUsers != null && sysUsers.size() > 0) @@ -127,10 +182,9 @@ public class TaskController extends JeecgController { } 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)) { + } 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){ + } else if (task != null && task.getWorkStatus() != null) { queryWrapper.eq("work_status", task.getWorkStatus()); } queryWrapper.orderByDesc("update_time"); diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java index c7f4af9..e75d257 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/task/entity/Task.java @@ -97,6 +97,7 @@ public class Task implements Serializable { */ @Excel(name = "模块id", width = 15) @ApiModelProperty(value = "模块id") + @Dict(dictTable = "modulex", dicText = "module_name",dicCode = "id") private java.lang.String moduleId; /** * 功能id