From 706d57aa682845cf1bc01cbfd1087c4c0f33093f Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期二, 12 十一月 2024 09:46:48 +0800 Subject: [PATCH] 优化 --- jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java | 277 ++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 230 insertions(+), 47 deletions(-) diff --git a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java index cb79010..09ebfc2 100644 --- a/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java +++ b/jcdm-main/src/main/java/com/jcdm/main/plcserver/sub/OPCUaSubscription.java @@ -8,6 +8,7 @@ import cn.hutool.json.JSONObject; import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.jcdm.framework.websocket.WebSocketUsers; import com.jcdm.main.constant.Constants; import com.jcdm.main.da.cellData.service.IDaCellDataService; @@ -25,13 +26,18 @@ import com.jcdm.main.restful.qingYan.doman.ChildVO; import com.jcdm.main.restful.qingYan.doman.ParentVO; import com.kangaroohy.milo.model.ReadWriteEntity; +import com.kangaroohy.milo.model.WriteEntity; import com.kangaroohy.milo.runner.subscription.SubscriptionCallback; import com.kangaroohy.milo.service.MiloService; import lombok.extern.slf4j.Slf4j; +import org.apache.xmlbeans.GDate; +import org.eclipse.milo.opcua.stack.core.types.builtin.DateTime; +import org.eclipse.milo.opcua.stack.core.types.builtin.Variant; import org.springframework.stereotype.Component; import javax.websocket.Session; import java.text.SimpleDateFormat; +import java.time.LocalDateTime; import java.util.*; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @@ -102,35 +108,114 @@ try{ if (Constants.RECORD_DATA.equals(tab)) { //鍑哄叆绔� if (Constants.ONE.equals(valueString)) {//鍏ョ珯 - Integer recordDataDone = 11; - miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build()); - } else if(Constants.TWO.equals(valueString)){//鍑虹珯 - Integer result = 21; - //鍏堝垽鏂槸鍚︽湁浜у搧SN - Object snCodeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue(); - Object orderObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".WorkOrderNumber").getValue(); - if (ObjectUtil.isNull(snCodeObjcet)){ - result = 25;//鏈幏鍙栬鐢熶骇鐨勫伐鍗曪紝璇疯仈绯荤鐞嗗憳 - }else{ - String snCode = snCodeObjcet.toString();//浜у搧SN - String orderNumber = orderObjcet.toString();//宸ュ崟鍙� - Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//绔欑姸鎬佸湴鍧� - if (ObjectUtil.isNotNull(stationStatusObjcet)){ - String stationStatus = stationStatusObjcet.toString(); - result = savePassingStation(thoroughfare, device,snCode,orderNumber,stationStatus);//淇濆瓨杩囩珯 - if(result == 21) { - result = saveParamCollection(device,snCode,orderNumber,stationStatus);//淇濆瓨鍙傛暟锛屽彂閫佸伐鍘侻ES - } + if(Constants.OP040_OP160.contains(device)){//浜哄伐宸ヤ綅 + Object snCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue(); + if (ObjectUtil.isNull(snCodeObject)){ + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); }else{ - result = 23; - log.info("璇诲彇鍒板伐浣峽}StationStatus鏁版嵁锛歿},杩斿洖RecordDataDone鐨勫�间负{}",device,"IS NULL锛�",result); + String productNum = snCodeObject.toString().trim(); + if(productNum.length()<10){ + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); + }else{ + //灏嗕骇鍝丼N鍙戦�佸埌鍓嶅彴 + productNum = "productNum,"+ productNum; + WebSocketUsers.sendMessageToUserByText(map.get(device), productNum); + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(11).build()); + String str = thoroughfare + "." + device + ".MESScrew"; + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(str).value(1).build());//鎷х揣姝ラ + } + } + }else {//鑷姩宸ヤ綅 + Object snCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue(); + if (ObjectUtil.isNull(snCodeObject)){ + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(12).build()); + }else{ + //鎵�鏈夎繘绔欏皢杩涚珯鏃堕棿鍐欑粰PLC + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currentDate = dateFormat.format(new Date()); + miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StartTime").value(currentDate).build()); + + Integer recordDataDone = 11; + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(recordDataDone).build()); + } + } - miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); + + } else if(Constants.TWO.equals(valueString)){//鍑虹珯 + if(Constants.OP040_OP160.contains(device)){//浜哄伐宸ヤ綅 + if(Constants.OP165.equals(device)){ + WebSocketUsers.sendMessageToUserByText(map.get(device), "print");//鎵撳嵃 + }else { + WebSocketUsers.sendMessageToUserByText(map.get(device), "END"); + } + } else if (Constants.OP0170_OP220.contains(device)) { + WebSocketUsers.sendMessageToUserByText(map.get(device), "END"); + } else{//鑷姩宸ヤ綅 + //鍏堝垽鏂槸鍚︽湁浜у搧SN + Object snCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + ".SNCode").getValue(); + Object orderObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".WorkOrderNumber").getValue(); + if (ObjectUtil.isNull(snCodeObject)){ + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(25).build()); + }else { + + Integer result = 21; + String snCode = snCodeObject.toString().trim();//浜у搧SN + String orderNumber = orderObjcet.toString().trim();//宸ュ崟鍙� + if(snCode.length()<10){ + result = 22; + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); + }else { + //鎵�鏈夊嚭绔欏皢鍑虹珯鏃堕棿鍐欑粰PLC + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currentDate = dateFormat.format(new Date()); + miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".StopTime").value(currentDate).build()); + + Object stationStatusObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".StationStatus").getValue();//绔欑姸鎬佸湴鍧� + if (ObjectUtil.isNotNull(stationStatusObjcet)) { + String stationStatus = stationStatusObjcet.toString(); + if (Constants.OP010.equals(device)) { + Object housingCodeObject = miloService.readFromOpcUa(thoroughfare + "." + device + ".HousingCode").getValue();//澹充綋鏉$爜锛屽瓨鍒板伐鍗曪紝杩斾慨鐢� + if (ObjectUtil.isNull(housingCodeObject)){ + result = 25; + }else{ + String housingCode = housingCodeObject.toString();//澹充綋鏉$爜锛屽瓨鍒板伐鍗曪紝杩斾慨鐢� + if(housingCode.length()<10){ + result = 25; + }else{ + CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { + updateOrderStatus(snCode, "3",housingCode);//OP010宸ヤ綅鏇存柊宸ュ崟鐘舵�佷负鎵ц涓�,骞舵洿鏂颁富鐗╂枡澹充綋鏉$爜 + reportFactoryMes(snCode, device, format.format(new Date()));//宸ュ巶MES鎶ュ伐 + }); + } + } + } + if(Constants.OP230.equals(device)){ + WebSocketUsers.sendMessageToUserByText(map.get(device), "twoHundredAndThirtyEND"); + CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { + updateOrderStatus(snCode, "5","");//OP230宸ヤ綅鏇存柊宸ュ崟鐘舵�佷负宸插畬鎴� + reportFactoryMes(snCode, "OP240", format.format(new Date()));//宸ュ巶MES鎶ュ伐 //鏆傛椂 OP240宸ヤ綅杩樻病鏈夊ソ锛屽湪230鎶�240鐨勫伐 + }); + miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".SNCode").value("").build()); + } + if(result == 21){ + result = savePassingStation(thoroughfare, device, snCode, orderNumber, stationStatus);//淇濆瓨杩囩珯 + } + if (result == 21) { + result = saveParamCollection(device, snCode, orderNumber, stationStatus);//淇濆瓨鍙傛暟锛屽彂閫佸伐鍘侻ES + } + } else { + result = 23; + log.info("璇诲彇鍒板伐浣峽}StationStatus鏁版嵁锛歿},杩斿洖RecordDataDone鐨勫�间负{}", device, "IS NULL锛�", result); + } + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordDataDone").value(result).build()); + } + + } + } } }else if (Constants.RECORD_SN.equals(tab)){//璇锋眰浜у搧搴忓垪鍙� if (Constants.ONE.equals(valueString)){ - Integer recordSNDone = 11; //杩涚珯PLC缁欎骇鍝佺被鍨嬶紝MES璇诲彇浜у搧绫诲瀷 Object productTypeObjcet = miloService.readFromOpcUa(thoroughfare + "." + device + ".ProductType").getValue();//浜у搧绫诲瀷 if (ObjectUtil.isNotNull(productTypeObjcet)){ @@ -141,10 +226,22 @@ receivingWorkOrders(thoroughfare, device,materialCode); }); }else{ - recordSNDone = 12; + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(12).build()); } - miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(recordSNDone).build()); + } + }else if(Constants.SCREW.equals(tab)){ + List<String> list = new ArrayList<>(); + String[] suffixes = {"Torque1", "Angle1", "TorqueResult1", "AngleResult1"}; + + for (String suffix : suffixes) { + String string = thoroughfare + "." + device + "." + suffix; + list.add(string); + } + List<ReadWriteEntity> list1 = miloService.readFromOpcUa(list); + List<Object> collect = list1.stream().map(ReadWriteEntity::getValue).collect(Collectors.toList()); + String joinedString = String.join(",", collect.toString()); + WebSocketUsers.sendMessageToUserByText(map.get(device), TightenTheConversionOkNg(joinedString)); } }catch (Exception e) { log.error(e.getMessage()); @@ -167,7 +264,7 @@ Date startTime = new Date(); ReadWriteEntity startTimeRead = miloService.readFromOpcUa(thoroughfare + "." + device + ".StartTime");//杩涚珯鏃堕棿 if (ObjectUtil.isNotNull(startTimeRead.getValue())){ - startTime = format.parse(TimeUtil.test(TimeUtil.stringProcessing(startTimeRead.getValue().toString()))); + startTime = format.parse(startTimeRead.getValue().toString()); }else{ result = 23; log.info("璇诲彇鍒板伐浣峽}鐨凷tartTime鏁版嵁锛歿},杩斿洖RecordDataDone鐨勫�间负{}",device,"IS NULL锛�",result); @@ -225,11 +322,11 @@ String paramValue = ""; if (ObjectUtil.isNotNull(readWriteEntityList.get(i).getValue())){ paramValue = readWriteEntityList.get(i).getValue().toString();//鍙傛暟鍊� - if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ + /*if("DATE".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ paramValue = format.parse(TimeUtil.test(TimeUtil.stringProcessing(paramValue))).toString(); }else if("MODEL".equals(list.get(i).getCollectParameterType()) && !paramValue.isEmpty()){ paramValue = Constants.materialMap.get(paramValue); - } + }*/ } daParamCollection.setParamValue(paramValue);//鍙傛暟鍊� daParamCollection.setLocationCode(device);//宸ヤ綅 @@ -247,13 +344,9 @@ mesList.add(childVO); } - /* CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { + CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { //鎻掑叆鍙傛暟閲囬泦琛� daParamCollectionService.insertBatch(collectionList); - //鐢熶骇鎶ュ伐锛堥宸ヤ綅鍜屾湯宸ヤ綅锛� - if(Constants.OP010.equals(device)) { - reportFactoryMes(snCode, device, format.format(new Date())); - } //涓婁紶鍒板伐鍘俶es ParentVO parentVO = new ParentVO(); parentVO.setStationCode(device);//宸ヤ綅 @@ -261,7 +354,7 @@ parentVO.setRecordId(UUID.randomUUID().toString()); if("2".equals(stationStatus)){//宸ョ珯鐘舵�� parentVO.setTotalResult("0"); - }else { + }else{ parentVO.setTotalResult("1"); } parentVO.setProductNum(snCode); @@ -270,7 +363,7 @@ HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); log.info("鎵ц宸ュ巶MES鏂规硶end锛屽伐浣嶅彿{} 杩斿洖鏁版嵁锛歿}",device,execute.body()); - });*/ + }); } }catch (Exception e) { throw new RuntimeException(e); @@ -295,17 +388,18 @@ List<OmProductionOrdeInfo> orderList = omProductionOrdeInfoService.list(new LambdaQueryWrapper<OmProductionOrdeInfo>() .eq(OmProductionOrdeInfo::getOrderStatus, Constants.ONE) .eq(OmProductionOrdeInfo::getStationCode,device)//宸ヤ綅 - .eq(OmProductionOrdeInfo::getProductCode,materialCode));//浜у搧绫诲瀷 + //.eq(OmProductionOrdeInfo::getProductCode,materialCode) + );//浜у搧绫诲瀷 if (CollUtil.isNotEmpty(orderList)){ Long id = orderList.get(0).getId(); - productNum = orderList.get(0).getProductNum();//妯$粍鐮� + productNum = orderList.get(0).getProductNum();//浜у搧鐮� orderNum = orderList.get(0).getWorkOrderNo(); }else{ // 鏌ヨ鏈�鏂扮殑宸ュ崟淇℃伅 OmProductionOrdeInfo lastOrder = omProductionOrdeInfoService.getLastOrder(); - - log.info("璇锋眰宸ュ巶MES宸ュ崟锛氬叆鍙俤evice{},materialCode锛歿}", device, materialCode); - String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), "M1OP100",materialCode); + //String facMaterialCode = Constants.facMaterialMap.get(materialCode); + log.info("璇锋眰宸ュ巶MES宸ュ崟锛氬叆鍙俤evice{},璇锋眰宸ュ巶鐗╂枡缂栫爜,浜у搧鐗╂枡缂栫爜MaterialCode{}", device,materialCode); + String orderJsonString = RestfulService.getProductionWorkOrderRequest(lastOrder.getProductNum(), device,""); log.info("璇锋眰宸ュ巶MES宸ュ崟锛氬嚭鍙俻ack锛歿}", orderJsonString); JSONObject jsonObject = new JSONObject(orderJsonString); @@ -313,12 +407,13 @@ JSONObject dataObject = jsonObject.getJSONObject("data"); String code = jsonObject.getStr("code"); // 鍒ゆ柇鎺ュ崟鏄惁鎴愬姛 - if(code.equals("success")) { + if("success".equals(code)) { OmProductionOrdeInfo omProductionOrdeInfo = new OmProductionOrdeInfo(); omProductionOrdeInfo.setWorkOrderNo(dataObject.getStr("productionOrderNum")); omProductionOrdeInfo.setProductNum(dataObject.getStr("productNum")); omProductionOrdeInfo.setStationCode(device); - omProductionOrdeInfo.setProductCode(dataObject.getStr("materialCode")); + omProductionOrdeInfo.setProductCode(materialCode); + omProductionOrdeInfo.setMaterialCode(dataObject.getStr("materialCode")); omProductionOrdeInfo.setPlanQty(Long.valueOf(dataObject.getStr("plannedQuantity"))); omProductionOrdeInfo.setOnlineCompletionMark("0"); omProductionOrdeInfo.setSfResult("0"); @@ -333,8 +428,11 @@ } //涓嬪彂浜у搧SN鍜屽伐鍗曞彿 if(!productNum.isEmpty() && !orderNum.isEmpty()){ - miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".ModuleCode").value(productNum).build()); + miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".SNCode").value(productNum).build()); miloService.writeToOpcUa(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".WorkOrderNumber").value(orderNum).build()); + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(11).build()); + }else{ + miloService.writeToOpcShort(ReadWriteEntity.builder().identifier(thoroughfare + "." + device + ".RecordSNDone").value(12).build()); } } catch (Exception e) { @@ -343,23 +441,108 @@ } /** + * 鏇存柊宸ュ崟 + * @param snCode 浜у搧sn + * @param orderStatus 宸ュ崟鐘舵�� + * @param materialCode 澹充綋鏉$爜 + * @throws Exception e + */ + private static void updateOrderStatus(String snCode,String orderStatus,String materialCode){ + try { + //鏇存柊宸ュ崟鐘舵�佷负宸叉墽琛� + LambdaUpdateWrapper<OmProductionOrdeInfo> updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.set(OmProductionOrdeInfo::getOrderStatus,orderStatus); + if(!materialCode.isEmpty()){//涓婄嚎 + updateWrapper.set(OmProductionOrdeInfo::getTrolleyYard,materialCode);//澹充綋鏉$爜 + updateWrapper.set(OmProductionOrdeInfo::getActualStartTime,new Date());//寮�濮嬫椂闂� + }else{//涓嬬嚎 + updateWrapper.set(OmProductionOrdeInfo::getActualEndTime,new Date());//缁撴潫鏃堕棿 + } + updateWrapper.eq(OmProductionOrdeInfo::getProductNum,snCode); + omProductionOrdeInfoService.update(new OmProductionOrdeInfo(),updateWrapper); + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + /** * 宸ュ巶MES鎶ュ伐 * @param productNum 閫氶亾 * @param stationCode 宸ヤ綅 - * @param confirmTime 鐗╂枡鍙� + * @param confirmTime 鏃堕棿 * @throws Exception e */ //{"code":"success","data":{"productNum":"LCV123456P0600036","stationCode":"1HZ01","resultCode":"S","resultText":"鎶ュ伐鎴愬姛"},"message":"API璋冪敤鎴愬姛"} - public static void reportFactoryMes(String productNum, String stationCode, String confirmTime) + public static void reportFactoryMes(String productNum,String stationCode,String confirmTime) { String result = ""; + String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; try { - String url = Constants.FACTORY_EMS_UAT_GET_RUL + "workReportResultFeedback?siteCode="+Constants.FACTORY_EMS_SITE_CODE+"&stationCode="+stationCode+"&productNum="+productNum+"&confirmTime="+confirmTime; + log.info("鎵ц宸ュ巶MES鎶ュ伐鏂规硶start锛屽簭鍒楀彿{}宸ヤ綅鍙穥}url{}",productNum,stationCode ,url); HttpResponse response = HttpRequest.get(url).execute(); - /*HttpRequest httpRequest = HttpRequest.get(url);*/ + //HttpRequest httpRequest = HttpRequest.get(url); result = response.body(); + log.info("鎵ц宸ュ巶MES鎶ュ伐鏂规硶绗竴娆nd锛屽簭鍒楀彿{}宸ヤ綅鍙穥}杩斿洖鏁版嵁{}",productNum,stationCode ,result); }catch (Exception e){ throw new RuntimeException(e); + }finally { + if(result.isEmpty()){ + HttpResponse response = HttpRequest.get(url).execute(); + result = response.body(); + log.info("鎵ц宸ュ巶MES鎶ュ伐鏂规硶绗簩娆nd锛屽簭鍒楀彿{}宸ヤ綅鍙穥}杩斿洖鏁版嵁{}",productNum,stationCode ,result); + } } } + public static String TightenTheConversionOkNg(String param){ + // 鍘婚櫎棣栧熬鐨勬柟鎷彿锛岀劧鍚庢寜鐓ч�楀彿鍒嗗壊瀛楃涓� + String[] parts = param.substring(1, param.length() - 1).split(","); + + // 鍒涘缓涓�涓柊鐨凷tringBuilder鏉ユ瀯寤烘浛鎹㈠悗鐨勫瓧绗︿覆 + StringBuilder sb = new StringBuilder(); + sb.append('['); // 娣诲姞宸︽柟鎷彿 + + for (int i = 0; i < parts.length; i++) { + String part = parts[i].trim(); // 鍘婚櫎鍙兘鐨勭┖鏍� + float value; + try { + value = Float.parseFloat(part); // 灏濊瘯灏嗗瓧绗︿覆杞崲涓烘诞鐐规暟 + String replacement; + if(i<2){ + replacement = part; + }else{ + if (value == 1f) { + replacement = "OK"; + } else{ + replacement = "NG"; + } + } + /* if (value == 1f) { + replacement = "OK"; + } else if (value == 2f) { + replacement = "NG"; + } else { + replacement = part; // 濡傛灉涓嶆槸1鎴�2锛屽垯淇濇寔涓嶅彉 + }*/ + sb.append(replacement); + if (i < parts.length - 1) { + sb.append(','); // 娣诲姞閫楀彿锛堥櫎浜嗘渶鍚庝竴涓厓绱狅級 + } + } catch (NumberFormatException e) { + // 濡傛灉杞崲澶辫触锛屽垯淇濇寔鍘熸牱锛堟垨杩涜鍏朵粬閿欒澶勭悊锛� + sb.append(part); + if (i < parts.length - 1) { + sb.append(','); + } + } + } + sb.append(']'); // 娣诲姞鍙虫柟鎷彿 + return sb.toString(); + } + + /* public static void main(String[] args) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + String currentDate = dateFormat.format(new Date()); + System.out.println(currentDate); + }*/ } -- Gitblit v1.9.3