|
@@ -1,9 +1,11 @@
|
|
|
package com.ktg.system.service.impl;
|
|
package com.ktg.system.service.impl;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.core.convert.Convert;
|
|
|
import cn.hutool.core.lang.Assert;
|
|
import cn.hutool.core.lang.Assert;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
+import com.ktg.common.config.RuoYiConfig;
|
|
|
import com.ktg.common.core.domain.entity.SysUser;
|
|
import com.ktg.common.core.domain.entity.SysUser;
|
|
|
import com.ktg.common.utils.StringUtils;
|
|
import com.ktg.common.utils.StringUtils;
|
|
|
import com.ktg.system.domain.SysUserCharacteristic;
|
|
import com.ktg.system.domain.SysUserCharacteristic;
|
|
@@ -16,10 +18,13 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.nio.file.Files;
|
|
import java.nio.file.Files;
|
|
|
import java.nio.file.Path;
|
|
import java.nio.file.Path;
|
|
|
import java.nio.file.Paths;
|
|
import java.nio.file.Paths;
|
|
|
|
|
+import java.util.Arrays;
|
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 用户特征(指纹、面部)Service业务层处理
|
|
* 用户特征(指纹、面部)Service业务层处理
|
|
@@ -38,9 +43,22 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
private ISysUserService iSysUserService;
|
|
private ISysUserService iSysUserService;
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public Page<SysUserCharacteristic> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic) {
|
|
|
|
|
|
|
+ public Page<SysUserCharacteristic> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic, String url) {
|
|
|
Page<SysUserCharacteristic> result = page(page, Wrappers.<SysUserCharacteristic>lambdaQuery()
|
|
Page<SysUserCharacteristic> result = page(page, Wrappers.<SysUserCharacteristic>lambdaQuery()
|
|
|
|
|
+ .eq(sysUserCharacteristic.getUserId() != null, SysUserCharacteristic::getUserId, sysUserCharacteristic.getUserId())
|
|
|
|
|
+ .eq(StringUtils.isNotBlank(sysUserCharacteristic.getType()), SysUserCharacteristic::getType, sysUserCharacteristic.getType())
|
|
|
.orderByDesc(SysUserCharacteristic::getRecordId));
|
|
.orderByDesc(SysUserCharacteristic::getRecordId));
|
|
|
|
|
+ String profile = RuoYiConfig.getProfile();
|
|
|
|
|
+ for (SysUserCharacteristic record : result.getRecords()) {
|
|
|
|
|
+ if (StringUtils.isNotBlank(record.getImageUrl())) {
|
|
|
|
|
+ if (record.getImageUrl().contains("C:" + profile)) {
|
|
|
|
|
+ record.setImageUrl(record.getImageUrl().replace("C:" + profile, url + "/profile"));
|
|
|
|
|
+ }
|
|
|
|
|
+ if (record.getImageUrl().contains(profile)) {
|
|
|
|
|
+ record.setImageUrl(record.getImageUrl().replace(profile, url + "/profile"));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -63,7 +81,7 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
// 时间戳
|
|
// 时间戳
|
|
|
long currentTimestamp = System.currentTimeMillis();
|
|
long currentTimestamp = System.currentTimeMillis();
|
|
|
// 设置文件路径
|
|
// 设置文件路径
|
|
|
- String filePath = "/home/iscs/finger/" + userId +"/";
|
|
|
|
|
|
|
+ String filePath = RuoYiConfig.getProfile() + "/finger/" + userId +"/";
|
|
|
if (StringUtils.isBlank(prodApi)) {
|
|
if (StringUtils.isBlank(prodApi)) {
|
|
|
filePath = "C:" + filePath;
|
|
filePath = "C:" + filePath;
|
|
|
}
|
|
}
|
|
@@ -114,4 +132,25 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
|
|
|
return template.serialize().getBytes();
|
|
return template.serialize().getBytes();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Boolean deleteSysUserCharacteristicByRecordIds(String recordIds) {
|
|
|
|
|
+ Assert.notBlank(recordIds, "请选择需要删除的数据!");
|
|
|
|
|
+ Long[] longIds = Convert.toLongArray(recordIds);
|
|
|
|
|
+ List<Long> list = Arrays.asList(longIds);
|
|
|
|
|
+ List<SysUserCharacteristic> sysUserCharacteristics = listByIds(list);
|
|
|
|
|
+ for (SysUserCharacteristic sysUserCharacteristic : sysUserCharacteristics) {
|
|
|
|
|
+ if (StringUtils.isNotBlank(sysUserCharacteristic.getContent())) {
|
|
|
|
|
+ File file = new File(sysUserCharacteristic.getContent());
|
|
|
|
|
+ if (!file.delete()) {
|
|
|
|
|
+ log.error("DAT文件删除失败: " + sysUserCharacteristic.getContent());
|
|
|
|
|
+ }
|
|
|
|
|
+ File file1 = new File(sysUserCharacteristic.getImageUrl());
|
|
|
|
|
+ if (!file1.delete()) {
|
|
|
|
|
+ log.error("img文件删除失败: " + sysUserCharacteristic.getImageUrl());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return removeBatchByIds(list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|