TODO调整;加了一个测试方法,后续线上可以去掉

This commit is contained in:
daichao 2025-06-21 10:49:07 +08:00
parent 32c6b1e222
commit 66b8444722
6 changed files with 59 additions and 9 deletions

View File

@ -44,7 +44,7 @@ public class ProvTestClient {
/**
* 证书地址
*/
private static final String PFX_FILE_PATH = "d2d\\yunnan.pfx";
private static final String PFX_FILE_PATH = "C:\\Users\\ThinkPad\\Desktop\\pfx证书\\yunnan.pfx";
/**
* 证书密码
*/
@ -55,15 +55,13 @@ public class ProvTestClient {
private static final String algorithm = "RSA";
private static final String XML_DIRECTORY = "D:\\tq\\文件\\药监\\省市对接药品v0.19-通用版\\数据报文示例\\";
private static final String XML_DIRECTORY = "C:\\Users\\ThinkPad\\Desktop\\pfx证书\\数据报文示例\\";
// private static final String XML_DIRECTORY = "C:\\Users\\ThinkPad\\Desktop\\真实接收到的数据集\\";
public static void main(String[] args) throws Exception {
//数据文件内容主业务类型 10基础信息数据 20应用信息数据
//subType数据文件内容子业务类型 详见数据类型字典表 基本信息(1011-10199001-9002) 应用信息2011-20202051-2053
String[] subTypes = {"1011", "1012", "1013", "1014", "1015", "1016", "1017", "1018", "1019", "9001", "9002", "2011", "2012", "2013", "2015", "2016", "2017", "2018", "2019", "2051", "2052", "2053"};
for (String subType : subTypes) {
testProv(subType);
}
testProv("2011");
}
public static void testProv(String subType) throws Exception {

View File

@ -0,0 +1,32 @@
package com.alihealth.d2d.provtest.controller;
import com.alihealth.d2d.provtest.common.AjaxResult;
import com.alihealth.d2d.provtest.searcher.DrugResolveSearcher;
import com.alihealth.d2d.provtest.service.IReceiveDataLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
@RestController
@RequestMapping("/resolve")
public class ResolveTest {
@Autowired
private IReceiveDataLogService receiveDataLogService;
@PostMapping(value = "/resolve")
public AjaxResult resolve(@RequestBody DrugResolveSearcher searcher) throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, BadPaddingException, IOException, InvalidKeyException {
receiveDataLogService.resolve(searcher);
return AjaxResult.success(true);
}
}

View File

@ -0,0 +1,9 @@
package com.alihealth.d2d.provtest.searcher;
import lombok.Data;
@Data
public class DrugResolveSearcher {
private String eventId;
}

View File

@ -1,7 +1,18 @@
package com.alihealth.d2d.provtest.service;
import com.alihealth.d2d.provtest.domain.ReceiveDataLog;
import com.alihealth.d2d.provtest.searcher.DrugResolveSearcher;
import com.baomidou.mybatisplus.extension.service.IService;
import javax.crypto.BadPaddingException;
import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
public interface IReceiveDataLogService extends IService<ReceiveDataLog> {
void resolve(DrugResolveSearcher searcher) throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, BadPaddingException, IOException, InvalidKeyException;
}

View File

@ -35,7 +35,7 @@ public class EventProcessingServiceImpl {
} catch (Exception e) {
throw new RuntimeException(e);
}
//TODO 需要加上外层的eventId 与日志表进行关联
//处理数据时关联到外层的eventId,方便通过日志排查问题
handler.handle(eventS,eventId);
}else{
handler.handleBase(xml,eventId);

View File

@ -35,8 +35,8 @@ logging:
cert:
#本地
#path: D:\ynyp\药品追溯\d2d\yunnan.pfx
# path: C:\\Users\\ThinkPad\\Desktop\\pfx证书\\yunnan.pfx
#服务器
path: d2d\yunnan.pfx
path: /data/cert/d2d/yunnan.pfx
password: 12345678
algorithm: RSA