Commit cba37d01 authored by 赵啸非's avatar 赵啸非

添加服务追踪

parent 514e8130
......@@ -44,7 +44,6 @@
{type: "selection", width: 60},
{type: "index",label: "序号",width: 50},
{label: "设备ID", prop: "deviceId"},
{label: "设备名称", prop: "deviceName"},
......@@ -60,10 +59,9 @@
{label: "楼栋", prop: "build",formatter: this.formatter},
/* {label: "超时时间", prop: "timeOutPeriod",formatter: this.formatter},
{label: "超时时间", prop: "timeOutPeriod",formatter: this.formatter},
{label: "临近时间", prop: "nearTime",formatter: this.formatter},
{label: "临近时间", prop: "nearTime",formatter: this.formatter},*/
{label: "设备状态 ", prop: "deviceStatus",formatter: this.formatter},
......@@ -73,7 +71,7 @@
width: 240,
formatter: row => {
return (
<table-buttons noAdd noEdit row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
<table-buttons noAdd noEdit noDel row={row} onEdit={this.toEdit} onView={this.toView} onDel={this.toDel} />
);
}
}
......
......@@ -32,9 +32,10 @@
<profiles.log.level>info</profiles.log.level>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.php.host>http://192.168.0.98:8090</profiles.php.host>
<profiles.sms.smsSendUrl>http://sms.wx3.com.cn</profiles.sms.smsSendUrl>
<profiles.sms.smsSendUrl>http://sms.wx3.com.cn/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>ADsUXLrS81vZDU95</profiles.sms.apiId>
<profiles.hik.host>8.136.255.30:8001</profiles.hik.host>
<profiles.hik.protocol>http://</profiles.hik.protocol>
<profiles.hik.appKey>25128371</profiles.hik.appKey>
<profiles.hik.appSecret>2m9RcPJOKq5j2QPQM4v5</profiles.hik.appSecret>
<profiles.hik.callback>http://8.136.255.30:11080/refined/hik/eventRcv</profiles.hik.callback>
......@@ -59,6 +60,7 @@
<profiles.sms.smsSendUrl>http://sms.wx3.com.cn</profiles.sms.smsSendUrl>
<profiles.sms.apiId>ADsUXLrS81vZDU95</profiles.sms.apiId>
<profiles.hik.host>8.136.255.30:8001</profiles.hik.host>
<profiles.hik.protocol>http://</profiles.hik.protocol>
<profiles.hik.appKey>25128371</profiles.hik.appKey>
<profiles.hik.appSecret>2m9RcPJOKq5j2QPQM4v5</profiles.hik.appSecret>
<profiles.hik.callback>http://8.136.255.30:11080/refined/hik/eventRcv</profiles.hik.callback>
......@@ -67,18 +69,27 @@
</properties>
</profile>
<profile>
<id>product</id>
<id>yibin</id>
<properties>
<profiles.active>test</profiles.active>
<profiles.active>yibin</profiles.active>
<profiles.server.port>21080</profiles.server.port>
<profiles.server.port>21080</profiles.server.port>
<profiles.server.path>/refined</profiles.server.path>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.server-addr>172.15.28.120:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>INFO</profiles.log.level>
<package.environment>test</package.environment>
<profiles.log.path>/mortals/app/logs</profiles.log.path>
<profiles.log.level>info</profiles.log.level>
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.php.host>http://172.15.28.116:8090</profiles.php.host>
<profiles.sms.smsSendUrl>http://172.15.28.113:8901/api/index/index</profiles.sms.smsSendUrl>
<profiles.sms.apiId>ADsUXLrS81vZDU95</profiles.sms.apiId>
<profiles.hik.host>10.12.177.245:443</profiles.hik.host>
<profiles.hik.protocol>https://</profiles.hik.protocol>
<profiles.hik.appKey>25128371</profiles.hik.appKey>
<profiles.hik.appSecret>2m9RcPJOKq5j2QPQM4v5</profiles.hik.appSecret>
<profiles.hik.callback>http://10.12.185.213:11080/refined/hik/eventRcv</profiles.hik.callback>
<package.environment>build</package.environment>
<skipUi>false</skipUi>
</properties>
</profile>
......
......@@ -3,12 +3,15 @@ package com.mortals.xhx.base.system.task.web;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.task.model.TaskQuery;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -48,19 +51,26 @@ public class TaskController extends BaseCRUDJsonBodyMappingController<TaskServic
status.put("status", TaskExcuteStatusEnum.getEnumMap());
status.put("excuteStrategy", TaskExcuteStrategyEnum.getEnumMap());
status.put("interimExcuteStatus", TaskInterimExcuteStatusEnum.getEnumMap());
Set<String> existServiceSet = this.service.find(new TaskQuery()).stream().map(i -> i.getExcuteService()).collect(Collectors.toSet());
Map<String, ITaskExcuteService> serviceMap = GlobalSysInfo.getBeansByType(ITaskExcuteService.class);
Map<String, Object> serviceList = new HashMap<String, Object>();
if (serviceMap != null) {
try {
serviceMap.forEach((k, v) -> {
if (null != v) {
serviceList.put(k, k);
if(!existServiceSet.contains(k)){
serviceList.put(k, k);
}
}
});
} catch (Exception ex) {
log.error("", ex);
}
}
model.put("excuteService", serviceList);
model.put(KEY_RESULT_DICT, status);
}
......
package com.mortals.xhx.busiz.req;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
......@@ -33,7 +34,7 @@ public class SmsThirdPartyReq {
/**
* 内容
*/
private String json;
private JSONObject json;
public static void main(String[] args) {
......@@ -42,7 +43,7 @@ public class SmsThirdPartyReq {
smsThirdPartyReq.setAppid("12");
smsThirdPartyReq.setPhone("31");
smsThirdPartyReq.setType("123");
smsThirdPartyReq.setJson("13213");
smsThirdPartyReq.setJson(new JSONObject());
System.out.println(JSON.toJSONString(smsThirdPartyReq));
......
......@@ -30,6 +30,7 @@ import com.mortals.xhx.module.hik.face.service.IHikPlanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
......@@ -41,7 +42,7 @@ import static com.mortals.xhx.common.key.ParamKey.PARAM_FACE_GROUP;
import static com.mortals.xhx.common.key.ParamKey.PARAM_FACE_GROUP_REGISTER;
//@Component
@Component
@Slf4j
public class SubEventStartedService implements IApplicationStartedService {
......@@ -79,8 +80,6 @@ public class SubEventStartedService implements IApplicationStartedService {
//查询本地指定人脸分组 如果没有则添加 并更新
String groupStr = GlobalSysInfo.getParamValue(PARAM_FACE_GROUP, PARAM_FACE_GROUP_REGISTER);
List<String> groupList = StrUtil.split(groupStr, ",".charAt(0));
......
......@@ -121,6 +121,10 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService {
planRecognBlackReq.setThreshold(threshold);
//设置人脸分组
FaceGroupEntity faceGroupEntity = faceGroupService.selectOne(new FaceGroupQuery().name(PARAM_FACE_GROUP_REGISTER));
if (ObjectUtils.isEmpty(faceGroupEntity)) {
log.info("人脸组不存在!");
return;
}
List<String> faceGroupIndexCodes = new ArrayList<>();
faceGroupIndexCodes.add(faceGroupEntity.getIndexCode());
planRecognBlackReq.setFaceGroupIndexCodes(faceGroupIndexCodes);
......@@ -147,7 +151,7 @@ public class CreateBlackPlanToHikByDayTaskImpl implements ITaskExcuteService {
//更新计划
planRecognBlackReq.setIndexCode(planRecognWhiteInfo.getIndexCode());
Rest<Boolean> planRecognWhiteUpdateRest = hikPlanService.planRecognWhiteUpdate(planRecognBlackReq);
if (planRecognWhiteUpdateRest.getCode() == YesNoEnum.YES.getValue()&&planRecognWhiteUpdateRest.getData()) {
if (planRecognWhiteUpdateRest.getCode() == YesNoEnum.YES.getValue() && planRecognWhiteUpdateRest.getData()) {
FacePlanEntity whitePlan = facePlanService.selectOne(new FacePlanQuery().indexCode(planRecognWhiteInfo.getIndexCode()));
whitePlan.setUpdateTime(new Date());
......
......@@ -10,6 +10,7 @@ import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.hik.camera.model.req.CameraListReq;
import com.mortals.xhx.module.hik.camera.model.req.CameraReq;
import com.mortals.xhx.module.hik.camera.model.rsp.CameraDataInfo;
import com.mortals.xhx.module.hik.camera.model.rsp.CameraInfo;
import com.mortals.xhx.module.hik.camera.service.IHikCameraService;
......@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -44,51 +46,49 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
}
/**
* "altitude": null,
* "cameraIndexCode": "d271545ad77c4fb28728101d765d76bb",
* "cameraName": "Camera 02",
* "cameraType": 0,
* "cameraTypeName": "枪机",
* "capabilitySet": "event_audio,io,MixMixedRoot,MixRoot,event_veh_recognition,face,event_vss,record,vss,ptz,event_io,net,maintenance,event_device,status,event_body,event_face,event_rule,event_veh",
* "capabilitySetName": "音频事件能力,IO能力,,,车辆识别事件能力,人脸识别能力,视频事件能力,录像能力,视频能力,云台能力,IO事件能力,网络参数配置能力,设备维护能力,设备事件能力,状态能力,人体事件能力,人脸事件能力,行为分析事件能力,车辆事件能力",
* "intelligentSet": null,
* "intelligentSetName": null,
* "channelNo": "2",
* "channelType": "analog",
* "channelTypeName": "模拟通道",
* "createTime": "2023-04-10T13:59:08.194+08:00",
* "encodeDevIndexCode": "f01277c1d6f842b581e6931fa7cc34b4",
* "encodeDevResourceType": null,
* "encodeDevResourceTypeName": null,
* "gbIndexCode": null,
* "installLocation": null,
* "keyBoardCode": null,
* "latitude": null,
* "longitude": null,
* "pixel": null,
* "ptz": null,
* "ptzName": null,
* "ptzController": null,
* "ptzControllerName": null,
* "recordLocation": null,
* "recordLocationName": null,
* "regionIndexCode": "root000000",
* "status": null,
* "statusName": null,
* "transType": 1,
* "transTypeName": "TCP",
* "treatyType": null,
* "treatyTypeName": null,
* "viewshed": null,
* "updateTime": "2023-04-10T15:11:56.446+08:00"
* "altitude": null,
* "cameraIndexCode": "d271545ad77c4fb28728101d765d76bb",
* "cameraName": "Camera 02",
* "cameraType": 0,
* "cameraTypeName": "枪机",
* "capabilitySet": "event_audio,io,MixMixedRoot,MixRoot,event_veh_recognition,face,event_vss,record,vss,ptz,event_io,net,maintenance,event_device,status,event_body,event_face,event_rule,event_veh",
* "capabilitySetName": "音频事件能力,IO能力,,,车辆识别事件能力,人脸识别能力,视频事件能力,录像能力,视频能力,云台能力,IO事件能力,网络参数配置能力,设备维护能力,设备事件能力,状态能力,人体事件能力,人脸事件能力,行为分析事件能力,车辆事件能力",
* "intelligentSet": null,
* "intelligentSetName": null,
* "channelNo": "2",
* "channelType": "analog",
* "channelTypeName": "模拟通道",
* "createTime": "2023-04-10T13:59:08.194+08:00",
* "encodeDevIndexCode": "f01277c1d6f842b581e6931fa7cc34b4",
* "encodeDevResourceType": null,
* "encodeDevResourceTypeName": null,
* "gbIndexCode": null,
* "installLocation": null,
* "keyBoardCode": null,
* "latitude": null,
* "longitude": null,
* "pixel": null,
* "ptz": null,
* "ptzName": null,
* "ptzController": null,
* "ptzControllerName": null,
* "recordLocation": null,
* "recordLocationName": null,
* "regionIndexCode": "root000000",
* "status": null,
* "statusName": null,
* "transType": 1,
* "transTypeName": "TCP",
* "treatyType": null,
* "treatyTypeName": null,
* "viewshed": null,
* "updateTime": "2023-04-10T15:11:56.446+08:00"
*/
private void syncDevice() {
CameraListReq cameraListReq = new CameraListReq();
cameraListReq.setPageNo(1);
cameraListReq.setPageSize(200);
cameraListReq.setRegionIndexCode("root000000");
Rest<CameraDataInfo> rest = hikCameraService.findCameraList(cameraListReq);
if (rest.getCode() == YesNoEnum.YES.getValue()) {
List<CameraInfo> cameraDataInfoList = rest.getData().getList();
......@@ -142,103 +142,12 @@ public class SyncSiteDeviceTaskImpl implements ITaskExcuteService {
if (!ObjectUtils.isEmpty(delDeviceList)) {
log.info("设备删除,size:{}", delDeviceList.size());
deviceService.remove(delDeviceList,null);
deviceService.remove(delDeviceList, null);
}
}
}else{
} else {
log.info("同步设备异常=>{}", JSON.toJSONString(rest));
}
// planRecognBlackListReq.set
//hikCameraService.findPlanRecognBlackList()
/* SitePdu sitePdu = new SitePdu();
sitePdu.setId(1L);
Rest<List<SitePdu>> siteRest = siteFeign.getFlatSitesBySiteId(sitePdu);
if (siteRest.getCode() == YesNoEnum.YES.getValue()) {
log.info("站点总数量:{}", siteRest.getData().size());
siteRest.getData().forEach(site -> {
log.info("站点名称:{}",site.getSiteName());
DevicePdu devicePdu = new DevicePdu();
devicePdu.setProductCode("ybj");
devicePdu.setSize(-1);
Rest<RespData<List<DevicePdu>>> deviceRest = deviceFeign.list(devicePdu);
log.info("deviceRest:{}",JSON.toJSONString(deviceRest));
if (YesNoEnum.YES.getValue() == deviceRest.getCode()) {
List<DevicePdu> devicePduList = deviceRest.getData().getData();
log.info("样表机总数量:{}", devicePduList.size());
if (!ObjectUtils.isEmpty(devicePduList)) {
List<DeviceEntity> newDeviceList = devicePduList.stream().map(newDevice -> {
DeviceEntity deviceEntity = new DeviceEntity();
deviceEntity.initAttrValue();
BeanUtils.copyProperties(newDevice, deviceEntity, BeanUtil.getNullPropertyNames(newDevice));
return deviceEntity;
}).collect(Collectors.toList());
List<DeviceEntity> oldDeviceList = deviceService.find(new DeviceQuery().siteId(site.getId()));
Map<String, DeviceEntity> oldDeviceMap = oldDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
Map<String, DeviceEntity> newDeviceMap = newDeviceList.stream().collect(Collectors.toMap(x -> x.getDeviceCode(), y -> y, (o, n) -> n));
List<DeviceEntity> updateDeviceLsit = newDeviceList.stream().map(item -> {
if (oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setId(oldDeviceMap.get(item.getDeviceCode()).getId());
item.setDeviceId(item.getId());
item.setProductCode(oldDeviceMap.get(item.getDeviceCode()).getProductCode());
item.setProductName(oldDeviceMap.get(item.getDeviceCode()).getProductName());
item.setUpdateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
List<DeviceEntity> saveDeviceList = newDeviceList.stream().map(item -> {
if (!oldDeviceMap.containsKey(item.getDeviceCode())) {
item.setDeviceId(item.getId());
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
//做差集
List<Long> delDeviceList = oldDeviceList.stream().map(item -> {
if (!newDeviceMap.containsKey(item.getDeviceCode())) {
return item.getId();
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateDeviceLsit)) {
log.info("设备更新,size:{}", updateDeviceLsit.size());
deviceService.update(updateDeviceLsit);
}
if (!ObjectUtils.isEmpty(saveDeviceList)) {
log.info("设备新增,size:{}", saveDeviceList.size());
deviceService.save(saveDeviceList);
}
if (!ObjectUtils.isEmpty(delDeviceList)) {
log.info("设备删除,size:{}", delDeviceList.size());
deviceService.remove(delDeviceList,null);
}
}
} else {
log.info("设备列表查询异常,{}", JSON.toJSONString(deviceRest));
}
});
} else {
log.info("站点列表查询异常,{}", JSON.toJSONString(siteRest));
}*/
}
......
......@@ -41,9 +41,9 @@ public class SyncSubmitAppointTaskImpl implements ITaskExcuteService {
@Override
public void excuteTask(ITask task) throws AppException {
log.info("同步提交预约任务");
log.debug("同步提交预约任务");
syncSubmitAppoint();
log.info("同步提交预约任务完成");
log.debug("同步提交预约任务完成");
}
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.module.care.service.impl;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
......@@ -117,20 +118,28 @@ public class CareRecordsServiceImpl extends AbstractCRUDServiceImpl<CareRecordsD
smsThirdPartyReq.setAppid(apiId);
smsThirdPartyReq.setPhone(careRecordsEntity.getContact());
smsThirdPartyReq.setType(ParamKey.SYS_PARAM_SMS_PERSON_CARE_TYPE);
Map<String, String> form = new HashMap<>();
EntityUtil.entityToMap(smsThirdPartyReq, form);
resp = HttpUtil.doPost(smsSendUrl, form);
smsThirdPartyReq.setJson(new JSONObject());
Map<String, Object> form = BeanUtil.beanToMap(smsThirdPartyReq, false, true);
log.info("sms req sendUrl:{} params:{}", smsSendUrl, JSON.toJSONString(form));
resp = cn.hutool.http.HttpUtil.post(smsSendUrl, form);
log.info("sms resp:{}", resp);
// resp = HttpUtil.doPost(smsSendUrl, form);
ApiSmsResp<Void> apiSmsResp = JSON.parseObject(resp, new TypeReference<ApiSmsResp<Void>>() {
});
//更新发送数量
CareRecordsQuery condition = new CareRecordsQuery();
condition.setId(careRecordsEntity.getId());
condition.setSmsCountIncrement(1);
condition.setCareCount(1);
if (apiSmsResp.getCode() == YesNoEnum.YES.getValue()) {
//更新发送数量
CareRecordsQuery condition = new CareRecordsQuery();
condition.setId(careRecordsEntity.getId());
condition.setSmsCountIncrement(1);
this.update(condition, context);
return Rest.ok();
} else {
throw new AppException(apiSmsResp.getMessage());
this.update(condition, context);
return Rest.fail(apiSmsResp.getMessage());
}
} catch (Exception e) {
......
......@@ -496,7 +496,7 @@ public class DeviceEntity extends DeviceVo {
this.deviceMac = "";
this.deviceLocation = "2";
this.deviceLocation = "";
this.lon = "";
......
......@@ -8,4 +8,10 @@ import java.util.List;
public class CameraListReq {
private int pageNo;
private int pageSize;
private String cameraIndexCodes;
private String encodeDevIndexCode;
private String regionIndexCode;
}
\ No newline at end of file
package com.mortals.xhx.module.hik.camera.model.req;
import java.util.List;
import lombok.Data;
@Data
public class CameraReq{
private List<String> regionIndexCodes;
private String orderType;
private int pageNo;
private String name;
private List<String> authCodes;
private int pageSize;
private String orderBy;
private List<ExpressionsItem> expressions;
private boolean isSubRegion;
}
\ No newline at end of file
package com.mortals.xhx.module.hik.camera.model.req;
import java.util.List;
import lombok.Data;
@Data
public class ExpressionsItem{
private List<String> values;
private String key;
private int operator;
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.mortals.xhx.module.hik.camera.service;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.camera.model.req.CameraListReq;
import com.mortals.xhx.module.hik.camera.model.req.CameraReq;
import com.mortals.xhx.module.hik.camera.model.rsp.CameraDataInfo;
/**
......
......@@ -8,6 +8,7 @@ import com.mortals.framework.common.Rest;
import com.mortals.xhx.module.hik.AbstractHikService;
import com.mortals.xhx.module.hik.HikApiRest;
import com.mortals.xhx.module.hik.camera.model.req.CameraListReq;
import com.mortals.xhx.module.hik.camera.model.req.CameraReq;
import com.mortals.xhx.module.hik.camera.model.rsp.CameraDataInfo;
import com.mortals.xhx.module.hik.camera.model.rsp.CameraInfo;
import com.mortals.xhx.module.hik.camera.service.IHikCameraService;
......@@ -30,7 +31,7 @@ public class HikCameraServiceImpl extends AbstractHikService implements IHikCame
@Override
public Rest<CameraDataInfo> findCameraList(CameraListReq cameraListReq) {
ArtemisConfig config = getArtemisConfig();
String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/cameras";
String getCamsApi = ARTEMIS_PATH + "/api/resource/v1/camera/advance/cameraList";
path.put(protocol, getCamsApi);
try {
log.info("camera list req=>{}", JSON.toJSONString(cameraListReq));
......
......@@ -66,5 +66,6 @@ php:
hik:
host: @profiles.hik.host@
appKey: @profiles.hik.appKey@
protocol: @profiles.hik.protocol@
appSecret: @profiles.hik.appSecret@
callback: @profiles.hik.callback@
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment