Compare commits

...

2 Commits

@ -12,6 +12,7 @@ import com.teamcenter.clientx.Utils;
import com.teamcenter.services.strong.administration.PreferenceManagementRestBindingStub; import com.teamcenter.services.strong.administration.PreferenceManagementRestBindingStub;
import com.teamcenter.services.strong.administration.PreferenceManagementService; import com.teamcenter.services.strong.administration.PreferenceManagementService;
import com.teamcenter.services.strong.administration._2012_09.PreferenceManagement; 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.ServiceData;
import com.teamcenter.soa.client.model.strong.User; import com.teamcenter.soa.client.model.strong.User;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -101,9 +102,11 @@ public class IgtcoaApi {
String task_Uid = String task_Uid =
propertyMap.containsKey("task_uid") ? propertyMap.get("task_uid").toString() : ""; propertyMap.containsKey("task_uid") ? propertyMap.get("task_uid").toString() : "";
// String taskWorkFlowUID = // String taskWorkFlowUID =
// propertyMap.containsKey("TaskWorkFlowUID") ? propertyMap.get("TaskWorkFlowUID").toString() : ""; // propertyMap.containsKey("TaskWorkFlowUID") ?
// propertyMap.get("TaskWorkFlowUID").toString() : "";
// String taskPackageUID = // String taskPackageUID =
// propertyMap.containsKey("TaskPackageUID") ? propertyMap.get("TaskPackageUID").toString() : ""; // propertyMap.containsKey("TaskPackageUID") ?
// propertyMap.get("TaskPackageUID").toString() : "";
String task_name = String task_name =
propertyMap.containsKey("task_name") ? propertyMap.get("task_name").toString() : ""; propertyMap.containsKey("task_name") ? propertyMap.get("task_name").toString() : "";
String task_CustomerNameBilingUnit = String task_CustomerNameBilingUnit =
@ -197,8 +200,7 @@ public class IgtcoaApi {
productApplicationFieldOrIndustry, productApplicationFieldOrIndustry,
productApplicationPart, productApplicationPart,
productType); productType);
if(productValue.length() > 256) if (productValue.length() > 256) {
{
return JsonResult.error("产品属性值超长"); return JsonResult.error("产品属性值超长");
} }
productList.add(productValue); productList.add(productValue);
@ -245,8 +247,7 @@ public class IgtcoaApi {
String fileUrl = key; String fileUrl = key;
byte[] buffer = Utils.getFile(fileUrl); byte[] buffer = Utils.getFile(fileUrl);
Date date = new Date(); Date date = new Date();
String filePath = String filePath = System.getProperty("java.io.tmpdir") + dateFormat.format(date) + "\\";
System.getProperty("java.io.tmpdir") + dateFormat.format(date) + "\\";
File file = new File(filePath); File file = new File(filePath);
if (!file.exists()) { if (!file.exists()) {
file.mkdir(); file.mkdir();
@ -336,13 +337,9 @@ public class IgtcoaApi {
// String // String
try { try {
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
Utils.setLog(logFileName, "oaCreateWorkFlow", "TC服务器出错" + ex.getMessage()); Utils.setLog(logFileName, "oaCreateWorkFlow", "TC服务器出错" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
@ -386,15 +383,10 @@ public class IgtcoaApi {
@PostMapping(value = "/oaGetDeliveryInfo") @PostMapping(value = "/oaGetDeliveryInfo")
public Object getDeliveryInfo(@RequestBody List<String> itemIdList) { 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); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try { try {
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
@ -402,26 +394,22 @@ public class IgtcoaApi {
Object object = TcsoaService.osGetDeliveryInfo(itemIdList); Object object = TcsoaService.osGetDeliveryInfo(itemIdList);
return object; return object;
} }
// @UserLoginToken // @UserLoginToken
@PostMapping(value = "/oaGetHistoryDelivery") @PostMapping(value = "/oaGetHistoryDelivery")
public Object getHistoryDelivery(HttpServletRequest request) { public Object getHistoryDelivery(HttpServletRequest request) {
String deliveryId = request.getParameter("deliveryId"); String deliveryId = request.getParameter("deliveryId");
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try { try {
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
Object Object = TcsoaService.oaGetHistoryDelivery(deliveryId); Object Object = TcsoaService.oaGetHistoryDelivery(deliveryId);
return Object; return Object;
} }
// @UserLoginToken // @UserLoginToken
@GetMapping(value = "/oaGetDeliveryFile") @GetMapping(value = "/oaGetDeliveryFile")
public void getGetDeliveryFile(HttpServletRequest request, HttpServletResponse response) { public void getGetDeliveryFile(HttpServletRequest request, HttpServletResponse response) {
@ -430,14 +418,10 @@ public class IgtcoaApi {
System.out.println("oaGetDeliveryFile" + deliveryId); System.out.println("oaGetDeliveryFile" + deliveryId);
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try { try {
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
@ -517,14 +501,10 @@ public class IgtcoaApi {
propertyMap, propertyMap,
logFileName); logFileName);
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
try { try {
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
Utils.setLog(logFileName, "oaCreateOrUpdateProject", "TC服务器登录出错" + ex.getMessage()); Utils.setLog(logFileName, "oaCreateOrUpdateProject", "TC服务器登录出错" + ex.getMessage());
@ -532,7 +512,8 @@ 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 = String objectName =
propertyMap.containsKey("objectName") ? propertyMap.get("objectName").toString() : ""; propertyMap.containsKey("objectName") ? propertyMap.get("objectName").toString() : "";
String projectUID = String projectUID =
@ -630,13 +611,9 @@ public class IgtcoaApi {
public JsonResult getItemProperty(@RequestBody List<String> itemIdList) { public JsonResult getItemProperty(@RequestBody List<String> itemIdList) {
String logFileName = dateFormatLog.format(new Date()); String logFileName = dateFormatLog.format(new Date());
try { try {
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
Utils.setLog(logFileName, "getItemProperty", "TC服务器出错" + ex.getMessage()); Utils.setLog(logFileName, "getItemProperty", "TC服务器出错" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();
@ -648,18 +625,13 @@ public class IgtcoaApi {
return jsonResult; return jsonResult;
} }
@GetMapping(value = "/getProjectItemProperty") @GetMapping(value = "/getProjectItemProperty")
public JsonResult getProjectItemProperty(@RequestParam("uid") String uid) { public JsonResult getProjectItemProperty(@RequestParam("uid") String uid) {
String logFileName = dateFormatLog.format(new Date()); String logFileName = dateFormatLog.format(new Date());
try { try {
if (tcSession == null) {
tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL);
}
if (tcUser == null) {
tcUser = tcUser =
tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD);
}
} catch (Exception ex) { } catch (Exception ex) {
Utils.setLog(logFileName, "getProjectItemProperty", "TC服务器出错" + ex.getMessage()); Utils.setLog(logFileName, "getProjectItemProperty", "TC服务器出错" + ex.getMessage());
ex.printStackTrace(); ex.printStackTrace();

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

Loading…
Cancel
Save