XiaoRuby
2023-08-21 dd571bf55de7f9a72d458adc179958ed2f9473c0
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
package com.yuanchu.limslaboratory.controller;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yuanchu.limslaboratory.pojo.Instrument;
import com.yuanchu.limslaboratory.pojo.MeteringPlan;
import com.yuanchu.limslaboratory.pojo.dto.AddPlanDto;
import com.yuanchu.limslaboratory.pojo.dto.GetPlanMeasureInstrumentDto;
import com.yuanchu.limslaboratory.pojo.dto.SelectMeasurementLedgerDto;
import com.yuanchu.limslaboratory.pojo.dto.SelectMeteringPlanDto;
import com.yuanchu.limslaboratory.service.MeteringPlanService;
import com.yuanchu.limslaboratory.service.UserService;
import com.yuanchu.limslaboratory.utils.JackSonUtil;
import com.yuanchu.limslaboratory.utils.RedisUtil;
import com.yuanchu.limslaboratory.utils.ServletUtils;
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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
import java.util.Map;
import java.util.Objects;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 江苏鵷雏网络科技有限公司
 * @since 2023-07-27
 */
@Api(tags = "实验室-->2、计量管理")
@RestController
@RequestMapping("/metering-plan")
public class MeteringPlanController {
 
    @Autowired
    private MeteringPlanService meteringPlanService;
 
    @Resource
    private UserService userService;
 
 
    @ApiOperation("添加计量计划")
    @PostMapping("/add")
    public Result<?> addMeteringPlanInformation(@RequestBody MeteringPlan meteringPlan) {
        Integer isInsertSuccess = meteringPlanService.addMeteringPlanInformation(meteringPlan);
        if (isInsertSuccess == 1){
            return Result.success("添加计量计划成功!");
        }
        return Result.fail("添加计量计划失败! ");
    }
 
    @ApiOperation("计量计划分页查询")
    @GetMapping("/plan_page_list")
    public Result<?> pagingQueryOfMeteringPlan(SelectMeteringPlanDto dto) {
        return Result.success(meteringPlanService.pagingQueryOfMeteringPlan(dto));
    }
 
    @ApiOperation("计量台账分页查询")
    @GetMapping("/standing_page_list")
    public Result<?> pagingQueryOfMeasurementLedger(SelectMeasurementLedgerDto selectMeasurementLedgerDto) {
        IPage<Map<String, Object>> page = meteringPlanService.pagingQueryOfMeasurementLedger(selectMeasurementLedgerDto);
        return Result.success(page);
    }
 
    @ApiOperation("单询计划信息")
    @GetMapping("/getPlanMeasureInstrument")
    public Result<?> getPlanMeasureInstrument(GetPlanMeasureInstrumentDto dto){
        return Result.success(meteringPlanService.getPlanMeasureInstrument(dto));
    }
 
    @ApiOperation("计划信息之下分页")
    @GetMapping("/limitGetPlanMeasureInstrument")
    public Result<?> limitGetPlanMeasureInstrument(GetPlanMeasureInstrumentDto dto){
        return Result.success(meteringPlanService.limitGetPlanMeasureInstrument(dto));
    }
 
    @ApiOperation("获取user列表和仪器列表")
    @GetMapping("/getListUserAndListIns")
    public Result<?>getListUserAndListIns(){
        return Result.success(meteringPlanService.getListUserAndListIns(userService.getUserNameAndId()));
    }
 
    @PostMapping("/addPlanAndMeasure")
    public Result<?>addPlanAndMeasure(@RequestBody AddPlanDto addPlanDto){
        return Result.success(meteringPlanService.addPlanAndMeasure(userService.getUserInfo(ServletUtils.getRequest().getHeader("X-Token")),addPlanDto));
    }
}