Commit 5461f4dd authored by AllenChen's avatar AllenChen

commit

parent 06c9d0bb
No preview for this file type
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -155,19 +155,26 @@
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -272,7 +272,7 @@ public class PddOpenController {
PddServiceConsoUserIdentifyRequest identifyRequest = JSON.parseObject(body, PddServiceConsoUserIdentifyRequest.class);
UserIdentify(identifyRequest);
log.info("pdd.service.conso.user.identify");
IdentityErrorType errorType = WorldexUtil.verifyIdentity(identifyRequest.getName(), identifyRequest.getMobileNo(), identifyRequest.getIdNumber());
IdentityErrorType errorType = UniPassUtil.queryUniPassPersonalClearanceInfo(identifyRequest.getIdNumber(), identifyRequest.getName(), identifyRequest.getMobileNo());
if (!errorType.equals(IdentityErrorType.Correct)) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("success", false);
......
......@@ -105,14 +105,14 @@ public class ImagePdfGenerator {
Document document = new Document(pdfDoc, new PageSize((int) (150 * 300 / 25.4), (int) (100 * 300 / 25.4)));
for (int i = 1; i < 10; i ++) {
for (int i1 = 1; i1 < 19; i1 ++) {
for (int i2 = 5; i2 < 6; i2 ++) {
for (int i1 = 1; i1 < 11; i1 ++) {
for (int i2 = 1; i2 < 4; i2 ++) {
for (int i3 = 1; i3 < 3; i3 ++) {
if (i3 == 2 && (i2 == 1|| i2 == 5)) {
continue;
}
// if (i3 == 2 && (i2 == 1|| i2 == 5)) {
// continue;
// }
// 1. 将文字转为图片(示例:韩文“안녕하세요,世界!”)
String code = "H" + i + "-" + i1 + "-" + i2 + "-" + i3;
String code = "LS" + i + "-" + i1 + "-" + i2 + "-" + i3;
byte[] imageBytes = TextToImageUtils.commonBarCodeToImage(code);
// 3. 将图片嵌入PDF
......
package org.ta.pddserver.utils;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import lombok.Data;
@Data
public class PersEcmQryRtnErrInfoVo {
@JacksonXmlProperty(localName = "errMsgCn")
private String errMsgCn; // 错误信息(韩文)
public String analyzeErrorMessage() {
if (errMsgCn.equals("납세의무자 개인통관고유부호가 존재하지 않습니다.")) {
return "纳税人个人通关唯一编号不存在。" + errMsgCn;
}
if (errMsgCn.equals("현재 사용중이 아닌 개인통관고유부호 입니다.")) {
return "当前未使用的个人通关唯一编号。" + errMsgCn;
}
if (errMsgCn.startsWith("입력하신 납세의무자명")) {
return "您输入的纳税人姓名与个人通关唯一编号的姓名不一致。" + errMsgCn;
}
if (errMsgCn.equals("개인통관고유부호 정보변경(휴대전화번호 인증)후 신고하시기 바랍니다.")) {
return "请在变更个人通关唯一编号信息(手机号码验证)后进行申报。" + errMsgCn;
}
if (errMsgCn.equals("납세의무자 전화번호가 일치하지 않습니다.")) {
return "纳税人电话号码不一致。" + errMsgCn;
}
if (errMsgCn.equals("입력하신 우편번호가 개인통관고유부호 우편번호(배송주소)와 일치하지 않습니다.")) {
return "您输入的邮政编码与个人通关唯一编号邮政编码(配送地址)不一致。" + errMsgCn;
}
if (errMsgCn.equals("유효기간이 만료 된 개인통관고유부호입니다.")) {
return "有效期已过期的个人通关唯一编号。" + errMsgCn;
}
if (errMsgCn.equals("입력하신 납세의무자(영문)명이 개인통관고유부호의 성명과 일치하지 않습니다.")) {
return "您输入的纳税人(英文)姓名与个人通关唯一号码姓名不一致。" + errMsgCn;
}
return errMsgCn;
}
}
package org.ta.pddserver.utils;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import lombok.Data;
import java.util.List;
@JacksonXmlRootElement(localName = "persEcmQryRtnVo")
@Data
public class PersEcmQryRtnVo {
@JacksonXmlProperty(localName = "ntceInfo")
String ntceInfo;
@JacksonXmlProperty(localName = "tCnt")
int tCnt;
@JacksonXmlProperty(localName = "valtPridStrtDt")
String valtPridStrtDt;
@JacksonXmlProperty(localName = "valtPridXpirDt")
String valtPridXpirDt;
@JacksonXmlElementWrapper(useWrapping = false) // 不使用包装元素
@JacksonXmlProperty(localName = "persEcmQryRtnErrInfoVo")
List<PersEcmQryRtnErrInfoVo> persEcmQryRtnErrInfoVoList;
}
package org.ta.pddserver.utils;
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import org.ta.pddserver.model.enums.IdentityErrorType;
import java.nio.charset.StandardCharsets;
@Slf4j
public class UniPassUtil {
/**
* 向韩国UNIPASS查询通关信息有效性
*
* @param persEcm 通关符号
* @param pltxNm 姓名
* @param cralTelNo 电话号码
* @param custPsno 邮编
* @return 结果信息
*/
public static UniPassPersonalClearanceCheckResult queryUniPassPersonalClearanceInfo(String persEcm, String pltxNm, String cralTelNo, String custPsno) {
String url = String.format("https://unipass.customs.go.kr:38010/ext/rest/persEcmQry/retrievePersEcm?crkyCn=g240g274x016o063l080g030v2&persEcm=%s&pltxNm=%s&cralTelno=%s&custPsno=%s", persEcm, pltxNm, cralTelNo, custPsno);
log.info("url:" + url);
UniPassPersonalClearanceCheckResult result = new UniPassPersonalClearanceCheckResult();
result.setSuccess(false);
try {
ResponseEntity<String> resp = new RestTemplate().getForEntity(url, String.class);
result.setMsg("查询验证失败!");
if (resp.getStatusCode().is2xxSuccessful()) {
XmlMapper xmlMapper = new XmlMapper();
String body = resp.getBody();
String newBody = new String(body.getBytes(StandardCharsets.ISO_8859_1), "UTF-8");
// log.info("body:{}", newBody);
PersEcmQryRtnVo respObject = xmlMapper.readValue(newBody, PersEcmQryRtnVo.class);
if (respObject != null) {
if (respObject.getTCnt() == 1) {
result.setSuccess(true);
result.setMsg("有效期:" + respObject.getValtPridStrtDt() + "-" + respObject.getValtPridStrtDt());
} else {
String msg = "";
for (PersEcmQryRtnErrInfoVo vo : respObject.getPersEcmQryRtnErrInfoVoList()) {
if (!msg.isEmpty()) {
msg += "\n";
}
msg += vo.analyzeErrorMessage();
}
result.setSuccess(false);
result.setMsg(msg);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
/**
* 向韩国UNIPASS查询通关信息有效性
*
* @param persEcm 通关符号
* @param pltxNm 姓名
* @param cralTelNo 电话号码
* @return 结果信息
*/
public static IdentityErrorType queryUniPassPersonalClearanceInfo(String persEcm, String pltxNm, String cralTelNo) {
String url = String.format("https://unipass.customs.go.kr:38010/ext/rest/persEcmQry/retrievePersEcm?crkyCn=g240g274x016o063l080g030v2&persEcm=%s&pltxNm=%s&cralTelno=%s", persEcm, pltxNm, cralTelNo);
log.info("url:" + url);
// UniPassPersonalClearanceCheckResult result = new UniPassPersonalClearanceCheckResult();
// result.setSuccess(false);
try {
ResponseEntity<String> resp = new RestTemplate().getForEntity(url, String.class);
// result.setMsg("查询验证失败!");
if (resp.getStatusCode().is2xxSuccessful()) {
XmlMapper xmlMapper = new XmlMapper();
String body = resp.getBody();
String newBody = new String(body.getBytes(StandardCharsets.ISO_8859_1), "UTF-8");
log.info("body:{}", newBody);
PersEcmQryRtnVo respObject = xmlMapper.readValue(newBody, PersEcmQryRtnVo.class);
if (respObject != null) {
if (respObject.getTCnt() == 1) {
return IdentityErrorType.Correct;
// result.setSuccess(true);
// result.setMsg("有效期:" + respObject.getValtPridStrtDt() + "-" + respObject.getValtPridStrtDt());
} else {
String msg = respObject.getNtceInfo();
// String msg = "";
for (PersEcmQryRtnErrInfoVo vo : respObject.getPersEcmQryRtnErrInfoVoList()) {
if (!msg.isEmpty()) {
msg += "\n";
}
msg += vo.analyzeErrorMessage();
}
// result.setSuccess(false);
// result.setMsg(msg);
if (msg.indexOf("납세의무자 개인통관고유부호가 존재하지 않습니다") >= 0 || msg.indexOf("현재 사용중이 아닌 개인통관고유부호 입니다") >= 0) {
return IdentityErrorType.CodeUnused;
}
if (msg.indexOf("납세의무자 전화번호가 일치하지 않습니다") >= 0 || msg.indexOf("개인통관고유부호 정보변경(휴대전화번호 인증)후 신고하시기 바랍니다") >= 0) {
return IdentityErrorType.CodeTelephoneInconsistency;
}
if (msg.indexOf("입력하신 납세의무자명") >= 0 || msg.indexOf("개인통관고유부호의 성명과 일치하지 않습니다") >= 0) {
return IdentityErrorType.CodeNameInconsistency;
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
return IdentityErrorType.UnknownWrong;
}
@Data
public static class UniPassPersonalClearanceCheckResult {
boolean success;
String msg;
}
}
......@@ -52,5 +52,5 @@ mybatis-plus:
pdd:
jyt: 0
gd: 1
gd: 0
lotto: 0
\ No newline at end of file
......@@ -10,6 +10,7 @@ import org.ta.pddserver.model.pddjy.request.*;
import org.ta.pddserver.model.pddjy.response.PddServiceConsoDerelictionResponse;
import org.ta.pddserver.utils.PddHttpTool;
import org.ta.pddserver.utils.PddSignTool;
import org.ta.pddserver.utils.UniPassUtil;
import org.ta.pddserver.utils.WorldexUtil;
import java.text.SimpleDateFormat;
......@@ -970,7 +971,7 @@ public class CommonTest {
String name = "REN SUPING";
String code = "P210015618116";
String phone = "01036196059";
IdentityErrorType errorType = WorldexUtil.verifyIdentity(name, phone, code);
IdentityErrorType errorType = UniPassUtil.queryUniPassPersonalClearanceInfo(name, code, phone);
log.info("errorType:{}", errorType);
}
......
......@@ -63,7 +63,7 @@ public class PdfTest {
@Test
public void test4() throws Exception {
try (FileOutputStream outputStream = new FileOutputStream("./codes-H5.pdf")) {
try (FileOutputStream outputStream = new FileOutputStream("./LS.pdf")) {
byte[] strToBytes = ImagePdfGenerator.generateCode();
outputStream.write(strToBytes);
System.out.println("文件写入成功!");
......
......@@ -28,7 +28,7 @@ public class WordexAPITest {
@org.junit.Test
public void verify() {
org.ta.pddserver.model.enums.IdentityErrorType type = WorldexUtil.verifyIdentity("강순매", "01039938571", "P210022453941");
org.ta.pddserver.model.enums.IdentityErrorType type = WorldexUtil.verifyIdentity("KIM OKSANA", "01065354555", "P200000801351");
log.info("type:{}", type);
}
......
2026-03-29 21:15:01 [main] INFO o.ta.pddserver.PddServerApplication - Starting PddServerApplication using Java 25.0.2 with PID 3363 (/Users/allen/Documents/HJCloudProjects/multiplesourcesecurity/PddServer/target/classes started by allen in /Users/allen/Documents/HJCloudProjects/multiplesourcesecurity)
2026-03-29 21:15:01 [main] DEBUG o.ta.pddserver.PddServerApplication - Running with Spring Boot v3.5.6, Spring v6.2.11
2026-03-29 21:15:01 [main] INFO o.ta.pddserver.PddServerApplication - No active profile set, falling back to 1 default profile: "default"
2026-03-29 21:15:01 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port 9000 (http)
2026-03-29 21:15:01 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
2026-03-29 21:15:01 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.46]
2026-03-29 21:15:01 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2026-03-29 21:15:01 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 483 ms
2026-03-29 21:15:01 [main] INFO org.ta.pddserver.config.OpenFilter - OPEN 过滤器初始化
2026-03-29 21:15:01 [main] INFO org.ta.pddserver.config.APIFilter - API 过滤器初始化
2026-03-29 21:15:02 [main] INFO o.t.p.serviceutil.WaybillOperator - 初始化 WaybillOperator,获取当前面单池状态
2026-03-29 21:15:02 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Starting...
2026-03-29 21:15:03 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariCP - Added connection com.mysql.cj.jdbc.ConnectionImpl@44d43cc9
2026-03-29 21:15:03 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Start completed.
2026-03-29 21:15:03 [main] DEBUG o.t.p.m.WaybillSeaMapper.selectFirst - ==> Preparing: SELECT * FROM `waybill_sea` ORDER BY `uid` ASC LIMIT 1;
2026-03-29 21:15:03 [main] DEBUG o.t.p.m.WaybillSeaMapper.selectFirst - ==> Parameters:
2026-03-29 21:15:03 [main] DEBUG o.t.p.m.WaybillSeaMapper.selectFirst - <== Total: 1
2026-03-29 21:15:03 [main] INFO o.t.p.serviceutil.WaybillOperator - 面单池更新完成,快递公司编码LOTTO,当前单号31775900987,剩余单号数量29493
2026-03-29 21:15:03 [main] INFO o.s.v.b.OptionalValidatorFactoryBean - Failed to set up a Bean Validation provider: jakarta.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
2026-03-29 21:15:03 [main] WARN o.s.b.a.t.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration - Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
2026-03-29 21:15:03 [main] WARN o.s.b.a.s.s.UserDetailsServiceAutoConfiguration -
Using generated security password: b9552d98-e19b-4d20-978e-51adeb49a205
This generated password is for development use only. Your security configuration must be updated before running your application in production.
2026-03-29 21:15:03 [main] INFO o.s.s.c.a.a.c.InitializeUserDetailsBeanManagerConfigurer$InitializeUserDetailsManagerConfigurer - Global AuthenticationManager configured with UserDetailsService bean with name inMemoryUserDetailsManager
2026-03-29 21:15:03 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port 9000 (http) with context path '/'
2026-03-29 21:15:03 [main] INFO o.ta.pddserver.PddServerApplication - Started PddServerApplication in 2.773 seconds (process running for 2.897)
2026-03-29 21:15:03 [main] INFO o.t.p.config.PddApplicationRunner - 注入注册PDD-HTTP 日志保存工具
2026-03-29 21:15:05 [scheduling-1] INFO o.t.pddserver.serviceutil.GDOperator - 2026年3月29日 21:15:05 工单数量:0
2026-03-29 21:15:06 [SpringApplicationShutdownHook] INFO o.s.b.w.e.tomcat.GracefulShutdown - Commencing graceful shutdown. Waiting for active requests to complete
2026-03-29 21:15:06 [tomcat-shutdown] INFO o.s.b.w.e.tomcat.GracefulShutdown - Graceful shutdown complete
2026-03-29 21:15:06 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Shutdown initiated...
2026-03-29 21:15:08 [main] INFO o.ta.pddserver.PddServerApplication - Starting PddServerApplication using Java 25.0.2 with PID 3381 (/Users/allen/Documents/HJCloudProjects/multiplesourcesecurity/PddServer/target/classes started by allen in /Users/allen/Documents/HJCloudProjects/multiplesourcesecurity)
2026-03-29 21:15:08 [main] DEBUG o.ta.pddserver.PddServerApplication - Running with Spring Boot v3.5.6, Spring v6.2.11
2026-03-29 21:15:08 [main] INFO o.ta.pddserver.PddServerApplication - No active profile set, falling back to 1 default profile: "default"
2026-03-29 21:15:08 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat initialized with port 9000 (http)
2026-03-29 21:15:08 [main] INFO o.a.catalina.core.StandardService - Starting service [Tomcat]
2026-03-29 21:15:08 [main] INFO o.a.catalina.core.StandardEngine - Starting Servlet engine: [Apache Tomcat/10.1.46]
2026-03-29 21:15:08 [main] INFO o.a.c.c.C.[Tomcat].[localhost].[/] - Initializing Spring embedded WebApplicationContext
2026-03-29 21:15:08 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext - Root WebApplicationContext: initialization completed in 388 ms
2026-03-29 21:15:08 [main] INFO org.ta.pddserver.config.OpenFilter - OPEN 过滤器初始化
2026-03-29 21:15:08 [main] INFO org.ta.pddserver.config.APIFilter - API 过滤器初始化
2026-03-29 21:15:09 [main] INFO o.t.p.serviceutil.WaybillOperator - 初始化 WaybillOperator,获取当前面单池状态
2026-03-29 21:15:09 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Starting...
2026-03-29 21:15:09 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariCP - Added connection com.mysql.cj.jdbc.ConnectionImpl@a3b858f
2026-03-29 21:15:09 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Start completed.
2026-03-29 21:15:09 [main] DEBUG o.t.p.m.WaybillSeaMapper.selectFirst - ==> Preparing: SELECT * FROM `waybill_sea` ORDER BY `uid` ASC LIMIT 1;
2026-03-29 21:15:09 [main] DEBUG o.t.p.m.WaybillSeaMapper.selectFirst - ==> Parameters:
2026-03-29 21:15:10 [main] DEBUG o.t.p.m.WaybillSeaMapper.selectFirst - <== Total: 1
2026-03-29 21:15:10 [main] INFO o.t.p.serviceutil.WaybillOperator - 面单池更新完成,快递公司编码LOTTO,当前单号31775900987,剩余单号数量29493
2026-03-29 21:15:10 [main] INFO o.s.v.b.OptionalValidatorFactoryBean - Failed to set up a Bean Validation provider: jakarta.validation.NoProviderFoundException: Unable to create a Configuration, because no Jakarta Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath.
2026-03-29 21:15:10 [main] WARN o.s.b.a.t.ThymeleafAutoConfiguration$DefaultTemplateResolverConfiguration - Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
2026-03-29 21:15:10 [main] WARN o.s.b.a.s.s.UserDetailsServiceAutoConfiguration -
Using generated security password: 4a837606-a6a2-41e2-9ac5-b7cde1d93a44
This generated password is for development use only. Your security configuration must be updated before running your application in production.
2026-03-29 21:15:10 [main] INFO o.s.s.c.a.a.c.InitializeUserDetailsBeanManagerConfigurer$InitializeUserDetailsManagerConfigurer - Global AuthenticationManager configured with UserDetailsService bean with name inMemoryUserDetailsManager
2026-03-29 21:15:10 [main] INFO o.s.b.w.e.tomcat.TomcatWebServer - Tomcat started on port 9000 (http) with context path '/'
2026-03-29 21:15:10 [main] INFO o.ta.pddserver.PddServerApplication - Started PddServerApplication in 2.492 seconds (process running for 2.589)
2026-03-29 21:15:10 [main] INFO o.t.p.config.PddApplicationRunner - 注入注册PDD-HTTP 日志保存工具
2026-03-29 21:15:25 [SpringApplicationShutdownHook] INFO o.s.b.w.e.tomcat.GracefulShutdown - Commencing graceful shutdown. Waiting for active requests to complete
2026-03-29 21:15:25 [tomcat-shutdown] INFO o.s.b.w.e.tomcat.GracefulShutdown - Graceful shutdown complete
2026-03-29 21:15:25 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Shutdown initiated...
2026-03-29 21:15:25 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariCP - Shutdown completed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment