Merge branch 'master' of https://codeup.aliyun.com/6428039c708c83a3fd907211/hzwmiot/hzwmiot24_java
This commit is contained in:
@ -156,6 +156,10 @@
|
||||
<artifactId>forest-spring-boot-starter</artifactId>
|
||||
<version>1.5.36</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.fastbee</groupId>
|
||||
<artifactId>fastbee-waterele-service</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
@ -1,155 +0,0 @@
|
||||
package com.fastbee.iot.anfang.controller;
|
||||
|
||||
import com.fastbee.common.annotation.Log;
|
||||
import com.fastbee.common.config.RuoYiConfig;
|
||||
import com.fastbee.common.core.controller.BaseController;
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.common.enums.BusinessType;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.common.utils.file.FileUploadUtils;
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.fastbee.common.utils.StringUtils.isEmpty;
|
||||
|
||||
/**
|
||||
* 设备告警上传Controller
|
||||
*
|
||||
* @author Dunxi Zang
|
||||
* @date 2024-06-19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/iot/photos")
|
||||
@Api(tags = "安防小板")
|
||||
public class UploadedPhotosController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUploadedPhotosService uploadedPhotosService;
|
||||
|
||||
/**
|
||||
* 查询设备告警上传列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
startPage();
|
||||
List<UploadedPhotos> list = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出设备告警上传列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:export')")
|
||||
@Log(title = "设备告警上传", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
List<UploadedPhotos> list = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
||||
ExcelUtil<UploadedPhotos> util = new ExcelUtil<UploadedPhotos>(UploadedPhotos.class);
|
||||
util.exportExcel(response, list, "设备告警上传数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备告警上传详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
return success(uploadedPhotosService.selectUploadedPhotosById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备告警上传
|
||||
*/
|
||||
@PostMapping
|
||||
public AjaxResult uploadPhoto(
|
||||
@RequestParam("fileToUpload") MultipartFile photo,
|
||||
@RequestParam("imei") String imei,
|
||||
@RequestParam("sn") String sn,
|
||||
@RequestParam("lat") String lat,
|
||||
@RequestParam("lng") String lng,
|
||||
@RequestParam("temp") String temp,
|
||||
@RequestParam("doorState") String doorState,
|
||||
@RequestParam("shakeState") String shakeState,
|
||||
@RequestParam("time") String time) {
|
||||
|
||||
if (photo.isEmpty()) {
|
||||
throw new ServiceException("照片为空,上传失败");
|
||||
}
|
||||
|
||||
try {
|
||||
// 上传文件路径
|
||||
String filePath = RuoYiConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, photo);
|
||||
|
||||
// 处理可能为空的字段
|
||||
Double latitude = isEmpty(lat) ? 0.0 : Double.valueOf(lat);
|
||||
Double longitude = isEmpty(lng) ? 0.0 : Double.valueOf(lng);
|
||||
Double temperature = isEmpty(temp) ? 0.0 : convertAndRoundTemperature(temp);
|
||||
if(doorState.equals("0")){
|
||||
shakeState = "1";
|
||||
}
|
||||
// 处理时间戳
|
||||
long timestamp = Long.parseLong(time + "000");
|
||||
Date date = new Date(timestamp);
|
||||
|
||||
UploadedPhotos uploadedPhotos = new UploadedPhotos(
|
||||
null, fileName, imei, sn, latitude, longitude, temperature, doorState, shakeState, date
|
||||
);
|
||||
return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos));
|
||||
} catch (IOException e) {
|
||||
throw new ServiceException("设备告警信息上传失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备告警上传
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:edit')")
|
||||
@Log(title = "设备告警上传", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return toAjax(uploadedPhotosService.updateUploadedPhotos(uploadedPhotos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备告警上传
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('iot:photos:remove')")
|
||||
@Log(title = "设备告警上传", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(uploadedPhotosService.deleteUploadedPhotosByIds(ids));
|
||||
}
|
||||
public static Double convertAndRoundTemperature(String tempStr) {
|
||||
// 将字符串转换为double
|
||||
double temp = Double.parseDouble(tempStr);
|
||||
|
||||
// 使用BigDecimal进行四舍五入,保留两位小数
|
||||
BigDecimal bd = BigDecimal.valueOf(temp);
|
||||
bd = bd.setScale(2, RoundingMode.HALF_UP);
|
||||
|
||||
// 返回转换后的double值
|
||||
return bd.doubleValue();
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
package com.fastbee.iot.anfang.service;
|
||||
|
||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储上传的照片信息Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-06-20
|
||||
*/
|
||||
public interface IUploadedPhotosService
|
||||
{
|
||||
/**
|
||||
* 查询存储上传的照片信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 存储上传的照片信息
|
||||
*/
|
||||
public UploadedPhotos selectUploadedPhotosById(Long id);
|
||||
|
||||
/**
|
||||
* 查询存储上传的照片信息列表
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 存储上传的照片信息集合
|
||||
*/
|
||||
public List<UploadedPhotos> selectUploadedPhotosList(UploadedPhotos uploadedPhotos);
|
||||
|
||||
/**
|
||||
* 新增存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertUploadedPhotos(UploadedPhotos uploadedPhotos);
|
||||
|
||||
/**
|
||||
* 修改存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateUploadedPhotos(UploadedPhotos uploadedPhotos);
|
||||
|
||||
/**
|
||||
* 批量删除存储上传的照片信息
|
||||
*
|
||||
* @param ids 需要删除的存储上传的照片信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUploadedPhotosByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除存储上传的照片信息信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteUploadedPhotosById(Long id);
|
||||
}
|
@ -1,95 +0,0 @@
|
||||
package com.fastbee.iot.anfang.service.impl;
|
||||
|
||||
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
||||
import com.fastbee.iot.mapper.UploadedPhotosMapper;
|
||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 存储上传的照片信息Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-06-20
|
||||
*/
|
||||
@Service
|
||||
public class UploadedPhotosServiceImpl implements IUploadedPhotosService
|
||||
{
|
||||
@Resource
|
||||
private UploadedPhotosMapper uploadedPhotosMapper;
|
||||
|
||||
/**
|
||||
* 查询存储上传的照片信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 存储上传的照片信息
|
||||
*/
|
||||
@Override
|
||||
public UploadedPhotos selectUploadedPhotosById(Long id)
|
||||
{
|
||||
return uploadedPhotosMapper.selectUploadedPhotosById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询存储上传的照片信息列表
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 存储上传的照片信息
|
||||
*/
|
||||
@Override
|
||||
public List<UploadedPhotos> selectUploadedPhotosList(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return uploadedPhotosMapper.selectUploadedPhotosList(uploadedPhotos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertUploadedPhotos(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return uploadedPhotosMapper.insertUploadedPhotos(uploadedPhotos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改存储上传的照片信息
|
||||
*
|
||||
* @param uploadedPhotos 存储上传的照片信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateUploadedPhotos(UploadedPhotos uploadedPhotos)
|
||||
{
|
||||
return uploadedPhotosMapper.updateUploadedPhotos(uploadedPhotos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除存储上传的照片信息
|
||||
*
|
||||
* @param ids 需要删除的存储上传的照片信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUploadedPhotosByIds(Long[] ids)
|
||||
{
|
||||
return uploadedPhotosMapper.deleteUploadedPhotosByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除存储上传的照片信息信息
|
||||
*
|
||||
* @param id 存储上传的照片信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteUploadedPhotosById(Long id)
|
||||
{
|
||||
return uploadedPhotosMapper.deleteUploadedPhotosById(id);
|
||||
}
|
||||
}
|
@ -178,6 +178,12 @@ public class Device extends BaseEntity
|
||||
|
||||
@ApiModelProperty("设备参数")
|
||||
private String devParams;
|
||||
@ApiModelProperty("管护人")
|
||||
private String caretaker;
|
||||
@ApiModelProperty("管护单位")
|
||||
private String managementUnit;
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
/**
|
||||
* 关联组态,来源产品
|
||||
|
@ -0,0 +1,50 @@
|
||||
package com.fastbee.iot.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 设备参数设置对象 device_param_config
|
||||
*
|
||||
* @author mafa
|
||||
* @date 2023-08-22
|
||||
*/
|
||||
@Data
|
||||
public class JiankongDeviceParam
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/** 设备id */
|
||||
private Long deviceId;
|
||||
/** ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 */
|
||||
private String startTime;
|
||||
/** ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 */
|
||||
private String stopTime;
|
||||
/** ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1 */
|
||||
private String type;
|
||||
/** ezopen协议地址的设备的视频加密密码 */
|
||||
private String code;
|
||||
/** 流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1 */
|
||||
private String protocol;
|
||||
|
||||
/** 视频清晰度,1-高清(主码流)、2-流畅(子码流) */
|
||||
private String quality;
|
||||
|
||||
/** 云台操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 */
|
||||
private String direction;
|
||||
/** 云台操作命令:速度 */
|
||||
private String speed;
|
||||
|
||||
/** 云台操作命令:传了一直动 不传移动一格 */
|
||||
private String notStop;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.fastbee.iot.haikang;
|
||||
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 点点控api界面
|
||||
*/
|
||||
public class HaikangYingshiApi {
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getToken(Map<String, Object> params) {
|
||||
String url = UrlConstant.getToken;//指定URL
|
||||
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
// System.out.println("jsonObject = " + jsonObject);
|
||||
// Map<String,Object> data =null;
|
||||
// if (jsonObject.get("code").equals("200")) {
|
||||
// data= (Map<String,Object>) jsonObject.get("data");
|
||||
// }
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 直播源,例如427734222,均采用英文符号,限制50个 Y
|
||||
* channelNo Integer 通道号,,非必选,默认为1 N
|
||||
* code String ezopen协议地址的设备的视频加密密码 N
|
||||
* expireTime Integer 过期时长,单位秒;针对hls/rtmp设置有效期,相对时间;30秒-720天 N
|
||||
* protocol Integer 流播放协议,1-ezopen、2-hls、3-rtmp、4-flv,默认为1 N
|
||||
* quality Integer 视频清晰度,1-高清(主码流)、2-流畅(子码流) N
|
||||
* startTime String ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 N
|
||||
* stopTime String ezopen协议地址的本地录像/云存储录像回放开始时间,示例:2019-12-01 00:00:00 N
|
||||
* type String ezopen协议地址的类型,1-预览,2-本地录像回放,3-云存储录像回放,非必选,默认为1 N
|
||||
* supportH265 Integer 是否要求播放视频为H265编码格式,1表示需要,0表示不要求 N
|
||||
* gbchannel String 国标设备的通道编号,视频通道编号ID N
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getAddress(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.address;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
// System.out.println("result = " + result);
|
||||
// Map<String,Object> data =(Map<String,Object>) jsonObject.get("data");
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||
* channelNo int 通道号 Y
|
||||
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||
* speed int 云台速度:0-慢,1-适中,2-快,海康设备参数不可为0
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject startMove(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.startyuntai;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||
* channelNo int 通道号 Y
|
||||
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject stopMove(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.stopyuntai;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 设备序列号,存在英文字母的设备序列号,字母需为大写 Y
|
||||
* channelNo int 通道号 Y
|
||||
* direction int 操作命令:0-上,1-下,2-左,3-右,4-左上,5-左下,6-右上,7-右下,8-放大,9-缩小,10-近焦距,11-远焦距 Y
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject getDeviceInfo(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.deviceInfo;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params accessToken String 授权过程获取的access_token Y
|
||||
* deviceSerial String 直播源,例如427734222,均采用英文符号,限制50个 Y
|
||||
* channelNo Integer 通道号,,非必选,默认为1 N
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject capture(Map<String, Object> params) {
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
String url = UrlConstant.capture;//指定URL
|
||||
HashMap<String, String> headers = new HashMap<>();//存放请求头,可以存放多个请求头
|
||||
headers.put("Content-Type", "application/x-www-form-urlencoded");
|
||||
String result = HttpUtil.createPost(url).addHeaders(headers).form(params).execute().body();
|
||||
JSONObject jsonObject = new JSONObject(result);
|
||||
// System.out.println("result = " + result);
|
||||
// Map<String,Object> data =(Map<String,Object>) jsonObject.get("data");
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.fastbee.iot.haikang;
|
||||
|
||||
/**
|
||||
* 点点控
|
||||
*/
|
||||
public class UrlConstant {
|
||||
|
||||
public static String appKey = "be85054cf4504710861fad77ec4e4af9";
|
||||
public static String appSecret = "104f39e29f9847e5d819a99c1c32fc88";
|
||||
|
||||
//获取 token
|
||||
public static String getToken = "https://open.ys7.com/api/lapp/token/get";
|
||||
//获取 直播地址
|
||||
public static String address = "https://open.ys7.com/api/lapp/v2/live/address/get";
|
||||
//开始云台
|
||||
public static String startyuntai = "https://open.ys7.com/api/lapp/device/ptz/start";
|
||||
//停止云台
|
||||
public static String stopyuntai = "https://open.ys7.com/api/lapp/device/ptz/stop";
|
||||
//设备信息
|
||||
public static String deviceInfo = "https://open.ys7.com/api/lapp/device/info";
|
||||
//设备抓拍图片
|
||||
public static String capture = "https://open.ys7.com/api/lapp/device/capture";
|
||||
//关闭设备视频加密
|
||||
public static String deviceEncryptOff = "https://open.ys7.com/api/lapp/device/encrypt/off";
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.fastbee.iot.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
@ -66,6 +67,12 @@ public class DeviceAllShortOutput
|
||||
private Integer isOwner;
|
||||
|
||||
private Integer subDeviceCount;
|
||||
@ApiModelProperty("管护人")
|
||||
private String caretaker;
|
||||
@ApiModelProperty("管护单位")
|
||||
private String managementUnit;
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
public Integer getSubDeviceCount() {
|
||||
return subDeviceCount;
|
||||
|
@ -94,6 +94,13 @@ public class DeviceShortOutput
|
||||
@Excel(name = "网关设备编号(子设备使用)")
|
||||
private String gwDevCode;
|
||||
|
||||
@ApiModelProperty("管护人")
|
||||
private String caretaker;
|
||||
@ApiModelProperty("管护单位")
|
||||
private String managementUnit;
|
||||
@ApiModelProperty("联系电话")
|
||||
private String tel;
|
||||
|
||||
/** 是否自定义位置 **/
|
||||
private Integer locationWay;
|
||||
|
||||
|
@ -28,7 +28,9 @@ public class UploadedPhotos extends BaseEntity
|
||||
/** 照片存储路径 */
|
||||
@Excel(name = "照片存储路径")
|
||||
private String photoPath;
|
||||
|
||||
/** 监控抓拍 */
|
||||
@Excel(name = "监控抓拍")
|
||||
private String monitorPath;
|
||||
/** 设备IMEI号 */
|
||||
@Excel(name = "设备IMEI号")
|
||||
private String imei;
|
||||
|
@ -6,6 +6,7 @@ import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
|
||||
import com.fastbee.common.enums.DeviceStatus;
|
||||
import com.fastbee.iot.domain.Device;
|
||||
import com.fastbee.iot.domain.DeviceGroup;
|
||||
import com.fastbee.iot.domain.JiankongDeviceParam;
|
||||
import com.fastbee.iot.model.*;
|
||||
import com.fastbee.iot.model.ThingsModels.ThingsModelShadow;
|
||||
import com.fastbee.iot.model.ThingsModels.ThingsModelValueItem;
|
||||
@ -334,5 +335,5 @@ public interface IDeviceService
|
||||
|
||||
|
||||
ArrayList<Object> getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime);
|
||||
|
||||
Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam);
|
||||
}
|
||||
|
@ -10,21 +10,20 @@ import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.common.core.domain.entity.SysDept;
|
||||
import com.fastbee.common.core.domain.entity.SysUser;
|
||||
import com.fastbee.common.core.domain.model.LoginUser;
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.common.core.redis.RedisCache;
|
||||
import com.fastbee.common.core.redis.RedisKeyBuilder;
|
||||
import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
|
||||
import com.fastbee.common.core.thingsModel.ThingsModelValuesInput;
|
||||
import com.fastbee.common.enums.*;
|
||||
import com.fastbee.common.exception.ServiceException;
|
||||
import com.fastbee.common.utils.CaculateUtils;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.common.utils.SecurityUtils;
|
||||
import com.fastbee.common.utils.StringUtils;
|
||||
import com.fastbee.common.utils.*;
|
||||
import com.fastbee.common.utils.http.HttpUtils;
|
||||
import com.fastbee.common.utils.ip.IpUtils;
|
||||
import com.fastbee.common.utils.json.JsonUtils;
|
||||
import com.fastbee.iot.cache.ITSLCache;
|
||||
import com.fastbee.iot.domain.*;
|
||||
import com.fastbee.iot.haikang.HaikangYingshiApi;
|
||||
import com.fastbee.iot.mapper.*;
|
||||
import com.fastbee.iot.model.*;
|
||||
import com.fastbee.iot.model.ThingsModelItem.Datatype;
|
||||
@ -39,6 +38,8 @@ import com.fastbee.iot.cache.ITSLValueCache;
|
||||
import com.fastbee.iot.tdengine.service.ILogService;
|
||||
import com.fastbee.system.mapper.SysDeptMapper;
|
||||
import com.fastbee.system.service.ISysUserService;
|
||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||
import com.fastbee.waterele.service.IMaWatereleRecordService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@ -123,7 +124,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
private SubGatewayMapper subGatewayMapper;
|
||||
@Resource
|
||||
private IOrderControlService orderControlService;
|
||||
|
||||
@Resource
|
||||
private IMaWatereleRecordService watereleRecordService;
|
||||
|
||||
/**
|
||||
* 查询设备
|
||||
@ -135,6 +137,9 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Override
|
||||
public Device selectDeviceByDeviceId(Long deviceId) {
|
||||
Device device = deviceMapper.selectDeviceByDeviceId(deviceId);
|
||||
if (device == null) {
|
||||
return null;
|
||||
}
|
||||
List<ValueItem> list = itslValueCache.getCacheDeviceStatus(device.getProductId(), device.getSerialNumber());
|
||||
if (list != null && list.size() > 0) {
|
||||
// redis中获取设备状态(物模型值)
|
||||
@ -1600,13 +1605,24 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
@Override
|
||||
public List<Map<String, Object>> devicePointInfo(Device devices) {
|
||||
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
|
||||
devices.setProductId(136L);
|
||||
List<Device> deviceList = selectDeviceList(devices);
|
||||
|
||||
for (Device device : deviceList) {
|
||||
// MaWatereleRecord maWatereleRecord = new MaWatereleRecord();
|
||||
// maWatereleRecord.setDevSn(device.getSerialNumber());
|
||||
// TableDataInfo tableDataInfo = watereleRecordService.selectMaWatereleRecordList(maWatereleRecord);
|
||||
// List<MaWatereleRecord> list = (List<MaWatereleRecord>) tableDataInfo.getRows();
|
||||
// int status = 4;
|
||||
// if(list.size() > 0){
|
||||
// MaWatereleRecord record = list.get(0);
|
||||
// if(new Date().getTime() - record.getCreateTime().getTime() < 3600000){
|
||||
// status = 3;
|
||||
// }
|
||||
// }
|
||||
// device.setStatus(status);
|
||||
HashMap<String, Object> itemMap = new HashMap<>();
|
||||
resultList.add(itemMap);
|
||||
Integer integer = 0;
|
||||
|
||||
itemMap.put("device",device);
|
||||
if (device.getStatus() != null) {
|
||||
if (device.getStatus().equals(4)) {
|
||||
@ -1614,7 +1630,6 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
}
|
||||
itemMap.put("online",integer);
|
||||
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
@ -1636,12 +1651,17 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
kvHashMap.put("beginTime", beginTime);
|
||||
kvHashMap.put("endTime", endTime);
|
||||
List<ThingsModel> thingsModels = thingsModelService.selectThingsModelList(new ThingsModel(device.getProductId()));
|
||||
thingsModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||
List<DeviceLog> deviceLogs= logService.selectDataList(kvHashMap);
|
||||
Map<String, List<DeviceLog>> collect = deviceLogs != null ? deviceLogs.stream().collect(Collectors.groupingBy(t -> t.getIdentity())): new HashMap();
|
||||
for (ThingsModel modelDevice : thingsModels) {
|
||||
if(modelDevice.getIsChart().equals(0)){
|
||||
continue;
|
||||
}
|
||||
HashMap<String, Object> dataListMap = new HashMap<>();
|
||||
|
||||
List<DeviceLog> deviceLogs1 = collect.get(modelDevice.getIdentifier());
|
||||
deviceLogs1.sort(Comparator.comparing(DeviceLog::getCreateTime));
|
||||
dataListMap.put("name", modelDevice.getModelName());
|
||||
if (StringUtils.isNotEmpty(modelDevice.getSpecs())) {
|
||||
cn.hutool.json.JSONObject object = new cn.hutool.json.JSONObject(modelDevice.getSpecs());
|
||||
@ -1651,7 +1671,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
if (deviceLogs1 != null) {
|
||||
System.out.println(deviceLogs1);
|
||||
dataListMap.put("time",deviceLogs1.stream().map(t->t.getCreateTime()).collect(Collectors.toList()));
|
||||
dataListMap.put("time",deviceLogs1.stream().map(t->DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,t.getCreateTime())).collect(Collectors.toList()));
|
||||
dataListMap.put("data",deviceLogs1.stream().map(t->t.getLogValue()).collect(Collectors.toList()));
|
||||
}else{
|
||||
dataListMap.put("time",new ArrayList<>());
|
||||
@ -1663,4 +1683,76 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam) {
|
||||
if (jiankongDeviceParam.getDeviceId() == null) {
|
||||
throw new RuntimeException("请上传设备id");
|
||||
}
|
||||
Device device = selectDeviceByDeviceId(jiankongDeviceParam.getDeviceId());
|
||||
|
||||
if (device == null) {
|
||||
throw new RuntimeException("设备未找到");
|
||||
}
|
||||
Map devData = DevParamsUtils.getDevParams(device.getDevParams());
|
||||
if (devData.get("appKey") == null) {
|
||||
throw new RuntimeException("未绑定设备参数appKey");
|
||||
}
|
||||
if (devData.get("appSecret") == null) {
|
||||
throw new RuntimeException("未绑定设备参数appSecret");
|
||||
}
|
||||
if (devData.get("channelNo") == null) {
|
||||
throw new RuntimeException("未绑定设备参数channelNo");
|
||||
}
|
||||
Map<String, Object> map = new HashMap<>();//存放参数
|
||||
map.put("appKey", devData.get("appKey"));
|
||||
map.put("appSecret", devData.get("appSecret"));
|
||||
cn.hutool.json.JSONObject token = HaikangYingshiApi.getToken(map);
|
||||
if (token != null && token.get("code").equals("200")) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
// accessToken=at.dunwhxt2azk02hcn7phqygsybbw0wv6p&deviceSerial=C78957921&channelNo=1
|
||||
token = (cn.hutool.json.JSONObject) token.get("data");
|
||||
params.put("accessToken", token.get("accessToken"));
|
||||
params.put("deviceSerial", device.getSerialNumber());
|
||||
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getStartTime())) {
|
||||
params.put("startTime", jiankongDeviceParam.getStartTime());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getStopTime())) {
|
||||
params.put("stopTime", jiankongDeviceParam.getStopTime());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getType())) {
|
||||
params.put("type", jiankongDeviceParam.getType());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getCode())) {
|
||||
params.put("code", jiankongDeviceParam.getCode());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getProtocol())) {
|
||||
params.put("protocol", jiankongDeviceParam.getProtocol());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(jiankongDeviceParam.getQuality())) {
|
||||
params.put("quality", jiankongDeviceParam.getQuality());
|
||||
}
|
||||
|
||||
cn.hutool.json.JSONObject response = HaikangYingshiApi.getAddress(params);
|
||||
if (response != null && response.get("code").equals("200")) {
|
||||
Map data = (cn.hutool.json.JSONObject) response.get("data");
|
||||
Map<String, Object> reMap = new HashMap<>();
|
||||
reMap.put("url", data.get("url"));
|
||||
reMap.put("devName", device.getDeviceName());
|
||||
reMap.put("accessToken", token.get("accessToken"));
|
||||
reMap.put("id", device.getDeviceId());
|
||||
reMap.put("status", device.getStatus() == null || device.getStatus() == 4 ? "离线" : "在线");
|
||||
return reMap;
|
||||
} else {
|
||||
throw new RuntimeException(response.get("msg").toString());
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ public class ThingsModelServiceImpl implements IThingsModelService {
|
||||
*/
|
||||
@Override
|
||||
public ThingsModel selectSingleThingsModel(ThingsModel model) {
|
||||
model.setLanguage(SecurityUtils.getLanguage());
|
||||
// model.setLanguage(SecurityUtils.getLanguage());
|
||||
return thingsModelMapper.selectSingleThingsModel(model);
|
||||
}
|
||||
|
||||
|
@ -151,32 +151,36 @@ public class MySqlLogServiceImpl implements ILogService {
|
||||
|
||||
@Override
|
||||
public List<DeviceLog> selectDataList(HashMap<String, Object> kvHashMap) {
|
||||
if (kvHashMap.get("endTime") != null) {
|
||||
DateTime endTime = DateUtil.parse(kvHashMap.get("endTime").toString());
|
||||
String yyyyMM = endTime.toString("yyyyMM");
|
||||
String yyyyMM2 = DateUtil.offsetMonth(endTime, -1).toString("yyyyMM");
|
||||
if (tableMapper.getTableByName(tableName + yyyyMM) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + yyyyMM);
|
||||
}
|
||||
if (tableMapper.getTableByName(tableName + yyyyMM2) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + yyyyMM2);
|
||||
}
|
||||
kvHashMap.put("tableName", tableName + yyyyMM);
|
||||
kvHashMap.put("tableName2", tableName + yyyyMM2);
|
||||
}
|
||||
if (kvHashMap.get("tableName") == null) {
|
||||
Date date = new Date();
|
||||
String ym = DateUtils.parseDateToStr(DateUtils.YYYYMM, date);
|
||||
String ym2 = DateUtils.parseDateToStr(DateUtils.YYYYMM, DateUtil.offsetMonth(new Date(), -1));
|
||||
if (tableMapper.getTableByName(tableName + ym) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + ym);
|
||||
}
|
||||
if (tableMapper.getTableByName(tableName + ym2) == null) {
|
||||
deviceLogMapper.createTableByDate(tableName + ym2);
|
||||
}
|
||||
kvHashMap.put("tableName", tableName + ym);
|
||||
kvHashMap.put("tableName2", tableName + ym2);
|
||||
}
|
||||
return deviceLogMapper.selectDataList(kvHashMap);
|
||||
DeviceLog deviceLog = new DeviceLog();
|
||||
deviceLog.setBeginTime(kvHashMap.get("beginTime").toString());
|
||||
deviceLog.setEndTime(kvHashMap.get("endTime").toString());
|
||||
deviceLog.setSerialNumber((kvHashMap.get("serialNumber").toString()));
|
||||
// if (kvHashMap.get("endTime") != null) {
|
||||
// DateTime endTime = DateUtil.parse(kvHashMap.get("endTime").toString());
|
||||
// String yyyyMM = endTime.toString("yyyyMM");
|
||||
// String yyyyMM2 = DateUtil.offsetMonth(endTime, -1).toString("yyyyMM");
|
||||
// if (tableMapper.getTableByName(tableName + yyyyMM) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + yyyyMM);
|
||||
// }
|
||||
// if (tableMapper.getTableByName(tableName + yyyyMM2) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + yyyyMM2);
|
||||
// }
|
||||
// kvHashMap.put("tableName", tableName + yyyyMM);
|
||||
// kvHashMap.put("tableName2", tableName + yyyyMM2);
|
||||
// }
|
||||
// if (kvHashMap.get("tableName") == null) {
|
||||
// Date date = new Date();
|
||||
// String ym = DateUtils.parseDateToStr(DateUtils.YYYYMM, date);
|
||||
// String ym2 = DateUtils.parseDateToStr(DateUtils.YYYYMM, DateUtil.offsetMonth(new Date(), -1));
|
||||
// if (tableMapper.getTableByName(tableName + ym) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + ym);
|
||||
// }
|
||||
// if (tableMapper.getTableByName(tableName + ym2) == null) {
|
||||
// deviceLogMapper.createTableByDate(tableName + ym2);
|
||||
// }
|
||||
// kvHashMap.put("tableName", tableName + ym);
|
||||
// kvHashMap.put("tableName2", tableName + ym2);
|
||||
// }
|
||||
return deviceLogMapper.selectDeviceLogList(deviceLog);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.fastbee.iot.timer;//package com.fastbee.farming;
|
||||
|
||||
import com.fastbee.common.core.page.TableDataInfo;
|
||||
import com.fastbee.common.core.redis.RedisCache;
|
||||
import com.fastbee.common.core.redis.RedisKeyBuilder;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
@ -17,6 +18,8 @@ import com.fastbee.iot.model.haiwei.HaiWeiPropertyVo;
|
||||
import com.fastbee.iot.service.IDeviceService;
|
||||
import com.fastbee.iot.tdengine.service.ILogService;
|
||||
import com.fastbee.iot.tdengine.service.model.TdLogDto;
|
||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||
import com.fastbee.waterele.service.IMaWatereleRecordService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -43,7 +46,8 @@ public class QxtrTask {
|
||||
private ILogService iLogService;
|
||||
@Resource
|
||||
RedisCache redisCache;
|
||||
|
||||
@Resource
|
||||
private IMaWatereleRecordService watereleRecordService;
|
||||
private static Pattern pattern = Pattern.compile("[-+]?[0-9]+(\\.[0-9]+)?$");
|
||||
|
||||
/**
|
||||
@ -57,6 +61,33 @@ public class QxtrTask {
|
||||
getDeviceInfo(Long.valueOf(SOLAR_DEVICE.getType()), devices);
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务 更新设备在线状态
|
||||
*/
|
||||
public void updateDeviceStatus() throws Exception {
|
||||
log.info("定时任务,更新设备在线状态");
|
||||
Device device = new Device();
|
||||
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
|
||||
device.setProductId(136L);
|
||||
List<Device> deviceList = iDeviceService.selectDeviceList(device);
|
||||
for (Device item : deviceList) {
|
||||
MaWatereleRecord maWatereleRecord = new MaWatereleRecord();
|
||||
maWatereleRecord.setDevSn(item.getSerialNumber());
|
||||
List<MaWatereleRecord> list = watereleRecordService.getList(maWatereleRecord);
|
||||
int status = 4;
|
||||
if(list.size() > 0){
|
||||
MaWatereleRecord record = list.get(0);
|
||||
if(new Date().getTime() - record.getCreateTime().getTime() < 3600000){
|
||||
status = 3;
|
||||
}
|
||||
}
|
||||
item.setStatus(status);
|
||||
iDeviceService.updateDevice(item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 定时任务 流量计设备
|
||||
*/
|
||||
|
@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="transport" column="transport" />
|
||||
<result property="guid" column="guid" />
|
||||
<result property="devParams" column="dev_params" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="caretaker" column="caretaker" />
|
||||
<result property="managementUnit" column="management_unit" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
||||
@ -65,6 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="transport" column="transport" />
|
||||
<result property="guid" column="guid" />
|
||||
<result property="devParams" column="dev_params" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="caretaker" column="caretaker" />
|
||||
<result property="managementUnit" column="management_unit" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.fastbee.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
||||
@ -86,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="isOwner" column="is_owner" />
|
||||
<result property="subDeviceCount" column="sub_device_count"/>
|
||||
<result property="devParams" column="dev_params" />
|
||||
<result property="tel" column="tel" />
|
||||
<result property="caretaker" column="caretaker" />
|
||||
<result property="managementUnit" column="management_unit" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.fastbee.iot.model.UserAndTenant" id="UserAndTenantResult">
|
||||
@ -203,7 +212,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectUnAuthDeviceList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
||||
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,
|
||||
d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
||||
from iot_device d
|
||||
left join iot_product_authorize a on a.device_id=d.device_id
|
||||
<where>
|
||||
@ -230,7 +241,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceListByGroup" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.dev_params, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
select d.device_id, d.device_name, d.dev_params, d.product_name,
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
from iot_device d
|
||||
<where>
|
||||
@ -257,7 +270,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="selectAllDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceAllShortResult">
|
||||
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type,
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||
from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
@ -307,7 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, d.dev_params, p.product_id, p.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,d.management_unit, d.caretaker, d.tel,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||
case
|
||||
@ -352,7 +367,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
||||
select d.device_id, d.device_name, d.dev_params, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
||||
d.serial_number, d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
||||
d.serial_number, d.management_unit, d.caretaker, d.tel,
|
||||
d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
||||
d.network_address, d.network_ip, d.longitude, d.latitude, d.active_time, d.create_time, d.update_time,
|
||||
d.img_url,d.summary,d.remark,p.guid from iot_device d
|
||||
left join iot_product p on p.product_id=d.product_id
|
||||
@ -518,6 +534,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isSimulate != null">is_simulate,</if>
|
||||
<if test="slaveId != null">slave_id,</if>
|
||||
<if test="devParams != null">dev_params,</if>
|
||||
<if test="managementUnit != null">management_unit,</if>
|
||||
<if test="caretaker != null">caretaker,</if>
|
||||
<if test="tel != null">tel,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
@ -549,11 +568,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="isSimulate != null">#{isSimulate},</if>
|
||||
<if test="slaveId != null">#{slaveId},</if>
|
||||
<if test="devParams != null">#{devParams},</if>
|
||||
<if test="managementUnit != null">#{managementUnit},</if>
|
||||
<if test="caretaker != null">#{caretaker},</if>
|
||||
<if test="tel != null">#{tel},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatchDevice" parameterType="com.fastbee.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number,
|
||||
firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
||||
values
|
||||
<foreach collection="deviceList" item="device" separator=",">
|
||||
(#{device.deviceName},
|
||||
@ -604,6 +627,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="summary != null">summary = #{summary},</if>
|
||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||
<if test="devParams != null">dev_params = #{devParams},</if>
|
||||
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
|
||||
<if test="caretaker != null">caretaker = #{caretaker},</if>
|
||||
<if test="tel != null">tel = #{tel},</if>
|
||||
</trim>
|
||||
where device_id = #{deviceId}
|
||||
</update>
|
||||
@ -665,6 +691,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="summary != null">summary = #{summary},</if>
|
||||
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
||||
<if test="devParams != null">dev_params = #{devParams},</if>
|
||||
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
|
||||
<if test="caretaker != null">caretaker = #{caretaker},</if>
|
||||
<if test="tel != null">tel = #{tel},</if>
|
||||
</trim>
|
||||
where serial_number = #{serialNumber}
|
||||
</update>
|
||||
@ -812,6 +841,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="listTerminalUser" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
||||
select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,
|
||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||
d.management_unit, d.caretaker, d.tel,
|
||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||
d.things_model_value, d.active_time,d.create_time,d.img_url,d.dev_params,
|
||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||
@ -879,7 +909,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</select>
|
||||
|
||||
<select id="listTerminalUserByGroup" resultType="com.fastbee.iot.domain.Device">
|
||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code,
|
||||
d.management_unit, d.caretaker, d.tel,d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||
d.location_way, d.active_time,d.dev_params,d.network_address,d.longitude,d.latitude
|
||||
from (
|
||||
select device_id, 1 AS is_owner
|
||||
|
@ -70,6 +70,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="!showSenior and tenantId != null and tenantId != 0 and !isAdmin">
|
||||
and p.tenant_id = #{tenantId}
|
||||
</if>
|
||||
<if test="productId != null and productId != ''"> and p.product_id = #{productId}</if>
|
||||
<if test="productName != null and productName != ''"> and p.product_name like concat('%', #{productName}, '%')</if>
|
||||
<if test="categoryName != null and categoryName != ''"> and p.category_name like concat('%', #{categoryName}, '%')</if>
|
||||
<if test="status != null "> and p.status = #{status}</if>
|
||||
|
@ -409,7 +409,7 @@
|
||||
specs = #{specs},
|
||||
</if>
|
||||
<if test="group != null and group != ''">
|
||||
group = #{group},
|
||||
`group` = #{group},
|
||||
</if>
|
||||
<if test="isChart != null">
|
||||
is_chart = #{isChart},
|
||||
|
@ -7,6 +7,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<resultMap type="com.fastbee.iot.model.anfang.UploadedPhotos" id="UploadedPhotosResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="photoPath" column="photo_path" />
|
||||
<result property="monitorPath" column="monitor_path" />
|
||||
<result property="imei" column="imei" />
|
||||
<result property="sn" column="sn" />
|
||||
<result property="lat" column="lat" />
|
||||
@ -18,10 +19,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUploadedPhotosVo">
|
||||
select id, photo_path, imei, sn, lat, lng, temp, door_state, shake_state, upload_time from uploaded_photos
|
||||
select id, photo_path,monitor_path, imei, sn, lat, lng, temp, door_state, shake_state, upload_time from uploaded_photos
|
||||
</sql>
|
||||
|
||||
<select id="selectUploadedPhotosList" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos" resultMap="UploadedPhotosResult">
|
||||
<select id="selectUploadedPhotosList" parameterType="com.fastbee.iot.model.anfang.UploadedPhotos"
|
||||
resultMap="UploadedPhotosResult">
|
||||
<include refid="selectUploadedPhotosVo"/>
|
||||
<where>
|
||||
<if test="photoPath != null and photoPath != ''"> and photo_path = #{photoPath}</if>
|
||||
@ -46,6 +48,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
insert into uploaded_photos
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="photoPath != null and photoPath != ''">photo_path,</if>
|
||||
<if test="monitorPath != null and monitorPath != ''">monitor_path,</if>
|
||||
<if test="imei != null and imei != ''">imei,</if>
|
||||
<if test="sn != null">sn,</if>
|
||||
<if test="lat != null">lat,</if>
|
||||
@ -57,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="photoPath != null and photoPath != ''">#{photoPath},</if>
|
||||
<if test="monitorPath != null and monitorPath != ''">#{monitorPath},</if>
|
||||
<if test="imei != null and imei != ''">#{imei},</if>
|
||||
<if test="sn != null">#{sn},</if>
|
||||
<if test="lat != null">#{lat},</if>
|
||||
@ -72,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
update uploaded_photos
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="photoPath != null and photoPath != ''">photo_path = #{photoPath},</if>
|
||||
<if test="monitorPath != null and monitorPath != ''">monitor_path = #{monitorPath},</if>
|
||||
<if test="imei != null and imei != ''">imei = #{imei},</if>
|
||||
<if test="sn != null">sn = #{sn},</if>
|
||||
<if test="lat != null">lat = #{lat},</if>
|
||||
|
Reference in New Issue
Block a user