jinpengyong
2021-08-03 477b3197e1ded6920461094a8f449d99e5c67f9d
更改请求方式
2 files modified
14 ■■■■ changed files
screen-api/src/main/java/com/moral/api/controller/WebController.java 11 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java 3 ●●●● patch | view | raw | blame | history
screen-api/src/main/java/com/moral/api/controller/WebController.java
@@ -117,14 +117,13 @@
     * @param request 请求信息
     * @return 返回请求成功后的对象信息
     */
    @GetMapping("getMacSensors")
    @PostMapping("getMacSensors")
    @ApiOperation(value = "根据多个mac获取公有因子", notes = "根据多个mac获取公有因子")
    @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 = "macs", value = "设备mac,多个逗号隔开", required = true, paramType = "query", dataType = "List")
    })
    public ResultMessage getMacSensors(HttpServletRequest request) {
        Map<String, Object> params = WebUtils.getParametersStartingWith(request, null);
    public ResultMessage getMacSensors(@RequestBody Map<String,Object> params) {
        if (!params.containsKey("macs")) {
            return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg());
        }
@@ -142,8 +141,8 @@
            @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", 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")
            @ApiImplicitParam(name = "type", value = "数据类型,日(day),月(month),年(year)", required = true, paramType = "body", dataType = "List"),
            @ApiImplicitParam(name = "times", value = "数据时间,日(2021-07-29),月(2021-07),年(2021),多个逗号隔开", required = true, paramType = "body", dataType = "List")
    })
    public ResultMessage getTrendChartData(@RequestBody Map<String,Object> params) {
        if (!params.containsKey("macs") || !params.containsKey("sensorCode") || !params.containsKey("type") || !params.containsKey("times")) {
screen-api/src/main/java/com/moral/api/service/impl/DeviceServiceImpl.java
@@ -57,7 +57,8 @@
    @Override
    public Map<String, Object> getSensorsByMac(Map<String, Object> params) {
        String[] macs = params.get("macs").toString().split(",");
        //设备mac
        List<String> macs = (List<String>) params.remove("macs");
        List<Map<String, Object>> elementLists = new ArrayList<>();
        for (String mac : macs) {