用友付款查询接口联调优化,增加付款单id保存和查询

This commit is contained in:
yuxueliang0813 2024-10-23 16:05:33 +08:00
parent 5fd0fff048
commit c4a15a6a05
3 changed files with 21 additions and 16 deletions

View File

@ -393,6 +393,7 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
.header("client_id", DobeDWUtils.clientid) .header("client_id", DobeDWUtils.clientid)
.build(); .build();
String yynum = null;//用友单据编号 String yynum = null;//用友单据编号
String yyid = null;//用友单据id
JSONObject json_reuslt = null; JSONObject json_reuslt = null;
try { try {
Response response = client.newCall(request).execute(); Response response = client.newCall(request).execute();
@ -404,6 +405,7 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
return false; return false;
}else{ }else{
yynum = json_reuslt.getJSONObject("data").getString("billno"); yynum = json_reuslt.getJSONObject("data").getString("billno");
yyid = json_reuslt.getJSONObject("data").getString("pk_bill");
} }
} catch (Exception e) { } catch (Exception e) {
log.error(String.format("用友付款接口异常:%s", e.getMessage())); log.error(String.format("用友付款接口异常:%s", e.getMessage()));
@ -416,19 +418,20 @@ public class YongyouBIPOperation extends AbstractOperationServicePlugIn implemen
DobeDWUtils.saveLog(payrequestinfo.getString("billno"),"用友BIP",payData.toString(),"用友billno为空"+json_reuslt.toString(),false,eventName); DobeDWUtils.saveLog(payrequestinfo.getString("billno"),"用友BIP",payData.toString(),"用友billno为空"+json_reuslt.toString(),false,eventName);
return false; return false;
}else{ }else{
//审核推送用友bip成功后反写费用登记和合同付款申请单的用友付款单id字段值并清空红冲单据编号字段 //审核推送用友bip成功后反写费用登记和合同付款申请单的用友付款单编号和id字段值并清空红冲单据编号字段
String sql = "UPDATE t_recon_payreqbill SET fk_qeug_yynum=?,fk_qeug_yyhc=? WHERE fid=?;"; String sql = "UPDATE t_recon_payreqbill SET fk_qeug_yynum=?,fk_qeug_yyhc=?,fk_qeug_yyid=? WHERE fid=?;";
if(isnotext){ if(isnotext){
sql = "UPDATE t_recon_connotextbill SET fk_qeug_yynum=?,fk_qeug_yyhc=? WHERE fid=?;"; sql = "UPDATE t_recon_connotextbill SET fk_qeug_yynum=?,fk_qeug_yyhc=?,fk_qeug_yyid=? WHERE fid=?;";
} }
if("unaudit".equals(eventName)){ if("unaudit".equals(eventName)){
//如果是反审核推送bip成功后反写红冲单据编号字段并清空bip单据编号 //如果是反审核推送bip成功后反写红冲单据编号字段并清空bip单据编号和id
sql = "UPDATE t_recon_payreqbill SET fk_qeug_yyhc=?,fk_qeug_yynum=? WHERE fid=?;"; sql = "UPDATE t_recon_payreqbill SET fk_qeug_yyhc=?,fk_qeug_yynum=?,fk_qeug_yyid=? WHERE fid=?;";
if(isnotext){ if(isnotext){
sql = "UPDATE t_recon_connotextbill SET fk_qeug_yyhc=?,fk_qeug_yynum=? WHERE fid=?;"; sql = "UPDATE t_recon_connotextbill SET fk_qeug_yyhc=?,fk_qeug_yynum=?,fk_qeug_yyid=? WHERE fid=?;";
} }
yyid = "";
} }
DB.update(DBRoute.of("scm"), sql, new Object[]{yynum,"",payrequestinfo.getLong("id")}); DB.update(DBRoute.of("scm"), sql, new Object[]{yynum,"",yyid,payrequestinfo.getLong("id")});
DobeDWUtils.saveLog(payrequestinfo.getString("billno"),"用友BIP",payData.toString(),json_reuslt.toString(),true,eventName); DobeDWUtils.saveLog(payrequestinfo.getString("billno"),"用友BIP",payData.toString(),json_reuslt.toString(),true,eventName);
return true; return true;
} }

View File

