548 lines
23 KiB
Plaintext
548 lines
23 KiB
Plaintext
|
|
Index: securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/util/QxVideoUtil.java
|
|||
|
|
===================================================================
|
|||
|
|
--- securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/util/QxVideoUtil.java (revision 9afbc200c36621819d66156260a542297162f19e)
|
|||
|
|
+++ securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/util/QxVideoUtil.java (revision 9afbc200c36621819d66156260a542297162f19e)
|
|||
|
|
@@ -1,416 +0,0 @@
|
|||
|
|
-package com.securityControl.task.util;
|
|||
|
|
-
|
|||
|
|
-import com.alibaba.fastjson.JSON;
|
|||
|
|
-import com.alibaba.fastjson.JSONArray;
|
|||
|
|
-import com.alibaba.fastjson.JSONObject;
|
|||
|
|
-import com.alibaba.fastjson.TypeReference;
|
|||
|
|
-import com.securityControl.common.core.utils.aes.StringHelper;
|
|||
|
|
-import com.securityControl.task.domain.vo.BallVideoEntity;
|
|||
|
|
-import com.securityControl.task.domain.vo.BallWatermarkMgeBean;
|
|||
|
|
-import com.securityControl.task.domain.vo.ReturnBallListEntity;
|
|||
|
|
-import com.securityControl.task.domain.vo.ReturnDataEntity;
|
|||
|
|
-import lombok.extern.slf4j.Slf4j;
|
|||
|
|
-
|
|||
|
|
-import java.text.ParseException;
|
|||
|
|
-import java.util.ArrayList;
|
|||
|
|
-import java.util.HashMap;
|
|||
|
|
-import java.util.List;
|
|||
|
|
-import java.util.Map;
|
|||
|
|
-
|
|||
|
|
-/**
|
|||
|
|
- * 清新平台数据获取
|
|||
|
|
- *
|
|||
|
|
- * @author 吕继龙
|
|||
|
|
- */
|
|||
|
|
-@Slf4j
|
|||
|
|
-public class QxVideoUtil {
|
|||
|
|
-
|
|||
|
|
- private static final String IPADDRESS = "112.31.70.193";// 平台地址
|
|||
|
|
- private static final String PORT = "9988";// 平台端口
|
|||
|
|
- private static final String USER = "bns4";// 用户名
|
|||
|
|
- private static final String PASSWORD = "Bns@2023**";// 密码
|
|||
|
|
- private static final String EPID = "system";// 登录平台企业ID
|
|||
|
|
- private static final int BFIX = 1;// 登录平台是否通过网闸模式
|
|||
|
|
- private static final String LOGIN_URL = "login";// 登录地址
|
|||
|
|
- private static final String GETBALLURL = "CAS/C_CAS_QueryPUIDRes";// 球机状态批量获取
|
|||
|
|
- private static final String GETBALLFILE = "SG/C_SG_QueryRecordFiles"; // 获取前端录像-图片-
|
|||
|
|
- private static final String GETBALLLIST = "CAS/C_CAS_QueryPUIDSets"; // 获取平台下球机列表
|
|||
|
|
- /**
|
|||
|
|
- * 获取球机gps
|
|||
|
|
- */
|
|||
|
|
- private static final String GPSBALLURL = "GPS/C_GS_QueryLastGPSData";
|
|||
|
|
- private static final String GETBALLLoadFile = "SG/C_SG_DownLoadFile_PushMode"; //下载前端抓拍文件
|
|||
|
|
- private static final String ON_DEMAND_VIDEO = "SG/VODFile.flv"; //前端存储 - 点播前端录像
|
|||
|
|
- private static final String ONDEMANDVIDEOPLATFORM = "CSS/VODFile.flv"; //云台点播 - 点播云台录像
|
|||
|
|
-
|
|||
|
|
-
|
|||
|
|
- private static final String QUERYSTORAGEFILES = "CSS/C_CSS_QueryStorageFiles"; //云存储 - 查询云录像云抓拍
|
|||
|
|
- private static final String QUERYPICTUREFILES = "CSS/C_CSS_DownloadFile";//云存储 - 下载云平台图片文件
|
|||
|
|
-
|
|||
|
|
-
|
|||
|
|
- // private static final String QHTTPURL = "http://112.31.70.193:1854/icvs/";// 连接icvs平台地址
|
|||
|
|
- private static final String Q2HTTPURL = "http://112.31.70.193:1854/icvs2/";// 连接icvs平台地址
|
|||
|
|
- private static final String BallUpdown = "RawRequest?dstType=8&dstID=&token=";//球机上下线
|
|||
|
|
- private static final String setConfig = "RawRequest?dstType=201&dstID=";//智能识别设置
|
|||
|
|
- private static final String set3dConfig = "RawRequest?dstType=201&dstID=";//3的云台设置
|
|||
|
|
- /**
|
|||
|
|
- * 设置视频叠加文字
|
|||
|
|
- **/
|
|||
|
|
- private static final String WATERMARK_URL = "IV/F_IV_TextAdd";
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 设置视频叠加文字
|
|||
|
|
- **/
|
|||
|
|
- private static final String RawRequest_URL = "RawRequest";
|
|||
|
|
-
|
|||
|
|
-
|
|||
|
|
- public static final String pictureQuery = Q2HTTPURL + QUERYPICTUREFILES; //云存储 - 下载云平台图片文件
|
|||
|
|
-
|
|||
|
|
- public static final String videoQuery = Q2HTTPURL + ONDEMANDVIDEOPLATFORM;//云台点播 - 点播云台录像
|
|||
|
|
-
|
|||
|
|
- public static final String videoWebQuery = Q2HTTPURL + ON_DEMAND_VIDEO;//前端录像点播
|
|||
|
|
-
|
|||
|
|
-
|
|||
|
|
- private static final String setDeviceText = "xml?dstType=201&dstID=";
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 系统登录,获取token
|
|||
|
|
- *
|
|||
|
|
- * @return token
|
|||
|
|
- */
|
|||
|
|
- public static String login() {
|
|||
|
|
- Map<String, Object> map = new HashMap<>();
|
|||
|
|
- map.put("address", IPADDRESS);
|
|||
|
|
- map.put("port", PORT);
|
|||
|
|
- map.put("user", USER);
|
|||
|
|
- map.put("password", PASSWORD);
|
|||
|
|
- map.put("epid", EPID);
|
|||
|
|
- map.put("fixaddr", BFIX);
|
|||
|
|
- String json = new JacksonHelpers().jsonSerialize(map);
|
|||
|
|
- String result = HttpHelps.doHttpPosts(Q2HTTPURL + LOGIN_URL, json);
|
|||
|
|
- if (result != null) {
|
|||
|
|
- JSONObject object = JSONObject.parseObject(result);
|
|||
|
|
- if (object != null) {
|
|||
|
|
- String msg = object.getString("msg");
|
|||
|
|
- String token = object.getString("token");
|
|||
|
|
- return token;
|
|||
|
|
- } else {
|
|||
|
|
- return null;
|
|||
|
|
- }
|
|||
|
|
- }
|
|||
|
|
- return null;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 获取单个设备状态
|
|||
|
|
- *
|
|||
|
|
- * @param puid
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static String getBallStatus(String puid, String token) {
|
|||
|
|
- login();
|
|||
|
|
- String taskStartTime = DateTimeHelper.getNowTime();
|
|||
|
|
- String param = "token=" + token + "&puid=" + puid;
|
|||
|
|
- String res = HttpHelps.sendGet(Q2HTTPURL + GETBALLURL, param);
|
|||
|
|
- if (!StringHelper.isEmpty(res)) {
|
|||
|
|
- JSONObject obj = JSONObject.parseObject(res);
|
|||
|
|
- if (obj != null) {
|
|||
|
|
- String status = obj.getString("OnlineFlag");
|
|||
|
|
-
|
|||
|
|
- if (StringHelper.isEmpty(status)) {
|
|||
|
|
- status = "0";
|
|||
|
|
- }
|
|||
|
|
- String taskEndTime = DateTimeHelper.getNowTime();
|
|||
|
|
- String time = DateTimeHelper.getTimeDifference(taskEndTime, taskStartTime);
|
|||
|
|
- log.error("清新获取数据开始时间:" + taskStartTime);
|
|||
|
|
- log.error("获取清新状态结束时间:" + taskEndTime);
|
|||
|
|
- log.error("清新获取状态总时长:" + time);
|
|||
|
|
- return status;
|
|||
|
|
- }
|
|||
|
|
- }
|
|||
|
|
- return "0";
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 批量获取清晰设备状态
|
|||
|
|
- *
|
|||
|
|
- * @param
|
|||
|
|
- * @param token
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static List<BallVideoEntity> getBallVideoWeb(String puid, String token, String idx, String type, String dateTime) {
|
|||
|
|
- List<BallVideoEntity> list = null;
|
|||
|
|
- String begin = DateTimeHelper.getStartTime(dateTime);
|
|||
|
|
- String end = DateTimeHelper.getEndTime(dateTime);
|
|||
|
|
- String param = "token=" + token + "&puid=" + puid + "&type=" + type + "&idx=0&begin=" + begin + "&end=" + end + "&offset=0count=200";
|
|||
|
|
- String res = HttpHelps.sendGet(Q2HTTPURL + GETBALLFILE, param);
|
|||
|
|
- if (!StringHelper.isEmpty(res) && res.indexOf("errcode") == -1 && res.indexOf("null") == -1) {
|
|||
|
|
- list = JSON.parseObject(res, new TypeReference<List<BallVideoEntity>>() {
|
|||
|
|
- });
|
|||
|
|
- log.error("p");
|
|||
|
|
- } else {
|
|||
|
|
- return null;
|
|||
|
|
- }
|
|||
|
|
- return list;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 获取云端录像文件||录像
|
|||
|
|
- *
|
|||
|
|
- * @param
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static List<BallVideoEntity> getBallVideo(String puid, String token, String type, String time) throws ParseException {
|
|||
|
|
- List<BallVideoEntity> list = null;
|
|||
|
|
- if (StringHelper.isEmpty(time)) {
|
|||
|
|
- time = DateTimeHelper.getNowDate();
|
|||
|
|
- }
|
|||
|
|
- String begin = DateTimeHelper.getStartTime(time);//开始时间
|
|||
|
|
- String end = DateTimeHelper.getEndTime(time);//结束时间
|
|||
|
|
- String param = "puid=" + puid + "&token=" + token + "&begin=" + begin + "&end=" + end + "&type=" + type;
|
|||
|
|
- String res = HttpHelps.sendGet(Q2HTTPURL + QUERYSTORAGEFILES, param);
|
|||
|
|
- JSONObject obj = JSONObject.parseObject(res);
|
|||
|
|
- Object data = obj.get("File");
|
|||
|
|
- if (data instanceof JSONObject) {//是对象
|
|||
|
|
- BallVideoEntity authInfoVo = JSON.parseObject(JSON.toJSONString(data), BallVideoEntity.class);
|
|||
|
|
- list = new ArrayList<BallVideoEntity>();
|
|||
|
|
- list.add(authInfoVo);
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- if (data instanceof JSONArray) {//是数组
|
|||
|
|
- JSONArray arr = obj.getJSONArray("File");
|
|||
|
|
-
|
|||
|
|
- list = JSON.parseObject(arr.toString(), new TypeReference<List<BallVideoEntity>>() {
|
|||
|
|
- });
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- return list;
|
|||
|
|
-
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- public static List<ReturnDataEntity> getBallStatuss(List<String> list, String token) {
|
|||
|
|
- List<ReturnDataEntity> reList = new ArrayList<>();
|
|||
|
|
- String taskStartTime = DateTimeHelper.getNowTime();
|
|||
|
|
- try {
|
|||
|
|
- String[] ans2 = list.toArray(new String[list.size()]);
|
|||
|
|
- JSONObject jsonObject = new JSONObject();//参数封装
|
|||
|
|
- jsonObject.put("puid", ans2);
|
|||
|
|
- String res = HttpClientUtils.doHttpPost(Q2HTTPURL + GETBALLURL + "?token=" + token, jsonObject, null);
|
|||
|
|
- if (!StringHelper.isEmpty(res)) {
|
|||
|
|
- reList = JSON.parseObject(res, new TypeReference<List<ReturnDataEntity>>() {
|
|||
|
|
- });
|
|||
|
|
- }
|
|||
|
|
- String taskEndTime = DateTimeHelper.getNowTime();
|
|||
|
|
- String time = DateTimeHelper.getTimeDifference(taskEndTime, taskStartTime);
|
|||
|
|
- log.error("清新获取数据开始时间:" + taskStartTime);
|
|||
|
|
- log.error("获取清新状态结束时间:" + taskEndTime);
|
|||
|
|
- log.error("清新获取状态总时长:" + time);
|
|||
|
|
- } catch (Exception e) {
|
|||
|
|
- log.error("清晰获取list集合数据状态异常:" + e.toString(), e);
|
|||
|
|
- }
|
|||
|
|
- return reList;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 修改球机水印
|
|||
|
|
- *
|
|||
|
|
- * @param
|
|||
|
|
- * @return
|
|||
|
|
- **/
|
|||
|
|
- public static String updateBallWatermarkMge(BallWatermarkMgeBean o, String token) {
|
|||
|
|
- token = login();
|
|||
|
|
- String text = o.getOne() + "\r\n" + o.getTwo() + "\r\n" + o.getThree();
|
|||
|
|
- Map<String, Object> jsonMap = new HashMap<>();
|
|||
|
|
- jsonMap.put("puid", o.getPuid());
|
|||
|
|
- jsonMap.put("idx", 0);
|
|||
|
|
- jsonMap.put("Text", text.toString());
|
|||
|
|
- jsonMap.put("align", "右下对齐");
|
|||
|
|
- jsonMap.put("xpos", "2");
|
|||
|
|
- jsonMap.put("ypos", "2");
|
|||
|
|
- String json = JSON.toJSONString(jsonMap);
|
|||
|
|
- String res = HttpClients.sendPost(Q2HTTPURL + WATERMARK_URL + "?token=" + token, json);
|
|||
|
|
- return res;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 修改设备名称
|
|||
|
|
- *
|
|||
|
|
- * @param
|
|||
|
|
- * @return
|
|||
|
|
- **/
|
|||
|
|
- public static void updateBallName(BallEntity entity, String token) {
|
|||
|
|
- String params = "?dstType=201&dstID=" + entity.getPuid() + "&token=" + token;
|
|||
|
|
- Map<String, String> jsonMap = new HashMap<>();
|
|||
|
|
- jsonMap.put("xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?><M Type=\"ComReq\"><C Type=\"S\" Prio=\"1\" EPID=\"system\"><Res Type=\"ST\" Idx=\"0\" OptID=\"F_RES_Desc\"><Param><Res Name=\"" + entity.getName().replace("\\r\\n", "|") + "\" Desc=\"\" Enable=\"1\" Usable=\"1\"></Res></Param></Res></C></M>");
|
|||
|
|
- String json = new JacksonHelpers().jsonSerialize(jsonMap);
|
|||
|
|
- HttpClients.sendPost(Q2HTTPURL + RawRequest_URL + params, json);
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 设置叠加文字
|
|||
|
|
- *
|
|||
|
|
- * @param o
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static String setOsdText(BallWatermarkMgeBean o) {
|
|||
|
|
- String text = o.getOne() + "\\r\\n" + o.getTwo() + "\\r\\n" + o.getThree();
|
|||
|
|
- try {
|
|||
|
|
- //登录
|
|||
|
|
- String token = login();
|
|||
|
|
- String xml = BallVideoEntity.PostXml.getOsDText(text);
|
|||
|
|
- String str = BallVideoEntity.PostXml.sedPostXml(Q2HTTPURL + setDeviceText + o.getPuid() + "&token=" + token, xml);
|
|||
|
|
- //return XML.toJSONObject(str).getJSONObject("M").getJSONObject("C").get("SPError").toString();
|
|||
|
|
- return "";
|
|||
|
|
- } catch (Exception e) {
|
|||
|
|
- log.error(e.toString(), e);
|
|||
|
|
- return "";
|
|||
|
|
- }
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 修改设备名称
|
|||
|
|
- *
|
|||
|
|
- * @param
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static String setOsdName(BallWatermarkMgeBean entity) {
|
|||
|
|
- try {
|
|||
|
|
- //登录
|
|||
|
|
- String token = login();
|
|||
|
|
- String xml = BallVideoEntity.PostXml.getDeviceNameXml(entity.getName());
|
|||
|
|
- Map<String, Object> jsonMap = new HashMap<>();
|
|||
|
|
- jsonMap.put("xml", xml);
|
|||
|
|
- String json = JSON.toJSONString(jsonMap);
|
|||
|
|
- String str = HttpClients.sendPost(Q2HTTPURL + setDeviceText + entity.getPuid() + "&token=" + token, json);
|
|||
|
|
- //return XML.toJSONObject(str).getJSONObject("M").getJSONObject("C").get("SPError").toString();
|
|||
|
|
- return "";
|
|||
|
|
- } catch (Exception e) {
|
|||
|
|
- log.error(e.toString(), e);
|
|||
|
|
- return "";
|
|||
|
|
- }
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 获取平台下球机信息
|
|||
|
|
- *
|
|||
|
|
- * @param
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static List<ReturnBallListEntity> getBallList() {
|
|||
|
|
- List<ReturnBallListEntity> reList = new ArrayList<>();
|
|||
|
|
- String token = login();
|
|||
|
|
- String param = "token=" + token;
|
|||
|
|
- String res = HttpHelps.sendGet(Q2HTTPURL + GETBALLLIST, param);
|
|||
|
|
- System.err.println(res);
|
|||
|
|
- if (!StringHelper.isEmpty(res)) {
|
|||
|
|
- JSONArray resArr = JSONObject.parseArray(res);
|
|||
|
|
- for (int i = 0; i < resArr.size(); i++) {
|
|||
|
|
- JSONObject jsonObject = resArr.getJSONObject(i);
|
|||
|
|
- ReturnBallListEntity ballList = new ReturnBallListEntity();
|
|||
|
|
- ballList.setName(jsonObject.getString("Name"));
|
|||
|
|
- ballList.setMac(jsonObject.getString("Model"));
|
|||
|
|
- ballList.setPuid(jsonObject.getString("$"));
|
|||
|
|
- ballList.setNationalStandardCode(jsonObject.getString("DeviceID"));
|
|||
|
|
- ballList.setSource("清新");
|
|||
|
|
- ballList.setStatus(jsonObject.getString("OnlineFlag"));
|
|||
|
|
-
|
|||
|
|
- ballList.setQxPuid(jsonObject.getString("$"));
|
|||
|
|
- ballList.setAllowFlag(jsonObject.getString("AllowFlag"));
|
|||
|
|
- ballList.setLongitude(jsonObject.getString("Longitude"));
|
|||
|
|
- ballList.setLatitude(jsonObject.getString("Latitude"));
|
|||
|
|
- ballList.setRemark(jsonObject.getString("Remark"));
|
|||
|
|
- ballList.setQxName(jsonObject.getString("Name"));
|
|||
|
|
- ballList.setDescription(jsonObject.getString("Description"));
|
|||
|
|
- ballList.setEnable(jsonObject.getString("Enable"));
|
|||
|
|
- ballList.setOnlineFlag(jsonObject.getString("OnlineFlag"));
|
|||
|
|
- ballList.setModel(jsonObject.getString("Model"));
|
|||
|
|
- ballList.setType(jsonObject.getString("Type"));
|
|||
|
|
- ballList.setProducerID(jsonObject.getString("ProducerID"));
|
|||
|
|
- ballList.setHardType(jsonObject.getString("HardType"));
|
|||
|
|
- ballList.setHardwareVersion(jsonObject.getString("HardwareVersion"));
|
|||
|
|
- ballList.setSoftwareVersion(jsonObject.getString("SoftwareVersion"));
|
|||
|
|
- ballList.setQxDeviceID(jsonObject.getString("DeviceID"));
|
|||
|
|
- reList.add(ballList);
|
|||
|
|
- }
|
|||
|
|
- }
|
|||
|
|
- return reList;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 获取球机GPS
|
|||
|
|
- *
|
|||
|
|
- * @param puIdList 球机puid
|
|||
|
|
- * @return
|
|||
|
|
- **/
|
|||
|
|
- public BallGpsEntity getBallGps(List<BallEntity> puIdList) {
|
|||
|
|
- String token = login();
|
|||
|
|
- String param = "?token=" + token;
|
|||
|
|
- HashMap<String, Object> map = new HashMap<>();
|
|||
|
|
- StringBuilder strJson = new StringBuilder();
|
|||
|
|
- for (BallEntity ball : puIdList) {
|
|||
|
|
- strJson.append("{\"puid\":\"").append(ball.getPuid()).append("\",\"idx\": 0,\"type\":\"ST\"},");
|
|||
|
|
- }
|
|||
|
|
- map.put("equipment", JSON.parse("[" + strJson.substring(0, strJson.length() - 1) + "]"));
|
|||
|
|
- String json = JSON.toJSONString(map);
|
|||
|
|
- String res = HttpClients.sendPost(Q2HTTPURL + GPSBALLURL + param, json);
|
|||
|
|
- if (res.contains("Res")) {
|
|||
|
|
- JSONObject jsonObject = JSON.parseObject(res);
|
|||
|
|
- return JSONObject.parseObject(jsonObject.toString(), BallGpsEntity.class);
|
|||
|
|
- } else {
|
|||
|
|
- return null;
|
|||
|
|
- }
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- /**
|
|||
|
|
- * 获取球机上下线事件
|
|||
|
|
- *
|
|||
|
|
- * @return
|
|||
|
|
- */
|
|||
|
|
- public static String getBallUpDown(String puid, String startTime, String endTime) {
|
|||
|
|
- String resultXml = "";
|
|||
|
|
- try {
|
|||
|
|
- String token = login();//登录
|
|||
|
|
- String xml = BallVideoEntity.PostXml.getXmlData(puid, startTime, endTime);
|
|||
|
|
- resultXml = BallVideoEntity.PostXml.sedPostXml(Q2HTTPURL + BallUpdown + token, xml);
|
|||
|
|
-
|
|||
|
|
- } catch (Exception e) {
|
|||
|
|
- log.error(e.toString(), e);
|
|||
|
|
- }
|
|||
|
|
- return resultXml;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- public static String setSBConfig(Map<String, String> map, String puid) {
|
|||
|
|
- String msg = "设置成功";
|
|||
|
|
- try {
|
|||
|
|
- String token = login();//登录
|
|||
|
|
- String xml = BallVideoEntity.PostXml.getXmlZnData(map);
|
|||
|
|
- Map<String, String> jsonMap = new HashMap<>();
|
|||
|
|
- jsonMap.put("xml", xml);
|
|||
|
|
- String json = new JacksonHelpers().jsonSerialize(jsonMap);
|
|||
|
|
- String resultXml = HttpClients.sendPost(Q2HTTPURL + setConfig + puid + "&token=" + token, json);
|
|||
|
|
- msg = BallVideoEntity.PostXml.getXmlConfigData(resultXml);
|
|||
|
|
- } catch (Exception e) {
|
|||
|
|
- msg = "设置失败";
|
|||
|
|
- log.error(e.toString(), e);
|
|||
|
|
- }
|
|||
|
|
- return msg;
|
|||
|
|
- }
|
|||
|
|
-
|
|||
|
|
- public static String set3DyunConfig(String Sx, String Sy, String Ex, String Ey, String puid) {
|
|||
|
|
- String msg = "设置成功";
|
|||
|
|
- try {
|
|||
|
|
- String token = login();//登录
|
|||
|
|
- String xml = BallVideoEntity.PostXml.get3DyunXmlData(Sx, Sy, Ex, Ey);
|
|||
|
|
- Map<String, String> jsonMap = new HashMap<>();
|
|||
|
|
- jsonMap.put("xml", xml);
|
|||
|
|
- String json = new JacksonHelpers().jsonSerialize(jsonMap);
|
|||
|
|
- String resultXml = HttpClients.sendPost(Q2HTTPURL + set3dConfig + puid + "&token=" + token, json);
|
|||
|
|
- msg = BallVideoEntity.PostXml.getXml3dYunConfigData(resultXml);
|
|||
|
|
- } catch (Exception e) {
|
|||
|
|
- msg = "设置失败";
|
|||
|
|
- log.error(e.toString(), e);
|
|||
|
|
- }
|
|||
|
|
- return msg;
|
|||
|
|
- }
|
|||
|
|
-}
|
|||
|
|
Index: securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/schedule/ScheduleDeviceXh.java
|
|||
|
|
IDEA additional info:
|
|||
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|||
|
|
<+>UTF-8
|
|||
|
|
===================================================================
|
|||
|
|
--- securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/schedule/ScheduleDeviceXh.java (date 1677676208647)
|
|||
|
|
+++ securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/schedule/ScheduleDeviceXh.java (date 1677676208647)
|
|||
|
|
@@ -0,0 +1,42 @@
|
|||
|
|
+package com.securityControl.task.schedule;
|
|||
|
|
+
|
|||
|
|
+import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
|||
|
|
+import com.securityControl.task.service.DeviceService;
|
|||
|
|
+import com.securityControl.task.service.TaskService;
|
|||
|
|
+import com.securityControl.task.service.impl.WeatherService;
|
|||
|
|
+import lombok.extern.slf4j.Slf4j;
|
|||
|
|
+import org.quartz.Job;
|
|||
|
|
+import org.quartz.JobExecutionContext;
|
|||
|
|
+import org.quartz.JobExecutionException;
|
|||
|
|
+import org.slf4j.Logger;
|
|||
|
|
+import org.slf4j.LoggerFactory;
|
|||
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
+import org.springframework.scheduling.annotation.EnableScheduling;
|
|||
|
|
+import org.springframework.stereotype.Component;
|
|||
|
|
+
|
|||
|
|
+/**
|
|||
|
|
+ * 球机信号的获取
|
|||
|
|
+ */
|
|||
|
|
+@Component
|
|||
|
|
+@EnableScheduling
|
|||
|
|
+public class ScheduleDeviceXh implements Job {
|
|||
|
|
+
|
|||
|
|
+ private static final Logger log = LoggerFactory.getLogger(ScheduledDeviceMsg.class);
|
|||
|
|
+
|
|||
|
|
+
|
|||
|
|
+ @Autowired
|
|||
|
|
+ private DeviceService service;
|
|||
|
|
+ @Autowired
|
|||
|
|
+ private TaskService taskService;
|
|||
|
|
+ public void execute(JobExecutionContext context) throws JobExecutionException {
|
|||
|
|
+ try{
|
|||
|
|
+ log.info("开始更新球机信号数据>>>");
|
|||
|
|
+ taskService.updateTask("bns_class_device","1", DateTimeHelper.getNowTime());
|
|||
|
|
+ service.updateDeviceXh();
|
|||
|
|
+ log.info("设备信息更新完成>>>");
|
|||
|
|
+ } catch (Exception e){
|
|||
|
|
+ log.error(e.toString(),e);
|
|||
|
|
+ }
|
|||
|
|
+ }
|
|||
|
|
+
|
|||
|
|
+}
|
|||
|
|
Index: securityControl-modules/securityControl-task/src/main/resources/mapper/task/WatherMapper.xml
|
|||
|
|
IDEA additional info:
|
|||
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|||
|
|
<+>UTF-8
|
|||
|
|
===================================================================
|
|||
|
|
--- securityControl-modules/securityControl-task/src/main/resources/mapper/task/WatherMapper.xml (date 1677670067863)
|
|||
|
|
+++ securityControl-modules/securityControl-task/src/main/resources/mapper/task/WatherMapper.xml (date 1677670067863)
|
|||
|
|
@@ -0,0 +1,24 @@
|
|||
|
|
+<?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.securityControl.task.mapper.WatherDao">
|
|||
|
|
+ <insert id="insertWatherWarn" parameterType="String">
|
|||
|
|
+ insert into t_wather_warn
|
|||
|
|
+ (city,create_time,content,type,level,is_accecpt,state,is_xf)value (
|
|||
|
|
+ #{city},#{time},#{content},#{type},#{level},'0','1','0'
|
|||
|
|
+ )
|
|||
|
|
+ </insert>
|
|||
|
|
+ <!--数据是否存在-->
|
|||
|
|
+ <select id="getIsCz" parameterType="String" resultType="Integer">
|
|||
|
|
+ select count(1) from
|
|||
|
|
+ t_wather_warn where create_time=#{time} and city=#{city}
|
|||
|
|
+ </select>
|
|||
|
|
+ <!--将当前数据修改为当前-->
|
|||
|
|
+ <insert id="updateWarther" parameterType="String">
|
|||
|
|
+ update t_wather_warn set state='1' where city=#{city} and create_time=#{time}
|
|||
|
|
+ </insert>
|
|||
|
|
+ <!--删除历史数据-->
|
|||
|
|
+ <update id="delWatherWrn" parameterType="String">
|
|||
|
|
+ update t_wather_warn set state='0' where city=#{city}
|
|||
|
|
+ </update>
|
|||
|
|
+
|
|||
|
|
+</mapper>
|
|||
|
|
\ No newline at end of file
|
|||
|
|
Index: securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/schedule/ScheduleClassMettingDeviceState.java
|
|||
|
|
IDEA additional info:
|
|||
|
|
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
|
|||
|
|
<+>UTF-8
|
|||
|
|
===================================================================
|
|||
|
|
--- securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/schedule/ScheduleClassMettingDeviceState.java (date 1677674835398)
|
|||
|
|
+++ securityControl-modules/securityControl-task/src/main/java/com/securityControl/task/schedule/ScheduleClassMettingDeviceState.java (date 1677674835398)
|
|||
|
|
@@ -0,0 +1,35 @@
|
|||
|
|
+package com.securityControl.task.schedule;
|
|||
|
|
+
|
|||
|
|
+import com.securityControl.common.core.utils.aes.DateTimeHelper;
|
|||
|
|
+import com.securityControl.task.service.DeviceService;
|
|||
|
|
+import com.securityControl.task.service.TaskService;
|
|||
|
|
+import org.quartz.Job;
|
|||
|
|
+import org.quartz.JobExecutionContext;
|
|||
|
|
+import org.quartz.JobExecutionException;
|
|||
|
|
+import org.slf4j.Logger;
|
|||
|
|
+import org.slf4j.LoggerFactory;
|
|||
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|||
|
|
+
|
|||
|
|
+/**
|
|||
|
|
+ * 更新当日站班会球机状态数据
|
|||
|
|
+ */
|
|||
|
|
+public class ScheduleClassMettingDeviceState implements Job {
|
|||
|
|
+
|
|||
|
|
+ private static final Logger log = LoggerFactory.getLogger(ScheduledDeviceMsg.class);
|
|||
|
|
+
|
|||
|
|
+ @Autowired
|
|||
|
|
+ private DeviceService service;
|
|||
|
|
+ @Autowired
|
|||
|
|
+ private TaskService taskService;
|
|||
|
|
+ public void execute(JobExecutionContext context) throws JobExecutionException {
|
|||
|
|
+ try{
|
|||
|
|
+ log.info("开始更新日计划设备信息>>>");
|
|||
|
|
+ taskService.updateTask("bns_device_state","1", DateTimeHelper.getNowTime());
|
|||
|
|
+ service.updateClassDeviceState();
|
|||
|
|
+ log.info("日计划设备信息更新完成>>>");
|
|||
|
|
+ } catch (Exception e){
|
|||
|
|
+ log.error(e.toString(),e);
|
|||
|
|
+ }
|
|||
|
|
+ }
|
|||
|
|
+
|
|||
|
|
+}
|