package com.gaojinsoft.htwy.y2020.apiFace.service.impl;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baidu.aip.face.AipFace;
import com.baidu.aip.face.MatchRequest;
import com.gaojinsoft.htwy.y2016.base.upload.service.AttachInfoService;
import com.gaojinsoft.htwy.y2019.marketManage.util.StringUtils;
import com.gaojinsoft.htwy.y2020.ApplyTypeCode.service.ApplyTypeCodeService;
import com.gaojinsoft.htwy.y2020.Kh.service.KhService;
import com.gaojinsoft.htwy.y2020.Store.service.StoreService;
import com.gaojinsoft.htwy.y2020.SupermarketSystem.service.SupermarketSystemService;
import com.gaojinsoft.htwy.y2020.apiFace.action.AipFaceAction;
import com.gaojinsoft.htwy.y2020.apiFace.service.AipFaceServ;
import com.gaojinsoft.htwy.y2020.matMake.util.ExceptionUtils;
import com.gaojinsoft.htwy.y2020.matMake.util.ListUtils;
import com.gaojinsoft.htwy.y2020.matMake.util.ResultUtils;
import com.gaojinsoft.htwy.y2020.utils.LogUtils;
import com.kingzheng.common.Json;
import com.kingzheng.common.autosql.scan.BaseScanSqlCommand;
import com.kingzheng.htwy.manage.service.ManageServ;
@Service("AipFaceServImpl")
public class AipFaceServImpl implements AipFaceServ {
private ManageServ manageServ;
@Autowired
private KhService khService;
@Autowired
private StoreService storeService;
@Autowired
private ApplyTypeCodeService ApplyTypeCodeService;
@Autowired
private SupermarketSystemService supermarketSystemService;
@Autowired
private AttachInfoService attachInfoService;
@Resource(name = "htwy_ManageServ")
public void setManageServ(ManageServ serv) {
this.manageServ = serv;
}
public static final String APP_ID = "23995676";
public static final String API_KEY = "KgvAsdilAySvGOFsEazU0Pp6";
public static final String SECRET_KEY = "iCz5vfj7LmeeVm58KUU71MOK4Ips7Qis";
public AipFace getAipFace() throws Exception {
AipFace client = new AipFace(APP_ID, API_KEY, SECRET_KEY);
// /可选:设置网络连接参数
client.setConnectionTimeoutInMillis(5000);
client.setSocketTimeoutInMillis(60000);
return client;
}
/**
* 人脸对比
*
* @return
*/
@Override
public void faceMatch(AipFaceAction action) throws Exception {
try {
Map<String, Object> result = new HashMap<String, Object>();
String faceId = StringUtils.toNotNullString(action.getFaceId());
String imgData = StringUtils.toNotNullString(action.getImgData());
if ("".equals(faceId)) {
ExceptionUtils.throwRuntimeException("对比人脸ID为空 ");
}
if ("".equals(imgData)) {
ExceptionUtils.throwRuntimeException("上传图片信息为空 ");
}
// image1/image2也可以为url或facetoken, 相应的imageType参数需要与之对应。
MatchRequest req1 = new MatchRequest(faceId, "FACE_TOKEN");
MatchRequest req2 = new MatchRequest(imgData, "BASE64");
ArrayList<MatchRequest> requests = new ArrayList<MatchRequest>();
requests.add(req1);
requests.add(req2);
AipFace client = getAipFace();
JSONObject res = client.match(requests);
LogUtils.mainInfo("res", res.toString(2));
int code = res.getInt("error_code");// 状态码: 200(请求成功);400(请求失败)
String errorMsg = res.getString("error_msg");// 状态码: 200(请求成功);400(请求失败)
if(code!=0) {
ExceptionUtils.throwRuntimeException(errorMsg);
}
JSONObject res2 = (JSONObject) res.get("result");
double score = res2.getDouble("score");//
if(score<70.0) {
ExceptionUtils.throwRuntimeException("人脸相似度小于70%,请重新拍照进行校验");
}
result.put("score", score);
action.setAjaxOutData(new ByteArrayInputStream(Json.Encode(ResultUtils.getSuccessResult(result)).toString().getBytes("utf-8")));
} catch (Exception e) {
e.printStackTrace();
action.setAjaxOutData(new ByteArrayInputStream(Json.Encode(ResultUtils.getErrorResult(e)).toString().getBytes("utf-8")));
}
}
@Override
public void faceAdd(AipFaceAction action) throws Exception {
try {
Map<String, Object> result = new HashMap<String, Object>();
String cardNum = StringUtils.toNotNullString(action.getCardNum());
String imgData = StringUtils.toNotNullString(action.getImgData());
if ("".equals(cardNum)) {
ExceptionUtils.throwRuntimeException("身份证号为空 ");
}
if ("".equals(imgData)) {
ExceptionUtils.throwRuntimeException("上传图片信息为空 ");
}
AipFace client = getAipFace();
// 传入可选参数调用接口
HashMap<String, String> options = new HashMap<String, String>();
options.put("user_info", "");
options.put("quality_control", "NORMAL");
options.put("liveness_control", "NORMAL");
options.put("action_type", "REPLACE");
String image = imgData;
String imageType = "BASE64";
String groupId = "xkmm_face";
String userId = cardNum;
// 人脸注册
JSONObject res = client.addUser(image, imageType, groupId, userId, options);
LogUtils.mainInfo("res", res.toString(2));
int code = res.getInt("error_code");// 状态码: 200(请求成功);400(请求失败)
String errorMsg = res.getString("error_msg");// 状态码: 200(请求成功);400(请求失败)
if(code!=0) {
ExceptionUtils.throwRuntimeException(errorMsg);
}
JSONObject res2 = (JSONObject) res.get("result");
String faceToken = res2.getString("face_token");// 状态码: 200(请求成功);400(请求失败)
result.put("faceId", faceToken);
action.setAjaxOutData(new ByteArrayInputStream(Json.Encode(ResultUtils.getSuccessResult(result)).toString().getBytes("utf-8")));
} catch (Exception e) {
e.printStackTrace();
action.setAjaxOutData(new ByteArrayInputStream(Json.Encode(ResultUtils.getErrorResult(e)).toString().getBytes("utf-8")));
}
}
@Override
public void updateFaceIdToSales(AipFaceAction action) throws Exception {
try {
String cardNum = StringUtils.toNotNullString(action.getCardNum());
String faceId = StringUtils.toNotNullString(action.getFaceId());
if ("".equals(cardNum)) {
ExceptionUtils.throwRuntimeException("身份证号为空 ");
}
if ("".equals(faceId)) {
ExceptionUtils.throwRuntimeException("对比人脸ID为空 ");
}
String sql = new BaseScanSqlCommand().getSqlText(this, "AipFaceServImpl.xml", "updateFaceIdToSales");
sql = sql.replaceAll("##personId##", cardNum);
sql = sql.replaceAll("##faceId##", faceId);
manageServ.getCommonServ44().executeBySQL(sql);
action.setAjaxOutData(new ByteArrayInputStream(Json.Encode(ResultUtils.getSuccessResult("")).toString().getBytes("utf-8")));
} catch (Exception e) {
e.printStackTrace();
action.setAjaxOutData(new ByteArrayInputStream(Json.Encode(ResultUtils.getErrorResult(e)).toString().getBytes("utf-8")));
}
}
}
<!DOCTYPE HTML>
<html>
<head xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>人脸校验</title>
<style>
* {
margin: 0;
margin-top: 0;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
padding: 0;
padding-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
}
.pp {
margin: 5px 0 5px;
}
.iconsize {
font-size: 16px;
}
.mt5 {
margin-top: 5px;
margin-left: 5px;
border-bottom: 1px solid #f5f5f5;
}
.y2lable {
width: 50%;
text-align: left;
height: 34px;
line-height: 34px;
}
.pdl5 {
padding-left: 5px;
height: 34px;
line-height: 34px;
width: 62%;
}
.form-control {
padding: 0px 12px;
border: none;
outline: none;
box-shadow: none;
}
.btn {
border-radius: 0;
height: 40px;
font-size: 18px;
}
.btn-primary {
background-color: #689BC6;
}
#dlg_form {
padding-bottom: 55px;
}
button {
background-color: #fff;
border: 1px solid #d4d0c8;
}
.mt5 {
margin-top: 5px;
margin-left: 8px;
border-bottom: 1px solid #f5f5f5;
}
.ystitle {
font-size: 16px;
height: 40px;
line-height: 40px;
color: #000000;
border-bottom: 0px solid #dedede;
padding-left: 5px;
font-weight: bold;
}
.panel-default {
border-color: #ddd;
border-bottom: 0px white;
box-shadow: unset;
border-top-color: #ec7138;
background-color: #fff;
border-radius: 0px;
}
.imgbox {
width: 72px;
height: 100px;
position: relative;
display: inline-block;
margin: 0 14px 5px 0px;
}
.imgbox img {
z-index: 1;
border: 0px solid #000;
position: absolute;
top: 0;
left: 0;
}
.imgbox .reimgbtn {
z-index: 2;
display: inline-block;
position: absolute;
top: -12px;
right: -12px;
background: red;
width: 24px;
height: 24px;
text-align: center;
font-size: 24px;
line-height: 24px;
border-radius: 50%;
color: #fff;
}
.file {
position: relative;
display: inline-block;
background: #fff;
border: 1px dashed #fff;
border-radius: 4px;
overflow: hidden;
text-decoration: none;
text-indent: 0;
line-height: 20px;
}
.file input {
position: absolute;
font-size: 45px;
right: 0;
top: 0;
opacity: 0;
}
.clear {
clear: both
}
</style>
<link href="../../../gaojinsoft/y2017/me/css/bootstrap.min.css" rel="stylesheet"
type="text/css"/>
<link href="../../../gaojinsoft/y2017/me/css/iconfont/iconfont.css" rel="stylesheet"
type="text/css">
<script src="../../../gaojinsoft/y2017/me/js/jquery-1.11.1.min.js"
type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/iconfont.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/mobileBUGFix.mini.js"
type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/upload.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/exif.js" type="text/javascript"></script>
<!-- 引入有度js文件 -->
<!-- <script src="<%=request.getContextPath()%>/htwyRes/js/youdu_js_sdk/youdu_sdk.js" type="text/javascript"></script>-->
<!-- 引入第三方toast弹窗组件 -->
<script src="../../../gaojinsoft/y2017/me/js/layer/mobile/layer.js"
type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/layerCommonJs.js" type="text/javascript"
charset="utf-8"></script>
<!-- 图片浏览器 -->
<!-- <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/htwyRes/js/simplelightbox/simplelightbox.min.css"/>-->
<!-- <script type="text/javascript" charset="utf-8" src="<%=request.getContextPath()%>/htwyRes/js/simplelightbox/simple-lightbox.min.js"></script>-->
<script src="../../../gaojinsoft/y2017/me/js/commonJs.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/jqCommonJs.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2020/supermarket/commonJs/vueCommonJs.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="app.css"/>
</head>
<body>
<div style="padding-bottom: 0rem;background-color: white;">
<div style="text-align: center;background-color: #f4b149;font-size: 20px;color: white">
人脸校验
</div>
<div class="take-face-photo" style="display: block;width: 100%;height: 400px;">
<div style="padding: 3px 5px;height: 220px;">
<div style="width: 100%;height: 100%;overflow: hidden;border-radius: 0.3rem;position: relative;">
<div class="face-image-background" id="takeFaceBackgroup"
style="background: url(./images/order/face-image-icon-noadd.png) no-repeat;height: 100%;width: 100%;background-size: 100% 100%;position: relative;">
<img src="" id="take-face-photo-show"
style="width: auto;height: auto;max-width: 100%;max-height: 100%;border-radius: 0.3rem;border: 0.1rem dashed #ccc;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);">
<!-- <img id="take-face-photo-show-temp" src="">-->
<input type="text" value="" style="visibility: hidden" name="faceImg" id="faceImg">
</div>
</div>
</div>
<div class="face-request" style="height: 5%;margin-left: 5px;margin-right: 5px;text-align: center">
<div style="width: 60px;display: inline-block;border-top: 0.05rem solid #f2ebeb;"></div>
<div style="display: inline-block;width: 32.5%;text-align: center;font-size: 0.45rem;color: #b7b4b4;">温馨提示
</div>
<div style="width: 60px;display: inline-block;border-top: 0.05rem solid #f2ebeb;"></div>
</div>
<div class="face-request-img"
style="padding: 5px 15px; display: flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;">
<div style=" width: 30%;">
<div style="background: url(./images/order/face-req-1.png) center center no-repeat; height: 50px;margin: 5px;background-size: contain;">
</div>
<div style="text-align: center;font-size: 0.4rem;color: black;">
摘掉眼镜
</div>
</div>
<div style=" width: 30%;">
<div style="background: url(./images/order/face-req-2.png) center center no-repeat ;height: 50px;margin: 5px;background-size: contain;">
</div>
<div style="text-align: center;font-size: 0.4rem;color: black;">
光线充足
</div>
</div>
<div style=" width: 30%;">
<div style="background: url(./images/order/face-req-3.png) center center no-repeat;height: 50px;margin: 5px;background-size: contain;">
</div>
<div style="text-align: center;font-size: 0.4rem;color: black;">
不要戴帽子
</div>
</div>
</div>
<div class="face-request-img"
style="padding: 5px 15px; display: flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;">
<div class="sfz-request-tips" style="height: 45%;width: 100%;">
<div style="display: inline-block;text-align: left;font-size: 0.4rem;color: black;padding: 2%;">
1、请将人脸正对手机,置于屏幕中央,并保持光线充足;
</div>
<div style="display: inline-block;text-align: left;font-size: 0.4rem;color: black;padding: 2%;">
2、保持网络良好,按系统提示操作;
</div>
</div>
</div>
<div class="">
<div Style="float:left;width: 49%">
<label class="btn btn-primary btn-xl btn-block" style="padding-top: 8px">
拍照
<input id="take-face-photo-input" img-attr="1" accept="image/*" type="file" style="display: none;"
onchange="showImageFileChageFun(this)">
</label>
</div>
<div Style="float:right;width: 49%">
<button type="button" class="btn btn-primary btn-xl btn-block" onclick="checkFaceFun()">上传校验</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var faceId = commonJs.getUrlParam("faceId");
var urlAttach = decodeURIComponent(commonJs.getUrlParam("url"));
function checkFaceFun() {
console.info("enterFaceFun");
var imgData = getElementVal("#faceImg");
imgData = commonJs.getFileDateString(imgData);
var dataTemp={
faceId:faceId,
imgData:imgData
};
var url = vueCommonJs.getApplyPath() + '/yami/AipFaceAction/faceMatch.do';
ajaxPost(url, dataTemp, "确定校验", function (result) {
console.info(result);
if (result.flag) {
// elementEnabled('#sendSmsCode',false);
// openToast("校验成功", 2000);
YmWindowLocation(urlAttach);
} else {
openAlert("校验失败,请重新校验!,失败原因" + result.msg);
}
},);
}
function showImageFileChageFun(th) {
// var ds= $(th).parent();
var filePath = $(th).val();//读取图片路径
if (!filePath) {
return;
}
if (filePath === "") {
return;
}
//读取文件进行显示
readImageFileAsDataURL(th.files[0], function (e) {
console.info("e.target.result len = " + e.target.result.length);
compressImageData(e.target.result, 0.7, function (data) {
console.info("data len = " + data.length);
setAttrValue("#take-face-photo-show", "src", data);
setElementVal("#faceImg", data);
$("#takeFaceBackgroup").css("background", "");
});
});
}
</script>
</html>
<!DOCTYPE HTML>
<html>
<head xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="format-detection" content="telephone=no">
<title>人脸录入</title>
<style>
* {
margin: 0;
margin-top: 0;
margin-bottom: 0;
margin-left: 0;
margin-right: 0;
padding: 0;
padding-top: 0;
padding-bottom: 0;
padding-left: 0;
padding-right: 0;
}
.pp {
margin: 5px 0 5px;
}
.iconsize {
font-size: 16px;
}
.mt5 {
margin-top: 5px;
margin-left: 5px;
border-bottom: 1px solid #f5f5f5;
}
.y2lable {
width: 50%;
text-align: left;
height: 34px;
line-height: 34px;
}
.pdl5 {
padding-left: 5px;
height: 34px;
line-height: 34px;
width: 62%;
}
.form-control {
padding: 0px 12px;
border: none;
outline: none;
box-shadow: none;
}
.btn {
border-radius: 0;
height: 40px;
font-size: 18px;
}
.btn-primary {
background-color: #689BC6;
}
#dlg_form {
padding-bottom: 55px;
}
button {
background-color: #fff;
border: 1px solid #d4d0c8;
}
.mt5 {
margin-top: 5px;
margin-left: 8px;
border-bottom: 1px solid #f5f5f5;
}
.ystitle {
font-size: 16px;
height: 40px;
line-height: 40px;
color: #000000;
border-bottom: 0px solid #dedede;
padding-left: 5px;
font-weight: bold;
}
.panel-default {
border-color: #ddd;
border-bottom: 0px white;
box-shadow: unset;
border-top-color: #ec7138;
background-color: #fff;
border-radius: 0px;
}
.imgbox {
width: 72px;
height: 100px;
position: relative;
display: inline-block;
margin: 0 14px 5px 0px;
}
.imgbox img {
z-index: 1;
border: 0px solid #000;
position: absolute;
top: 0;
left: 0;
}
.imgbox .reimgbtn {
z-index: 2;
display: inline-block;
position: absolute;
top: -12px;
right: -12px;
background: red;
width: 24px;
height: 24px;
text-align: center;
font-size: 24px;
line-height: 24px;
border-radius: 50%;
color: #fff;
}
.file {
position: relative;
display: inline-block;
background: #fff;
border: 1px dashed #fff;
border-radius: 4px;
overflow: hidden;
text-decoration: none;
text-indent: 0;
line-height: 20px;
}
.file input {
position: absolute;
font-size: 45px;
right: 0;
top: 0;
opacity: 0;
}
.clear {
clear: both
}
</style>
<link href="../../../gaojinsoft/y2017/me/css/bootstrap.min.css" rel="stylesheet"
type="text/css"/>
<link href="../../../gaojinsoft/y2017/me/css/iconfont/iconfont.css" rel="stylesheet"
type="text/css">
<script src="../../../gaojinsoft/y2017/me/js/jquery-1.11.1.min.js"
type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/bootstrap.min.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/iconfont.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/mobileBUGFix.mini.js"
type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/upload.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/exif.js" type="text/javascript"></script>
<!-- 引入有度js文件 -->
<!-- <script src="<%=request.getContextPath()%>/htwyRes/js/youdu_js_sdk/youdu_sdk.js" type="text/javascript"></script>-->
<!-- 引入第三方toast弹窗组件 -->
<script src="../../../gaojinsoft/y2017/me/js/layer/mobile/layer.js"
type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/layerCommonJs.js" type="text/javascript"
charset="utf-8"></script>
<!-- 图片浏览器 -->
<!-- <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/htwyRes/js/simplelightbox/simplelightbox.min.css"/>-->
<!-- <script type="text/javascript" charset="utf-8" src="<%=request.getContextPath()%>/htwyRes/js/simplelightbox/simple-lightbox.min.js"></script>-->
<script src="../../../gaojinsoft/y2017/me/js/commonJs.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2017/me/js/jqCommonJs.js" type="text/javascript"></script>
<script src="../../../gaojinsoft/y2020/supermarket/commonJs/vueCommonJs.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="app.css"/>
</head>
<body>
<div style="padding-bottom: 0rem;background-color: white;">
<div style="text-align: center;background-color: #f4b149;font-size: 20px;color: white">
人脸录入
</div>
<div class="take-face-photo" style="display: block;width: 100%;height: 400px;">
<div style="padding: 3px 5px;height: 220px;">
<div style="width: 100%;height: 100%;overflow: hidden;border-radius: 0.3rem;position: relative;">
<div class="face-image-background" id="takeFaceBackgroup"
style="background: url(./images/order/face-image-icon-noadd.png) no-repeat;height: 100%;width: 100%;background-size: 100% 100%;position: relative;">
<img src="" id="take-face-photo-show"
style="width: auto;height: auto;max-width: 100%;max-height: 100%;border-radius: 0.3rem;border: 0.1rem dashed #ccc;position: absolute;top: 50%;left: 50%;transform: translate(-50%,-50%);">
<!-- <img id="take-face-photo-show-temp" src="">-->
<input type="text" value="" style="visibility: hidden" name="faceImg" id="faceImg">
</div>
</div>
</div>
<div class="face-request" style="height: 5%;margin-left: 5px;margin-right: 5px;text-align: center">
<div style="width: 60px;display: inline-block;border-top: 0.05rem solid #f2ebeb;"></div>
<div style="display: inline-block;width: 32.5%;text-align: center;font-size: 0.45rem;color: #b7b4b4;">温馨提示
</div>
<div style="width: 60px;display: inline-block;border-top: 0.05rem solid #f2ebeb;"></div>
</div>
<div class="face-request-img"
style="padding: 5px 15px; display: flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;">
<div style=" width: 30%;">
<div style="background: url(./images/order/face-req-1.png) center center no-repeat; height: 50px;margin: 5px;background-size: contain;">
</div>
<div style="text-align: center;font-size: 0.4rem;color: black;">
摘掉眼镜
</div>
</div>
<div style=" width: 30%;">
<div style="background: url(./images/order/face-req-2.png) center center no-repeat ;height: 50px;margin: 5px;background-size: contain;">
</div>
<div style="text-align: center;font-size: 0.4rem;color: black;">
光线充足
</div>
</div>
<div style=" width: 30%;">
<div style="background: url(./images/order/face-req-3.png) center center no-repeat;height: 50px;margin: 5px;background-size: contain;">
</div>
<div style="text-align: center;font-size: 0.4rem;color: black;">
不要戴帽子
</div>
</div>
</div>
<div class="face-request-img"
style="padding: 5px 15px; display: flex;flex-direction:row;flex-wrap:nowrap;justify-content:space-between;">
<div class="sfz-request-tips" style="height: 45%;width: 100%;">
<div style="display: inline-block;text-align: left;font-size: 0.4rem;color: black;padding: 2%;">
1、请将人脸正对手机,置于屏幕中央,并保持光线充足;
</div>
<div style="display: inline-block;text-align: left;font-size: 0.4rem;color: black;padding: 2%;">
2、保持网络良好,按系统提示操作;
</div>
</div>
</div>
<div class="">
<div Style="float:left;width: 49%">
<label class="btn btn-primary btn-xl btn-block" style="padding-top: 8px">
拍照
<input id="take-face-photo-input" img-attr="1" accept="image/*" type="file" style="display: none;"
onchange="showImageFileChageFun(this)">
</label>
</div>
<div Style="float:right;width: 49%">
<button type="button" class="btn btn-primary btn-xl btn-block" onclick="enterFaceFun()">上传录入</button>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
var cardNum = commonJs.getUrlParam("cardNum");
function enterFaceFun() {
console.info("enterFaceFun");
var imgData = getElementVal("#faceImg");
imgData = commonJs.getFileDateString(imgData);
var dataTemp = {
cardNum: cardNum,
imgData: imgData
};
var url = vueCommonJs.getApplyPath() + '/yami/AipFaceAction/faceAdd.do';
ajaxPost(url, dataTemp, "确定录入", function (result) {
console.info(result);
if (result.flag) {
// elementEnabled('#sendSmsCode',false);
updateFaceIdToSales(cardNum,result.data.faceId);
} else {
openAlert("录入失败,请重新校验!,失败原因" + result.msg);
}
},);
}
function updateFaceIdToSales(cardNum, faceId) {
console.info("updateFaceIdToSales");
var imgData = getElementVal("#faceImg");
imgData = commonJs.getFileDateString(imgData);
var dataTemp = {
cardNum: cardNum,
faceId: faceId
};
var url = vueCommonJs.getApplyPath() + '/yami/AipFaceAction/updateFaceIdToSales.do';
ajaxPost(url, dataTemp, "", function (result) {
console.info(result);
if (result.flag) {
openAlert("录入成功" + result.msg,"",function () {
var urlTemp = vueCommonJs.getApplyPath()+'/yami/SuperMarketApplyAction/applyList.do?type=1';
YmWindowLocation(urlTemp);
});
} else {
openAlert("更新用户人脸信息失败!,失败原因" + result.msg);
}
},);
}
function showImageFileChageFun(th) {
// var ds= $(th).parent();
var filePath = $(th).val();//读取图片路径
if (!filePath) {
return;
}
if (filePath === "") {
return;
}
//读取文件进行显示
readImageFileAsDataURL(th.files[0], function (e) {
console.info("e.target.result len = " + e.target.result.length);
compressImageData(e.target.result, 0.7, function (data) {
console.info("data len = " + data.length);
setAttrValue("#take-face-photo-show", "src", data);
setElementVal("#faceImg", data);
$("#takeFaceBackgroup").css("background", "");
});
});
}
</script>
</html>
分享到:
相关推荐
区块链_智能合约_Solidity_保险应用_基于以太坊的技_1744433266
内容概要:本文档详细介绍了在Windows系统上安装MySQL数据库的具体步骤。首先,需要配置系统环境变量,包括新建MYSQL_HOME变量并将其添加到PATH中;其次,创建并编辑my.ini配置文件,设置MySQL的基本参数如端口、字符集、数据存放目录等;接着,在命令行工具中通过一系列指令完成MySQL的初始化、服务安装、启动以及root用户的密码设置和权限调整。整个流程涵盖了从环境搭建到最终确保MySQL服务正常运行的所有关键环节。 适合人群:适用于有一定计算机操作基础,尤其是对数据库管理有一定兴趣或需求的技术人员。 使用场景及目标:①帮助用户在本地机器上成功部署MySQL数据库环境;②确保用户能够掌握MySQL的基本配置与管理技能,如环境变量配置、服务安装与卸载、用户权限管理等。 其他说明:在安装过程中可能会遇到一些常见问题,例如由于之前版本残留导致的服务安装失败,此时可以通过命令行删除旧服务(sc delete mysql)来解决。此外,为了保证安全性,务必及时修改root用户的初始密码。
内容概要:`STARTUP.A51` 是 Keil C51 编译器自带的启动文件,用于初始化 8051 单片机的硬件和软件环境。该文件主要完成三个任务:初始化堆栈指针、清零内部数据存储器、跳转到主程序。文件中定义了内存模式(如 SMALL),并设置了堆栈指针的初始值为 0x60。接着通过循环将内部数据存储器的所有字节清零,确保程序开始时数据存储器的状态是确定的。此外,文件还列出了 8051 单片机的各个中断向量地址,并为每个中断提供占位符,实际的中断处理程序需要在其他文件中实现。最后,启动代码段初始化堆栈指针和数据段后,跳转到 `MAIN` 函数开始执行主程序。; 适合人群:对嵌入式系统开发有一定了解,尤其是使用 8051 单片机的开发者。; 使用场景及目标:①理解 8051 单片机启动文件的工作原理;②掌握如何初始化堆栈指针和数据段;③熟悉中断向量表的设置及其作用。; 其他说明:此文件为程序正常运行提供了必要的初始化操作,开发者可以根据具体需求修改该文件以适应不同的硬件和软件环境。
内容概要:该论文研究了一种基于行波理论的输电线路故障诊断方法。当输电线路发生故障时,故障点会产生向两侧传播的电流和电压行波。通过相模变换对三相电流行波解耦,利用解耦后独立模量间的关系确定故障类型和相别,再采用小波变换模极大值法标定行波波头,从而计算故障点距离。仿真结果表明,该方法能准确识别故障类型和相别,并对故障点定位具有高精度。研究使用MATLAB进行仿真验证,为输电线路故障诊断提供了有效解决方案。文中详细介绍了三相电流信号生成、相模变换(Clarke变换)、小波变换波头检测、故障诊断主流程以及结果可视化等步骤,并通过多个实例验证了方法的有效性和准确性。 适合人群:具备一定电力系统基础知识和编程能力的专业人士,特别是从事电力系统保护与控制领域的工程师和技术人员。 使用场景及目标:①适用于电力系统的故障检测与诊断;②能够快速准确地识别输电线路的故障类型、相别及故障点位置;③为电力系统的安全稳定运行提供技术支持,减少停电时间和损失。 其他说明:该方法不仅在理论上进行了深入探讨,还提供了完整的Python代码实现,便于读者理解和实践。此外,文中还讨论了行波理论的核心公式、三相线路行波解耦、行波测距实现等关键技术点,并针对工程应用给出了注意事项,如波速校准、采样率要求、噪声处理等。这使得该方法不仅具有学术价值,也具有很强的实际应用前景。
内容概要:本文详细介绍了光伏-混合储能微电网能量管理系统的模型架构及其控制策略。首先探讨了光伏发电模块中的MPPT(最大功率点跟踪)控制,采用扰动观察法和改进型变步长策略来提高光伏板的发电效率。接着重点讲解了混合储能系统的功率分配,利用一阶低通滤波算法将功率需求分为低频和高频两部分,分别由蓄电池和超级电容处理。此外,文中还深入讨论了SOC(荷电状态)管理策略,确保电池和超级电容在不同工作状态下保持最佳性能。仿真结果显示,在光伏出力剧烈波动的情况下,系统能够有效地维持稳定的电压水平,并显著提高了储能设备的使用寿命。 适合人群:对光伏微电网、储能技术和能量管理系统感兴趣的科研人员、工程师和技术爱好者。 使用场景及目标:适用于研究和开发高效、可靠的光伏-混合储能微电网系统,旨在优化能量管理和提高系统稳定性。具体应用场景包括但不限于家庭光伏系统、小型微电网以及工业能源管理系统。 其他说明:文中提供了详细的代码实现和仿真结果,便于读者理解和复现实验。同时,模型设计采用了模块化思路,方便进行个性化修改和扩展。
内容概要:本文详细介绍了基于MATLAB和CVX平台实现的储能调峰调频联合优化模型。该模型不仅涵盖了储能的基本参数设定、负荷不确定性处理、充放电策略制定,还包括了调峰调频的联合调度、功率约束处理、鲁棒优化等方面的内容。通过构建考虑电池退化成本、充放电功率约束以及用户负荷不确定性的储能优化模型,展现了储能系统在电力系统中的高效协同工作。文中提供了详细的代码示例,解释了各个部分的功能和实现方法,强调了模型的深度与创新性。 适合人群:适用于具有一定编程基础和技术背景的研究人员、工程师以及希望深入了解储能系统优化的学生。 使用场景及目标:该模型主要用于电力系统中储能设备的优化调度,旨在提高储能系统的经济效益和社会效益。通过联合调峰调频,能够显著提升储能系统的收益,实现1+1>2的超线性增益效果。此外,该模型还可以用于教学和科研,帮助初学者理解和掌握储能优化的相关技术和理论。 其他说明:代码中包含了丰富的注释和模块化的子程序,使得整个模型易于理解和扩展。对于有经验的开发者,可以在现有基础上进一步改进和定制,以适应不同的应用场景。
大模型技术白皮书2023版
图像增广 PyTorch 版
批量修改文件名可以帮助用户节省大量时间,提高工作效率 里面附带使用教程
《计算机应用基础》第2章--Windows-XP操作系统.ppt
包括:源程序工程文件、Proteus仿真工程文件、电路原理图文件、配套技术手册、论文资料等 1、采用51/52单片机(通用)作为主控芯片; 2、采用1602液晶显示使用过程及状态,液晶屏亮度会随光线自动调整; 3、按键输入6位密码,输入密码正确则锁打开,显示open!输入密码错误次数超过3次,蜂鸣器报警并且锁定键盘; 4、密码可以自己修改,必须是锁打开时才能改密,为防止误操作,修改密码得输入两次; 5、采用24C02保存密码,掉电不丢失; 6、可通过红外遥控器输入密码操作锁的状态;
内容概要:本文深入剖析了2025年全球感知技术的十大发展趋势,涵盖多模态感知融合、3D感知与空间计算、脑机接口中的感知反馈技术、5G/6G赋能的超低延迟感知、语音与情感识别的高级化、生物感知与数字健康、环境感知与自适应智能、增强现实(AR)与触觉反馈技术、气味与化学感知、量子感知与极端条件测量。文章详细介绍了每项技术的技术原理、关键算法、实现方式、商业案例及未来前景,强调了感知技术在智慧城市、自动驾驶、智慧医疗、工业自动化等领域的深刻影响。报告指出,感知技术正从单一传感模式向多模态融合、从二维数据向三维空间重建、从传统网络通信向超低延迟和高可靠性网络升级,实现全场景、全维度的智能感知。; 适合人群:对感知技术感兴趣的科技爱好者、研究人员、决策者、企业管理层和投资人。; 使用场景及目标:①了解感知技术的最新进展和未来发展方向;②为技术研究提供全面、深入的参考;③为商业应用提供具体的案例和前景分析;④推动跨领域协同创新,构建开放共赢的产业生态。; 其他说明:报告基于近年来技术研发的最新进展、业界前沿的技术路线以及各大科技企业在商业落地方面的丰富实践。随着感知技术的不断成熟,数据隐私与安全保护问题也需高度重视,以确保技术进步与社会伦理和谐统一。未来,感知技术将成为推动社会进步和产业升级的重要力量,为实现万物互联、智慧决策和智能体验提供无限可能。
本论文主要论述了如何使用JAVA语言开发一个校园新闻网站 ,本系统将严格按照软件开发流程进行各个阶段的工作,采用B/S架构,面向对象编程思想进行项目开发。在引言中,作者将论述校园新闻网站的当前背景以及系统开发的目的,后续章节将严格按照软件开发流程,对系统进行各个阶段分析设计。 校园新闻网站的主要使用者分为管理员和用户,实现功能包括管理员:首页、个人中心、用户管理、新闻类型管理、校园新闻管理、留言板管理、论坛交流、系统管理,用户前台:首页、校园新闻、论坛交流、留言反馈、个人中心、后台管理等功能。由于本网站的功能模块设计比较全面,所以使得整个校园新闻网站信息管理的过程得以实现。 本系统的使用可以实现本校园新闻网站管理的信息化,可以方便管理员进行更加方便快捷的管理,可以提高管理人员的工作效率。 基于Springboot+vue的校园新闻网站【源码+数据库+参考论文】 感兴趣自行下载学习!
内容概要:本文详细探讨了三相三电平PWM整流器的闭环控制策略及其核心技术——三电平SVPWM算法。文章首先介绍了三相三电平PWM整流器的基本概念和优势,如输出三种电平以降低谐波含量并减少滤波器体积和成本。接着阐述了闭环控制策略的重要性,强调了电压外环和电流内环的双闭环控制机制。随后,文章深入讲解了三电平SVPWM算法的工作原理,包括空间电压矢量的选择、扇区判断、矢量作用时间和死区补偿等关键技术环节。此外,还讨论了中点电位平衡的问题以及PI参数的整定方法。最后,通过示波器测试验证了系统的性能指标,如THD低于3%,直流电压纹波小于1%。 适合人群:从事电力电子领域的工程师和技术人员,尤其是对三相三电平PWM整流器及其控制策略感兴趣的读者。 使用场景及目标:适用于高压大功率场合,旨在提高整流器的性能,降低谐波含量,实现单位功率因数运行。通过合理设计闭环控制策略和优化SVPWM算法,确保整流器在各种工况下都能稳定、高效地工作。 其他说明:文中提供了大量MATLAB和C语言代码片段,帮助读者更好地理解和实现相关算法。同时,针对实际调试过程中遇到的问题给出了实用的解决方案,如中点电位平衡和死区补偿等。
全新红娘本地交友系统定制版源码 相亲婚恋交友小程序源码
内容概要:文章探讨了AI技术,特别是DeepSeek,如何驱动地图生成的变革。首先介绍了地图制图在AI时代的背景与挑战,强调了DeepSeek与地图融合的两种主要方式:嵌入地图制图链和研发地图语言自身的预训练模型。随后详细描述了DeepSeek在地图生成中的具体应用,包括智能化地图生成器DoMapAI的整体框架,地图制图链中的知识图谱推理路径,以及地图语言的Token化过程。最后,文章总结了AI时代地图制图的职业变化和技术变革,指出地图制图正经历“大变局”。 适合人群:从事地图制图及相关领域的研究人员、工程师,以及对AI与地图生成感兴趣的学者。 使用场景及目标:①理解AI技术在地图生成中的应用,特别是DeepSeek的作用;②掌握智能化地图生成器DoMapAI的工作原理及其应用场景;③学习地图语言Token化的方法及其在地图生成中的应用;④探索AI时代地图制图的职业发展方向和技术变革。 阅读建议:本文内容较为专业,建议读者先了解基本的AI技术和地图制图知识。重点关注DeepSeek与地图融合的具体方法和应用场景,理解智能化地图生成器DoMapAI的工作流程,以及地图语言Token化的实现过程。在阅读过程中,可以结合实际案例进行思考,以更好地理解AI技术对地图制图的影响。
chromedriver-mac-arm64-135.0.7049.114.zip
《网络布线与小型局域网搭建(第2版)》第3章-布线系统的设计.ppt
内容概要:本文详细介绍了使用Abaqus软件进行子弹穿钢板模型的模拟方法,重点探讨了CAE文件的作用和创建过程。首先概述了子弹穿钢板模拟的重要性和应用场景,接着深入讲解了CAE文件的概念及其作为模拟‘大脑’的关键地位。文中提供了详细的Python代码示例,涵盖创建部件、定义材料属性、划分网格、设置接触条件以及显式动力学分析步骤等方面的内容。此外,还讨论了网格划分的艺术、接触设置的注意事项、求解器参数的选择以及后处理技巧,强调了每个环节的具体操作和优化建议。 适合人群:从事工程模拟领域的研究人员和技术人员,尤其是对Abaqus软件有一定了解并希望深入掌握其高级特性的用户。 使用场景及目标:适用于需要模拟高速冲击条件下材料行为的研究项目,如防护材料研发、结构抗冲击设计等。通过学习本文,读者能够掌握创建复杂工程模拟模型的方法,提高模拟效率和准确性。 其他说明:文章不仅提供了理论指导,还包括大量实用的操作提示和代码片段,有助于读者快速上手并在实践中不断改进模型。同时,文中提到的一些优化技巧对于提升计算性能和结果可靠性具有重要价值。
内容概要:本文详细介绍了机器视觉系统的关键技术及其应用,涵盖相机标定、OpenCV图像处理以及QT界面开发。首先,文章讲解了相机标定的基本概念和实现方法,通过OpenCV的camera_calibration工具进行标定,确保图像处理和识别的准确性。接着,探讨了图像处理的各种技术,如边缘检测、阈值处理和轮廓检测,展示了如何利用OpenCV库对图像进行预处理。随后,介绍了QT界面开发,通过PyQt5创建了一个直观友好的界面,使用户能够实时查看处理结果并控制设备。最后,讨论了视觉识别与抓取的具体实现,包括物体识别、坐标转换和机械臂控制,强调了多传感器融合的重要性。 适合人群:具备一定编程基础,尤其是对机器视觉感兴趣的开发者和技术爱好者。 使用场景及目标:适用于工业自动化、智能制造等领域,旨在帮助读者理解和实现完整的机器视觉系统,提高生产效率和精度。 其他说明:文中不仅提供了详细的代码示例,还分享了许多实践经验,如标定板制作、图像格式转换等,有助于读者避免常见错误并优化系统性能。