修改扩展方法

This commit is contained in:
xiang2lin 2024-05-30 15:13:54 +08:00
parent 8d9c6e3f73
commit e13746b313
1 changed files with 80 additions and 53 deletions

View File

@ -1,5 +1,6 @@
package com.hzya.frame.seeyon.service.impl; package com.hzya.frame.seeyon.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
@ -60,17 +61,15 @@ public class SeeyonExtServiceImpl implements ISeeyonExtService {
} }
//根据forApp组装不同参数 //根据forApp组装不同参数
switch (formApp){ switch (formApp){
case "4728403652378707515":// case "-8691606453890363968"://
hzyaExtData.put("billCode", "cunhuoabc123456"); hzyaExtData.put("billCode", "cunhuoabc123456");
getInventory(businessData,param); getInventory(businessData,param);
break; break;
case "供应商": case "6223456019738676230":
hzyaExtData.put("billCode", ""); getSupplier(businessData,param,hzyaExtData);
getSupplier(businessData,param);
break; break;
case "客户": case "-9122508232154527168":
hzyaExtData.put("billCode", ""); getCustomer(businessData,param,hzyaExtData);
getCustomer(businessData,param);
break; break;
default: default:
param.setBodys("未匹配到表单当前formID"+ formApp); param.setBodys("未匹配到表单当前formID"+ formApp);
@ -93,6 +92,8 @@ public class SeeyonExtServiceImpl implements ISeeyonExtService {
*/ */
@Override @Override
public void ydcSeeyon2u8CallBack(SysMessageManageLogEntity logEntity) { public void ydcSeeyon2u8CallBack(SysMessageManageLogEntity logEntity) {
//在这里记录日志 //在这里记录日志
JSONObject targetData = JSON.parseObject(logEntity.getTargetData());//这个对象里的body是 发送到u8的请求报文 JSONObject targetData = JSON.parseObject(logEntity.getTargetData());//这个对象里的body是 发送到u8的请求报文
JSONObject sourceData = JSON.parseObject(logEntity.getSourceData()); JSONObject sourceData = JSON.parseObject(logEntity.getSourceData());
@ -102,11 +103,25 @@ public class SeeyonExtServiceImpl implements ISeeyonExtService {
JSONArray formMainIds = new JSONArray(); JSONArray formMainIds = new JSONArray();
formMainIds.add(sourceBody.getString("id")); formMainIds.add(sourceBody.getString("id"));
JSONObject param = new JSONObject(); JSONObject param = new JSONObject();
param.put("formAppId",sourceBody.getString("formApp")); String formApp = sourceBody.getString("formApp");
param.put("formAppId",formApp);
param.put("formMainIds",formMainIds); param.put("formMainIds",formMainIds);
param.put("dataSourceCode","ht_oa_sqlserver"); param.put("dataSourceCode","ht_oa_sqlserver");
param.put("eventType",sourceBody.getString("eventType")); param.put("eventType",sourceBody.getString("eventType"));
//把返回的单号更新到oa档案表
String sql = "";
switch (formApp){
case "-8691606453890363968"://存货
sql = "";
break;
case "6223456019738676230"://供应商
sql = "update formmain_0229 set field0002 = '' where field0001 = "+hzyaExtData.getString("billCode");
break;
case "-9122508232154527168"://客户
sql = "update formmain_0230 set field0002 = '' where field0001 = "+hzyaExtData.getString("billCode");
break;
}
IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity(); IntegrationTaskLivingDetailsEntity logDetails = new IntegrationTaskLivingDetailsEntity();
logDetails.setRootAppPk(JSON.toJSONString(param)); logDetails.setRootAppPk(JSON.toJSONString(param));
logDetails.setRootAppBill(hzyaExtData.getString("billCode")); logDetails.setRootAppBill(hzyaExtData.getString("billCode"));
@ -138,76 +153,88 @@ public class SeeyonExtServiceImpl implements ISeeyonExtService {
//存货参数组装 //存货参数组装
private SysExtensionApiEntity getInventory(JSONObject businessData,SysExtensionApiEntity param){ private SysExtensionApiEntity getInventory(JSONObject businessData,SysExtensionApiEntity param){
if (null != businessData){ if (null != businessData){
JSONObject jsonObject = new JSONObject(); JSONObject formmain0227 = businessData.getJSONObject("formmain_0227");
jsonObject.put("Token", "Hzya1314_CheckSkip"); JSONArray formson0228Arr = businessData.getJSONArray("formson_0228");
jsonObject.put("billid", "123"); for (int i=0; i< formson0228Arr.size(); i++){
jsonObject.put("AccId", "005"); JSONObject formson0228 = formson0228Arr.getJSONObject(i);
JSONObject jsonObject = new JSONObject();
jsonObject.put("Token", "Hzya1314_CheckSkip");
jsonObject.put("billid", formson0228.getString("id"));
jsonObject.put("AccId", formmain0227.getString("field0015"));
JSONObject oArchives = new JSONObject(); JSONObject oArchives = new JSONObject();
oArchives.put("cInvCode", "cyp12"); oArchives.put("cInvCode", formson0228.getString("field0002"));
oArchives.put("cInvCCode", "0101"); oArchives.put("cInvCCode", formson0228.getString("field0005"));
oArchives.put("cInvName", "测试"); oArchives.put("cInvName", formson0228.getString("field0003"));
oArchives.put("cGroupCode", "01"); //todo 这个没值
oArchives.put("cComUnitCode", "0101"); oArchives.put("cGroupCode", "01");
oArchives.put("cComUnitCode", formson0228.getString("field0006"));
jsonObject.put("oArchives", oArchives); jsonObject.put("oArchives", oArchives);
param.setBodys(JSON.toJSONString(jsonObject)); param.setBodys(JSON.toJSONString(jsonObject));
}
} }
return param; return param;
} }
//供应商参数组装 //供应商参数组装
private SysExtensionApiEntity getSupplier(JSONObject businessData,SysExtensionApiEntity param){ private SysExtensionApiEntity getSupplier(JSONObject businessData,SysExtensionApiEntity param,JSONObject hzyaExtData){
if (null != businessData){ if (null != businessData){
JSONObject formmain0225 = businessData.getJSONObject("formmain_0225");
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("billid", "123"); jsonObject.put("billid", formmain0225.getString("id"));
jsonObject.put("AccId", "888"); jsonObject.put("AccId", formmain0225.getString("field0020"));
jsonObject.put("Token", U8Util.getToken()); jsonObject.put("Token", U8Util.getToken());
JSONObject oArchives = new JSONObject(); JSONObject oArchives = new JSONObject();
oArchives.put("cVenCode", "0001"); oArchives.put("cVenCode", formmain0225.getString("field0002"));
oArchives.put("cVenName ", "测试0001"); oArchives.put("cVenName ", formmain0225.getString("field0003"));
oArchives.put("cVenAbbName", "测试0001简称"); oArchives.put("cVenAbbName", formmain0225.getString("field0004"));
oArchives.put("cVCCode", "01"); oArchives.put("cVCCode", formmain0225.getString("field0006"));
oArchives.put("cVenExch_name", "人民币"); oArchives.put("cVenExch_name", formmain0225.getString("field0010"));
oArchives.put("bVenTax", "false"); //oArchives.put("bVenTax", "false");
oArchives.put("bLicenceDate", "false"); //oArchives.put("bLicenceDate", "false");
oArchives.put("bBusinessDate", "false"); //oArchives.put("bBusinessDate", "false");
oArchives.put("bProxyDate", "false"); //oArchives.put("bProxyDate", "false");
oArchives.put("bPassGMP", "false"); //oArchives.put("bPassGMP", "false");
oArchives.put("bVenCargo", "false"); //oArchives.put("bVenCargo", "false");
oArchives.put("bProxyForeign", "true"); //oArchives.put("bProxyForeign", "true");
oArchives.put("bVenService", "true"); //oArchives.put("bVenService", "true");
oArchives.put("iVenGSPType", "0"); //oArchives.put("iVenGSPType", "0");
oArchives.put("bVenOverseas", "false"); //oArchives.put("bVenOverseas", "false");
oArchives.put("bVenAccPeriodMng", "false"); //oArchives.put("bVenAccPeriodMng", "false");
oArchives.put("bVenHomeBranch", "false"); //oArchives.put("bVenHomeBranch", "false");
oArchives.put("dVenCreateDatetime", "2023-01-04 10:00"); oArchives.put("dVenCreateDatetime", DateUtil.now());
oArchives.put("cVenRegCode", "税号"); oArchives.put("cVenRegCode", formmain0225.getString("field0009"));
oArchives.put("cVenBank", "开户银行"); oArchives.put("cVenBank", formmain0225.getString("field0011"));
oArchives.put("cVenAccount", "银行账号"); oArchives.put("cVenAccount", formmain0225.getString("field0012"));
jsonObject.put("oArchives", oArchives); jsonObject.put("oArchives", oArchives);
param.setBodys(JSON.toJSONString(jsonObject)); param.setBodys(JSON.toJSONString(jsonObject));
hzyaExtData.put("billCode", formmain0225.getString("field0001"));
hzyaExtData.put("formmainId", formmain0225.getString("id"));
} }
return param; return param;
} }
//客户参数组装 //客户参数组装
private SysExtensionApiEntity getCustomer(JSONObject businessData,SysExtensionApiEntity param){ private SysExtensionApiEntity getCustomer(JSONObject businessData,SysExtensionApiEntity param,JSONObject hzyaExtData){
if (null != businessData){ if (null != businessData){
JSONObject formmain0226 = businessData.getJSONObject("formmain_0226");
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("billid", "123"); jsonObject.put("billid", formmain0226.getString("id"));
jsonObject.put("AccId", "888"); jsonObject.put("AccId", formmain0226.getString("field0025"));
jsonObject.put("Token", "Hzya1314_CheckSkip"); jsonObject.put("Token", "Hzya1314_CheckSkip");
JSONObject oArchives = new JSONObject(); JSONObject oArchives = new JSONObject();
oArchives.put("cCusCode", "0001"); oArchives.put("cCusCode", formmain0226.getString("field0002"));
oArchives.put("cCusName", "测试0001"); oArchives.put("cCusName", formmain0226.getString("field0007"));
oArchives.put("cCusAbbName", "测试0001"); oArchives.put("cCusAbbName", formmain0226.getString("field0008"));
oArchives.put("cCCCode", "01"); oArchives.put("cCCCode", formmain0226.getString("field0012"));
oArchives.put("cCusExch_name", "人民币"); oArchives.put("cCusExch_name", formmain0226.getString("field0013"));
// todo 这个字段没值
oArchives.put("cCusMngTypeCode", "999"); oArchives.put("cCusMngTypeCode", "999");
jsonObject.put("oArchives", oArchives); jsonObject.put("oArchives", oArchives);
param.setBodys(JSON.toJSONString(jsonObject)); param.setBodys(JSON.toJSONString(jsonObject));
hzyaExtData.put("billCode",formmain0226.getString("field0001"));
hzyaExtData.put("formmainId",formmain0226.getString("id"));
} }
return param; return param;
} }