dev
parent
63317d726c
commit
42740c78ae
|
|
@ -40,30 +40,41 @@ public class StudentSignAddExe {
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public StudentSignCO execute(StudentSignAddCmd cmd) {
|
public StudentSignCO execute(StudentSignAddCmd cmd) {
|
||||||
|
System.out.println("第一步-----------------------------"+ System.currentTimeMillis());
|
||||||
StudentDO stu = studentRepository.findInfoByStudentId(cmd.getStudentId());
|
StudentDO stu = studentRepository.findInfoByStudentId(cmd.getStudentId());
|
||||||
|
System.out.println("第2步-----------------------------"+ System.currentTimeMillis());
|
||||||
StudentSignE studentSignE = new StudentSignE();
|
StudentSignE studentSignE = new StudentSignE();
|
||||||
BeanUtils.copyProperties(cmd, studentSignE);
|
BeanUtils.copyProperties(cmd, studentSignE);
|
||||||
|
System.out.println("第3步-----------------------------"+ System.currentTimeMillis());
|
||||||
StudentDO student = studentRepository.findFaceUrlByPhone(stu.getPhone());
|
StudentDO student = studentRepository.findFaceUrlByPhone(stu.getPhone());
|
||||||
|
System.out.println("第4步-----------------------------"+ System.currentTimeMillis());
|
||||||
if (student == null || ObjectUtils.isEmpty(student.getUserAvatarUrl())) {
|
if (student == null || ObjectUtils.isEmpty(student.getUserAvatarUrl())) {
|
||||||
throw new BizException("您还没有录入人脸");
|
throw new BizException("您还没有录入人脸");
|
||||||
}
|
}
|
||||||
String faceUrl = null;
|
String faceUrl = null;
|
||||||
try {
|
try {
|
||||||
|
System.out.println("第5步-----------------------------"+ System.currentTimeMillis());
|
||||||
faceUrl = Base64Util.getBase64String(studentSignE.getFiles()[0]);
|
faceUrl = Base64Util.getBase64String(studentSignE.getFiles()[0]);
|
||||||
|
System.out.println("第6步-----------------------------"+ System.currentTimeMillis());
|
||||||
studentSignE.compareFace(student.getUserAvatarUrl(), faceUrl, fileUrlConfig.getPrefixUrl());
|
studentSignE.compareFace(student.getUserAvatarUrl(), faceUrl, fileUrlConfig.getPrefixUrl());
|
||||||
|
System.out.println("第10步-----------------------------"+ System.currentTimeMillis());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
String path = studentSignE.getType() == 1 ? "clockSign" : "examSign";
|
String path = studentSignE.getType() == 1 ? "clockSign" : "examSign";
|
||||||
|
System.out.println("第11步-----------------------------"+ System.currentTimeMillis());
|
||||||
String fileName = Tools.get32UUID() + studentSignE.getFiles()[0].getOriginalFilename().substring(studentSignE.getFiles()[0].getOriginalFilename().lastIndexOf("."));
|
String fileName = Tools.get32UUID() + studentSignE.getFiles()[0].getOriginalFilename().substring(studentSignE.getFiles()[0].getOriginalFilename().lastIndexOf("."));
|
||||||
|
System.out.println("第12步-----------------------------"+ System.currentTimeMillis());
|
||||||
studentSignE.setFaceUrl(zcloudImgFilesFacade.saveFile( faceUrl,fileName, path));
|
studentSignE.setFaceUrl(zcloudImgFilesFacade.saveFile( faceUrl,fileName, path));
|
||||||
|
System.out.println("第13步-----------------------------"+ System.currentTimeMillis());
|
||||||
studentSignE.init(stu.getStudentId(), stu.getClassId(), stu.getClassCorpinfoId());
|
studentSignE.init(stu.getStudentId(), stu.getClassId(), stu.getClassCorpinfoId());
|
||||||
boolean res = false;
|
boolean res = false;
|
||||||
StudentSignCO studentSignCO = new StudentSignCO();
|
StudentSignCO studentSignCO = new StudentSignCO();
|
||||||
try {
|
try {
|
||||||
|
System.out.println("第14步-----------------------------"+ System.currentTimeMillis());
|
||||||
res = studentSignGateway.add(studentSignE);
|
res = studentSignGateway.add(studentSignE);
|
||||||
|
System.out.println("第15步-----------------------------"+ System.currentTimeMillis());
|
||||||
BeanUtils.copyProperties(studentSignE, studentSignCO);
|
BeanUtils.copyProperties(studentSignE, studentSignCO);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,11 @@ public class StudentSignE extends BaseE {
|
||||||
private Long updateId;
|
private Long updateId;
|
||||||
|
|
||||||
public void compareFace(String templateFaceUrl, String faceUrl, String prefixUrl) throws Exception {
|
public void compareFace(String templateFaceUrl, String faceUrl, String prefixUrl) throws Exception {
|
||||||
|
System.out.println("第7步-----------------------------"+ System.currentTimeMillis());
|
||||||
String templateFace = Base64Util.urlToBase64(prefixUrl + templateFaceUrl);
|
String templateFace = Base64Util.urlToBase64(prefixUrl + templateFaceUrl);
|
||||||
|
System.out.println("第8步-----------------------------"+ System.currentTimeMillis());
|
||||||
String confidence = FaceUtil.compareFace(templateFace, faceUrl);
|
String confidence = FaceUtil.compareFace(templateFace, faceUrl);
|
||||||
|
System.out.println("第9步-----------------------------"+ System.currentTimeMillis());
|
||||||
if (Double.valueOf(confidence) < 75) {
|
if (Double.valueOf(confidence) < 75) {
|
||||||
throw new BizException("人脸不匹配");
|
throw new BizException("人脸不匹配");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue