完成发送代码,开始编写查询和清理已发送数据的代码。
This commit is contained in:
@@ -13,17 +13,59 @@
|
||||
*/
|
||||
package com.cpic.xim.huixiabao;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cpic.xim.huixiabao.data.config.HuixiabaoConfig;
|
||||
|
||||
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;
|
||||
|
||||
public class AppMain
|
||||
{
|
||||
public static void main( String[] args )
|
||||
{
|
||||
String url = HuixiabaoConfig.getUrl();
|
||||
String appId = HuixiabaoConfig.getAppid();
|
||||
String appSecret = HuixiabaoConfig.getAppSecret();
|
||||
String funId = "xxx";
|
||||
String encKey = HuixiabaoConfig.getEncKey();
|
||||
String signKey = HuixiabaoConfig.getSignKey();
|
||||
|
||||
EncryptionModeEnum encType = EncryptionModeEnum.SM4;
|
||||
SignTypeEnum signType = SignTypeEnum.SM3;
|
||||
|
||||
try
|
||||
{
|
||||
DefaultZephyrClient client = new DefaultZephyrClient( url,
|
||||
funId,
|
||||
appId,
|
||||
appSecret,
|
||||
signType,
|
||||
signKey,
|
||||
encType,
|
||||
encKey );
|
||||
|
||||
DefaultZephyrRequest req = new DefaultZephyrRequest();
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
DefaultZephyrResponse resp = null;
|
||||
|
||||
jsonObject1.put( "code", "XXXXXXXXXXXXXXXXXX" );
|
||||
jsonObject1.put( "scene_code", "XXX" );
|
||||
|
||||
req.setData( jsonObject1 );
|
||||
// resp = client.execute( req );
|
||||
|
||||
System.out.println( req.toString() );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
System.out.println( "Fuck World!" );
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
System.out.println( "Hello World!" );
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,15 @@
|
||||
/*
|
||||
* @Author: Kane
|
||||
*
|
||||
* @Date: 2025-03-06 14:33:27
|
||||
*
|
||||
* @LastEditors: Kane
|
||||
* @FilePath: /Cpicxim-XMNHSA-Repeater/src/main/java/com/cpicxim/huixiabao/data/pojo/HmbListItem.java
|
||||
*
|
||||
* @FilePath: /cpicxim-XMNHSA-repeater/src/main/java/com/cpic/xim/huixiabao/data/pojo/HmbXyxInfo.java
|
||||
*
|
||||
* @Description: 小药箱接口参数描述
|
||||
*
|
||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||
*/
|
||||
package com.cpic.xim.huixiabao.data.pojo;
|
||||
|
||||
@@ -17,7 +21,20 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
@JsonPropertyOrder( alphabetic = true )
|
||||
public class HmbXyxInfo
|
||||
{
|
||||
|
||||
|
||||
public HmbXyxInfo( String psnName,
|
||||
String certNo,
|
||||
String serviceId,
|
||||
String status,
|
||||
String xyxNo )
|
||||
{
|
||||
this.psnName = psnName;
|
||||
this.certNo = certNo;
|
||||
this.serviceId = serviceId;
|
||||
this.status = status;
|
||||
this.xyxNo = xyxNo;
|
||||
}
|
||||
|
||||
public String getPsnName()
|
||||
{
|
||||
return psnName;
|
||||
@@ -68,19 +85,25 @@ public class HmbXyxInfo
|
||||
this.xyxNo = xyxNo;
|
||||
}
|
||||
|
||||
@JsonProperty("psnName")
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "HmbXyxInfo [psnName=" + psnName + ", certNo=" + certNo + ", serviceId=" + serviceId + ", status=" + status + ", xyxNo=" + xyxNo + "]";
|
||||
}
|
||||
|
||||
@JsonProperty( "psnName" )
|
||||
private String psnName;
|
||||
|
||||
@JsonProperty("certno")
|
||||
@JsonProperty( "certno" )
|
||||
private String certNo;
|
||||
|
||||
@JsonProperty("serviceId")
|
||||
@JsonProperty( "serviceId" )
|
||||
private String serviceId;
|
||||
|
||||
@JsonProperty("status")
|
||||
@JsonProperty( "status" )
|
||||
private String status;
|
||||
|
||||
@JsonProperty("xyxNo")
|
||||
@JsonProperty( "xyxNo" )
|
||||
private String xyxNo;
|
||||
|
||||
}
|
@@ -13,6 +13,11 @@
|
||||
*/
|
||||
package com.cpic.xim.huixiabao.nhs;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Vector;
|
||||
import com.cpic.xim.huixiabao.data.pojo.*;
|
||||
import org.slf4j.Logger;
|
||||
@@ -31,22 +36,85 @@ public class CpicximToXMNHS
|
||||
{
|
||||
private static Logger logger = LoggerFactory.getLogger( CpicximToXMNHS.class );
|
||||
|
||||
private static String driverName = "com.mysql.cj.jdbc.Driver";
|
||||
private static String url = "jdbc:mysql://10.39.0.85:3306/huixiabao?useUnicode=true&characterEncoding=utf8&useSSL=true";
|
||||
private static String userName = "huixiabao";
|
||||
private static String password = "Kane@1981";
|
||||
|
||||
/**
|
||||
* 从数据库中获取未发送过的小药箱数据。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Vector<HmbXyxInfo> getNeverTransHmbList()
|
||||
public static Vector<HmbXyxInfo> getNeverTransHmbList()
|
||||
{
|
||||
|
||||
Vector<HmbXyxInfo> items = new Vector<HmbXyxInfo>();
|
||||
HmbXyxInfo item = null;
|
||||
|
||||
|
||||
Connection connection = null;
|
||||
Statement statement = null;
|
||||
ResultSet result = null;
|
||||
|
||||
try
|
||||
{
|
||||
Class.forName( "com.mysql.cj.jdbc.Driver" );
|
||||
|
||||
String url = CpicximToXMNHS.url;
|
||||
String userName = CpicximToXMNHS.userName;
|
||||
String password = CpicximToXMNHS.password;
|
||||
String sql = """
|
||||
select info.psnName, info.certNo, info.serviceId, info.status, info.xyxNo
|
||||
from HmbXyxInfo info,
|
||||
HmbXyxInfo_Update u
|
||||
where info.xyxNo = u.xyxNo """;
|
||||
|
||||
connection = DriverManager.getConnection( url, userName, password );
|
||||
statement = connection.createStatement();
|
||||
result = statement.executeQuery( sql.trim() );
|
||||
|
||||
while ( result.next() )
|
||||
{
|
||||
item = new HmbXyxInfo( result.getString( "psnName" ),
|
||||
result.getString( "certno" ),
|
||||
result.getString( "serviceId" ),
|
||||
result.getString( "status" ),
|
||||
result.getString( "xyxNo" ) );
|
||||
|
||||
items.add( item );
|
||||
}
|
||||
}
|
||||
catch ( SQLException error )
|
||||
{
|
||||
error.printStackTrace();
|
||||
}
|
||||
catch ( ClassNotFoundException error )
|
||||
{
|
||||
|
||||
}
|
||||
finally
|
||||
{
|
||||
try
|
||||
{
|
||||
result.close();
|
||||
statement.close();
|
||||
connection.close();
|
||||
}
|
||||
catch ( SQLException error )
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
public void postHmbList( Vector<HmbXyxInfo> items )
|
||||
public static void removePostedHmbXyxInfo( Vector<HmbXyxInfo> postedItems )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public static void postHmbList( Vector<HmbXyxInfo> items )
|
||||
{
|
||||
String url = HuixiabaoConfig.getUrl();
|
||||
String appId = HuixiabaoConfig.getAppid();
|
||||
|
@@ -15,11 +15,17 @@ package com.cpic.xim.huixiabao;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Vector;
|
||||
|
||||
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 com.cpic.xim.huixiabao.data.pojo.HmbXyxInfo;
|
||||
import com.cpic.xim.huixiabao.nhs.CpicximToXMNHS;
|
||||
|
||||
import cn.hsa.zephyr.apisdk.DefaultZephyrClient;
|
||||
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
|
||||
import cn.hsa.zephyr.apisdk.internal.util.encrypt.EncryptionModeEnum;
|
||||
@@ -47,7 +53,9 @@ public class AppTest
|
||||
public void testLog()
|
||||
{
|
||||
for (
|
||||
int i = 0; i < 10000; i++
|
||||
int i = 0;
|
||||
i < 10000;
|
||||
i++
|
||||
)
|
||||
{
|
||||
// System.out.print("test!");
|
||||
@@ -119,4 +127,14 @@ public class AppTest
|
||||
|
||||
System.out.println( json );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMysql()
|
||||
{
|
||||
Vector<HmbXyxInfo> items = CpicximToXMNHS.getNeverTransHmbList();
|
||||
|
||||
System.out.println( items.toString() );
|
||||
|
||||
assert( items.size() > 0 );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user