|
@@ -45,7 +45,7 @@
|
|
<span style="color:black;">{{batchConcurrency}}</span>
|
|
<span style="color:black;">{{batchConcurrency}}</span>
|
|
</span>
|
|
</span>
|
|
<span>
|
|
<span>
|
|
- 并发请求:
|
|
|
|
|
|
+ 实时并发:
|
|
<span style="color:black;">{{reqNum}}</span>
|
|
<span style="color:black;">{{reqNum}}</span>
|
|
</span>
|
|
</span>
|
|
<span>
|
|
<span>
|
|
@@ -80,7 +80,7 @@
|
|
:key="msgInfo.fileName"
|
|
:key="msgInfo.fileName"
|
|
>
|
|
>
|
|
<p class='console-line'>
|
|
<p class='console-line'>
|
|
- <span>{{msgInfo.fileName}}:{{msgInfo.msg}}</span>
|
|
|
|
|
|
+ <span class="filename">{{msgInfo.fileName}}</span><span>{{msgInfo.msg}}</span>
|
|
</p>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
@@ -89,7 +89,7 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-const CryptoJS = require("crypto-js");
|
|
|
|
|
|
+// const CryptoJS = require("crypto-js");
|
|
const Base64 = require("js-base64").Base64;
|
|
const Base64 = require("js-base64").Base64;
|
|
const fs = window.nodeRequire("fs");
|
|
const fs = window.nodeRequire("fs");
|
|
const path = window.nodeRequire("path");
|
|
const path = window.nodeRequire("path");
|
|
@@ -247,17 +247,19 @@ export default {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
const photoFile = fs.readFileSync(studentPhotoPath);
|
|
const photoFile = fs.readFileSync(studentPhotoPath);
|
|
|
|
+ const photoFileName =path
|
|
|
|
+ .basename(studentPhotoPath)
|
|
const rootOrgId = localStorage.getItem("rootOrgId");
|
|
const rootOrgId = localStorage.getItem("rootOrgId");
|
|
|
|
|
|
//生成新名称
|
|
//生成新名称
|
|
- let serverPhotoPath = null;
|
|
|
|
- const upyunPhotoPath = studentId => {
|
|
|
|
- const md5Hash = CryptoJS.MD5(
|
|
|
|
- Base64.encode(studentId + new Date().getTime())
|
|
|
|
- ).toString();
|
|
|
|
- serverPhotoPath = md5Hash + fileSuffix;
|
|
|
|
- return rootOrgId + "/" + studentId + "/" + md5Hash + fileSuffix;
|
|
|
|
- };
|
|
|
|
|
|
+ // let serverPhotoPath = null;
|
|
|
|
+ // const upyunPhotoPath = studentId => {
|
|
|
|
+ // const md5Hash = CryptoJS.MD5(
|
|
|
|
+ // Base64.encode(studentId + new Date().getTime())
|
|
|
|
+ // ).toString();
|
|
|
|
+ // serverPhotoPath = md5Hash + fileSuffix;
|
|
|
|
+ // return rootOrgId + "/" + studentId + "/" + md5Hash + fileSuffix;
|
|
|
|
+ // };
|
|
|
|
|
|
// 核心流程:
|
|
// 核心流程:
|
|
// 1. get studentId from ecs
|
|
// 1. get studentId from ecs
|
|
@@ -269,24 +271,29 @@ export default {
|
|
// 每一步出错都会保存到错误日志
|
|
// 每一步出错都会保存到错误日志
|
|
try {
|
|
try {
|
|
// 不用Promise.all的原因是每一步失败就不用进行下一步了
|
|
// 不用Promise.all的原因是每一步失败就不用进行下一步了
|
|
- let studentId = await this.getStudentId(rootOrgId, identityNumber);
|
|
|
|
- let faceToken = await this.detectFace(photoFile);
|
|
|
|
- this.faceSetToken = await this.getFaceSetToken();
|
|
|
|
- let faceCount = await this.addFaceToSet(this.faceSetToken, faceToken);
|
|
|
|
-
|
|
|
|
- await this.saveImageToUpyun({
|
|
|
|
- upyunPhotoPath: upyunPhotoPath(studentId),
|
|
|
|
- photoFile
|
|
|
|
- });
|
|
|
|
- const photoInfo = {
|
|
|
|
- studentId: studentId,
|
|
|
|
- faceSetToken: this.faceSetToken,
|
|
|
|
- faceToken: faceToken,
|
|
|
|
- rootOrgId: rootOrgId,
|
|
|
|
- faceCount,
|
|
|
|
- photoName: serverPhotoPath
|
|
|
|
- };
|
|
|
|
- await this.saveStudentFaceInfoByPut(photoInfo);
|
|
|
|
|
|
+ // let studentId = await this.getStudentId(rootOrgId, identityNumber);
|
|
|
|
+ // let faceToken = await this.detectFace(photoFile);
|
|
|
|
+ // this.faceSetToken = await this.getFaceSetToken();
|
|
|
|
+ // let faceCount = await this.addFaceToSet(this.faceSetToken, faceToken);
|
|
|
|
+
|
|
|
|
+ // await this.saveImageToUpyun({
|
|
|
|
+ // upyunPhotoPath: upyunPhotoPath(studentId),
|
|
|
|
+ // photoFile
|
|
|
|
+ // });
|
|
|
|
+ // const photoInfo = {
|
|
|
|
+ // studentId: studentId,
|
|
|
|
+ // faceSetToken: this.faceSetToken,
|
|
|
|
+ // faceToken: faceToken,
|
|
|
|
+ // rootOrgId: rootOrgId,
|
|
|
|
+ // faceCount,
|
|
|
|
+ // photoName: serverPhotoPath
|
|
|
|
+ // };
|
|
|
|
+ // await this.saveStudentFaceInfoByPut(photoInfo);
|
|
|
|
+ let studentInfo = await this.getStudentInfo(rootOrgId, identityNumber);
|
|
|
|
+
|
|
|
|
+ if (studentInfo.photoPath) {
|
|
|
|
+ await this.saveStudentBasePhoto(photoFile, photoFileName);
|
|
|
|
+ }
|
|
this.finishOnePhotoSuccess("处理成功", studentPhotoPath);
|
|
this.finishOnePhotoSuccess("处理成功", studentPhotoPath);
|
|
|
|
|
|
{
|
|
{
|
|
@@ -327,6 +334,65 @@ export default {
|
|
});
|
|
});
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ async getStudentInfo(rootOrgId, identityNumber) {
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ this.$http
|
|
|
|
+ .get(
|
|
|
|
+ "/api/ecs_core/student/getStudentInfo?orgId=" +
|
|
|
|
+ rootOrgId +
|
|
|
|
+ "&identityNumber=" +
|
|
|
|
+ identityNumber
|
|
|
|
+ )
|
|
|
|
+ .then(res => {
|
|
|
|
+ var studentFaceInfo = res.data;
|
|
|
|
+ if (studentFaceInfo && studentFaceInfo.id) {
|
|
|
|
+ resolve(studentFaceInfo);
|
|
|
|
+ } else {
|
|
|
|
+ reject("查询身份证不存在");
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ .catch(err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ reject("根据身份证号码查询失败");
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ async saveStudentBasePhoto(file, filename) {
|
|
|
|
+ let config = {
|
|
|
|
+ headers: {
|
|
|
|
+ "Content-Type": "multipart/form-data",
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ let formData = new FormData();
|
|
|
|
+
|
|
|
|
+ let fileBlob = new Blob([file]);
|
|
|
|
+ formData.append("file", fileBlob, filename);
|
|
|
|
+ // formData.append("filename", filename);
|
|
|
|
+ // formData.append("Content-Type", "image/jpeg");
|
|
|
|
+
|
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
|
+ this.$http
|
|
|
|
+ .post("/api/ecs_outlet/facepp/add", formData, config)
|
|
|
|
+ .then(res => {
|
|
|
|
+ // var data = res.data;
|
|
|
|
+ // console.log(data);
|
|
|
|
+ // if (data) {
|
|
|
|
+ resolve('保存成功');
|
|
|
|
+ // } else {
|
|
|
|
+ // reject("保存失败");
|
|
|
|
+ // }
|
|
|
|
+ })
|
|
|
|
+ .catch(err => {
|
|
|
|
+ console.log(err);
|
|
|
|
+ if(err.response && err.response.data && err.response.data.desc) {
|
|
|
|
+ reject(err.response.data.desc)
|
|
|
|
+ } else {
|
|
|
|
+ reject("保存失败---未知错误");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ },
|
|
//保存文件至又拍云
|
|
//保存文件至又拍云
|
|
async saveImageToUpyun({ upyunPhotoPath, photoFile }) {
|
|
async saveImageToUpyun({ upyunPhotoPath, photoFile }) {
|
|
const url = process.env.VUE_APP_UPYUN_BUCKETURL + upyunPhotoPath;
|
|
const url = process.env.VUE_APP_UPYUN_BUCKETURL + upyunPhotoPath;
|
|
@@ -619,15 +685,19 @@ export default {
|
|
|
|
|
|
.console-panel .console-line {
|
|
.console-panel .console-line {
|
|
font-size: 14px;
|
|
font-size: 14px;
|
|
- text-align: center;
|
|
|
|
|
|
+ /* text-align: center; */
|
|
display: flex;
|
|
display: flex;
|
|
- justify-content: center;
|
|
|
|
- align-items: center;
|
|
|
|
|
|
+ /* justify-content: center; */
|
|
|
|
+ /* align-items: center; */
|
|
}
|
|
}
|
|
-
|
|
|
|
-.console-panel .console-line > span {
|
|
|
|
- margin: 0 10px;
|
|
|
|
|
|
+.console-line .filename {
|
|
|
|
+ text-align: right;
|
|
|
|
+ width: 300px;
|
|
|
|
+ margin-right: 10px;
|
|
}
|
|
}
|
|
|
|
+/* .console-panel .console-line > span {
|
|
|
|
+ margin: 0 10px;
|
|
|
|
+} */
|
|
|
|
|
|
.console-panel .console-line > span.red {
|
|
.console-panel .console-line > span.red {
|
|
color: #fc7156;
|
|
color: #fc7156;
|