完成发送代码,开始编写查询和清理已发送数据的代码。
This commit is contained in:
parent
f64cac1c21
commit
1b1545968c
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<maven.compile.source>18</maven.compile.source>
|
||||||
|
<maven.compile.target>18</maven.compile.target>
|
||||||
<maven.compiler.release>18</maven.compiler.release>
|
<maven.compiler.release>18</maven.compiler.release>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
@ -134,18 +136,31 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<defaultGoal>compile</defaultGoal>
|
<!-- <defaultGoal>compile</defaultGoal> -->
|
||||||
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to
|
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to
|
||||||
parent pom) -->
|
parent pom) -->
|
||||||
<plugins>
|
<plugins>
|
||||||
<!-- clean lifecycle, see
|
<plugin>
|
||||||
https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<plugin>
|
<version>3.3.0</version>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.13.0</version>
|
||||||
|
<configuration>
|
||||||
|
<compilerArguments>
|
||||||
|
<extdirs>${project.basedir}/lib</extdirs>
|
||||||
|
</compilerArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- <plugin>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<version>3.4.0</version>
|
<version>3.4.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- default lifecycle, jar packaging: see
|
|
||||||
https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>3.3.1</version>
|
<version>3.3.1</version>
|
||||||
@ -159,13 +174,6 @@
|
|||||||
</compilerArguments>
|
</compilerArguments>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>3.3.0</version>
|
|
||||||
<configuration>
|
|
||||||
<skip>true</skip>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.2</version>
|
||||||
@ -174,8 +182,7 @@
|
|||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>3.1.2</version>
|
<version>3.1.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<!-- site lifecycle, see
|
|
||||||
https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
<version>3.12.1</version>
|
<version>3.12.1</version>
|
||||||
@ -206,8 +213,48 @@
|
|||||||
</goals>
|
</goals>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
</plugin> -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
<configuration>
|
||||||
|
<descriptorRefs>
|
||||||
|
<descriptorRef>jar-with-dependencies</descriptorRef>
|
||||||
|
</descriptorRefs>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>com.cpic.xim.huixiabao.AppMain</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>make-assembly</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>single</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>3.4.3</version>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>com.cpic.xim.huixiabao.AppMain</mainClass>
|
||||||
|
<includeSystemScope>true</includeSystemScope>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>repackage</id>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
@ -13,17 +13,59 @@
|
|||||||
*/
|
*/
|
||||||
package com.cpic.xim.huixiabao;
|
package com.cpic.xim.huixiabao;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.cpic.xim.huixiabao.data.config.HuixiabaoConfig;
|
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.EncryptionModeEnum;
|
||||||
import cn.hsa.zephyr.apisdk.internal.util.encrypt.SignTypeEnum;
|
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 class AppMain
|
||||||
{
|
{
|
||||||
public static void main( String[] args )
|
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;
|
EncryptionModeEnum encType = EncryptionModeEnum.SM4;
|
||||||
SignTypeEnum signType = SignTypeEnum.SM3;
|
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!" );
|
System.out.println( "Hello World!" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,15 @@
|
|||||||
/*
|
/*
|
||||||
* @Author: Kane
|
* @Author: Kane
|
||||||
|
*
|
||||||
* @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/cpic/xim/huixiabao/data/pojo/HmbXyxInfo.java
|
||||||
|
*
|
||||||
* @Description: 小药箱接口参数描述
|
* @Description: 小药箱接口参数描述
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
||||||
*/
|
*/
|
||||||
package com.cpic.xim.huixiabao.data.pojo;
|
package com.cpic.xim.huixiabao.data.pojo;
|
||||||
|
|
||||||
@ -17,7 +21,20 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
|||||||
@JsonPropertyOrder( alphabetic = true )
|
@JsonPropertyOrder( alphabetic = true )
|
||||||
public class HmbXyxInfo
|
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()
|
public String getPsnName()
|
||||||
{
|
{
|
||||||
return psnName;
|
return psnName;
|
||||||
@ -68,19 +85,25 @@ public class HmbXyxInfo
|
|||||||
this.xyxNo = xyxNo;
|
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;
|
private String psnName;
|
||||||
|
|
||||||
@JsonProperty("certno")
|
@JsonProperty( "certno" )
|
||||||
private String certNo;
|
private String certNo;
|
||||||
|
|
||||||
@JsonProperty("serviceId")
|
@JsonProperty( "serviceId" )
|
||||||
private String serviceId;
|
private String serviceId;
|
||||||
|
|
||||||
@JsonProperty("status")
|
@JsonProperty( "status" )
|
||||||
private String status;
|
private String status;
|
||||||
|
|
||||||
@JsonProperty("xyxNo")
|
@JsonProperty( "xyxNo" )
|
||||||
private String xyxNo;
|
private String xyxNo;
|
||||||
|
|
||||||
}
|
}
|
@ -13,6 +13,11 @@
|
|||||||
*/
|
*/
|
||||||
package com.cpic.xim.huixiabao.nhs;
|
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 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;
|
||||||
@ -31,22 +36,85 @@ public class CpicximToXMNHS
|
|||||||
{
|
{
|
||||||
private static Logger logger = LoggerFactory.getLogger( CpicximToXMNHS.class );
|
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
|
* @return
|
||||||
*/
|
*/
|
||||||
public Vector<HmbXyxInfo> getNeverTransHmbList()
|
public static Vector<HmbXyxInfo> getNeverTransHmbList()
|
||||||
{
|
{
|
||||||
|
|
||||||
Vector<HmbXyxInfo> items = new Vector<HmbXyxInfo>();
|
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;
|
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 url = HuixiabaoConfig.getUrl();
|
||||||
String appId = HuixiabaoConfig.getAppid();
|
String appId = HuixiabaoConfig.getAppid();
|
||||||
|
@ -15,11 +15,17 @@ package com.cpic.xim.huixiabao;
|
|||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
import java.sql.*;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
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.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.DefaultZephyrClient;
|
||||||
import cn.hsa.zephyr.apisdk.internal.exception.ZephyrApiException;
|
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.EncryptionModeEnum;
|
||||||
@ -47,7 +53,9 @@ public class AppTest
|
|||||||
public void testLog()
|
public void testLog()
|
||||||
{
|
{
|
||||||
for (
|
for (
|
||||||
int i = 0; i < 10000; i++
|
int i = 0;
|
||||||
|
i < 10000;
|
||||||
|
i++
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
// System.out.print("test!");
|
// System.out.print("test!");
|
||||||
@ -119,4 +127,14 @@ public class AppTest
|
|||||||
|
|
||||||
System.out.println( json );
|
System.out.println( json );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMysql()
|
||||||
|
{
|
||||||
|
Vector<HmbXyxInfo> items = CpicximToXMNHS.getNeverTransHmbList();
|
||||||
|
|
||||||
|
System.out.println( items.toString() );
|
||||||
|
|
||||||
|
assert( items.size() > 0 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
BIN
文档/地址.xlsx
BIN
文档/地址.xlsx
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user