报文学习1
22年8月10日
输入参数:(这个是json)
{
"OPT_MOD_CHECK_REQ":{
"MSG":{
"speedLevel",
"serialNumber":"01007396141",
"orderNo":"R0032022080118372440",
"city":"110",
"channelType":"1010300",
"deductionTag":"1",
"tradeItem":[{
"attrCode":"N",
"attrValue":"accounting",
},{
"attrValue": "5711",
"attrCode": "M_INMODE_CODE"
}, {
"attrValue": "1",
"attrCode": "orderSourceTag"
}, {
"attrValue": "1",
"attrCode": "SHORT_PROCESS"
}, {
"attrValue": "1",
"attrCode": "LDPT"
}, {
"attrValue": "2022080103335209",
"attrCode": "LDPTDDH"
}],
"queryType":"0",
"productInfo":[{
"optType",
"oldProductId",
"productMode",
"brandNumber"
}],
"areaCode":"226",
"province":"11",
"para":[{
"paraId",
"paraValue"
}],
"district":"226",
"changeTag":"1",
"opeSysType",
"recomInfo":[{
"recomDepartId":"11a0133",
"recomPersonName":"董秋玲",
"recomCity",
"recomPersonId":"1101497092",
}],
"markingTag",
"notYearDiscntId",
"inModeCode":"E",
"operatorId":"dongql1",
"channelId":"11a0133",
"broadDiscntInfo":[{
"broadDiscntId",
"broadDiscntAttr":[{
"delayDiscntType",
"delayType",
"delayDiscntId",
"eddectNow"
}],
}]
"order":[{
"orderId":"1",
"orderLineId":"1"
}],
"offerInfo":[{
"offerId":"111210181110",
"offerName":"融合通用",
"offerTypeCode":"211",
"elementInfo":[{
"childOfferId",
"childOfferName",
"elementId",
"elementType"
}]
}]
},
"APPKEY":"1120221660026277136",
"APPTX":"zttcen"
}
}
输出参数:
"OPT_MOD_CHECK_RSP":{
"MSG",
"STATUS",
"TXID",
"RSP":[{
"SUB_CODE",
"RSP_DESC",
"ATTACH",
"DATA":[{
"code",
"endDate",
"discntName",
"custName",
"provOrderId2",
"productName",
"feeInfo":[{
"feeMode",
"feeTypeCode",
"fee",
"operateType",
"feeTypeName",
"maxDerateFee"
}],
"para":[{
"paraId",
"paraValue"
}],
"totalFee",
"detail",
"arrearageMess":[{
"areaCode",
"arrearagerUserName",
"arrearageType",
"arrearageNumber"
}],
"provOraderId",
"productType",
"startDate"
}],
"SUB_DESC",
"RSP_CODE"
}],
}
代码
package test1;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class test01 {
public static void main(String[] args) {
Map<String, Object> UNI_BSS_BODY = new HashMap<String, Object>();
Map<String, Object> OPT_MOD_CHECK_REQ = new HashMap<String, Object>();
Map<String, Object> MSG = new HashMap<String, Object>();
List<Map<String, Object>> tradeItemList = new ArrayList<Map<String, Object>>();
Map<String, Object> tradeItem = new HashMap<String, Object>();
List<Map<String, Object>> productInfoList = new ArrayList<Map<String,Object>>();
Map<String, Object> productInfo = new HashMap<String, Object>();
List<Map<String, Object>> paraList = new ArrayList<Map<String,Object>>();
Map<String, Object> para = new HashMap<String, Object>();
List<Map<String, Object>> recominfoList = new ArrayList<Map<String,Object>>();
Map<String, Object> recominfo = new HashMap<String, Object>();
List<Map<String, Object>> broadDiscntInfoList = new ArrayList<Map<String,Object>>();
Map<String, Object> broadDiscntInfo = new HashMap<String, Object>();
List<Map<String, Object>> broadDiscntAttrList = new ArrayList<Map<String,Object>>();
Map<String, Object> broadDiscntAttr = new HashMap<String, Object>();
List<Map<String, Object>> orderList = new ArrayList<Map<String,Object>>();
Map<String, Object> order = new HashMap<String, Object>();
List<Map<String, Object>> offerInfoList = new ArrayList<Map<String,Object>>();
Map<String, Object> offerInfo = new HashMap<String, Object>();
List<Map<String, Object>> elementInfoList = new ArrayList<Map<String,Object>>();
Map<String, Object> elementInfo = new HashMap<String, Object>();
UNI_BSS_BODY.put("OPT_MOD_CHECK_REQ", OPT_MOD_CHECK_REQ);
OPT_MOD_CHECK_REQ.put("MSG", MSG);
MSG.put("speedLevel", "");
MSG.put("serialNumber", "01007396141");
MSG.put("orderNo", "R0032022080118372440");
MSG.put("city", "110");
MSG.put("channelType", "1010300");
MSG.put("deductionTag", "1");
MSG.put("tradeItem", tradeItemList);
tradeItemList.add(tradeItem);
tradeItem.put("attrCode", "N");
tradeItem.put("attrValue", "accounting");
MSG.put("queryType", "0");
MSG.put("productInfo", productInfoList);
productInfoList.add(productInfo);
productInfo.put("optType", "");
productInfo.put("oldProductId", "");
productInfo.put("productMode", "");
productInfo.put("brandNumber", "");
MSG.put("areaCode", "226");
MSG.put("province", "11");
MSG.put("para", paraList);
paraList.add(para);
para.put("paraId", "");
para.put("paraValue", "");
MSG.put("district", "226");
MSG.put("openSysType", "");
MSG.put("recominfo", recominfoList);
recominfoList.add(recominfo);
recominfo.put("reconmDepartId", "11a0133");
recominfo.put("recomPersonName", "董秋玲");
recominfo.put("recomCity", "");
recominfo.put("recomPersonId", "1101497092");
MSG.put("markingTag", "");
MSG.put("notYearDiscntId", "");
MSG.put("inModeCode", "E");
MSG.put("operatorId", "dong1l1");
MSG.put("changnelId", "11a0133");
MSG.put("broadDiscntInfo", broadDiscntInfoList);
broadDiscntInfoList.add(broadDiscntInfo);
broadDiscntInfo.put("broadDiscntId", "");
broadDiscntInfo.put("broadDiscntAttr", broadDiscntAttrList);
broadDiscntAttrList.add(broadDiscntAttr);
broadDiscntAttr.put("delayDiscntType", "");
broadDiscntAttr.put("delayType", "");
broadDiscntAttr.put("delayDiscntId", "");
broadDiscntAttr.put("eddectNow", "");
MSG.put("order", orderList);
orderList.add(order);
order.put("orderId", "1");
order.put("orderLineId", "1");
MSG.put("offerInfo", offerInfoList);
offerInfoList.add(offerInfo);
offerInfo.put("offerId", "111210181110");
offerInfo.put("offerName", "融合通用");
offerInfo.put("offerTypeCode", "211");
offerInfo.put("elenmentInfo", elementInfoList);
elementInfoList.add(elementInfo);
elementInfo.put("childOfferId", "");
elementInfo.put("childOfferName", "");
elementInfo.put("elementId", "");
elementInfo.put("elementType", "");
UNI_BSS_BODY.put("APPKEY", "1120221660026277136");
UNI_BSS_BODY.put("APPTX", "zttcen");
}
/**
* 接口
* @param map
* @return
*/
public Map<String, Object> test(Map<String, Object> map){
map.get("OPT_MOD_CHECK_REQ");
return null;
}
}
注意:
- 要在
public static void main(String[] args) {}
内部书写代码。 - 创建数组时,要以
List<Map<String, Object>> tradeItemList = new ArrayList<Map<String, Object>>();
Map<String, Object> tradeItem = new HashMap<String, Object>();
这种形式创建,避免在使用的时候再强制转换类型。 - 创建数组时,创建的是对应名称的List,但是节点名称依然是原本的(无List)。
- 数组在使用时的逻辑是,先创建一个List<Map> aaaList数组,然后在创建一个Map类型的aaa,然后aaaList.add(aaa),aaa.put()对应的字段,KEY和VALUE都是String类型注意双引号""。
MSG.put("order", orderList);
在将List放入父节点时,Value部分没有双引号。