4.25日部署服务器
parent
ccc03b8cb1
commit
0a4da40b6b
|
@ -7,6 +7,7 @@
|
||||||
<groupId>com.dkha</groupId>
|
<groupId>com.dkha</groupId>
|
||||||
<version>1.0-SNAPSHOT</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
<packaging>jar</packaging>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>face-server</artifactId>
|
<artifactId>face-server</artifactId>
|
||||||
|
@ -78,6 +79,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>mysql</groupId>
|
<groupId>mysql</groupId>
|
||||||
<artifactId>mysql-connector-java</artifactId>
|
<artifactId>mysql-connector-java</artifactId>
|
||||||
|
<version>5.1.38</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|
|
@ -1,12 +1,26 @@
|
||||||
package com.dkha.server.controllers;
|
package com.dkha.server.controllers;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.dkha.common.fileupload.MinioUtil;
|
import com.dkha.common.fileupload.MinioUtil;
|
||||||
import com.dkha.common.http.HttpUtil;
|
import com.dkha.common.http.HttpUtil;
|
||||||
|
import com.dkha.common.modules.vo.face.ApiSearchFaceRectVO;
|
||||||
import com.dkha.common.modules.vo.face.FaceResEntity;
|
import com.dkha.common.modules.vo.face.FaceResEntity;
|
||||||
import com.dkha.common.modules.vo.CompareFaceList;
|
import com.dkha.common.modules.vo.CompareFaceList;
|
||||||
|
import com.dkha.common.modules.vo.search.SearchPortraitVo;
|
||||||
|
import com.dkha.common.modules.vo.search.SearchRequestVo;
|
||||||
|
import com.dkha.common.modules.vo.search.SearchResultVo;
|
||||||
|
import com.dkha.common.page.PageParam;
|
||||||
import com.dkha.common.result.CommonResult;
|
import com.dkha.common.result.CommonResult;
|
||||||
import com.dkha.common.modules.vo.ReturnVO;
|
import com.dkha.common.modules.vo.ReturnVO;
|
||||||
import com.dkha.common.util.JsonUtil;
|
import com.dkha.common.util.JsonUtil;
|
||||||
|
import com.dkha.common.util.UtilValidate;
|
||||||
|
import com.dkha.server.mappers.PortraitMapper;
|
||||||
|
import com.dkha.server.modules.entities.Portrait;
|
||||||
|
import com.dkha.server.services.IPortraitService;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
@ -14,11 +28,14 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -33,12 +50,15 @@ public class FaceController extends CommonResult {
|
||||||
@Autowired
|
@Autowired
|
||||||
private HttpUtil httpUtil;
|
private HttpUtil httpUtil;
|
||||||
|
|
||||||
private Gson gson =new Gson();
|
@Autowired
|
||||||
|
private IPortraitService iPortraitService;
|
||||||
|
@Autowired
|
||||||
|
private PortraitMapper portraitMapper;
|
||||||
|
@Autowired
|
||||||
|
private Gson gson;
|
||||||
|
|
||||||
private int count ;
|
private int count ;
|
||||||
|
|
||||||
private Map<String,FaceResEntity> faceRes = new HashMap<>();
|
|
||||||
|
|
||||||
private List<FaceResEntity> facelist = new ArrayList<>();
|
private List<FaceResEntity> facelist = new ArrayList<>();
|
||||||
|
|
||||||
private List<CompareFaceList> compareFaceLists = new ArrayList<>();
|
private List<CompareFaceList> compareFaceLists = new ArrayList<>();
|
||||||
|
@ -137,27 +157,45 @@ public class FaceController extends CommonResult {
|
||||||
//System.out.println("发送信息结束");
|
//System.out.println("发送信息结束");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void sendWebsocket2(List<CompareFaceList> oncompareFacelist){
|
public void sendWebsocket2(List<CompareFaceList> oncompareFacelist){
|
||||||
compareFaceLists.clear();
|
compareFaceLists.clear();
|
||||||
compareFaceLists = oncompareFacelist;
|
// compareFaceLists = oncompareFacelist;
|
||||||
|
for (CompareFaceList com :oncompareFacelist){
|
||||||
|
if(UtilValidate.isNotEmpty(com.getName())){
|
||||||
|
//根据人脸名称去找rphoto
|
||||||
|
QueryWrapper<Portrait> queryWrapper=new QueryWrapper<>();
|
||||||
|
queryWrapper.eq("name",com.getName());
|
||||||
|
Portrait rphoto = iPortraitService.getBaseMapper().selectOne(queryWrapper);
|
||||||
|
System.out.println("rphoto"+rphoto);
|
||||||
|
com.setRphoto(rphoto.getUrl());
|
||||||
|
}
|
||||||
|
if(com.getXsd()>70) {
|
||||||
|
System.out.println("相似度为:" + com.getXsd() + "%,小于70");
|
||||||
|
compareFaceLists.add(com);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println(compareFaceLists);
|
||||||
WebSocketContral webSocketContral =new WebSocketContral();
|
WebSocketContral webSocketContral =new WebSocketContral();
|
||||||
webSocketContral.sendMessage(gson.toJson(oncompareFacelist));
|
webSocketContral.sendMessage(gson.toJson(compareFaceLists));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/compareList")
|
@PostMapping("/compareList")
|
||||||
public void compareList(
|
public void compareList(
|
||||||
@RequestBody List<CompareFaceList> compareFaceLists ){
|
@RequestBody List<CompareFaceList> faceLists ){
|
||||||
// String compareURL = apiServerPrefix + ApiUrlEnum.ALARMS_POSTURL.getUrl();
|
|
||||||
// ReturnVO returnVO = (ReturnVO) httpUtil.post(compareURL, list, ApiVO.class);
|
|
||||||
// CompareFaceList compareFaceList = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<CompareFaceList>() {});
|
|
||||||
// compareFaceLists.add(compareFaceList);
|
|
||||||
// return successResult(compareFaceLists);
|
|
||||||
compareFaceLists.clear();
|
compareFaceLists.clear();
|
||||||
for(CompareFaceList com: compareFaceLists ){
|
System.out.println("facelist"+faceLists);
|
||||||
compareFaceLists.add(com);
|
for (CompareFaceList com :faceLists){
|
||||||
|
if(UtilValidate.isNotEmpty(com.getName())){
|
||||||
|
//人脸数量
|
||||||
|
QueryWrapper<Portrait> queryWrapper=new QueryWrapper<>();
|
||||||
|
queryWrapper.select("url").eq("name",com.getName());
|
||||||
|
Portrait rphoto = portraitMapper.selectOne(queryWrapper);
|
||||||
|
System.out.println("rphoto:"+rphoto);
|
||||||
|
// com.setName(rphoto.getUrl());
|
||||||
}
|
}
|
||||||
|
// compareFaceLists.add(com);
|
||||||
|
}
|
||||||
|
System.out.println(compareFaceLists);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FaceResEntity> getFacelist() {
|
public List<FaceResEntity> getFacelist() {
|
||||||
|
|
|
@ -20,6 +20,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import org.apache.poi.ss.formula.functions.T;
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
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;
|
||||||
|
import org.springframework.context.ApplicationContextAware;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import javax.websocket.OnClose;
|
import javax.websocket.OnClose;
|
||||||
import javax.websocket.OnMessage;
|
import javax.websocket.OnMessage;
|
||||||
|
@ -52,6 +53,9 @@ public class WebSocketContral {
|
||||||
|
|
||||||
|
|
||||||
private Session session;
|
private Session session;
|
||||||
|
|
||||||
|
private FaceController faceController1;
|
||||||
|
|
||||||
private Gson gson =new Gson();
|
private Gson gson =new Gson();
|
||||||
|
|
||||||
private static CopyOnWriteArraySet<WebSocketContral> webSocketSet=new CopyOnWriteArraySet<WebSocketContral>();
|
private static CopyOnWriteArraySet<WebSocketContral> webSocketSet=new CopyOnWriteArraySet<WebSocketContral>();
|
||||||
|
@ -125,27 +129,28 @@ public class WebSocketContral {
|
||||||
//System.out.println(message);
|
//System.out.println(message);
|
||||||
if(UtilValidate.isNotEmpty(message))
|
if(UtilValidate.isNotEmpty(message))
|
||||||
{
|
{
|
||||||
|
log.info("【websocket消息】收到客户端消息:{}",message);
|
||||||
ReturnVO returnVO=gson.fromJson(message,ReturnVO.class);
|
ReturnVO returnVO=gson.fromJson(message,ReturnVO.class);
|
||||||
//System.out.println(message);
|
//System.out.println(message);
|
||||||
|
faceController1 =applicationContext.getBean(FaceController.class);
|
||||||
if(returnVO.getMessage().equals("okpro")) {
|
if(returnVO.getMessage().equals("okpro")) {
|
||||||
if (UtilValidate.isNotEmpty(returnVO.getData())) {
|
if (UtilValidate.isNotEmpty(returnVO.getData())) {
|
||||||
// List<FaceResEntity> facelist =gson.fromJson(gson.toJson(returnVO.getData()),List<FaceResEntity>.class);
|
// List<FaceResEntity> facelist =gson.fromJson(gson.toJson(returnVO.getData()),List<FaceResEntity>.class);
|
||||||
List<FaceResEntity> onfacelist = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<List<FaceResEntity>>() {});
|
List<FaceResEntity> onfacelist = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<List<FaceResEntity>>() {});
|
||||||
FaceController faceController = new FaceController();
|
faceController1.sendWebsocket1(onfacelist);
|
||||||
faceController.sendWebsocket1(onfacelist);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(returnVO.getMessage().equals("okplus")){
|
else if(returnVO.getMessage().equals("okplus")){
|
||||||
if (UtilValidate.isNotEmpty(returnVO.getData())) {
|
if (UtilValidate.isNotEmpty(returnVO.getData())) {
|
||||||
// List<FaceResEntity> facelist =gson.fromJson(gson.toJson(returnVO.getData()),List<FaceResEntity>.class);
|
// List<FaceResEntity> facelist =gson.fromJson(gson.toJson(returnVO.getData()),List<FaceResEntity>.class);
|
||||||
List<CompareFaceList> oncompareFaceLists = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<List<CompareFaceList>>() {});
|
List<CompareFaceList> oncompareFaceLists = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<List<CompareFaceList>>() {});
|
||||||
FaceController faceController = new FaceController();
|
// FaceController faceController = new FaceController();
|
||||||
faceController.sendWebsocket2(oncompareFaceLists);
|
faceController1.sendWebsocket2(oncompareFaceLists);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
log.info("【websocket消息】收到客户端消息:{}",message);
|
log.info("【websocket消息】收到客户端消息:{}","发送完成");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
ControlLibraryMidMapper controlLibraryMidMapper;
|
ControlLibraryMidMapper controlLibraryMidMapper;
|
||||||
@Autowired
|
@Autowired
|
||||||
ControlLibraryMidServiceImpl controlLibraryMidService;
|
ControlLibraryMidServiceImpl controlLibraryMidService;
|
||||||
|
@Autowired
|
||||||
|
FaceCameraServiceImpl faceCameraServiceImpl;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IPortraitService iPortraitService;
|
private IPortraitService iPortraitService;
|
||||||
|
|
||||||
|
@ -144,6 +145,11 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
for (String camerid : listcamera) {
|
for (String camerid : listcamera) {
|
||||||
ControlBayonetMid controlBayonetMid = new ControlBayonetMid();
|
ControlBayonetMid controlBayonetMid = new ControlBayonetMid();
|
||||||
FaceCameraEntity faceCamera = faceCameraService.getById(camerid);
|
FaceCameraEntity faceCamera = faceCameraService.getById(camerid);
|
||||||
|
System.out.println(faceCamera.getStatus());
|
||||||
|
if (faceCamera.getStatus().equals(YNEnums.NO.code)){
|
||||||
|
faceCameraServiceImpl.status(faceCamera.getIdFaceCamera(),true);
|
||||||
|
}
|
||||||
|
System.out.println(faceCamera.getStatus());
|
||||||
if (controlBayonetMidService.selectexistByCarmeID(camerid) == 0) {
|
if (controlBayonetMidService.selectexistByCarmeID(camerid) == 0) {
|
||||||
//依次判断摄像头是否添加到任务中
|
//依次判断摄像头是否添加到任务中
|
||||||
controlBayonetMid.setIsValid(YNEnums.YES.code);
|
controlBayonetMid.setIsValid(YNEnums.YES.code);
|
||||||
|
@ -183,23 +189,30 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
ctvo.setThreshold(taskvo.getControlThreshold());
|
ctvo.setThreshold(taskvo.getControlThreshold());
|
||||||
ctvo.setCameraId(camerList);
|
ctvo.setCameraId(camerList);
|
||||||
ctvo.setLibraryId(taskvo.getLibIds());
|
ctvo.setLibraryId(taskvo.getLibIds());
|
||||||
Map<String,Object> resultMap = ( Map<String,Object>) httpUtil.post(link+ApiUrlEnum.TASK_POSTURL.getUrl(), ctvo, Map.class);
|
// System.out.println("设置编码为:9249924");
|
||||||
if(resultMap!=null){
|
// Map<String,Object> resultMap = ( Map<String,Object>) httpUtil.post(link+ApiUrlEnum.TASK_POSTURL.getUrl(), ctvo, Map.class);
|
||||||
if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString()))
|
// if(resultMap!=null){
|
||||||
{
|
// if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString()))
|
||||||
Map<String,Object> data= (Map<String,Object>) resultMap.get("data");
|
// {
|
||||||
if(data!=null&&data.get("taskId")!=null){
|
// Map<String,Object> data= (Map<String,Object>) resultMap.get("data");
|
||||||
strTaskNo=data.get("taskId").toString();
|
// if(data!=null&&data.get("taskId")!=null){
|
||||||
}else
|
// strTaskNo=data.get("taskId").toString();
|
||||||
{
|
// }else
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!没有获取到任务编号");
|
// {
|
||||||
}
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!没有获取到任务编号");
|
||||||
}else {
|
// }
|
||||||
return new CommonResult(resultMap, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
// }else {
|
||||||
}
|
// return new CommonResult(resultMap, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
||||||
}else {
|
// }
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
// }else {
|
||||||
}
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
||||||
|
// }
|
||||||
|
// strTaskNo="9249924";
|
||||||
|
//后端处理taskID
|
||||||
|
Long testNo = System.currentTimeMillis();
|
||||||
|
String testNostring = testNo.toString();
|
||||||
|
System.out.println("设置编码为"+testNostring);
|
||||||
|
strTaskNo = testNostring;
|
||||||
|
|
||||||
ControlTask controlTask = new ControlTask();
|
ControlTask controlTask = new ControlTask();
|
||||||
controlTask.setTaskNo(strTaskNo);
|
controlTask.setTaskNo(strTaskNo);
|
||||||
|
@ -262,17 +275,24 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
return new CommonResult(null, SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "参数异常,非法的任务ID!");
|
return new CommonResult(null, SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "参数异常,非法的任务ID!");
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
boolean isDeleteApi = false;
|
boolean isDeleteApi = true;
|
||||||
//1. 调用平台API接口
|
//1. 调用平台API接口
|
||||||
Map<String, Object> resultMap = (Map<String, Object>) httpUtil.delete(link + ApiUrlEnum.TASK_POSTURL.getUrl() + "/" + controlOne.getTaskNo(), Map.class);
|
// Map<String, Object> resultMap = (Map<String, Object>) httpUtil.delete(link + ApiUrlEnum.TASK_POSTURL.getUrl() + "/" + controlOne.getTaskNo(), Map.class);
|
||||||
if (resultMap != null) {
|
// if (resultMap != null) {
|
||||||
if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())){
|
// if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())){
|
||||||
isDeleteApi=true;
|
// isDeleteApi=true;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API删除任务信息失败!");
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API删除任务信息失败!");
|
||||||
}
|
// }
|
||||||
if (isDeleteApi) {
|
if (isDeleteApi) {
|
||||||
|
List<FaceCameraEntity> listfaceCamera = controlTaskMapper.getCameraByTaskID(taskID);
|
||||||
|
for (FaceCameraEntity faceCameraEntity : listfaceCamera){
|
||||||
|
Long deleteID = faceCameraEntity.getIdFaceCamera();
|
||||||
|
if (faceCameraEntity.getStatus().equals(YNEnums.YES.code)){
|
||||||
|
faceCameraServiceImpl.status(deleteID,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 删除任务摄像头中间管理库
|
// 删除任务摄像头中间管理库
|
||||||
controlBayonetMidService.deletetaskandcarmerbytaskid(taskID);
|
controlBayonetMidService.deletetaskandcarmerbytaskid(taskID);
|
||||||
// 删除任务特征库中间管理库
|
// 删除任务特征库中间管理库
|
||||||
|
@ -321,18 +341,25 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
if (controlOne == null) {
|
if (controlOne == null) {
|
||||||
return new CommonResult(null, SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "参数异常,非法的任务ID!");
|
return new CommonResult(null, SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "参数异常,非法的任务ID!");
|
||||||
} else {
|
} else {
|
||||||
boolean isDeleteApi = false;
|
boolean isDeleteApi = true;
|
||||||
try{
|
try{
|
||||||
//1. 调用平台API接口
|
//1. 调用平台API接口
|
||||||
Map<String, Object> resultMap = (Map<String, Object>) httpUtil.delete(link + ApiUrlEnum.TASK_POSTURL.getUrl() + "/" + controlOne.getTaskNo(), Map.class);
|
// Map<String, Object> resultMap = (Map<String, Object>) httpUtil.delete(link + ApiUrlEnum.TASK_POSTURL.getUrl() + "/" + controlOne.getTaskNo(), Map.class);
|
||||||
if (resultMap != null) {
|
// if (resultMap != null) {
|
||||||
if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())) {
|
// if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())) {
|
||||||
isDeleteApi=true;
|
// isDeleteApi=true;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API删除任务信息失败!");
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API删除任务信息失败!");
|
||||||
}
|
// }
|
||||||
if (isDeleteApi) {
|
if (isDeleteApi) {
|
||||||
|
List<FaceCameraEntity> listfaceCamera = controlTaskMapper.getCameraByTaskID(taskID);
|
||||||
|
for (FaceCameraEntity faceCameraEntity : listfaceCamera){
|
||||||
|
Long deleteID = faceCameraEntity.getIdFaceCamera();
|
||||||
|
if (faceCameraEntity.getStatus().equals(YNEnums.YES.code)){
|
||||||
|
faceCameraServiceImpl.status(deleteID,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 更新本地数据库的状态为N
|
// 更新本地数据库的状态为N
|
||||||
controlOne.setIsValid(TaskStatusEnum.STOP.code);
|
controlOne.setIsValid(TaskStatusEnum.STOP.code);
|
||||||
this.updateById(controlOne);
|
this.updateById(controlOne);
|
||||||
|
@ -362,18 +389,25 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
if (controlOne == null) {
|
if (controlOne == null) {
|
||||||
return new CommonResult(null, SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "参数异常,非法的任务ID!");
|
return new CommonResult(null, SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "参数异常,非法的任务ID!");
|
||||||
} else {
|
} else {
|
||||||
boolean isDeleteApi = false;
|
boolean isDeleteApi = true;
|
||||||
try{
|
try{
|
||||||
//1. 调用平台API接口
|
//1. 调用平台API接口
|
||||||
Map<String, Object> resultMap = (Map<String, Object>) httpUtil.delete(link + ApiUrlEnum.TASK_POSTURL.getUrl() + "/" + controlOne.getTaskNo(), Map.class);
|
// Map<String, Object> resultMap = (Map<String, Object>) httpUtil.delete(link + ApiUrlEnum.TASK_POSTURL.getUrl() + "/" + controlOne.getTaskNo(), Map.class);
|
||||||
if (resultMap != null) {
|
// if (resultMap != null) {
|
||||||
if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())){
|
// if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())){
|
||||||
isDeleteApi=true;
|
// isDeleteApi=true;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API删除任务信息失败!");
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API删除任务信息失败!");
|
||||||
}
|
// }
|
||||||
if (isDeleteApi) {
|
if (isDeleteApi) {
|
||||||
|
List<FaceCameraEntity> listfaceCamera = controlTaskMapper.getCameraByTaskID(taskID);
|
||||||
|
for (FaceCameraEntity faceCameraEntity : listfaceCamera){
|
||||||
|
Long deleteID = faceCameraEntity.getIdFaceCamera();
|
||||||
|
if (faceCameraEntity.getStatus().equals(YNEnums.YES.code)){
|
||||||
|
faceCameraServiceImpl.status(deleteID,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 更新本地数据库的状态为暂停
|
// 更新本地数据库的状态为暂停
|
||||||
controlOne.setIsValid(TaskStatusEnum.SUSPEND.code);
|
controlOne.setIsValid(TaskStatusEnum.SUSPEND.code);
|
||||||
this.updateById(controlOne);
|
this.updateById(controlOne);
|
||||||
|
@ -409,6 +443,13 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
if (UtilValidate.isEmpty(listBayoneMid)) {
|
if (UtilValidate.isEmpty(listBayoneMid)) {
|
||||||
return new CommonResult(controlOne.getTaskName(), SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "恢复任务失败,该任务下没有查询到有效摄像头列表!");
|
return new CommonResult(controlOne.getTaskName(), SystemCode.ILLEGAL_ARGUMENT_EXCEPTION.code, "恢复任务失败,该任务下没有查询到有效摄像头列表!");
|
||||||
}
|
}
|
||||||
|
List<FaceCameraEntity> listfaceCamera = controlTaskMapper.getCameraByTaskID(taskID);
|
||||||
|
for (FaceCameraEntity faceCameraEntity : listfaceCamera){
|
||||||
|
Long deleteID = faceCameraEntity.getIdFaceCamera();
|
||||||
|
if (faceCameraEntity.getStatus().equals(YNEnums.NO.code)){
|
||||||
|
faceCameraServiceImpl.status(deleteID,true);
|
||||||
|
}
|
||||||
|
}
|
||||||
//根据任务ID获取人像中间库
|
//根据任务ID获取人像中间库
|
||||||
List<ControlLibraryMid> listLibMid = controlLibraryMidService.list(queryWrapper);
|
List<ControlLibraryMid> listLibMid = controlLibraryMidService.list(queryWrapper);
|
||||||
//获取人像中间库
|
//获取人像中间库
|
||||||
|
@ -437,23 +478,24 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
try {
|
try {
|
||||||
//2. 发送任务到API层
|
//2. 发送任务到API层
|
||||||
// 调用平台API接口
|
// 调用平台API接口
|
||||||
String strTaskNo = "000000";
|
// String strTaskNo = "000000";
|
||||||
Map<String, Object> resultMap = (Map<String, Object>) httpUtil.post(link + ApiUrlEnum.TASK_POSTURL.getUrl(), ctvo, Map.class);
|
// Map<String, Object> resultMap = (Map<String, Object>) httpUtil.post(link + ApiUrlEnum.TASK_POSTURL.getUrl(), ctvo, Map.class);
|
||||||
if (resultMap != null) {
|
// if (resultMap != null) {
|
||||||
if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())){
|
// if(ErrEnum.OK.getCode().toString().equalsIgnoreCase(resultMap.get("code").toString())){
|
||||||
Map<String, Object> data = (Map<String, Object>) resultMap.get("data");
|
// Map<String, Object> data = (Map<String, Object>) resultMap.get("data");
|
||||||
if (data != null && data.get("taskId") != null) {
|
// if (data != null && data.get("taskId") != null) {
|
||||||
strTaskNo = data.get("taskId").toString();
|
// strTaskNo = data.get("taskId").toString();
|
||||||
} else {
|
// } else {
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return new CommonResult(resultMap, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
// return new CommonResult(resultMap, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "远程API保存任务信息失败!");
|
||||||
}
|
// }
|
||||||
//3. 更新本地库任务的状态为RUN状态
|
//3. 更新本地库任务的状态为RUN状态
|
||||||
|
String strTaskNo = controlOne.getTaskNo();
|
||||||
controlOne.setTaskNo(strTaskNo);
|
controlOne.setTaskNo(strTaskNo);
|
||||||
controlOne.setIsValid(TaskStatusEnum.RUN.code);
|
controlOne.setIsValid(TaskStatusEnum.RUN.code);
|
||||||
this.updateById(controlOne);
|
this.updateById(controlOne);
|
||||||
|
@ -518,16 +560,17 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "生成特征库识别!");
|
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, "生成特征库识别!");
|
||||||
}
|
}
|
||||||
//2.添加人脸信息特征
|
//2.添加人脸信息特征
|
||||||
Portrait portrait;
|
// Portrait portrait;
|
||||||
try {
|
// try {
|
||||||
portrait = iPortraitService.addPortraitPngs(faceLibrar.getIdFactory().toString(), url);
|
// System.out.println(faceLibrar.getIdFactory().toString());
|
||||||
} catch (Exception e) {
|
// portrait = iPortraitService.addPortraitPngs(faceLibrar.getIdFactory().toString(), url);
|
||||||
log.error("上传人像异常"+e.getMessage());
|
// } catch (Exception e) {
|
||||||
return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, e.getMessage());
|
// log.error("上传人像异常"+e.getMessage());
|
||||||
}
|
// return new CommonResult(null, SystemCode.INTERNAL_PROGRAM_ERROR.code, e.getMessage());
|
||||||
|
// }
|
||||||
Map<String,Object> result=new HashMap<>();
|
Map<String,Object> result=new HashMap<>();
|
||||||
result.put("libid",faceLibrar.getIdFactory().toString());
|
result.put("libid",faceLibrar.getIdFactory().toString());
|
||||||
result.put("url",portrait.getBackgroundUrl());
|
result.put("url",url);
|
||||||
return new CommonResult(result,SystemCode.HANDLER_SUCCESS.code,"人像文件上传成功!");
|
return new CommonResult(result,SystemCode.HANDLER_SUCCESS.code,"人像文件上传成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
#MySQL
|
#MySQL
|
||||||
driver-class-name: com.mysql.jdbc.Driver
|
driver-class-name: com.mysql.jdbc.Driver
|
||||||
url: jdbc:mysql://192.168.1.127:3306/face_application_23_3?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://192.168.1.127:3306/face_application_23_3?useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
|
||||||
username: root
|
username: root
|
||||||
password: Dkha123
|
password: Dkha123
|
||||||
initial-size: 10
|
initial-size: 10
|
||||||
|
@ -92,7 +92,7 @@ mybatis-plus:
|
||||||
cache-enabled: false
|
cache-enabled: false
|
||||||
call-setters-on-nulls: true
|
call-setters-on-nulls: true
|
||||||
jdbc-type-for-null: 'null'
|
jdbc-type-for-null: 'null'
|
||||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||||
|
|
||||||
# 用于控制swagger是否显示
|
# 用于控制swagger是否显示
|
||||||
swagger:
|
swagger:
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<appender name="traceFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="traceFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<!-- rollover daily -->
|
<!-- rollover daily -->
|
||||||
<fileNamePattern>/mnt/appSystems/logs/${app_name}/%d{yyyy-MM, aux}/trace.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
<fileNamePattern>/home/cb/mnt/appSystems/logs/${app_name}/%d{yyyy-MM, aux}/trace.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
<!--访问日志最大500M-->
|
<!--访问日志最大500M-->
|
||||||
<maxFileSize>500MB</maxFileSize>
|
<maxFileSize>500MB</maxFileSize>
|
||||||
<!-- 保留10天 -->
|
<!-- 保留10天 -->
|
||||||
|
@ -32,9 +32,9 @@
|
||||||
|
|
||||||
<appender name="errorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
<appender name="errorFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||||
<fileNamePattern>/appSystems/logs/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
<fileNamePattern>/home/cb/mnt/appSystems/logs/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
<!-- rollover daily -->
|
<!-- rollover daily -->
|
||||||
<fileNamePattern>/mnt/appSystems/logs/${app_name}/%d{yyyy-MM, aux}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
<fileNamePattern>/home/cb/mnt/appSystems/logs/${app_name}/%d{yyyy-MM, aux}/error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
|
||||||
<!--访问日志最大500M-->
|
<!--访问日志最大500M-->
|
||||||
<maxFileSize>500MB</maxFileSize>
|
<maxFileSize>500MB</maxFileSize>
|
||||||
<!-- 保留10天 -->
|
<!-- 保留10天 -->
|
||||||
|
|
Loading…
Reference in New Issue