bug修复
This commit is contained in:
parent
a7578d20de
commit
2c47db34f5
@ -1,14 +1,15 @@
|
||||
package com.zhgd.xmgl.async;
|
||||
|
||||
import com.zhgd.xmgl.call.HikvisionCall;
|
||||
import com.zhgd.xmgl.call.HousingDataCall;
|
||||
import com.zhgd.xmgl.call.WkServiceuCall;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectEnterprise;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectUfaceConfig;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.*;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -38,41 +39,45 @@ public class AsyncWorker {
|
||||
private IProjectUfaceConfigService projectUfaceConfigService;
|
||||
@Autowired
|
||||
private WkServiceuCall wkServiceuCall;
|
||||
@Autowired
|
||||
HikvisionCall hikvisionCall;
|
||||
|
||||
/**
|
||||
* 批量数据发送任务
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void sendBatchWorkerInfo(Map<String,Object> map) {
|
||||
public void sendBatchWorkerInfo(Map<String, Object> map) {
|
||||
try {
|
||||
List<WorkerInfo> list=workerInfoMapper.selectSendWorkerList(map);
|
||||
if(list.size()>0){
|
||||
for (WorkerInfo info:list){
|
||||
housingDataCall.sendAddWork(info.getProjectSn(),info);
|
||||
List<WorkerInfo> list = workerInfoMapper.selectSendWorkerList(map);
|
||||
if (list.size() > 0) {
|
||||
for (WorkerInfo info : list) {
|
||||
housingDataCall.sendAddWork(info.getProjectSn(), info);
|
||||
}
|
||||
}
|
||||
log.info("--------------------------------批量发送人员信息执行完成-------------------------------");
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量数据发送任务
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void sendBatchWokerDev(Map<String, Object> map, ProjectUfaceConfig projectUfaceConfig,List<UfaceDev> devList) {
|
||||
public void sendBatchWokerDev(Map<String, Object> map, ProjectUfaceConfig projectUfaceConfig, List<UfaceDev> devList) {
|
||||
try {
|
||||
List<WorkerInfo> list=workerInfoMapper.selectProjectWorkerInfoList(map);
|
||||
if(list.size()>0){
|
||||
for (WorkerInfo info:list){
|
||||
projectUfaceConfigService.sendBatchWorkerInfo(info,projectUfaceConfig,devList);
|
||||
List<WorkerInfo> list = workerInfoMapper.selectProjectWorkerInfoList(map);
|
||||
if (list.size() > 0) {
|
||||
for (WorkerInfo info : list) {
|
||||
projectUfaceConfigService.sendBatchWorkerInfo(info, projectUfaceConfig, devList);
|
||||
}
|
||||
}
|
||||
Long userId=MapUtils.getLong(map,"userId");
|
||||
if(userId!=null) {
|
||||
Long userId = MapUtils.getLong(map, "userId");
|
||||
if (userId != null) {
|
||||
java.text.DateFormat format1 = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
Notice notice = new Notice();
|
||||
notice.setAccountId(userId);
|
||||
@ -83,67 +88,73 @@ public class AsyncWorker {
|
||||
noticeService.addNotice(notice, true);
|
||||
}
|
||||
log.info("--------------------------------批量向设备下发人员执行完成-------------------------------");
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个人员数据发送任务
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void sendWorkerInfoById(WorkerInfo info) {
|
||||
try {
|
||||
housingDataCall.sendAddWork(info.getProjectSn(),info);
|
||||
housingDataCall.sendAddWork(info.getProjectSn(), info);
|
||||
log.info("--------------------------------单个发送人员信息执行完成-------------------------------");
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员退场异步任务
|
||||
*
|
||||
* @param info 1 删除,2退场
|
||||
*/
|
||||
@Async("sendExitWorkerExecutor")
|
||||
public void sendExitWorkById(WorkerInfo info,Integer type) {
|
||||
public void sendExitWorkById(WorkerInfo info, Integer type) {
|
||||
try {
|
||||
housingDataCall.sendExitWork(info.getProjectSn(),info);
|
||||
housingDataCall.sendExitWork(info.getProjectSn(), info);
|
||||
log.info("--------------------------------单个发送人员退场执行完成-------------------------------");
|
||||
if(type==1) {
|
||||
if (type == 1) {
|
||||
//万科退场
|
||||
wkServiceuCall.removeWork(info.getProjectSn(), info);
|
||||
}else{
|
||||
} else {
|
||||
wkServiceuCall.sendAddWork(info.getProjectSn(), info);
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组编辑或修改
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void sendAddOrUpdateTeam(TeamInfo teamInfo, DepartmentInfo departmentInfo,Integer type) {
|
||||
public void sendAddOrUpdateTeam(TeamInfo teamInfo, DepartmentInfo departmentInfo, Integer type) {
|
||||
try {
|
||||
if(type==1) {
|
||||
if (type == 1) {
|
||||
housingDataCall.sendAddOrUpdateTeam(teamInfo.getProjectSn(), teamInfo.getId());
|
||||
//向万科平台发送数据
|
||||
wkServiceuCall.sendAddDepartmentGroup(teamInfo,null,1,teamInfo.getProjectSn());
|
||||
}else{
|
||||
wkServiceuCall.sendAddDepartmentGroup(teamInfo, null, 1, teamInfo.getProjectSn());
|
||||
} else {
|
||||
//向万科平台发送数据
|
||||
wkServiceuCall.sendAddDepartmentGroup(null,departmentInfo,2,teamInfo.getProjectSn());
|
||||
wkServiceuCall.sendAddDepartmentGroup(null, departmentInfo, 2, teamInfo.getProjectSn());
|
||||
}
|
||||
//log.info("--------------------------------单个发送班组执行完成-------------------------------");
|
||||
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向外部上传设备
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
@ -151,48 +162,73 @@ public class AsyncWorker {
|
||||
try {
|
||||
//向万科上传人脸设备
|
||||
wkServiceuCall.sentAddUfaceDev(ufaceDev);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个人员数据发送任务
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void sendAndOrEditWorkerInfo(WorkerInfo info) {
|
||||
try {
|
||||
wkServiceuCall.sendAddWork(info.getProjectSn(),info);
|
||||
wkServiceuCall.sendAddWork(info.getProjectSn(), info);
|
||||
log.info("--------------------------------单个发送人员信息执行完成-------------------------------");
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加企业
|
||||
*
|
||||
* @param enterpriseInfo
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void addEnterpriseInfo(EnterpriseInfo enterpriseInfo) {
|
||||
try {
|
||||
wkServiceuCall.addEnterpriseInfo(enterpriseInfo);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解除企业绑定
|
||||
*
|
||||
* @param projectEnterprise
|
||||
*/
|
||||
@Async("sendWorkerExecutor")
|
||||
public void removeEnterpriseInfo(ProjectEnterprise projectEnterprise) {
|
||||
try {
|
||||
wkServiceuCall.removeEnterpriseInfo(projectEnterprise);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加劳务人员-海康
|
||||
*
|
||||
* @param workerInfo
|
||||
*/
|
||||
@Async
|
||||
public void addWorkerForHikvision(WorkerInfo workerInfo) {
|
||||
//try {
|
||||
// hikvisionCall.addWorkerForHikvision(workerInfo);
|
||||
//} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
//}
|
||||
}
|
||||
|
||||
public void editWorkerForHikvision(WorkerInfo workerInfo) {
|
||||
//try {
|
||||
// hikvisionCall.editWorkerForHikvision(workerInfo);
|
||||
//} catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
184
src/main/java/com/zhgd/xmgl/call/HikvisionCall.java
Normal file
184
src/main/java/com/zhgd/xmgl/call/HikvisionCall.java
Normal file
@ -0,0 +1,184 @@
|
||||
package com.zhgd.xmgl.call;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.util.Base64Util;
|
||||
import com.zhgd.xmgl.util.HikvisionUtil;
|
||||
import com.zhgd.xmgl.util.PathUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class HikvisionCall {
|
||||
@Value("${upload.image.url.prefix:}")
|
||||
private String imageUrlPrefix;
|
||||
|
||||
public static String GetCameraPreviewURL() {
|
||||
|
||||
/**
|
||||
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
||||
*/
|
||||
ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口
|
||||
ArtemisConfig.appKey = "29180881"; // 密钥appkey
|
||||
ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret
|
||||
|
||||
/**
|
||||
* STEP2:设置OpenAPI接口的上下文
|
||||
*/
|
||||
final String ARTEMIS_PATH = "/artemis";
|
||||
|
||||
/**
|
||||
* STEP3:设置接口的URI地址
|
||||
*/
|
||||
final String previewURLsApi = ARTEMIS_PATH + "/api/video/v1/cameras/previewURLs";
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* STEP4:设置参数提交方式
|
||||
*/
|
||||
String contentType = "application/json";
|
||||
|
||||
/**
|
||||
* STEP5:组装请求参数
|
||||
*/
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("cameraIndexCode", "748d84750e3a4a5bbad3cd4af9ed5101");
|
||||
jsonBody.put("streamType", 0);
|
||||
jsonBody.put("protocol", "rtsp");
|
||||
jsonBody.put("transmode", 1);
|
||||
jsonBody.put("expand", "streamform=ps");
|
||||
String body = jsonBody.toJSONString();
|
||||
/**
|
||||
* STEP6:调用接口
|
||||
*/
|
||||
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null);// post请求application/json类型参数
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addWorkerForHikvision(WorkerInfo workerInfo) {
|
||||
|
||||
/**
|
||||
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
||||
*/
|
||||
ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口
|
||||
ArtemisConfig.appKey = "29180881"; // 密钥appkey
|
||||
ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret
|
||||
|
||||
/**
|
||||
* STEP2:设置OpenAPI接口的上下文
|
||||
*/
|
||||
final String ARTEMIS_PATH = "/artemis";
|
||||
|
||||
/**
|
||||
* STEP3:设置接口的URI地址
|
||||
*/
|
||||
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v2/person/single/add";
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* STEP4:设置参数提交方式
|
||||
*/
|
||||
String contentType = "application/json";
|
||||
|
||||
/**
|
||||
* STEP5:组装请求参数
|
||||
*/
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("personId", workerInfo.getId());
|
||||
jsonBody.put("personName", workerInfo.getWorkerName());
|
||||
jsonBody.put("gender", workerInfo.getSex());
|
||||
jsonBody.put("orgIndexCode", "todo");//todo
|
||||
jsonBody.put("birthday", workerInfo.getBirthday());
|
||||
jsonBody.put("phoneNo", workerInfo.getPhoneNumber());
|
||||
jsonBody.put("email", workerInfo.getPersonMail());
|
||||
jsonBody.put("certificateType", "111");
|
||||
jsonBody.put("certificateNo", workerInfo.getIdCard());
|
||||
jsonBody.put("jobNo", workerInfo.getPersonSn());
|
||||
ArrayList<HashMap<String, String>> faceList = new ArrayList<>();
|
||||
HashMap<String, String> faceMap = new HashMap<>();
|
||||
faceMap.put("faceData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(imageUrlPrefix + "/" + workerInfo.getFieldAcquisitionUrl())));
|
||||
faceList.add(faceMap);
|
||||
jsonBody.put("faces", faceList);
|
||||
String body = jsonBody.toJSONString();
|
||||
/**
|
||||
* STEP6:调用接口
|
||||
*/
|
||||
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null);// post请求application/json类型参数
|
||||
log.info("海康rs:{}", result);
|
||||
}
|
||||
|
||||
public void editWorkerForHikvision(WorkerInfo workerInfo) {
|
||||
/**
|
||||
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
||||
*/
|
||||
ArtemisConfig.host = "127.0.0.1:443"; // 平台的ip端口
|
||||
ArtemisConfig.appKey = "29180881"; // 密钥appkey
|
||||
ArtemisConfig.appSecret = "XO0wCAYGi4KV70ybjznx";// 密钥appSecret
|
||||
|
||||
/**
|
||||
* STEP2:设置OpenAPI接口的上下文
|
||||
*/
|
||||
final String ARTEMIS_PATH = "/artemis";
|
||||
|
||||
/**
|
||||
* STEP3:设置接口的URI地址
|
||||
*/
|
||||
final String previewURLsApi = ARTEMIS_PATH + "/api/resource/v1/person/single/update";
|
||||
Map<String, String> path = new HashMap<String, String>(2) {
|
||||
{
|
||||
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* STEP4:设置参数提交方式
|
||||
*/
|
||||
String contentType = "application/json";
|
||||
|
||||
/**
|
||||
* STEP5:组装请求参数
|
||||
*/
|
||||
JSONObject jsonBody = new JSONObject();
|
||||
jsonBody.put("personId", workerInfo.getId());
|
||||
jsonBody.put("personName", workerInfo.getWorkerName());
|
||||
jsonBody.put("gender", workerInfo.getSex());
|
||||
jsonBody.put("orgIndexCode", "todo");//todo
|
||||
jsonBody.put("birthday", workerInfo.getBirthday());
|
||||
jsonBody.put("phoneNo", workerInfo.getPhoneNumber());
|
||||
jsonBody.put("email", workerInfo.getPersonMail());
|
||||
jsonBody.put("certificateType", "111");
|
||||
jsonBody.put("certificateNo", workerInfo.getIdCard());
|
||||
jsonBody.put("jobNo", workerInfo.getPersonSn());
|
||||
ArrayList<HashMap<String, String>> faceList = new ArrayList<>();
|
||||
HashMap<String, String> faceMap = new HashMap<>();
|
||||
faceMap.put("faceData", Base64Util.convertFileToBase64(PathUtil.reviseSlash(imageUrlPrefix + "/" + workerInfo.getFieldAcquisitionUrl())));
|
||||
faceList.add(faceMap);
|
||||
jsonBody.put("faces", faceList);
|
||||
String body = jsonBody.toJSONString();
|
||||
/**
|
||||
* STEP6:调用接口
|
||||
*/
|
||||
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null);// post请求application/json类型参数
|
||||
//HikvisionUtil.doPost("https://"+previewURLsApi,)
|
||||
log.info("海康rs:{}", result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@ -203,12 +204,14 @@ public class Project implements Serializable {
|
||||
/**
|
||||
* 第三方安全帽用户名
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Excel(name = "第三方安全帽用户名", width = 15)
|
||||
@ApiModelProperty(value = "第三方安全帽用户名")
|
||||
private java.lang.String helmetUser;
|
||||
/**
|
||||
* 第三方安全帽网站密码
|
||||
*/
|
||||
@JsonIgnore
|
||||
@Excel(name = "第三方安全帽网站密码", width = 15)
|
||||
@ApiModelProperty(value = "第三方安全帽网站密码")
|
||||
private java.lang.String helmetPassword;
|
||||
@ -246,33 +249,44 @@ public class Project implements Serializable {
|
||||
@ApiModelProperty(value = "sj重点工程类型多选")
|
||||
private String keyProjectType;
|
||||
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "fms监控大屏username")
|
||||
private String fmsMonitoringScreenUsername;
|
||||
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "fms监控大屏key")
|
||||
private String fmsMonitoringScreenKey;
|
||||
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "品茗用户名")
|
||||
private String pinMingUsername;
|
||||
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "品茗密码")
|
||||
private String pinMingPassword;
|
||||
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "金筑工AppKey")
|
||||
private String jzgAppKey;
|
||||
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "金筑工AppSecret")
|
||||
private String jzgAppSecret;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "金筑工projectCode")
|
||||
private String jzgProjectCode;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "金筑工访问host")
|
||||
private String jzgHost;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "'携稳的appId'")
|
||||
private String xiwonAppId;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "'携稳的appSecret'")
|
||||
private String xiwonAppSecret;
|
||||
@ApiModelProperty(value = "bim的Url")
|
||||
private String bimUrl;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "广联达授权文件路径")
|
||||
private String gldLicPath;
|
||||
@ApiModelProperty(value = "新大屏地址(没有填则跳旧大屏)")
|
||||
@ -287,10 +301,15 @@ public class Project implements Serializable {
|
||||
private String bimCommandCenterUrl;
|
||||
@ApiModelProperty(value = "天气信息")
|
||||
private String weatherInfo;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "济南仁智测控账号")
|
||||
private String jnrzckAccount;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "济南仁智测控密码")
|
||||
private String jnrzckPw;
|
||||
@JsonIgnore
|
||||
@ApiModelProperty(value = "是否同步到海康")
|
||||
private Integer syncHikvision;
|
||||
|
||||
/**
|
||||
* runde平台token
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.zhgd.xmgl.modules.sprayrt.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -77,8 +76,7 @@ public class SprayRtDevServiceImpl extends ServiceImpl<SprayRtDevMapper, SprayRt
|
||||
if (d == null) {
|
||||
throw new OpenAlertException("设备sn不存在");
|
||||
}
|
||||
BeanUtil.copyProperties(sprayRtDev, d);
|
||||
sprayRtDevMapper.updateById(d);
|
||||
sprayRtDevMapper.update(sprayRtDev, new LambdaQueryWrapper<SprayRtDev>().eq(SprayRtDev::getDevSn, sprayRtDev.getDevSn()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -37,7 +37,7 @@
|
||||
wp.empty_pic2,
|
||||
wp.empty_pic3,
|
||||
wp.empty_pic4,
|
||||
wp.gross_time,
|
||||
wi.gross_time,
|
||||
wp.mod_date_time,
|
||||
wp.remarks
|
||||
FROM weigh_info wi
|
||||
|
||||
@ -312,6 +312,9 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
.eq(WorkerInfoDelete::getProjectSn, workerInfo.getProjectSn())
|
||||
.eq(WorkerInfoDelete::getIdCard, workerInfo.getIdCard())
|
||||
);
|
||||
//同步海康
|
||||
asyncWorker.editWorkerForHikvision(workerInfo);
|
||||
|
||||
return workerInfo;
|
||||
}
|
||||
|
||||
@ -368,6 +371,8 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
||||
govtOpenApiService.workerInfoAddSync(workerInfo);
|
||||
}
|
||||
asyncJiLianDa.saveWorkerInfo(workerInfo);
|
||||
|
||||
|
||||
return workerInfo;
|
||||
}
|
||||
|
||||
|
||||
50
src/main/java/com/zhgd/xmgl/util/HikvisionUtil.java
Normal file
50
src/main/java/com/zhgd/xmgl/util/HikvisionUtil.java
Normal file
@ -0,0 +1,50 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
import com.hikvision.artemis.sdk.Client;
|
||||
import com.hikvision.artemis.sdk.Request;
|
||||
import com.hikvision.artemis.sdk.Response;
|
||||
import com.hikvision.artemis.sdk.constant.Constants;
|
||||
import com.hikvision.artemis.sdk.enums.Method;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 海康接口
|
||||
*/
|
||||
@Slf4j
|
||||
public class HikvisionUtil {
|
||||
public static String doPost(String host, String path, String body, Map<String, String> querys, String appKey, String appSecret) {
|
||||
log.info("HikvisionUtil#doPost.url:{}", host + path);
|
||||
String responseStr = null;
|
||||
try {
|
||||
Map<String, String> headers = new HashMap();
|
||||
headers.put("Accept", "*/*");
|
||||
headers.put("Content-Type", "application/json");
|
||||
Request request = new Request(Method.POST_STRING, host, path, appKey, appSecret, Constants.DEFAULT_TIMEOUT);
|
||||
request.setHeaders(headers);
|
||||
request.setQuerys(querys);
|
||||
request.setStringBody(body);
|
||||
Response response = Client.execute(request);
|
||||
responseStr = getResponseResult(response);
|
||||
log.info("HikvisionUtil#doPost.getResponseResult:{}", responseStr);
|
||||
} catch (Exception var10) {
|
||||
var10.printStackTrace();
|
||||
}
|
||||
return responseStr;
|
||||
}
|
||||
|
||||
private static String getResponseResult(Response response) {
|
||||
String responseStr = null;
|
||||
int statusCode = response.getStatusCode();
|
||||
if (!String.valueOf(statusCode).startsWith("2") && !String.valueOf(statusCode).startsWith("3")) {
|
||||
//String msg = response.getErrorMessage();
|
||||
responseStr = response.getBody();
|
||||
} else {
|
||||
responseStr = response.getBody();
|
||||
}
|
||||
|
||||
return responseStr;
|
||||
}
|
||||
}
|
||||
20
src/main/java/com/zhgd/xmgl/util/PathUtil.java
Normal file
20
src/main/java/com/zhgd/xmgl/util/PathUtil.java
Normal file
@ -0,0 +1,20 @@
|
||||
package com.zhgd.xmgl.util;
|
||||
|
||||
public class PathUtil {
|
||||
/**
|
||||
* 删除多余的斜杠
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String reviseSlash(String path) {
|
||||
return path.replaceAll("([^:])(//+)", "$1/");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(reviseSlash("/home//foo/"));
|
||||
System.out.println(reviseSlash("/home/foo/"));
|
||||
System.out.println(reviseSlash("/homefoo//"));
|
||||
System.out.println(reviseSlash("http://192.168.34.221:19111/xmgl/weight/weighInfo/getNewestWeighInfo"));
|
||||
System.out.println(reviseSlash("http://192.168.34.221:19111/xmgl//weight/weighInfo/getNewestWeighInfo"));
|
||||
}
|
||||
}
|
||||
@ -108,3 +108,5 @@ bridgeProduceQrCodeUrl=http://192.168.34.173:8082/#/
|
||||
xiwon.url=http://openapi.xiwon588.com/
|
||||
#udp端口
|
||||
udp.port=51236
|
||||
#上传的图片的url前缀
|
||||
upload.image.url.prefix=http://192.168.34.221:9111/image/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user