保存进度!
This commit is contained in:
parent
05efe7bf81
commit
8e8f06717e
@ -129,6 +129,12 @@
|
|||||||
<version>${jackson.version}</version>
|
<version>${jackson.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
<version>9.2.0</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* @Author: Kane
|
* @Author: Kane Wang <wangkane@qq.com>
|
||||||
* @Date: 2025-03-17 14:52:06
|
* @Date: 2025-03-17 19:03:17
|
||||||
* @LastEditors: Kane
|
* @LastEditors: Kane
|
||||||
* @FilePath: /cpicxim-huixiabao/src/main/java/com/cpic/xim/huixiabao/db/HuixiabaoDbUtils.java
|
* @LastModified: 2025-03-20 10:49:49
|
||||||
|
* @FilePath: /cpicxim-huixiabao/src/main/java/com/cpic/xim/huixiabao/db/HuixiabaoDbUtils.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) ${2023} by Kane, All Rights Reserved.
|
* Copyright (c) 2025 by Kane All rights reserved
|
||||||
*/
|
*/
|
||||||
package com.cpic.xim.huixiabao.db;
|
package com.cpic.xim.huixiabao.db;
|
||||||
|
|
||||||
@ -26,14 +27,15 @@ public class HuixiabaoDbUtils
|
|||||||
private static Logger logger = LoggerFactory.getLogger( HuixiabaoDbUtils.class );
|
private static Logger logger = LoggerFactory.getLogger( HuixiabaoDbUtils.class );
|
||||||
|
|
||||||
public static void saveHmbXyxInfoToMysql( Vector<HmbXyxInfoItem> xyxInfo )
|
public static void saveHmbXyxInfoToMysql( Vector<HmbXyxInfoItem> xyxInfo )
|
||||||
throws ClassNotFoundException
|
throws ClassNotFoundException,
|
||||||
|
SQLException
|
||||||
{
|
{
|
||||||
Connection connection = null;
|
Connection connection = null;
|
||||||
PreparedStatement statementDelete = null;
|
PreparedStatement statementDelete = null;
|
||||||
PreparedStatement statementInsert = null;
|
PreparedStatement statementInsert = null;
|
||||||
|
|
||||||
String sqlDelete = """
|
String sqlDelete = """
|
||||||
delete from HmbXyxInfo where xyxNo = ?"
|
delete from HmbXyxInfo where xyxNo = ?
|
||||||
""";
|
""";
|
||||||
String sqlInsert = """
|
String sqlInsert = """
|
||||||
insert into HmbXyxInfo( psnName, certno, serviceId, status, xyxNo )
|
insert into HmbXyxInfo( psnName, certno, serviceId, status, xyxNo )
|
||||||
@ -47,32 +49,24 @@ public class HuixiabaoDbUtils
|
|||||||
connection = DriverManager.getConnection( AppConfig.getUrltest(),
|
connection = DriverManager.getConnection( AppConfig.getUrltest(),
|
||||||
AppConfig.getUsername(),
|
AppConfig.getUsername(),
|
||||||
AppConfig.getPassword() );
|
AppConfig.getPassword() );
|
||||||
statementDelete = connection.prepareStatement( sqlDelete );
|
statementDelete = connection.prepareStatement( sqlDelete.trim() );
|
||||||
statementInsert = connection.prepareStatement( sqlInsert );
|
statementInsert = connection.prepareStatement( sqlInsert.trim() );
|
||||||
|
|
||||||
for ( HmbXyxInfoItem item: xyxInfo )
|
for ( HmbXyxInfoItem item : xyxInfo )
|
||||||
{
|
{
|
||||||
logger.info( "写入记录{<>}", item.getXyxNo() );
|
logger.info( "写入记录{<>}", item.getXyxNo() );
|
||||||
|
|
||||||
statementDelete.setString(1, item.getXyxNo() );
|
statementDelete.setString( 1, item.getXyxNo() );
|
||||||
statementInsert.setString(1, item.getPsnName() );
|
statementInsert.setString( 1, item.getPsnName() );
|
||||||
statementInsert.setString(2, item.getCertno() );
|
statementInsert.setString( 2, item.getCertno() );
|
||||||
statementInsert.setString(3, item.getServiceId() );
|
statementInsert.setString( 3, item.getServiceId() );
|
||||||
statementInsert.setString(4, item.getStatus() );
|
statementInsert.setString( 4, item.getStatus() );
|
||||||
statementInsert.setString(5, item.getXyxNo() );
|
statementInsert.setString( 5, item.getXyxNo() );
|
||||||
|
|
||||||
statementDelete.execute();
|
statementDelete.execute();
|
||||||
statementInsert.execute();
|
statementInsert.execute();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( ClassNotFoundException error )
|
|
||||||
{
|
|
||||||
logger.error("加载mysql驱动失败:{<>}", error.getMessage() );
|
|
||||||
}
|
|
||||||
catch ( SQLException error )
|
|
||||||
{
|
|
||||||
logger.error("执行sql失败:{<>}", error.getMessage() );
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if ( statementDelete != null )
|
if ( statementDelete != null )
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/**
|
/**
|
||||||
* @Author: Kane Wang <wangkane@qq.com>
|
* @Author: Kane Wang <wangkane@qq.com>
|
||||||
* @Date: 2025-03-15 18:40:54
|
* @Date: 2025-03-15 18:40:54
|
||||||
* @LastEditors: Kane Wang
|
* @LastEditors: Kane
|
||||||
* @LastModified: 2025-03-16 08:59:16
|
* @LastModified: 2025-03-16 08:59:16
|
||||||
* @FilePath: src/main/java/com/cpic/xim/huixiabao/web/controllers/MediCover/MediCoverController.java
|
* @FilePath: /cpicxim-huixiabao/src/main/java/com/cpic/xim/huixiabao/web/controllers/MediCover/MediCoverController.java
|
||||||
* @Description:
|
* @Description:
|
||||||
*
|
*
|
||||||
* Copyright (c) 2025 by Kane All rights reserved
|
* Copyright (c) 2025 by Kane All rights reserved
|
||||||
@ -19,11 +19,16 @@ import com.fasterxml.jackson.databind.JsonMappingException;
|
|||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.cpic.xim.utils.secrecy.*;
|
import com.cpic.xim.utils.secrecy.*;
|
||||||
import com.cpic.xim.huixiabao.web.data.nhs.xyx.HmbXyxInfo;
|
import com.cpic.xim.huixiabao.web.data.nhs.xyx.HmbXyxInfo;
|
||||||
|
import com.cpic.xim.huixiabao.web.data.nhs.xyx.HmbXyxInfoItem;
|
||||||
|
import com.cpic.xim.huixiabao.db.HuixiabaoDbUtils;
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
@Controller
|
||||||
@ -58,27 +63,56 @@ public class MediCoverController
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
xyxInfo = jsonMapper.readValue( decryptData, HmbXyxInfo.class );
|
xyxInfo = jsonMapper.readValue( decryptData, HmbXyxInfo.class );
|
||||||
|
|
||||||
|
HuixiabaoDbUtils.saveHmbXyxInfoToMysql( xyxInfo.getHmbList() );
|
||||||
|
}
|
||||||
|
catch ( ClassNotFoundException error )
|
||||||
|
{
|
||||||
|
logger.error( "加载mysql驱动失败:{}", error.getMessage() );
|
||||||
|
|
||||||
|
// 解析json错误。通知调用者
|
||||||
|
response = new MediCoverResponse( "500",
|
||||||
|
"加载mysql驱动失败:" + error.getMessage(),
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
false );
|
||||||
|
}
|
||||||
|
catch ( SQLException error )
|
||||||
|
{
|
||||||
|
// 执行sql错误。通知调用者
|
||||||
|
logger.error( "执行sql失败:{}", error.getMessage() );
|
||||||
|
|
||||||
|
response = new MediCoverResponse( "500",
|
||||||
|
"执行sql失败:" + error.getMessage(),
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
false );
|
||||||
}
|
}
|
||||||
catch ( Exception error )
|
catch ( Exception error )
|
||||||
{
|
{
|
||||||
// 解析json错误。通知调用者
|
// 解析json错误。通知调用者
|
||||||
response = new MediCoverResponse( "500",
|
response = new MediCoverResponse( "500",
|
||||||
"解析JSON失败:" + error.getMessage(),
|
"解析JSON失败:{}" + error.getMessage(),
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
false );
|
false );
|
||||||
|
|
||||||
return response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理成功
|
|
||||||
response = new MediCoverResponse( "20000",
|
if ( response == null )
|
||||||
"处理成功",
|
{
|
||||||
"",
|
// 处理成功
|
||||||
"",
|
response = new MediCoverResponse( "20000",
|
||||||
"",
|
"处理成功",
|
||||||
true );
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
true );
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user