保存进度!
This commit is contained in:
parent
a3dc3480ba
commit
a823e3f963
@ -118,10 +118,23 @@
|
|||||||
<version>9.2.0</version>
|
<version>9.2.0</version>
|
||||||
</dependency>
|
</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>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>compile</defaultGoal>
|
<defaultGoal>compile</defaultGoal>
|
||||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to
|
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to
|
||||||
parent pom) -->
|
parent pom) -->
|
||||||
<plugins>
|
<plugins>
|
||||||
|
@ -12,27 +12,40 @@ package com.cpic.xim.huixiabao.data.config;
|
|||||||
|
|
||||||
public class HuixiabaoConfig
|
public class HuixiabaoConfig
|
||||||
{
|
{
|
||||||
|
public static String getAppid()
|
||||||
public String getAppid()
|
|
||||||
{
|
{
|
||||||
return appid;
|
return appid;
|
||||||
}
|
}
|
||||||
public String getAppSecret()
|
|
||||||
|
public static String getAppSecret()
|
||||||
{
|
{
|
||||||
return appSecret;
|
return appSecret;
|
||||||
}
|
}
|
||||||
public String getSignKey()
|
|
||||||
|
public static String getSignKey()
|
||||||
{
|
{
|
||||||
return signKey;
|
return signKey;
|
||||||
}
|
}
|
||||||
public String getEncKey()
|
|
||||||
|
public static String getEncKey()
|
||||||
{
|
{
|
||||||
return encKey;
|
return encKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String url = "https://172.18.1.150:9040";
|
public static int getMAX_COUNT_PER_REQUEST()
|
||||||
private String appid = "hxb-tb";
|
{
|
||||||
private String appSecret = "60F468FB46170DD4CF6CBECE215DBFC0";
|
return MAX_COUNT_PER_REQUEST;
|
||||||
private String signKey = "1A2F447BD0F930798D8031B137EC6E25";
|
}
|
||||||
private String encKey = "08307695B1668EB9FD6210250FED874F";
|
|
||||||
|
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
|
* @Date: 2025-03-06 14:33:27
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @FilePath: /Cpicxim-XMNHSA-Repeater/src/main/java/com/cpicxim/huixiabao/data/pojo/HmbListItem.java
|
* @FilePath: /Cpicxim-XMNHSA-Repeater/src/main/java/com/cpicxim/huixiabao/data/pojo/HmbListItem.java
|
||||||
* @Description:
|
* @Description: 小药箱接口参数描述
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
@ -15,7 +15,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
|||||||
|
|
||||||
@JsonInclude( JsonInclude.Include.NON_EMPTY )
|
@JsonInclude( JsonInclude.Include.NON_EMPTY )
|
||||||
@JsonPropertyOrder( alphabetic = true )
|
@JsonPropertyOrder( alphabetic = true )
|
||||||
public class HmbListItem
|
public class HmbXyxInfo
|
||||||
{
|
{
|
||||||
|
|
||||||
public String getPsnName()
|
public String getPsnName()
|
@ -2,7 +2,7 @@
|
|||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
* @Date: 2025-03-06 14:27:05
|
* @Date: 2025-03-06 14:27:05
|
||||||
* @LastEditors: Kane
|
* @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:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
@ -24,7 +24,7 @@ public class HmbXyxInfoRequest
|
|||||||
this.hmbList = new Vector<>();
|
this.hmbList = new Vector<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public HmbXyxInfoRequest( String topic, Vector<HmbListItem> hmbList )
|
public HmbXyxInfoRequest( String topic, Vector<HmbXyxInfo> hmbList )
|
||||||
{
|
{
|
||||||
this.topic = topic;
|
this.topic = topic;
|
||||||
this.topic = "hmbXyxInfo";
|
this.topic = "hmbXyxInfo";
|
||||||
@ -41,12 +41,12 @@ public class HmbXyxInfoRequest
|
|||||||
this.topic = topic;
|
this.topic = topic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vector<HmbListItem> getHmbList()
|
public Vector<HmbXyxInfo> getHmbList()
|
||||||
{
|
{
|
||||||
return hmbList;
|
return hmbList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setHmbList( Vector<HmbListItem> hmbList )
|
public void setHmbList( Vector<HmbXyxInfo> hmbList )
|
||||||
{
|
{
|
||||||
this.hmbList = hmbList;
|
this.hmbList = hmbList;
|
||||||
}
|
}
|
||||||
@ -55,5 +55,5 @@ public class HmbXyxInfoRequest
|
|||||||
private String topic; // 业务类型
|
private String topic; // 业务类型
|
||||||
|
|
||||||
@JsonProperty("hmbList")
|
@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 com.cpic.xim.huixiabao.data.pojo.*;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
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
|
public class CpicximToXMNHS
|
||||||
{
|
{
|
||||||
private static Logger logger = LoggerFactory.getLogger( CpicximToXMNHS.class );
|
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;
|
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.junit.jupiter.api.Test;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import cn.hsa.zephyr.apisdk.DefaultZephyrClient;
|
import cn.hsa.zephyr.apisdk.DefaultZephyrClient;
|
||||||
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
|
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
|
||||||
@ -48,9 +49,10 @@ public class AppTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
public void nhsTest()
|
public void nhsTest()
|
||||||
{
|
{
|
||||||
String url = "";
|
String url = "172.18.1.150:9040";
|
||||||
String appId = "待定";
|
String appId = "待定";
|
||||||
String appSecret = "待定";
|
String appSecret = "待定";
|
||||||
String funId = "xxx";
|
String funId = "xxx";
|
||||||
@ -59,7 +61,7 @@ public class AppTest
|
|||||||
|
|
||||||
SignTypeEnum signType = SignTypeEnum.SM3;
|
SignTypeEnum signType = SignTypeEnum.SM3;
|
||||||
EncryptionModeEnum encType = EncryptionModeEnum.SM4;
|
EncryptionModeEnum encType = EncryptionModeEnum.SM4;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DefaultZephyrClient client = new DefaultZephyrClient( url, funId, appId, appSecret,
|
DefaultZephyrClient client = new DefaultZephyrClient( url, funId, appId, appSecret,
|
||||||
@ -73,7 +75,7 @@ public class AppTest
|
|||||||
|
|
||||||
req.setData( jsonObject1 );
|
req.setData( jsonObject1 );
|
||||||
resp = client.execute( req );
|
resp = client.execute( req );
|
||||||
|
|
||||||
System.out.println( resp.getData() );
|
System.out.println( resp.getData() );
|
||||||
}
|
}
|
||||||
catch ( ZephyrApiException e )
|
catch ( ZephyrApiException e )
|
||||||
@ -81,4 +83,27 @@ public class AppTest
|
|||||||
e.printStackTrace();
|
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