代码调整
This commit is contained in:
parent
4d0f2f99e7
commit
a9c6cb613d
|
@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,6 +43,9 @@ public class ProvTestServerController {
|
||||||
@RequestMapping("/receive")
|
@RequestMapping("/receive")
|
||||||
public @ResponseBody
|
public @ResponseBody
|
||||||
Map<String, Object> receive(HttpServletRequest request) throws IOException {
|
Map<String, Object> receive(HttpServletRequest request) throws IOException {
|
||||||
|
//时间格式
|
||||||
|
SimpleDateFormat formatterDatetime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
RequestWrapper requestWrapper = new RequestWrapper(request);
|
RequestWrapper requestWrapper = new RequestWrapper(request);
|
||||||
String body = requestWrapper.getBodyString();
|
String body = requestWrapper.getBodyString();
|
||||||
System.out.println(body);
|
System.out.println(body);
|
||||||
|
@ -86,6 +91,7 @@ public class ProvTestServerController {
|
||||||
log.setSubTypeName(SubTypeEnum.getNameByType(eventPojo.getSubType()));
|
log.setSubTypeName(SubTypeEnum.getNameByType(eventPojo.getSubType()));
|
||||||
log.setData(eventPojo.getData());
|
log.setData(eventPojo.getData());
|
||||||
log.setVer(ver);
|
log.setVer(ver);
|
||||||
|
log.setEventTime(new Date(Long.parseLong(timeStamp)));
|
||||||
receiveDataLogService.save(log);
|
receiveDataLogService.save(log);
|
||||||
|
|
||||||
//解析并处理数据
|
//解析并处理数据
|
||||||
|
|
|
@ -1,8 +1,14 @@
|
||||||
package com.alihealth.d2d.provtest.controller;
|
package com.alihealth.d2d.provtest.controller;
|
||||||
|
|
||||||
import com.alihealth.d2d.provtest.common.AjaxResult;
|
import com.alihealth.d2d.provtest.common.AjaxResult;
|
||||||
|
import com.alihealth.d2d.provtest.domain.ReceiveDataLog;
|
||||||
import com.alihealth.d2d.provtest.searcher.DrugResolveSearcher;
|
import com.alihealth.d2d.provtest.searcher.DrugResolveSearcher;
|
||||||
import com.alihealth.d2d.provtest.service.IReceiveDataLogService;
|
import com.alihealth.d2d.provtest.service.IReceiveDataLogService;
|
||||||
|
import com.alihealth.d2d.provtest.service.impl.EventProcessingServiceImpl;
|
||||||
|
import com.alihealth.d2d.provtest.utils.CertManager;
|
||||||
|
import com.alihealth.d2d.provtest.utils.EventPojo;
|
||||||
|
import com.alihealth.d2d.provtest.utils.StreamUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -16,6 +22,7 @@ import java.io.IOException;
|
||||||
import java.security.InvalidKeyException;
|
import java.security.InvalidKeyException;
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.InvalidKeySpecException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/resolve")
|
@RequestMapping("/resolve")
|
||||||
|
@ -24,9 +31,36 @@ public class ResolveTest {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IReceiveDataLogService receiveDataLogService;
|
private IReceiveDataLogService receiveDataLogService;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EventProcessingServiceImpl processingService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CertManager certManager;
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(value = "/resolve")
|
@PostMapping(value = "/resolve")
|
||||||
public AjaxResult resolve(@RequestBody DrugResolveSearcher searcher) throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, BadPaddingException, IOException, InvalidKeyException {
|
public AjaxResult resolve(@RequestBody DrugResolveSearcher searcher) throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, BadPaddingException, IOException, InvalidKeyException {
|
||||||
receiveDataLogService.resolve(searcher);
|
receiveDataLogService.resolve(searcher);
|
||||||
return AjaxResult.success(true);
|
return AjaxResult.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping(value = "/resolve2")
|
||||||
|
public AjaxResult resolve2() throws NoSuchPaddingException, IllegalBlockSizeException, NoSuchAlgorithmException, InvalidKeySpecException, BadPaddingException, IOException, InvalidKeyException {
|
||||||
|
List<ReceiveDataLog> list = receiveDataLogService.list(new QueryWrapper<ReceiveDataLog>()
|
||||||
|
.lambda().between(ReceiveDataLog::getCreateTime, "2025-06-11 00:00:00", "2025-06-12 00:00:00")
|
||||||
|
);
|
||||||
|
String privateKey = certManager.getPrivateKey();
|
||||||
|
for (ReceiveDataLog receiveDataLog : list) {
|
||||||
|
String eventId = receiveDataLog.getEventId();
|
||||||
|
String de = certManager.testDecrypt(privateKey, receiveDataLog.getData());
|
||||||
|
String xml = StreamUtil.getUnStreamContent(de);
|
||||||
|
EventPojo eventPojo = new EventPojo();
|
||||||
|
eventPojo.setData(receiveDataLog.getData());
|
||||||
|
eventPojo.setSubType(receiveDataLog.getSubType());
|
||||||
|
processingService.processEvent(eventPojo, xml, eventId);
|
||||||
|
}
|
||||||
|
|
||||||
|
return AjaxResult.success(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class ReceiveDataLog {
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
@TableField( "update_time")
|
@TableField( "event_time")
|
||||||
private Date updateTime;
|
private Date eventTime;
|
||||||
|
|
||||||
|
|
||||||
@TableField( "is_deleted")
|
@TableField( "is_deleted")
|
||||||
|
|
Loading…
Reference in New Issue