|
@@ -22,6 +22,7 @@ import com.ozs.service.entity.vo.ReqMsgAlarmVo;
|
|
import com.ozs.vo.RespGeoHazardMonitorVo;
|
|
import com.ozs.vo.RespGeoHazardMonitorVo;
|
|
import com.ozs.vo.RespMsgAlarmVo;
|
|
import com.ozs.vo.RespMsgAlarmVo;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import okhttp3.Response;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -398,7 +399,7 @@ public class GeoHazardMonitorTokenController {
|
|
BaseUser admin = baseUserService.getUserName("admin");
|
|
BaseUser admin = baseUserService.getUserName("admin");
|
|
lw.eq(BaseDeviceDynamicManagement::getCameraCode, reqDeviceVo.getCameraCode());
|
|
lw.eq(BaseDeviceDynamicManagement::getCameraCode, reqDeviceVo.getCameraCode());
|
|
BaseDeviceDynamicManagement baseDynamicManagement = baseDeviceDynamicManagementService.getOne(lw);
|
|
BaseDeviceDynamicManagement baseDynamicManagement = baseDeviceDynamicManagementService.getOne(lw);
|
|
- if (ObjectUtils.isEmpty(baseDynamicManagement)){
|
|
|
|
|
|
+ if (ObjectUtils.isEmpty(baseDynamicManagement)) {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "相机编码不存在");
|
|
jsonObject.put("message", "相机编码不存在");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
@@ -416,7 +417,7 @@ public class GeoHazardMonitorTokenController {
|
|
baseDynamicManagement.setUpdateBy(admin.getUserId());
|
|
baseDynamicManagement.setUpdateBy(admin.getUserId());
|
|
log.info("reqDeviceVo:{}", baseDynamicManagement);
|
|
log.info("reqDeviceVo:{}", baseDynamicManagement);
|
|
if (baseDeviceDynamicManagementService.updateById(baseDynamicManagement)) {
|
|
if (baseDeviceDynamicManagementService.updateById(baseDynamicManagement)) {
|
|
- BaseElectricityResume baseElectricityResume=new BaseElectricityResume();
|
|
|
|
|
|
+ BaseElectricityResume baseElectricityResume = new BaseElectricityResume();
|
|
baseElectricityResume.setCameraCode(baseDynamicManagement.getCameraCode());
|
|
baseElectricityResume.setCameraCode(baseDynamicManagement.getCameraCode());
|
|
baseElectricityResume.setElectricity(reqDeviceVo.getElectricity());
|
|
baseElectricityResume.setElectricity(reqDeviceVo.getElectricity());
|
|
baseElectricityResumeService.save(baseElectricityResume);
|
|
baseElectricityResumeService.save(baseElectricityResume);
|
|
@@ -447,18 +448,18 @@ public class GeoHazardMonitorTokenController {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@PostMapping("/cloud/state")
|
|
@PostMapping("/cloud/state")
|
|
- public String cloudState(@RequestParam("parameter") String parameter,HttpServletRequest request){
|
|
|
|
|
|
+ public String cloudState(@RequestParam("parameter") String parameter, HttpServletRequest request) {
|
|
JSONObject jsonObject = new JSONObject();
|
|
JSONObject jsonObject = new JSONObject();
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
String token = apiTokenUtils.getGeoHazardMonitorToken(request);
|
|
log.info("token:{}", token);
|
|
log.info("token:{}", token);
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
if (StringUtils.isNotEmpty(token)) {
|
|
CloudState cloudState = new CloudState();
|
|
CloudState cloudState = new CloudState();
|
|
cloudState.setCreateTime(new Date());
|
|
cloudState.setCreateTime(new Date());
|
|
- if (cloudStateService.save(cloudState)){
|
|
|
|
|
|
+ if (cloudStateService.save(cloudState)) {
|
|
jsonObject.put("resultCode", 1);
|
|
jsonObject.put("resultCode", 1);
|
|
jsonObject.put("message", "成功");
|
|
jsonObject.put("message", "成功");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("resultCode", 0);
|
|
jsonObject.put("message", "新增数据失败");
|
|
jsonObject.put("message", "新增数据失败");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
return SM4Utils.encryptData_ECB(JSONObject.toJSONString(jsonObject), "4370780c9a8c43e5");
|
|
@@ -504,24 +505,29 @@ public class GeoHazardMonitorTokenController {
|
|
} catch (InterruptedException e) {
|
|
} catch (InterruptedException e) {
|
|
throw new RuntimeException(e);
|
|
throw new RuntimeException(e);
|
|
}
|
|
}
|
|
- String result;
|
|
|
|
String url = bakUrl + "/gb28181/api/invite?id=" + cameraCode + "&channel=" + channel + "&startTime=" + seconds + "&endTime=" + second;
|
|
String url = bakUrl + "/gb28181/api/invite?id=" + cameraCode + "&channel=" + channel + "&startTime=" + seconds + "&endTime=" + second;
|
|
try {
|
|
try {
|
|
- result = HttpClientUtil.get(url);
|
|
|
|
- log.info("-----alarmHistoryPlay----code--"+cameraCode+"---" + result);
|
|
|
|
- if ("200".equals(result)) {
|
|
|
|
- String path = apiSummary(cameraCode + "/" + channel + "/" + seconds + "-" + second);
|
|
|
|
- if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
|
|
|
|
- String codes = HttpUtils.sendGet(startRecording(cameraCode + "/" + channel + "/" + seconds + "-" + second));
|
|
|
|
- log.info("codes------>" + codes);
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
- // 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
|
|
|
|
- String formattedDate = sdf.format(alarmDate);
|
|
|
|
- log.info("-----formattedDate-----------" + formattedDate);
|
|
|
|
- String records = getQueryRecords(cameraCode + "/" + channel + "/" + seconds + "-" + second, formattedDate, "mp4");
|
|
|
|
- log.info("-----records-----------" + records);
|
|
|
|
- return records;
|
|
|
|
|
|
+ Response response = HttpClientUtil.get(url);
|
|
|
|
+ if (response != null) {
|
|
|
|
+ log.info("-----alarmHistoryPlay----code--" + cameraCode + "---" + response.code());
|
|
|
|
+ log.info("-----alarmHistoryPlay----message--" + cameraCode + "---" + response.message());
|
|
|
|
+ log.info("-----alarmHistoryPlay----body--" + cameraCode + "---" + response.body());
|
|
|
|
+ if (200 == response.code()) {
|
|
|
|
+ String path = apiSummary(cameraCode + "/" + channel + "/" + seconds + "-" + second);
|
|
|
|
+ if (org.apache.commons.lang3.StringUtils.isNotEmpty(path)) {
|
|
|
|
+ String codes = HttpUtils.sendGet(startRecording(cameraCode + "/" + channel + "/" + seconds + "-" + second));
|
|
|
|
+ log.info("codes------>" + codes);
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ // 使用SimpleDateFormat将Date对象格式化为指定样式的字符串
|
|
|
|
+ String formattedDate = sdf.format(alarmDate);
|
|
|
|
+ log.info("-----formattedDate-----------" + formattedDate);
|
|
|
|
+ String records = getQueryRecords(cameraCode + "/" + channel + "/" + seconds + "-" + second, formattedDate, "mp4");
|
|
|
|
+ log.info("-----records-----------" + records);
|
|
|
|
+ return records;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }else {
|
|
|
|
+ return null;
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.info(e.getMessage());
|
|
log.info(e.getMessage());
|