package com.pjb.springbootjjwt.api; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.pjb.springbootjjwt.SpringbootJjwtApplication; import com.pjb.springbootjjwt.entity.*; import com.pjb.springbootjjwt.service.IgtcoaServer; import com.pjb.springbootjjwt.service.TcsoaService; import com.teamcenter.clientx.AppXSession; // import com.teamcenter.services.loose.core._2006_03.FileManagement; 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; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; import java.io.*; import java.net.URLEncoder; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; @RestController // @RequestMapping("igtcoa") public class IgtcoaApi { @Autowired IgtcoaServer igtcoaServer; private static AppXSession tcSession; private static User tcUser; private static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS"); private static SimpleDateFormat dateFormatLog = new SimpleDateFormat("yyyyMMddHHmmss"); // @UserLoginToken @PostMapping(value = "/oaCreateWorkFlow") public JsonResult createWorkFlow(@RequestBody JSONObject jsonObject) { // "type": "Project" String logFileName = dateFormatLog.format(new Date()); // 添加日志记录传递的参数及报错信息 Utils.setLog(logFileName, "oaCreateWorkFlow", jsonObject.toString()); HashMap itemObjectPropMap = new HashMap< String, com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct>(); HashMap revObjectPropMap = new HashMap< String, com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct>(); HashMap revMasterObjectPropMap = new HashMap< String, com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct>(); Map fileMap = new HashMap(); Map propertyMap = new HashMap(); // Map postValueMap = jsonObject.getInnerMap(); // for (String key : postValueMap.keySet()) { // Object value = postValueMap.get(key); // if (value != null) { // System.out.println("key:" + key + " value:" + value.toString()); // // 获取属性及位置 // if (key.indexOf(".") > 0) { // String itemWhere = key.split(".")[0]; // String itemName = key.split(".")[1]; // com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct valueVecStruct // = // new com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct(); // valueVecStruct.stringVec = new String[] {value.toString()}; // switch (itemWhere) { // case "item": // itemObjectPropMap.put(itemName, valueVecStruct); // break; // case "rev": // revObjectPropMap.put(itemName, valueVecStruct); // break; // case "revMaster": // revMasterObjectPropMap.put(itemName, valueVecStruct); // break; // } // } // } // } Utils.getData( jsonObject.toString(), itemObjectPropMap, revObjectPropMap, revMasterObjectPropMap, fileMap, propertyMap, logFileName); // Utils.getData(); // 获取必要的属性 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 task_name = propertyMap.containsKey("task_name") ? propertyMap.get("task_name").toString() : ""; String task_CustomerNameBilingUnit = propertyMap.containsKey("project_CustomerNameBilingUnit") ? propertyMap.get("project_CustomerNameBilingUnit").toString() : ""; String project_Projectname = propertyMap.containsKey("project_Projectname") ? propertyMap.get("project_Projectname").toString() : ""; String project_ProjectCode = propertyMap.containsKey("project_ProjectCode") ? propertyMap.get("project_ProjectCode").toString() : ""; String project_ProjectLevel = propertyMap.containsKey("project_ProjectLevel") ? propertyMap.get("project_ProjectLevel").toString() : ""; String task_product = propertyMap.containsKey("task_product") ? propertyMap.get("task_product").toString() : ""; String project_id = propertyMap.containsKey("project_id") ? propertyMap.get("project_id").toString() : ""; String project_uid = propertyMap.containsKey("project_uid") ? propertyMap.get("project_uid").toString() : ""; // String project_name = request.getParameter("project_name"); // "type": "Task" // String task_delivery = request.getParameter("task_delivery"); // String task_uid = request.getParameter("task_uid"); // String task_type = request.getParameter("task_type"); // String task_priority = request.getParameter("task_priority"); // String task_progress = request.getParameter("task_progress"); // String task_duration = request.getParameter("task_duration"); // String task_actualStartTime = request.getParameter("task_actualStartTime"); // String task_actualEndTime = request.getParameter("task_actualEndTime"); // String task_startTime = request.getParameter("task_startTime"); // String task_endTime = request.getParameter("task_endTime"); // String task_planWorkTime = request.getParameter("task_planWorkTime"); // String task_description = // request.getParameter("task_description")!=null?request.getParameter("task_description"):""; // String task_Dstype = request.getParameter("task_Dstype"); // String task_Dsigner = request.getParameter("task_Dsigner"); // String task_YPdata = request.getParameter("task_YPdata"); String user_id = propertyMap.containsKey("user_id") ? propertyMap.get("user_id").toString() : ""; Object userIdObject = propertyMap.get("user_id"); if (userIdObject instanceof JSONArray) { JSONArray jsonArray = JSONArray.parseArray(userIdObject.toString()); user_id = jsonArray.getString(0); } // 获取产品信息 String productJson = propertyMap.containsKey("product") ? propertyMap.get("product").toString() : null; List productList = new ArrayList(); if (productJson != null) { JSONArray jsonArray = JSONArray.parseArray(productJson); for (Object o : jsonArray) { if (o instanceof JSONObject) { JSONObject productJsonObject = JSONObject.parseObject(o.toString()); String cUproductModel = productJsonObject.containsKey("cUproductModel") ? productJsonObject.getString("cUproductModel") : "产品型号"; String bearingCategory = productJsonObject.containsKey("bearingCategory") ? productJsonObject.getString("bearingCategory") : "轴承类别"; String plant = productJsonObject.containsKey("plant") ? productJsonObject.getString("plant") : "工厂全称"; String productApplicationFieldOrIndustry = productJsonObject.containsKey("productApplicationFieldOrIndustry") ? productJsonObject.getString("productApplicationFieldOrIndustry") : "产品应用领域/行业"; String productApplicationPart = productJsonObject.containsKey("productApplicationPart") ? productJsonObject.getString("productApplicationPart") : "产品应用部位"; String productType = productJsonObject.containsKey("productType") ? productJsonObject.getString("productType") : "产品类型"; // 拼接产品属性的值 String productValue = String.format( "[%s][%s][%s][%s][%s][%s]", cUproductModel, bearingCategory, plant, productApplicationFieldOrIndustry, productApplicationPart, productType); if (productValue.length() > 256) { return JsonResult.error("产品属性值超长"); } productList.add(productValue); } } } com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct valueVecStruct = new com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct(); valueVecStruct.stringVec = productList.toArray(new String[productList.size()]); revObjectPropMap.put("rb3_aryProductInfo", valueVecStruct); // String user_id = // user_id = user_id.substring(1,user_id.length()-1); // user_id = user_id.split(",")[0]; // 任务说明拼接 云派+任务名称+客户名+项目名称+项目编号+项目等级+产品型号+设计类型+设计人+样品交期 fnd0Instructions String taskInstruction = "云派" + ((task_name != null && task_name != "") ? "+" + task_name : "任务名称") + ((project_Projectname != null && project_Projectname != "") ? "+" + project_Projectname : "项目名称"); System.out.println(taskInstruction); if (taskInstruction.length() > 128) { taskInstruction = taskInstruction.substring(0, 124) + "..."; // Utils.setLog(logFileName, "oaCreateWorkFlow", "流程名称过长"); // return JsonResult.error("流程名称过长"); } // 获取附件 List fileList = new ArrayList(); try { // MultiValueMap fileMap = ((StandardMultipartHttpServletRequest) // request).getMultiFileMap(); // // System.out.println("fileMap.size();:"+fileMap.size()); // Collection files = fileMap.values(); // for(MultipartFile file :files){ // String fileName = file.getName(); // System.out.println("fileName:"+fileName); // } for (String key : fileMap.keySet()) { String fileName = fileMap.get(key); String fileUrl = key; byte[] buffer = Utils.getFile(fileUrl); Date date = new Date(); String filePath = System.getProperty("java.io.tmpdir") + dateFormat.format(date) + "\\"; File file = new File(filePath); if (!file.exists()) { file.mkdir(); } File targetFile = new File(filePath + fileName); System.out.println("==================AddPath:" + filePath + fileName); OutputStream outStream = new FileOutputStream(targetFile); outStream.write(buffer); outStream.close(); fileList.add(targetFile); } // if (jsonObject.containsKey("fileList")) { // // 获取文件 // JSONArray fileArray = jsonObject.getJSONArray("fileList"); // if (fileArray != null && fileArray.size() > 0) { // List files = fileArray.toJavaList(JSONObject.class); // for (JSONObject file : files) { // String fileName = file.get("fileName").toString(); // String fileUrl = file.get("fileUrl").toString(); // byte[] buffer = Utils.getFile(fileUrl); // // File targetFile = new File("C://temp//" + fileName); // System.out.println("==================AddPath:C://temp//" + fileName); // OutputStream outStream = new FileOutputStream(targetFile); // outStream.write(buffer); // outStream.close(); // fileList.add(targetFile); // } // } // } // jsonObject.getString("fileList"); // Collection parts = request.getParts(); // for (Part part1 : parts) { // String fileName = part1.getSubmittedFileName(); // if (fileName != null) { // InputStream initialStream = part1.getInputStream(); // byte[] buffer = new byte[initialStream.available()]; // initialStream.read(buffer); // // File targetFile = new File("C://temp//" + fileName); // System.out.println("==================AddPath:C://temp//" + fileName); // OutputStream outStream = new FileOutputStream(targetFile); // outStream.write(buffer); // outStream.close(); // fileList.add(targetFile); // } // } } catch (Exception e) { Utils.setLog(logFileName, "oaCreateWorkFlow", "获取文件出错" + e.getMessage()); return JsonResult.error("获取文件出错" + e.getMessage()); } // catch (ServletException e) { // e.printStackTrace(); // } System.out.println("fileList.size():" + fileList.size()); System.out.println("=========================================="); System.out.println("task_uid:" + task_Uid); // System.out.println("task_id:" + task_id); System.out.println("task_name:" + task_name); System.out.println("user_id:" + user_id); System.out.println("project_uid:" + project_uid); System.out.println("project_id:" + project_id); // System.out.println("project_name:" + project_name); System.out.println("task_CustomerNameBilingUnit:" + task_CustomerNameBilingUnit); System.out.println("task_product:" + task_CustomerNameBilingUnit); System.out.println("project_Projectname:" + project_Projectname); System.out.println("project_ProjectCode:" + project_ProjectCode); System.out.println("project_ProjectLevel:" + project_ProjectLevel); // System.out.println("task_Dstype:" + task_Dstype); // System.out.println("task_Dsigner:" + task_Dsigner); // System.out.println("task_YPdata:" + task_YPdata); System.out.println("=========================================="); // System.out.println("userId:" + request.getParameter("userId")); // System.out.println("projectUID:" + request.getParameter("projectUID")); // System.out.println( // "CustomerNameBillingUnit:" + request.getParameter("customerNameBillingUnit")); // System.out.println("CustomerLevel:" + request.getParameter("customerLevel")); // System.out.println("objectName:" + request.getParameter("objectName")); // System.out.println("ProjectCode:" + request.getParameter("projectCode")); // System.out.println("type:" + request.getParameter("type")); // System.out.println("ProjectLevel:" + request.getParameter("projectLevel")); // System.out.println("objectDesc:" + request.getParameter("objectDesc")); // System.out.println("fields:" + request.getParameter("fields")); // System.out.println("PartWhereUse:" + request.getParameter("partWhereUse")); // System.out.println("ComponentVehicle:" + request.getParameter("componentVehicle")); // System.out.println("product:" + request.getParameter("product")); // String try { tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); tcUser = tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); } catch (Exception ex) { Utils.setLog(logFileName, "oaCreateWorkFlow", "TC服务器出错" + ex.getMessage()); ex.printStackTrace(); return JsonResult.error("TC服务器登录出错" + ex.getMessage()); } try { JsonResult jsonResult = TcsoaService.osCreateWorkFlow( task_Uid, task_name, user_id, taskInstruction, fileList, project_uid, itemObjectPropMap, revObjectPropMap, revMasterObjectPropMap, logFileName); Utils.setLog(logFileName, "oaCreateWorkFlow", "任务包返回信息:" + jsonResult.toString()); return jsonResult; } catch (Exception e) { Utils.setLog(logFileName, "oaCreateWorkFlow", "TC服务器出错" + e.getMessage()); e.printStackTrace(); return JsonResult.error("TC服务器出错" + e.getMessage()); } } protected boolean ServiceDataError(final ServiceData data) { if (data.sizeOfPartialErrors() > 0) { for (int i = 0; i < data.sizeOfPartialErrors(); i++) { for (String msg : data.getPartialError(i).getMessages()) System.out.println(msg); } return true; } return false; } // @UserLoginToken @PostMapping(value = "/oaGetDeliveryInfo") public Object getDeliveryInfo(@RequestBody List itemIdList) { // String deliveryId = request.getParameter("deliveryId"); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); try { tcUser = tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); } catch (Exception ex) { ex.printStackTrace(); } Object object = TcsoaService.osGetDeliveryInfo(itemIdList); return object; } // @UserLoginToken @PostMapping(value = "/oaGetHistoryDelivery") public Object getHistoryDelivery(HttpServletRequest request) { String deliveryId = request.getParameter("deliveryId"); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); try { 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) { String deliveryId = request.getParameter("deliveryId"); String deliberyRevision = request.getParameter("deliberyRevision"); System.out.println("oaGetDeliveryFile" + deliveryId); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); try { tcUser = tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); } catch (Exception ex) { ex.printStackTrace(); } File file = TcsoaService.getGetDeliveryFile(deliveryId, deliberyRevision); // 1.获取要下载的文件的绝对路径 if (file == null) { response.setStatus(400); return; } String realPath = file.getAbsolutePath(); // 2.获取要下载的文件名 String fileName = realPath.substring(realPath.lastIndexOf("\\") + 1); // 3.设置content-disposition响应头控制浏览器以下载的形式打开文件 // try { try { fileName = URLEncoder.encode(fileName, "UTF-8"); response.setHeader( "content-disposition", "attachment;filename=" + fileName.replaceAll("\\+", "%20")); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } // } catch (UnsupportedEncodingException e) { // e.printStackTrace(); // } // 4.获取要下载的文件输入流 InputStream in = null; try { in = new FileInputStream(realPath); int len = 0; // 5.创建数据缓冲区 byte[] buffer = new byte[1024]; // 6.通过response对象获取OutputStream流 OutputStream out = response.getOutputStream(); // 7.将FileInputStream流写入到buffer缓冲区 while ((len = in.read(buffer)) > 0) { // 8.使用OutputStream将缓冲区的数据输出到客户端浏览器 out.write(buffer, 0, len); } in.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } @PostMapping(value = "/oaCreateOrUpdateProject") // public Object createOrUpdateProject(@RequestBody ProjectData data) { public Object createOrUpdateProject(@RequestBody JSONObject jsonObject) { // String json = // "{\"productMaterialNumber\":\"1231\",\"productApplicationFieldOrIndustry\":\"A11底盘系统\",\"sampleType\":\"8888\",\"bearingCategory\":\"调心球轴承\",\"customerPoductCode\":\"15155\",\"cUproductModel\":\"DAC2F90F3543\",\"plant\":\"杭州人本-轨道交通\",\"objectName\":\"DAC2F90F3543\",\"productApplicationPart\":\"22200\",\"cycleStatus\":\"6226ce3ae4b09a8828b1cda9\",\"customerProjectName\":\"158494894\",\"productType\":\"全新新产品\",\"objectDesc\":\"55555\"},{\"productMaterialNumber\":\"22\",\"productApplicationFieldOrIndustry\":\"A45航空\",\"sampleType\":\"222\",\"bearingCategory\":\"调心球轴承\",\"customerPoductCode\":\"55\",\"cUproductModel\":\"122\",\"plant\":\"黄石人本-轨道交通\",\"objectName\":\"45\",\"productApplicationPart\":\"4541\",\"cycleStatus\":\"6226ce3ae4b09a8828b1cda9\",\"customerProjectName\":\"1532\",\"productType\":\"全新新产品\",\"objectDesc\":\"123\"},{\"productMaterialNumber\":\"22\",\"productApplicationFieldOrIndustry\":\"A45航空\",\"sampleType\":\"222\",\"bearingCategory\":\"调心球轴承\",\"customerPoductCode\":\"55\",\"cUproductModel\":\"122\",\"plant\":\"黄石人本-轨道交通\",\"objectName\":\"45\",\"productApplicationPart\":\"4541\",\"cycleStatus\":\"6226ce3ae4b09a8828b1cda9\",\"customerProjectName\":\"1532\",\"productType\":\"全新新产品\",\"objectDesc\":\"123\"}"; String logFileName = dateFormatLog.format(new Date()); // 添加日志记录传递的参数及报错信息 Utils.setLog(logFileName, "oaCreateOrUpdateProject", jsonObject.toString()); HashMap itemObjectPropMap = new HashMap< String, com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct>(); HashMap revObjectPropMap = new HashMap< String, com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct>(); HashMap revMasterObjectPropMap = new HashMap< String, com.teamcenter.services.strong.core._2007_01.DataManagement.VecStruct>(); Map fileMap = new HashMap(); Map propertyMap = new HashMap(); Utils.getData( jsonObject.toString(), itemObjectPropMap, revObjectPropMap, revMasterObjectPropMap, fileMap, propertyMap, logFileName); tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); try { tcUser = tcSession.login(SpringbootJjwtApplication.TC_USER, SpringbootJjwtApplication.TC_PWD); } catch (Exception ex) { Utils.setLog(logFileName, "oaCreateOrUpdateProject", "TC服务器登录出错" + ex.getMessage()); ex.printStackTrace(); } // 获取必须的属性 String userId = propertyMap.containsKey("designTeam") ? propertyMap.get("designTeam").toString() : "admin"; String objectName = propertyMap.containsKey("objectName") ? propertyMap.get("objectName").toString() : ""; String projectUID = propertyMap.containsKey("projectUID") ? propertyMap.get("projectUID").toString() : ""; System.out.println("userId:" + userId); System.out.println("objectName:" + objectName); System.out.println("projectUID:" + projectUID); ProjectData data = new ProjectData(); data.setUserId(userId); data.setProjectUID(projectUID); // data.setCustomerNameBillingUnit(request.getParameter("customerNameBillingUnit")); // data.setCustomerLevel(request.getParameter("customerLevel")); data.setObjectName(objectName); // data.setProjectCode(request.getParameter("projectCode")); // data.setType(request.getParameter("type")); // data.setProjectLevel(request.getParameter("projectLevel")); // data.setObjectDesc(request.getParameter("objectDesc")); // data.setFields(request.getParameter("fields")); // data.setPartWhereUse(request.getParameter("partWhereUse")); // data.setComponentVehicle(request.getParameter("componentVehicle")); // data.setUid(request.getParameter("uid")); // System.out.println("userId:" + request.getParameter("userId")); // System.out.println("projectUID:" + request.getParameter("projectUID")); // System.out.println( // "CustomerNameBillingUnit:" + request.getParameter("customerNameBillingUnit")); // System.out.println("CustomerLevel:" + request.getParameter("customerLevel")); // System.out.println("objectName:" + request.getParameter("objectName")); // System.out.println("ProjectCode:" + request.getParameter("projectCode")); // System.out.println("type:" + request.getParameter("type")); // System.out.println("ProjectLevel:" + request.getParameter("projectLevel")); // System.out.println("objectDesc:" + request.getParameter("objectDesc")); // System.out.println("fields:" + request.getParameter("fields")); // System.out.println("PartWhereUse:" + request.getParameter("partWhereUse")); // System.out.println("ComponentVehicle:" + request.getParameter("componentVehicle")); // System.out.println("product:" + request.getParameter("product")); // System.out.println("uid:" + request.getParameter("uid")); try { String productJson = propertyMap.containsKey("product") ? propertyMap.get("product").toString() : null; if (productJson != null) { List productList = new ArrayList(); JSONArray jsonArray = JSONArray.parseArray(productJson); for (Object o : jsonArray) { if (o instanceof JSONObject) { JSONObject productJsonObject = JSONObject.parseObject(o.toString()); if (productJsonObject.containsKey("bearingCategory") && productJsonObject.containsKey("plant")) { Product product = new Product(); product.setBearingCategory(productJsonObject.getString("bearingCategory")); product.setPlant(productJsonObject.getString("plant")); productList.add(product); } } } // List subStringList = new ArrayList(); // while (productJson.lastIndexOf("}") != productJson.indexOf("}")) { // subStringList.add(productJson.substring(0, productJson.indexOf("}") + 1)); // productJson = productJson.substring(productJson.indexOf("}") + 2, // productJson.length()); // System.out.println(); // } // subStringList.add(productJson); // List productList = new ArrayList(); // for (String json : subStringList) { // System.out.println("productJson:" + json); // Product product = JSONObject.parseObject(json, Product.class); // productList.add(product); // } data.setProduct(productList); } String projectPUID = TcsoaService.createOrUpdataProject( data, itemObjectPropMap, revObjectPropMap, revMasterObjectPropMap, logFileName); Utils.setLog(logFileName, "oaCreateOrUpdateProject", "项目UID:" + projectPUID); System.out.println("projectUID:" + projectPUID); JSONObject resultJSONObject = new JSONObject(); resultJSONObject.put("Status", true); resultJSONObject.put("ErrorMessage", ""); resultJSONObject.put("projectUID", projectPUID); return resultJSONObject; } catch (Exception ex) { Utils.setLog(logFileName, "oaCreateOrUpdateProject", "TC服务器出错" + ex.getMessage()); JSONObject resultJSONObject = new JSONObject(); resultJSONObject.put("Status", false); resultJSONObject.put("ErrorMessage", "TC服务器出错" + ex.getMessage()); resultJSONObject.put("projectUID", ""); ex.printStackTrace(); return resultJSONObject; } } @PostMapping(value = "/getItemProperty") public JsonResult getItemProperty(@RequestBody List itemIdList) { String logFileName = dateFormatLog.format(new Date()); try { tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); 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()); return jsonResult; } @GetMapping(value = "/getProjectItemProperty") public JsonResult getProjectItemProperty(@RequestParam("uid") String uid) { String logFileName = dateFormatLog.format(new Date()); try { tcSession = new AppXSession(SpringbootJjwtApplication.TC_URL); 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()); return jsonResult; } }