baiying 2 månader sedan
förälder
incheckning
b121c60936

+ 12 - 0
pom.xml

@@ -41,6 +41,7 @@
         <!-- 移除 itextpdf 8.x 属性,因为它需要 Java 11+ -->
         <!-- 使用与 Java 1.8 兼容的版本 -->
         <itextpdf5.version>5.5.13.3</itextpdf5.version>
+        <itextpdf.version>7.1.11</itextpdf.version>
 
         <!-- 配置编译器插件的属性 -->
         <maven.compiler.source>${java.version}</maven.compiler.source>
@@ -153,6 +154,17 @@
             <artifactId>itextpdf</artifactId>
             <version>${itextpdf5.version}</version>
         </dependency>
+
+        <dependency>
+            <groupId>com.itextpdf</groupId>
+            <artifactId>kernel</artifactId>
+            <version>${itextpdf.version}</version>
+        </dependency>
+<!--        <dependency>-->
+<!--            <groupId>com.itextpdf</groupId>-->
+<!--            <artifactId>io</artifactId>-->
+<!--            <version>${itextpdf.version}</version>-->
+<!--        </dependency>-->
         <!-- 移除了 iText 8.x 的依赖 (kernel, io, layout) -->
 
         <!-- Lombok -->

+ 18 - 0
src/main/java/net/yaoyi/gulop/member/auth/controller/MemberAuthController.java

@@ -1,6 +1,7 @@
 package net.yaoyi.gulop.member.auth.controller;
 
 // import jakarta.validation.Valid;
+import com.ancun.netsign.model.AuthInput;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import net.yaoyi.gulop.member.auth.dto.FourElementAuthDto;
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.validation.Valid;
+import java.io.IOException;
 import java.util.Map;
 
 
@@ -55,6 +57,11 @@ public class MemberAuthController {
         }
     }
 
+    @PostMapping("/three-element1")
+    public CommonResult threeElementAuth1(@RequestBody AuthInput input) {
+        return authService.threeElementAuth1(input);
+    }
+
 
     /**
      * OCR身份证识别
@@ -72,6 +79,11 @@ public class MemberAuthController {
         }
     }
 
+    public CommonResult uploadOcr1(@RequestParam("file") MultipartFile file, @RequestParam("type") String type) throws IOException {
+        String fileUrl = minioUtil.uploadFile(file);
+        return authService.ocrAuth1(fileUrl,type);
+    }
+
 
     //请求个人人脸活体认证
     @PostMapping("/person-face")
@@ -80,6 +92,12 @@ public class MemberAuthController {
         return authService.personFace(request,2L);
     }
 
+    @PostMapping("/person-face1")
+    public CommonResult personFace1(@RequestBody
+    AuthInput request){
+        return authService.personFace1(request);
+    }
+
     //个人银行卡四要素比对
     @PostMapping("/four-element")
     public CommonResult fourElementAuth(

+ 25 - 0
src/main/java/net/yaoyi/gulop/member/auth/controller/SignContractController.java

@@ -1,12 +1,17 @@
 package net.yaoyi.gulop.member.auth.controller;
 
 
+import com.ancun.netsign.model.ContractInput;
+import com.ancun.netsign.model.ContractUserInput;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import net.yaoyi.gulop.member.auth.service.GigConfigService;
 import net.yaoyi.gulop.member.auth.util.CommonResult;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.List;
 import java.util.Map;
 
 @Slf4j
@@ -42,6 +47,26 @@ public class SignContractController {
         }
     }
 
+    @PostMapping("/create-contract")
+    public CommonResult createContract(@RequestBody ContractInput contractInput) {
+        return gigConfigService.createContract(contractInput);
+    }
+
+    @PostMapping("/create-contract1")
+    public CommonResult createContract1(@RequestParam("contractId") String contractId, @RequestParam("file") MultipartFile file) throws IOException {
+        ContractInput contractInput = new ContractInput();
+        contractInput.setContractNo(contractId);
+        contractInput.setContractName(contractId);
+        contractInput.setValidityTime(30);
+        contractInput.setSignOrder(1);
+        return gigConfigService.createContract1(contractInput, file);
+    }
+
+    @PostMapping("/add-signer")
+    public CommonResult addSigner(@RequestBody List<ContractUserInput> request) {
+        return gigConfigService.addSigner(request);
+    }
+
     //查看合同信息(同步合同信息和状态)
     @PostMapping("/sign-check")
     public CommonResult signCheck(@RequestBody Map<String, String> request) {

+ 9 - 0
src/main/java/net/yaoyi/gulop/member/auth/service/GigConfigService.java

@@ -1,8 +1,11 @@
 package net.yaoyi.gulop.member.auth.service;
 
 
+import com.ancun.netsign.model.ContractInput;
+import com.ancun.netsign.model.ContractUserInput;
 import net.yaoyi.gulop.member.auth.entity.GigConfig;
 import net.yaoyi.gulop.member.auth.util.CommonResult;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
 import java.util.List;
@@ -13,6 +16,12 @@ public interface GigConfigService {
 
     CommonResult signContract(Long configId,Long userId) throws IOException;
 
+    CommonResult createContract(ContractInput contractInput);
+
+    CommonResult createContract1(ContractInput contractInput, MultipartFile file) throws IOException;
+
+    CommonResult addSigner(List<ContractUserInput> contractUserInputs);
+
     CommonResult signCheck(Long contractId, long userId);
 
     List<GigConfig>  getReportList();

+ 6 - 0
src/main/java/net/yaoyi/gulop/member/auth/service/MemberAuthService.java

@@ -1,6 +1,7 @@
 package net.yaoyi.gulop.member.auth.service;
 
 
+import com.ancun.netsign.model.AuthInput;
 import net.yaoyi.gulop.member.auth.dto.FourElementAuthDto;
 import net.yaoyi.gulop.member.auth.dto.QualificationDTO;
 import net.yaoyi.gulop.member.auth.dto.ThreeElementAuthDTO;
@@ -19,13 +20,18 @@ public interface MemberAuthService {
      */
     CommonResult threeElementAuth(Map<String, Object> request,Long userId);
 
