|
|
@@ -45,13 +45,21 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Boolean insertUserFingerprintDat(MultipartFile file, String userName) throws IOException {
|
|
|
+ public Boolean insertUserFingerprintDat(MultipartFile file, String userName, String sysAttrValue) throws IOException {
|
|
|
Assert.notBlank(userName, "请告知我这是哪个用户的指纹!");
|
|
|
Assert.isTrue(file.getSize() > 0, "指纹信息不能为空!");
|
|
|
SysUser user = iSysUserService.getOne(Wrappers.<SysUser>lambdaQuery()
|
|
|
.eq(SysUser::getUserName, userName));
|
|
|
Assert.isFalse(user == null, "系统中无该用户!");
|
|
|
Long userId = user.getUserId();
|
|
|
+ if (StringUtils.isNotBlank(sysAttrValue)) {
|
|
|
+ // 检查人员指纹上限
|
|
|
+ long count = count(Wrappers.<SysUserCharacteristic>lambdaQuery()
|
|
|
+ .eq(SysUserCharacteristic::getUserId, userId));
|
|
|
+ int i = Integer.parseInt(sysAttrValue);
|
|
|
+ Assert.isFalse(count >= i, "该人员的指纹录入已上限,最大"+ i + "条!");
|
|
|
+ }
|
|
|
+
|
|
|
// 时间戳
|
|
|
long currentTimestamp = System.currentTimeMillis();
|
|
|
// 设置文件路径
|
|
|
@@ -72,8 +80,9 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
file.transferTo(targetLocation.toFile());
|
|
|
|
|
|
// 开始生成dat文件
|
|
|
+ String imagePath = null;
|
|
|
try {
|
|
|
- String imagePath = filePath + fileName; // 替换为你的指纹图片路径
|
|
|
+ imagePath = filePath + fileName; // 替换为你的指纹图片路径
|
|
|
byte[] fingerprintData = extractFingerprintTemplate(imagePath);
|
|
|
|
|
|
// 保存到文件
|
|
|
@@ -87,6 +96,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
sysUserCharacteristic.setType("1");
|
|
|
sysUserCharacteristic.setContent(filePath + userId + "_" + currentTimestamp + ".dat");
|
|
|
sysUserCharacteristic.setOrderNum(0);
|
|
|
+ sysUserCharacteristic.setImageUrl(imagePath);
|
|
|
save(sysUserCharacteristic);
|
|
|
return true;
|
|
|
}
|