引入人脸识别部分代码
This commit is contained in:
parent
a631281ba7
commit
fa80ce99b8
@ -7,15 +7,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.system.fantang.domain.*;
|
||||
import com.ruoyi.system.fantang.mapper.FtFaceEventDaoMapper;
|
||||
import com.ruoyi.system.fantang.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -56,6 +61,9 @@ public class ClientController extends BaseController {
|
||||
@Autowired
|
||||
private IFtFoodDefaultDaoService foodDefaultDaoService;
|
||||
|
||||
@Autowired
|
||||
private IFtFaceEventService faceEventService;
|
||||
|
||||
/**
|
||||
* 获取用餐时间信息
|
||||
* 日期:2020年12月11日
|
||||
@ -518,4 +526,63 @@ public class ClientController extends BaseController {
|
||||
return AjaxResult.success("已退款");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 人脸识别设备心跳信号
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/heartbeat")
|
||||
public String HeartbeatControl(HttpServletRequest request){
|
||||
System.out.println("face device heartbeat.....");
|
||||
StringBuffer data = new StringBuffer();
|
||||
String line = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
reader = request.getReader();
|
||||
while (null != (line = reader.readLine())) {
|
||||
data.append(line);
|
||||
}
|
||||
JSONObject jsonObject = JSONObject.parseObject(data.toString());
|
||||
System.out.println(jsonObject);
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
}
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/Verify")
|
||||
public String VerifyControl(HttpServletRequest request){
|
||||
System.out.println("verify.....");
|
||||
StringBuffer data = new StringBuffer();
|
||||
|
||||
try {
|
||||
BufferedReader reader = request.getReader();
|
||||
String line = null;
|
||||
while (null != (line = reader.readLine()))
|
||||
data.append(line);
|
||||
JSONObject jsonObject = JSONObject.parseObject(data.toString());
|
||||
System.out.println(jsonObject);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("flag", 0);
|
||||
List<FtFaceEventDao> dao = faceEventService.selectByMap(map);
|
||||
if (dao.size() == 0)
|
||||
{
|
||||
JSONObject infoObject = JSONObject.parseObject(jsonObject.getString("info"));
|
||||
FtFaceEventDao eventDao = new FtFaceEventDao();
|
||||
|
||||
eventDao.setDeviceId(infoObject.getString("DeviceID"));
|
||||
eventDao.setPersonId(infoObject.getString("PersonID"));
|
||||
// faceEventService.insert(eventDao);
|
||||
}
|
||||
else {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
} finally {
|
||||
}
|
||||
return "ok";
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,32 @@
|
||||
package com.ruoyi.system.fantang.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("ft_faceEvent")
|
||||
public class FtFaceEventDao {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
@TableField(value = "device_id")
|
||||
private String deviceId;
|
||||
|
||||
@TableField(value = "person_id")
|
||||
private String personId;
|
||||
|
||||
@TableField(fill= FieldFill.INSERT)
|
||||
private int flag;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private Date createTime;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private int findFlag;
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
package com.ruoyi.system.fantang.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.ruoyi.system.fantang.domain.FtFaceEventDao;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public interface FtFaceEventDaoMapper extends BaseMapper<FtFaceEventDao> {
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.ruoyi.system.fantang.service;
|
||||
|
||||
import com.ruoyi.system.fantang.domain.FtFaceEventDao;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface IFtFaceEventService {
|
||||
List<FtFaceEventDao> selectByMap(HashMap<String, Object> map);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user