堃博OA对接宁波银行
This commit is contained in:
parent
5202887be0
commit
35ea37fbfc
|
@ -94,9 +94,9 @@
|
|||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>kunb</id> <!--堃博-->
|
||||
<id>dongj</id> <!--东进-->
|
||||
<properties>
|
||||
<profile.active>kunb</profile.active>
|
||||
<profile.active>dongj</profile.active>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
|
|
@ -1,20 +1,24 @@
|
|||
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.util.NingBBankUtil;
|
||||
import com.hzya.frame.seeyon.paybill.service.IPayBillService;
|
||||
import com.hzya.frame.sysnew.integtationTaskLivingDetails.entity.IntegrationTaskLivingDetailsEntity;
|
||||
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 java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 堃博OA单据推送宁波银行
|
||||
|
@ -57,7 +61,105 @@ public class KunBNingBBankPluginInitializer extends PluginBaseEntity{
|
|||
}
|
||||
@Override
|
||||
public JsonResultEntity executeBusiness(JSONObject requestJson) {
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
String dataSourceCode = "KUNBOA";
|
||||
oaBillEntity.setDataSourceCode(dataSourceCode);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select field0001 as serialNo,field0031 as corpCode,field0012 as rcvAcc,'' as rcvBankName,field0030 as payAcc,field0032 as rcvBankNo,field0012 as rcvName,field0033 as purpose,field0008 as amt,'field0034' as fieldName,'formmain_0020' as tableName, as field0036 payMsg from formmain_0020 where field0034 = '1' and field0012 is not null and field0030 is not null");
|
||||
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 payMsg = main.getString("payMsg");
|
||||
try {
|
||||
|
||||
logger.info("获取到付款单状态的数据"+main.toString());
|
||||
String apiCode = "8000310001";
|
||||
JSONObject reMain = new JSONObject();
|
||||
reMain.put("serialNo",main.getString("serialNo"));
|
||||
String result = NingBBankUtil.sendU9cTOCrmEsb(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 = data.getJSONObject("transferDtl");
|
||||
String status = transferDtl.getString("status");
|
||||
|
||||
// if(1==1){
|
||||
// status = "0";
|
||||
// }
|
||||
String msg = formatStatus(status);
|
||||
if(StrUtil.isEmpty(msg)){
|
||||
msg ="未知交易状态,请联系管理员查证";
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
sb.append(" , "+fieldName+" = '2'");
|
||||
}
|
||||
sb.append(" set "+payMsg+" = '"+msg+"'");
|
||||
if(status.equals("0")||status.equals("-2")||status.equals("-3")||status.equals("2")||status.equals("4")||status.equals("5")||status.equals("6")||status.equals("96")||status.equals("112")){
|
||||
sb.append(" , "+fieldName+" = '0'");
|
||||
}
|
||||
}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();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new JsonResultEntity("成功",true,new JsonResultEntity());
|
||||
}
|
||||
|
||||
public String formatStatus(String status){
|
||||
|
||||
Map<String,String> statusMap = new HashMap<>();
|
||||
statusMap.put("0","交易成功");
|
||||
statusMap.put("-2","已删除");
|
||||
statusMap.put("-3","审批打回交易关闭");
|
||||
statusMap.put("2","交易失败");
|
||||
statusMap.put("4","交易失败,资金下拨失败");
|
||||
statusMap.put("5","联动支付失败,资金退回成功");
|
||||
statusMap.put("6","联动支付失败,资金退回查证中、");
|
||||
statusMap.put("96","联动支付失败,资金退回失败");
|
||||
statusMap.put("112","请款失败");
|
||||
statusMap.put("-1","驳回");
|
||||
statusMap.put("1","交易待查证");
|
||||
statusMap.put("3","待发送");
|
||||
statusMap.put("95","审批通过");
|
||||
statusMap.put("7","暂存");
|
||||
statusMap.put("-4","经办撤回");
|
||||
statusMap.put("111","请款查证中");
|
||||
statusMap.put("113","请款成功,交易待发送");
|
||||
statusMap.put("114","联动支付成功,智能支付交易待发送");
|
||||
if(Long.valueOf(status)>=11 && Long.valueOf(status) <=94){
|
||||
return "待审批";
|
||||
}
|
||||
return statusMap.get(status);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ public class KunBPayBillPluginInitializer extends PluginBaseEntity{
|
|||
|
||||
@Override
|
||||
public String getPluginName() {
|
||||
return "KunBPayBillPluginInitializer插件";
|
||||
return "堃博OA付款单同步宁波银行";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -76,7 +76,7 @@ public class KunBPayBillPluginInitializer extends PluginBaseEntity{
|
|||
|
||||
try {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(null != requestJson && StrUtil.isNotEmpty(requestJson.getString("code"))){
|
||||
if(StrUtil.isNotEmpty(rootAppPk)){
|
||||
String code = requestJson.getString("code");
|
||||
sb.append(" and id = '"+rootAppPk+"'");
|
||||
}else{
|
||||
|
@ -84,30 +84,12 @@ public class KunBPayBillPluginInitializer extends PluginBaseEntity{
|
|||
}
|
||||
|
||||
PayBillEntity oaBillEntity = new PayBillEntity();
|
||||
String dataSourceCode = requestJson.getString("sourceCode");
|
||||
String dataSourceCode = "KUNBOA";
|
||||
oaBillEntity.setDataSourceCode(dataSourceCode);
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
stringBuffer.append("select \n" +
|
||||
"id as id,\n" +
|
||||
"serialno as serialNo,\n" +
|
||||
"corpcode as corpCode,\n" +
|
||||
"payacc as payAcc,\n" +
|
||||
"rcvacc as rcvAcc,\n" +
|
||||
"rcvbankname as rcvBankName,\n" +
|
||||
"rcvbankno as rcvBankNo,\n" +
|
||||
"rcvname as rcvName,\n" +
|
||||
"purpose as purpose,\n" +
|
||||
"remark as remark,\n" +
|
||||
"issubscribe as isSubscribe,\n" +
|
||||
"difbank as difBank,\n" +
|
||||
"areasign as areaSign,\n" +
|
||||
"amt as amt,\n" +
|
||||
"'subState' as fieldName,\n" +
|
||||
"'formmain_bank' as tableName,\n" +
|
||||
"amt as amt,\n" +
|
||||
"wishpaytime as wishPayTime,\n" +
|
||||
"isforindividual as isForIndividual\n" +
|
||||
"from formmain_bank where 1=1 " );
|
||||
|
||||
//备用金申请单
|
||||
stringBuffer.append("select * from v_hzya_pay" );
|
||||
stringBuffer.append(sb.toString());
|
||||
List<HashMap<String, Object>> hashMaps = payBillDao.getOaBillData(stringBuffer.toString(),oaBillEntity);
|
||||
if(CollectionUtils.isNotEmpty(hashMaps)){
|
||||
|
@ -133,27 +115,32 @@ public class KunBPayBillPluginInitializer extends PluginBaseEntity{
|
|||
String subState = "";
|
||||
String fieldName = main.getString("fieldName");
|
||||
String tableName = main.getString("tableName");
|
||||
String payMsg = main.getString("payMsg");
|
||||
String str = "";
|
||||
String sync_flag = "";
|
||||
try {
|
||||
if(StrUtil.isEmpty(interId)){
|
||||
if(StrUtil.isEmpty(interId)){//todo 银行状态 1支付中 2 支付失败 null 未提交支付 0支付成功
|
||||
if(flag){
|
||||
subState = "Y";
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "N";
|
||||
subState = "2";
|
||||
taskLivingDetailsService.saveLogToFail(logDetails);
|
||||
}
|
||||
}else{
|
||||
logDetails.setId(interId);
|
||||
if(flag){
|
||||
subState = "Y";
|
||||
subState = "1";
|
||||
sync_flag = " ,"+payMsg+" = '支付中'";
|
||||
taskLivingDetailsService.saveLogFailToSuccess(logDetails);
|
||||
}else{
|
||||
subState = "N";
|
||||
subState = "2";
|
||||
taskLivingDetailsService.updateLogFailToSuccess(logDetails);
|
||||
}
|
||||
}
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'," +"subMsg = '"+attribute+"'"+"where id = '"+main.getString("id")+"'";
|
||||
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'," +"subMsg = '"+attribute+"'"+sync_flag+"where id = '"+main.getString("id")+"'";
|
||||
} catch (Exception e) {
|
||||
subState = "N";
|
||||
str = "update "+tableName+" set " + fieldName + "= '" +subState+"'," +"subMsg = '"+attribute+"' "+"where id = '"+main.getString("id")+"'";
|
||||
|
|
Loading…
Reference in New Issue