+    CommonResult threeElementAuth1(AuthInput authInput);
 
     CommonResult fourElementAuth(FourElementAuthDto request,Long userId);
 
     CommonResult ocrAuth(String fileUrl, String type,Long userId) throws IOException;
 
+    CommonResult ocrAuth1(String fileUrl, String type) throws IOException;
+
     CommonResult personFace(ThreeElementAuthDTO request,Long userId);
 
+    CommonResult personFace1(AuthInput authInput);
+
     CommonResult checkCertificate(QualificationDTO qualificationDTO,Long userId);
 
     MemberAuthInfoVO getAuthInfo(Long userId);

+ 44 - 1
src/main/java/net/yaoyi/gulop/member/auth/service/impl/GigConfigServiceImpl.java

@@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
 import com.ancun.netsign.client.NetSignClient;
 import com.ancun.netsign.model.*;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.google.common.collect.Table;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import net.yaoyi.gulop.member.auth.constant.enums.ContractStatus;
@@ -16,8 +15,10 @@ import net.yaoyi.gulop.member.auth.util.CommonResult;
 import net.yaoyi.gulop.member.auth.util.ContractNumberGenerator;
 import net.yaoyi.gulop.member.auth.util.RemoteFileUtils;
 import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.io.InputStream;
 import java.time.LocalDateTime;
 import java.util.*;
 import java.util.function.Function;
@@ -317,6 +318,48 @@ public class GigConfigServiceImpl implements GigConfigService {
 
     }
 
