保存进度!

This commit is contained in:
Kane Wang 2025-03-17 19:03:17 +08:00
parent 7ecbdcdfa9
commit cb7e70fb81
4 changed files with 176 additions and 14 deletions

View File

@ -0,0 +1,59 @@
/**
* @Author: Kane
* @Date: 2025-03-17 17:09:29
* @LastEditors: Kane
* @FilePath: /cpicxim-huixiabao/src/main/java/com/cpic/xim/data/config/AppConfig.java
* @Description:
*
* Copyright (c) ${2023} by Kane, All Rights Reserved.
*/
package com.cpic.xim.data.config;
public class AppConfig
{
public static String getDriverName()
{
return driverName;
}
public static void setDriverName( String driverName )
{
AppConfig.driverName = driverName;
}
public static String getUrl()
{
return url;
}
public static void setUrl( String url )
{
AppConfig.url = url;
}
public static String getUserName()
{
return userName;
}
public static void setUserName( String userName )
{
AppConfig.userName = userName;
}
public static String getPassword()
{
return password;
}
public static void setPassword( String password )
{
AppConfig.password = password;
}
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";
}

View File

@ -0,0 +1,113 @@
/**
* @Author: Kane
* @Date: 2025-03-17 14:52:06
* @LastEditors: Kane
* @FilePath: /cpicxim-huixiabao/src/main/java/com/cpic/xim/huixiabao/db/HuixiabaoDbUtils.java
* @Description:
*
* Copyright (c) ${2023} by Kane, All Rights Reserved.
*/
package com.cpic.xim.huixiabao.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Vector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cpic.xim.huixiabao.web.data.nhs.xyx.HmbXyxInfoItem;
import com.cpic.xim.data.config.AppConfig;
public class HuixiabaoDbUtils
{
private static Logger logger = LoggerFactory.getLogger( HuixiabaoDbUtils.class );
public static void saveHmbXyxInfoToMysql( Vector<HmbXyxInfoItem> xyxInfo )
throws ClassNotFoundException
{
Connection connection = null;
PreparedStatement statementDelete = null;
PreparedStatement statementInsert = null;
String sqlDelete = """
delete from HmbXyxInfo where xyxNo = ?"
""";
String sqlInsert = """
insert into HmbXyxInfo( psnName, certno, serviceId, status, xyxNo )
values( ?, ?, ?, ?, ? )
""";
try
{
Class.forName( "com.mysql.cj.jdbc.Driver" );
connection = DriverManager.getConnection( AppConfig.getUrl(),
AppConfig.getUserName(),
AppConfig.getPassword() );
statementDelete = connection.prepareStatement( sqlDelete );
statementInsert = connection.prepareStatement( sqlInsert );
for ( HmbXyxInfoItem item: xyxInfo )
{
statementDelete.setString(1, item.getXyxNo() );
statementInsert.setString(1, item.getPsnName() );
statementInsert.setString(2, item.getCertno() );
statementInsert.setString(3, item.getServiceId() );
statementInsert.setString(4, item.getStatus() );
statementInsert.setString(5, item.getXyxNo() );
statementDelete.execute();
statementInsert.execute();
}
}
catch ( ClassNotFoundException error )
{
}
catch ( SQLException error )
{
}
finally
{
if ( statementDelete != null )
{
try
{
statementDelete.close();
}
catch ( SQLException error )
{
}
}
if ( statementInsert != null )
{
try
{
statementInsert.close();
}
catch ( SQLException error )
{
}
}
if ( connection != null )
{
try
{
connection.close();
}
catch ( SQLException error )
{
}
}
}
}
}

View File

@ -61,7 +61,7 @@ public class MediCoverController
}
catch ( Exception error )
{
// 解析json错误
// 解析json错误通知调用者
response = new MediCoverResponse( "500",
"解析JSON失败" + error.getMessage(),
"",
@ -72,6 +72,7 @@ public class MediCoverController
return response;
}
// 处理成功
response = new MediCoverResponse( "20000",
"处理成功",
"",

View File

@ -1,23 +1,12 @@
/**
* @Author: Kane
* @Date: 2025-03-15 21:01:56
* @Date: 2025-03-17 09:17:21
* @LastEditors: Kane
* @FilePath: /cpicxim-huixiabao/src/main/java/com/cpic/xim/huixiabao/web/controllers/MediCover/MediCoverResultInResponse.java
* @Description:
*
* Copyright (c) ${2023} by Kane, All Rights Reserved.
* @Copyright (c) ${2023} by Kane, All Rights Reserved.
*/
/**
* @Author: Kane Wang <wangkane@qq.com>
* @Date: 2025-03-15 18:40:54
* @LastEditors: Kane Wang
* @LastModified: 2025-03-16 01:13:50
* @FilePath: src/main/java/com/cpic/xim/huixiabao/web/controllers/MediCover/MediCoverResultInResponse.java
* @Description:
*
* Copyright (c) 2025 by Kane All rights reserved
*/
package com.cpic.xim.huixiabao.web.controllers.MediCover;
import com.fasterxml.jackson.annotation.JsonProperty;