4
hao
2025-04-16 c5fb1fbcbb2bf4d511773d348f9ef625855c61fc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.web.basic.controller;
 
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import com.app.base.control.WebController;
import com.app.base.data.ApiResponseResult;
import com.web.basic.entity.TodoInfo;
import com.web.basic.service.TodoInfoService;
 
/**
 * 待办事项
 * @author chen
 *
 */
@Api(description = "待办事项模块")
@RestController
@RequestMapping(value= "/todoInfo")
public class TodoInfoController extends WebController {
    @Autowired
    private TodoInfoService todoInfoService;
    
    @ApiOperation(value="新增待办事项", notes="新增待办事项")
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public ApiResponseResult add(TodoInfo todoInfo) {
        try {
            return todoInfoService.add(todoInfo);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.getMessage());
        }
    }
 
    @ApiOperation(value="编辑待办事项", notes="编辑待办事项")
    @RequestMapping(value = "/edit", method = RequestMethod.POST)
    public ApiResponseResult edit(TodoInfo todoInfo) {
        try {
            return todoInfoService.edit(todoInfo);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.getMessage());
        }
    }
 
    @ApiOperation(value="关闭待办事项", notes="关闭待办事项")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "Id", value = "ID(可传可不传)", dataType = "Long", paramType="query", defaultValue=""),
            @ApiImplicitParam(name = "bsUserId", value = "用户ID(可传可不传,传值时关联ID也必须传值)", dataType = "Long", paramType="query", defaultValue=""),
            @ApiImplicitParam(name = "roleId", value = "角色ID(可传可不传,传值时关联ID也必须传值)", dataType = "Long", paramType="query", defaultValue=""),
            @ApiImplicitParam(name = "bsReferId", value = "关联ID(可传可不传)", dataType = "Long", paramType="query", defaultValue="")
    })
    @RequestMapping(value = "/close", method = RequestMethod.POST)
    public ApiResponseResult close(Long Id, Long bsUserId, Long roleId, Long bsReferId) {
        try {
            return todoInfoService.close(Id, bsUserId, roleId, bsReferId);
        } catch (Exception e) {
            e.printStackTrace();
            return ApiResponseResult.failure(e.getMessage());
        }
    }
 
    @ApiOperation(value="删除待办事项", notes="删除待办事项")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "ID", dataType = "Long", paramType="query",defaultValue=""),
    })
    @RequestMapping(value = "/delete", method = RequestMethod.POST)
    public ApiResponseResult delete(Long id) {
        try {
            if(null!=id && id==-1) {
                return ApiResponseResult.failure("没有删除权限");
            }
            return todoInfoService.delete(id);
        } catch (Exception e) {
            return ApiResponseResult.failure(e.getMessage());
        }
    }
 
    @ApiOperation(value="获取待办事项", notes="获取待办事项")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "bsStatus", value = "待办状态(0:未完成,1:已完成,2:已取消)", dataType = "int", paramType="query",defaultValue=""),
    })
    @RequestMapping(value = "/getlist", method = RequestMethod.GET)
    public ApiResponseResult getlist(int bsStatus) {
        try {
            Sort sort = new Sort(Sort.Direction.DESC,"id");
            return todoInfoService.getlist(bsStatus, super.getPageRequest(sort));
        } catch (Exception e) {
            return ApiResponseResult.failure(e.getMessage());
        }
    }
}