whycxzp
2022-09-28 b08e3ef5207a78ef376c5978e9ab2e08272a8175
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
package com.whyc.controller;
 
import com.whyc.dto.ActionUtil;
import com.whyc.dto.Response;
import com.whyc.pojo.FileParam;
import com.whyc.service.FileParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;
 
import java.text.ParseException;
import java.util.Date;
 
@RestController
@RequestMapping("fileParam")
@Api(tags = "数据库管理")
public class FileParamController {
    @Autowired
    private FileParamService service;
 
    @ApiOperation("查询数据中存在的电池标称电压类型")
    @GetMapping("getMonVolStd")
    public Response getMonVolStd(){
        return service.getMonVolStd();
    }
 
    @ApiOperation("按照筛选条件查询数据库信息")
    @GetMapping("getDataByCondition")
    public Response getDataByCondition(@RequestParam(required = false ,defaultValue = "1982-01-01 00:00:00") String startTime
                                       , @RequestParam(required = false,defaultValue = "2222-01-01 00:00:00") String endTime
                                       , @RequestParam(required = false) int battVol
                                       ,@RequestParam(required = false ,defaultValue = "1") int pageCurr
                                        ,@RequestParam(required = false ,defaultValue = "10") int pageSize)  {
        Date testTime1= null;
        Date testTime2= null;
        try {
            testTime1 = ActionUtil.sdfwithALL.parse(startTime);
            testTime2 = ActionUtil.sdfwithALL.parse(endTime);
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return service.getDataByCondition(testTime1,testTime2,battVol,pageCurr,pageSize);
    }
 
    @ApiOperation("分级评价-系数及阈值查询")
    @GetMapping("factorsAndThreshold")
    public Response getFactorsAndThreshold(@RequestParam String fileId){
        FileParam param =  service.getFactorsAndThreshold(fileId);
        return new Response().set(1,param);
    }
 
    @ApiOperation("分级评价-系数及阈值更新及禁用启用")
    @PutMapping("factorsAndThreshold")
    public Response updateFactorsAndThreshold(@RequestBody FileParam param){
        service.updateFactorsAndThreshold(param);
        return new Response().set(1,"更新完成");
    }
}