lc/lc123/cloud/app/plugin/operate/ap/ApBusBillSubmitToFwOp.java

56 lines
2.2 KiB
Java

package tqq9.lc123.cloud.app.plugin.operate.ap;
import com.alibaba.fastjson.JSONObject;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.operate.result.OperationResult;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import org.apache.commons.lang3.StringUtils;
import tqq9.lc123.cloud.app.plugin.trd.FWImpl;
import java.util.List;
/**
* 暂估应付单提交后推送泛微
*/
public class ApBusBillSubmitToFwOp extends AbstractOperationServicePlugIn {
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
OperationResult operationResult = this.getOperationResult();
List<Object> successPkIds = operationResult.getSuccessPkIds();
for (Object successPkId : successPkIds) {
DynamicObject bill = BusinessDataServiceHelper.loadSingle(successPkId, "ap_busbill");
DynamicObject billtype = bill.getDynamicObject("billtype");
if (null != billtype) {
//采购费用暂估
String number = billtype.getString("number");
if ("ap_busbill_purfee_BT_S".equals(number)) {
String resultStr = FWImpl.pushFwApBusBill(bill);
if (StringUtils.isNotBlank(resultStr)) {
JSONObject resultObj = JSONObject.parseObject(resultStr);
String code = resultObj.getString("code");
if ("SUCCESS".equals(code)) {
bill.set("tqq9_issuccess", true);
JSONObject data = resultObj.getJSONObject("data");
if (data != null) {
String requestid = data.getString("requestid");
bill.set("tqq9_fwrequestid", requestid);
SaveServiceHelper.save(new DynamicObject[]{bill});
}
}
}
}
}
}
}
}