value
2023-09-01 a0849402cbf35d956eea058ba648922e4258a631
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
100
101
102
103
104
105
106
107
108
109
package com.yuanchu.limslaboratory.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.annotation.AuthHandler;
import com.yuanchu.limslaboratory.enums.InterfaceType;
import com.yuanchu.limslaboratory.enums.MenuEnums;
import com.yuanchu.limslaboratory.pojo.vo.ReportVo;
import com.yuanchu.limslaboratory.service.ReportService;
import com.yuanchu.limslaboratory.utils.JackSonUtil;
import com.yuanchu.limslaboratory.utils.MyUtil;
import com.yuanchu.limslaboratory.utils.RedisUtil;
import com.yuanchu.limslaboratory.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;
 
 
/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-08-07
 */
@Api(tags = "检验模块-->检验报告")
@RestController
@RequestMapping("/report")
public class ReportController {
 
    @Resource
    private ReportService reportService;
 
    @ApiOperation("查询检验报告")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "page", value = "初始页", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "pageSize", value = "每一页数量", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "status", value = "状态(为空=全部)", dataTypeClass = Integer.class),
            @ApiImplicitParam(name = "name", value = "搜索信息", dataTypeClass = String.class)
    })
    @GetMapping("/selectAllReport")
    @AuthHandler
    public Result selectAllReport(Integer page, Integer pageSize, Integer status, String name) {
        IPage<ReportVo> reportPage = reportService.selectAllReport(new Page<Object>(page, pageSize), status, name);
        Map<String, Object> map = new HashMap<>();
        map.put("total", reportPage.getTotal());
        map.put("row", reportPage.getRecords());
        return Result.success(map);
    }
 
    @ApiOperation("提交")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "检验报告id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/submit")
    @AuthHandler
    public Result submit(Integer id) {
        return Result.success(reportService.submit(id));
    }
 
    @ApiOperation("审核")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "检验报告id", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "result", value = "审核结论", dataTypeClass = String.class, required = true)
    })
    @PostMapping("/check")
    @AuthHandler
    public Result check(@RequestHeader("X-Token") String token, Integer id, String result) throws Exception {
        Object object = RedisUtil.get(token);
        Map<String, Object> unmarshal = JackSonUtil.unmarshal(JackSonUtil.marshal(object), Map.class);
        MyUtil.PrintLog(unmarshal + "-------id" + id + "=========" + result);
        return Result.success(reportService.check((String) unmarshal.get("name"), id, result));
    }
 
    @ApiOperation("删除")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "id", value = "检验报告id", dataTypeClass = Integer.class, required = true)
    })
    @PostMapping("/delreport")
    @AuthHandler
    public Result delreport(Integer id) {
        return Result.success(reportService.delreport(id));
    }
 
    @ApiOperation("获取报告内的数据")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "code", value = "报告单号", dataTypeClass = String.class, required = true)
    })
    @PostMapping("/getReportContext")
    @AuthHandler
    public Result getReportContext(String code) {
        return Result.success(reportService.getReportContext(code));
    }
 
    @GetMapping("/getEnterprise")
    @ApiOperation("获取企业信息")
    @AuthHandler(type = InterfaceType.SELECT,menuId = MenuEnums.checkTheReport,isAdd = true)
    public Result getEnterprise() {
        return Result.success(reportService.getEnterprise());
    }
}