保存进度!
This commit is contained in:
parent
a3dc3480ba
commit
a823e3f963
@ -118,10 +118,23 @@
|
||||
<version>9.2.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk18on</artifactId>
|
||||
<version>1.80</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
|
||||
<dependency>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
<version>1.3.5</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<defaultGoal>compile</defaultGoal>
|
||||
<defaultGoal>compile</defaultGoal>
|
||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to
|
||||
parent pom) -->
|
||||
<plugins>
|
||||
|
@ -12,27 +12,40 @@ package com.cpic.xim.huixiabao.data.config;
|
||||
|
||||
public class HuixiabaoConfig
|
||||
{
|
||||
|
||||
public String getAppid()
|
||||
public static String getAppid()
|
||||
{
|
||||
return appid;
|
||||
}
|
||||
public String getAppSecret()
|
||||
|
||||
public static String getAppSecret()
|
||||
{
|
||||
return appSecret;
|
||||
}
|
||||
public String getSignKey()
|
||||
|
||||
public static String getSignKey()
|
||||
{
|
||||
return signKey;
|
||||
}
|
||||
public String getEncKey()
|
||||
|
||||
public static String getEncKey()
|
||||
{
|
||||
return encKey;
|
||||
}
|
||||
|
||||
private String url = "https://172.18.1.150:9040";
|
||||
private String appid = "hxb-tb";
|
||||
private String appSecret = "60F468FB46170DD4CF6CBECE215DBFC0";
|
||||
private String signKey = "1A2F447BD0F930798D8031B137EC6E25";
|
||||
private String encKey = "08307695B1668EB9FD6210250FED874F";
|
||||
public static int getMAX_COUNT_PER_REQUEST()
|
||||
{
|
||||
return MAX_COUNT_PER_REQUEST;
|
||||
}
|
||||
|
||||
public static String getUrl()
|
||||
{
|
||||
return url;
|
||||
}
|
||||
|
||||
private static final int MAX_COUNT_PER_REQUEST = 500;
|
||||
private static final String url = "https://172.18.1.150:9040";
|
||||
private static final String appid = "hxb-tb";
|
||||
private static final String appSecret = "60F468FB46170DD4CF6CBECE215DBFC0";
|
||||
private static final String signKey = "1A2F447BD0F930798D8031B137EC6E25";
|
||||
private static final String encKey = "08307695B1668EB9FD6210250FED874F";
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
* @Date: 2025-03-06 14:33:27
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /Cpicxim-XMNHSA-Repeater/src/main/java/com/cpicxim/huixiabao/data/pojo/HmbListItem.java
|
||||
* @Description:
|
||||
* @Description: 小药箱接口参数描述
|
||||
*
|
||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||
*/
|
||||
@ -15,7 +15,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
|
||||
@JsonInclude( JsonInclude.Include.NON_EMPTY )
|
||||
@JsonPropertyOrder( alphabetic = true )
|
||||
public class HmbListItem
|
||||
public class HmbXyxInfo
|
||||
{
|
||||
|
||||
public String getPsnName()
|
@ -2,7 +2,7 @@
|
||||
* @Author: Kane
|
||||
* @Date: 2025-03-06 14:27:05
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /Cpicxim-XMNHSA-Repeater/src/main/java/com/cpicxim/huixiabao/data/pojo/HmbXyxInfoRequest.java
|
||||
* @FilePath: /cpicxim-XMNHSA-repeater/src/main/java/com/cpic/xim/huixiabao/data/pojo/HmbXyxInfoRequest.java
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||
@ -24,7 +24,7 @@ public class HmbXyxInfoRequest
|
||||
this.hmbList = new Vector<>();
|
||||
}
|
||||
|
||||
public HmbXyxInfoRequest( String topic, Vector<HmbListItem> hmbList )
|
||||
public HmbXyxInfoRequest( String topic, Vector<HmbXyxInfo> hmbList )
|
||||
{
|
||||
this.topic = topic;
|
||||
this.topic = "hmbXyxInfo";
|
||||
@ -41,12 +41,12 @@ public class HmbXyxInfoRequest
|
||||
this.topic = topic;
|
||||
}
|
||||
|
||||
public Vector<HmbListItem> getHmbList()
|
||||
public Vector<HmbXyxInfo> getHmbList()
|
||||
{
|
||||
return hmbList;
|
||||
}
|
||||
|
||||
public void setHmbList( Vector<HmbListItem> hmbList )
|
||||
public void setHmbList( Vector<HmbXyxInfo> hmbList )
|
||||
{
|
||||
this.hmbList = hmbList;
|
||||
}
|
||||
@ -55,5 +55,5 @@ public class HmbXyxInfoRequest
|
||||
private String topic; // 业务类型
|
||||
|
||||
@JsonProperty("hmbList")
|
||||
private Vector<HmbListItem> hmbList;
|
||||
private Vector<HmbXyxInfo> hmbList;
|
||||
}
|
@ -13,16 +13,67 @@ import java.util.Vector;
|
||||
import com.cpic.xim.huixiabao.data.pojo.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.hsa.zephyr.apisdk.DefaultZephyrClient;
|
||||
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
|
||||
import cn.hsa.zephyr.apisdk.internal.util.encrypt.EncryptionModeEnum;
|
||||
import cn.hsa.zephyr.apisdk.internal.util.encrypt.SignTypeEnum;
|
||||
import cn.hsa.zephyr.apisdk.request.DefaultZephyrRequest;
|
||||
import cn.hsa.zephyr.apisdk.response.DefaultZephyrResponse;
|
||||
import com.cpic.xim.huixiabao.data.config.HuixiabaoConfig;
|
||||
|
||||
public class CpicximToXMNHS
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger( CpicximToXMNHS.class );
|
||||
|
||||
public Vector<HmbListItem> getNeverTransHmbList()
|
||||
/**
|
||||
* 从数据库中获取未发送过的小药箱数据。
|
||||
* @return
|
||||
*/
|
||||
public Vector<HmbXyxInfo> getNeverTransHmbList()
|
||||
{
|
||||
|
||||
Vector<HmbListItem> items = new Vector<HmbListItem>();
|
||||
Vector<HmbXyxInfo> items = new Vector<HmbXyxInfo>();
|
||||
|
||||
return items;
|
||||
}
|
||||
}
|
||||
|
||||
public void postHmbList( Vector<HmbXyxInfo> items )
|
||||
{
|
||||
String url = HuixiabaoConfig.getUrl();
|
||||
String appId = HuixiabaoConfig.getAppid();
|
||||
String appSecret = HuixiabaoConfig.getAppSecret();
|
||||
String funId = "xxx";
|
||||
String encKey = HuixiabaoConfig.getEncKey();
|
||||
String signKey = HuixiabaoConfig.getSignKey();
|
||||
|
||||
SignTypeEnum signType = SignTypeEnum.SM3;
|
||||
EncryptionModeEnum encType = EncryptionModeEnum.SM4;
|
||||
|
||||
// 发送用工具对象
|
||||
DefaultZephyrClient client = new DefaultZephyrClient( url, funId, appId, appSecret,
|
||||
signType, signKey, encType, encKey );
|
||||
DefaultZephyrRequest req = new DefaultZephyrRequest();
|
||||
DefaultZephyrResponse resp = null;
|
||||
|
||||
// 数据
|
||||
JSONObject requestObject = new JSONObject();
|
||||
JSONObject xyxInfo = new JSONObject();
|
||||
JSONArray xyxInfoList = new JSONArray();
|
||||
|
||||
requestObject.put( "topic", "hmbXyxInfo" );
|
||||
requestObject.put( "hmbList", xyxInfoList );
|
||||
|
||||
int count = 0; // 计数,每个请求不能超过500条
|
||||
|
||||
for ( HmbXyxInfo info : items )
|
||||
{
|
||||
if ( count >= HuixiabaoConfig.getMAX_COUNT_PER_REQUEST() - 1 )
|
||||
{
|
||||
// 达到上限,将当前数据送出
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import cn.hsa.zephyr.apisdk.DefaultZephyrClient;
|
||||
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
|
||||
@ -48,9 +49,10 @@ public class AppTest
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nhsTest()
|
||||
{
|
||||
String url = "";
|
||||
String url = "172.18.1.150:9040";
|
||||
String appId = "待定";
|
||||
String appSecret = "待定";
|
||||
String funId = "xxx";
|
||||
@ -59,7 +61,7 @@ public class AppTest
|
||||
|
||||
SignTypeEnum signType = SignTypeEnum.SM3;
|
||||
EncryptionModeEnum encType = EncryptionModeEnum.SM4;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
DefaultZephyrClient client = new DefaultZephyrClient( url, funId, appId, appSecret,
|
||||
@ -73,7 +75,7 @@ public class AppTest
|
||||
|
||||
req.setData( jsonObject1 );
|
||||
resp = client.execute( req );
|
||||
|
||||
|
||||
System.out.println( resp.getData() );
|
||||
}
|
||||
catch ( ZephyrApiException e )
|
||||
@ -81,4 +83,27 @@ public class AppTest
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void jsonTest()
|
||||
{
|
||||
JSONObject requestObject = new JSONObject();
|
||||
JSONObject item = new JSONObject();
|
||||
JSONArray hmbList = new JSONArray();
|
||||
|
||||
requestObject.put( "topic", "hmbXyxInfo" );
|
||||
requestObject.put("hmbList", hmbList );
|
||||
|
||||
item.put( "psnName", "王炜" );
|
||||
item.put( "cerno", "350402198106130016" );
|
||||
item.put( "serviceId", "100007" );
|
||||
item.put( "status", "1" );
|
||||
item.put( "xyxNo", "1234567" );
|
||||
|
||||
hmbList.add( item );
|
||||
|
||||
String json = requestObject.toJSONString();
|
||||
|
||||
System.out.println( json );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user