瀏覽代碼

对接修改指纹多服务的不存在导致的获取不到的异常

车车 3 月之前
父節點
當前提交
d16e1bcf3c

+ 1 - 2
ktg-admin/src/main/java/com/ktg/web/controller/system/SysUserCharacteristicController.java

@@ -55,8 +55,7 @@ public class SysUserCharacteristicController extends BaseController
     @GetMapping("/getSysUserCharacteristicPage")
     public CommonResult<Page<SysUserCharacteristic>> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic)
     {
-        String url = serverConfig.getUrl();
-        Page<SysUserCharacteristic> result = sysUserCharacteristicService.getSysUserCharacteristicPage(page, sysUserCharacteristic, url);
+        Page<SysUserCharacteristic> result = sysUserCharacteristicService.getSysUserCharacteristicPage(page, sysUserCharacteristic);
         return CommonResult.success(result);
     }
 

+ 5 - 0
ktg-common/src/main/java/com/ktg/common/utils/FingerprintComparisonByDat.java

@@ -10,6 +10,7 @@ import com.machinezoo.sourceafis.FingerprintTemplate;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
@@ -94,6 +95,10 @@ public class FingerprintComparisonByDat {
                 double high = 0;
                 for (String matcherDat : matcherDatList) {
                     // 输入的指纹和指纹库中的指纹进行对比,找到当前线程中的分数最高的指纹
+                    boolean exists = new File(matcherDat).exists();
+                    if (!exists) {
+                        continue;
+                    }
                     FingerprintTemplate matcherTemp = new FingerprintTemplate().deserialize(new String(Files.readAllBytes(Paths.get(matcherDat))));
                     double score = matcher.match(matcherTemp);
                     if (score > high) {

+ 8 - 2
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/HardwareApiServiceImpl.java

@@ -517,8 +517,11 @@ public class HardwareApiServiceImpl implements HardwareApiService {
             IsJobTicket byId = isJobTicketService.getById(lockList.get(0).getTicketId());
             if (byId != null) {
                 List<String> nfcList = lockList.stream().map(LockPointBatchDTO::getPointNfc).collect(Collectors.toList());
+                List<IsRfidToken> list2 = iIsRfidTokenService.list(Wrappers.<IsRfidToken>lambdaQuery()
+                        .in(IsRfidToken::getRfid, nfcList));
+                List<Long> collect = list2.stream().map(IsRfidToken::getRfidId).collect(Collectors.toList());
                 List<IsIsolationPoint> list1 = iIsIsolationPointService.list(Wrappers.<IsIsolationPoint>lambdaQuery()
-                        .in(IsIsolationPoint::getPointNfc, nfcList));
+                        .in(IsIsolationPoint::getRfidId, collect));
                 // String pointNames = list1.stream().map(IsIsolationPoint::getPointName).collect(Collectors.joining(","));
                 StringBuilder pointNames = new StringBuilder();
                 for (IsIsolationPoint isIsolationPoint : list1) {
@@ -533,8 +536,11 @@ public class HardwareApiServiceImpl implements HardwareApiService {
             IsJobTicket byId = isJobTicketService.getById(unlockList.get(0).getTicketId());
             if (byId != null) {
                 List<String> nfcList = unlockList.stream().map(LockPointBatchDTO::getPointNfc).collect(Collectors.toList());
+                List<IsRfidToken> list2 = iIsRfidTokenService.list(Wrappers.<IsRfidToken>lambdaQuery()
+                        .in(IsRfidToken::getRfid, nfcList));
+                List<Long> collect = list2.stream().map(IsRfidToken::getRfidId).collect(Collectors.toList());
                 List<IsIsolationPoint> list1 = iIsIsolationPointService.list(Wrappers.<IsIsolationPoint>lambdaQuery()
-                        .in(IsIsolationPoint::getPointNfc, nfcList));
+                        .in(IsIsolationPoint::getRfidId, collect));
                 // String pointNames = list1.stream().map(IsIsolationPoint::getPointName).collect(Collectors.joining(","));
                 StringBuilder pointNames = new StringBuilder();
                 for (IsIsolationPoint isIsolationPoint : list1) {

+ 1 - 1
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsJobTicketStepServiceImpl.java

@@ -81,7 +81,7 @@ public class IsJobTicketStepServiceImpl extends ServiceImpl<IsJobTicketStepMappe
         update(Wrappers.<IsJobTicketStep>lambdaUpdate().eq(IsJobTicketStep::getStepId, dto.getStepId())
                 .set(IsJobTicketStep::getStepStatus, dto.getStepStatus()));
         // 操作确认
-        isTicketOperLogService.addLog2(jobTicket.getTicketId(), jobTicket.getTicketName(), jobTicketStep.getAndroidStepContent(), SecurityUtils.getUserId(), SecurityUtils.getUsername());
+        isTicketOperLogService.addLog2(jobTicket.getTicketId(), jobTicket.getTicketName(), jobTicketStep.getAndroidStepContent(), SecurityUtils.getUserId(), SecurityUtils.getLoginUser().getUser().getNickName());
         return true;
     }
 

+ 9 - 9
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsTicketOperLogServiceImpl.java

@@ -79,7 +79,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog3(Long jobId, String jobName, String type, String lockType, String lockUser) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -97,7 +97,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog4(Long jobId, String jobName) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -115,7 +115,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog5(Long jobId, String jobName, String pointNames) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -133,7 +133,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog6(Long jobId, String jobName, String colockUser) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -151,7 +151,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog7(Long jobId, String jobName, String colockUser) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -169,7 +169,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog8(Long jobId, String jobName) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -187,7 +187,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog9(Long jobId, String jobName, String pointNames) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -205,7 +205,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog10(Long jobId, String jobName) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);
@@ -223,7 +223,7 @@ public class IsTicketOperLogServiceImpl extends ServiceImpl<IsTicketOperLogMappe
     public Boolean addLog11(Long jobId, String jobName) {
         Date date = new Date();
         Long userId = SecurityUtils.getUserId();
-        String username = SecurityUtils.getUsername();
+        String username = SecurityUtils.getLoginUser().getUser().getNickName();
         IsTicketOperLog isTicketOperLog = new IsTicketOperLog();
         isTicketOperLog.setTicketId(jobId);
         isTicketOperLog.setTicketName(jobName);

+ 1 - 1
ktg-system/src/main/java/com/ktg/system/service/ISysUserCharacteristicService.java

@@ -17,7 +17,7 @@ import java.io.IOException;
  */
 public interface ISysUserCharacteristicService extends IService<SysUserCharacteristic> {
 
-    Page<SysUserCharacteristic> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic, String url);
+    Page<SysUserCharacteristic> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic);
 
     Long insertUserFingerprintDat(MultipartFile file, String userName, String sysAttrValue, String url, String group) throws IOException;
 

+ 9 - 13
ktg-system/src/main/java/com/ktg/system/service/impl/SysUserCharacteristicServiceImpl.java

@@ -44,28 +44,19 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
     private SysUserCharacteristicMapper sysUserCharacteristicMapper;
     @Value("${ktg-mes.prod}")
     private String prodApi;
+    @Value("${server.port}")
+    private String port;
     @Autowired
     private ISysUserService iSysUserService;
     private static final double THRESHOLD = 40; // 相当于错误率是0.01%,THRESHOLD越高,错误率越低
 
     @Override
-    public Page<SysUserCharacteristic> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic, String url) {
+    public Page<SysUserCharacteristic> getSysUserCharacteristicPage(Page<SysUserCharacteristic> page, SysUserCharacteristic sysUserCharacteristic) {
         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())
                 .eq(StringUtils.isNotBlank(sysUserCharacteristic.getGroupCode()), SysUserCharacteristic::getGroupCode, sysUserCharacteristic.getGroupCode())
                 .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;
     }
 
@@ -121,7 +112,12 @@ public class SysUserCharacteristicServiceImpl extends ServiceImpl<SysUserCharact
                 imageUrl = imagePath.replace(FileDriveLetterUtils.getDriveLetter() + profile, url + "/profile");
             } else  {
                 // 服务器linux / win
-                imageUrl = imagePath.replace(FileDriveLetterUtils.getDriveLetter() + profile, url + "/prod-api" + "/profile");
+                if (url.contains(port)) {
+                    // 说明是后端上传
+                    imageUrl = imagePath.replace(FileDriveLetterUtils.getDriveLetter() + profile, url + "/profile");
+                } else {
+                    imageUrl = imagePath.replace(FileDriveLetterUtils.getDriveLetter() + profile, url + "/prod-api" + "/profile");
+                }
             }
         } catch (IOException e) {
             e.printStackTrace();