1.ut优化
2.推送费控字段确认,以及成功返回方式 3.锁定解锁接口id有校验,字段确认, 4.凭证查询接口字段确认 5.源单是费控,不允许拆分和合并(依据) 6.接口返回值 --s
This commit is contained in:
parent
8243c926be
commit
53ed962faa
|
|
@ -0,0 +1,55 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.form;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
|
import kd.bos.form.operate.FormOperate;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.bos.util.StringUtils;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排程处理单
|
||||||
|
* shjh_psd_schebillcalc_ext
|
||||||
|
*/
|
||||||
|
public class PsdSchebillFormPlugin extends AbstractFormPlugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeDoOperation(BeforeDoOperationEventArgs args) {
|
||||||
|
super.beforeDoOperation(args);
|
||||||
|
FormOperate source = (FormOperate) args.getSource();
|
||||||
|
String operateKey = source.getOperateKey();
|
||||||
|
switch (operateKey) {
|
||||||
|
case "autocombine":// 自动合并
|
||||||
|
case "split":// 拆分
|
||||||
|
case "combine":/// 合并
|
||||||
|
case "cancelcombine":/// 取消合并
|
||||||
|
//付款排程增加校验,源单是费控,不允许拆分和合并
|
||||||
|
DynamicObjectCollection entryentity = this.getModel().getEntryEntity("entryentity");//逐笔排程_单据体
|
||||||
|
if (!entryentity.isEmpty()) {
|
||||||
|
for (DynamicObject dynamicObject : entryentity) {
|
||||||
|
String e_billno = dynamicObject.getString("e_billno");
|
||||||
|
if (StringUtils.isNotEmpty(e_billno)) {
|
||||||
|
//付款排程单
|
||||||
|
DynamicObject schedulebill = BusinessDataServiceHelper.loadSingle("psd_schedulebill",
|
||||||
|
new QFilter("billno", QCP.equals, e_billno).toArray());
|
||||||
|
if (null != schedulebill) {
|
||||||
|
String fkbillid = schedulebill.getString("shjh_fkbillid");//费控表头ID
|
||||||
|
if (StringUtils.isNotEmpty(fkbillid)) {
|
||||||
|
this.getView().showErrorNotification("源单是费控,不允许拆分和合并!");
|
||||||
|
args.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -105,7 +105,10 @@ public class SappzFormPlugin extends AbstractFormPlugin {
|
||||||
if (null != data && data.containsKey("IT_ITEM")) {
|
if (null != data && data.containsKey("IT_ITEM")) {
|
||||||
JSONArray IT_ITEMs = (JSONArray) data.get("IT_ITEM");
|
JSONArray IT_ITEMs = (JSONArray) data.get("IT_ITEM");
|
||||||
if (!IT_ITEMs.isEmpty()) {
|
if (!IT_ITEMs.isEmpty()) {
|
||||||
// for (int i = 0; i <5000; i++) {
|
// int size = IT_ITEMs.size();
|
||||||
|
// if (IT_ITEMs.size() > 5000) {
|
||||||
|
// size = 5000;
|
||||||
|
// }
|
||||||
for (int i = 0; i < IT_ITEMs.size(); i++) {
|
for (int i = 0; i < IT_ITEMs.size(); i++) {
|
||||||
JSONObject it_list = (JSONObject)IT_ITEMs.get(i);
|
JSONObject it_list = (JSONObject)IT_ITEMs.get(i);
|
||||||
DynamicObject add = shjhEntryentity.addNew();
|
DynamicObject add = shjhEntryentity.addNew();
|
||||||
|
|
|
||||||
|
|
@ -68,5 +68,6 @@ public class SchebillcalcFormPlugin extends AbstractFormPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//todo:增加校验,源单类型是费控的,不允许拆分;不允许合并
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,72 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.sap.db.jdbc.packet.ErrorLevel;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.BeforeOperationArgs;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import static shjh.jhzj7.fi.fi.utils.SapUtils.unlocked_status;
|
||||||
|
|
||||||
|
public class PayApplyDeleteOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void beforeExecuteOperationTransaction(BeforeOperationArgs e) {
|
||||||
|
super.beforeExecuteOperationTransaction(e);
|
||||||
|
|
||||||
|
String operationKey = e.getOperationKey();
|
||||||
|
if ("delete".equals(operationKey)) {
|
||||||
|
//提交失败调取删除,删除判断单据状态暂存、来源系统sap、已锁定 才可以执行删除逻辑-->调解锁接口
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
for (DynamicObject bill : dataEntities) {
|
||||||
|
String billstatus = bill.getString("billstatus");//获取单据状态:暂存A
|
||||||
|
String sourcesystem = bill.getString("shjh_sourcesystem");//来源系统:SAP_A
|
||||||
|
boolean shjhSapwhetherlocking = bill.getBoolean("shjh_sapwhetherlocking");//SAP是否锁定:锁定
|
||||||
|
if ("A".equals(billstatus) && "A".equals(sourcesystem)) {
|
||||||
|
if (!shjhSapwhetherlocking) {
|
||||||
|
e.setCancel(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//调解锁接口
|
||||||
|
JSONArray IT_INPUT = new JSONArray();
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
String FM_CompanyCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("openorg")) {
|
||||||
|
FM_CompanyCode = bill.getDynamicObject("openorg").getString("number");//公司编码_申请付款组织
|
||||||
|
}
|
||||||
|
jsonObject.put("bukrs",FM_CompanyCode);//公司代码_申请付款组织
|
||||||
|
jsonObject.put("belnr", bill.getString("shjh_vouchernum"));//会计凭证编号_SAP应付凭证号
|
||||||
|
jsonObject.put("gjahr", bill.getString("shjh_voucheryear"));//会计年度_SAP应付凭证会计年度
|
||||||
|
jsonObject.put("stasus", "02");//状态 01:锁定,02:解锁,03:关闭,04:退单:05:作废
|
||||||
|
String cname = "";
|
||||||
|
if (null!= bill.getDynamicObject("creator")) {
|
||||||
|
cname = bill.getDynamicObject("creator").getString("number");//创建人,工号_申请人
|
||||||
|
}
|
||||||
|
jsonObject.put("cname", cname);//创建人,工号
|
||||||
|
jsonObject.put("zjddjid", ""+bill.getPkValue());//金蝶单据ID
|
||||||
|
jsonObject.put("zjddjbh", bill.getString("billno"));//金蝶单据编号
|
||||||
|
IT_INPUT.add(jsonObject);
|
||||||
|
|
||||||
|
JSONObject jsonObjects = unlocked_status(IT_INPUT,bill.getString("billno"));
|
||||||
|
String code = (String)jsonObjects.get("code");
|
||||||
|
if (!"0".equals(code)) {
|
||||||
|
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
|
||||||
|
operateErrorInfo.setMessage("付款申请单:"+bill.getString("billno")+"状态解锁失败:" + jsonObject.get("msg"));
|
||||||
|
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());
|
||||||
|
operateErrorInfo.setPkValue(bill.getPkValue());
|
||||||
|
this.operationResult.addErrorInfo(operateErrorInfo);
|
||||||
|
e.setCancel(true);
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
this.operationResult.addSuccessPkId(bill.getPkValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,66 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.sap.db.jdbc.packet.ErrorLevel;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
|
||||||
|
import static shjh.jhzj7.fi.fi.utils.SapUtils.unlocked_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款申请单保存操作
|
||||||
|
*/
|
||||||
|
public class PayApplySaveOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
//保存插件之后来源类型为sap且未锁定才去锁,并且更新状态
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
for (DynamicObject bill : dataEntities) {
|
||||||
|
String sourcesystem = bill.getString("shjh_sourcesystem");//来源系统:SAP
|
||||||
|
boolean shjhSapwhetherlocking = bill.getBoolean("shjh_sapwhetherlocking");//SAP是否锁定:未锁定
|
||||||
|
if ("A".equals(sourcesystem) && !shjhSapwhetherlocking) {
|
||||||
|
JSONArray IT_INPUT = new JSONArray();
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
String FM_CompanyCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("openorg")) {
|
||||||
|
FM_CompanyCode = bill.getDynamicObject("openorg").getString("number");//公司编码_申请付款组织
|
||||||
|
}
|
||||||
|
jsonObject.put("bukrs",FM_CompanyCode);//公司代码_申请付款组织
|
||||||
|
jsonObject.put("belnr", bill.getString("shjh_vouchernum"));//会计凭证编号_SAP应付凭证号
|
||||||
|
jsonObject.put("gjahr", bill.getString("shjh_voucheryear"));//会计年度_SAP应付凭证会计年度
|
||||||
|
jsonObject.put("stasus", "01");//状态 01:锁定,02:解锁,03:关闭,04:退单:05:作废
|
||||||
|
String cname = "";
|
||||||
|
if (null!= bill.getDynamicObject("creator")) {
|
||||||
|
cname = bill.getDynamicObject("creator").getString("number");//创建人,工号_申请人
|
||||||
|
}
|
||||||
|
jsonObject.put("cname", cname);//创建人,工号
|
||||||
|
jsonObject.put("zjddjid", ""+bill.getPkValue());//金蝶单据ID
|
||||||
|
jsonObject.put("zjddjbh", bill.getString("billno"));//金蝶单据编号
|
||||||
|
IT_INPUT.add(jsonObject);
|
||||||
|
|
||||||
|
JSONObject jsonObjects = unlocked_status(IT_INPUT,bill.getString("billno"));
|
||||||
|
String code = (String)jsonObjects.get("code");
|
||||||
|
if (!"0".equals(code)) {
|
||||||
|
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
|
||||||
|
operateErrorInfo.setMessage("付款申请单:"+bill.getString("billno")+"状态锁定失败:" + jsonObject.get("msg"));
|
||||||
|
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());
|
||||||
|
operateErrorInfo.setPkValue(bill.getPkValue());
|
||||||
|
this.operationResult.addErrorInfo(operateErrorInfo);
|
||||||
|
}else {
|
||||||
|
//成功:更新状态
|
||||||
|
bill.set("shjh_sapwhetherlocking", true);
|
||||||
|
SaveServiceHelper.save(new DynamicObject[]{bill});
|
||||||
|
this.operationResult.addSuccessPkId(bill.getPkValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.entity.ExtendedDataEntity;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.AddValidatorsEventArgs;
|
||||||
|
import kd.bos.entity.validate.AbstractValidator;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
public class PayApplySubmitOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAddValidators(AddValidatorsEventArgs e) {
|
||||||
|
super.onAddValidators(e);
|
||||||
|
e.addValidator(new AbstractValidator() {
|
||||||
|
@Override
|
||||||
|
public void validate() {
|
||||||
|
String operateKey = this.getOperateKey();
|
||||||
|
//标记锁了才可以提交,
|
||||||
|
if ("submit".equals(operateKey)){
|
||||||
|
ExtendedDataEntity[] entities = this.getDataEntities();
|
||||||
|
for (ExtendedDataEntity entity : entities) {
|
||||||
|
DynamicObject bill = entity.getDataEntity();
|
||||||
|
String sourcesystem = bill.getString("shjh_sourcesystem");//来源系统:SAP_A
|
||||||
|
boolean shjhSapwhetherlocking = bill.getBoolean("shjh_sapwhetherlocking");//SAP是否锁定:锁定
|
||||||
|
if ("A".equals(sourcesystem)) {
|
||||||
|
if (!shjhSapwhetherlocking) {
|
||||||
|
this.addErrorMessage(entity,"SAP未锁定,不能提交");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,199 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.operate;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.sap.db.jdbc.packet.ErrorLevel;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||||
|
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||||
|
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||||
|
import kd.bos.orm.query.QCP;
|
||||||
|
import kd.bos.orm.query.QFilter;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import static shjh.jhzj7.fi.fi.utils.SapUtils.withholding_billing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 付款单推送费控操作插件
|
||||||
|
* shjh_cas_paybill_ext
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class PaybillOperation extends AbstractOperationServicePlugIn implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||||
|
super.afterExecuteOperationTransaction(e);
|
||||||
|
|
||||||
|
String operationKey = e.getOperationKey();
|
||||||
|
if ("pushfk".equals(operationKey)) {
|
||||||
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
|
for (DynamicObject bill : dataEntities) {
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
// 构建header
|
||||||
|
JSONObject header = buildHeader(bill);
|
||||||
|
// 构建body
|
||||||
|
JSONArray body = buildBody(bill);
|
||||||
|
data.put("header", header);
|
||||||
|
data.put("body", body);
|
||||||
|
JSONObject jsonObject = withholding_billing(data, bill.getString("billno"));
|
||||||
|
String code = (String)jsonObject.get("code");
|
||||||
|
if (!"0".equals(code)) {
|
||||||
|
OperateErrorInfo operateErrorInfo = new OperateErrorInfo();
|
||||||
|
operateErrorInfo.setMessage("付款单:"+bill.getString("billno")+"推送费控失败:" + jsonObject.get("msg"));
|
||||||
|
operateErrorInfo.setErrorLevel(ErrorLevel.Error.name());
|
||||||
|
operateErrorInfo.setPkValue(bill.getPkValue());
|
||||||
|
this.operationResult.addErrorInfo(operateErrorInfo);
|
||||||
|
}else {
|
||||||
|
this.operationResult.addSuccessPkId(bill.getPkValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建header方法
|
||||||
|
public static JSONObject buildHeader(DynamicObject bill) {
|
||||||
|
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_paybill");
|
||||||
|
JSONObject header = new JSONObject();
|
||||||
|
header.put("FM_RequestBillCode", "DKK");// 单据类型编码,固定值:DKK
|
||||||
|
header.put("FM_RequestCode", bill.getString("billno"));// 资金系统的申请单号_单据编号
|
||||||
|
|
||||||
|
String FM_CompanyCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("openorg")) {
|
||||||
|
FM_CompanyCode = bill.getDynamicObject("openorg").getString("number");//公司编码_申请付款组织
|
||||||
|
}
|
||||||
|
header.put("FM_CompanyCode", FM_CompanyCode);// 公司编码_申请付款组织
|
||||||
|
String FM_DeptCode = "";
|
||||||
|
DynamicObjectCollection entry = bill.getDynamicObjectCollection("entry");
|
||||||
|
if (!entry.isEmpty()) {
|
||||||
|
DynamicObject dynamicObject = entry.get(0);
|
||||||
|
DynamicObject secondarydept = dynamicObject.getDynamicObject("shjh_secondarydept");
|
||||||
|
if (null != secondarydept) {
|
||||||
|
FM_DeptCode = secondarydept.getString("number");// 部门编码_申请付款部门
|
||||||
|
}
|
||||||
|
}
|
||||||
|
header.put("FM_DeptCode", FM_DeptCode);//部门编码,取分录二级部门
|
||||||
|
|
||||||
|
String FM_ExpenseItemCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("shjh_bizsmall")) {
|
||||||
|
FM_ExpenseItemCode = bill.getDynamicObject("shjh_bizsmall").getString("number");// 业务小类编码
|
||||||
|
}
|
||||||
|
|
||||||
|
String FM_UserCode = "";
|
||||||
|
String FM_CreateUserCode = "";
|
||||||
|
QFilter q1 = new QFilter("shjh_biztype", QCP.equals, "fk");//业务类型为付款单
|
||||||
|
QFilter q2 = new QFilter("shjh_org.number", QCP.equals, FM_CompanyCode);//组织
|
||||||
|
QFilter q3 = new QFilter("shjh_bizsmalltype.number", QCP.equals, FM_ExpenseItemCode);//业务小类
|
||||||
|
DynamicObject[] load = BusinessDataServiceHelper.load("shjh_fksqr", "id", new QFilter[]{q1, q2, q3});
|
||||||
|
if (load.length > 0) {
|
||||||
|
DynamicObject fksqr = load[0];
|
||||||
|
if (null != fksqr) {
|
||||||
|
DynamicObject dynamicObject = fksqr.getDynamicObject("shjh_sqr");
|
||||||
|
if (null != dynamicObject) {
|
||||||
|
FM_UserCode = dynamicObject.getString("number");// 员工工号_费控单据申请人映射表_人员
|
||||||
|
FM_CreateUserCode = dynamicObject.getString("createusercode");// 创建人工号_费控单据申请人映射表_人员
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// header.put("FM_UserCode", FM_UserCode);//员工工号,配置表(shjh_fksqr)
|
||||||
|
// header.put("FM_CreateUserCode", FM_CreateUserCode);// 创建人工号
|
||||||
|
header.put("FM_UserCode", "GH017994");//员工工号,配置表(shjh_fksqr)
|
||||||
|
header.put("FM_CreateUserCode", "GH017994");// 创建人工号
|
||||||
|
|
||||||
|
String FM_ExpenseTypeCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("shjh_bizbig")) {
|
||||||
|
FM_ExpenseTypeCode = bill.getDynamicObject("shjh_bizbig").getString("number");// 业务大类编码(EQ49,EQ44,EQ1101)
|
||||||
|
}
|
||||||
|
// header.put("FM_ExpenseTypeCode", FM_ExpenseTypeCode);// 业务大类编码(EQ49,EQ44,EQ1101)
|
||||||
|
header.put("FM_ExpenseTypeCode", "EQ44");// 业务大类编码(EQ49,EQ44,EQ1101)
|
||||||
|
//todo:EQ1101 -- QT0401,QT0402
|
||||||
|
// EQ44 -- ZZ1001
|
||||||
|
// EQ49 -- ZZ1301、ZZ1302、ZZ1303、ZZ1304
|
||||||
|
|
||||||
|
header.put("FM_CurrencyCode", "RMB");// 币种编码,默认:RMB
|
||||||
|
header.put("FM_RequestName", bill.getString("description"));// todo:单据主题_拼接
|
||||||
|
header.put("FM_AttachUrl", null);//附件URL地址:array
|
||||||
|
header.put("FM_BudType", 0);//预算类别0-组织预算,1-全年预算,当前只处理0 int
|
||||||
|
header.put("Remark", bill.getString("description"));// 事项描述_摘要
|
||||||
|
|
||||||
|
return header;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建body方法
|
||||||
|
public static JSONArray buildBody(DynamicObject bill) {
|
||||||
|
bill = BusinessDataServiceHelper.loadSingle(bill.getPkValue(), "cas_paybill");
|
||||||
|
JSONArray body = new JSONArray();
|
||||||
|
// 付款明细
|
||||||
|
DynamicObjectCollection Lists = bill.getDynamicObjectCollection("entry");
|
||||||
|
for (DynamicObject obj : Lists) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
Double e_actamt = Double.valueOf(String.valueOf(obj.getBigDecimal("e_actamt"))); // 含税金额_实付金额
|
||||||
|
Double taxamt = Double.valueOf(String.valueOf(obj.getBigDecimal("taxamt"))); // 税额_税额
|
||||||
|
Double excluamt = e_actamt - taxamt; // 未税金额 = 实付金额 - 税额
|
||||||
|
jsonObject.put("FM_ClaimAmt", e_actamt);
|
||||||
|
jsonObject.put("FM_ExcluAmt", excluamt);//未税金额
|
||||||
|
jsonObject.put("FM_VatAmt", taxamt);
|
||||||
|
Date entrybizdate = obj.getDate("entrybizdate");
|
||||||
|
// 将 Date 对象转换为 LocalDate 对象
|
||||||
|
LocalDate localDate = entrybizdate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
|
||||||
|
// 提取年份
|
||||||
|
int year = localDate.getYear();
|
||||||
|
// 提取月份
|
||||||
|
int month = localDate.getMonthValue();
|
||||||
|
jsonObject.put("FM_FiscalYear", year);// 费用年度_表头业务日期
|
||||||
|
jsonObject.put("FM_FiscalMoth", month);//费用月度_表头业务日期
|
||||||
|
// 格式化日期为 yyyyMMdd
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
String formattedDate = localDate.format(formatter);
|
||||||
|
jsonObject.put("FM_ExItemDate1", formattedDate);// 业务日期_业务日期
|
||||||
|
String FM_SupplierCode = "";
|
||||||
|
String payeetype = bill.getString("payeetype");//收款人类型
|
||||||
|
if ("bd_supplier".equals(payeetype)) {
|
||||||
|
String payeeformid = bill.getString("payeeformid");//收款人基础资料标识
|
||||||
|
String payee = bill.getString("payee");//收款人ID
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(payee, payeeformid);
|
||||||
|
if (null != dynamicObject) {
|
||||||
|
FM_SupplierCode = dynamicObject.getString("number");// 供应商编码_收款人类型为供应商,取收款人编码
|
||||||
|
}
|
||||||
|
}
|
||||||
|
jsonObject.put("FM_SupplierCode", FM_SupplierCode);// 供应商编码_收款人类型为供应商,取收款人编码
|
||||||
|
|
||||||
|
String FM_CostCenterCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("shjh_costcenter")) {
|
||||||
|
FM_CostCenterCode = bill.getDynamicObject("shjh_costcenter").getString("number");// 成本中心编码
|
||||||
|
}
|
||||||
|
jsonObject.put("FM_CostCenterCode", FM_CostCenterCode);// 成本中心编码
|
||||||
|
|
||||||
|
String FM_ProfitCenterCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("shjh_pc")) {
|
||||||
|
FM_ProfitCenterCode = bill.getDynamicObject("shjh_pc").getString("number");// 利润中心编码
|
||||||
|
}
|
||||||
|
jsonObject.put("FM_ProfitCenterCode", FM_ProfitCenterCode);// 利润中心编码
|
||||||
|
|
||||||
|
String FM_ExpenseItemCode = "";
|
||||||
|
if (null!= bill.getDynamicObject("shjh_bizsmall")) {
|
||||||
|
FM_ExpenseItemCode = bill.getDynamicObject("shjh_bizsmall").getString("number");// 业务小类编码
|
||||||
|
}
|
||||||
|
// jsonObject.put("FM_ExpenseItemCode", FM_ExpenseItemCode);// 业务小类编码
|
||||||
|
jsonObject.put("FM_ExpenseItemCode", "ZZ1001");// todo:业务小类编码
|
||||||
|
|
||||||
|
// todo:税率编码(传J0时,发票类型选INVOICE003),参考附表 @余学良 根据业务类型来默认吧,
|
||||||
|
// 我们到时候会增加一个 代付款(专票)这样的大类,,这个大类传 专票。其他大类 默认 其他发票类型,税率0
|
||||||
|
jsonObject.put("FM_InvoiceTypeCode", "INVOICE003");// 发票类型编码(普票:INVOICE001,专票:INVOICE002,其它票据:INVOICE003)
|
||||||
|
jsonObject.put("FM_TaxRateCode", "J0");
|
||||||
|
jsonObject.put("FM_DetailAttachUrl", null);// 附件URL地址:array
|
||||||
|
jsonObject.put("Remark", obj.getString("e_remark"));// 备注
|
||||||
|
|
||||||
|
body.add(jsonObject);
|
||||||
|
}
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,34 @@
|
||||||
|
package shjh.jhzj7.fi.fi.plugin.task;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import kd.bos.context.RequestContext;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.exception.KDException;
|
||||||
|
import kd.bos.schedule.executor.AbstractTask;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static shjh.jhzj7.fi.fi.plugin.operate.PaybillOperation.buildBody;
|
||||||
|
import static shjh.jhzj7.fi.fi.plugin.operate.PaybillOperation.buildHeader;
|
||||||
|
import static shjh.jhzj7.fi.fi.utils.SapUtils.withholding_billing;
|
||||||
|
|
||||||
|
public class PaybillPushFkTask extends AbstractTask implements Plugin {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute(RequestContext requestContext, Map<String, Object> map) throws KDException {
|
||||||
|
DynamicObject[] paybills = BusinessDataServiceHelper.load("cas_paybill", "id", null);
|
||||||
|
for (DynamicObject paybill : paybills) {
|
||||||
|
JSONObject data = new JSONObject();
|
||||||
|
// 构建header
|
||||||
|
JSONObject header = buildHeader(paybill);
|
||||||
|
// 构建body
|
||||||
|
JSONArray body = buildBody(paybill);
|
||||||
|
data.put("header", header);
|
||||||
|
data.put("body", body);
|
||||||
|
withholding_billing(data, paybill.getString("billno"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -14,7 +14,6 @@ import org.apache.http.entity.StringEntity;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
|
||||||
import java.sql.Date;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
|
@ -46,60 +45,39 @@ public class SapUtils {
|
||||||
// public static final String withholdingUrl = "https://hipint.jahwa.com.cn:6443/gateway//HIP_ReceiveFromFM/1.0/fm/send";//正式环境
|
// public static final String withholdingUrl = "https://hipint.jahwa.com.cn:6443/gateway//HIP_ReceiveFromFM/1.0/fm/send";//正式环境
|
||||||
public static final String receiverID2 = "FeiKong";//定义的发送者
|
public static final String receiverID2 = "FeiKong";//定义的发送者
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建请求头
|
|
||||||
* @param thirdPartyMap 第三方数据映射
|
|
||||||
* @return 请求头映射
|
|
||||||
*/
|
|
||||||
private static Map<String, String> buildCustomerHeader(Map<String, Object> thirdPartyMap) {
|
|
||||||
Map<String, String> customerHeader = new HashMap<>();
|
|
||||||
customerHeader.put("interfaceID", ""+thirdPartyMap.get("interfaceID"));//识别被调接口并进行路由
|
|
||||||
customerHeader.put("receiverID", ""+thirdPartyMap.get("receiverID"));
|
|
||||||
return customerHeader;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证锁定解锁状态回写
|
* SAP应付凭证锁定解锁状态回写
|
||||||
*/
|
*/
|
||||||
public static void unlocked_status(Map<String, Object> thirdPartyMap){
|
public static JSONObject unlocked_status(JSONArray IT_INPUT,String billno){
|
||||||
|
|
||||||
|
Map<String, Object> thirdPartyMap = new HashMap<>();
|
||||||
thirdPartyMap.put("interfaceID",interfaceID1);
|
thirdPartyMap.put("interfaceID",interfaceID1);
|
||||||
thirdPartyMap.put("receiverID",receiverID1);
|
thirdPartyMap.put("receiverID",receiverID1);
|
||||||
thirdPartyMap.put("URL",unlockedUrl);
|
thirdPartyMap.put("URL",unlockedUrl);
|
||||||
// 构建请求头
|
thirdPartyMap.put("billno",billno);
|
||||||
Map<String, String> customerHeader = buildCustomerHeader(thirdPartyMap);
|
|
||||||
// 组装请求体
|
// 组装请求体
|
||||||
JSONObject pendingsBody = unlockedBody(thirdPartyMap);
|
JSONObject pendingsBody = unlockedBody(IT_INPUT);
|
||||||
// 发送请求并处理响应
|
// 发送请求并处理响应
|
||||||
// processRequest(customerHeader, pendingsBody, thirdPartyMap,Apimenthod1);
|
return processRequest(pendingsBody, thirdPartyMap, Apimenthod1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证锁定解锁状态回写组装请求体:
|
* SAP应付凭证锁定解锁状态回写组装请求体:
|
||||||
* @param thirdPartyMap 第三方数据映射
|
|
||||||
* @return 请求体的 JSON 对象
|
* @return 请求体的 JSON 对象
|
||||||
*/
|
*/
|
||||||
private static JSONObject unlockedBody(Map<String, Object> thirdPartyMap) {
|
private static JSONObject unlockedBody(JSONArray IT_INPUT) {
|
||||||
|
// 获取当前日期和时间
|
||||||
|
LocalDateTime date = LocalDateTime.now();
|
||||||
|
// 定义日期时间格式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
// 格式化当前日期和时间
|
||||||
|
String dates = date.format(formatter);
|
||||||
//组装请求体
|
//组装请求体
|
||||||
JSONObject pendingsBody = new JSONObject();
|
JSONObject pendingsBody = new JSONObject();
|
||||||
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//todo:唯一事务ID,采用UUID或其他强唯一性ID
|
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//唯一事务ID,采用UUID或其他强唯一性ID,会校验不存在,是否在上游储存
|
||||||
pendingsBody.put("requestTime", ""+(thirdPartyMap.get("createdatetime")));//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
||||||
|
|
||||||
JSONObject data = new JSONObject();
|
JSONObject data = new JSONObject();
|
||||||
JSONArray IT_INPUT = new JSONArray();
|
|
||||||
//todo:多
|
|
||||||
List<DynamicObject> Lists = (List<DynamicObject>) thirdPartyMap.get("Lists");
|
|
||||||
for (DynamicObject obj : Lists) {
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("bukrs", ""+(thirdPartyMap.get("bukrs")));//公司代码
|
|
||||||
jsonObject.put("belnr", ""+(thirdPartyMap.get("belnr")));//会计凭证编号
|
|
||||||
jsonObject.put("gjahr", ""+(thirdPartyMap.get("gjahr")));//会计年度
|
|
||||||
jsonObject.put("stasus", ""+(thirdPartyMap.get("stasus")));//状态 01:锁定,02:解锁,03:关闭,04:退单:05:作废
|
|
||||||
jsonObject.put("cname", ""+(thirdPartyMap.get("cname")));//创建人,工号
|
|
||||||
jsonObject.put("zjddjid", ""+(thirdPartyMap.get("zjddjid")));//金蝶单据ID
|
|
||||||
jsonObject.put("zjddjbh", ""+(thirdPartyMap.get("zjddjbh")));//金蝶单据编号
|
|
||||||
IT_INPUT.add(jsonObject);
|
|
||||||
}
|
|
||||||
data.put("IT_INPUT",IT_INPUT);
|
data.put("IT_INPUT",IT_INPUT);
|
||||||
pendingsBody.put("data", data);
|
pendingsBody.put("data", data);
|
||||||
return pendingsBody;
|
return pendingsBody;
|
||||||
|
|
@ -146,11 +124,13 @@ public class SapUtils {
|
||||||
/**
|
/**
|
||||||
* 生成代扣款记账单接口
|
* 生成代扣款记账单接口
|
||||||
*/
|
*/
|
||||||
public static void withholding_billing(){
|
public static JSONObject withholding_billing(JSONObject data,String billno){
|
||||||
Map<String, Object> thirdPartyMap = new HashMap<>();
|
Map<String, Object> thirdPartyMap = new HashMap<>();
|
||||||
thirdPartyMap.put("interfaceID",interfaceID3);
|
thirdPartyMap.put("interfaceID",interfaceID3);
|
||||||
thirdPartyMap.put("receiverID",receiverID2);
|
thirdPartyMap.put("receiverID",receiverID2);
|
||||||
thirdPartyMap.put("URL",withholdingUrl);
|
thirdPartyMap.put("URL",withholdingUrl);
|
||||||
|
thirdPartyMap.put("billno",billno);
|
||||||
|
|
||||||
// 获取当前日期和时间
|
// 获取当前日期和时间
|
||||||
LocalDateTime date = LocalDateTime.now();
|
LocalDateTime date = LocalDateTime.now();
|
||||||
// 定义日期时间格式
|
// 定义日期时间格式
|
||||||
|
|
@ -158,62 +138,27 @@ public class SapUtils {
|
||||||
// 格式化当前日期和时间
|
// 格式化当前日期和时间
|
||||||
String dates = date.format(formatter);
|
String dates = date.format(formatter);
|
||||||
thirdPartyMap.put("createdatetime",dates);
|
thirdPartyMap.put("createdatetime",dates);
|
||||||
// 构建请求头
|
|
||||||
Map<String, String> customerHeader = buildCustomerHeader(thirdPartyMap);
|
|
||||||
// 组装请求体
|
// 组装请求体
|
||||||
JSONObject withholdingBody = withholdingBody(thirdPartyMap);
|
JSONObject withholdingBody = withholdingBody(data);
|
||||||
// 发送请求并处理响应
|
// 发送请求并处理响应
|
||||||
// processRequest(customerHeader, withholdingBody, thirdPartyMap, Apimenthod3);
|
return processRequest(withholdingBody, thirdPartyMap, Apimenthod2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* SAP应付凭证清单接口组装请求体:
|
* 生成代扣款记账单接口组装请求体:
|
||||||
* @param thirdPartyMap 第三方数据映射
|
|
||||||
* @return 请求体的 JSON 对象
|
* @return 请求体的 JSON 对象
|
||||||
*/
|
*/
|
||||||
private static JSONObject withholdingBody(Map<String, Object> thirdPartyMap) {
|
private static JSONObject withholdingBody(JSONObject data) {
|
||||||
|
// 获取当前日期和时间
|
||||||
|
LocalDateTime date = LocalDateTime.now();
|
||||||
|
// 定义日期时间格式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
|
// 格式化当前日期和时间
|
||||||
|
String dates = date.format(formatter);
|
||||||
//组装请求体
|
//组装请求体
|
||||||
JSONObject pendingsBody = new JSONObject();
|
JSONObject pendingsBody = new JSONObject();
|
||||||
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//todo:唯一事务ID,采用UUID或其他强唯一性ID
|
pendingsBody.put("rootContextID",""+System.currentTimeMillis());//todo:唯一事务ID,采用UUID或其他强唯一性ID
|
||||||
pendingsBody.put("requestTime", ""+(thirdPartyMap.get("createdatetime")));//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
pendingsBody.put("requestTime", dates);//请求时间,格式为yyyy-MM-dd HH:mm:ss.SSS
|
||||||
|
|
||||||
JSONObject data = new JSONObject();
|
|
||||||
JSONObject header = new JSONObject();
|
|
||||||
header.put("FM_RequestBillCode", "DKK");//单据类型编码,固定值:DKK
|
|
||||||
header.put("FM_RequestCode", ""+(thirdPartyMap.get("FM_RequestCode")));//资金系统的申请单号
|
|
||||||
header.put("FM_CompanyCode", ""+(thirdPartyMap.get("FM_CompanyCode")));//公司编码
|
|
||||||
header.put("FM_DeptCode", ""+(thirdPartyMap.get("FM_DeptCode")));//部门编码
|
|
||||||
header.put("FM_UserCode", ""+(thirdPartyMap.get("FM_UserCode")));//员工工号
|
|
||||||
header.put("FM_CreateUserCode", ""+(thirdPartyMap.get("FM_CreateUserCode")));//创建人工号
|
|
||||||
header.put("FM_ExpenseTypeCode", ""+(thirdPartyMap.get("FM_ExpenseTypeCode")));//业务大类编码(EQ49,EQ44,EQ1101)
|
|
||||||
header.put("FM_CurrencyCode", ""+(thirdPartyMap.get("FM_CurrencyCode")));//币种编码,默认:RMB
|
|
||||||
header.put("FM_RequestName", ""+(thirdPartyMap.get("FM_RequestName")));//单据主题
|
|
||||||
header.put("FM_AttachUrl", JSONArray.parse(""+(thirdPartyMap.get("FM_AttachUrl"))));//todo:附件URL地址:array
|
|
||||||
header.put("FM_BudType", Integer.valueOf(""+thirdPartyMap.get("FM_AttachUr")));//预算类别0-组织预算,1-全年预算,当前只处理0 int
|
|
||||||
header.put("Remark", ""+(thirdPartyMap.get("Remark")));//事项描述
|
|
||||||
JSONArray body = new JSONArray();
|
|
||||||
//todo:多
|
|
||||||
List<DynamicObject> Lists = (List<DynamicObject>) thirdPartyMap.get("Lists");
|
|
||||||
for (DynamicObject obj : Lists) {
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
|
||||||
jsonObject.put("FM_ClaimAmt", Double.valueOf(""+(thirdPartyMap.get("FM_ClaimAmt"))));//含税金额
|
|
||||||
jsonObject.put("FM_ExcluAmt", Double.valueOf(""+(thirdPartyMap.get("FM_ExcluAmt"))));//未税金额
|
|
||||||
jsonObject.put("FM_VatAmt", Double.valueOf(""+(thirdPartyMap.get("FM_VatAmt"))));//税额
|
|
||||||
jsonObject.put("FM_FiscalYear", Integer.valueOf(""+(thirdPartyMap.get("FM_FiscalYear"))));//费用年度
|
|
||||||
jsonObject.put("FM_FiscalMoth", Integer.valueOf(""+(thirdPartyMap.get("FM_FiscalMoth"))));//费用月度
|
|
||||||
jsonObject.put("FM_ExItemDate1", Date.valueOf(""+thirdPartyMap.get("FM_ExItemDate1")));//业务日期
|
|
||||||
jsonObject.put("FM_SupplierCode", ""+(thirdPartyMap.get("FM_SupplierCode")));//供应商编码,业务大类=EQ49时必填
|
|
||||||
jsonObject.put("FM_CostCenterCode", ""+(thirdPartyMap.get("FM_CostCenterCode")));//成本中心编码,业务大类=EQ49时必填
|
|
||||||
jsonObject.put("FM_ProfitCenterCode", ""+(thirdPartyMap.get("FM_ProfitCenterCode")));//利润中心编码,业务大类=EQ49时必填
|
|
||||||
jsonObject.put("FM_ExpenseItemCode", ""+(thirdPartyMap.get("FM_ExpenseItemCode")));//业务小类编码,业务大类=EQ49时必填
|
|
||||||
jsonObject.put("FM_InvoiceTypeCode", ""+(thirdPartyMap.get("FM_InvoiceTypeCode")));//发票类型编码(普票:INVOICE001,专票:INVOICE002,其它票据:INVOICE003)
|
|
||||||
jsonObject.put("FM_TaxRateCode", ""+(thirdPartyMap.get("FM_TaxRateCode")));//税率编码(传J0时,发票类型选INVOICE003),参考附表
|
|
||||||
jsonObject.put("FM_DetailAttachUrl", JSONArray.parse(""+(thirdPartyMap.get("FM_DetailAttachUrl"))));//todo:附件URL地址:array
|
|
||||||
jsonObject.put("Remark", ""+(thirdPartyMap.get("Remark")));//备注
|
|
||||||
body.add(jsonObject);
|
|
||||||
}
|
|
||||||
data.put("header",header);
|
|
||||||
data.put("body",body);
|
|
||||||
pendingsBody.put("data", data);
|
pendingsBody.put("data", data);
|
||||||
return pendingsBody;
|
return pendingsBody;
|
||||||
}
|
}
|
||||||
|
|
@ -263,6 +208,12 @@ public class SapUtils {
|
||||||
if (responseEntity != null) {
|
if (responseEntity != null) {
|
||||||
String responseString = EntityUtils.toString(responseEntity, "UTF-8");
|
String responseString = EntityUtils.toString(responseEntity, "UTF-8");
|
||||||
jsonObject = JSONObject.parseObject(responseString);
|
jsonObject = JSONObject.parseObject(responseString);
|
||||||
|
String code = (String)jsonObject.get("code");
|
||||||
|
if (!"0".equals(code)) {
|
||||||
|
logger.info(apiName +"失败!");
|
||||||
|
saveLog(apiName +(thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false,apiName);
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
handleResponse(jsonObject, pendingsBody, thirdPartyMap,apiName);
|
handleResponse(jsonObject, pendingsBody, thirdPartyMap,apiName);
|
||||||
return com.alibaba.fastjson.JSONObject.parseObject(responseString);
|
return com.alibaba.fastjson.JSONObject.parseObject(responseString);
|
||||||
}else {
|
}else {
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,12 @@ public class ApplyAdjustBillControler {
|
||||||
|
|
||||||
log.error("审核成功,费控调整单号:" + fkBillNum);
|
log.error("审核成功,费控调整单号:" + fkBillNum);
|
||||||
JhzjUtils.saveLog(fkBillNum, Apimenthod, jsonBodyString, null, true, "API");
|
JhzjUtils.saveLog(fkBillNum, Apimenthod, jsonBodyString, null, true, "API");
|
||||||
return CustomApiResult.success(null);
|
ApiResult customApiResult = new ApiResult("");
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
customApiResult.setHeaders(map);
|
||||||
|
customApiResult.getHeaders().put("billno",fkBillNum);
|
||||||
|
customApiResult.getHeaders().put("billid",""+ap_payapply.getPkValue());
|
||||||
|
return CustomApiResult.success(customApiResult);
|
||||||
}else {
|
}else {
|
||||||
// 调整金额大于分录未调整过的申请金额,反馈无法处理
|
// 调整金额大于分录未调整过的申请金额,反馈无法处理
|
||||||
return handleErrorAndReturn("同步失败, 调整单号:" + fkBillNum + "的调整金额大于分录未调整过的申请金额", fkBillNum, jsonBodyString);
|
return handleErrorAndReturn("同步失败, 调整单号:" + fkBillNum + "的调整金额大于分录未调整过的申请金额", fkBillNum, jsonBodyString);
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import kd.bos.entity.validate.ValidateResult;
|
||||||
import kd.bos.entity.validate.ValidateResultCollection;
|
import kd.bos.entity.validate.ValidateResultCollection;
|
||||||
import kd.bos.logging.Log;
|
import kd.bos.logging.Log;
|
||||||
import kd.bos.logging.LogFactory;
|
import kd.bos.logging.LogFactory;
|
||||||
|
import kd.bos.openapi.base.custom.valueextraction.CustomApiResultValueExtractor;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiController;
|
import kd.bos.openapi.common.custom.annotation.ApiController;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiPostMapping;
|
import kd.bos.openapi.common.custom.annotation.ApiPostMapping;
|
||||||
import kd.bos.openapi.common.custom.annotation.ApiRequestBody;
|
import kd.bos.openapi.common.custom.annotation.ApiRequestBody;
|
||||||
|
|
@ -58,6 +59,8 @@ public class ApplyBillControler {
|
||||||
public CustomApiResult<ApiResult> applybill_sync (@NotNull @Valid @ApiRequestBody(value="入参json格式数据") ApplyBillModel applybill) {
|
public CustomApiResult<ApiResult> applybill_sync (@NotNull @Valid @ApiRequestBody(value="入参json格式数据") ApplyBillModel applybill) {
|
||||||
JSONObject json_body;
|
JSONObject json_body;
|
||||||
String jsonBodyString = null;
|
String jsonBodyString = null;
|
||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 解析入参,如果格式不正确,日志记录,并反馈esb
|
// 解析入参,如果格式不正确,日志记录,并反馈esb
|
||||||
json_body = (JSONObject) JSON.toJSON(applybill);
|
json_body = (JSONObject) JSON.toJSON(applybill);
|
||||||
|
|
@ -383,7 +386,12 @@ public class ApplyBillControler {
|
||||||
|
|
||||||
log.error("审核成功,费控单据编号:" + fkBillNum);
|
log.error("审核成功,费控单据编号:" + fkBillNum);
|
||||||
JhzjUtils.saveLog(fkBillNum, Apimenthod, jsonBodyString, null, true, "API");
|
JhzjUtils.saveLog(fkBillNum, Apimenthod, jsonBodyString, null, true, "API");
|
||||||
return CustomApiResult.success(null);
|
ApiResult customApiResult = new ApiResult("");
|
||||||
|
HashMap<String, String> map = new HashMap<>();
|
||||||
|
customApiResult.setHeaders(map);
|
||||||
|
customApiResult.getHeaders().put("billno",fkBillNum);
|
||||||
|
customApiResult.getHeaders().put("billid",""+ap_payapply.getPkValue());
|
||||||
|
return CustomApiResult.success(customApiResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue