更改附件上传失败返回错误信息

master
祁云辉 1 year ago
parent 3d32e542b4
commit 69d7712ca9

@ -26,6 +26,7 @@ import com.teamcenter.services.strong.core.SessionService;
import com.teamcenter.services.strong.core._2007_12.Session;
import com.teamcenter.services.strong.core._2018_11.ProjectLevelSecurity;
import com.teamcenter.services.strong.workflow.WorkflowService;
import com.teamcenter.soa.client.Connection;
import com.teamcenter.soa.client.model.*;
import com.teamcenter.soa.client.model.Property;
import com.teamcenter.soa.client.model.strong.*;
@ -181,8 +182,7 @@ public class TcsoaService {
FileManagementService fmService =
FileManagementService.getService(AppXSession.getConnection());
Date date = new Date();
String filePath =
System.getProperty("java.io.tmpdir") + dateFormat.format(date);
String filePath = System.getProperty("java.io.tmpdir") + dateFormat.format(date);
File file = new File(filePath);
if (!file.exists()) {
file.mkdir();
@ -346,7 +346,13 @@ public class TcsoaService {
ItemRevision itemRevision = itemsResponse.output[0].itemRev;
resultJSONObject.put("TaskPackageUID", itemRevision.get_items_tag().getUid());
// 添加任务资料
try {
putRWZL(user, itemRevision, fileList);
} catch (Exception e) {
dataManagementService.deleteObjects(new ModelObject[] {itemsResponse.output[0].item});
Utils.setLog(logFileName, "oaCreateWorkFlow", "上传数据集失败:" + e.getMessage());
return JsonResult.error("上传数据集失败!");
}
// 设置版本表单
dataManagementService.getProperties(
@ -1501,19 +1507,33 @@ public class TcsoaService {
if (property.getPropertyDescription().getLovUid() != null
&& !property.getPropertyDescription().getLovUid().equals("")) {
com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct ns = new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct();
com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct ns =
new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct();
ns.locales = new String[] {"zh_CN"};
ns.name = itemNames[itemNames.length - 1];
com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo pi = new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo();
com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo pi =
new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo();
pi.object = itemTag;
pi.propsToget = new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct[] { ns };
com.teamcenter.services.strong.core._2015_07.DataManagement.LocalizedPropertyValuesResponse lpvr = dmService.getLocalizedProperties2(new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo[] { pi });
com.teamcenter.services.strong.core._2015_07.DataManagement.LocalizedPropertyValuesInfo2[] Output = lpvr.output;
if(Output.length > 0 && Output[0].propertyValues.length > 0 && Output[0].propertyValues[0].values.length > 0)
{
pi.propsToget =
new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct[] {
ns
};
com.teamcenter.services.strong.core._2015_07.DataManagement
.LocalizedPropertyValuesResponse
lpvr =
dmService.getLocalizedProperties2(
new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo
[] {pi});
com.teamcenter.services.strong.core._2015_07.DataManagement.LocalizedPropertyValuesInfo2
[]
Output = lpvr.output;
if (Output.length > 0
&& Output[0].propertyValues.length > 0
&& Output[0].propertyValues[0].values.length > 0) {
return Output[0].propertyValues[0].values[0];
}
// LovInfo lovInfo = property.getPropertyDescription().getLovReference().getLovInfo();
// LovInfo lovInfo =
// property.getPropertyDescription().getLovReference().getLovInfo();
// List<LovValue> lovValueList = lovInfo.getValues();
// for (LovValue lovValue : lovValueList) {
// lovValue.getDisplayValue();
@ -1552,23 +1572,38 @@ public class TcsoaService {
GetProperty(itemTag, itemNames[itemNames.length - 1], dmService);
if (property.getPropertyDescription().getLovUid() != null
&& !property.getPropertyDescription().getLovUid().equals("")) {
// LovInfo lovInfo = property.getPropertyDescription().getLovReference().getLovInfo();
// LovInfo lovInfo =
// property.getPropertyDescription().getLovReference().getLovInfo();
// List<LovValue> lovValueList = lovInfo.getValues();
// for (LovValue lovValue : lovValueList) {
// lovValue.getDisplayValue();
// }
//Teamcenter.Services.Strong.Core._2010_04.DataManagement.NameLocaleStruct ns = new Services.Strong.Core._2010_04.DataManagement.NameLocaleStruct();
com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct ns = new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct();
// Teamcenter.Services.Strong.Core._2010_04.DataManagement.NameLocaleStruct ns = new
// Services.Strong.Core._2010_04.DataManagement.NameLocaleStruct();
com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct ns =
new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct();
ns.locales = new String[] {"zh_CN"};
ns.name = itemNames[itemNames.length - 1];
com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo pi = new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo();
com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo pi =
new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo();
pi.object = itemTag;
pi.propsToget = new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct[] { ns };
com.teamcenter.services.strong.core._2015_07.DataManagement.LocalizedPropertyValuesResponse lpvr = dmService.getLocalizedProperties2(new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo[] { pi });
com.teamcenter.services.strong.core._2015_07.DataManagement.LocalizedPropertyValuesInfo2[] Output = lpvr.output;
if(Output.length > 0 && Output[0].propertyValues.length > 0 && Output[0].propertyValues[0].values.length > 0)
{
pi.propsToget =
new com.teamcenter.services.strong.core._2010_04.DataManagement.NameLocaleStruct[] {
ns
};
com.teamcenter.services.strong.core._2015_07.DataManagement
.LocalizedPropertyValuesResponse
lpvr =
dmService.getLocalizedProperties2(
new com.teamcenter.services.strong.core._2010_04.DataManagement.PropertyInfo
[] {pi});
com.teamcenter.services.strong.core._2015_07.DataManagement.LocalizedPropertyValuesInfo2
[]
Output = lpvr.output;
if (Output.length > 0
&& Output[0].propertyValues.length > 0
&& Output[0].propertyValues[0].values.length > 0) {
return Output[0].propertyValues[0].values[0];
}

Loading…
Cancel
Save