@ -59,10 +59,11 @@ public class YongyouBIPTask extends AbstractTask implements Plugin {
//将满足本次查询条件的单子存入map中 //将满足本次查询条件的单子存入map中
DynamicObject prinfo = null; DynamicObject prinfo = null;
DynamicObject requestinfo = null; DynamicObject requestinfo = null;
String yynum = null; String yyid = null;
JSONObject idjson = null; JSONObject idjson = null;
JSONArray idarray = new JSONArray(); JSONArray idarray = new JSONArray();
Map<String,DynamicObject> billMap = new HashMap(); Map<String,DynamicObject> billMap = new HashMap();
Map<String,String> billNumberMap = new HashMap();
for (int i = 0; i < prs.length; i++) { for (int i = 0; i < prs.length; i++) {
prinfo = BusinessDataServiceHelper.loadSingle(prs[i].getPkValue(),payregisterEntity); prinfo = BusinessDataServiceHelper.loadSingle(prs[i].getPkValue(),payregisterEntity);
//费用登记 //费用登记
@ -73,14 +74,15 @@ public class YongyouBIPTask extends AbstractTask implements Plugin {
} }
requestinfo = BusinessDataServiceHelper.loadSingle(requestinfo.getPkValue(),requestinfo.getDataEntityType().getName()); requestinfo = BusinessDataServiceHelper.loadSingle(requestinfo.getPkValue(),requestinfo.getDataEntityType().getName());
//看用友的实付款查询接口是一个个查询还是集中查询;这个字段直接从F7实体对象中获取不到需要扩展F7实体 //看用友的实付款查询接口是一个个查询还是集中查询;这个字段直接从F7实体对象中获取不到需要扩展F7实体
yynum = requestinfo.getString("qeug_yynum"); yyid = requestinfo.getString("qeug_yyid");
//获取到的yynum为空则不进行实付查询 //获取到的yynum为空则不进行实付查询
if(DobeDWUtils.isEmpty(yynum)){ if(DobeDWUtils.isEmpty(yyid)){
continue; continue;
} }
billMap.put(yynum,prinfo); billMap.put(yyid,prinfo);
billNumberMap.put(yyid,requestinfo.getString("qeug_yynum"));
idjson = new JSONObject(); idjson = new JSONObject();
idjson.put("id",yynum); idjson.put("id",yyid);
idarray.add(idjson); idarray.add(idjson);
} }
if(billMap.isEmpty()){ if(billMap.isEmpty()){
@ -132,11 +134,11 @@ public class YongyouBIPTask extends AbstractTask implements Plugin {
JSONArray dataArray = resultData.getJSONArray("data"); JSONArray dataArray = resultData.getJSONArray("data");
for (int i = 0; i < dataArray.size(); i++) { for (int i = 0; i < dataArray.size(); i++) {
idjson = dataArray.getJSONObject(i); idjson = dataArray.getJSONObject(i);
yynum = idjson.getJSONObject("parentVO").getString("pk_settle"); yyid = idjson.getJSONObject("parentVO").getString("pk_busi");
prinfo = billMap.get(yynum); prinfo = billMap.get(yyid);
if(prinfo != null){ if(prinfo != null){
prinfo.set("bizdate",idjson.getJSONObject("parentVO").getDate("settleDate")); prinfo.set("bizdate",idjson.getJSONObject("parentVO").getDate("settleDate"));
prinfo.set("billno",yynum); prinfo.set("billno",billNumberMap.get(yyid));
prinfo.set("billstatus","B"); //单据状态改为已提交 prinfo.set("billstatus","B"); //单据状态改为已提交
SaveServiceHelper.update(prinfo);//保存上述设置内容 SaveServiceHelper.update(prinfo);//保存上述设置内容
//调用付款登记单的审核方法 //调用付款登记单的审核方法

View File

@ -39,7 +39,7 @@ public class DobeDWUtils {
//用友付款单新增接口 //用友付款单新增接口
public static final String payUrl = "http://106.14.25.83:9999/nccloud/api/arap/paybill/insertandcommit"; public static final String payUrl = "http://106.14.25.83:9999/nccloud/api/arap/paybill/insertandcommit";
//付款金额查询接口 //付款金额查询接口
public static final String payQueryUrl = "http://106.14.25.83:8090/nccloud/api/sp/spPaybillQuery/querySettleStatus"; public static final String payQueryUrl = "http://106.14.25.83:9999/nccloud/api/sp/spPaybillQuery/querySettleStatus";
private static final String jklogEntityName = "qeug_recon_jklog"; private static final String jklogEntityName = "qeug_recon_jklog";