List of usage examples for java.util ResourceBundle containsKey
public boolean containsKey(String key)
key
is contained in this ResourceBundle
or its parent bundles. From source file:com.evolveum.midpoint.model.impl.validator.ResourceValidatorImpl.java
@NotNull private String getString(ResourceBundle bundle, String key, Object... parameters) { final String resolvedKey; if (key != null) { if (bundle.containsKey(key)) { resolvedKey = bundle.getString(key); } else {//from w w w . j a v a 2 s . c o m resolvedKey = key; } } else { resolvedKey = ""; } final MessageFormat format = new MessageFormat(resolvedKey, bundle.getLocale()); return format.format(parameters); }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_cj_deliveryOrderStatus(String xmlDataString) { // String jsonReturnString = ""; SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.RETRIEVAL_TIME_FORMAT); System.out.println(/*from w w w .ja va 2s . c om*/ "---------------------------?FPAPI_cj_deliveryOrderStatus-------------------------------"); Map orderInfo = XmlUtil.parseXmlFPAPI_SingleNodes(xmlDataString, "//deliveryorderstatus/child::*"); //?? // ?? List<String> colNames = new ArrayList<String>(); List<Object> colValues = new ArrayList<Object>(); colNames.add("BOL"); colValues.add(orderInfo.get("order_code")); List<Map<String, Object>> items = commonManagerMapper.selectTableListByNVList("t_sn_order", colNames, colValues, null, null); //? Map item = null; if (items.size() > 0) { item = items.get(0); } else { return "<deliveryorderstatusreturn><status>fail</status></deliveryorderstatusreturn>"; } // String statusCode = orderInfo.get("status_code") != null ? orderInfo.get("status_code").toString() : ""; if ("001".equals(statusCode) || "005".equals(statusCode)) { colNames.clear(); colValues.clear(); colNames.add("ORDER_STATUS"); colValues.add("1"); commonManagerMapper.updateTableByNVList("t_sn_order", "BOL", orderInfo.get("order_code"), colNames, colValues); } //??--7.10 JSONObject snRequest = new JSONObject(); JSONArray statusList = new JSONArray(); colNames.clear(); colValues.clear(); colNames.add("STATUS_CODE"); colValues.add(orderInfo.get("status_code")); List<Map<String, Object>> statusChangeList = commonManagerMapper .selectTableListByNVList("T_SN_STATUS_CHANGE", colNames, colValues, null, null); for (Map<String, Object> statusChange : statusChangeList) { JSONObject statusSingleItem = new JSONObject(); String statusType = statusChange.get("STATUS_TYPE") != null ? statusChange.get("STATUS_TYPE").toString() : ""; if ("WMS".equals(statusType)) { //orderDetailorderCode List<Map> orderDetailList = snCommonManagerMapper .selectFlightInfo(orderInfo.get("order_code").toString()); for (Map orderDetail : orderDetailList) { statusSingleItem.put("expressNo", orderDetail.get("ORDER_CODE")); statusSingleItem.put("expressCompanyCode", "WMS"); statusSingleItem.put("mailStatus", statusChange.get("CN_CODE")); statusSingleItem.put("address", statusChange.get("CN_REMARK")); statusSingleItem.put("statusType", statusChange.get("STATUS_TYPE")); statusSingleItem.put("time", CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT).format(new Date())); statusList.add(statusSingleItem); } } else if ("TMS".equals(statusType)) { statusSingleItem.put("expressNo", item.get("TMS_ORDER_CODE")); statusSingleItem.put("expressCompanyCode", item.get("TMS_SERVICE_CODE")); statusSingleItem.put("mailStatus", statusChange.get("CN_CODE")); statusSingleItem.put("address", statusChange.get("CN_REMARK")); statusSingleItem.put("statusType", statusChange.get("STATUS_TYPE")); statusSingleItem.put("time", CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT).format(new Date())); statusList.add(statusSingleItem); } } snRequest.put("statusList", statusList); JSONObject content = new JSONObject(); content.put("snRequest", snRequest); Map requestParam = new HashMap(); requestParam.put("logistic_provider_id", CommonUtil.getSystemConfigProperty("SN_deliveryOrderStatusInfo_logistic_provider_id")); requestParam.put("msg_type", CommonUtil.getSystemConfigProperty("SN_deliveryOrderStatusInfo_msg_type")); requestParam.put("url", CommonUtil.getSystemConfigProperty("SN_deliveryOrderStatusInfo_requestUrl")); System.out.println(content.toString()); // ?? String result = send2SN(requestParam, content.toString()); //?t_sn_return_status // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : orderInfo.keySet()) { if (bundle.containsKey("SN_RETURN_STATUS_" + key.toString().toUpperCase())) { if (orderInfo.get(key) == null || orderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_RETURN_STATUS_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_RETURN_STATUS_" + key.toString().toUpperCase()), orderInfo.get(key)); } } } data.put("STATUS_TIME", CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT).format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_RETURN_STATUS", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); return "<deliveryorderstatusreturn><status>success</status></deliveryorderstatusreturn>"; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private int insertOrder(JSONObject orderInfo, JSONObject senderInfo, JSONObject receiverInfo) { ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : orderInfo.keySet()) { if (bundle.containsKey("SN_ORDER_" + key.toString().toUpperCase())) { if (orderInfo.get(key) == null || orderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), orderInfo.get(key)); }/*from w w w . j a va2s . c o m*/ } } for (Object key : senderInfo.keySet()) { if (bundle.containsKey("SN_ORDER_" + key.toString().toUpperCase())) { if (senderInfo.get(key) == null || senderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), senderInfo.get(key)); } } } for (Object key : receiverInfo.keySet()) { if (bundle.containsKey("SN_ORDER_" + key.toString().toUpperCase())) { if (receiverInfo.get(key) == null || receiverInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_ORDER_" + key.toString().toUpperCase()), receiverInfo.get(key)); } } } // ?????receiverAddress?t_sn_order.RECEIVER_ADDRESS? // ???receiverProvincereceiverCityreceiverAreareceiverAddress?t_sn_order // .RECEIVER_ADDRESS String receiverProvince = receiverInfo.get("receiverProvince") != null ? receiverInfo.get("receiverProvince").toString() : ""; String receiverCity = receiverInfo.get("receiverCity") != null ? receiverInfo.get("receiverCity").toString() : ""; String receiverArea = receiverInfo.get("receiverArea") != null ? receiverInfo.get("receiverArea").toString() : ""; String receiverAddress = receiverInfo.get("receiverAddress") != null ? receiverInfo.get("receiverAddress").toString() : ""; data.put("RECEIVER_ADDRESS", receiverProvince + receiverCity + receiverArea + receiverAddress); data.put("ORDER_STATUS", "0"); data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_ORDER", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); return Integer.valueOf(primary.get("primaryId").toString()); }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_Load(String xmlString) { String xmlReturnString = ""; System.out.println("---------------------------?FPAPI_Load-------------------------------"); // /*from w w w. ja va 2 s . c o m*/ // <loadId>?t_new_import_load.LOAD_NO // <total>?t_new_import_load.TOTAL // <TotalWeight>?t_new_import_load.WEIGHT // <CarEcNo>?t_new_import_load.CAR_NO // <tracyNum>?t_new_import_load.TRACY_NUM // STATUS1 // // t_new_import_load.LOAD_ID?t_new_import_load_detail.LOAD_ID // <outorderId>?t_new_import_load_detail.ORDER_NO Map head = null; boolean isSuccess = true; try { // businessType head = XmlUtil.parseXmlFPAPI_SingleNodes(xmlString, "//LoadHead/child::*"); // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); // ? // ? Map mainData = new HashMap(); for (Object key : head.keySet()) { if (bundle.containsKey("load_" + key.toString())) { mainData.put(bundle.getObject("load_" + key.toString()), head.get(key)); } } mainData.put("STATUS", "1"); mainData.put("CREAT_DATE", sf.format(new Date())); mainData.put("CREAT_TIME", new Date()); Map primary = new HashMap(); primary.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_load", new ArrayList<String>(mainData.keySet()), new ArrayList<Object>(mainData.values()), primary); // ?? List<Map> items = XmlUtil.parseXmlFPAPI_MulitpleNodes(xmlString, "//LoadHead/loadContents/loadContent"); for (Map item : items) { Map data = new HashMap(); // ? for (Object key : item.keySet()) { if (bundle.containsKey("load_" + key.toString())) { data.put(bundle.getObject("load_" + key.toString()), item.get(key)); } } // String uniqueCol="SKU"; // String primaryCol="RECEIPT_ID"; // // ? // uniqueCheck("t_new_import_receipt",uniqueCol,data.get(uniqueCol),primaryCol,data.get(primaryCol),false); // ? data.put("LOAD_ID", primary.get("primaryId")); // data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); Map primarySub = new HashMap(); primarySub.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_load_detail", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primarySub); } } catch (Exception e) { e.printStackTrace(); isSuccess = false; } // ? List<LinkedMap> dataList = new ArrayList<LinkedMap>(); for (int i = 0; i < 1; i++) { LinkedMap resultData = new LinkedMap(); resultData.put("loadHeadId", head != null ? head.get("loadHeadId") : ""); resultData.put("loadId", head != null ? head.get("loadId") : ""); resultData.put("returnMessage", isSuccess ? "?" : ""); // resultData.put("errorCode", ""); // resultData.put("errorMsg", ""); dataList.add(resultData); } String root = CommonUtil.getSystemConfigProperty("loadReceiptRoot"); xmlReturnString = XmlUtil.generalReceiptXml_FP(root, null, dataList); return xmlReturnString; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private Map handleOrderC061(String xmlString, ResourceBundle bundle) { Map result = new HashMap(); result.put("isSuccess", true); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); List<Map> items = XmlUtil.parseXmlFPAPI_MulitpleNodes(xmlString, "//orders/orderImformation/orderItems"); for (Map item : items) { Map data = new HashMap(); // ?//from ww w . j a v a 2s . c o m for (Object key : item.keySet()) { if (bundle.containsKey("order_" + key.toString())) { data.put(bundle.getObject("order_" + key.toString()), item.get(key)); } } // String uniqueCol="SKU"; // String primaryCol="RECEIPT_ID"; // // ? // uniqueCheck("t_new_import_receipt",uniqueCol,data.get(uniqueCol),primaryCol,data.get(primaryCol),false); // ? data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); Map primary = new HashMap(); primary.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_receipt", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); } return result; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private void insertOrderDetail(int orderId, JSONObject orderInfo, JSONArray orderItemList) { ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); for (Iterator it = orderItemList.iterator(); it.hasNext();) { JSONObject item = (JSONObject) it.next(); Map primary_sub = new HashMap(); primary_sub.put("primaryId", null); Map dataSub = new HashMap(); for (Object key : item.keySet()) { if (bundle.containsKey("SN_ORDER_DETAIL_" + key.toString().toUpperCase())) { if (item.get(key) == null || item.get(key).toString().isEmpty()) { dataSub.put(bundle.getObject("SN_ORDER_DETAIL_" + key.toString().toUpperCase()), null); } else { dataSub.put(bundle.getObject("SN_ORDER_DETAIL_" + key.toString().toUpperCase()), item.get(key)); }// ww w. j ava2 s. c om } } // ? dataSub.put("ORDER_ID", orderId); dataSub.put("ORDER_CODE", orderInfo.get("orderCode")); dataSub.put("FPS_ORDER_ID", orderInfo.get("fpsOrderId")); dataSub.put("ORDER_NUMBER", orderInfo.get("orderNumber")); // data.put("CREAT_DATE", sf.format(new Date())); dataSub.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_ORDER_DETAIL", new ArrayList<String>(dataSub.keySet()), new ArrayList<Object>(dataSub.values()), primary_sub); } }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_sn_sku(String jsonString) { // String jsonReturnString = ""; System.out.println("---------------------------?FPAPI_SN_SKU-------------------------------"); // /*from ww w. j a v a 2s. c o m*/ JSONObject jsonObject = JSONObject.fromObject(jsonString); JSONArray cmmdtyInfo = (JSONArray) jsonObject.get("cmmdtyInfo"); // JSONArray customerInfo = (JSONArray) jsonObject.get("customerInfo"); // JSONArray barCodeInfo = (JSONArray) jsonObject.get("barCodeInfo"); // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); JSONObject result = new JSONObject(); JSONArray resultArray = new JSONArray(); for (Iterator it = cmmdtyInfo.iterator(); it.hasNext();) { JSONObject item = (JSONObject) it.next(); Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : item.keySet()) { if (bundle.containsKey("SN_SKU_" + key.toString().toUpperCase())) { if (item.get(key) == null || item.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_SKU_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_SKU_" + key.toString().toUpperCase()), item.get(key)); } } } // ? // data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_SKU", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); JSONObject resultItem = new JSONObject(); resultItem.put("kunner", data.get("OWNER")); resultItem.put("sncmmdty_code", data.get("SKU")); resultItem.put("process_stat", "03"); resultItem.put("notes", ""); resultArray.add(resultItem); } result.put("resultInfo", resultArray); return result.toString(); }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String generalRequestXml4TJ(String id, ResourceBundle bundle) { int idInt = Integer.valueOf(id); // step 1 ?xml LinkedHashMap InventoryHead = new LinkedHashMap(); //?/* www . ja v a 2 s. c o m*/ List<LinkedHashMap> headList = snCommonManagerMapper.selectInventoryHead(idInt); if (headList != null) { LinkedHashMap item = headList.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_HEAD_" + key.toString())) { InventoryHead.put(bundle.getObject("TJ_HEAD_" + key.toString()), item.get(key)); } else { InventoryHead.put(key.toString(), item.get(key)); } } } } List<LinkedHashMap> InventoryList = new ArrayList<LinkedHashMap>(); //? List<LinkedHashMap> ItemList = snCommonManagerMapper.selectInventoryList(idInt); if (ItemList != null) { for (LinkedHashMap item : ItemList) { //book?? List<LinkedHashMap> bookInfoList = snCommonManagerMapper.selectInventoryListRelateBookInfo( item.get("ORDER_NO").toString(), item.get("ITEM_NO").toString()); for (LinkedHashMap bookInfo : bookInfoList) { //book? item.put("RECORD_NO", bookInfo.get("RECORD_NO")); item.put("GOODS_SERIALNO", bookInfo.get("GOODS_SERIALNO")); item.put("DECL_NO", bookInfo.get("DECL_NO")); LinkedHashMap Inventory = new LinkedHashMap(); //t_new_import_sku.unit2<qty2>????t_new_import_inventory_detail.qty2 //t_new_import_sku.unit2?<qty2>?t_new_import_inventory_detail.qty1 if (item.get("UNIT2") == null || item.get("UNIT2").toString().isEmpty()) { //?? } else { item.put("QTY2", item.get("QTY1")); } // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_LIST_" + key.toString())) { Inventory.put(bundle.getObject("TJ_LIST_" + key.toString()), item.get(key)); } else { Inventory.put(key.toString(), item.get(key)); } } } InventoryList.add(Inventory); } } } LinkedHashMap IODeclContainerList = new LinkedHashMap(); List<LinkedHashMap> IODeclContainerListTemp = snCommonManagerMapper.selectIODeclContainerList(idInt); if (IODeclContainerListTemp != null) { LinkedHashMap item = IODeclContainerListTemp.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_IO_" + key.toString())) { IODeclContainerList.put(bundle.getObject("TJ_IO_" + key.toString()), item.get(key)); } else { IODeclContainerList.put(key.toString(), item.get(key)); } } } } LinkedHashMap IODeclOrderRelationList = new LinkedHashMap(); List<LinkedHashMap> IODeclOrderRelationListTemp = snCommonManagerMapper .selectIODeclOrderRelationList(idInt); if (IODeclOrderRelationListTemp != null) { LinkedHashMap item = IODeclOrderRelationListTemp.get(0); // ? if (item != null) { for (Object key : item.keySet()) { if (bundle.containsKey("TJ_IO_" + key.toString())) { IODeclOrderRelationList.put(bundle.getObject("TJ_IO_" + key.toString()), item.get(key)); } else { IODeclOrderRelationList.put(key.toString(), item.get(key)); } } } } LinkedHashMap BaseTransfer = snCommonManagerMapper.selectBaseTransfer(); String resultXmlString = XmlUtil.generalRequestXml4TJ_621(InventoryHead, InventoryList, IODeclContainerList, IODeclOrderRelationList, BaseTransfer, bundle); return resultXmlString; }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_sn_receipt(String jsonString) throws CommonException { // String jsonReturnString = ""; SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); System.out.println("---------------------------?FPAPI_SN_RECEIPT-------------------------------"); // /*from w w w .j a v a 2 s. c o m*/ JSONObject jsonObject = JSONObject.fromObject(jsonString); JSONObject orderInfo = (JSONObject) jsonObject.get("orderInfo"); JSONObject senderInfo = (JSONObject) orderInfo.get("senderInfo"); JSONArray orderItemList = (JSONArray) orderInfo.get("orderItemList"); // JSONArray customerInfo = (JSONArray) jsonObject.get("customerInfo"); // JSONArray barCodeInfo = (JSONArray) jsonObject.get("barCodeInfo"); // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); JSONObject result = new JSONObject(); //ORDER_CODEt_sn_order.ORDER_CODE?????? List orderDataList = commonManagerMapper.selectTableListByCol("T_SN_ORDER", "ORDER_CODE", orderInfo.get("orderCode"), null, null); if (orderDataList.size() > 0) { result.put("success", "true"); result.put("errorCode", ""); result.put("errorMsg", ""); result.put("orderCode", orderInfo.get("orderCode")); return result.toString(); } JSONArray resultArray = new JSONArray(); // T_SN_RECEIPT Map primary = new HashMap(); primary.put("primaryId", null); Map data = new HashMap(); for (Object key : orderInfo.keySet()) { if (bundle.containsKey("SN_RECEIPT_" + key.toString().toUpperCase())) { if (orderInfo.get(key) == null || orderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_RECEIPT_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_RECEIPT_" + key.toString().toUpperCase()), orderInfo.get(key)); } } } for (Object key : senderInfo.keySet()) { if (bundle.containsKey("SN_RECEIPT_" + key.toString().toUpperCase())) { if (senderInfo.get(key) == null || senderInfo.get(key).toString().isEmpty()) { data.put(bundle.getObject("SN_RECEIPT_" + key.toString().toUpperCase()), null); } else { data.put(bundle.getObject("SN_RECEIPT_" + key.toString().toUpperCase()), senderInfo.get(key)); } } } data.put("SENDER_CODE", orderInfo.get("ownerUserId")); data.put("RECEIPT_STATUS", "0"); data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_RECEIPT", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); //???? List<Map> orderItemListForCJ = new ArrayList<Map>(); for (Iterator it = orderItemList.iterator(); it.hasNext();) { JSONObject item = (JSONObject) it.next(); Map primary_sub = new HashMap(); primary_sub.put("primaryId", null); Map dataSub = new HashMap(); Map dataSubForCJ = new HashMap(); for (Object key : item.keySet()) { if (bundle.containsKey("SN_RECEIPT_DETAIL_" + key.toString().toUpperCase())) { if (item.get(key) == null || item.get(key).toString().isEmpty()) { dataSub.put(bundle.getObject("SN_RECEIPT_DETAIL_" + key.toString().toUpperCase()), null); } else { dataSub.put(bundle.getObject("SN_RECEIPT_DETAIL_" + key.toString().toUpperCase()), item.get(key)); } } } // ? dataSub.put("RECEIPT_ID", primary.get("primaryId")); // data.put("CREAT_DATE", sf.format(new Date())); dataSub.put("CREAT_TIME", new Date()); commonManagerMapper.insertTableByNVList("T_SN_RECEIPT_DETAIL", new ArrayList<String>(dataSub.keySet()), new ArrayList<Object>(dataSub.values()), primary_sub); //????? dataSubForCJ.put("ORDER_ITEM_ID", dataSub.get("ORDER_ITEM_ID")); dataSubForCJ.put("SKU", dataSub.get("SKU")); dataSubForCJ.put("ITEM_NAME", dataSub.get("ITEM_NAME")); dataSubForCJ.put("EXPECT_QTY", dataSub.get("EXPECT_QTY")); dataSubForCJ.put("PRODUCE_CODE", dataSub.get("PRODUCE_CODE")); orderItemListForCJ.add(dataSubForCJ); } //???? Map order = new HashMap(); order.put("OWNER", data.get("OWNER")); order.put("ORDER_CODE", data.get("ORDER_CODE")); order.put("ORDER_TYPE", data.get("ORDER_TYPE")); order.put("EXPECT_START_TIME", data.get("EXPECT_START_TIME")); order.put("EXPECT_END_TIME", data.get("EXPECT_END_TIME")); order.put("TMS_ORDER_CODE", data.get("TMS_ORDER_CODE")); order.put("SENDER_ADDRESS", data.get("SENDER_ADDRESS")); order.put("SENDER_CODE", data.get("SENDER_CODE")); order.put("SENDER_NAME", data.get("SENDER_NAME")); order.put("SENDER_MOBILE", data.get("SENDER_MOBILE")); order.put("SENDER_PHONE", data.get("SENDER_PHONE")); order.put("CUST", CommonUtil.getSystemConfigProperty("CJ_cust")); String xmlStringData = XmlUtil.generalCommonXml_CJ("DATA", order, orderItemListForCJ); String requestXmlData = XmlUtil.generalSoapXml_CJ(xmlStringData, "sendInStockOrder"); System.out.println(requestXmlData); //?????? String response = HttpUtil.sendHttpCMD_CJ(requestXmlData, CommonUtil.getSystemConfigProperty("CJ_sendInStockOrder_requestUrl").toString()); //?? // String returnXmlData = XmlUtil // .getResponseFromXmlString_CJ(response); String returnXmlData = XmlUtil.getTotalMidValue(StringEscapeUtils.unescapeXml(response), "<ns:return>", "</ns:return>"); // // String returnXmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DATA><ORDER><ORDER_CODE>3434222e333</ORDER_CODE><CD>OK</CD><INFO><![CDATA[]]></INFO><ITEMS><ITEM><ORDER_ITEM_ID>420000002xxxxxx</ORDER_ITEM_ID><SKU>P0000KMM</SKU><ACTUAL_QTY>1</ACTUAL_QTY><ACTUAL_QTY_DEFECT>5590</ACTUAL_QTY_DEFECT></ITEM><ITEM><ORDER_ITEM_ID>1234567891</ORDER_ITEM_ID><SKU>P0001KMM</SKU><ACTUAL_QTY>1</ACTUAL_QTY><ACTUAL_QTY_DEFECT>5591</ACTUAL_QTY_DEFECT></ITEM></ITEMS></ORDER></DATA>"; // // String returnXmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><DATA><ORDER><ORDER_CODE>W107xxxxxx</ORDER_CODE><CD>102</CD><INFO>??</INFO></ORDER></DATA>"; //? // Map orderResult = XmlUtil.parseXmlFPAPI_SingleNodes(returnXmlData, "//DATA/ORDER/child::*"); // if (orderResult.containsKey("CD") && "OK".equals(orderResult.get("CD").toString())) { //?? result.put("success", "true"); result.put("errorCode", ""); result.put("errorMsg", ""); } else { // //????B0007,? result.put("success", "false"); result.put("errorCode", "B0007"); result.put("errorMsg", orderResult.get("INFO")); } result.put("orderCode", orderResult.get("ORDER_CODE")); return result.toString(); }
From source file:com.foo.manager.commonManager.thread.HttpHandleThread.java
private String handleXml_Inventory(String xmlString) { String xmlReturnString = ""; System.out.println("---------------------------?FPAPI_INVENTORY-------------------------------"); List<String> inventoryOrderDataXML = XmlUtil.getNodesXmlData(xmlString, "//inputList/inventoryOrder"); List<Map> resultList = new ArrayList<Map>(); // ?????/*from ww w . j ava 2s.c o m*/ List<Map> dataList = new ArrayList<Map>(); // ?<businessType>C061? // <inventoryDetailItems><goodsNumber>t_new_import_receipt?ACTUAL_QTY // 1.inventoryDetailHead.logisticsOrderId = RECEIPT_NO // 2.inventoryDetailItems.goodsCode = SKU // ?t_new_import_books // <goodsCode>?SKU // <goodsDescription>?DESCRIPTION // <goodsNumber>?QTY // ADD_REDUCE_FLAG1 // <logisticsOrderId>?ORDER_NO // CREAT_DATE?YYYYMMDD // ? String checkBusinessTypeC061 = CommonUtil.getSystemConfigProperty("checkInventoryBusinessType_C061"); String checkBusinessTypeC005 = CommonUtil.getSystemConfigProperty("checkInventoryBusinessType_C005"); // ?? ResourceBundle bundle = CommonUtil.getMessageMappingResource("CEB_SN"); SimpleDateFormat sf = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT_1); for (String xmlData : inventoryOrderDataXML) { Map head = null; Map singleResult = new HashMap(); singleResult.put("isSuccess", "true"); try { // businessType head = XmlUtil.parseXmlFPAPI_SingleNodes(xmlData, "//inventoryDetailHead/child::*"); singleResult.put("messageId", head.get("messageId")); String businessType = null; String logisticsOrderId = head.get("logisticsOrderId") != null ? head.get("logisticsOrderId").toString() : ""; if (head != null && head.containsKey("businessType") && head.get("businessType") != null) { businessType = (String) head.get("businessType"); } // --C061 if (checkBusinessTypeC061.equals(businessType)) { List<Map> items = XmlUtil.parseXmlFPAPI_MulitpleNodes(xmlData, "//inventoryDetailItems"); List<String> colNames = new ArrayList<String>(); List<Object> colValues = new ArrayList<Object>(); for (Map item : items) { Map data = new HashMap(); // ? for (Object key : item.keySet()) { if (bundle.containsKey("inventory_" + key.toString())) { data.put(bundle.getObject("inventory_" + key.toString()), item.get(key)); } } // t_new_import_receipt.ACTUAL_QTY, ?SKURECEIPT_NO String sku = data.get("SKU").toString(); colNames.clear(); colValues.clear(); colNames.add("RECEIPT_NO"); colNames.add("SKU"); colValues.add(logisticsOrderId); colValues.add(sku); List<Map<String, Object>> rows = commonManagerMapper .selectTableListByNVList("t_new_import_receipt", colNames, colValues, null, null); if (rows.size() > 0) { for (Map row : rows) { colNames.clear(); colValues.clear(); colNames.add("ACTUAL_QTY"); colValues.add(data.get("QTY")); // ? commonManagerMapper.updateTableByNVList("t_new_import_receipt", "RECEIPT_ID", row.get("RECEIPT_ID"), colNames, colValues); } // ? data.put("ORDER_NO", logisticsOrderId); data.put("ADD_REDUCE_FLAG", "1"); data.put("CREAT_DATE", sf.format(new Date())); data.put("CREAT_TIME", new Date()); Map primary = new HashMap(); primary.put("primaryId", null); commonManagerMapper.insertTableByNVList("t_new_import_books", new ArrayList<String>(data.keySet()), new ArrayList<Object>(data.values()), primary); } else { singleResult.put("isSuccess", "false"); } } // ???--SN Map data = new HashMap(); String dateFormatString = CommonUtil.getDateFormatter(CommonDefine.COMMON_FORMAT) .format(new Date()); data.put("messageId", getMessageId()); data.put("logisticsOrderId", logisticsOrderId); data.put("logisticsExpressId", ""); data.put("statusCode", "1120"); data.put("logisticsStation", "tianjin"); data.put("finishedDate", dateFormatString.split(" ")[0]); data.put("finishedTime", dateFormatString.split(" ")[1]); data.put("operator", "sinotrans"); data.put("telNumber", ""); data.put("shipmentCode", ""); data.put("weight", ""); data.put("weightUnit", ""); data.put("note", ""); data.put("consignee", ""); data.put("airwayBillNo", ""); data.put("flightNo", ""); data.put("flightDate", ""); data.put("keyValueAdd", ""); data.put("thirdPartyCompany", ""); dataList.add(data); } else if (checkBusinessTypeC005.equals(businessType)) { String statusCode = head.get("statusCode") != null ? head.get("statusCode").toString() : ""; if ("1060".equals(statusCode)) { // ?? } else if ("1131".equals(statusCode)) { // ? // t_new_import_inventory_detail? List<String> colNames = new ArrayList<String>(); List<Object> colValues = new ArrayList<Object>(); colNames.add("ORDER_NO"); colValues.add(logisticsOrderId); List<Map<String, Object>> rows = commonManagerMapper.selectTableListByCol( "t_new_import_inventory_detail", "LOS_NO", logisticsOrderId, null, null); if (rows != null && rows.size() > 0) { // ????? /* * <InventoryCancel> <orderNo></orderNo> * <ebpCode></ebpCode> </InventoryCancel> */ for (Map<String, Object> row : rows) { Map InventoryCancelData = new HashMap(); InventoryCancelData.put("orderNo", row.get("ORDER_NO")); InventoryCancelData.put("ebpCode", "3201966A69"); InventoryCancelData.put("note", "??"); String xmlStringData = XmlUtil.generalCommonXml("InventoryCancel", InventoryCancelData); // ?????? Map reponse = postToTJ(xmlStringData, CommonUtil.getSystemConfigProperty("TJ_business_type_cancel")); } singleResult.put("isSuccess", "true"); } else { singleResult.put("isSuccess", "false"); } } } } catch (Exception e) { e.printStackTrace(); singleResult.put("isSuccess", "false"); } resultList.add(singleResult); } // ??? if (dataList.size() > 0) { Map requestParam = new HashMap(); requestParam.put("logistic_provider_id", CommonUtil.getSystemConfigProperty("SN_inputStatusList_logistic_provider_id")); requestParam.put("msg_type", CommonUtil.getSystemConfigProperty("SN_inputStatusList_msg_type")); requestParam.put("url", CommonUtil.getSystemConfigProperty("SN_inputStatusList_requestUrl")); String content = XmlUtil.generalReceiptXml_LoadRec_FP( CommonUtil.getSystemConfigProperty("inputStatusListRoot"), CommonUtil.getSystemConfigProperty("inputStatusListFirstElement"), dataList); // System.out.println(content); // ?? send2SN(requestParam, content); } // ? List<LinkedMap> dataListReturn = new ArrayList<LinkedMap>(); for (int i = 0; i < resultList.size(); i++) { LinkedMap resultData = new LinkedMap(); resultData.put("messageId", resultList.get(i).get("messageId")); resultData.put("success", resultList.get(i).get("isSuccess")); resultData.put("errorCode", ""); resultData.put("errorMsg", ""); dataListReturn.add(resultData); } String root = CommonUtil.getSystemConfigProperty("inventoryReceiptRoot"); String firstElement = CommonUtil.getSystemConfigProperty("inventoryFirstElement"); xmlReturnString = XmlUtil.generalReceiptXml_FP(root, firstElement, dataListReturn); return xmlReturnString; }