Compare commits

..

No commits in common. '69d7712ca9cf016b268f3ccc5f204838a8b6e4ab' and '859f15c2d56c66bcd7cb9daa507e0dcc05b53f8c' have entirely different histories.

@ -12,7 +12,6 @@ import com.teamcenter.clientx.Utils;
import com.teamcenter.services.strong.administration.PreferenceManagementRestBindingStub;
import com.teamcenter.services.strong.administration.PreferenceManagementService;
import com.teamcenter.services.strong.administration._2012_09.PreferenceManagement;
import com.teamcenter.soa.client.Connection;
import com.teamcenter.soa.client.model.ServiceData;
import com.teamcenter.soa.client.model.strong.User;
import org.springframework.beans.factory.annotation.Autowired;
@ -101,12 +100,10 @@ public class IgtcoaApi {
// 获取必要的属性
String task_Uid =
propertyMap.containsKey("task_uid") ? propertyMap.get("task_uid").toString() : "";
// String taskWorkFlowUID =
// propertyMap.containsKey("TaskWorkFlowUID") ?
// propertyMap.get("TaskWorkFlowUID").toString() : "";
// String taskPackageUID =
// propertyMap.containsKey("TaskPackageUID") ?
// propertyMap.get("TaskPackageUID").toString() : "";
// String taskWorkFlowUID =
// propertyMap.containsKey("TaskWorkFlowUID") ? propertyMap.get("TaskWorkFlowUID").toString() : "";
// String taskPackageUID =
// propertyMap.containsKey("TaskPackageUID") ? propertyMap.get("TaskPackageUID").toString() : "";
String task_name =
propertyMap.containsKey("task_name") ? propertyMap.get("task_name").toString() : "";
String task_CustomerNameBilingUnit =
@ -200,7 +197,8 @@ public class IgtcoaApi {
productApplicationFieldOrIndustry,
productApplicationPart,
productType);
if (productValue.length() > 256) {
if(productValue.length() > 256)
{
return JsonResult.error("产品属性值超长");
}
productList.add(productValue);
@ -225,9 +223,9 @@ public class IgtcoaApi {
: "项目名称");
System.out.println(taskInstruction);
if (taskInstruction.length() > 128) {
taskInstruction = taskInstruction.substring(0, 124) + "...";
// Utils.setLog(logFileName, "oaCreateWorkFlow", "流程名称过长");
// return JsonResult.error("流程名称过长");
taskInstruction = taskInstruction.substring(0,124) + "...";
//Utils.setLog(logFileName, "oaCreateWorkFlow", "流程名称过长");
//return JsonResult.error("流程名称过长");
}
// 获取附件
List<File> fileList = new ArrayList<File>();
@ -247,7 +245,8 @@ public class IgtcoaApi {
String fileUrl = key;
byte[] buffer = Utils.getFile(fileUrl);
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();
@ -337,9 +336,13 @@ public class IgtcoaApi {
// String
try {
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
Utils.setLog(logFileName, "oaCreateWorkFlow", "TC服务器出错" + ex.getMessage());
ex.printStackTrace();
@ -382,11 +385,16 @@ public class IgtcoaApi {
// @UserLoginToken
@PostMapping(value = "/oaGetDeliveryInfo")
public Object getDeliveryInfo(@RequestBody List<String> itemIdList) {
// String deliveryId = request.getParameter("deliveryId");
//String deliveryId = request.getParameter("deliveryId");
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try {
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
ex.printStackTrace();
}
@ -394,22 +402,26 @@ public class IgtcoaApi {
Object object = TcsoaService.osGetDeliveryInfo(itemIdList);
return object;
}
// @UserLoginToken
@PostMapping(value = "/oaGetHistoryDelivery")
public Object getHistoryDelivery(HttpServletRequest request) {
String deliveryId = request.getParameter("deliveryId");
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try {
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
ex.printStackTrace();
}
Object Object = TcsoaService.oaGetHistoryDelivery(deliveryId);
return Object;
}
// @UserLoginToken
@GetMapping(value = "/oaGetDeliveryFile")
public void getGetDeliveryFile(HttpServletRequest request, HttpServletResponse response) {
@ -418,10 +430,14 @@ public class IgtcoaApi {
System.out.println("oaGetDeliveryFile" + deliveryId);
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try {
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
ex.printStackTrace();
@ -501,10 +517,14 @@ public class IgtcoaApi {
propertyMap,
logFileName);
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try {
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
Utils.setLog(logFileName, "oaCreateOrUpdateProject", "TC服务器登录出错" + ex.getMessage());
@ -512,8 +532,7 @@ public class IgtcoaApi {
}
// 获取必须的属性
String userId =
propertyMap.containsKey("designTeam") ? propertyMap.get("designTeam").toString() : "admin";
String userId = propertyMap.containsKey("designTeam") ? propertyMap.get("designTeam").toString() : "admin";
String objectName =
propertyMap.containsKey("objectName") ? propertyMap.get("objectName").toString() : "";
String projectUID =
@ -611,34 +630,43 @@ public class IgtcoaApi {
public JsonResult getItemProperty(@RequestBody List<String> itemIdList) {
String logFileName = dateFormatLog.format(new Date());
try {
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
Utils.setLog(logFileName, "getItemProperty", "TC服务器出错" + ex.getMessage());
ex.printStackTrace();
return JsonResult.error("TC服务器登录出错" + ex.getMessage());
}
JsonResult jsonResult = TcsoaService.getItemPropertys(logFileName, itemIdList);
Utils.setLog(logFileName, "getItemPropertys", "jsonResult" + jsonResult.toString());
JsonResult jsonResult = TcsoaService.getItemPropertys(logFileName,itemIdList);
Utils.setLog(logFileName, "getItemPropertys", "jsonResult"+jsonResult.toString());
return jsonResult;
}
@GetMapping(value = "/getProjectItemProperty")
public JsonResult getProjectItemProperty(@RequestParam("uid") String uid) {
String logFileName = dateFormatLog.format(new Date());
try {
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
if (tcUser == null) {
tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) {
Utils.setLog(logFileName, "getProjectItemProperty", "TC服务器出错" + ex.getMessage());
ex.printStackTrace();
return JsonResult.error("TC服务器登录出错" + ex.getMessage());
}
JsonResult jsonResult = TcsoaService.getProjectItemPropertys(logFileName, uid);
Utils.setLog(logFileName, "getProjectItemProperty", "jsonResult" + jsonResult.toString());
JsonResult jsonResult = TcsoaService.getProjectItemPropertys(logFileName,uid);
Utils.setLog(logFileName, "getProjectItemProperty", "jsonResult"+jsonResult.toString());
return jsonResult;
}
}

@ -26,7 +26,6 @@ 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.*;
@ -182,7 +181,8 @@ 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,13 +346,7 @@ 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(
@ -1507,44 +1501,30 @@ 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();
ns.locales = new String[] {"zh_CN"};
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();
// List<LovValue> lovValueList = lovInfo.getValues();
// for (LovValue lovValue : lovValueList) {
// lovValue.getDisplayValue();
// }
// String lovUid = property.getPropertyDescription().getLovUid();
// ModelObject[] items = loadObjects(new String[] {lovUid}, dmService);
// if (items == null || items.length <= 0) {
// return property.getDisplayableValue();
// }
// // dmService.getProperties(items, new String[] { "lov_name" });
// return property.getDisplayableValue();
// LovInfo lovInfo = property.getPropertyDescription().getLovReference().getLovInfo();
// List<LovValue> lovValueList = lovInfo.getValues();
// for (LovValue lovValue : lovValueList) {
// lovValue.getDisplayValue();
// }
// String lovUid = property.getPropertyDescription().getLovUid();
// ModelObject[] items = loadObjects(new String[] {lovUid}, dmService);
// if (items == null || items.length <= 0) {
// return property.getDisplayableValue();
// }
// // dmService.getProperties(items, new String[] { "lov_name" });
// return property.getDisplayableValue();
// String lovName = items[0].getPropertyObject("lov_name").getStringValue();
// String value = getLovDisValue(lovName, property.getDisplayableValue());
// if (value != null && !value.equals(""))
@ -1572,42 +1552,27 @@ 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();
// 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();
ns.locales = new String[] {"zh_CN"};
// 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();
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];
}
// return property.getDisplayableValue();
//return property.getDisplayableValue();
} else {
if (itemNames[itemNames.length - 1].compareTo("object_type") == 0) {
return property.getStringValue();

Loading…
Cancel
Save