【泛微接口】快递单号接口,付款状态接口
This commit is contained in:
parent
c3dfe086fb
commit
ff8187becf
|
|
@ -1,12 +1,102 @@
|
||||||
package tqq9.lc123.cloud.app.plugin.operate.cas;
|
package tqq9.lc123.cloud.app.plugin.operate.cas;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.HttpURLConnection;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款单付款状态回传泛微kd.bos.form.plugin.bdctrl.AssignQueryPluginNew
|
||||||
|
*/
|
||||||
public class PaymentbillPushPaystateOp extends AbstractOperationServicePlugIn {
|
public class PaymentbillPushPaystateOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
super.afterExecuteOperationTransaction(e);
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
for (DynamicObject dataEntity : dataEntities) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(), dataEntity.getDynamicObjectType().getName());
|
||||||
|
String tqq9_fwrequestid = dataEntity.getString("tqq9_fwrequestid");//泛微流程ID
|
||||||
|
if(StringUtils.isNotBlank(tqq9_fwrequestid)){
|
||||||
|
Date paydate = dataEntity.getDate("paydate");//付款日期
|
||||||
|
String jyrq = sdf.format(paydate);
|
||||||
|
String jyzy = dataEntity.getString("description");//摘要
|
||||||
|
String tqq9_cwztfkzt = dataEntity.getString("tqq9_cwztfkzt");//财务中台付款状态
|
||||||
|
|
||||||
|
// [0:中台接收成功,
|
||||||
|
// 1:中台接收失败,
|
||||||
|
// 2:发送E企明成功,
|
||||||
|
// 3:发送E企明失败,
|
||||||
|
// 4:交易成功:E企明付款成功, 交易成功:E企明付款成功。-D
|
||||||
|
// 5:交易失败:E企明付款失败, 交易失败:E企明付款失败。-F
|
||||||
|
// 6:交易处理中:E企明付款处理中, 交易处理中:E企明付款处理中。-E
|
||||||
|
// 7:交易退回:E企明付款被退回] 交易退回:E企明付款被退回。-G
|
||||||
|
String fkzt = null;
|
||||||
|
if("D".equals(tqq9_cwztfkzt)){
|
||||||
|
fkzt = "4";
|
||||||
|
}else if("F".equals(tqq9_cwztfkzt)){
|
||||||
|
fkzt = "5";
|
||||||
|
}else if("E".equals(tqq9_cwztfkzt)){
|
||||||
|
fkzt = "6";
|
||||||
|
}else if("G".equals(tqq9_cwztfkzt)){
|
||||||
|
fkzt = "7";
|
||||||
|
}
|
||||||
|
String tqq9_dzhdbh = dataEntity.getString("tqq9_dzhdbh");//电子回单编号
|
||||||
|
String tqq9_digital_receipt = dataEntity.getString("tqq9_digital_receipt");//电子回单编号
|
||||||
|
String filename = "";
|
||||||
|
try {
|
||||||
|
URL url = new URL(tqq9_digital_receipt);
|
||||||
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
// 尝试从响应头获取
|
||||||
|
String disposition = conn.getHeaderField("Content-Disposition");
|
||||||
|
if (disposition != null && disposition.contains("filename=")) {
|
||||||
|
filename = disposition.split("filename=")[1].replace("\"", "").trim();
|
||||||
|
}
|
||||||
|
} catch (MalformedURLException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new RuntimeException(ex);
|
||||||
|
}
|
||||||
|
if(StringUtils.isBlank(filename)){
|
||||||
|
filename = "银行电子回单"+new Date().getTime()+".pdf";
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject mainTable = new JSONObject();
|
||||||
|
mainTable.put("lcid", tqq9_fwrequestid);
|
||||||
|
mainTable.put("fkzt", fkzt);
|
||||||
|
mainTable.put("dzhdwjbh", tqq9_dzhdbh);
|
||||||
|
mainTable.put("jyrq", jyrq);
|
||||||
|
mainTable.put("jyzy", jyzy);
|
||||||
|
JSONArray files = new JSONArray();
|
||||||
|
JSONObject file = new JSONObject();
|
||||||
|
file.put("name", filename);
|
||||||
|
file.put("content", tqq9_digital_receipt);
|
||||||
|
files.add(file);
|
||||||
|
mainTable.put("dzhdwj", files);
|
||||||
|
|
||||||
|
String billno = dataEntity.getString("billno");
|
||||||
|
DynamicObject creator = dataEntity.getDynamicObject("creator");
|
||||||
|
creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),"bos_user");
|
||||||
|
String tqq9_fwuserid = creator.getString("tqq9_fwuserid");
|
||||||
|
|
||||||
|
FWRestfulUtils fwRestfulUtils = new FWRestfulUtils();
|
||||||
|
fwRestfulUtils.pushData(mainTable, tqq9_fwuserid, billno, "cas_paybill");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@ public class OtherOutPushExprnoOp extends AbstractOperationServicePlugIn {
|
||||||
|
|
||||||
String billno = dataEntity.getString("billno");
|
String billno = dataEntity.getString("billno");
|
||||||
String tqq9_fwrequestid = dataEntity.getString("tqq9_fwrequestid");
|
String tqq9_fwrequestid = dataEntity.getString("tqq9_fwrequestid");
|
||||||
|
if(StringUtils.isNotBlank(tqq9_fwrequestid)){
|
||||||
JSONObject mainTable = new JSONObject();
|
JSONObject mainTable = new JSONObject();
|
||||||
mainTable.put("lcid", tqq9_fwrequestid);
|
mainTable.put("lcid", tqq9_fwrequestid);
|
||||||
mainTable.put("kddh", kddh);
|
mainTable.put("kddh", kddh);
|
||||||
|
|
@ -48,4 +49,6 @@ public class OtherOutPushExprnoOp extends AbstractOperationServicePlugIn {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -531,7 +531,7 @@ public class FWImpl {
|
||||||
String filePath = (String) attachment.get("url");
|
String filePath = (String) attachment.get("url");
|
||||||
String fileName = (String) attachment.get("name");
|
String fileName = (String) attachment.get("name");
|
||||||
byte[] bytes = HttpUtil.downloadBytes(filePath);
|
byte[] bytes = HttpUtil.downloadBytes(filePath);
|
||||||
String str = "base64:" + cn.hutool.core.codec.Base64.encode(bytes);
|
String str = cn.hutool.core.codec.Base64.encode(bytes);//"base64:" +
|
||||||
JSONObject fj = new JSONObject();
|
JSONObject fj = new JSONObject();
|
||||||
fj.put("content", str);
|
fj.put("content", str);
|
||||||
fj.put("name", fileName);
|
fj.put("name", fileName);
|
||||||
|
|
@ -3901,7 +3901,6 @@ public class FWImpl {
|
||||||
String orgNumber = org.getString("number");
|
String orgNumber = org.getString("number");
|
||||||
String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);//业务归属
|
String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);//业务归属
|
||||||
|
|
||||||
String kczz = ywgz;//库存组织
|
|
||||||
String djlx = null;//单据类型
|
String djlx = null;//单据类型
|
||||||
DynamicObject billtype = bill.getDynamicObject("billtype");//单据类型
|
DynamicObject billtype = bill.getDynamicObject("billtype");//单据类型
|
||||||
if (null != billtype) {
|
if (null != billtype) {
|
||||||
|
|
@ -4131,7 +4130,7 @@ public class FWImpl {
|
||||||
m6.put("fieldValue", ywgz);
|
m6.put("fieldValue", ywgz);
|
||||||
JSONObject m7 = new JSONObject();//
|
JSONObject m7 = new JSONObject();//
|
||||||
m7.put("fieldName", "kczz");
|
m7.put("fieldName", "kczz");
|
||||||
m7.put("fieldValue", kczz);
|
m7.put("fieldValue", ywgz);
|
||||||
JSONObject m8 = new JSONObject();//
|
JSONObject m8 = new JSONObject();//
|
||||||
m8.put("fieldName", "djlx");
|
m8.put("fieldName", "djlx");
|
||||||
m8.put("fieldValue", djlx);
|
m8.put("fieldValue", djlx);
|
||||||
|
|
@ -5358,24 +5357,24 @@ public class FWImpl {
|
||||||
}else if ("5".equals(materialtype)){
|
}else if ("5".equals(materialtype)){
|
||||||
wllx = "特征件";
|
wllx = "特征件";
|
||||||
}
|
}
|
||||||
String ywzx = "";
|
String ywzxdx = "";
|
||||||
DynamicObjectCollection serviceattribute = bill.getDynamicObjectCollection("serviceattribute");
|
DynamicObjectCollection serviceattribute = bill.getDynamicObjectCollection("serviceattribute");
|
||||||
for (DynamicObject attribute : serviceattribute) {
|
for (DynamicObject attribute : serviceattribute) {
|
||||||
long id = attribute.getLong("fbasedataid.id");
|
long id = attribute.getLong("fbasedataid.id");
|
||||||
attribute = BusinessDataServiceHelper.loadSingle(id, "bd_serviceattribute", "id,name,number,operatorid");
|
attribute = BusinessDataServiceHelper.loadSingle(id, "bd_serviceattribute", "id,name,number,operatorid");
|
||||||
String number = attribute.getString("number");
|
String number = attribute.getString("number");
|
||||||
if(number.contains("1001")){
|
if(number.contains("1001")){
|
||||||
ywzx = ywzx + ",0";
|
ywzxdx = ywzxdx + ",0";
|
||||||
}else if (number.equals("2001")){
|
}else if (number.equals("2001")){
|
||||||
ywzx = ywzx + ",1";
|
ywzxdx = ywzxdx + ",1";
|
||||||
}else if (number.equals("2002")){
|
}else if (number.equals("2002")){
|
||||||
ywzx = ywzx + ",2";
|
ywzxdx = ywzxdx + ",2";
|
||||||
}else if (number.equals("2003")){
|
}else if (number.equals("2003")){
|
||||||
ywzx = ywzx + ",3";
|
ywzxdx = ywzxdx + ",3";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(StringUtils.isNotBlank(ywzx)){
|
if(StringUtils.isNotBlank(ywzxdx)){
|
||||||
ywzx = ywzx.substring(1);
|
ywzxdx = ywzxdx.substring(1);
|
||||||
}
|
}
|
||||||
String ym = bill.getString("tqq9_ym");
|
String ym = bill.getString("tqq9_ym");
|
||||||
String ssbm = null;
|
String ssbm = null;
|
||||||
|
|
@ -5502,8 +5501,8 @@ public class FWImpl {
|
||||||
m27.put("fieldName", "wllx");
|
m27.put("fieldName", "wllx");
|
||||||
m27.put("fieldValue", wllx);
|
m27.put("fieldValue", wllx);
|
||||||
JSONObject m28 = new JSONObject();
|
JSONObject m28 = new JSONObject();
|
||||||
m28.put("fieldName", "ywzx");
|
m28.put("fieldName", "ywzxdx");
|
||||||
m28.put("fieldValue", ywzx);
|
m28.put("fieldValue", ywzxdx);
|
||||||
JSONObject m29 = new JSONObject();
|
JSONObject m29 = new JSONObject();
|
||||||
m29.put("fieldName", "ym");
|
m29.put("fieldName", "ym");
|
||||||
m29.put("fieldValue", ym);
|
m29.put("fieldValue", ym);
|
||||||
|
|
|
||||||
|
|
@ -80,8 +80,11 @@ public class FWRestfulUtils {
|
||||||
requestName = "推送仓库信息";
|
requestName = "推送仓库信息";
|
||||||
ourl = "api/cube/restful/interface/saveOrUpdateModeData/CK";
|
ourl = "api/cube/restful/interface/saveOrUpdateModeData/CK";
|
||||||
}else if("im_otheroutbill".equals(entityName)){
|
}else if("im_otheroutbill".equals(entityName)){
|
||||||
requestName = "推送快递单号信息";
|
requestName = "快递单号回传";
|
||||||
ourl = "api/cube/restful/interface/saveOrUpdateModeData/KDDHCX";
|
ourl = "api/cube/restful/interface/saveOrUpdateModeData/KDDHCX";
|
||||||
|
}else if("cas_paybill".equals(entityName)){
|
||||||
|
requestName = "付款状态回传";
|
||||||
|
ourl = "api/cube/restful/interface/saveOrUpdateModeData/FKZTHC";
|
||||||
}
|
}
|
||||||
System.out.println("===请求参数dataparam==="+dataParam);
|
System.out.println("===请求参数dataparam==="+dataParam);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue