xdd 2 тижнів тому
батько
коміт
613c9b936e

+ 91 - 0
fs-admin/src/main/java/com/fs/his/controller/FsTodoItemsController.java

@@ -0,0 +1,91 @@
+package com.fs.his.controller;
+
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.R;
+import com.fs.todo.domain.FsTodoItems;
+import com.fs.todo.param.QueryTodoItemsParam;
+import com.fs.todo.service.FsTodoItemsService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+@Api("待办")
+@RestController
+@RequestMapping(value="/todoItems")
+public class FsTodoItemsController extends BaseController {
+
+    @Autowired
+    private FsTodoItemsService fsTodoItemsService;
+
+
+    @ApiOperation("查看待办列表")
+    @PostMapping("/listPage")
+    public R listPage(@RequestBody QueryTodoItemsParam param)
+    {
+        PageHelper.startPage(param.getPageNum(), param.getPageSize());
+        List<FsTodoItems> fsTodoItems = fsTodoItemsService.listPage(param);
+        PageInfo<FsTodoItems> listPageInfo=new PageInfo<>(fsTodoItems);
+        return R.ok().put("data",listPageInfo);
+    }
+
+    @ApiOperation("查看详情")
+    @PostMapping("/findById")
+    public R findById(@RequestBody QueryTodoItemsParam param)
+    {
+        if(ObjectUtils.isNull(param.getId())){
+            throw new IllegalArgumentException("待办事项id不能为空!");
+        }
+        FsTodoItems byId = fsTodoItemsService.getById(param.getId());
+        return R.ok().put("data",byId);
+    }
+
+    @ApiOperation("更新待办事项状态")
+    @PostMapping("/updateStatusById")
+    public R updateStatusById(@RequestBody QueryTodoItemsParam param)
+    {
+        if(ObjectUtils.isNull(param.getId())){
+            throw new IllegalArgumentException("待办事项id不能为空!");
+        }
+        fsTodoItemsService.updateStatus(param.getId(),param.getStatus());
+        return R.ok();
+    }
+    @ApiOperation("更新待办事项")
+    @PostMapping("/updateById")
+    public R updateById(@RequestBody FsTodoItems param)
+    {
+        if(ObjectUtils.isNull(param.getId())){
+            throw new IllegalArgumentException("待办事项id不能为空!");
+        }
+        fsTodoItemsService.updateById(param);
+        return R.ok();
+    }
+
+
+    @ApiOperation("删除待办事项")
+    @PostMapping("/removeById")
+    public R removeById(@RequestBody QueryTodoItemsParam param){
+        fsTodoItemsService.removeById(param.getId());
+        return R.ok();
+    }
+
+    @ApiOperation("添加待办事项")
+    @PostMapping("/add")
+    public R addTodoItems(@RequestBody FsTodoItems param){
+        param.setCreateTime(LocalDateTime.now());
+        param.setUpdateTime(LocalDateTime.now());
+        param.setCreatorId(getUserId());
+        fsTodoItemsService.save(param);
+        return R.ok();
+    }
+
+}

+ 0 - 3
fs-framework/src/main/java/com/fs/framework/config/LogInterceptor.java

@@ -1,7 +1,5 @@
 package com.fs.framework.config;
 
-
-
 import org.slf4j.MDC;
 import org.springframework.stereotype.Component;
 import org.springframework.util.StringUtils;
@@ -11,7 +9,6 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.util.UUID;
 
-
 /**
  * @description: 日志拦截器
  * @author: xdd

+ 11 - 1
fs-service/src/main/java/com/fs/todo/domain/FsTodoItems.java

@@ -3,6 +3,8 @@ package com.fs.todo.domain;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 
 /**
@@ -33,6 +35,8 @@ public class FsTodoItems {
      */
     private Integer status;
 
+    private String statusText;
+
     /**
      * 创建者ID(管理员)
      */
@@ -47,11 +51,12 @@ public class FsTodoItems {
      * 优先级:0-低,1-中,2-高
      */
     private Integer priority;
+    private String priorityText;
 
     /**
      * 截止日期
      */
-    private LocalDateTime dueDate;
+    private LocalDate dueDate;
 
     /**
      * 创建时间
@@ -72,4 +77,9 @@ public class FsTodoItems {
      * 任务分类
      */
     private Integer cateId;
+
+    /**
+     * 任务分类文本
+     */
+    private String cateText;
 }

+ 28 - 1
fs-service/src/main/java/com/fs/todo/service/impl/FsTodoItemsServiceImpl.java

@@ -1,5 +1,8 @@
 package com.fs.todo.service.impl;
 
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.fs.common.utils.DictUtils;
+import com.fs.common.utils.StringUtils;
 import com.fs.todo.domain.FsTodoItems;
 import com.fs.todo.mapper.FsTodoItemsMapper;
 import com.fs.todo.param.QueryTodoItemsParam;
@@ -37,7 +40,31 @@ public class FsTodoItemsServiceImpl implements FsTodoItemsService {
 
     @Override
     public List<FsTodoItems> listPage(QueryTodoItemsParam param) {
-        return fsTodoItemsMapper.listPage(param);
+        List<FsTodoItems> fsTodoItems = fsTodoItemsMapper.listPage(param);
+        for (FsTodoItems fsTodoItem : fsTodoItems) {
+            if(ObjectUtils.isNotNull(fsTodoItem.getStatus())){
+                String todoItemType = DictUtils.getDictLabel("todo_item_status", String.valueOf(fsTodoItem.getStatus()));
+                if(StringUtils.isNotBlank(todoItemType)) {
+                    fsTodoItem.setStatusText(todoItemType);
+                }
+            }
+
+            if(ObjectUtils.isNotNull(fsTodoItem.getPriority())) {
+                String priority = DictUtils.getDictLabel("todo_priority", String.valueOf(fsTodoItem.getPriority()));
+                if(StringUtils.isNotBlank(priority)) {
+                    fsTodoItem.setPriorityText(priority);
+                }
+            }
+
+            if(ObjectUtils.isNotNull(fsTodoItem.getCateId())) {
+                String cateText = DictUtils.getDictLabel("todo_item_type", String.valueOf(fsTodoItem.getCateId()));
+                if(StringUtils.isNotBlank(cateText)) {
+                    fsTodoItem.setCateText(cateText);
+                }
+            }
+
+        }
+        return fsTodoItems;
     }
 
     /**