|
|
@@ -78,13 +78,13 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
long count = count(Wrappers.<SysUserCharacteristic>lambdaQuery()
|
|
|
.eq(SysUserCharacteristic::getUserId, userId));
|
|
|
int i = Integer.parseInt(sysAttrValue);
|
|
|
- Assert.isFalse(count >= i, "该人员的指纹录入已上限,最大"+ i + "条!");
|
|
|
+ Assert.isFalse(count >= i, "该人员的指纹录入已上限,最大" + i + "条!");
|
|
|
}
|
|
|
|
|
|
// 时间戳
|
|
|
long currentTimestamp = System.currentTimeMillis();
|
|
|
// 设置文件路径
|
|
|
- String filePath = RuoYiConfig.getProfile() + "/finger/" + userId +"/";
|
|
|
+ String filePath = RuoYiConfig.getProfile() + "/finger/" + userId + "/";
|
|
|
if (StringUtils.isBlank(prodApi)) {
|
|
|
filePath = "C:" + filePath;
|
|
|
}
|
|
|
@@ -119,6 +119,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
+ Assert.isFalse(true, "该文件指纹无法识别,请重新录入!");
|
|
|
}
|
|
|
SysUserCharacteristic sysUserCharacteristic = new SysUserCharacteristic();
|
|
|
sysUserCharacteristic.setUserId(userId);
|
|
|
@@ -134,14 +135,17 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
public static byte[] extractFingerprintTemplate(String imagePath) throws IOException {
|
|
|
// 读取图像文件(灰度图像 PNG, BMP, JPEG 等)
|
|
|
byte[] imageBytes = Files.readAllBytes(Paths.get(imagePath));
|
|
|
-
|
|
|
- // 提取特征值
|
|
|
- FingerprintTemplate template = new FingerprintTemplate()
|
|
|
- .dpi(500) // 指定 DPI (重要,通常为 500)
|
|
|
- .create(imageBytes);
|
|
|
-
|
|
|
- // 导出为 byte[] 保存特征值
|
|
|
- return template.serialize().getBytes();
|
|
|
+ try {
|
|
|
+ // 提取特征值
|
|
|
+ FingerprintTemplate template = new FingerprintTemplate()
|
|
|
+ .dpi(500) // 指定 DPI (重要,通常为 500)
|
|
|
+ .create(imageBytes);
|
|
|
+ // 导出为 byte[] 保存特征值
|
|
|
+ return template.serialize().getBytes();
|
|
|
+ } catch (Exception e) {
|
|
|
+ Assert.isFalse(true, "该文件指纹无法识别,请重新录入!");
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@@ -157,7 +161,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
long count = count(Wrappers.<SysUserCharacteristic>lambdaQuery()
|
|
|
.eq(SysUserCharacteristic::getUserId, userId));
|
|
|
int i = Integer.parseInt(sysAttrValue);
|
|
|
- Assert.isFalse(count >= i, "该人员的人脸录入已上限,最大"+ i + "条!");
|
|
|
+ Assert.isFalse(count >= i, "该人员的人脸录入已上限,最大" + i + "条!");
|
|
|
}
|
|
|
FaceCutVO faceCutVO = FaceCutUtil.imageFaceDetection(file, userId, url);
|
|
|
SysUserCharacteristic sysUserCharacteristic = new SysUserCharacteristic();
|
|
|
@@ -188,7 +192,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
long count = count(Wrappers.<SysUserCharacteristic>lambdaQuery()
|
|
|
.eq(SysUserCharacteristic::getUserId, userId));
|
|
|
int i = Integer.parseInt(sysAttrValue);
|
|
|
- Assert.isFalse(count >= i, "该人员的人脸录入已上限,最大"+ i + "条!");
|
|
|
+ Assert.isFalse(count >= i, "该人员的人脸录入已上限,最大" + i + "条!");
|
|
|
}
|
|
|
FaceCutVO faceCutVO = ArcSoftMothodUtil.saveArcData(file, userId, url);
|
|
|
SysUserCharacteristic sysUserCharacteristic = new SysUserCharacteristic();
|