|
@@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import kd.bos.cache.CacheFactory;
|
|
|
import kd.bos.cache.TempFileCache;
|
|
|
+import kd.bos.dataentity.OperateOption;
|
|
|
import kd.bos.dataentity.entity.DynamicObject;
|
|
|
+import kd.bos.dataentity.entity.DynamicObjectCollection;
|
|
|
import kd.bos.dataentity.resource.ResManager;
|
|
|
import kd.bos.dataentity.utils.StringUtils;
|
|
|
import kd.bos.entity.BillEntityType;
|
|
|
+import kd.bos.entity.operate.result.OperationResult;
|
|
|
import kd.bos.logging.Log;
|
|
|
import kd.bos.logging.LogFactory;
|
|
|
import kd.bos.openapi.common.custom.annotation.ApiController;
|
|
@@ -19,6 +22,7 @@ import kd.bos.orm.query.QFilter;
|
|
|
import kd.bos.servicehelper.AttachmentServiceHelper;
|
|
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
|
|
import kd.bos.servicehelper.DispatchServiceHelper;
|
|
|
+import kd.bos.servicehelper.operation.SaveServiceHelper;
|
|
|
import kd.imc.rim.common.message.exception.MsgException;
|
|
|
import kd.imc.rim.common.utils.FileUploadUtils;
|
|
|
import kd.imc.rim.common.utils.FileUtils;
|
|
@@ -132,7 +136,20 @@ public class SRMSynAttacmentApiPlugin implements Serializable {
|
|
|
BillEntityType dataEntityType = (BillEntityType) billInfo.getDataEntityType();
|
|
|
String appId = dataEntityType.getAppId();
|
|
|
|
|
|
- AttachmentServiceHelper.saveTempAttachments(entityName, billInfo.getLong("id"), appId, attachmentInfos);
|
|
|
+ DynamicObjectCollection attcachCols = AttachmentServiceHelper.saveTempAttachments(entityName, billInfo.getLong("id"), appId, attachmentInfos);
|
|
|
+
|
|
|
+ OperationResult resultSave = SaveServiceHelper.saveOperate(entityName, new DynamicObject[]{billInfo}, OperateOption.create());
|
|
|
+
|
|
|
+ StringBuilder err = new StringBuilder();
|
|
|
+ if (resultSave.getSuccessPkIds().size() <= 0) {
|
|
|
+ for (int i = 0; i < resultSave.getAllErrorOrValidateInfo().size(); i++) {
|
|
|
+ String message = resultSave.getAllErrorOrValidateInfo().get(i).getMessage();
|
|
|
+ err.append("/").append(message);
|
|
|
+ }
|
|
|
+ logger.info(err.toString());
|
|
|
+
|
|
|
+ return returnResult("E", "附件上传后,保存单据失败:" + err.toString(), null);
|
|
|
+ }
|
|
|
} catch(Exception e){
|
|
|
logger.info("synAttacmenthForSRM:" + (e.getMessage() == null ? "" : e.getMessage()));
|
|
|
|