Merge remote-tracking branch 'origin/sw' into sw

# Conflicts:
#	base-buildpackage/src/main/java/com/hzya/frame/plugin/BackUpDatabase/plugin/BackUpDatabaseInitializer.java
This commit is contained in:
yuqh 2025-01-07 09:25:19 +08:00
commit dd0388e01f
5 changed files with 142 additions and 120 deletions

View File

@ -5,13 +5,13 @@ import com.hzya.frame.base.PluginBaseEntity;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
//import com.jcraft.jsch.Channel;
//import com.jcraft.jsch.ChannelSftp;
//import com.jcraft.jsch.JSch;
//import com.jcraft.jsch.Session;
//import com.jcraft.jsch.SftpATTRS;
//import com.jcraft.jsch.SftpException;
//import org.apache.commons.net.ftp.FTPClient;
/*import com.jcraft.jsch.Channel;
import com.jcraft.jsch.ChannelSftp;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
import com.jcraft.jsch.SftpATTRS;
import com.jcraft.jsch.SftpException;
import org.apache.commons.net.ftp.FTPClient;*/
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -107,12 +107,12 @@ public class BackUpDatabaseInitializer extends PluginBaseEntity {
private String sftpFilePase;
// private ChannelSftp sftp = null;
// private Session sshSession = null;
/*private ChannelSftp sftp = null;
private Session sshSession = null;*/
@Override
public JsonResultEntity executeBusiness(JSONObject requestJson) {
try {
/* try {
if(filePase == null || "".equals(filePase)
|| databaseName == null || "".equals(databaseName)
|| fileName == null || "".equals(fileName)
@ -185,14 +185,14 @@ public class BackUpDatabaseInitializer extends PluginBaseEntity {
return false;
}
}
/**
*//**
* @Author lvleigang
* @Description 创建目录及文件
* @Date 8:59 上午 2024/10/22
* @param filePath
* @param fileName
* @return java.io.File
**/
**//*
public File creatFile(String filePath, String fileName) {
File folder = new File(filePath);
//文件夹路径不存在
@ -224,57 +224,57 @@ public class BackUpDatabaseInitializer extends PluginBaseEntity {
}
public void connect() {
// try {
// JSch jsch = new JSch();
// jsch.getSession(sftpUsername, sftpHost, sftpPort);
// sshSession = jsch.getSession(sftpUsername, sftpHost, sftpPort);
// if (logger.isInfoEnabled()) {
// logger.info("Session created.");
// }
// sshSession.setPassword(sftpPassword);
// Properties sshConfig = new Properties();
// sshConfig.put("StrictHostKeyChecking", "no");
// sshSession.setConfig(sshConfig);
// sshSession.connect();
// if (logger.isInfoEnabled()) {
// logger.info("Session connected.");
// }
// Channel channel = sshSession.openChannel("sftp");
// channel.connect();
// if (logger.isInfoEnabled()) {
// logger.info("Opening Channel.");
// }
// sftp = (ChannelSftp) channel;
// if (logger.isInfoEnabled()) {
// logger.info("Connected to " + host + ".");
// }
// } catch (Exception e) {
// }
try {
JSch jsch = new JSch();
jsch.getSession(sftpUsername, sftpHost, sftpPort);
sshSession = jsch.getSession(sftpUsername, sftpHost, sftpPort);
if (logger.isInfoEnabled()) {
logger.info("Session created.");
}
sshSession.setPassword(sftpPassword);
Properties sshConfig = new Properties();
sshConfig.put("StrictHostKeyChecking", "no");
sshSession.setConfig(sshConfig);
sshSession.connect();
if (logger.isInfoEnabled()) {
logger.info("Session connected.");
}
Channel channel = sshSession.openChannel("sftp");
channel.connect();
if (logger.isInfoEnabled()) {
logger.info("Opening Channel.");
}
sftp = (ChannelSftp) channel;
if (logger.isInfoEnabled()) {
logger.info("Connected to " + host + ".");
}
} catch (Exception e) {
}
}
/**
*//**
* 关闭连接
*/
*//*
public void disconnect() {
// if (this.sftp != null) {
// if (this.sftp.isConnected()) {
// this.sftp.disconnect();
// if (logger.isInfoEnabled()) {
// logger.info("sftp is closed already");
// }
// }
// }
// if (this.sshSession != null) {
// if (this.sshSession.isConnected()) {
// this.sshSession.disconnect();
// if (logger.isInfoEnabled()) {
// logger.info("sshSession is closed already");
// }
// }
// }
if (this.sftp != null) {
if (this.sftp.isConnected()) {
this.sftp.disconnect();
if (logger.isInfoEnabled()) {
logger.info("sftp is closed already");
}
}
}
if (this.sshSession != null) {
if (this.sshSession.isConnected()) {
this.sshSession.disconnect();
if (logger.isInfoEnabled()) {
logger.info("sshSession is closed already");
}
}
}
}
/**
*//**
* 上传单个文件
*
* @param remotePath远程保存目录
@ -282,91 +282,91 @@ public class BackUpDatabaseInitializer extends PluginBaseEntity {
* @param localPath本地上传目录(以路径符号结束)
* @param localFileName上传的文件名
* @return
*/
*//*
public boolean uploadFile(String remotePath, String remoteFileName, String localPath, String localFileName) {
// FileInputStream in = null;
// try {
// createDir(remotePath);
// File file = new File(localPath + File.separator + localFileName);
// in = new FileInputStream(file);
// sftp.put(in, remoteFileName, 65536);
// return true;
// } catch (FileNotFoundException e) {
// } catch (SftpException e) {
// } finally {
// if (in != null) {
// try {
// in.close();
// } catch (IOException e) {
// }
// }
// }
FileInputStream in = null;
try {
createDir(remotePath);
File file = new File(localPath + File.separator + localFileName);
in = new FileInputStream(file);
sftp.put(in, remoteFileName, 65536);
return true;
} catch (FileNotFoundException e) {
} catch (SftpException e) {
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
}
}
}
return false;
}
/**
*//**
* 创建目录
*
* @param createpath
* @return
*/
*//*
public boolean createDir(String createpath) {
// try {
// if (isDirExist(createpath)) {
// this.sftp.cd(createpath);
// return true;
// }
// String pathArry[] = createpath.split("/");
// StringBuffer filePath = new StringBuffer("/");
// for (String path : pathArry) {
// if (path.equals("")) {
// continue;
// }
// filePath.append(path + "/");
// if (isDirExist(filePath.toString())) {
// sftp.cd(filePath.toString());
// } else {
// // 建立目录
// sftp.mkdir(filePath.toString());
// // 进入并设置为当前目录
// sftp.cd(filePath.toString());
// }
//
// }
// this.sftp.cd(createpath);
// return true;
// } catch (SftpException e) {
// }
try {
if (isDirExist(createpath)) {
this.sftp.cd(createpath);
return true;
}
String pathArry[] = createpath.split("/");
StringBuffer filePath = new StringBuffer("/");
for (String path : pathArry) {
if (path.equals("")) {
continue;
}
filePath.append(path + "/");
if (isDirExist(filePath.toString())) {
sftp.cd(filePath.toString());
} else {
// 建立目录
sftp.mkdir(filePath.toString());
// 进入并设置为当前目录
sftp.cd(filePath.toString());
}
}
this.sftp.cd(createpath);
return true;
} catch (SftpException e) {
}
return false;
}
/**
*//**
* 判断目录是否存在
*
* @param directory
* @return
*/
*//*
public boolean isDirExist(String directory) {
boolean isDirExistFlag = false;
// try {
// SftpATTRS sftpATTRS = sftp.lstat(directory);
// isDirExistFlag = true;
// return sftpATTRS.isDir();
// } catch (Exception e) {
// if (e.getMessage().toLowerCase().equals("no such file")) {
// isDirExistFlag = false;
// }
// }
try {
SftpATTRS sftpATTRS = sftp.lstat(directory);
isDirExistFlag = true;
return sftpATTRS.isDir();
} catch (Exception e) {
if (e.getMessage().toLowerCase().equals("no such file")) {
isDirExistFlag = false;
}
}
return isDirExistFlag;
}
/**
*//**
* 如果目录不存在就创建目录
*
* @param path
*/
*//*
public void mkdirs(String path) {
File f = new File(path);
@ -376,7 +376,8 @@ public class BackUpDatabaseInitializer extends PluginBaseEntity {
if (!f.exists()) {
f.mkdirs();
}
}*/
return null;
}

View File

@ -18,7 +18,24 @@ public class ServiceDataEntity extends BaseEntity {
private String summary_id;//summary_id
private String bipAmountField;//BIP打款金额字段
private String bipAmount;//BIP打款金额
public String getBipAmountField() {
return bipAmountField;
}
public void setBipAmountField(String bipAmountField) {
this.bipAmountField = bipAmountField;
}
public String getBipAmount() {
return bipAmount;
}
public void setBipAmount(String bipAmount) {
this.bipAmount = bipAmount;
}
public String getSummary_id() {
return summary_id;

View File

@ -25,6 +25,8 @@
,summary_id
,bip_payment_number_field as bipPaymentNumberField
,bip_payment_number as bipPaymentNumber
,bip_amount_field as bipAmountField
,bip_amount as bipAmount
</sql>
<select id="entity_list_base" resultMap="get-ServiceDataEntity-result" parameterType = "com.hzya.frame.sysnew.comparison.serviceData.entity.ServiceDataEntity">
@ -89,6 +91,7 @@
update ${tabName} set
<trim suffix="" suffixOverrides=",">
<if test="payDate != null and payDate != ''"> ${payDateFiled} = #{payDate},</if>
<if test="bipAmount != null and bipAmount != ''"> ${bipAmountField} = #{bipAmount},</if>
<if test="payResult != null and payResult != ''"> ${payResultFiled} = #{payResult}</if>
</trim>
where id=#{id}

View File

@ -162,6 +162,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
if (jsonObject.getString("billCode").equals(serviceDataEntity.getBillCode())) {
serviceDataEntity.setPayResult(jsonObject.getString("payResult"));
serviceDataEntity.setPayDate(jsonObject.getString("payDate"));
serviceDataEntity.setBipAmount(jsonObject.getString("bipAmount"));
serviceDataEntity.setDataSourceCode(jsonObject.getString("dataSourceCode"));
logger.info("====开始根据单据号:{},表名称:{},表单id:{}更新支付状态和时间======", serviceDataEntity.getBillCode(), serviceDataEntity.getTabName(), serviceDataEntity.getId());
integer = serviceDataDao.updatePayResult(serviceDataEntity);
@ -292,7 +293,7 @@ public class ServiceDataServiceImpl extends BaseService<ComparisonEntity,String>
try {
StringBuffer stringBuffer = new StringBuffer();
stringBuffer.append("select oa_id as data_id,tab_name,title,pay_company,bill_name,pay_result_field,pay_date_field,receipt_filed,\n" +
"push_status_field,summary_id,bip_payment_number_field,\n" +
"push_status_field,summary_id,bip_payment_number_field,bip_amount_field,\n" +
"vdef1,pk_acceptorg,creator,pk_group,pk_org,applydate,pk_trantypecode,pk_busitype,vdef2,pk_currtype,\n" +
"pk_supplier,pk_bankacc_r,pk_bankacc_p,pk_decidedept,vdef10,vdef12,vdef3,vdef4,vdef5,vdef6,applysum,\n" +
"vdef7,vdef8,vdef9 from v_cmp_apply where 1=1 and vdef1 is not null and push_status is null and applysum >0");

View File

@ -14,9 +14,9 @@
<!-- <module>fw-nc</module>-->
<!-- <module>fw-ncc</module>-->
<!-- <module>fw-ningbobank</module>-->
<!-- <module>fw-oa</module>-->
<module>fw-oa</module>
<!-- <module>fw-u8</module>-->
<!-- <module>fw-u8c</module>-->
<module>fw-u8c</module>
<!-- <module>fw-u9c</module>-->
</modules>
<groupId>com.hzya.frame</groupId>