|
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.pms.controller.admin;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.util.ObjUtil;
|
|
import cn.hutool.core.util.ObjUtil;
|
|
|
|
|
+import cn.hutool.json.JSONObject;
|
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
|
@@ -59,6 +60,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -115,6 +117,8 @@ public class IotDeviceController {
|
|
|
private IotDeviceMapper iotDeviceMapper;
|
|
private IotDeviceMapper iotDeviceMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IotAlarmSettingMapper iotAlarmSettingMapper;
|
|
private IotAlarmSettingMapper iotAlarmSettingMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private RestTemplate restTemplate;
|
|
|
|
|
|
|
|
@GetMapping(value = {"/company"})
|
|
@GetMapping(value = {"/company"})
|
|
|
@Operation(summary = "获取设备属于哪个公司", description = "获取设备属于哪个公司")
|
|
@Operation(summary = "获取设备属于哪个公司", description = "获取设备属于哪个公司")
|
|
@@ -811,4 +815,22 @@ public class IotDeviceController {
|
|
|
List<ImmutableMap<String, ? extends Serializable>> collect = allDevices.stream().map(e -> ImmutableMap.of("id", e.getId(), "deviceName", e.getDeviceName(), "deviceCode", e.getDeviceCode())).collect(Collectors.toList());
|
|
List<ImmutableMap<String, ? extends Serializable>> collect = allDevices.stream().map(e -> ImmutableMap.of("id", e.getId(), "deviceName", e.getDeviceName(), "deviceCode", e.getDeviceCode())).collect(Collectors.toList());
|
|
|
return success(collect);
|
|
return success(collect);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Operation(summary = "获取延凡token")
|
|
|
|
|
+ @GetMapping("/yf/token")
|
|
|
|
|
+ public CommonResult<String> getYfToken() {
|
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+// map.put("code", "12");
|
|
|
|
|
+ map.put("password", "123456");
|
|
|
|
|
+ map.put("sourceType", 1);
|
|
|
|
|
+ map.put("username", "yanfan");
|
|
|
|
|
+// map.put("uuid", "5dc9dd7f2337451f8f708131166eabab");
|
|
|
|
|
+ JSONObject entries = restTemplate.postForObject("http://121.36.34.44/prod-api/login", map, JSONObject.class);
|
|
|
|
|
+ if (Objects.nonNull(entries)) {
|
|
|
|
|
+ if (Objects.nonNull(entries.get("token"))) {
|
|
|
|
|
+ return success(String.valueOf(entries.get("token")));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return success("");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|