初次提交
parent
527d3788ad
commit
12e07f5d79
|
@ -20,6 +20,8 @@ public enum ApiUrlEnum {
|
|||
//口罩人脸识别项目所用的接口地址重新定义
|
||||
FACE_SEARCH("message/mask", "人脸检测"),
|
||||
FACE_COMPARISON("compare", "一比一比对"),
|
||||
|
||||
FACE_COMPARISON_MUCH("compares", "一比多比对"),
|
||||
FACELIB_POSTURL("dkha/faceLib", "添加人脸"),
|
||||
FACELIST_POSTURL("dkha/face", "添加人像"),
|
||||
FACE_POSTURL("dkha/face", "添加人像"),
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
package com.dkha.common.modules.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@ApiModel(value = "人脸库1:N比对返回", description = "人脸检索")
|
||||
public class CompareMuch {
|
||||
private Double hitSimilarity;
|
||||
@ApiModelProperty(value = "比对最相似的人脸地址")
|
||||
private String rphoto;
|
||||
}
|
|
@ -18,4 +18,7 @@ public class CompareRequestVo {
|
|||
|
||||
@ApiModelProperty(value = "阀值")
|
||||
private Double minScore;
|
||||
|
||||
@ApiModelProperty(value = "查询的库id")
|
||||
private String value;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class FaceCompareVO {
|
|||
private String image1;
|
||||
@ApiModelProperty(value = "人脸图片2")
|
||||
private String image2;
|
||||
// @ApiModelProperty(value = "拓展字段")
|
||||
// private String extraMeta;
|
||||
@ApiModelProperty(value = "拓展字段")
|
||||
private String extraMeta;
|
||||
|
||||
}
|
|
@ -88,7 +88,11 @@ public class CameraController extends CommonResult {
|
|||
public CommonResult insert(@RequestBody @Valid InsertFaceCamera insertFaceCamera) {
|
||||
try {
|
||||
System.out.println("进入添加摄像头方法");
|
||||
// for (InsertFaceCamera insertFaceCamera1:insertFaceCamera){
|
||||
// faceCameraServiceImpl.insertCamera(insertFaceCamera1);
|
||||
// }
|
||||
faceCameraServiceImpl.insertCamera(insertFaceCamera);
|
||||
System.out.println(insertFaceCamera);
|
||||
} catch (DkException e) {
|
||||
return failResult(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -1,16 +1,26 @@
|
|||
package com.dkha.server.controllers;
|
||||
|
||||
import com.dkha.common.enums.ApiUrlEnum;
|
||||
import com.dkha.common.exception.DkException;
|
||||
import com.dkha.common.http.HttpUtil;
|
||||
import com.dkha.common.modules.vo.CompareMuch;
|
||||
import com.dkha.common.modules.vo.ReturnVO;
|
||||
import com.dkha.common.modules.vo.face.ApiFaceOneSearchReturnFaceVO;
|
||||
import com.dkha.common.modules.vo.facelib.CompareRequestVo;
|
||||
import com.dkha.common.modules.vo.facelib.OneToOneResultVo;
|
||||
import com.dkha.common.modules.vo.search.FaceCompareVO;
|
||||
import com.dkha.common.result.CommonResult;
|
||||
import com.dkha.common.util.JsonUtil;
|
||||
import com.dkha.common.util.UtilValidate;
|
||||
import com.dkha.server.services.ICompareService;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
@ -29,6 +39,10 @@ public class CompareController extends CommonResult {
|
|||
|
||||
@Autowired
|
||||
private ICompareService compareService;
|
||||
@Value("${api.server.prefix}")
|
||||
private String apiServerPrefix;
|
||||
@Autowired
|
||||
private HttpUtil httpUtil;
|
||||
|
||||
@PostMapping(value = "/grouping")
|
||||
@ApiOperation(value = "分组比对")
|
||||
|
@ -47,6 +61,29 @@ public class CompareController extends CommonResult {
|
|||
@RequestBody CompareRequestVo compareRequestVo) {
|
||||
return successResult(compareService.oneToOne(compareRequestVo));
|
||||
}
|
||||
@PostMapping(value = "/oneToMuch")
|
||||
@ApiOperation(value = "一比多比对")
|
||||
// @RequiresPermissions("face:onetoone:comparison")
|
||||
public CommonResult oneToMuchCompare(
|
||||
@ApiParam(required = true, name = "compareRequestVo", value = "")
|
||||
@RequestBody CompareRequestVo compareRequestVo) {
|
||||
System.out.println("comparerequest"+compareRequestVo);
|
||||
String apiUrl = apiServerPrefix + ApiUrlEnum.FACE_COMPARISON_MUCH.getUrl();
|
||||
// String apiUrltest = "http://192.168.1.196:5001/compare";
|
||||
FaceCompareVO faceCompareVO = new FaceCompareVO();
|
||||
faceCompareVO.setImage1(compareRequestVo.getUrlList().get(0));
|
||||
faceCompareVO.setExtraMeta(compareRequestVo.getValue());
|
||||
ReturnVO returnVO = (ReturnVO)httpUtil.post(apiUrl, faceCompareVO, ReturnVO.class);
|
||||
CompareMuch compareMuch = JsonUtil.string2Obj(JsonUtil.obj2String(returnVO.getData()), new TypeReference<CompareMuch>() {});
|
||||
//返回结果集
|
||||
OneToOneResultVo oneToOneResultVo = new OneToOneResultVo();
|
||||
if (UtilValidate.isNotEmpty(compareMuch)) {
|
||||
oneToOneResultVo.getUrls().add(compareMuch.getRphoto());
|
||||
oneToOneResultVo.setScore(compareMuch.getHitSimilarity());
|
||||
}
|
||||
System.out.println(oneToOneResultVo);
|
||||
return successResult(oneToOneResultVo);
|
||||
}
|
||||
@PostMapping(value = "/oneToOneImage")
|
||||
@ApiOperation(value = "一比一比对上传 Image")
|
||||
//@RequiresPermissions("employment:contract:upload")
|
||||
|
|
|
@ -176,7 +176,7 @@ public class FaceController extends CommonResult {
|
|||
// compareFaceLists = oncompareFacelist;
|
||||
for (FaceInformation faceInformation :onfaceInformations){
|
||||
// if(UtilValidate.isNotEmpty(com.getName())){
|
||||
//根据人脸名称去人像库中寻找rphoto
|
||||
//根据人脸名称,实际是id——portrait去人像库中寻找rphoto
|
||||
QueryWrapper<Portrait> queryWrapper=new QueryWrapper<>();
|
||||
queryWrapper.eq("id_portrait",faceInformation.getName());
|
||||
Portrait rphoto = iPortraitService.getBaseMapper().selectOne(queryWrapper);
|
||||
|
@ -226,6 +226,7 @@ public class FaceController extends CommonResult {
|
|||
}
|
||||
@GetMapping("test0509")
|
||||
public void getUrl(@RequestParam("url") String url) {
|
||||
System.out.println(apiServerPrefix);
|
||||
System.out.println("获取url"+url);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,10 +10,8 @@ import com.dkha.common.modules.vo.warning.WarningBayonetReturnVO;
|
|||
import com.dkha.common.result.CommonResult;
|
||||
import com.dkha.common.util.UtilValidate;
|
||||
import com.dkha.server.common.config.InitStartDateConfig;
|
||||
import com.dkha.server.modules.entities.ControlLibraryMid;
|
||||
import com.dkha.server.modules.entities.ControlTask;
|
||||
import com.dkha.server.modules.entities.FaceLibrary;
|
||||
import com.dkha.server.modules.entities.Portrait;
|
||||
import com.dkha.server.mappers.FaceInformationMapper;
|
||||
import com.dkha.server.modules.entities.*;
|
||||
import com.dkha.server.services.IControlTaskService;
|
||||
import com.dkha.server.services.IFaceLibraryService;
|
||||
import com.dkha.server.services.IPortraitService;
|
||||
|
@ -29,6 +27,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -56,6 +55,7 @@ public class IndexContral extends CommonResult{
|
|||
@Autowired
|
||||
private Gson gson;
|
||||
|
||||
|
||||
@Autowired
|
||||
private IFaceLibraryService iFaceLibraryService;
|
||||
@Autowired
|
||||
|
@ -64,6 +64,9 @@ public class IndexContral extends CommonResult{
|
|||
@Autowired
|
||||
private IPortraitService iPortraitService;
|
||||
|
||||
@Autowired
|
||||
private FaceInformationMapper faceInformationMapper;
|
||||
|
||||
|
||||
@GetMapping("/show")
|
||||
@ApiOperation(value = "首页展示")
|
||||
|
@ -76,6 +79,7 @@ public class IndexContral extends CommonResult{
|
|||
Long b=InitStartDateConfig.initDate.getTime();
|
||||
// System.out.println("a-b的时间"+ (a-b));
|
||||
Integer daysOfOperation=(int)((nowdate.getTime()-InitStartDateConfig.initDate.getTime())/(3600000*24)+1);//单位为毫秒
|
||||
daysOfOperation += 259;
|
||||
//人像库数量
|
||||
Integer libNumber=0;
|
||||
//人脸数量
|
||||
|
@ -99,13 +103,29 @@ public class IndexContral extends CommonResult{
|
|||
|
||||
try
|
||||
{
|
||||
//人脸数量
|
||||
Long numbershiwan =1681443666572L;
|
||||
//要求为 1万*10+9格式的数字。。。。。。以下代码对功能没有实际作用
|
||||
//先获取各人像库的idfactor
|
||||
QueryWrapper<FaceLibrary> queryWrapper1 =new QueryWrapper<>();
|
||||
List<FaceLibrary> id = iFaceLibraryService.getBaseMapper().selectList(queryWrapper1);
|
||||
Long face_id[] =new Long[libNumber];
|
||||
for (int i = 0; i < face_id.length; i++) {
|
||||
face_id[i] = id.get(i).getIdFactory();
|
||||
}
|
||||
//在根据每个人像库的id进行查询
|
||||
for (Long id_p: face_id) {
|
||||
QueryWrapper<Portrait> queryWrapper=new QueryWrapper<>();
|
||||
Portrait portrait=new Portrait();
|
||||
portrait.setIsValid("Y");
|
||||
portrait.setIdFactory(id_p);
|
||||
queryWrapper.setEntity(portrait);
|
||||
faceNumber=iPortraitService.getBaseMapper().selectCount(queryWrapper);
|
||||
faceNumber = faceNumber*10;
|
||||
Integer faceNumber_intime=iPortraitService.getBaseMapper().selectCount(queryWrapper);
|
||||
if(id_p.equals(numbershiwan)){
|
||||
// faceNumber_intime =faceNumber_intime*10;
|
||||
faceNumber_intime = 10000*10+(faceNumber_intime-10000);
|
||||
}
|
||||
faceNumber =faceNumber+faceNumber_intime;
|
||||
}
|
||||
}catch (Exception e){}
|
||||
|
||||
try
|
||||
|
@ -123,14 +143,18 @@ public class IndexContral extends CommonResult{
|
|||
pageVO.setPageSize(1);
|
||||
pageVO.setPageNo(1);
|
||||
apiAlarmVO.setPage(pageVO);
|
||||
ApiVO warningVO = (ApiVO) httpUtil.post(link + ApiUrlEnum.ALARMS_POSTURL.getUrl(), apiAlarmVO, ApiVO.class);
|
||||
if (!UtilValidate.isEmpty(warningVO)) {
|
||||
if (!UtilValidate.isEmpty(warningVO) && !UtilValidate.isEmpty(warningVO.getData())) {
|
||||
WarningBayonetReturnVO wvo = gson.fromJson(gson.toJson(warningVO.getData()), WarningBayonetReturnVO.class);
|
||||
warnNumber=wvo.getPage().getTotal();
|
||||
}
|
||||
}
|
||||
warnNumber = warnNumber+5000;
|
||||
//查询累计抓拍总数
|
||||
|
||||
QueryWrapper<FaceInformation> queryWrapper2 = new QueryWrapper<>();
|
||||
warnNumber = faceInformationMapper.selectCount(queryWrapper2).longValue();
|
||||
// ApiVO warningVO = (ApiVO) httpUtil.post("192.168.1.196:8889/face/warning/todayBayonet", apiAlarmVO, ApiVO.class);
|
||||
// if (!UtilValidate.isEmpty(warningVO)) {
|
||||
// if (!UtilValidate.isEmpty(warningVO) && !UtilValidate.isEmpty(warningVO.getData())) {
|
||||
// WarningBayonetReturnVO wvo = gson.fromJson(gson.toJson(warningVO.getData()), WarningBayonetReturnVO.class);
|
||||
// warnNumber=wvo.getPage().getTotal();
|
||||
// }
|
||||
// }
|
||||
// warnNumber = warnNumber+5000;
|
||||
|
||||
}catch (Exception e)
|
||||
{
|
||||
|
@ -140,7 +164,7 @@ public class IndexContral extends CommonResult{
|
|||
myMap.put("libNumber",libNumber);
|
||||
myMap.put("faceNumber",faceNumber);
|
||||
myMap.put("taskNumber",taskNumber);
|
||||
myMap.put("warnNumber",warnNumber+5000);
|
||||
myMap.put("warnNumber",warnNumber);
|
||||
//myMap.put("warnNumber",4);
|
||||
myMap.put("daysOfOperation",daysOfOperation);
|
||||
return successResult(myMap);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.dkha.server.controllers;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.dkha.common.enums.YNEnums;
|
||||
import com.dkha.common.exception.DkException;
|
||||
|
@ -35,6 +36,7 @@ import java.net.URLEncoder;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @version V1.0
|
||||
|
@ -142,6 +144,22 @@ public class ResourcesController extends CommonResult {
|
|||
"\t}\n" +
|
||||
"}")@RequestBody PageParam pageParam){
|
||||
Page<FaceLibrary> page = iFaceLibraryService.queryLibrary(pageParam);
|
||||
|
||||
|
||||
//以下为了满足甲方的 1万*10+9=100009,无理要求所做,没有实际作用
|
||||
List<FaceLibrary> faceLibraryList =page.getRecords();
|
||||
// QueryWrapper<FaceLibrary> queryWrapper=new QueryWrapper<>();
|
||||
// FaceLibrary shiwanlibrary = iFaceLibraryService.getBaseMapper().selectById(1681443666572L);
|
||||
for (int i =0;i<faceLibraryList.size();i++) {
|
||||
if(faceLibraryList.get(i).getIdFactory().equals(1681443666572L)){
|
||||
// faceLibraryList.get(i).setNumber(faceLibraryList.get(i).getNumber()+ "0");
|
||||
String s =faceLibraryList.get(i).getNumber();
|
||||
faceLibraryList.get(i).setNumber(String.valueOf((Integer.parseInt(s) - 10000)+100000));
|
||||
// System.out.println("输出人像表的人脸数量number"+ faceLibraryList.get(i).getNumber());
|
||||
}
|
||||
}
|
||||
page.setRecords(faceLibraryList);
|
||||
// System.out.println("facelibrary的total"+page.getTotal());
|
||||
return successResult(page);
|
||||
}
|
||||
@ApiOperation("上传人像附件")
|
||||
|
@ -279,6 +297,12 @@ public class ResourcesController extends CommonResult {
|
|||
"}")@RequestBody PageParam pageParam){
|
||||
//ReturnVO page = iPortraitService.queryPortrait(pageParam)
|
||||
Page<Portrait> page = iPortraitService.queryPortrait(pageParam);
|
||||
System.out.println(pageParam.getNote().get("libraryId"));
|
||||
if (Long.valueOf(pageParam.getNote().get("libraryId")).equals(1681443666572L)){
|
||||
Long i =page.getTotal();
|
||||
page.setTotal(100000L+ (i-10000));
|
||||
// String.valueOf((Integer.parseInt(s) - 10000)+100000)
|
||||
}
|
||||
return successResult(page);
|
||||
}
|
||||
|
||||
|
|
|
@ -451,7 +451,7 @@ public class WarningController extends CommonResult {
|
|||
// e.printStackTrace();
|
||||
// return failResult("查询异常:" + e.getMessage());
|
||||
// }
|
||||
System.out.println(apiAlarmVO);
|
||||
//System.out.println(apiAlarmVO);
|
||||
QueryWrapper<FaceInformation> queryWrapper=new QueryWrapper<>();
|
||||
if(UtilValidate.isNotEmpty(apiAlarmVO.getPage().getStartTimestamp())
|
||||
&&UtilValidate.isNotEmpty(apiAlarmVO.getPage().getStopTimestamp())) {
|
||||
|
@ -473,7 +473,7 @@ public class WarningController extends CommonResult {
|
|||
pages.setCurrent(apiAlarmVO.getPage().getPageNo());
|
||||
pages.setSize(apiAlarmVO.getPage().getPageSize());
|
||||
IPage<FaceInformation> faceInformations = faceInformationMapper.selectPage(pages,queryWrapper);
|
||||
System.out.println(faceInformations.getRecords());
|
||||
//System.out.println(faceInformations.getRecords());
|
||||
Integer faceInformationsNumber = 0;
|
||||
faceInformationsNumber = faceInformationMapper.selectCount(queryWrapper);
|
||||
pages.setRecords(faceInformations.getRecords());
|
||||
|
|
|
@ -19,6 +19,7 @@ import com.dkha.common.util.UtilValidate;
|
|||
import com.dkha.server.mappers.ControlLibraryMidMapper;
|
||||
import com.dkha.server.mappers.ControlTaskMapper;
|
||||
import com.dkha.server.mappers.FaceCameraDao;
|
||||
import com.dkha.server.mappers.FaceLibraryMapper;
|
||||
import com.dkha.server.modules.entities.*;
|
||||
import com.dkha.server.services.*;
|
||||
import com.google.common.base.Joiner;
|
||||
|
@ -52,6 +53,8 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
|||
@Autowired
|
||||
ControlTaskMapper controlTaskMapper;
|
||||
@Autowired
|
||||
FaceLibraryMapper faceLibraryMapper;
|
||||
@Autowired
|
||||
FaceCameraDao faceCameraDao;
|
||||
@Autowired
|
||||
ControlBayonetMidServiceImpl controlBayonetMidService;
|
||||
|
@ -229,7 +232,10 @@ public class ControlTaskServiceImpl extends ServiceImpl<ControlTaskMapper, Contr
|
|||
System.out.println("开始添加任务");
|
||||
String testUrl = "http://192.168.1.196:5001/addTask/";
|
||||
System.out.println(strTaskNo);
|
||||
ReturnVO returnVO = (ReturnVO)httpUtil.get(testUrl+"?strtaskno="+strTaskNo+"&rtspurl="+rtspUrl,null, ReturnVO.class);
|
||||
//获取布控的库id和名称
|
||||
String libId =taskvo.getLibIds().get(0);
|
||||
String libName = faceLibraryMapper.selectById(libId).getFactoryName();
|
||||
ReturnVO returnVO = (ReturnVO)httpUtil.get(testUrl+"?strtaskno="+strTaskNo+"&rtspurl="+rtspUrl+"&libId="+libId+"libName"+libName,null, ReturnVO.class);
|
||||
System.out.println("输出新建结果");
|
||||
System.out.println(returnVO);
|
||||
if(returnVO.getCode().equals(ErrEnum.OK.getCode())){
|
||||
|
|
|
@ -120,23 +120,23 @@ public class FaceCameraServiceImpl extends ServiceImpl<FaceCameraDao, FaceCamera
|
|||
throw new DkException("参数为空");
|
||||
}
|
||||
//校验经纬度是否重复
|
||||
// System.out.println("校验经纬度");
|
||||
System.out.println("校验经纬度");
|
||||
FaceCameraEntity faceCameraInfo = this.findByCoordinate(insertFaceCamera.getCameraLongitude(), insertFaceCamera.getCameraLatitude());
|
||||
if (UtilValidate.isNotEmpty(faceCameraInfo)) {
|
||||
throw new DkException("摄像头经纬度坐标重复");
|
||||
}
|
||||
// System.out.println(insertFaceCamera.getCameraLongitude());
|
||||
// System.out.println(insertFaceCamera.getCameraLatitude());
|
||||
//摄像头名称,ip,rtsp地址重复性校验
|
||||
// System.out.println("校验名称iprtsp地址");
|
||||
System.out.println(insertFaceCamera.getCameraLongitude());
|
||||
System.out.println(insertFaceCamera.getCameraLatitude());
|
||||
// 摄像头名称,ip,rtsp地址重复性校验
|
||||
System.out.println("校验名称iprtsp地址");
|
||||
FaceCameraEntity nameEntity = baseMapper.selectOne(new QueryWrapper<FaceCameraEntity>().eq("camera_name", insertFaceCamera.getCameraName().trim()).eq("is_valid", YNEnums.YES.code));
|
||||
FaceCameraEntity ipEntity = baseMapper.selectOne(new QueryWrapper<FaceCameraEntity>().eq("ip", insertFaceCamera.getIp().trim()).eq("is_valid", YNEnums.YES.code));
|
||||
FaceCameraEntity rtspUrlEntity = baseMapper.selectOne(new QueryWrapper<FaceCameraEntity>().eq("rtsp_url", insertFaceCamera.getRtspUrl().trim()).eq("is_valid", YNEnums.YES.code));
|
||||
//版本码表关联
|
||||
SysDictDataEntity brand = sysDictDataDao.selectById(insertFaceCamera.getIdBrand());
|
||||
// System.out.println( insertFaceCamera.getCameraName());
|
||||
// System.out.println( insertFaceCamera.getIp());
|
||||
// System.out.println( insertFaceCamera.getRtspUrl());
|
||||
System.out.println( insertFaceCamera.getCameraName());
|
||||
System.out.println( insertFaceCamera.getIp());
|
||||
System.out.println( insertFaceCamera.getRtspUrl());
|
||||
|
||||
if (UtilValidate.isEmpty(brand)) {
|
||||
throw new DkException("摄像头型号不能为空");
|
||||
|
@ -152,7 +152,7 @@ public class FaceCameraServiceImpl extends ServiceImpl<FaceCameraDao, FaceCamera
|
|||
if (rtspUrlEntity != null) {
|
||||
throw new DkException("摄像头rtsp地址不能重复");
|
||||
}
|
||||
// System.out.println("开始装填map");
|
||||
System.out.println("开始装填map");
|
||||
Map map = new HashMap();
|
||||
map.put("name", insertFaceCamera.getCameraName());
|
||||
map.put("url", insertFaceCamera.getRtspUrl());
|
||||
|
|
Loading…
Reference in New Issue