jinpengyong
2021-08-03 014f0297513088601b2db6177dbf790cf47aa1bd
screen-api/src/main/java/com/moral/api/controller/WebController.java
@@ -7,11 +7,11 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@@ -136,17 +136,16 @@
     * @param request 请求信息
     * @return 返回请求成功后的对象信息
     */
    @GetMapping("getTrendChartData")
    @PostMapping("getTrendChartData")
    @ApiOperation(value = "多设备单监测因子趋势图", notes = "多设备单监测因子趋势图.")
    @ApiImplicitParams(value = {
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"),
            @ApiImplicitParam(name = "macs", value = "设备mac,多个逗号隔开", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "sensorCode", value = "因子code", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "type", value = "数据类型,日(day),月(month),年(year)", required = true, paramType = "query", dataType = "String"),
            @ApiImplicitParam(name = "times", value = "数据时间,日(2021-07-29),月(2021-07),年(2021),多个逗号隔开", required = true, paramType = "query", dataType = "String")
            @ApiImplicitParam(name = "macs", value = "设备mac,多个逗号隔开", required = true, paramType = "body", dataType = "String"),
            @ApiImplicitParam(name = "sensorCode", value = "因子code", required = true, paramType = "body", dataType = "String"),
            @ApiImplicitParam(name = "type", value = "数据类型,日(day),月(month),年(year)", required = true, paramType = "body", dataType = "String"),
            @ApiImplicitParam(name = "times", value = "数据时间,日(2021-07-29),月(2021-07),年(2021),多个逗号隔开", required = true, paramType = "body", dataType = "String")
    })
    public ResultMessage getTrendChartData(HttpServletRequest request) {
        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
    public ResultMessage getTrendChartData(@RequestBody Map<String,Object> params) {
        if (!params.containsKey("macs") || !params.containsKey("sensorCode") || !params.containsKey("type") || !params.containsKey("times")) {
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }