zoukankan      html  css  js  c++  java
  • api controller 接口接收json字符串参数

    {"data":{"alarmRepeatTimes":2,"currentMode":1,"moduleResetTimeout":3,"otherInterval":4,"statusInterval":5},"devEuiList":["3237383162378A01","3238313953367222"]}

    @RequestMapping(value ="setting/olc",method = RequestMethod.POST)
    @ResponseBody
    public ResponseResult multipleSetting(@RequestBody String body){
    LogUtils.infoLog(getClass().getSimpleName(), "multipleSetting", logger,
    LogUtils.ActionDirection.DIRECTION_LOCAL, "multipleSetting settingDto :" , Json.toJson(body));
    JSONObject jb = Json.fromJson(body,JSONObject.class);
    String dataJson = jb.getAsString("data");
    SettingDto settingDto = Json.fromJson(dataJson,SettingDto.class);
    TbSetting tbSetting = new TbSetting();
    tbSetting.setCurrentMode(settingDto.getCurrentMode());
    tbSetting.setStatusUpdateInterval(settingDto.getStatusInterval());
    tbSetting.setOtherUpdateInterval(settingDto.getOtherInterval());
    tbSetting.setAlarmRepeatTime(settingDto.getAlarmRepeatTimes());
    tbSetting.setModuleReset(settingDto.getModuleResetTimeout());
    tbSetting.setCreateTime(new Date());
    List<String> devlist = (List<String>)jb.get("devEuiList");

    adminService.multipleSetting(tbSetting,devlist);
    ResponseResult responseResult = new ResponseResult();
    return responseResult;
    }
  • 相关阅读:
    【转】当你输入一个网址的时候,实际会发生什么?
    opencv 操作本地摄像头实现录像
    谷歌笔试题——排序,只允许0和其他元素交换
    判断素数的相关代码
    VS2010 代码自动对齐 快捷键
    谷歌的一道面试题
    各种排序算法代码汇总
    冒泡排序
    lua环境变量
    lua迭代
  • 原文地址:https://www.cnblogs.com/zhaoblog/p/9472792.html
Copyright © 2011-2022 走看看