fix:云之家获取按钮
This commit is contained in:
parent
135a1b4b5a
commit
043c719773
@ -1,17 +1,25 @@
|
||||
package com.yem.wm.bc.bill.from;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.yem.ia.intebilllogon.Utils.BackfilljsonAssignUtils;
|
||||
import com.yem.wm.bc.change.business.ChangeModelHelper;
|
||||
import com.yem.wm.syn.eas.api.controller.YZJAuditController;
|
||||
import com.yem.wm.utils.StringUtils;
|
||||
import com.yem.wm.utils.YunzhijiaUtils;
|
||||
import kd.bos.bill.AbstractBillPlugIn;
|
||||
import kd.bos.dataentity.OperateOption;
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.entity.datamodel.IDataModel;
|
||||
import kd.bos.entity.operate.result.OperateErrorInfo;
|
||||
import kd.bos.entity.operate.result.OperationResult;
|
||||
import kd.bos.entity.validate.ValidateResult;
|
||||
import kd.bos.entity.validate.ValidateResultCollection;
|
||||
import kd.bos.form.FormShowParameter;
|
||||
import kd.bos.form.events.AfterDoOperationEventArgs;
|
||||
import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||
import kd.bos.form.events.PreOpenFormEventArgs;
|
||||
import kd.bos.form.operate.FormOperate;
|
||||
import kd.bos.openapi.common.result.CustomApiResult;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
@ -19,7 +27,12 @@ import kd.bos.servicehelper.QueryServiceHelper;
|
||||
import kd.bos.servicehelper.operation.OperationServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EventObject;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 夜子
|
||||
@ -117,5 +130,68 @@ public class YemBillPlugInBaseFrom extends AbstractBillPlugIn {
|
||||
this.getView().updateView("yem_isyzjreject");
|
||||
this.getView().invokeOperation("refresh");
|
||||
}
|
||||
if ("cloudhomeacquisition".equals(operateKey)) {
|
||||
String data = (String) this.getModel().getValue("yem_flowinstid");
|
||||
if (!data.isEmpty()) {
|
||||
|
||||
DynamicObject ialog = BusinessDataServiceHelper.loadSingle("yem_ialog"
|
||||
, new QFilter[]{new QFilter("yem_forminstid", QCP.equals, data)});
|
||||
if (ialog!=null) {
|
||||
ialog.set("yem_writeback", data);
|
||||
SaveServiceHelper.save(new DynamicObject[]{ialog});
|
||||
}
|
||||
//TODO 调用云之家获取审批结果接口
|
||||
JSONObject reqjson = new JSONObject();
|
||||
reqjson.put("flowInstId", data);
|
||||
String retStr = null;
|
||||
try {
|
||||
retStr = YunzhijiaUtils.doPost(YunzhijiaUtils.yzjurl + "/gateway/yun/common/approve", reqjson.toString());
|
||||
} catch (IOException | KeyManagementException | NoSuchAlgorithmException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
JSONObject retJson = JSONObject.parseObject(retStr);
|
||||
if (!"FINISH".equals(retJson.getString("data"))) {
|
||||
//回写数据
|
||||
// BackfilljsonAssignUtils.BackfilljsonAssign(data);
|
||||
OperationResult result = OperationServiceHelper.executeOperate("audit", this.getModel().getDataEntityType().getName()
|
||||
, new Object[]{this.getModel().getValue("id")}, OperateOption.create());
|
||||
String audit = result(result, "audit");
|
||||
if (audit != null) {
|
||||
this.getView().showMessage("同步失败,失败原因:" + audit);
|
||||
OperationServiceHelper.executeOperate("unsubmit", this.getModel().getDataEntityType().getName()
|
||||
, new Object[]{this.getModel().getValue("id")}, OperateOption.create());
|
||||
}else {
|
||||
this.getView().showMessage("同步成功:");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private String result(OperationResult result, String operation) {
|
||||
if (!result.isSuccess()) {
|
||||
ValidateResultCollection validateResult = result.getValidateResult();
|
||||
List<ValidateResult> validateErrors = validateResult.getValidateErrors();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
if (result.getMessage() != null) {
|
||||
stringBuilder.append(result.getMessage());
|
||||
}
|
||||
for (ValidateResult validateError : validateErrors) {
|
||||
List<OperateErrorInfo> allErrorInfos = validateError.getAllErrorInfo();
|
||||
for (OperateErrorInfo allErrorInfo : allErrorInfos) {
|
||||
|
||||
String message = allErrorInfo.getMessage();
|
||||
stringBuilder.append(message + ";");
|
||||
}
|
||||
}
|
||||
List<OperateErrorInfo> allErrorInfos = result.getAllErrorInfo();
|
||||
for (OperateErrorInfo allErrorInfo : allErrorInfos) {
|
||||
String message = allErrorInfo.getMessage();
|
||||
stringBuilder.append(message);
|
||||
}
|
||||
return operation + stringBuilder;
|
||||
//throw new KDBizException(operation+stringBuilder);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user