Browse Source

add feature for visitor

tags/B.1.0.1.1_20230721_base^2
yk 2 years ago
parent
commit
0a096c77b9
1 changed files with 15 additions and 0 deletions
  1. +15
    -0
      xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsInnerApiController.java

+ 15
- 0
xueyi-modules/xueyi-system/src/main/java/com/xueyi/system/pass/controller/api/DmRecognizedRecordsInnerApiController.java View File

@@ -1,6 +1,7 @@
package com.xueyi.system.pass.controller.api;

import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.xueyi.common.core.web.result.R;
@@ -19,6 +20,7 @@ import com.xueyi.system.pass.mapper.DmRecognizedRecordsMapper;
import com.xueyi.system.resource.controller.api.BaseApiController;
import com.xueyi.system.resource.domain.dto.DmResourcesDto;
import com.xueyi.system.resource.service.impl.DmResourcesServiceImpl;
import com.xueyi.system.resource.service.impl.FaceServiceImpl;
import com.xueyi.system.staff.mapper.DmStaffMapper;
import com.xueyi.system.staff.service.impl.DmStaffServiceImpl;
import com.xueyi.system.utils.common.ImageUtil;
@@ -64,6 +66,9 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
@Autowired
private DmRecognizedRecordsConverter recordsConverter;

@Autowired
private FaceServiceImpl faceService;

@InnerAuth
@PostMapping(value = "/upload-pass")
public JSONObject upload(@RequestBody DmRecognizedRecordsDto recognizedRecordsDto) {
@@ -155,6 +160,16 @@ public class DmRecognizedRecordsInnerApiController extends BaseApiController {
dmResourcesDto.setType(DmResourcesDto.TYPE_PIC);
dmResourcesDto.setUrl(url);
dmResourcesDto.setName("stranger");

com.alibaba.fastjson.JSONObject json = faceService.getFaceExtraction("", "", imgBase64);

if (0!=json.getInteger("status")) {
return output(-1, json.getString("errMsg")).toJSON();
} else {
JSONArray obj = json.getJSONArray("result").getJSONObject(0).getJSONArray("faces").getJSONObject(0).getJSONArray("feature");
dmResourcesDto.setFeature(obj.toJSONString());
}

iDmResourcesService.addOne(dmResourcesDto);
cr.setFaceUrl(url);
cr.setResourceId(dmResourcesDto.getId());


Loading…
Cancel
Save