+    @Override
+    public CommonResult createContract(ContractInput contractInput){
+        UmsExtConfig config = getConfig();
+        NetSignClient netSignClient = new NetSignClient("https://prev.asign.cn/", config.getExtId(), config.getExtSecret());
+
+        ApiRespBody<ContractOutput> apiRespBody = netSignClient.createContract(contractInput);
+
+        return CommonResult.ok(apiRespBody);
+    }
+
+    @Override
+    public CommonResult createContract1(ContractInput contractInput, MultipartFile file) throws IOException {
+        UmsExtConfig config = getConfig();
+        NetSignClient netSignClient = new NetSignClient("https://prev.asign.cn/", config.getExtId(), config.getExtSecret());
+
+
+        InputStream inputStream = file.getInputStream();
+        String fileName = "20250427095713.docx";
+
+        // 封装到FileDto
+        FileDto fileDto = new FileDto();
+        fileDto.setFileName(fileName);
+        fileDto.setFileInputStream(inputStream);
+        List<FileDto> files = new ArrayList<>();
+        files.add(fileDto);
+
+        contractInput.setContractFiles(files);
+
+        ApiRespBody<ContractOutput> apiRespBody = netSignClient.createContract(contractInput);
+
+        return CommonResult.ok(apiRespBody);
+    }
+
+    @Override
+    public CommonResult addSigner(List<ContractUserInput> contractUserInputs){
+        UmsExtConfig config = getConfig();
+        NetSignClient netSignClient = new NetSignClient("https://prev.asign.cn/", config.getExtId(), config.getExtSecret());
+
+        ApiRespBody<ContractOutput> apiRespBody = netSignClient.addSigner(contractUserInputs);
+
+        return CommonResult.ok(apiRespBody);
+    }
 
     //同步状态
     public CommonResult signCheck(Long contractId, long userId){

+ 56 - 0
src/main/java/net/yaoyi/gulop/member/auth/service/impl/MemberAuthServiceImpl.java

@@ -115,6 +115,23 @@ public class MemberAuthServiceImpl implements MemberAuthService {
         return CommonResult.ok(null,"成功");
     }
 
+    /**
+     * 个人运营商三要素比对
+     * @param request 认证请求体
+     * @return
+     */
+    @Transactional
+    public CommonResult threeElementAuth1(AuthInput authInput) {
+
+        UmsExtConfig config = getConfig();
+
+        NetSignClient netSignClient = new NetSignClient("https://prev.asign.cn/", config.getExtId(), config.getExtSecret());
+
+        ApiRespBody<AuthOutput> apiRespBody = netSignClient.personVerifyMobile3(authInput);
+
+        return CommonResult.ok(apiRespBody);
+    }
+
 
     /**
      * 个人银行卡四要素比对
@@ -198,6 +215,18 @@ public class MemberAuthServiceImpl implements MemberAuthService {
 
     }
 
+    @Override
+    public CommonResult ocrAuth1(String fileUrl, String type) throws IOException {
+        UmsExtConfig config = getConfig();
+        String base64 = ImageToBase64Converter.convertImageUrlToBase64(fileUrl);
+        NetSignClient netSignClient = new NetSignClient("https://prev.asign.cn/", config.getExtId().toString(), config.getExtSecret());
+        UserInput userInput = new UserInput();
+        userInput.setBase64Img(base64);
+        userInput.setSide(type);
+        ApiRespBody apiRespBody = netSignClient.ocrIdentify(userInput);
+
+        return CommonResult.ok(apiRespBody);
+    }
 
     //请求人脸认证
     //miniprogram-kyc.tencentcloudapi.com
@@ -261,6 +290,33 @@ public class MemberAuthServiceImpl implements MemberAuthService {
         }
     }
 
+    @Override
+    public CommonResult personFace1(AuthInput authInput) {
+
+        /*int i = 1;
+        int x = 0;
+        if (i - x  == 1) {
+            String s = "{\"type\": \"个人活体人脸认证\", \"result\": 0, \"faceUrl\": \"https://miniprogram-kyc.tencentcloudapi.com/api/web/login?webankAppId=IDAfndk9&version=1.0.0&nonce=VBMLBTtdABjs20BPYLWBMOy242Drur0H&orderNo=TC511322199205103651742299776831&h5faceId=tx00cb72c924567a41e8d5e6bb80d767&url=https%3A%2F%2Fprev.asign.cn%2Fauth%2Fface%2Fredirect%2F25764824841872561658677&resultType=1&userId=51132219920510365X&sign=FDF3710D2EBEB4241AD9FBC3E84FACCA5CA742D0&from=browser\", \"process\": null, \"serialNo\": \"PA10320250318200938694393\", \"identifyUrl\": null}";
+            JSONObject parse = (JSONObject) JSONObject.parse(s);
+            return CommonResult.ok(parse);
+        }*/
+
+        UmsExtConfig config = getConfig();
+
+        //假装用户的手机号码
+        NetSignClient netSignClient = new NetSignClient("https://prev.asign.cn/", config.getExtId(), config.getExtSecret());
+
+        int apiStatus = 0;
+        ApiRespBody<AuthOutput> apiRespBody = null;
+        try{
+            apiRespBody = netSignClient.personAuthFace(authInput);
+
+            return CommonResult.ok(apiRespBody);
+        } catch (Exception e){
+            return CommonResult.failed(e.getMessage());
+        }
+    }
+
 
     //保存资质证书
     public CommonResult checkCertificate(QualificationDTO qualificationDTO,Long userId){

+ 3 - 3
src/main/resources/application.properties

@@ -10,9 +10,9 @@ spring.profiles.active=dev
 #spring.datasource.username=root
 #spring.datasource.password=root
 
-spring.datasource.url=jdbc:mysql://119.91.140.133:3306/java3000?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
-spring.datasource.username=java3000
-spring.datasource.password=java3000java3000
+spring.datasource.url=jdbc:mysql://localhost:3306/java3000?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=UTC
+spring.datasource.username=root
+spring.datasource.password=root
 spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
 #mybatis.configuration.map-underscore-to-camel-case=true
 logging.level.net.yaoyi.gulop.member.auth.mapper=false

+ 0 - 13
src/test/java/net/yaoyi/gulop/member/auth/GulopMemberAuthApplicationTests.java

@@ -1,13 +0,0 @@
-package net.yaoyi.gulop.member.auth;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class GulopMemberAuthApplicationTests {
-
-    @Test
-    void contextLoads() {
-    }
-
-}