|
|
|
@ -48,6 +48,7 @@ import com.inspect.patrol.service.impl.Video2NvrComponent; |
|
|
|
import com.inspect.patrol.vo.CameraVo; |
|
|
|
import com.inspect.system.base.domain.SysDictData; |
|
|
|
|
|
|
|
import java.sql.SQLIntegrityConstraintViolationException; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
@ -56,8 +57,9 @@ import java.util.stream.Collectors; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import com.sun.prism.paint.Color; |
|
|
|
import com.inspect.base.core.constant.Color; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.dao.DuplicateKeyException; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import springfox.documentation.annotations.ApiIgnore; |
|
|
|
|
|
|
|
@ -446,38 +448,37 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
patrolPresetPos.setChannelCode(channel.getString("channelCode")); |
|
|
|
patrolPresetPos.setChannelType(channel.getString("channelType")); |
|
|
|
patrolPresetPos.setVideoNvrCode(eqpBook.getString("videoNvrCode")); |
|
|
|
JSONObject basePresetId; |
|
|
|
JSONObject basePreset; |
|
|
|
String snap; |
|
|
|
if (patrolPresetPos.getPatrolPointId() == null) { |
|
|
|
ajaxResult = this.basedataStdPatrolPointService.queryById(patrolPresetPos.getStdParolPointId()); |
|
|
|
//qinyl |
|
|
|
basePresetId = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult)).getJSONObject("data"); |
|
|
|
basePreset = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult)).getJSONObject("data"); |
|
|
|
ajaxResult = this.basedataDeviceService.queryById(patrolPresetPos.getDeviceId()); |
|
|
|
JSONObject device = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult)).getJSONObject("data"); |
|
|
|
snap = device.getString("areaId"); |
|
|
|
String stdPatrolPointId = patrolPresetPos.getStdParolPointId(); |
|
|
|
JSONObject paramJson = (new JSONObject()) |
|
|
|
.fluentPut("deviceId", patrolPresetPos.getDeviceId()) |
|
|
|
.fluentPut("patrolContent", basePresetId.getString("patrolContent")) |
|
|
|
.fluentPut("patrolContent", basePreset.getString("patrolContent")) |
|
|
|
.fluentPut("purpose", INSERT_PATROL_POINT_PURPOSE) |
|
|
|
.fluentPut("areaId", snap) |
|
|
|
.fluentPut("stdParolPointId", stdPatrolPointId) |
|
|
|
.fluentPut("deviceTypeId", device.getString("deviceTypeId")) |
|
|
|
.fluentPut("lowerValue", basePresetId.getString("lowerValue")) |
|
|
|
.fluentPut("alarmThreshold", basePresetId.getString("alarmThreshold")) |
|
|
|
.fluentPut("upperValue", basePresetId.getString("upperValue")) |
|
|
|
.fluentPut("algSubtypeIds", basePresetId.getString("algSubtypeIds")) |
|
|
|
.fluentPut("patrolPointName", device.getString("deviceName") + "_" + basePresetId.getString("stdPatrolPointName")); |
|
|
|
.fluentPut("lowerValue", basePreset.getString("lowerValue")) |
|
|
|
.fluentPut("alarmThreshold", basePreset.getString("alarmThreshold")) |
|
|
|
.fluentPut("upperValue", basePreset.getString("upperValue")) |
|
|
|
.fluentPut("algSubtypeIds", basePreset.getString("algSubtypeIds")) |
|
|
|
.fluentPut("patrolPointName", device.getString("deviceName") + "_" + basePreset.getString("stdPatrolPointName")); |
|
|
|
ajaxResult = this.basedataPatrolPointService.add(paramJson); |
|
|
|
JSONObject patrolPoint = JSONObject.parseObject(JSONObject.toJSONString(ajaxResult)); |
|
|
|
patrolPresetPos.setPatrolPointId(patrolPoint.getLong("data")); |
|
|
|
} |
|
|
|
|
|
|
|
basePresetId = null; |
|
|
|
|
|
|
|
Integer basePresetId = null; |
|
|
|
try { |
|
|
|
this.basedataPatrolPointService.UpPatrolPointModel((new JSONObject()).fluentPut("patrolPointId", patrolPresetPos.getPatrolPointId())); |
|
|
|
Integer basePresetId2 = this.insertBasePreset(patrolPresetPos); |
|
|
|
basePresetId = this.insertBasePreset(patrolPresetPos); |
|
|
|
SnapModel snapModel = new SnapModel(); |
|
|
|
snapModel.setCode(patrolPresetPos.getChannelCode()); |
|
|
|
snapModel.setPatrolDeviceCode(patrolPresetPos.getPatrolDeviceCode()); |
|
|
|
@ -492,21 +493,26 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
logger.info("[PRESET] 预置位编码不能为空!: {}", patrolPresetPos.getPresetPosCode()); |
|
|
|
throw new ServiceException("预置位编码不能为空!"); |
|
|
|
} else { |
|
|
|
logger.info(Color.GREEN + "[PRESET] INSERT patrolPresetPos: {}" + Color.END, patrolPresetPos); |
|
|
|
int insertResId = patrolPresetPosService.insertPatrolPresetPos(patrolPresetPos); |
|
|
|
logger.info("[PRESET] insert insertResId: {}", insertResId); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
logger.info("[PRESET] patrolPresetPos: {} already added!", patrolPresetPos1.getPatrolPointId()); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
this.basedataPatrolPointService.remove(new Long[]{patrolPresetPos.getPatrolPointId()}); |
|
|
|
if (basePresetId != null) { |
|
|
|
this.basedataPatrolpointPresetService.remove(new Long[]{Long.valueOf(Long.parseLong(basePresetId + ""))}); |
|
|
|
logger.warn(Color.RED + "[PRESET] INSERT into patrolPresetPos Exception class: {}" + Color.END, e.getClass()); |
|
|
|
if (e.getClass().equals(DuplicateKeyException.class)) { |
|
|
|
logger.warn(Color.RED + "[PRESET] INSERT into patrolPresetPos Exception class!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1" + Color.END); |
|
|
|
return AjaxResult.fail(500, "该监测点已经绑定!"); |
|
|
|
} else { |
|
|
|
logger.warn("[PRESET] INSERT into patrolPresetPos 2: {}", e.getMessage()); |
|
|
|
this.basedataPatrolPointService.remove(new Long[]{patrolPresetPos.getPatrolPointId()}); |
|
|
|
if (basePresetId != null) { |
|
|
|
this.basedataPatrolpointPresetService.remove(new Long[]{Long.parseLong(basePresetId + "")}); |
|
|
|
} |
|
|
|
throw new ServiceException("连接超时!"); |
|
|
|
} |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
throw new ServiceException("连接超时!"); |
|
|
|
} |
|
|
|
|
|
|
|
this.toSdkIrParam(patrolPresetPos, eqpBook); |
|
|
|
|