|
|
|
package com.zc.controller;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.google.gson.Gson;
|
|
|
|
import com.ruoyi.common.annotation.Log;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
|
import com.ruoyi.common.enums.BusinessType;
|
|
|
|
import com.ruoyi.common.utils.IDGenerator;
|
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
|
import com.ruoyi.common.utils.http.HttpUtils;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.zc.domain.IotBoardTemplate;
|
|
|
|
import com.zc.service.IIotBoardTemplateService;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 情报板模板Controller
|
|
|
|
*
|
|
|
|
* @author 刘方堃
|
|
|
|
* @date 2021-11-30
|
|
|
|
*/
|
|
|
|
@RestController
|
|
|
|
@RequestMapping("/system/template")
|
|
|
|
public class IotBoardTemplateController extends BaseController
|
|
|
|
{
|
|
|
|
@Autowired
|
|
|
|
private IIotBoardTemplateService iotBoardTemplateService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getAllVmsTemplate")
|
|
|
|
public AjaxResult getAllVmsTemplate(String category, String devicePixel) {
|
|
|
|
return AjaxResult.success(iotBoardTemplateService.getAllVmsTemplate(category, devicePixel));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 新增情报板模板
|
|
|
|
*/
|
|
|
|
// @PreAuthorize("@ss.hasPermi('system:templateConfig:add')")
|
|
|
|
@Log(title = "情报板模板", businessType = BusinessType.INSERT)
|
|
|
|
@PostMapping
|
|
|
|
public AjaxResult add(@RequestBody JSONObject jsonObject)
|
|
|
|
{
|
|
|
|
return AjaxResult.success(iotBoardTemplateService.insertSdVmsTemplate(jsonObject));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 修改情报板模板
|
|
|
|
*/
|
|
|
|
// @PreAuthorize("@ss.hasPermi('system:templateConfig:edit')")
|
|
|
|
@Log(title = "情报板模板", businessType = BusinessType.UPDATE)
|
|
|
|
@PutMapping
|
|
|
|
public AjaxResult edit(@RequestBody JSONObject jsonObject)
|
|
|
|
{
|
|
|
|
return toAjax(iotBoardTemplateService.updateSdVmsTemplate(jsonObject));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 删除情报板模板
|
|
|
|
*/
|
|
|
|
@PreAuthorize("@ss.hasPermi('system:templateConfig:remove')")
|
|
|
|
@Log(title = "情报板模板", businessType = BusinessType.DELETE)
|
|
|
|
@DeleteMapping("/{ids}")
|
|
|
|
public AjaxResult remove(@PathVariable Long[] ids)
|
|
|
|
{
|
|
|
|
return toAjax(iotBoardTemplateService.deleteSdVmsTemplateByIds(ids));
|
|
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/deviceControl")
|
|
|
|
public AjaxResult deviceControl(){
|
|
|
|
|
|
|
|
String deviceId = "65535";
|
|
|
|
String function = "11";
|
|
|
|
//拼接请求路径
|
|
|
|
String url = "http://10.0.81.201:8081/iot/device/functions/" + deviceId + "/" + function;
|
|
|
|
|
|
|
|
Map<String,Object> params = new HashMap<>();
|
|
|
|
|
|
|
|
params.put("1","65535");
|
|
|
|
params.put("2","play033.lst");
|
|
|
|
|
|
|
|
|
|
|
|
//请求参数
|
|
|
|
Gson gson = new Gson();
|
|
|
|
String jsonMessage = gson.toJson(params);
|
|
|
|
|
|
|
|
//发起post请求
|
|
|
|
String result = HttpUtils.sendPost(url,jsonMessage);
|
|
|
|
System.out.println(result);
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|