yangys
2024-10-30 25db770e621f1259b8d5b7fd514207f7481c2d0f
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
package com.qianwen.smartman.modules.cps.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.qianwen.smartman.common.cache.RegionCache;
import com.qianwen.core.mp.support.Query;
import com.qianwen.core.oss.model.BladeFile;
import com.qianwen.core.scanner.modular.annotation.DeleteResource;
import com.qianwen.core.scanner.modular.annotation.GetResource;
import com.qianwen.core.scanner.modular.annotation.PostResource;
import com.qianwen.core.scanner.modular.annotation.PutResource;
import com.qianwen.core.scanner.modular.stereotype.ApiResource;
import com.qianwen.core.secure.annotation.PreAuth;
import com.qianwen.core.tool.api.R;
import com.qianwen.smartman.modules.cps.entity.CheckProject;
import com.qianwen.smartman.modules.cps.service.ICheckProjectService;
import com.qianwen.smartman.modules.cps.vo.CheckProjectSubmitVO;
import com.qianwen.smartman.modules.cps.vo.CheckProjectUpdateVO;
import com.qianwen.smartman.modules.cps.vo.CheckProjectVO;
import com.qianwen.smartman.modules.cps.vo.IdsVO;
import com.qianwen.smartman.modules.resource.enums.TemplateEnum;
import com.qianwen.smartman.modules.resource.service.ISystemResourceService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
@ApiResource({"smis/check-project"})
@Api(value = "点检项目", tags = {"点检项目"})
@RestController
public class CheckProjectController {
    private final ICheckProjectService checkProjectService;
    private final ISystemResourceService systemResourceService;
 
    public CheckProjectController(final ICheckProjectService checkProjectService, final ISystemResourceService systemResourceService) {
        this.checkProjectService = checkProjectService;
        this.systemResourceService = systemResourceService;
    }
 
    @ApiOperationSupport(order = 1)
    @PostResource
    @ApiOperation("新增点检项目")
    @PreAuth
    public R<CheckProject> createCheckProject(@RequestBody CheckProjectSubmitVO vo) {
        return R.data(this.checkProjectService.createCheckProject(vo));
    }
 
    @ApiOperationSupport(order = 2)
    @GetResource({"/page"})
    @ApiOperation("分页查询点检项目")
    @PreAuth
    public R<IPage<CheckProjectVO>> pageCheckProject(@ApiParam("分页条件") Query query, @RequestParam(value = "key", required = false) @ApiParam("查询条件") String key, @RequestParam(value = "status", required = false) @ApiParam("状态:1 启用 0 停用") Integer status) {
        return R.data(this.checkProjectService.pageCheckProject(query, key, status));
    }
 
    @ApiOperationSupport(order = 3)
    @ApiOperation("删除点检项目")
    @PreAuth
    @DeleteResource
    public R<Boolean> removeCheckProject(@RequestBody IdsVO vo, @RequestParam("type") @ApiParam("删除传0 停用传1") Integer type) {
        return R.data(Boolean.valueOf(this.checkProjectService.removeCheckProject(vo.getIds(), type)));
    }
 
    @ApiOperationSupport(order = 4)
    @PutResource
    @ApiOperation("编辑点检项目")
    @PreAuth
    public R<Boolean> updateCheckProject(@RequestBody CheckProjectUpdateVO vo) {
        return R.data(Boolean.valueOf(this.checkProjectService.updateCheckProject(vo)));
    }
 
    @ApiOperationSupport(order = RegionCache.VILLAGE_LEVEL)
    @GetResource({"/excel/template"})
    @ApiOperation("导出点检项目模板")
    @PreAuth
    public R<BladeFile> exportTemplateCheckProject() {
        return R.data(this.systemResourceService.getBusinessTemplateInfo(TemplateEnum.CHECK_PROJECT));
    }
 
    @ApiOperationSupport(order = 6)
    @PostResource({"/excel/import"})
    @ApiOperation("导入点检项目")
    @PreAuth
    public R<BladeFile> importCheckProject(@RequestParam MultipartFile file) {
        return R.data(this.checkProjectService.importCheckProject(file));
    }
 
    @ApiOperationSupport(order = 7)
    @PostResource({"/excel/export"})
    @ApiOperation("导出点检项目")
    @PreAuth
    public R<BladeFile> exportCheckProject(@RequestParam(value = "key", required = false) String key, @RequestParam(value = "status", required = false) @ApiParam("状态:1 启用 0 停用") Integer status) {
        return R.data(this.checkProjectService.exportCheckProject(key, status));
    }
}