|
@@ -63,7 +63,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Boolean insertUserFingerprintDat(MultipartFile file, String userName, String sysAttrValue) throws IOException {
|
|
|
|
|
|
|
+ public Boolean insertUserFingerprintDat(MultipartFile file, String userName, String sysAttrValue, String url) throws IOException {
|
|
|
Assert.notBlank(userName, "请告知我这是哪个用户的指纹!");
|
|
Assert.notBlank(userName, "请告知我这是哪个用户的指纹!");
|
|
|
Assert.isTrue(file.getSize() > 0, "指纹信息不能为空!");
|
|
Assert.isTrue(file.getSize() > 0, "指纹信息不能为空!");
|
|
|
SysUser user = iSysUserService.getOne(Wrappers.<SysUser>lambdaQuery()
|
|
SysUser user = iSysUserService.getOne(Wrappers.<SysUser>lambdaQuery()
|
|
@@ -99,6 +99,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
|
|
|
|
|
// 开始生成dat文件
|
|
// 开始生成dat文件
|
|
|
String imagePath = null;
|
|
String imagePath = null;
|
|
|
|
|
+ String imageUrl = null;
|
|
|
try {
|
|
try {
|
|
|
imagePath = filePath + fileName; // 替换为你的指纹图片路径
|
|
imagePath = filePath + fileName; // 替换为你的指纹图片路径
|
|
|
byte[] fingerprintData = extractFingerprintTemplate(imagePath);
|
|
byte[] fingerprintData = extractFingerprintTemplate(imagePath);
|
|
@@ -106,6 +107,13 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
// 保存到文件
|
|
// 保存到文件
|
|
|
Files.write(Paths.get(filePath + userId + "_" + currentTimestamp + ".dat"), fingerprintData);
|
|
Files.write(Paths.get(filePath + userId + "_" + currentTimestamp + ".dat"), fingerprintData);
|
|
|
System.out.println("指纹特征值已保存!");
|
|
System.out.println("指纹特征值已保存!");
|
|
|
|
|
+ // 图片地址
|
|
|
|
|
+ String profile = RuoYiConfig.getProfile();
|
|
|
|
|
+ if (imagePath.contains("C:" + profile)) {
|
|
|
|
|
+ imageUrl = imagePath.replace("C:" + profile, url + "/profile");
|
|
|
|
|
+ } else if (imagePath.contains(profile)) {
|
|
|
|
|
+ imageUrl = imagePath.replace(profile, url + "/prod-api" + "/profile");
|
|
|
|
|
+ }
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
|
}
|
|
}
|
|
@@ -114,7 +122,8 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
sysUserCharacteristic.setType("1");
|
|
sysUserCharacteristic.setType("1");
|
|
|
sysUserCharacteristic.setContent(filePath + userId + "_" + currentTimestamp + ".dat");
|
|
sysUserCharacteristic.setContent(filePath + userId + "_" + currentTimestamp + ".dat");
|
|
|
sysUserCharacteristic.setOrderNum(0);
|
|
sysUserCharacteristic.setOrderNum(0);
|
|
|
- sysUserCharacteristic.setImageUrl(imagePath);
|
|
|
|
|
|
|
+ sysUserCharacteristic.setImageUrl(imageUrl);
|
|
|
|
|
+ sysUserCharacteristic.setImagePath(imagePath);
|
|
|
save(sysUserCharacteristic);
|
|
save(sysUserCharacteristic);
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -144,9 +153,9 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
if (!file.delete()) {
|
|
if (!file.delete()) {
|
|
|
log.error("DAT文件删除失败: " + sysUserCharacteristic.getContent());
|
|
log.error("DAT文件删除失败: " + sysUserCharacteristic.getContent());
|
|
|
}
|
|
}
|
|
|
- File file1 = new File(sysUserCharacteristic.getImageUrl());
|
|
|
|
|
|
|
+ File file1 = new File(sysUserCharacteristic.getImagePath());
|
|
|
if (!file1.delete()) {
|
|
if (!file1.delete()) {
|
|
|
- log.error("img文件删除失败: " + sysUserCharacteristic.getImageUrl());
|
|
|
|
|
|
|
+ log.error("img文件删除失败: " + sysUserCharacteristic.getImagePath());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|