lc/lc123/cloud/app/plugin/operate/im/OtherOutSubmitToFwOp.java

44 lines
1.7 KiB
Java
Raw Normal View History

package tqq9.lc123.cloud.app.plugin.operate.im;
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 OtherOutSubmitToFwOp 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, "im_otheroutbill");
String resultStr = FWImpl.pushFwOtherOut(bill);
if(StringUtils.isNotBlank(resultStr)){
JSONObject resultObj = JSONObject.parseObject(resultStr);
String code = resultObj.getString("code");
if("SUCCESS".equals(code)){
JSONObject data = resultObj.getJSONObject("data");
if(data != null){
String requestid = data.getString("requestid");
bill.set("tqq9_fwrequestid", requestid);
bill.set("tqq9_fwstate", "B");
SaveServiceHelper.save(new DynamicObject[]{bill});
}
}
}
}
}
}