
18 changed files with 509 additions and 23 deletions
@ -0,0 +1,71 @@ |
|||
package com.yxt.supervise.monitor.api.entity; |
|||
|
|||
import com.baomidou.mybatisplus.annotation.TableField; |
|||
import com.baomidou.mybatisplus.annotation.TableName; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import com.yxt.common.core.domain.EntityWithId; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
@Data |
|||
@ApiModel(value = "有ID的实体", description = "有ID的实体") |
|||
@TableName("y_push_police_info") |
|||
public class PushPoliceInfo extends EntityWithId { |
|||
// `id`使用继承的
|
|||
@ApiModelProperty("记录创建时间") |
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") |
|||
private Date createTime = new Date(); // 记录创建时间
|
|||
|
|||
@ApiModelProperty("备注说明") |
|||
private String remarks; // 备注说明
|
|||
|
|||
@ApiModelProperty("信息状态") |
|||
private String state; |
|||
|
|||
@ApiModelProperty("是否成功 (0成功 1失败)") |
|||
private String isSuccess; |
|||
|
|||
@ApiModelProperty("是否删除") |
|||
private String isDelete; |
|||
|
|||
@ApiModelProperty("修改时间") |
|||
private String modifyTime; |
|||
|
|||
@ApiModelProperty("创建人") |
|||
private String createBySid; |
|||
|
|||
@ApiModelProperty("更新人") |
|||
private String updateBySid; |
|||
|
|||
@ApiModelProperty("设备ID") |
|||
private String deviceId; |
|||
|
|||
@ApiModelProperty("信息类型") |
|||
private String msgType; |
|||
|
|||
@ApiModelProperty("推送参数") |
|||
private String input; |
|||
|
|||
@ApiModelProperty("返回参数") |
|||
private String output; |
|||
|
|||
@ApiModelProperty("仓库ID") |
|||
private String ckId; |
|||
|
|||
@ApiModelProperty("发送时间") |
|||
private String sendTime; |
|||
|
|||
@ApiModelProperty("0设备状态报警1图片对比报警") |
|||
private Integer imageOrPolice; |
|||
|
|||
@TableField(exist = false) |
|||
@ApiModelProperty("设备名称") |
|||
private String name; |
|||
|
|||
@TableField(exist = false) |
|||
@ApiModelProperty("设备位置") |
|||
private String position; |
|||
} |
@ -0,0 +1,28 @@ |
|||
package com.yxt.supervise.monitor.api.vo; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Exrickx |
|||
*/ |
|||
@Data |
|||
public class DeviceVo { |
|||
|
|||
private String name; |
|||
|
|||
private String serialNumber; |
|||
|
|||
private String status; |
|||
|
|||
private String similarity; |
|||
|
|||
private String startImage; |
|||
|
|||
private String endImage; |
|||
|
|||
private String startTime; |
|||
|
|||
private String endTime; |
|||
|
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.yxt.supervise.monitor.api.vo; |
|||
|
|||
import com.yxt.supervise.monitor.api.entity.Device; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Exrickx |
|||
*/ |
|||
@Data |
|||
public class PushPoliceAllVo { |
|||
|
|||
private String sid; |
|||
|
|||
private String name; |
|||
|
|||
private List<DeviceVo> devices; |
|||
|
|||
private Integer errorCount; |
|||
|
|||
private String sendTime; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.yxt.supervise.monitor.api.vo; |
|||
|
|||
import com.yxt.supervise.monitor.api.entity.Device; |
|||
import com.yxt.supervise.monitor.api.entity.DeviceImage; |
|||
import lombok.Data; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author Exrickx |
|||
*/ |
|||
@Data |
|||
public class PushPoliceImageAllVo { |
|||
|
|||
private String sid; |
|||
|
|||
private String name; |
|||
|
|||
private List<DeviceVo> deviceImages; |
|||
|
|||
private String sendTime; |
|||
|
|||
} |
@ -0,0 +1,42 @@ |
|||
package com.yxt.supervise.monitor.api.vo; |
|||
|
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author Exrickx |
|||
*/ |
|||
@Data |
|||
public class PushPoliceVo { |
|||
|
|||
private String id; |
|||
|
|||
private String sid; |
|||
|
|||
private String remarks; |
|||
|
|||
private String reportTarget; |
|||
|
|||
private String code; |
|||
|
|||
private String name; |
|||
|
|||
private String content; |
|||
|
|||
private String levelSid; |
|||
|
|||
private String levelCode; |
|||
|
|||
private String levelName; |
|||
|
|||
private String typeSid; |
|||
|
|||
private String typeCode; |
|||
|
|||
private String typeName; |
|||
|
|||
private String bigTypeName; |
|||
|
|||
private String list; |
|||
|
|||
} |
@ -0,0 +1,15 @@ |
|||
package com.yxt.supervise.monitor.biz.pushPoliceInfo; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.supervise.monitor.api.entity.CallPolice; |
|||
import com.yxt.supervise.monitor.api.entity.PushPoliceInfo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
@Mapper |
|||
public interface PushPoliceInfoMapper extends BaseMapper<PushPoliceInfo> { |
|||
|
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.yxt.supervise.monitor.biz.pushPoliceInfo.PushPoliceInfoMapper"> |
|||
<!-- <select id="getCallPolicePage" resultType="com.yxt.supervise.monitor.api.entity.CallPolice">--> |
|||
<!-- select t.createTime, t.msgType, d.name, d.position--> |
|||
<!-- from y_call_police t--> |
|||
<!-- inner join y_device d on t.deviceId = d.id--> |
|||
<!-- ${ew.customSqlSegment}--> |
|||
<!-- </select>--> |
|||
</mapper> |
@ -0,0 +1,136 @@ |
|||
package com.yxt.supervise.monitor.biz.pushPoliceInfo; |
|||
|
|||
import com.alibaba.fastjson.JSONArray; |
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|||
import com.yxt.supervise.monitor.api.entity.CallPolice; |
|||
import com.yxt.supervise.monitor.api.entity.Device; |
|||
import com.yxt.supervise.monitor.api.entity.DeviceImage; |
|||
import com.yxt.supervise.monitor.api.entity.PushPoliceInfo; |
|||
import com.yxt.supervise.monitor.api.vo.PushPoliceAllVo; |
|||
import com.yxt.supervise.monitor.api.vo.PushPoliceImageAllVo; |
|||
import com.yxt.supervise.monitor.api.vo.PushPoliceVo; |
|||
import com.yxt.supervise.monitor.biz.util.HttpUtils; |
|||
import org.springframework.beans.factory.annotation.Value; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.text.SimpleDateFormat; |
|||
import java.util.Date; |
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
|
|||
@Service |
|||
public class PushPoliceInfoService extends ServiceImpl<PushPoliceInfoMapper, PushPoliceInfo> { |
|||
|
|||
|
|||
@Value("${policeMessage.sxtUrl}") |
|||
private String policeUrl; |
|||
|
|||
@Value("${policeMessage.imageUrl}") |
|||
private String policeImgUrl; |
|||
|
|||
@Value("${policeMessage.getCodeUrl}") |
|||
private String getCodeUrl; |
|||
|
|||
|
|||
/** |
|||
* @param pushPoliceAllVos 入参 |
|||
* @return |
|||
*/ |
|||
public void pushPoliceMessage(PushPoliceAllVo pushPoliceAllVos) { |
|||
if (pushPoliceAllVos == null) { |
|||
log.error("The Device Is Null"); |
|||
return; |
|||
} |
|||
|
|||
System.out.println(JSONObject.toJSONString(pushPoliceAllVos)); |
|||
if (1 == 1) return; |
|||
|
|||
String result = ""; |
|||
String paramJson = ""; |
|||
try { |
|||
paramJson = JSONObject.toJSONString(pushPoliceAllVos); |
|||
System.out.println(paramJson); |
|||
|
|||
// 调取报警平台
|
|||
result = HttpUtils.sendPostJson(policeUrl, paramJson, ""); |
|||
// 返回结果存库
|
|||
PushPoliceInfo pushPoliceInfo = new PushPoliceInfo(); |
|||
pushPoliceInfo.setCkId(pushPoliceAllVos.getSid()); |
|||
pushPoliceInfo.setCreateTime(new Date()); |
|||
pushPoliceInfo.setSendTime(pushPoliceAllVos.getSendTime()); |
|||
pushPoliceInfo.setInput(paramJson); |
|||
pushPoliceInfo.setOutput(result); |
|||
// 0设备状态报警1图片对比报警
|
|||
pushPoliceInfo.setImageOrPolice(0); |
|||
pushPoliceInfo.setIsSuccess("0"); |
|||
this.save(pushPoliceInfo); |
|||
|
|||
} catch (Exception e) { |
|||
// 返回结果存库
|
|||
PushPoliceInfo pushPoliceInfo = new PushPoliceInfo(); |
|||
pushPoliceInfo.setCkId(pushPoliceAllVos.getSid()); |
|||
pushPoliceInfo.setCreateTime(new Date()); |
|||
pushPoliceInfo.setSendTime(pushPoliceAllVos.getSendTime()); |
|||
pushPoliceInfo.setInput(paramJson); |
|||
pushPoliceInfo.setOutput(result); |
|||
// 0设备状态报警1图片对比报警
|
|||
pushPoliceInfo.setImageOrPolice(0); |
|||
pushPoliceInfo.setIsSuccess("1"); |
|||
this.save(pushPoliceInfo); |
|||
// 报错处理
|
|||
System.out.println(e); |
|||
} |
|||
} |
|||
|
|||
|
|||
/** |
|||
* @param pushPoliceImageAllVo 对比信息 |
|||
* @return |
|||
*/ |
|||
public void pushPoliceImageMessage(PushPoliceImageAllVo pushPoliceImageAllVo) { |
|||
if (pushPoliceImageAllVo == null) { |
|||
log.error("The DeviceImage Is Null"); |
|||
return; |
|||
} |
|||
|
|||
System.out.println(JSONObject.toJSONString(pushPoliceImageAllVo)); |
|||
|
|||
if (1 == 1) return; |
|||
String paramJson = ""; |
|||
String result = ""; |
|||
try { |
|||
paramJson = JSONObject.toJSONString(pushPoliceImageAllVo); |
|||
// 调取报警平台
|
|||
result = HttpUtils.sendPostJson(policeImgUrl, paramJson, ""); |
|||
|
|||
// 返回结果存库
|
|||
PushPoliceInfo pushPoliceInfo = new PushPoliceInfo(); |
|||
pushPoliceInfo.setCkId(pushPoliceImageAllVo.getSid()); |
|||
pushPoliceInfo.setCreateTime(new Date()); |
|||
pushPoliceInfo.setSendTime(pushPoliceImageAllVo.getSendTime()); |
|||
pushPoliceInfo.setInput(paramJson); |
|||
pushPoliceInfo.setOutput(result); |
|||
// 0设备状态报警1图片对比报警
|
|||
pushPoliceInfo.setImageOrPolice(1); |
|||
pushPoliceInfo.setIsSuccess("0"); |
|||
this.save(pushPoliceInfo); |
|||
|
|||
} catch (Exception e) { |
|||
// 返回结果存库
|
|||
PushPoliceInfo pushPoliceInfo = new PushPoliceInfo(); |
|||
pushPoliceInfo.setCkId(pushPoliceImageAllVo.getSid()); |
|||
pushPoliceInfo.setCreateTime(new Date()); |
|||
pushPoliceInfo.setSendTime(pushPoliceImageAllVo.getSendTime()); |
|||
pushPoliceInfo.setInput(paramJson); |
|||
pushPoliceInfo.setOutput(result); |
|||
// 0设备状态报警1图片对比报警
|
|||
pushPoliceInfo.setImageOrPolice(1); |
|||
pushPoliceInfo.setIsSuccess("1"); |
|||
this.save(pushPoliceInfo); |
|||
// 报错处理
|
|||
System.out.println(result); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue