parent
cf0f756f2f
commit
6d3ce7042f
|
@ -115,6 +115,7 @@ public class AccLogPluginInitializer extends PluginBaseEntity {
|
|||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
//查询银行账户列表
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData("SELECT field0002 from formmain_0053",oaBillEntity);
|
||||
|
@ -125,12 +126,13 @@ public class AccLogPluginInitializer extends PluginBaseEntity {
|
|||
accList.add(field0002);
|
||||
}
|
||||
}
|
||||
accList = Convert.toList(String.class,"86041110000110293,86041110000109337,6223160030547665,6214180002001411023,6214180000002609736");
|
||||
//1、查询宁波银行的交易记录
|
||||
AccTransactionReq accTransactionReq = new AccTransactionReq();
|
||||
accTransactionReq.setCdSign(NingboBankUtil.SHOURU);
|
||||
accTransactionReq.setBeginDate("2024-07-01");
|
||||
accTransactionReq.setEndDate("2024-07-30");
|
||||
accTransactionReq.setBankAccList(Convert.toList(String.class,"86041110000110293,86041110000109337,6223160030547665,6214180002001411023,6214180000002609736"));
|
||||
accTransactionReq.setBankAccList(accList);
|
||||
Map<String, String> headerMap = MapBuilder.<String, String>create(true)
|
||||
.put("apiCode", "8000360002")
|
||||
.put("publicKey","ZJYAWb7lhAUTYqekPkU+uHJv1/ObJxb7dT7sD8HPRDGAgyhCe7eDIk+3zDUT+v578prj")
|
||||
|
|
|
@ -10,15 +10,11 @@ import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
|
|||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -135,80 +131,11 @@ public class NingboBankPayPluginInitializer extends PluginBaseEntity {
|
|||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
|
||||
//备用金申请单
|
||||
//付款单
|
||||
stringBuffer.append("select * from v_hzya_pay where 1=1 " );
|
||||
stringBuffer.append(sb.toString());
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity);
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
main.put(key, hashMap.get(key));
|
||||
}
|
||||
logger.info("获取到付款单的数据"+main.toString());
|
||||
String result = ningboBankPluginService.executeEsb(main.toString(),"8000360000");
|
||||
logger.info("推送宁波银行的返回结果"+result);
|
||||
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
|
||||
logDetails.setRootAppPk(main.getString("id"));
|
||||
logDetails.setRootAppBill(main.getString("serialNo"));
|
||||
logDetails.setNewTransmitInfo(result);
|
||||
logDetails.setNewPushDate(new Date());
|
||||
logDetails.setRootAppNewData(JSON.toJSONString(main));
|
||||
logDetails.setPluginId("NingboBankPayPlugin");
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
String attribute = resultObj.getString("attribute");
|
||||
boolean flag = resultObj.getBoolean("flag");
|
||||
String subState = "";
|
||||
String fieldName = main.getString("fieldName");
|
||||
String tableName = main.getString("tableName");
|
||||
String payMsg = main.getString("payMsg");
|
||||
// String subMsg = main.getString("subMsg");
|
||||
String str = "";
|
||||
String sync_flag = "";
|
||||
try {
|
||||
if(StrUtil.isEmpty(interId)){// 银行状态 1支付中 2 支付失败 null 未提交支付 0支付成功
|
||||
logDetails.setCreate_time(new Date());
|
||||
logDetails.setModify_time(new Date());
|
||||
if(flag){
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "2";
|
||||
String resMsg = JSONObject.parseObject(attribute).getString("retMsg");
|
||||
sync_flag = " ,"+payMsg+" = '"+resMsg+"'";
|
||||
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||
}
|
||||
}else{
|
||||
logDetails.setId(interId);
|
||||
logDetails.setModify_time(new Date());
|
||||
if(flag){
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "2";
|
||||
String resMsg = JSONObject.parseObject(attribute).getString("retMsg");
|
||||
sync_flag = " ,"+payMsg+" = '"+resMsg+"'";
|
||||
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||
}
|
||||
}
|
||||
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +sync_flag+"where id = '"+main.getString("id")+"'";
|
||||
} catch (Exception e) {
|
||||
subState = "N";
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +payMsg+" = '"+attribute+"' "+"where id = '"+main.getString("id")+"'";
|
||||
logger.info("保存日志失败"+e.getMessage());
|
||||
oaBillEntity.setSql(str);
|
||||
payBillDao.updateStateForId(str,oaBillEntity);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//修改推送状态,防止重复推送
|
||||
oaBillEntity.setSql(str);
|
||||
payBillDao.updateStateForId(str,oaBillEntity);
|
||||
}
|
||||
}
|
||||
ningboBankPluginService.payRequest(hashMaps,getPluginId(),"8000360000",interId);
|
||||
} catch (Exception e) {
|
||||
logger.info("获取OA数据失败"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -118,65 +118,8 @@ public class NingboBankPayResultPluginInitializer extends PluginBaseEntity {
|
|||
try {
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity);
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
main.put(key, hashMap.get(key));
|
||||
}
|
||||
String tableName = main.getString("tableName");
|
||||
String fieldName = main.getString("fieldName");
|
||||
String payDate = main.getString("payDate");
|
||||
String payMsg = main.getString("payMsg");
|
||||
try {
|
||||
|
||||
logger.info("获取到付款单状态的数据"+main.toString());
|
||||
JSONObject reMain = new JSONObject();
|
||||
reMain.put("serialNo",main.getString("serialNo"));
|
||||
String result = ningboBankPluginService.executeEsb(reMain.toString(),"8000360001");
|
||||
logger.info("获取付款状态结果"+result);
|
||||
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
JSONObject attribute = resultObj.getJSONObject("attribute");
|
||||
boolean flag = resultObj.getBoolean("flag");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("update "+tableName);
|
||||
if(flag){
|
||||
JSONObject data = attribute.getJSONObject("Data");
|
||||
JSONObject transferDtl = data.getJSONObject("transferDtl");
|
||||
String status = transferDtl.getString("status");
|
||||
String msg = PayStatusEnum.getByCode(status);
|
||||
if(StrUtil.isEmpty(msg)){
|
||||
msg ="未知交易状态,请联系管理员查证";
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
}
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
//收否最终态
|
||||
if(PayStatusEnum.isFinally(status)){
|
||||
sb.append(" , "+fieldName+" = '0'");
|
||||
String payDateStr = DateUtil.now();
|
||||
sb.append(" , "+payDate+" = '"+payDateStr+"'");
|
||||
}
|
||||
}else {
|
||||
sb.append(" set "+payMsg+" = '查询失败,请联系管理员'");
|
||||
sb.append(" ,"+fieldName+" = '2'");
|
||||
|
||||
}
|
||||
sb.append(" where id = '"+main.getString("id")+"'");
|
||||
//修改推送状态,防止重复推送
|
||||
oaBillEntity.setSql(sb.toString());
|
||||
payBillDao.updateStateForId(sb.toString(),oaBillEntity);
|
||||
} catch (Exception e) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("update "+tableName );
|
||||
sb.append(" set "+payMsg+" = '获取交易状态失败'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
sb.append(" where id = '"+main.getString("id")+"'");
|
||||
logger.info("获取交易状态失败,更新交易信息为失败状态,后续不在查询");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
//查询交易结果
|
||||
ningboBankPluginService.queryResult(hashMaps,"8000360001");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
package com.hzya.frame.plugin.a8bill.plugin;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description 外汇 TT 汇款
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/1 14:33
|
||||
**/
|
||||
public class NingboBankTTPayPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
private INingboBankPluginService ningboBankPluginService;
|
||||
@Resource
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Autowired
|
||||
private IPayBillPluginInitializerDao payBillDao;
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
|
||||
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 10:48
|
||||
* @Param []
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件销毁方法
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的ID
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "NingboBankTTPayPlugin";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "宁波银行T/T汇款插件";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "宁波银行T/T汇款插件";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 1、场景插件
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 14:01
|
||||
* @Param []
|
||||
* @return java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
/***
|
||||
* 执行业务代码
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-07 11:20
|
||||
* @param requestJson 执行业务代码的参数
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
JSONObject requestJsonObj = JSON.parseObject(requestJson.toString(),JSONObject.class);
|
||||
String interId = requestJsonObj.getString("integration_task_living_details_id");
|
||||
IntegrationTaskLivingDetailsEntity oldMsg = new IntegrationTaskLivingDetailsEntity();
|
||||
if(StrUtil.isNotEmpty(interId)){
|
||||
oldMsg = taskLivingDetailsService.get(interId);
|
||||
}
|
||||
String rootAppPk = oldMsg.getRootAppPk();
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(StrUtil.isNotEmpty(rootAppPk)){
|
||||
String code = requestJson.getString("code");
|
||||
sb.append(" and id = '"+rootAppPk+"'");
|
||||
}else{
|
||||
sb.append(" and payState is null");
|
||||
}
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
//付款单
|
||||
stringBuffer.append("select * from v_hzya_pay_tt where 1=1 " );
|
||||
stringBuffer.append(sb.toString());
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity);
|
||||
ningboBankPluginService.payRequest(hashMaps,getPluginId(),"8000360003",interId);
|
||||
} catch (Exception e) {
|
||||
logger.info("获取OA数据失败"+e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JsonResultEntity("成功",true,new JsonResultEntity());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
package com.hzya.frame.plugin.a8bill.plugin;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.base.PluginBaseEntity;
|
||||
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import com.hzya.frame.web.entity.JsonResultEntity;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description TT汇款汇出交易结果查询
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/2 10:47
|
||||
**/
|
||||
public class NingboBankTTPayResultPluginInitializer extends PluginBaseEntity {
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
private INingboBankPluginService ningboBankPluginService;
|
||||
@Resource
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Autowired
|
||||
private IPayBillPluginInitializerDao payBillDao;
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
|
||||
|
||||
/***
|
||||
* 插件初始化方法
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 10:48
|
||||
* @Param []
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void initialize() {
|
||||
logger.info(getPluginLabel() + "執行初始化方法initialize()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件销毁方法
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public void destroy() {
|
||||
logger.info(getPluginLabel() + "執行銷毀方法destroy()");
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的ID
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginId() {
|
||||
return "NingboBankTTPayResultPlugin";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的名称
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "宁波银行T/T汇款交易状态查询插件";
|
||||
}
|
||||
|
||||
/****
|
||||
* 插件的显示值
|
||||
* @author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @date 2023-08-02 10:48
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public String getPluginLabel() {
|
||||
return "宁波银行T/T汇款交易状态查询插件";
|
||||
}
|
||||
|
||||
/***
|
||||
* 插件类型 1、场景插件
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-02 14:01
|
||||
* @Param []
|
||||
* @return java.lang.String
|
||||
**/
|
||||
@Override
|
||||
public String getPluginType() {
|
||||
return "1";
|
||||
}
|
||||
|
||||
/***
|
||||
* 执行业务代码
|
||||
* @Author 👻👻👻👻👻👻👻👻 gjh
|
||||
* @Date 2023-08-07 11:20
|
||||
* @param requestJson 执行业务代码的参数
|
||||
* @return void
|
||||
**/
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) throws Exception {
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select * from v_hzya_pay_tt where payState ='1'");
|
||||
try {
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity);
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
//查询交易结果
|
||||
ningboBankPluginService.queryResult(hashMaps,"8000360007");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JsonResultEntity("成功",true,new JsonResultEntity());
|
||||
}
|
||||
}
|
|
@ -1,7 +1,9 @@
|
|||
package com.hzya.frame.plugin.a8bill.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -11,6 +13,14 @@ import java.util.List;
|
|||
**/
|
||||
public interface INingboBankPluginService {
|
||||
|
||||
/**
|
||||
* 支付申请
|
||||
* @param hashMaps oa 查到的数据
|
||||
* @param pluginId 插件 id
|
||||
* @param apiCode api 编码
|
||||
* @param interId 重试 id
|
||||
*/
|
||||
void payRequest(List<HashMap<String, Object>> hashMaps,String pluginId,String apiCode,String interId);
|
||||
/**
|
||||
* 调用宁波银行esb接口
|
||||
* @param params
|
||||
|
@ -25,4 +35,11 @@ public interface INingboBankPluginService {
|
|||
* @param accTransactionResList
|
||||
*/
|
||||
void saveAccLog(List<AccTransactionRes> accTransactionResList);
|
||||
|
||||
/**
|
||||
* 查询交易结果
|
||||
* @param hashMaps
|
||||
* @param apiCode
|
||||
*/
|
||||
void queryResult(List<HashMap<String, Object>> hashMaps,String apiCode);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,34 @@
|
|||
package com.hzya.frame.plugin.a8bill.service.impl;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.map.MapBuilder;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hzya.frame.ningboBankTreasury.dto.req.SingleTransferReq;
|
||||
import com.hzya.frame.ningboBankTreasury.dto.req.TTRemitReq;
|
||||
import com.hzya.frame.ningboBankTreasury.dto.res.AccTransactionRes;
|
||||
import com.hzya.frame.ningboBankTreasury.enums.CurrencyEnum;
|
||||
import com.hzya.frame.ningboBankTreasury.enums.PayStatusEnum;
|
||||
import com.hzya.frame.ningboBankTreasury.enums.TTPayStatusEnum;
|
||||
import com.hzya.frame.plugin.a8bill.dao.IPayBillPluginInitializerDao;
|
||||
import com.hzya.frame.plugin.a8bill.entity.PayBillEntity;
|
||||
import com.hzya.frame.plugin.a8bill.service.INingboBankPluginService;
|
||||
import com.hzya.frame.seeyon.dongj.entity.Formmain0044Entity;
|
||||
import com.hzya.frame.seeyon.dongj.service.IFormmain0044Service;
|
||||
import com.hzya.frame.stringutil.StringUtil;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.service.IIntegrationTaskLivingDetailsService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
|
@ -28,13 +37,203 @@ import java.util.stream.Collectors;
|
|||
* @Date 2024/7/25 16:34
|
||||
**/
|
||||
public class NingboBankPluginServiceImpl implements INingboBankPluginService {
|
||||
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Autowired
|
||||
private IFormmain0044Service formmain0044Service;
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
@Resource
|
||||
private IIntegrationTaskLivingDetailsService taskLivingDetailsService;
|
||||
@Autowired
|
||||
private IPayBillPluginInitializerDao payBillDao;
|
||||
|
||||
@Value("${OA.data_source_code}")
|
||||
private String oa_data_source_code;
|
||||
|
||||
|
||||
/**
|
||||
* 支付申请
|
||||
* @param hashMaps oa 查到的数据
|
||||
* @param pluginId 插件 id
|
||||
* @param apiCode api 编码
|
||||
* @param interId 重试 id
|
||||
*/
|
||||
@Override
|
||||
public void payRequest(List<HashMap<String, Object>> hashMaps, String pluginId, String apiCode,String interId) {
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
try {
|
||||
JSONObject main = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
main.put(key, hashMap.get(key));
|
||||
}
|
||||
String param = "";
|
||||
if ("8000360000".equals(apiCode)){
|
||||
SingleTransferReq singleTransferReq = JSONObject.parseObject(main.toString(), SingleTransferReq.class);
|
||||
param = JSONObject.toJSONString(singleTransferReq);
|
||||
}else if("8000360003".equals(apiCode)){
|
||||
TTRemitReq ttRemitReq = JSONObject.parseObject(main.toString(), TTRemitReq.class);
|
||||
if ("01".equals(ttRemitReq.getPayMode()) || "1".equals(ttRemitReq.getPayMode())){
|
||||
ttRemitReq.setFileUploadCodes(Convert.toList(String.class,"0a736c17-e79f-48be-b3cd-710585165d55"));
|
||||
}
|
||||
param = JSONObject.toJSONString(ttRemitReq);
|
||||
}
|
||||
if (StrUtil.isEmpty(param)){
|
||||
param = main.toString();
|
||||
}
|
||||
logger.info("获取到付款单的数据:{}",main.toString());
|
||||
String result = this.executeEsb(param,apiCode);
|
||||
logger.info("推送宁波银行的返回结果:{}",result);
|
||||
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
|
||||
logDetails.setRootAppPk(main.getString("id"));
|
||||
logDetails.setRootAppBill(main.getString("serialNo"));
|
||||
logDetails.setNewTransmitInfo(result);
|
||||
logDetails.setNewPushDate(new Date());
|
||||
logDetails.setRootAppNewData(JSON.toJSONString(main));
|
||||
logDetails.setPluginId(pluginId);
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
String attribute = resultObj.getString("attribute");
|
||||
boolean flag = resultObj.getBoolean("flag");
|
||||
String subState = "";
|
||||
String fieldName = main.getString("fieldName");
|
||||
String tableName = main.getString("tableName");
|
||||
String payMsg = main.getString("payMsg");
|
||||
// String subMsg = main.getString("subMsg");
|
||||
String str = "";
|
||||
String sync_flag = "";
|
||||
try {
|
||||
if(StrUtil.isEmpty(interId)){// 银行状态 1支付中 2 支付失败 null 未提交支付 0支付成功
|
||||
logDetails.setCreate_time(new Date());
|
||||
logDetails.setModify_time(new Date());
|
||||
if(flag){
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "2";
|
||||
String resMsg = JSONObject.parseObject(attribute).getString("retMsg");
|
||||
sync_flag = " ,"+payMsg+" = '"+resMsg+"'";
|
||||
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||
}
|
||||
}else{
|
||||
logDetails.setId(interId);
|
||||
logDetails.setModify_time(new Date());
|
||||
if(flag){
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "2";
|
||||
String resMsg = JSONObject.parseObject(attribute).getString("retMsg");
|
||||
sync_flag = " ,"+payMsg+" = '"+resMsg+"'";
|
||||
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||
}
|
||||
}
|
||||
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +sync_flag+"where id = '"+main.getString("id")+"'";
|
||||
} catch (Exception e) {
|
||||
subState = "N";
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'" +payMsg+" = '"+attribute+"' "+"where id = '"+main.getString("id")+"'";
|
||||
logger.info("保存日志失败"+e.getMessage());
|
||||
oaBillEntity.setSql(str);
|
||||
payBillDao.updateStateForId(str,oaBillEntity);
|
||||
e.printStackTrace();
|
||||
}
|
||||
//修改推送状态,防止重复推送
|
||||
oaBillEntity.setSql(str);
|
||||
payBillDao.updateStateForId(str,oaBillEntity);
|
||||
}catch (Exception e){
|
||||
logger.info("宁波银行付款接口调用出错:{}",e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询交易结果
|
||||
*
|
||||
* @param hashMaps
|
||||
* @param apiCode
|
||||
*/
|
||||
@Override
|
||||
public void queryResult(List<HashMap<String, Object>> hashMaps, String apiCode) {
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
oaBillEntity.setDataSourceCode(oa_data_source_code);
|
||||
for (HashMap<String, Object> hashMap : hashMaps) {
|
||||
JSONObject main = new JSONObject();
|
||||
for(String key:hashMap.keySet()) {
|
||||
main.put(key, hashMap.get(key));
|
||||
}
|
||||
String tableName = main.getString("tableName");
|
||||
String fieldName = main.getString("fieldName");
|
||||
String payDate = main.getString("payDate");
|
||||
String payMsg = main.getString("payMsg");
|
||||
try {
|
||||
|
||||
logger.info("获取到付款单状态的数据"+main.toString());
|
||||
JSONObject reMain = new JSONObject();
|
||||
reMain.put("serialNo",main.getString("serialNo"));
|
||||
String result = this.executeEsb(reMain.toString(),apiCode);
|
||||
logger.info("获取付款状态结果"+result);
|
||||
|
||||
JSONObject resultObj = JSON.parseObject(result);
|
||||
JSONObject attribute = resultObj.getJSONObject("attribute");
|
||||
boolean flag = resultObj.getBoolean("flag");
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("update "+tableName);
|
||||
if(flag){
|
||||
JSONObject data = attribute.getJSONObject("Data");
|
||||
JSONObject transferDtl = new JSONObject();
|
||||
String status = "";
|
||||
String msg = "";
|
||||
boolean isFinally = true;
|
||||
if ("8000360001".equals(apiCode)){
|
||||
transferDtl = data.getJSONObject("transferDtl");
|
||||
status = transferDtl.getString("status");
|
||||
msg = PayStatusEnum.getByCode(status);
|
||||
isFinally = PayStatusEnum.isFinally(status);
|
||||
}else if ("8000360007".equals(apiCode)){
|
||||
status = data.getString("transState");
|
||||
msg = TTPayStatusEnum.getByCode(status);
|
||||
isFinally = TTPayStatusEnum.isFinally(status);
|
||||
}
|
||||
if(StrUtil.isEmpty(msg)){
|
||||
msg ="未知交易状态,请联系管理员查证";
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
}
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
//是否最终态
|
||||
if(isFinally){
|
||||
sb.append(" , "+fieldName+" = '0'");
|
||||
String payDateStr = DateUtil.now();
|
||||
sb.append(" , "+payDate+" = '"+payDateStr+"'");
|
||||
}
|
||||
}else {
|
||||
sb.append(" set "+payMsg+" = '"+attribute.getString("retMsg")+"'");
|
||||
sb.append(" ,"+fieldName+" = '2'");
|
||||
|
||||
}
|
||||
sb.append(" where id = '"+main.getString("id")+"'");
|
||||
//修改推送状态,防止重复推送
|
||||
oaBillEntity.setSql(sb.toString());
|
||||
payBillDao.updateStateForId(sb.toString(),oaBillEntity);
|
||||
} catch (Exception e) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("update "+tableName );
|
||||
sb.append(" set "+payMsg+" = '获取交易状态失败'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
sb.append(" where id = '"+main.getString("id")+"'");
|
||||
logger.info("获取交易状态失败,更新交易信息为失败状态,后续不在查询");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用宁波银行esb接口
|
||||
*
|
||||
|
|
|
@ -0,0 +1,390 @@
|
|||
package com.hzya.frame.ningboBankTreasury.dto.req;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description T/T汇款提交
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/1 17:14
|
||||
**/
|
||||
public class TTRemitReq {
|
||||
private String custId;
|
||||
private String serialNo;
|
||||
private String remitType;
|
||||
private String transferType;
|
||||
private String corpCode;
|
||||
private String remitAddress;
|
||||
private String bankType;
|
||||
private String payMode;
|
||||
private String estimateDate;
|
||||
private String remitCurCode;
|
||||
private String smallCurCode;
|
||||
private String totalAmt;
|
||||
private String transAmt;
|
||||
private String subTransCode;
|
||||
private String goods;
|
||||
private String transAmt2;
|
||||
private String subTransCode2;
|
||||
private String goods2;
|
||||
private String remitAcc;
|
||||
private String curRemitAmt;
|
||||
private String remitAcc2;
|
||||
private String curRemitAmt2;
|
||||
private String curRemitAmt3;
|
||||
private String remitAcc3;
|
||||
private String isAgent;
|
||||
private String agentAcc;
|
||||
private String agentBankSwiftCode;
|
||||
private String rcvSettleType;
|
||||
private String rcvBankCode;
|
||||
private String rcvCountryCode;
|
||||
private String rcvName;
|
||||
private String rcvAddress;
|
||||
private String rcvAcc;
|
||||
private String costPayer;
|
||||
private String costAcc;
|
||||
private String isFullPay;
|
||||
private String paymentProp;
|
||||
private String contacts;
|
||||
private String contactPhone;
|
||||
private String payUnderFreeTax;
|
||||
//private List<ContractDetail> contractDtlList;
|
||||
private String postscript;
|
||||
private List<String> fileUploadCodes;
|
||||
|
||||
public String getCustId() {
|
||||
return custId;
|
||||
}
|
||||
|
||||
public void setCustId(String custId) {
|
||||
this.custId = custId;
|
||||
}
|
||||
|
||||
public String getSerialNo() {
|
||||
return serialNo;
|
||||
}
|
||||
|
||||
public void setSerialNo(String serialNo) {
|
||||
this.serialNo = serialNo;
|
||||
}
|
||||
|
||||
public String getRemitType() {
|
||||
return remitType;
|
||||
}
|
||||
|
||||
public void setRemitType(String remitType) {
|
||||
this.remitType = remitType;
|
||||
}
|
||||
|
||||
public String getTransferType() {
|
||||
return transferType;
|
||||
}
|
||||
|
||||
public void setTransferType(String transferType) {
|
||||
this.transferType = transferType;
|
||||
}
|
||||
|
||||
public String getCorpCode() {
|
||||
return corpCode;
|
||||
}
|
||||
|
||||
public void setCorpCode(String corpCode) {
|
||||
this.corpCode = corpCode;
|
||||
}
|
||||
|
||||
public String getRemitAddress() {
|
||||
return remitAddress;
|
||||
}
|
||||
|
||||
public void setRemitAddress(String remitAddress) {
|
||||
this.remitAddress = remitAddress;
|
||||
}
|
||||
|
||||
public String getBankType() {
|
||||
return bankType;
|
||||
}
|
||||
|
||||
public void setBankType(String bankType) {
|
||||
this.bankType = bankType;
|
||||
}
|
||||
|
||||
public String getPayMode() {
|
||||
return payMode;
|
||||
}
|
||||
|
||||
public void setPayMode(String payMode) {
|
||||
this.payMode = payMode;
|
||||
}
|
||||
|
||||
public String getEstimateDate() {
|
||||
return estimateDate;
|
||||
}
|
||||
|
||||
public void setEstimateDate(String estimateDate) {
|
||||
this.estimateDate = estimateDate;
|
||||
}
|
||||
|
||||
public String getRemitCurCode() {
|
||||
return remitCurCode;
|
||||
}
|
||||
|
||||
public void setRemitCurCode(String remitCurCode) {
|
||||
this.remitCurCode = remitCurCode;
|
||||
}
|
||||
|
||||
public String getSmallCurCode() {
|
||||
return smallCurCode;
|
||||
}
|
||||
|
||||
public void setSmallCurCode(String smallCurCode) {
|
||||
this.smallCurCode = smallCurCode;
|
||||
}
|
||||
|
||||
public String getTotalAmt() {
|
||||
return totalAmt;
|
||||
}
|
||||
|
||||
public void setTotalAmt(String totalAmt) {
|
||||
this.totalAmt = totalAmt;
|
||||
}
|
||||
|
||||
public String getTransAmt() {
|
||||
return transAmt;
|
||||
}
|
||||
|
||||
public void setTransAmt(String transAmt) {
|
||||
this.transAmt = transAmt;
|
||||
}
|
||||
|
||||
public String getSubTransCode() {
|
||||
return subTransCode;
|
||||
}
|
||||
|
||||
public void setSubTransCode(String subTransCode) {
|
||||
this.subTransCode = subTransCode;
|
||||
}
|
||||
|
||||
public String getGoods() {
|
||||
return goods;
|
||||
}
|
||||
|
||||
public void setGoods(String goods) {
|
||||
this.goods = goods;
|
||||
}
|
||||
|
||||
public String getTransAmt2() {
|
||||
return transAmt2;
|
||||
}
|
||||
|
||||
public void setTransAmt2(String transAmt2) {
|
||||
this.transAmt2 = transAmt2;
|
||||
}
|
||||
|
||||
public String getSubTransCode2() {
|
||||
return subTransCode2;
|
||||
}
|
||||
|
||||
public void setSubTransCode2(String subTransCode2) {
|
||||
this.subTransCode2 = subTransCode2;
|
||||
}
|
||||
|
||||
public String getGoods2() {
|
||||
return goods2;
|
||||
}
|
||||
|
||||
public void setGoods2(String goods2) {
|
||||
this.goods2 = goods2;
|
||||
}
|
||||
|
||||
public String getRemitAcc() {
|
||||
return remitAcc;
|
||||
}
|
||||
|
||||
public void setRemitAcc(String remitAcc) {
|
||||
this.remitAcc = remitAcc;
|
||||
}
|
||||
|
||||
public String getCurRemitAmt() {
|
||||
return curRemitAmt;
|
||||
}
|
||||
|
||||
public void setCurRemitAmt(String curRemitAmt) {
|
||||
this.curRemitAmt = curRemitAmt;
|
||||
}
|
||||
|
||||
public String getRemitAcc2() {
|
||||
return remitAcc2;
|
||||
}
|
||||
|
||||
public void setRemitAcc2(String remitAcc2) {
|
||||
this.remitAcc2 = remitAcc2;
|
||||
}
|
||||
|
||||
public String getCurRemitAmt2() {
|
||||
return curRemitAmt2;
|
||||
}
|
||||
|
||||
public void setCurRemitAmt2(String curRemitAmt2) {
|
||||
this.curRemitAmt2 = curRemitAmt2;
|
||||
}
|
||||
|
||||
public String getCurRemitAmt3() {
|
||||
return curRemitAmt3;
|
||||
}
|
||||
|
||||
public void setCurRemitAmt3(String curRemitAmt3) {
|
||||
this.curRemitAmt3 = curRemitAmt3;
|
||||
}
|
||||
|
||||
public String getRemitAcc3() {
|
||||
return remitAcc3;
|
||||
}
|
||||
|
||||
public void setRemitAcc3(String remitAcc3) {
|
||||
this.remitAcc3 = remitAcc3;
|
||||
}
|
||||
|
||||
public String getIsAgent() {
|
||||
return isAgent;
|
||||
}
|
||||
|
||||
public void setIsAgent(String isAgent) {
|
||||
this.isAgent = isAgent;
|
||||
}
|
||||
|
||||
public String getAgentAcc() {
|
||||
return agentAcc;
|
||||
}
|
||||
|
||||
public void setAgentAcc(String agentAcc) {
|
||||
this.agentAcc = agentAcc;
|
||||
}
|
||||
|
||||
public String getAgentBankSwiftCode() {
|
||||
return agentBankSwiftCode;
|
||||
}
|
||||
|
||||
public void setAgentBankSwiftCode(String agentBankSwiftCode) {
|
||||
this.agentBankSwiftCode = agentBankSwiftCode;
|
||||
}
|
||||
|
||||
public String getRcvSettleType() {
|
||||
return rcvSettleType;
|
||||
}
|
||||
|
||||
public void setRcvSettleType(String rcvSettleType) {
|
||||
this.rcvSettleType = rcvSettleType;
|
||||
}
|
||||
|
||||
public String getRcvBankCode() {
|
||||
return rcvBankCode;
|
||||
}
|
||||
|
||||
public void setRcvBankCode(String rcvBankCode) {
|
||||
this.rcvBankCode = rcvBankCode;
|
||||
}
|
||||
|
||||
public String getRcvCountryCode() {
|
||||
return rcvCountryCode;
|
||||
}
|
||||
|
||||
public void setRcvCountryCode(String rcvCountryCode) {
|
||||
this.rcvCountryCode = rcvCountryCode;
|
||||
}
|
||||
|
||||
public String getRcvName() {
|
||||
return rcvName;
|
||||
}
|
||||
|
||||
public void setRcvName(String rcvName) {
|
||||
this.rcvName = rcvName;
|
||||
}
|
||||
|
||||
public String getRcvAddress() {
|
||||
return rcvAddress;
|
||||
}
|
||||
|
||||
public void setRcvAddress(String rcvAddress) {
|
||||
this.rcvAddress = rcvAddress;
|
||||
}
|
||||
|
||||
public String getRcvAcc() {
|
||||
return rcvAcc;
|
||||
}
|
||||
|
||||
public void setRcvAcc(String rcvAcc) {
|
||||
this.rcvAcc = rcvAcc;
|
||||
}
|
||||
|
||||
public String getCostPayer() {
|
||||
return costPayer;
|
||||
}
|
||||
|
||||
public void setCostPayer(String costPayer) {
|
||||
this.costPayer = costPayer;
|
||||
}
|
||||
|
||||
public String getCostAcc() {
|
||||
return costAcc;
|
||||
}
|
||||
|
||||
public void setCostAcc(String costAcc) {
|
||||
this.costAcc = costAcc;
|
||||
}
|
||||
|
||||
public String getIsFullPay() {
|
||||
return isFullPay;
|
||||
}
|
||||
|
||||
public void setIsFullPay(String isFullPay) {
|
||||
this.isFullPay = isFullPay;
|
||||
}
|
||||
|
||||
public String getPaymentProp() {
|
||||
return paymentProp;
|
||||
}
|
||||
|
||||
public void setPaymentProp(String paymentProp) {
|
||||
this.paymentProp = paymentProp;
|
||||
}
|
||||
|
||||
public String getContacts() {
|
||||
return contacts;
|
||||
}
|
||||
|
||||
public void setContacts(String contacts) {
|
||||
this.contacts = contacts;
|
||||
}
|
||||
|
||||
public String getContactPhone() {
|
||||
return contactPhone;
|
||||
}
|
||||
|
||||
public void setContactPhone(String contactPhone) {
|
||||
this.contactPhone = contactPhone;
|
||||
}
|
||||
|
||||
public String getPayUnderFreeTax() {
|
||||
return payUnderFreeTax;
|
||||
}
|
||||
|
||||
public void setPayUnderFreeTax(String payUnderFreeTax) {
|
||||
this.payUnderFreeTax = payUnderFreeTax;
|
||||
}
|
||||
|
||||
public String getPostscript() {
|
||||
return postscript;
|
||||
}
|
||||
|
||||
public void setPostscript(String postscript) {
|
||||
this.postscript = postscript;
|
||||
}
|
||||
|
||||
public List<String> getFileUploadCodes() {
|
||||
return fileUploadCodes;
|
||||
}
|
||||
|
||||
public void setFileUploadCodes(List<String> fileUploadCodes) {
|
||||
this.fileUploadCodes = fileUploadCodes;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.hzya.frame.ningboBankTreasury.enums;
|
||||
|
||||
/**
|
||||
* @Description T/T汇款 支付状态枚举
|
||||
* @Author xiangerlin
|
||||
* @Date 2024/8/2 15:42
|
||||
**/
|
||||
public enum TTPayStatusEnum{
|
||||
|
||||
// 成功和失败状态
|
||||
SUCCESS("0", "交易成功"),
|
||||
TRANSACTION_FAILED("2", "交易失败"),
|
||||
TRANSACTION_SENDING("8", "交易发送中"),
|
||||
|
||||
// 审批状态
|
||||
|
||||
APPROVAL_IN_PROGRESS("11-94", "审批中"),
|
||||
APPROVAL_PASSED("95", "审批通过"),
|
||||
APPROVAL_REJECTED_CLOSED("-3", "审批打回,交易关闭"),
|
||||
|
||||
// 其他状态
|
||||
TEMPORARY_STORAGE("7", "暂存"),
|
||||
DELETED("-2", "删除"),
|
||||
BANK_PROCESSING("1", "银行处理中"),
|
||||
APPROVAL_REJECTED("-1", "审批打回");
|
||||
|
||||
// 枚举属性
|
||||
private final String code;
|
||||
private final String description;
|
||||
|
||||
// 枚举构造函数
|
||||
TTPayStatusEnum(String code, String description) {
|
||||
this.code = code;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
// 获取状态码
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
// 获取状态描述
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
// 根据状态码查找枚举
|
||||
public static TTPayStatusEnum fromCode(String code) {
|
||||
for (TTPayStatusEnum status : TTPayStatusEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown code: " + code);
|
||||
}
|
||||
|
||||
public static String getByCode(String code){
|
||||
for (TTPayStatusEnum status : TTPayStatusEnum.values()) {
|
||||
if (status.getCode().equals(code)) {
|
||||
return status.getDescription();
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Unknown code: " + code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为最终态
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static boolean isFinally(String code){
|
||||
return SUCCESS.code.equals(code)
|
||||
|| APPROVAL_REJECTED_CLOSED.code.equals(code)
|
||||
|| DELETED.code.equals(code)
|
||||
|| TRANSACTION_FAILED.code.equals(code);
|
||||
}
|
||||
}
|
|
@ -58,6 +58,7 @@ public class NingboBankTreasuryServiceImpl implements INingboBankTreasuryService
|
|||
}
|
||||
//发送数据
|
||||
try {
|
||||
logger.info("调用宁波银行接口最终参数:{}",dataJson);
|
||||
String returnData = OpenSDK.send(productID,serviceID,dataJson.replace(" ",""));
|
||||
if(returnData == null || "".equals(returnData)){
|
||||
returnJson.put("retCode","9999");
|
||||
|
|
Loading…
Reference in New Issue