jinpengyong
2021-08-03 014f0297513088601b2db6177dbf790cf47aa1bd
监测因子趋势图更改请求方式为Post
2 files modified
23 ■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/WebController.java 17 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java 6 ●●●● patch | view | raw | blame | history
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());
        }
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
@@ -50,7 +50,7 @@
    @Override
    public List<Device> getDevicesByMonitorPointId(Integer monitorPointId) {
        QueryWrapper<Device> wrapper = new QueryWrapper();
        wrapper.eq("monitor_point_id",monitorPointId);
        wrapper.eq("monitor_point_id", monitorPointId);
        wrapper.eq("is_delete", Constants.NOT_DELETE);
        return deviceMapper.selectList(wrapper);
    }
@@ -86,9 +86,9 @@
    public List<Map<String, Object>> getTrendChartData(Map<String, Object> params) {
        Object type = params.get("type");
        //设备mac
        String[] macs = params.remove("macs").toString().split(",");
        List<String> macs = (List<String>) params.remove("macs");
        //所选时间
        String[] times = params.remove("times").toString().split(",");
        List<String> times = (List<String>) params.remove("times");
        //因子code
        String sensorCode = params.get("sensorCode").toString();
        String end;