From 3eb56cab8a5a453ac5e70b6e36618dde32431326 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期三, 22 一月 2025 14:49:48 +0800
Subject: [PATCH] 1

---
 ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/domain/excel/MgtCompanyExcel.java                    |    5 
 ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/model/UserDetail.java                                |    4 
 ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java                                              |   27 ++-
 ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/RemoteCompanyUserService.java                        |    2 
 ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java                     |   10 +
 ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/factory/RemoteCompanyUserServiceFallbackFactory.java |    4 
 doc/aa.json                                                                                                          |  236 +++++++++++++++++++++++++++++++--
 ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java                                                 |  103 +++++++-------
 ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/orc/OcrUtils.java                           |    5 
 ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java                              |    7 +
 ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/service/impl/CompanyServiceImpl.java                     |    8 
 11 files changed, 320 insertions(+), 91 deletions(-)

diff --git a/doc/aa.json b/doc/aa.json
index 3be660a..b112e75 100644
--- a/doc/aa.json
+++ b/doc/aa.json
@@ -1,26 +1,234 @@
 {
   "headers": {
     "access-control-allow-origin": "*",
-    "date": "Wed, 22 Jan 2025 02:32:31 GMT",
-    "content-length": "181",
+    "date": "Wed, 22 Jan 2025 06:17:14 GMT",
     "keep-alive": "timeout=25",
-    "x-acs-request-id": "C4D08986-F48C-5AB0-81BB-EA6D3E641261",
+    "transfer-encoding": "chunked",
+    "vary": "Accept-Encoding",
+    "x-acs-request-id": "F5B723E7-2482-5B99-9ABF-0ADA9BED16F0",
     "connection": "keep-alive",
     "content-type": "application/json;charset=utf-8",
-    "etag": "1oG9IxMCzf0kauAjlE63lUw1",
     "access-control-expose-headers": "*",
-    "x-acs-trace-id": "726453953e55e52583454e3eef889146"
+    "x-acs-trace-id": "2855503c12d3646d6fbbc361e6444d63"
   },
   "body": {
-    "Message": "success",
-    "RequestId": "C4D08986-F48C-5AB0-81BB-EA6D3E641261",
-    "Code": "Success",
-    "Result": {
-      "Status": "1",
-      "OpenTime": "2022-08-11/9999-09-09",
-      "ReasonCode": "100",
-      "BizCode": "1"
+    "RequestId": "F5B723E7-2482-5B99-9ABF-0ADA9BED16F0",
+    "Data": {
+      "SubImages": [
+        {
+          "FigureInfo": {
+            "blicense_title": {
+              "FigureCount": 1,
+              "FigureDetails": [
+                {
+                  "FigurePoints": [
+                    {
+                      "X": 648,
+                      "Y": 311
+                    },
+                    {
+                      "X": 1111,
+                      "Y": 312
+                    },
+                    {
+                      "X": 1112,
+                      "Y": 415
+                    },
+                    {
+                      "X": 648,
+                      "Y": 414
+                    }
+                  ],
+                  "FigureAngle": 0
+                }
+              ]
+            },
+            "national_emblem": {
+              "FigureCount": 1,
+              "FigureDetails": [
+                {
+                  "FigurePoints": [
+                    {
+                      "X": 787,
+                      "Y": 141
+                    },
+                    {
+                      "X": 965,
+                      "Y": 141
+                    },
+                    {
+                      "X": 964,
+                      "Y": 265
+                    },
+                    {
+                      "X": 786,
+                      "Y": 264
+                    }
+                  ],
+                  "FigureAngle": 0
+                }
+              ]
+            }
+          },
+          "SubImageId": 0,
+          "KvInfo": {
+            "KvCount": 14,
+            "Data": {
+              "RegistrationDate": "2022年08月11日",
+              "companyType": "其他有限责任公司",
+              "companyName": "新疆新省事大数据有限公司",
+              "businessScope": "许可项目:第一类增值电信业务:建筑智能化系统设计;农作物种子进出口;建设工程设计;建设工程施工;住宅室内装饰装修。(依法须经批准的项目,经相关部门批准后方可升展经营活动,具体经营项目以相关部门批准文件或许可证件为准)一般项目:数据处理和存储支持服务:人工智能理论与算法软件开发:智能机器人的研发;云计算装备技术服务;云计算设备销售;数字内容制作服务(不含出版发行);通信设备销售;安防设备销售:信息安全设备销售:信息安全设备制造:卫星导航服务;导航终端销售;导航终端制造;导航、测绘、气象及海洋专用仪器销售;环境保护专用设备销售;光通信设备销售;技术服务、技术开发、技术咨询、技术交流、技术转让、技术推广:软件开发:信息系统集成服务:卫星技术综合应用系统集成:货物进出口;农副产品销售:食品进出口:酒店管理:物业管理:广告发布;广告设计、代理;广告制作;第一类医疗器械销售;第二类医疗器栈销售;教育咨询服务(不含涉许可审批的教育培训活动);大数据服务;互联网数据服务;物联网应用服务;安全技术防范系统设计施工服务;信息系统运行维护服务:数据处理服务:信息技术咨询服务;5G通信技术服务;工业工程设计服务;移动通信设备制造;移动通信设备销售;通信传输设备专业修理;通信交换设备专业修理;网络设备制造:网络设备销售;普通机械设备安装服务;计算机软硬件及辅助设备零售;计算机软硬件及辅助设备批发;计算机软硬件及外围设备制造:平面设计;技术进出口:劳务服务(不含劳务派遣)。(除依法须经批准的项目外,凭营业执照依法自主开展经营活动)",
+              "title": "营业执照",
+              "validPeriod": "",
+              "companyForm": "",
+              "creditCode": "91650106MABWEMX61X",
+              "registeredCapital": "壹仟万元整",
+              "legalPerson": "张丹",
+              "validFromDate": "20220811",
+              "businessAddress": "新疆乌鲁木齐经济技术开发区(头屯河区)玄武湖路433号经开万达广场12号写字楼办公1217室",
+              "issueDate": "2023年07月21日",
+              "validToDate": ""
+            },
+            "KvDetails": {
+              "RegistrationDate": {
+                "KeyName": "RegistrationDate",
+                "ValueAngle": 0,
+                "Value": "2022年08月11日",
+                "KeyConfidence": 96,
+                "ValueConfidence": 96
+              },
+              "companyType": {
+                "KeyName": "companyType",
+                "ValueAngle": 0,
+                "Value": "其他有限责任公司",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "companyName": {
+                "KeyName": "companyName",
+                "ValueAngle": 0,
+                "Value": "新疆新省事大数据有限公司",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "businessScope": {
+                "KeyName": "businessScope",
+                "ValueAngle": 0,
+                "Value": "许可项目:第一类增值电信业务:建筑智能化系统设计;农作物种子进出口;建设工程设计;建设工程施工;住宅室内装饰装修。(依法须经批准的项目,经相关部门批准后方可升展经营活动,具体经营项目以相关部门批准文件或许可证件为准)一般项目:数据处理和存储支持服务:人工智能理论与算法软件开发:智能机器人的研发;云计算装备技术服务;云计算设备销售;数字内容制作服务(不含出版发行);通信设备销售;安防设备销售:信息安全设备销售:信息安全设备制造:卫星导航服务;导航终端销售;导航终端制造;导航、测绘、气象及海洋专用仪器销售;环境保护专用设备销售;光通信设备销售;技术服务、技术开发、技术咨询、技术交流、技术转让、技术推广:软件开发:信息系统集成服务:卫星技术综合应用系统集成:货物进出口;农副产品销售:食品进出口:酒店管理:物业管理:广告发布;广告设计、代理;广告制作;第一类医疗器械销售;第二类医疗器栈销售;教育咨询服务(不含涉许可审批的教育培训活动);大数据服务;互联网数据服务;物联网应用服务;安全技术防范系统设计施工服务;信息系统运行维护服务:数据处理服务:信息技术咨询服务;5G通信技术服务;工业工程设计服务;移动通信设备制造;移动通信设备销售;通信传输设备专业修理;通信交换设备专业修理;网络设备制造:网络设备销售;普通机械设备安装服务;计算机软硬件及辅助设备零售;计算机软硬件及辅助设备批发;计算机软硬件及外围设备制造:平面设计;技术进出口:劳务服务(不含劳务派遣)。(除依法须经批准的项目外,凭营业执照依法自主开展经营活动)",
+                "KeyConfidence": 99,
+                "ValueConfidence": 98
+              },
+              "title": {
+                "KeyName": "title",
+                "ValueAngle": 0,
+                "Value": "营业执照",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "companyForm": {
+                "KeyName": "companyForm",
+                "Value": "",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "validPeriod": {
+                "KeyName": "validPeriod",
+                "Value": "",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "creditCode": {
+                "KeyName": "creditCode",
+                "ValueAngle": 1,
+                "Value": "91650106MABWEMX61X",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "registeredCapital": {
+                "KeyName": "registeredCapital",
+                "ValueAngle": 0,
+                "Value": "壹仟万元整",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "legalPerson": {
+                "KeyName": "legalPerson",
+                "ValueAngle": 0,
+                "Value": "张丹",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "validFromDate": {
+                "KeyName": "validFromDate",
+                "ValueAngle": 0,
+                "Value": "20220811",
+                "KeyConfidence": 100,
+                "ValueConfidence": 96
+              },
+              "issueDate": {
+                "KeyName": "issueDate",
+                "ValueAngle": 0,
+                "Value": "2023年07月21日",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "businessAddress": {
+                "KeyName": "businessAddress",
+                "ValueAngle": 0,
+                "Value": "新疆乌鲁木齐经济技术开发区(头屯河区)玄武湖路433号经开万达广场12号写字楼办公1217室",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              },
+              "validToDate": {
+                "KeyName": "validToDate",
+                "Value": "",
+                "KeyConfidence": 100,
+                "ValueConfidence": 100
+              }
+            }
+          },
+          "QualityInfo": {
+            "IsCopy": false
+          },
+          "BarCodeInfo": {
+            "BarCodeDetails": [],
+            "BarCodeCount": 0
+          },
+          "Type": "营业执照",
+          "QrCodeInfo": {
+            "QrCodeDetails": [
+              {
+                "QrCodeAngle": 0,
+                "Data": "http://www.gsxt.gov.cn/index.html?uniscid=91650106MABWEMX61X",
+                "QrCodePoints": [
+                  {
+                    "X": 1324,
+                    "Y": 309
+                  },
+                  {
+                    "X": 1457,
+                    "Y": 309
+                  },
+                  {
+                    "X": 1457,
+                    "Y": 442
+                  },
+                  {
+                    "X": 1324,
+                    "Y": 442
+                  }
+                ]
+              }
+            ],
+            "QrCodeCount": 1
+          },
+          "Angle": 0
+        }
+      ],
+      "Height": 1280,
+      "SubImageCount": 1,
+      "Width": 1755
     }
   },
   "statusCode": 200
-}
+}
\ No newline at end of file
diff --git a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/RemoteCompanyUserService.java b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/RemoteCompanyUserService.java
index 2aade52..9e47699 100644
--- a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/RemoteCompanyUserService.java
+++ b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/RemoteCompanyUserService.java
@@ -22,5 +22,5 @@
     R<User> getUserByPhone(@RequestParam("phone") String phone, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 
     @PutMapping("/front/user/updateUser")
-    R<Void> updateUser(@RequestBody User user);
+    R<Void> updateUser(@RequestBody User user,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 }
diff --git a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/domain/excel/MgtCompanyExcel.java b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/domain/excel/MgtCompanyExcel.java
index f5e0a32..afafe5b 100644
--- a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/domain/excel/MgtCompanyExcel.java
+++ b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/domain/excel/MgtCompanyExcel.java
@@ -1,6 +1,7 @@
 package com.ruoyi.company.api.domain.excel;
 
 import cn.idev.excel.annotation.ExcelProperty;
+import cn.idev.excel.annotation.format.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 
@@ -32,8 +33,8 @@
     @ExcelProperty(value = "联系方式")
     private String contactPhone;
 
-    @ExcelProperty(value = "注册时间",format = "yyyy-MM-dd")
-    @JsonFormat(pattern = "yyyy-MM-dd")
+    @ExcelProperty(value = "注册时间")
+    @DateTimeFormat("yyyy-MM-dd")
     private LocalDateTime createTime;
 
 }
diff --git a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/factory/RemoteCompanyUserServiceFallbackFactory.java b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/factory/RemoteCompanyUserServiceFallbackFactory.java
index 2e71fda..bc6c9be 100644
--- a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/factory/RemoteCompanyUserServiceFallbackFactory.java
+++ b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/factory/RemoteCompanyUserServiceFallbackFactory.java
@@ -34,11 +34,9 @@
             }
 
             @Override
-            public R<Void> updateUser(User user) {
+            public R<Void> updateUser(User user, String source) {
                 return R.fail();
             }
-
-
         };
     }
 }
diff --git a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/model/UserDetail.java b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/model/UserDetail.java
index d21569c..2405146 100644
--- a/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/model/UserDetail.java
+++ b/ruoyi-api/ruoyi-api-company/src/main/java/com/ruoyi/company/api/model/UserDetail.java
@@ -1,7 +1,9 @@
 package com.ruoyi.company.api.model;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.time.LocalDateTime;
 
@@ -45,6 +47,8 @@
 
     /** 注册时间 */
     @Schema(description = "注册时间")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime registerTime;
 
     /** 绑定手机号 */
diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
index 340dd9b..f8dd206 100644
--- a/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
+++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/controller/TokenController.java
@@ -36,6 +36,8 @@
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.Valid;
+import java.time.LocalDateTime;
+import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -132,6 +134,8 @@
     {
         // 验证码生成
         String code = String.valueOf(Math.random()).substring(2, 6);
+        code += ":"+System.currentTimeMillis();
+
         // 缓存验证码
         String verifyKey = CacheConstants.PHONE_CODE_KEY + registerUser.getPhone();
         redisService.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
@@ -194,10 +198,16 @@
         if (!"999999".equals(smsCode)) {
             String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(registerUser.getPhone(), "");
             String captcha = redisService.getCacheObject(verifyKey);
-            if (captcha == null) {
+            if (captcha == null){
+                throw new CaptchaException("验证码错误");
+            }
+            String[] split = captcha.split(":");
+            long l = Long.parseLong(split[2]);
+            long l1 = System.currentTimeMillis();
+            // 判断是否大于两分钟
+            if (l1 - l > 2 * 60 * 1000) {
                 throw new CaptchaException("验证码已失效");
             }
-            redisService.deleteObject(verifyKey);
             if (!smsCode.equalsIgnoreCase(captcha)) {
                 throw new CaptchaException("验证码错误");
             }
@@ -229,16 +239,9 @@
     @Operation(summary = "公司校验",description = "公司校验")
     public R<?> check(@RequestBody RegisterUser registerUser)
     {
-        String accountName = registerUser.getAccountName();
-        R<User> userR = remoteCompanyUserService.getUserByPhone(accountName, SecurityConstants.INNER);
-        R<User> userR2 = remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER);
-
-        User user = userR.getData();
-        Boolean flag = sysLoginService.check(user, registerUser.getCompanyName(), registerUser.getIdCardNumber());
-        User user1 = userR2.getData();
-        Boolean flag1 = sysLoginService.check(user1, registerUser.getCompanyName(), registerUser.getIdCardNumber());
-        if (!flag1 && !flag){
-            return R.fail("账号不存在");
+        User check = sysLoginService.check(registerUser);
+        if (check == null) {
+            return R.fail("账号不存在!");
         }
         return R.ok();
     }
diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
index 3450f8b..e83b91a 100644
--- a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
+++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java
@@ -160,10 +160,16 @@
         if (!"999999".equals(smsCode)) {
             String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(registerUser.getPhone(), "");
             String captcha = redisService.getCacheObject(verifyKey);
-            if (captcha == null) {
+            if (captcha == null){
+                throw new ServiceException("验证码错误");
+            }
+            String[] split = captcha.split(":");
+            long l = Long.parseLong(split[2]);
+            long l1 = System.currentTimeMillis();
+            // 判断是否大于两分钟
+            if (l1 - l > 2 * 60 * 1000) {
                 throw new CaptchaException("验证码已失效");
             }
-            redisService.deleteObject(verifyKey);
             if (!smsCode.equalsIgnoreCase(captcha)) {
                 throw new CaptchaException("验证码错误");
             }
@@ -176,77 +182,72 @@
 
 
     public User companyLogin(RegisterUser registerUser) {
+        // 输入验证
+        if (registerUser == null || registerUser.getAccountName() == null || registerUser.getPassword() == null) {
+            throw new ServiceException("无效的输入");
+        }
         String accountName = registerUser.getAccountName();
         String password = registerUser.getPassword();
-
         R<User> userByPhoneR = remoteCompanyUserService.getUserByPhone(accountName, SecurityConstants.INNER);
-        if (R.isError(userByPhoneR)) {
-            throw new ServiceException(userByPhoneR.getMsg());
-        }
+        R<User> userByAccountNameR = remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER);
+
+        User user = null;
         if (userByPhoneR.getData() != null) {
-            if (SecurityUtils.matchesPassword(password, userByPhoneR.getData().getPassword())) {
-                return userByPhoneR.getData();
-            }
+            user = userByPhoneR.getData();
+        } else if (userByAccountNameR.getData() != null) {
+            user = userByAccountNameR.getData();
         }
 
-
-        R<User> r = remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER);
-        if (R.isError(r)) {
-            throw new ServiceException(r.getMsg());
-        }
-        if (r.getData() == null) {
+        if (user == null) {
             throw new ServiceException("账号不存在");
         }
-        if (!SecurityUtils.matchesPassword(password, r.getData().getPassword())) {
-            throw new ServiceException("密码错误");
+
+        if (!SecurityUtils.matchesPassword(password, user.getPassword())) {
+            throw new ServiceException("账号或密码错误");
         }
-        return r.getData();
+
+        return user;
     }
+
 
 
     public void resetPwd(RegisterUser registerUser) {
-        String accountName = registerUser.getAccountName();
-        R<User> userR = remoteCompanyUserService.getUserByPhone(accountName, SecurityConstants.INNER);
-        R<User> userR2 = remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER);
-
-        User user = userR.getData();
-        Boolean flag = check(user, registerUser.getCompanyName(), registerUser.getIdCardNumber());
-        User user1 = userR2.getData();
-        Boolean flag1 = check(user1, registerUser.getCompanyName(), registerUser.getIdCardNumber());
-
-        if (!flag1 && !flag){
-            throw new ServiceException("账号不存在");
-        }
-        User user2;
-        if (flag){
-            user2 = user;
-        }else {
-            user2 = user1;
-        }
+        User user = check(registerUser);
 
         String password = SecurityUtils.encryptPassword(registerUser.getPassword());
-        user2.setPassword(password);
-        R<Void> r = remoteCompanyUserService.updateUser(user2);
+        user.setPassword(password);
+        R<Void> r = remoteCompanyUserService.updateUser(user, SecurityConstants.INNER);
         if (R.isError(r)) {
-            throw new ServiceException(userR.getMsg());
+            throw new ServiceException(r.getMsg());
         }
     }
 
 
-    public Boolean check(User user, String companyName, String idCardNumber) {
-        boolean flag = true;
-        if (user != null){
-            R<List<Company>> companyListR = remoteCompanyService.getCompanyByUserId(user.getUserId(), SecurityConstants.INNER);
-            List<Company> companyList = companyListR.getData();
-            long count = companyList.stream().filter(company -> company.getCompanyName()
-                    .equals(companyName) && company.getIdCardNumber().equals(idCardNumber)).count();
-            if (count == 0) {
-                flag = false;
-            }
+
+    public User check(RegisterUser registerUser) {
+        String accountName = registerUser.getAccountName();
+        R<User> userByPhoneR = remoteCompanyUserService.getUserByPhone(accountName, SecurityConstants.INNER);
+        R<User> userByAccountNameR= remoteCompanyUserService.getUserByAccountName(accountName, SecurityConstants.INNER);
+
+        User user;
+        if (userByPhoneR.getData() != null) {
+            user = userByPhoneR.getData();
+        } else if (userByAccountNameR.getData() != null) {
+            user = userByAccountNameR.getData();
         }else {
-            flag = false;
+            throw new ServiceException("账号不存在");
         }
-        return flag;
+
+        R<List<Company>> companyListR = remoteCompanyService.getCompanyByUserId(user.getUserId(), SecurityConstants.INNER);
+        List<Company> companyList = companyListR.getData();
+        long count = companyList.stream().filter(company -> company.getCompanyName()
+                .equals(registerUser.getCompanyName()) &&
+                company.getIdCardNumber().equals(registerUser.getIdCardNumber())).count();
+        if (count == 0) {
+            return null;
+        }
+
+        return user;
     }
 
 
diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/orc/OcrUtils.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/orc/OcrUtils.java
index fe2b659..27f6cbe 100644
--- a/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/orc/OcrUtils.java
+++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/orc/OcrUtils.java
@@ -71,8 +71,9 @@
 
     public static void main(String[] args) {
         try {
-            InputStream inputStream = UrlDownloader.downloadAsStream("http://192.168.110.188:9300/statics/2025/01/21/862dab34c5f83ce2635d219c467ac9f6_20250121170536A004.jpg");
-            idCard(inputStream,"idCard");
+            InputStream inputStream = UrlDownloader.downloadAsStream("http://192.168.110.188:9300/statics/2025/01/22/862dab34c5f83ce2635d219c467ac9f6_20250122141611A119.jpg");
+            String businessLicense = idCard(inputStream, "BusinessLicense");
+            System.out.println(businessLicense);
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
diff --git a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java
index 2185bdf..4578a40 100644
--- a/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java
+++ b/ruoyi-gateway/src/main/java/com/ruoyi/gateway/service/impl/ValidateCodeServiceImpl.java
@@ -107,6 +107,13 @@
         String captcha = redisService.getCacheObject(verifyKey);
         if (captcha == null)
         {
+            throw new CaptchaException("验证码错误");
+        }
+        String[] split = captcha.split(":");
+        long l = Long.parseLong(split[2]);
+        long l1 = System.currentTimeMillis();
+        // 判断是否大于两分钟
+        if (l1 - l > 2 * 60 * 1000) {
             throw new CaptchaException("验证码已失效");
         }
         redisService.deleteObject(verifyKey);
diff --git a/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java b/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
index f26193f..3925aef 100644
--- a/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
+++ b/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/controller/front/UserController.java
@@ -105,10 +105,16 @@
         }
         String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(updatePhone.getNewPhone(), "");
         String captcha = redisService.getCacheObject(verifyKey);
-        if (captcha == null) {
+        String[] split = captcha.split(":");
+        long l = Long.parseLong(split[2]);
+        long l1 = System.currentTimeMillis();
+        // 判断是否大于两分钟
+        if (l1 - l > 2 * 60 * 1000) {
             throw new CaptchaException("验证码已失效");
         }
-        redisService.deleteObject(verifyKey);
+        if (captcha == null) {
+            throw new CaptchaException("验证码错误");
+        }
         if (!updatePhone.getCode().equalsIgnoreCase(captcha)) {
             throw new CaptchaException("验证码错误");
         }
diff --git a/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/service/impl/CompanyServiceImpl.java b/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/service/impl/CompanyServiceImpl.java
index 831561e..694fa64 100644
--- a/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/service/impl/CompanyServiceImpl.java
+++ b/ruoyi-modules/ruoyi-company/src/main/java/com/ruoyi/company/service/impl/CompanyServiceImpl.java
@@ -115,7 +115,7 @@
             throw new ServiceException("该企业已存在");
         }
         //身份证二要素校验
-        identityVerification(dto, company, user);
+        identityVerification(dto, user);
         this.save(company);
     }
 
@@ -168,20 +168,20 @@
                 throw new ServiceException("该企业已存在");
             }
         }
-        identityVerification(dto, company, user);
+        identityVerification(dto, user);
         Company companyUpd = BeanUtils.copyBean(dto, Company.class);
         companyUpd.setId(company.getId());
         this.updateById(companyUpd);
     }
 
-    private void identityVerification(MgtCompanyDTO dto, Company company, User user) {
+    private void identityVerification(MgtCompanyDTO dto, User user) {
         //身份证二要素校验
         Boolean res = aliyunCloudAuthUtil.verifyIdCard(dto.getLegalPersonName(), dto.getIdCardNumber());
         if (!res) {
             throw new ServiceException("身份证信息不匹配");
         }
         //营业执照二要素校验
-        res = aliyunCloudAuthUtil.verifyBusinessLicense(dto.getSocialCode(), company.getCompanyName(), user.getUserId());
+        res = aliyunCloudAuthUtil.verifyBusinessLicense(dto.getSocialCode(), dto.getCompanyName(), user.getUserId());
         if (!res) {
             throw new ServiceException("营业执照信息不匹配");
         }

--
Gitblit v1.7.1