|
|
|
@ -58,6 +58,7 @@ import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
import com.inspect.base.core.constant.Color; |
|
|
|
import io.swagger.models.auth.In; |
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
|
import org.springframework.dao.DuplicateKeyException; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
@ -91,6 +92,8 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
IvsFeignService ivsFeignService; |
|
|
|
@Value("${gwb.url}") |
|
|
|
private String deviceUrl; |
|
|
|
@Value("${liveSIPB.url}") |
|
|
|
private String liveSIPBUrl; |
|
|
|
@Value("${sftp.ip}") |
|
|
|
private String ip; |
|
|
|
@Value("${sftp.port}") |
|
|
|
@ -99,6 +102,8 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
private String username; |
|
|
|
@Value("${sftp.password}") |
|
|
|
private String password; |
|
|
|
@Value("${ivs.version:3800}") |
|
|
|
private String version; |
|
|
|
private final String INSERT_PATROL_POINT_PURPOSE = "数据分析,在线监视"; |
|
|
|
private final String SELECT_PRESET_CODE_CLASS_BIND = "1"; |
|
|
|
private final String SELECT_PRESET_CODE_CLASS_STOP = "2"; |
|
|
|
@ -495,6 +500,42 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
logger.info(Color.GREEN + "[PRESET] INSERT patrolPresetPos: {}" + Color.END, patrolPresetPos); |
|
|
|
int insertResId = patrolPresetPosService.insertPatrolPresetPos(patrolPresetPos); |
|
|
|
logger.info("[PRESET] insert insertResId: {}", insertResId); |
|
|
|
logger.info("红外添加完成==》往1800中同步配置,version{}", version); |
|
|
|
//往1800中写规则 |
|
|
|
if (version.equals("1800")) { |
|
|
|
PatrolPresetParam patrolPresetParam = patrolPresetPos.getPresetParamList().get(0); |
|
|
|
final String temperUrl = liveSIPBUrl + "/api/v1/device/setHwConfig"; |
|
|
|
logger.info("=========temperUrl====={}", temperUrl); |
|
|
|
JSONObject temperParam = new JSONObject(); |
|
|
|
temperParam.put("presetId", patrolPresetPos.getPresetPosCode()); |
|
|
|
temperParam.put("name", patrolPresetParam.getMeasureName()); |
|
|
|
temperParam.put("cameraCode", patrolPresetPos.getChannelCode()); |
|
|
|
List<Map<String, Object>> polygonList = new ArrayList<>(); |
|
|
|
String[] split = patrolPresetParam.getCoordinate().split(StringUtils.COMMA); |
|
|
|
if(split.length == 10){ |
|
|
|
Map<String, Object> point = new HashMap<>(); |
|
|
|
point.put("x", (int)((Double.parseDouble(split[0])/Double.parseDouble(split[8])) * 8190)); |
|
|
|
point.put("y", (int)((Double.parseDouble(split[1])/Double.parseDouble(split[9])) * 8190)); |
|
|
|
Map<String, Object> point1 = new HashMap<>(); |
|
|
|
point1.put("x", (int)((Double.parseDouble(split[2])/Double.parseDouble(split[8])) * 8190)); |
|
|
|
point1.put("y", (int)((Double.parseDouble(split[3])/Double.parseDouble(split[9])) * 8190)); |
|
|
|
Map<String, Object> point2 = new HashMap<>(); |
|
|
|
point2.put("x", (int)((Double.parseDouble(split[4])/Double.parseDouble(split[8])) * 8190)); |
|
|
|
point2.put("y", (int)((Double.parseDouble(split[5])/Double.parseDouble(split[9])) * 8190)); |
|
|
|
Map<String, Object> point3 = new HashMap<>(); |
|
|
|
point3.put("x", (int)((Double.parseDouble(split[6])/Double.parseDouble(split[8])) * 8190)); |
|
|
|
point3.put("y", (int)((Double.parseDouble(split[7])/Double.parseDouble(split[9])) * 8190)); |
|
|
|
polygonList.add(point); |
|
|
|
polygonList.add(point1); |
|
|
|
polygonList.add(point2); |
|
|
|
polygonList.add(point3); |
|
|
|
temperParam.put("polygonList", polygonList); |
|
|
|
} |
|
|
|
logger.info("=========temperParam{}", temperParam); |
|
|
|
final String temperUrlRes = HttpClientUtils.sendPostAgain(temperUrl, temperParam.toString()); |
|
|
|
logger.info("[infra_1800] prePointExec temperUrlRes: {}", temperUrlRes); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
logger.info("[PRESET] patrolPresetPos: {} already added!", patrolPresetPos1.getPatrolPointId()); |
|
|
|
@ -568,6 +609,7 @@ public class PatrolPresetPosController extends BaseController { |
|
|
|
map.put("points", points.toJSONString()); |
|
|
|
map.put("coordinate", split[split.length - 2] + "*" + split[split.length - 1]); |
|
|
|
this.remoteInvokeService.invoke("IR_SET", patrolPresetPos.getPatrolDeviceCode().split("#")[0], map); |
|
|
|
|
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
} |
|
|
|
|