1 package com.deppon.oms.module.client.pushToTianFangkeji.domain; 2 3 import java.util.ArrayList; 4 import java.util.List; 5 6 import javax.xml.bind.annotation.XmlElement; 7 import javax.xml.bind.annotation.XmlElementWrapper; 8 import javax.xml.bind.annotation.XmlElements; 9 import javax.xml.bind.annotation.XmlRootElement; 10 11 @XmlRootElement(name="Request") 12 public class EmpPushToTianFangRequest { 13 private MsgHead msgHead; 14 private Body Body; 15 16 /** 17 * @return the msgHead 18 */ 19 public MsgHead getMsgHead() { 20 return msgHead; 21 } 22 23 /** 24 * @param msgHead the msgHead to set 25 */ 26 public void setMsgHead(MsgHead msgHead) { 27 this.msgHead = msgHead; 28 } 29 30 /** 31 * @return the body 32 */ 33 public Body getBody() { 34 return Body; 35 } 36 37 /** 38 * @param body the body to set 39 */ 40 public void setBody(Body body) { 41 Body = body; 42 } 43 44 /** 45 * 内部类MSgHead 46 * @author 342290 47 * 48 */ 49 public static class MsgHead{ 50 private String tradeNo; 51 private String processCode; 52 private String ecCompanyCode; 53 private String expressCompanyCode; 54 /** 55 * @return the tradeNo 56 */ 57 public String getTradeNo() { 58 return tradeNo; 59 } 60 /** 61 * @param tradeNo the tradeNo to set 62 */ 63 public void setTradeNo(String tradeNo) { 64 this.tradeNo = tradeNo; 65 } 66 /** 67 * @return the processCode 68 */ 69 public String getProcessCode() { 70 return processCode; 71 } 72 /** 73 * @param processCode the processCode to set 74 */ 75 public void setProcessCode(String processCode) { 76 this.processCode = processCode; 77 } 78 /** 79 * @return the ecCompanyCode 80 */ 81 public String getEcCompanyCode() { 82 return ecCompanyCode; 83 } 84 /** 85 * @param ecCompanyCode the ecCompanyCode to set 86 */ 87 public void setEcCompanyCode(String ecCompanyCode) { 88 this.ecCompanyCode = ecCompanyCode; 89 } 90 /** 91 * @return the expressCompanyCode 92 */ 93 public String getExpressCompanyCode() { 94 return expressCompanyCode; 95 } 96 /** 97 * @param expressCompanyCode the expressCompanyCode to set 98 */ 99 public void setExpressCompanyCode(String expressCompanyCode) { 100 this.expressCompanyCode = expressCompanyCode; 101 } 102 } 103 104 /** 105 * 内部类Body 106 * 342290 陈军 107 */ 108 public static class Body{ 109 110 List<DeliveryPerson> deliveryPersons = new ArrayList<DeliveryPerson>(); 111 112 /** 113 * @return the deliveryPersons 114 */ 115 @XmlElementWrapper(name="deliveryPersons") 116 @XmlElements(value = {@XmlElement(name = "deliveryPerson", type = DeliveryPerson.class) }) 117 public List<DeliveryPerson> getDeliveryPersons() { 118 return deliveryPersons; 119 } 120 121 /** 122 * @param deliveryPersons the deliveryPersons to set 123 */ 124 public void setDeliveryPersons(List<DeliveryPerson> deliveryPersons) { 125 this.deliveryPersons = deliveryPersons; 126 } 127 128 } 129 130 /** 131 * 内部类DeliveryPerson 132 * 342290 陈军 133 */ 134 public static class DeliveryPerson{ 135 //快递人员编号 136 private String deliveryPersonID; 137 //快递人员姓名 138 private String name; 139 //联系电话 140 private String phone; 141 //证件类型:07000001二代身份证;07000002护照 142 private String certificatesType; 143 //证件号码 144 private String certificateNo; 145 //人员常驻地址 146 private String Address; 147 //入职时间,格式为yyyy-mm-dd hh:mm:ss 148 private String entryTime; 149 //离职时间,格式为yyyy-mm-dd hh:mm:ss 150 private String quitTime; 151 //快递人员从业资格证号码 152 private String deliveryNo; 153 //从业资格证等级:08000001初级,08000002中级,08000003高级 154 private String deliveryLevel; 155 //人员在职状态:09000001在职,09000002非在职 156 private String Status; 157 //备注 158 private String Remark; 159 160 /** 161 * @return the deliveryPersonID 162 */ 163 public String getDeliveryPersonID() { 164 return deliveryPersonID; 165 } 166 /** 167 * @param deliveryPersonID the deliveryPersonID to set 168 */ 169 public void setDeliveryPersonID(String deliveryPersonID) { 170 this.deliveryPersonID = deliveryPersonID; 171 } 172 /** 173 * @return the name 174 */ 175 public String getName() { 176 return name; 177 } 178 /** 179 * @param name the name to set 180 */ 181 public void setName(String name) { 182 this.name = name; 183 } 184 /** 185 * @return the phone 186 */ 187 public String getPhone() { 188 return phone; 189 } 190 /** 191 * @param phone the phone to set 192 */ 193 public void setPhone(String phone) { 194 this.phone = phone; 195 } 196 /** 197 * @return the certificatesType 198 */ 199 public String getCertificatesType() { 200 return certificatesType; 201 } 202 /** 203 * @param certificatesType the certificatesType to set 204 */ 205 public void setCertificatesType(String certificatesType) { 206 this.certificatesType = certificatesType; 207 } 208 /** 209 * @return the certificateNo 210 */ 211 public String getCertificateNo() { 212 return certificateNo; 213 } 214 /** 215 * @param certificateNo the certificateNo to set 216 */ 217 public void setCertificateNo(String certificateNo) { 218 this.certificateNo = certificateNo; 219 } 220 /** 221 * @return the address 222 */ 223 public String getAddress() { 224 return Address; 225 } 226 /** 227 * @param address the address to set 228 */ 229 public void setAddress(String address) { 230 Address = address; 231 } 232 /** 233 * @return the entryTime 234 */ 235 public String getEntryTime() { 236 return entryTime; 237 } 238 /** 239 * @param entryTime the entryTime to set 240 */ 241 public void setEntryTime(String entryTime) { 242 this.entryTime = entryTime; 243 } 244 /** 245 * @return the quitTime 246 */ 247 public String getQuitTime() { 248 return quitTime; 249 } 250 /** 251 * @param quitTime the quitTime to set 252 */ 253 public void setQuitTime(String quitTime) { 254 this.quitTime = quitTime; 255 } 256 /** 257 * @return the deliveryNo 258 */ 259 public String getDeliveryNo() { 260 return deliveryNo; 261 } 262 /** 263 * @param deliveryNo the deliveryNo to set 264 */ 265 public void setDeliveryNo(String deliveryNo) { 266 this.deliveryNo = deliveryNo; 267 } 268 /** 269 * @return the deliveryLevel 270 */ 271 public String getDeliveryLevel() { 272 return deliveryLevel; 273 } 274 /** 275 * @param deliveryLevel the deliveryLevel to set 276 */ 277 public void setDeliveryLevel(String deliveryLevel) { 278 this.deliveryLevel = deliveryLevel; 279 } 280 /** 281 * @return the status 282 */ 283 public String getStatus() { 284 return Status; 285 } 286 /** 287 * @param status the status to set 288 */ 289 public void setStatus(String status) { 290 Status = status; 291 } 292 /** 293 * @return the remark 294 */ 295 public String getRemark() { 296 return Remark; 297 } 298 /** 299 * @param remark the remark to set 300 */ 301 public void setRemark(String remark) { 302 Remark = remark; 303 } 304 } 305 306 }
1 public static void main(String []args){ 2 EmpPushToTianFangRequest request = new EmpPushToTianFangRequest(); 3 EmpPushToTianFangRequest.MsgHead msgHead = new EmpPushToTianFangRequest.MsgHead(); 4 EmpPushToTianFangRequest.Body body = new EmpPushToTianFangRequest.Body(); 5 6 msgHead.setEcCompanyCode("95353"); 7 msgHead.setExpressCompanyCode("Deppon"); 8 msgHead.setProcessCode("10666666666666666"); 9 10 EmpPushToTianFangRequest.DeliveryPerson deliveryPerson1 = new EmpPushToTianFangRequest.DeliveryPerson(); 11 deliveryPerson1.setAddress("明珠路88号"); 12 deliveryPerson1.setDeliveryNo("360781199207100033"); 13 deliveryPerson1.setEntryTime("2011-11-11 11:11:11"); 14 15 EmpPushToTianFangRequest.DeliveryPerson deliveryPerson2 = new EmpPushToTianFangRequest.DeliveryPerson(); 16 deliveryPerson2.setAddress("明珠路99号"); 17 deliveryPerson2.setDeliveryNo("360666666666666666"); 18 deliveryPerson2.setEntryTime("2011-12-12 12:12:12"); 19 20 21 List<EmpPushToTianFangRequest.DeliveryPerson> deliveryPersons = new ArrayList<EmpPushToTianFangRequest.DeliveryPerson>(); 22 deliveryPersons.add(deliveryPerson1); 23 deliveryPersons.add(deliveryPerson2); 24 25 body.setDeliveryPersons(deliveryPersons); 26 request.setMsgHead(msgHead); 27 request.setBody(body); 28 29 try { 30 JAXBContext context = JAXBContext.newInstance(EmpPushToTianFangRequest.class); 31 Marshaller marshaller = context.createMarshaller(); 32 marshaller.marshal(request, System.out); 33 } catch (JAXBException e) { 34 e.printStackTrace(); 35 }
@XmlElementWrapper(name="deliveryPersons") 注解是关键