作者 Kevin

修复不同主单下相同分单号的回执错乱的bug;

修改sli和fhl报文的代理人字段;
正在显示 26 个修改的文件 包含 1318 行增加1158 行删除
1 package com.agent.controller.agent; 1 package com.agent.controller.agent;
2 2
  3 +import java.text.ParseException;
  4 +import java.text.SimpleDateFormat;
  5 +import java.util.ArrayList;
  6 +import java.util.Date;
  7 +import java.util.List;
  8 +import java.util.Map;
  9 +
  10 +import javax.annotation.Resource;
  11 +import javax.servlet.http.HttpServletRequest;
  12 +import javax.servlet.http.HttpServletResponse;
  13 +
  14 +import org.apache.commons.collections.CollectionUtils;
  15 +import org.apache.commons.lang.StringUtils;
  16 +import org.slf4j.Logger;
  17 +import org.slf4j.LoggerFactory;
  18 +import org.springframework.stereotype.Controller;
  19 +import org.springframework.ui.Model;
  20 +import org.springframework.web.bind.annotation.RequestMapping;
  21 +import org.springframework.web.bind.annotation.RequestMethod;
  22 +import org.springframework.web.bind.annotation.ResponseBody;
  23 +
3 import com.agent.controller.BasicController; 24 import com.agent.controller.BasicController;
4 import com.agent.entity.Constant; 25 import com.agent.entity.Constant;
5 -import com.agent.entity.agent.*; 26 +import com.agent.entity.agent.BasicAgentEntity;
  27 +import com.agent.entity.agent.DeliveryInfoEntity;
  28 +import com.agent.entity.agent.ManifestEntity;
  29 +import com.agent.entity.agent.PackageSizeEntity;
  30 +import com.agent.entity.agent.PackageTypeEntity;
  31 +import com.agent.entity.agent.PubDgEntity;
  32 +import com.agent.entity.agent.SupervisionEntity;
6 import com.agent.entity.system.UserEntity; 33 import com.agent.entity.system.UserEntity;
7 -import com.agent.imf.agent.redis.RedisSaveMessage;  
8 -import com.agent.service.agent.*; 34 +import com.agent.service.agent.BasicAgentService;
  35 +import com.agent.service.agent.DeliveryDicService;
  36 +import com.agent.service.agent.DeliveryInfoService;
  37 +import com.agent.service.agent.ManifestService;
  38 +import com.agent.service.agent.PackageSizeService;
  39 +import com.agent.service.agent.PackageTypeService;
  40 +import com.agent.service.agent.PubDgService;
  41 +import com.agent.service.agent.SupervisionService;
9 import com.agent.util.HttpJsonMsg; 42 import com.agent.util.HttpJsonMsg;
10 import com.agent.vo.ResponseModel; 43 import com.agent.vo.ResponseModel;
11 import com.agent.vo.agent.DeliveryVo; 44 import com.agent.vo.agent.DeliveryVo;
  45 +import com.agent.xml.XmlBuildTask;
12 import com.agent.xml.common.XmlUtil; 46 import com.agent.xml.common.XmlUtil;
13 import com.agent.xml.deliveryInfo.ApplicableFreightRateServiceChargeXml; 47 import com.agent.xml.deliveryInfo.ApplicableFreightRateServiceChargeXml;
14 import com.agent.xml.deliveryInfo.ArrivalEventXml; 48 import com.agent.xml.deliveryInfo.ArrivalEventXml;
@@ -47,640 +81,624 @@ import com.framework.core.Servlets; @@ -47,640 +81,624 @@ import com.framework.core.Servlets;
47 import com.framework.shiro.SessionUtil; 81 import com.framework.shiro.SessionUtil;
48 import com.plugin.easyui.DataGrid; 82 import com.plugin.easyui.DataGrid;
49 import com.plugin.easyui.EasyPage; 83 import com.plugin.easyui.EasyPage;
50 -import org.apache.commons.collections.CollectionUtils;  
51 -import org.apache.commons.lang.StringUtils;  
52 -import org.slf4j.Logger;  
53 -import org.slf4j.LoggerFactory;  
54 -import org.springframework.stereotype.Controller;  
55 -import org.springframework.ui.Model;  
56 -import org.springframework.web.bind.annotation.RequestMapping;  
57 -import org.springframework.web.bind.annotation.RequestMethod;  
58 -import org.springframework.web.bind.annotation.ResponseBody;  
59 -  
60 -import javax.annotation.Resource;  
61 -import javax.servlet.http.HttpServletRequest;  
62 -import javax.servlet.http.HttpServletResponse;  
63 -  
64 -import java.text.ParseException;  
65 -import java.text.SimpleDateFormat;  
66 -import java.util.ArrayList;  
67 -import java.util.Date;  
68 -import java.util.List;  
69 -import java.util.Map;  
70 84
71 /** 85 /**
72 * Created by cohesion on 2017/3/29. 86 * Created by cohesion on 2017/3/29.
73 */ 87 */
74 @Controller 88 @Controller
75 @RequestMapping(value = "/delivery") 89 @RequestMapping(value = "/delivery")
76 -public class DeliveryInfoController extends BasicController{  
77 -  
78 - private static final Logger logger = LoggerFactory.getLogger(DeliveryInfoController.class);  
79 -  
80 - /**  
81 - * 交运信息  
82 - */  
83 - @Resource  
84 - private DeliveryInfoService deliveryInfoService;  
85 -  
86 - /**  
87 - * 代理人  
88 - */  
89 - @Resource  
90 - private BasicAgentService agentService;  
91 -  
92 - @Resource  
93 - private SupervisionService supervisionService;  
94 -  
95 - @Resource  
96 - private PubDgService dgService;  
97 -  
98 - @Resource  
99 - private PackageTypeService packageTypeService;  
100 -  
101 - @Resource  
102 - private PackageSizeService sizeService;  
103 -  
104 - @Resource  
105 - private ManifestService manifestService;  
106 -  
107 -  
108 - @Resource  
109 - private DeliveryDicService deliverydicservice;  
110 -  
111 - /**  
112 - * 交运信息页面  
113 - * @return  
114 - */  
115 - @RequestMapping(value = "/list")  
116 - public String getList(){  
117 - return "delivery/list";  
118 - }  
119 -  
120 - /**  
121 - * 交运信息分页数据  
122 - * @return  
123 - */  
124 - @RequestMapping(value="/grid.json")  
125 - @ResponseBody  
126 - public DataGrid<DeliveryVo> grid(HttpServletRequest request,EasyPage<DeliveryInfoEntity> pageForm) throws ParseException {  
127 - Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");  
128 - searchParams.put("EQ_isdelete", 0);  
129 - String deliveryDate =searchParams.get("GTE_deliveryDate").toString();  
130 - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");  
131 - if(StringUtils.isNotEmpty(deliveryDate)){  
132 - searchParams.put("GTE_deliveryDate",dateFormat.parse(deliveryDate));  
133 - }  
134 - String deliveryDate1 =searchParams.get("LTE_deliveryDate").toString();  
135 - if(StringUtils.isNotEmpty(deliveryDate1)){  
136 - searchParams.put("LTE_deliveryDate",dateFormat.parse(deliveryDate1));  
137 - }  
138 - pageForm.setSearchParams(searchParams);  
139 - pageForm.parseData(deliveryInfoService.getPage(pageForm));  
140 - return transferData(pageForm);  
141 - }  
142 -  
143 - /**  
144 - * 编辑  
145 - * @param id  
146 - * @param model  
147 - * @return  
148 - */  
149 - @RequestMapping(value = "/edit" , method = {RequestMethod.GET })  
150 - public String edit(Long id, Model model) {  
151 - DeliveryInfoEntity deliveryInfo = null;  
152 - if(id!=null){  
153 - deliveryInfo = deliveryInfoService.findOne(id);  
154 - }  
155 -  
156 - model.addAttribute("delivery", deliveryInfo);  
157 - UserEntity user = SessionUtil.getUser();  
158 - if(user!=null && user.getAgent()!=null){  
159 - BasicAgentEntity agent = agentService.findOne(user.getAgent());  
160 - model.addAttribute("userAgent",agent);  
161 - }  
162 -  
163 - //品名代码  
164 -// List<DeliveryDicEntity> good = deliverydicservice.findGood();  
165 -// model.addAttribute("good",good);  
166 -  
167 - //监管代码  
168 - List<SupervisionEntity> supervisionList = supervisionService.findAll();  
169 - model.addAttribute("supervisionList",supervisionList);  
170 -  
171 - //危险品代码  
172 - List<PubDgEntity> dgList = dgService.findAll();  
173 - model.addAttribute("dgList",dgList);  
174 -  
175 - //包装种类  
176 - List<PackageTypeEntity> typeList = packageTypeService.findAll();  
177 - model.addAttribute("typeList",typeList);  
178 - return "delivery/edit";  
179 - }  
180 -  
181 - /**  
182 - * 获取包装类型  
183 - *  
184 - * @param hostId  
185 - * @return  
186 - */  
187 - @RequestMapping(value = "/size/get" , method = {RequestMethod.POST })  
188 - @ResponseBody  
189 - public String getSize(Long hostId) {  
190 - return JSON.toJSONString(sizeService.getList(Constant.packageSizeDelivery, hostId),filter);  
191 - }  
192 -  
193 -  
194 - /**  
195 - * 保存  
196 - * @param deliveryJson  
197 - * @return  
198 - */  
199 - @RequestMapping(value = "/save" , method = {RequestMethod.POST })  
200 - @ResponseBody  
201 - public ResponseModel save(String deliveryJson,String sizeJson) {  
202 - ResponseModel model = new ResponseModel();  
203 - try {  
204 - DeliveryInfoEntity delivery = JSONObject.parseObject(deliveryJson,DeliveryInfoEntity.class);  
205 - List<PackageSizeEntity> sizeList = JSONArray.parseArray(sizeJson,PackageSizeEntity.class);  
206 - DeliveryInfoEntity deliveryInfo = deliveryInfoService.save(delivery,sizeList);  
207 - model.setData(deliveryInfo.getId());  
208 - model.setStatus(200);  
209 - } catch (Exception e) {  
210 - model.setStatus(500);  
211 - logger.error("系统异常 >>", e);  
212 - }  
213 - return model;  
214 - }  
215 -  
216 - /**  
217 - * 保存并且发送  
218 - * @param deliveryJson  
219 - * @return  
220 - */  
221 - @RequestMapping(value = "/sendXml" , method = {RequestMethod.POST })  
222 - @ResponseBody  
223 - public ResponseModel sendXml(String deliveryJson,String sizeJson,HttpServletRequest request) {  
224 - ResponseModel model = new ResponseModel();  
225 - try {  
226 - DeliveryInfoEntity delivery = JSONObject.parseObject(deliveryJson,DeliveryInfoEntity.class);  
227 - delivery.setIsdelete(1);  
228 - List<PackageSizeEntity> sizeList = JSONArray.parseArray(sizeJson,PackageSizeEntity.class);  
229 - DeliveryInfoEntity deliveryInfo = deliveryInfoService.save(delivery,sizeList);  
230 -  
231 - //生成报文并且发送  
232 - String rootPath = request.getSession().getServletContext().getRealPath("/");  
233 - String path = rootPath+"/excel/manifest"+new Date().getTime()+".xml";  
234 - String xml = XmlUtil.convertToXml2(deliveryInfoService.deliveryXml(delivery), path);  
235 - //发送redis储存数据  
236 - System.out.println(xml);  
237 - new RedisSaveMessage().saveMessage(xml);  
238 - model.setData(deliveryInfo.getId());  
239 - model.setStatus(200);  
240 - } catch (Exception e) {  
241 - model.setStatus(500);  
242 - logger.error("系统异常 >>", e);  
243 - }  
244 - return model;  
245 - }  
246 -  
247 -  
248 - /**  
249 - * 查询主单号是否存在  
250 - *  
251 - * @param mawbNo  
252 - * @return  
253 - */  
254 - @RequestMapping(value = "/queryMawbNo",method = {RequestMethod.POST})  
255 - @ResponseBody  
256 - public ResponseModel queryMawbId(Long id,String mawbNo){  
257 - ResponseModel model = new ResponseModel();  
258 - List<DeliveryInfoEntity> list = null;  
259 - if(StringUtils.isNotEmpty(mawbNo)){  
260 - list = deliveryInfoService.findByMawbNo(mawbNo);  
261 - }  
262 - boolean exist = false;  
263 - if(CollectionUtils.isNotEmpty(list)){  
264 - if(list.size()>1){  
265 - exist = true;  
266 - }else if(!list.get(0).getId().equals(id)) {  
267 - exist = true;  
268 - }  
269 - }  
270 - if(exist){  
271 - model.setStatus(500);  
272 - }  
273 - else {  
274 - model.setStatus(200);  
275 - }  
276 - return model;  
277 - }  
278 -  
279 - /**  
280 - * 删除  
281 - * @param ids  
282 - * @return  
283 - */  
284 - @RequestMapping(value = "/delete" , method = {RequestMethod.POST })  
285 - @ResponseBody  
286 - public ResponseModel delete(String ids) {  
287 - ResponseModel model = new ResponseModel();  
288 - try {  
289 - deliveryInfoService.deleteAll(ids);  
290 - model.setStatus(200);  
291 - model.setMsg(HttpJsonMsg.SUCCESS);  
292 - } catch (Exception e) {  
293 - model.setStatus(500);  
294 - model.setMsg(HttpJsonMsg.ERROR);  
295 - logger.error("系统异常 >>", e);  
296 - }  
297 - return model;  
298 - }  
299 -  
300 - private DataGrid<DeliveryVo> transferData(EasyPage<DeliveryInfoEntity> pageForm){  
301 - DataGrid<DeliveryInfoEntity> list = pageForm.getData();  
302 - List<DeliveryVo> rows = new ArrayList<>();  
303 - if(CollectionUtils.isNotEmpty(list.getRows())){  
304 - for(DeliveryInfoEntity entity:list.getRows()){  
305 - DeliveryVo vo = new DeliveryVo();  
306 - vo.setId(entity.getId());  
307 - vo.setSupplier(entity.getSupplier());  
308 - vo.setMawbNo(entity.getMawbNo());  
309 - vo.setDestination(entity.getDestination());  
310 - vo.setGoodsName(entity.getGoodsName());  
311 - vo.setCbm(entity.getCbm());  
312 - vo.setWeight(entity.getWeight());  
313 - vo.setScheduledFlight(entity.getScheduledFlight());  
314 - if(entity.getAgent()!=null){  
315 - BasicAgentEntity agent = agentService.findOne(entity.getAgent());  
316 - if(agent!=null){  
317 - vo.setAgent(agent.getNameCn());  
318 - }  
319 - }  
320 - if(entity.getSendDate()!=null){  
321 - vo.setSendDate(Constant.dateFormat.format(entity.getSendDate()));  
322 - }  
323 - rows.add(vo);  
324 - }  
325 - }  
326 - DataGrid<DeliveryVo> vos = new DataGrid<>();  
327 - vos.setRows(rows);  
328 - vos.setTotal(list.getTotal());  
329 - return vos;  
330 - }  
331 -  
332 - //发送报文  
333 - @RequestMapping(value = "/xml",method = RequestMethod.POST)  
334 - @ResponseBody  
335 - public ResponseModel createXml(Long id,HttpServletRequest request,HttpServletResponse response) throws Exception {  
336 - ResponseModel model = new ResponseModel();  
337 - String rootPath = request.getSession().getServletContext().getRealPath("/");  
338 - String path = rootPath+"/excel/delivery"+new Date().getTime()+".xml";  
339 - String xml = "";  
340 - if(id!=null){  
341 - xml = beanToXml(path,id);  
342 - }  
343 - model.setData(xml);  
344 - return model;  
345 - } 90 +public class DeliveryInfoController extends BasicController {
  91 +
  92 + private static final Logger logger = LoggerFactory.getLogger(DeliveryInfoController.class);
  93 +
  94 + /**
  95 + * 交运信息
  96 + */
  97 + @Resource
  98 + private DeliveryInfoService deliveryInfoService;
  99 +
  100 + /**
  101 + * 代理人
  102 + */
  103 + @Resource
  104 + private BasicAgentService agentService;
  105 +
  106 + @Resource
  107 + private SupervisionService supervisionService;
  108 +
  109 + @Resource
  110 + private PubDgService dgService;
  111 +
  112 + @Resource
  113 + private PackageTypeService packageTypeService;
  114 +
  115 + @Resource
  116 + private PackageSizeService sizeService;
  117 +
  118 + @Resource
  119 + private ManifestService manifestService;
  120 +
  121 + @Resource
  122 + private DeliveryDicService deliverydicservice;
  123 +
  124 + /**
  125 + * 交运信息页面
  126 + *
  127 + * @return
  128 + */
  129 + @RequestMapping(value = "/list")
  130 + public String getList() {
  131 + return "delivery/list";
  132 + }
  133 +
  134 + /**
  135 + * 交运信息分页数据
  136 + *
  137 + * @return
  138 + */
  139 + @RequestMapping(value = "/grid.json")
  140 + @ResponseBody
  141 + public DataGrid<DeliveryVo> grid(HttpServletRequest request, EasyPage<DeliveryInfoEntity> pageForm)
  142 + throws ParseException {
  143 + Map<String, Object> searchParams = Servlets.getParametersStartingWith(request, "search_");
  144 + searchParams.put("EQ_isdelete", 0);
  145 + String deliveryDate = searchParams.get("GTE_deliveryDate").toString();
  146 + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  147 + if (StringUtils.isNotEmpty(deliveryDate)) {
  148 + searchParams.put("GTE_deliveryDate", dateFormat.parse(deliveryDate));
  149 + }
  150 + String deliveryDate1 = searchParams.get("LTE_deliveryDate").toString();
  151 + if (StringUtils.isNotEmpty(deliveryDate1)) {
  152 + searchParams.put("LTE_deliveryDate", dateFormat.parse(deliveryDate1));
  153 + }
  154 + pageForm.setSearchParams(searchParams);
  155 + pageForm.parseData(deliveryInfoService.getPage(pageForm));
  156 + return transferData(pageForm);
  157 + }
  158 +
  159 + /**
  160 + * 编辑
  161 + *
  162 + * @param id
  163 + * @param model
  164 + * @return
  165 + */
  166 + @RequestMapping(value = "/edit", method = { RequestMethod.GET })
  167 + public String edit(Long id, Model model) {
  168 + DeliveryInfoEntity deliveryInfo = null;
  169 + if (id != null) {
  170 + deliveryInfo = deliveryInfoService.findOne(id);
  171 + }
  172 +
  173 + model.addAttribute("delivery", deliveryInfo);
  174 + UserEntity user = SessionUtil.getUser();
  175 + if (user != null && user.getAgent() != null) {
  176 + BasicAgentEntity agent = agentService.findOne(user.getAgent());
  177 + model.addAttribute("userAgent", agent);
  178 + }
  179 +
  180 + // 品名代码
  181 + // List<DeliveryDicEntity> good = deliverydicservice.findGood();
  182 + // model.addAttribute("good",good);
  183 +
  184 + // 监管代码
  185 + List<SupervisionEntity> supervisionList = supervisionService.findAll();
  186 + model.addAttribute("supervisionList", supervisionList);
  187 +
  188 + // 危险品代码
  189 + List<PubDgEntity> dgList = dgService.findAll();
  190 + model.addAttribute("dgList", dgList);
  191 +
  192 + // 包装种类
  193 + List<PackageTypeEntity> typeList = packageTypeService.findAll();
  194 + model.addAttribute("typeList", typeList);
  195 + return "delivery/edit";
  196 + }
  197 +
  198 + /**
  199 + * 获取包装类型
  200 + *
  201 + * @param hostId
  202 + * @return
  203 + */
  204 + @RequestMapping(value = "/size/get", method = { RequestMethod.POST })
  205 + @ResponseBody
  206 + public String getSize(Long hostId) {
  207 + return JSON.toJSONString(sizeService.getList(Constant.packageSizeDelivery, hostId), filter);
  208 + }
  209 +
  210 + /**
  211 + * 保存
  212 + *
  213 + * @param deliveryJson
  214 + * @return
  215 + */
  216 + @RequestMapping(value = "/save", method = { RequestMethod.POST })
  217 + @ResponseBody
  218 + public ResponseModel save(String deliveryJson, String sizeJson) {
  219 + ResponseModel model = new ResponseModel();
  220 + try {
  221 + DeliveryInfoEntity delivery = JSONObject.parseObject(deliveryJson, DeliveryInfoEntity.class);
  222 + List<PackageSizeEntity> sizeList = JSONArray.parseArray(sizeJson, PackageSizeEntity.class);
  223 + DeliveryInfoEntity deliveryInfo = deliveryInfoService.save(delivery, sizeList);
  224 + model.setData(deliveryInfo.getId());
  225 + model.setStatus(200);
  226 + } catch (Exception e) {
  227 + model.setStatus(500);
  228 + logger.error("系统异常 >>", e);
  229 + }
  230 + return model;
  231 + }
  232 +
  233 + /**
  234 + * 保存并且发送
  235 + *
  236 + * @param deliveryJson
  237 + * @return
  238 + */
  239 + @RequestMapping(value = "/sendXml", method = { RequestMethod.POST })
  240 + @ResponseBody
  241 + public ResponseModel sendXml(String deliveryJson, String sizeJson, HttpServletRequest request) {
  242 + ResponseModel model = new ResponseModel();
  243 + try {
  244 + DeliveryInfoEntity delivery = JSONObject.parseObject(deliveryJson, DeliveryInfoEntity.class);
  245 + delivery.setIsdelete(1);
  246 + List<PackageSizeEntity> sizeList = JSONArray.parseArray(sizeJson, PackageSizeEntity.class);
  247 + DeliveryInfoEntity deliveryInfo = deliveryInfoService.save(delivery, sizeList);
  248 +
  249 + // 生成报文并且发送
  250 + String rootPath = request.getSession().getServletContext().getRealPath("/");
  251 + String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml";
  252 + new XmlBuildTask(deliveryInfoService.deliveryXml(delivery), path).perform();
  253 +
  254 + // String xml = XmlUtil.convertToXml2(deliveryInfoService.deliveryXml(delivery),
  255 + // path);
  256 + // new XmlSendTask().saveMessage(xml);
  257 +
  258 + model.setData(deliveryInfo.getId());
  259 + model.setStatus(200);
  260 + } catch (Exception e) {
  261 + model.setStatus(500);
  262 + logger.error("系统异常 >>", e);
  263 + }
  264 + return model;
  265 + }
  266 +
  267 + /**
  268 + * 查询主单号是否存在
  269 + *
  270 + * @param mawbNo
  271 + * @return
  272 + */
  273 + @RequestMapping(value = "/queryMawbNo", method = { RequestMethod.POST })
  274 + @ResponseBody
  275 + public ResponseModel queryMawbId(Long id, String mawbNo) {
  276 + ResponseModel model = new ResponseModel();
  277 + List<DeliveryInfoEntity> list = null;
  278 + if (StringUtils.isNotEmpty(mawbNo)) {
  279 + list = deliveryInfoService.findByMawbNo(mawbNo);
  280 + }
  281 + boolean exist = false;
  282 + if (CollectionUtils.isNotEmpty(list)) {
  283 + if (list.size() > 1) {
  284 + exist = true;
  285 + } else if (!list.get(0).getId().equals(id)) {
  286 + exist = true;
  287 + }
  288 + }
  289 + if (exist) {
  290 + model.setStatus(500);
  291 + } else {
  292 + model.setStatus(200);
  293 + }
  294 + return model;
  295 + }
  296 +
  297 + /**
  298 + * 删除
  299 + *
  300 + * @param ids
  301 + * @return
  302 + */
  303 + @RequestMapping(value = "/delete", method = { RequestMethod.POST })
  304 + @ResponseBody
  305 + public ResponseModel delete(String ids) {
  306 + ResponseModel model = new ResponseModel();
  307 + try {
  308 + deliveryInfoService.deleteAll(ids);
  309 + model.setStatus(200);
  310 + model.setMsg(HttpJsonMsg.SUCCESS);
  311 + } catch (Exception e) {
  312 + model.setStatus(500);
  313 + model.setMsg(HttpJsonMsg.ERROR);
  314 + logger.error("系统异常 >>", e);
  315 + }
  316 + return model;
  317 + }
  318 +
  319 + private DataGrid<DeliveryVo> transferData(EasyPage<DeliveryInfoEntity> pageForm) {
  320 + DataGrid<DeliveryInfoEntity> list = pageForm.getData();
  321 + List<DeliveryVo> rows = new ArrayList<>();
  322 + if (CollectionUtils.isNotEmpty(list.getRows())) {
  323 + for (DeliveryInfoEntity entity : list.getRows()) {
  324 + DeliveryVo vo = new DeliveryVo();
  325 + vo.setId(entity.getId());
  326 + vo.setSupplier(entity.getSupplier());
  327 + vo.setMawbNo(entity.getMawbNo());
  328 + vo.setDestination(entity.getDestination());
  329 + vo.setGoodsName(entity.getGoodsName());
  330 + vo.setCbm(entity.getCbm());
  331 + vo.setWeight(entity.getWeight());
  332 + vo.setScheduledFlight(entity.getScheduledFlight());
  333 + if (entity.getAgent() != null) {
  334 + BasicAgentEntity agent = agentService.findOne(entity.getAgent());
  335 + if (agent != null) {
  336 + vo.setAgent(agent.getNameCn());
  337 + }
  338 + }
  339 + if (entity.getSendDate() != null) {
  340 + vo.setSendDate(Constant.dateFormat.format(entity.getSendDate()));
  341 + }
  342 + rows.add(vo);
  343 + }
  344 + }
  345 + DataGrid<DeliveryVo> vos = new DataGrid<>();
  346 + vos.setRows(rows);
  347 + vos.setTotal(list.getTotal());
  348 + return vos;
  349 + }
  350 +
  351 + // 发送报文
  352 + @RequestMapping(value = "/xml", method = RequestMethod.POST)
  353 + @ResponseBody
  354 + public ResponseModel createXml(Long id, HttpServletRequest request, HttpServletResponse response) throws Exception {
  355 + ResponseModel model = new ResponseModel();
  356 + String rootPath = request.getSession().getServletContext().getRealPath("/");
  357 + String path = rootPath + "/excel/delivery" + new Date().getTime() + ".xml";
  358 + String xml = "";
  359 + if (id != null) {
  360 + xml = beanToXml(path, id);
  361 + }
  362 + model.setData(xml);
  363 + return model;
  364 + }
346 365
347 private String beanToXml(String path, Long id) { 366 private String beanToXml(String path, Long id) {
348 - //获取表中信息  
349 - DeliveryInfoEntity deliveryInfo = deliveryInfoService.findOne(id);  
350 - //创建xml  
351 - DeliveryInfoMasterConsignmentXml mas = new DeliveryInfoMasterConsignmentXml();  
352 - mas.setId(deliveryInfo.getMawbNo());  
353 - mas.setNilcarriagevalueindicator("true");  
354 - mas.setDeclaredvalueforcarriageamount(deliveryInfo.getDeclaredvalueforcarriageamount());  
355 -  
356 - mas.setNilcustomsvalueindicator("true");  
357 - mas.setDeclaredvalueforcustomsamount(deliveryInfo.getDeclaredvalueforcustomsamount());  
358 -  
359 - mas.setNilinsurancevalueindicator("true");  
360 - mas.setInsurancevalueamount(deliveryInfo.getInsurancevalueamount());  
361 -  
362 - mas.setTotalchargeprepaidindicator("true");  
363 - mas.setTotaldisbursementprepaidindicator("true");  
364 - mas.setIncludedtaregrossweightmeasure(deliveryInfo.getWeight());  
365 - mas.setNetweightmeasure(deliveryInfo.getRecheckWeight());  
366 - mas.setGrossvolumemeasure(deliveryInfo.getCbm());;  
367 - mas.setTotalpiecequantity(deliveryInfo.getRecheckPieces());  
368 -  
369 - //发货人  
370 - DeliveryInfoConsignorPartyXML deli = new DeliveryInfoConsignorPartyXML();  
371 - deli.setName(deliveryInfo.getC_name());  
372 - deli.setLegalid(deliveryInfo.getC_legalid());  
373 - deli.setAccountid(deliveryInfo.getC_accountid());  
374 - //发货人地址  
375 - PostalStructuredAddressXml pos = new PostalStructuredAddressXml();  
376 - pos.setPostcodeCode(deliveryInfo.getC_postcodecode());  
377 - pos.setStreetName(deliveryInfo.getC_streetname());  
378 - pos.setCityName(deliveryInfo.getC_cityname());  
379 - pos.setCountryID(deliveryInfo.getC_countryid());  
380 - pos.setCountryName(deliveryInfo.getC_countryname());  
381 - pos.setCountrySubDivisionName(deliveryInfo.getC_countrysubdivisionname());  
382 - pos.setPostOfficeBox(deliveryInfo.getC_postofficebox());  
383 - pos.setCityID(deliveryInfo.getC_partycityid());  
384 - pos.setCountrySubDivisionID(deliveryInfo.getC_countrysubdivisionid());  
385 - deli.setPostalstructuredaddress(pos);  
386 - //发货人电话  
387 - DefinedTradeContactXml def = new DefinedTradeContactXml();  
388 - def.setPersonname(deliveryInfo.getC_personname());  
389 - def.setDepartmentname(deliveryInfo.getC_departmentname());  
390 -  
391 - DirectTelephoneCommunicationXml die = new DirectTelephoneCommunicationXml();  
392 - die.setCompleteNumber(deliveryInfo.getC_number());  
393 - def.setDirecttelephonecommunication(die);  
394 -  
395 - FaxCommunicationxML fax = new FaxCommunicationxML();  
396 - fax.setCompletenumber(deliveryInfo.getC_completenumber());  
397 - def.setFaxcommunication(fax);  
398 -  
399 - URIEmailCommunicationXML uri = new URIEmailCommunicationXML();  
400 - uri.setUriid(deliveryInfo.getC_uriid());  
401 - def.setUriemailcommunication(uri);  
402 -  
403 - TelexCommunicationXml tel = new TelexCommunicationXml();  
404 - tel.setCompleteNumber(deliveryInfo.getC_completenumbers());  
405 - def.setTelexcommunication(tel);  
406 -  
407 - deli.setDefinedtradecontact(def);  
408 - mas.setConsignorparty(deli);  
409 -  
410 - //收货人  
411 - DeliveryInfoConsigneePartyXml del = new DeliveryInfoConsigneePartyXml();  
412 - del.setName(deliveryInfo.getS_name());  
413 - del.setLegalid(deliveryInfo.getS_legalid());  
414 - del.setAccountid(deliveryInfo.getS_accountid());  
415 - //地址  
416 - PostalStructuredAddressXml poss = new PostalStructuredAddressXml();  
417 - poss.setPostcodeCode(deliveryInfo.getS_postcodecode());  
418 - poss.setStreetName(deliveryInfo.getS_streetname());  
419 - poss.setCityName(deliveryInfo.getS_cityname());  
420 - poss.setCountryID(deliveryInfo.getS_countryid());  
421 - poss.setCountryName(deliveryInfo.getS_countryname());  
422 - poss.setCountrySubDivisionName(deliveryInfo.getS_countrysubdivisionname());  
423 - poss.setPostOfficeBox(deliveryInfo.getS_postofficebox());  
424 - poss.setCityID(deliveryInfo.getS_partycityid());  
425 - poss.setCountrySubDivisionID(deliveryInfo.getS_countrysubdivisionid());  
426 - del.setPostalstructuredaddress(poss);  
427 -  
428 - //电话  
429 - DefinedTradeContactXml deff = new DefinedTradeContactXml();  
430 - deff.setPersonname(deliveryInfo.getS_personname());  
431 - deff.setDepartmentname(deliveryInfo.getC_departmentname());  
432 -  
433 - DirectTelephoneCommunicationXml diee = new DirectTelephoneCommunicationXml();  
434 - diee.setCompleteNumber(deliveryInfo.getS_number());  
435 - deff.setDirecttelephonecommunication(diee);  
436 -  
437 - FaxCommunicationxML faxx = new FaxCommunicationxML();  
438 - faxx.setCompletenumber(deliveryInfo.getS_completenumber());  
439 - deff.setFaxcommunication(faxx);  
440 -  
441 - URIEmailCommunicationXML urii = new URIEmailCommunicationXML();  
442 - urii.setUriid(deliveryInfo.getS_uriid());  
443 - deff.setUriemailcommunication(urii);  
444 -  
445 - TelexCommunicationXml tell = new TelexCommunicationXml();  
446 - tell.setCompleteNumber(deliveryInfo.getS_completenumbers());  
447 - deff.setTelexcommunication(tell);  
448 -  
449 - del.setDefinedtradecontact(deff);  
450 - mas.setConsigneeparty(del);  
451 -  
452 - //填开代理人  
453 - DeliveryInfoFreightForwarderPartyXml defr = new DeliveryInfoFreightForwarderPartyXml();  
454 - defr.setName(deliveryInfo.getF_name());  
455 - defr.setLegalid(deliveryInfo.getF_legalid());  
456 - defr.setAccountid(deliveryInfo.getF_accountid());  
457 - //地址  
458 - PostalStructuredAddressXml stru = new PostalStructuredAddressXml();  
459 - stru.setPostcodeCode(deliveryInfo.getF_postcodecode());  
460 - stru.setStreetName(deliveryInfo.getF_streetname());  
461 - stru.setCityName(deliveryInfo.getF_cityname());  
462 - stru.setCountryID(deliveryInfo.getF_countryid());  
463 - stru.setCountryName(deliveryInfo.getF_countryname());  
464 - stru.setCountrySubDivisionName(deliveryInfo.getF_countrysubdivisionname());  
465 - stru.setPostOfficeBox(deliveryInfo.getF_postofficebox());  
466 - stru.setCityID(deliveryInfo.getF_cityid());  
467 - stru.setCountrySubDivisionID(deliveryInfo.getF_countrysubdivisionid());  
468 - defr.setPostalstructuredaddress(stru);  
469 -  
470 - //电话  
471 - DefinedTradeContactXml detf = new DefinedTradeContactXml();  
472 - detf.setPersonname(deliveryInfo.getF_personname());  
473 - detf.setDepartmentname(deliveryInfo.getF_departmentname());  
474 -  
475 - DirectTelephoneCommunicationXml dieef = new DirectTelephoneCommunicationXml();  
476 - dieef.setCompleteNumber(deliveryInfo.getF_number());  
477 - detf.setDirecttelephonecommunication(dieef);  
478 -  
479 - FaxCommunicationxML faxxf = new FaxCommunicationxML();  
480 - faxxf.setCompletenumber(deliveryInfo.getF_completenumber());  
481 - detf.setFaxcommunication(faxxf);  
482 -  
483 - URIEmailCommunicationXML uriif = new URIEmailCommunicationXML();  
484 - uriif.setUriid(deliveryInfo.getF_uriid());  
485 - detf.setUriemailcommunication(uriif);  
486 -  
487 - TelexCommunicationXml tellf = new TelexCommunicationXml();  
488 - tellf.setCompleteNumber(deliveryInfo.getF_completenumbers());  
489 - detf.setTelexcommunication(tellf);  
490 -  
491 - defr.setDefinedtradecontact(detf);  
492 - mas.setFreightforwarderparty(defr);  
493 -  
494 - //其他代理人  
495 - DeliveryInfoAssociatedPartyXml deliin = new DeliveryInfoAssociatedPartyXml();  
496 - deliin.setName(deliveryInfo.getA_name());  
497 - deliin.setLegalid(deliveryInfo.getA_legalid());  
498 - deliin.setAccountid(deliveryInfo.getA_accountid());  
499 - //地址  
500 - PostalStructuredAddressXml struip = new PostalStructuredAddressXml();  
501 - struip.setPostcodeCode(deliveryInfo.getP_postcodecode());  
502 - struip.setStreetName(deliveryInfo.getP_streetname());  
503 - struip.setCityName(deliveryInfo.getP_cityname());  
504 - struip.setCountryID(deliveryInfo.getP_countryid());  
505 - struip.setCountryName(deliveryInfo.getP_countryname());  
506 - struip.setCountrySubDivisionName(deliveryInfo.getP_countrysubdivisionname());  
507 - struip.setPostOfficeBox(deliveryInfo.getP_postofficebox());  
508 - struip.setCityID(deliveryInfo.getP_cityid());  
509 - struip.setCountrySubDivisionID(deliveryInfo.getP_countrysubdivisionid());  
510 - deliin.setPostalstructuredaddress(stru);  
511 -  
512 - //电话  
513 - DefinedTradeContactXml detfip = new DefinedTradeContactXml();  
514 - detfip.setPersonname(deliveryInfo.getP_personname());  
515 - detfip.setDepartmentname(deliveryInfo.getP_departmentname());  
516 -  
517 - DirectTelephoneCommunicationXml dieefip = new DirectTelephoneCommunicationXml();  
518 - dieefip.setCompleteNumber(deliveryInfo.getP_number());  
519 - detfip.setDirecttelephonecommunication(dieefip);  
520 -  
521 - FaxCommunicationxML faxxfip = new FaxCommunicationxML();  
522 - faxxfip.setCompletenumber(deliveryInfo.getP_completenumber());  
523 - detfip.setFaxcommunication(faxxfip);  
524 -  
525 - URIEmailCommunicationXML uriifip = new URIEmailCommunicationXML();  
526 - uriifip.setUriid(deliveryInfo.getP_uriid());  
527 - detfip.setUriemailcommunication(uriifip);  
528 -  
529 - TelexCommunicationXml tellfip = new TelexCommunicationXml();  
530 - tellfip.setCompleteNumber(deliveryInfo.getP_completenumbers());  
531 - detfip.setTelexcommunication(tellfip);  
532 -  
533 - deliin.setDefinedtradecontact(detfip);  
534 - mas.setAssociatedparty(deliin);  
535 -  
536 - //实发站  
537 - OriginLocationXml ori = new OriginLocationXml();  
538 - ori.setId(deliveryInfo.getOriginlocationid());  
539 - ori.setName(deliveryInfo.getOriginlocationname());  
540 - mas.setOriginlocation(ori);  
541 -  
542 - //目的站  
543 - FinalDestinationLocationXml fina = new FinalDestinationLocationXml();  
544 - fina.setId(deliveryInfo.getFinaldestinationlocationid());  
545 - fina.setName(deliveryInfo.getFinaldestinationlocationname());  
546 - mas.setFinaldestinationlocation(fina);  
547 -  
548 - //订仓信息  
549 - SpecifiedLogisticsTransportMovementXml spec = new SpecifiedLogisticsTransportMovementXml();  
550 - spec.setStagecode(deliveryInfo.getStagecode());  
551 - spec.setModecode(deliveryInfo.getModecode());  
552 - spec.setMode(deliveryInfo.getM_mode());  
553 - spec.setId(deliveryInfo.getM_id());  
554 -  
555 - UsedLogisticsTransportMeansXml used = new UsedLogisticsTransportMeansXml();  
556 - used.setName(deliveryInfo.getM_name());  
557 - spec.setUsedlogisticstransportmeans(used);  
558 -  
559 -  
560 - ArrivalEventXml arrivalevent = new ArrivalEventXml();  
561 - arrivalevent.setScheduledoccurrencedatetime(deliveryInfo.getSc_datetime().toString());  
562 -  
563 - OccurrenceArrivalLocationXml occ = new OccurrenceArrivalLocationXml();  
564 - occ.setId(deliveryInfo.getSc_id());  
565 - occ.setName(deliveryInfo.getSc_name());  
566 - occ.setTypecode(deliveryInfo.getSc_typecode());  
567 - arrivalevent.setOccurrencearrivallocation(occ);  
568 - spec.setArrivalevent(arrivalevent);  
569 -  
570 - DepartureEventXml departureevent = new DepartureEventXml();  
571 - departureevent.setScheduledoccurrencedatetime(deliveryInfo.getSo_datetime().toString());  
572 -  
573 - OccurrenceDepartureLocationXml ocu = new OccurrenceDepartureLocationXml();  
574 - ocu.setId(deliveryInfo.getSc_id());  
575 - ocu.setName(deliveryInfo.getSc_name());  
576 - ocu.setTypecode(deliveryInfo.getSc_typecode());  
577 -  
578 - departureevent.setOccurrencedeparturelocation(ocu);  
579 - spec.setDepartureevent(departureevent);  
580 -  
581 - spec.setSequencenumeric("1");  
582 - mas.setSpecifiedlogisticstransportmovement(spec);  
583 -  
584 - //处理说明  
585 - HandlingInstructionsXml hand = new HandlingInstructionsXml();  
586 - hand.setDescription(deliveryInfo.getSeq2_description());  
587 - hand.setDescriptioncode(deliveryInfo.getSeq2_descriptioncode());  
588 - mas.setHandlinginstructions(hand);  
589 -  
590 - //相关文件  
591 - AssociatedReferenceDocumentXml ass = new AssociatedReferenceDocumentXml();  
592 - ass.setId(deliveryInfo.getAss_id());  
593 - ass.setIssuedatetime(deliveryInfo.getAss_issuedatetime().toString());  
594 - ass.setTypecode(deliveryInfo.getAss_typecode());  
595 - ass.setName(deliveryInfo.getAss_name());  
596 - mas.setAssociatedreferencedocument(ass);  
597 -  
598 - //海关相关代码  
599 - IncludedCustomsNoteXml inc = new IncludedCustomsNoteXml();  
600 - inc.setContentcode(deliveryInfo.getAss_contentcode());  
601 - inc.setContent(deliveryInfo.getAss_content());  
602 - inc.setSubjectcode(deliveryInfo.getAss_subjectcode());  
603 - inc.setCountryid(deliveryInfo.getAss_countryid());  
604 - mas.setIncludedcustomsnote(inc);  
605 -  
606 - //货物信息  
607 - IncludedMasterConsignmentItemXml clide = new IncludedMasterConsignmentItemXml();  
608 - clide.setSequencenumeric(deliveryInfo.getInc_sequencenumeric());  
609 - clide.setTypecode(deliveryInfo.getAss_typecode());  
610 - clide.setGrossweightmeasure(deliveryInfo.getInc_grossweightmeasure());  
611 - clide.setGrossvolumemeasure(deliveryInfo.getInc_grossvolumemeasure());  
612 - clide.setTotalchargeamount(deliveryInfo.getInc_totalchargeamount());  
613 - clide.setPiecequantity(deliveryInfo.getInc_piecequantity());  
614 - clide.setTareweightmeasure(deliveryInfo.getInc_tareweightmeasure());  
615 - clide.setVolumetricfactor(deliveryInfo.getInc_volumetricfactor());  
616 -  
617 - NatureIdentificationTransportCargoXml natu = new NatureIdentificationTransportCargoXml();  
618 - natu.setExtraidentification(deliveryInfo.getInc_extraidentification());  
619 - natu.setIdentification(deliveryInfo.getInc_identification());  
620 - clide.setNatureidentificationtransportcargo(natu);  
621 -  
622 - TransportLogisticsPackageXml tr = new TransportLogisticsPackageXml();  
623 - tr.setItemQuantity(deliveryInfo.getInc_itemquantity());  
624 -  
625 - LinearSpatialDimensionXml linde = new LinearSpatialDimensionXml();  
626 - linde.setDescription("true");  
627 - linde.setHeightmeasure(deliveryInfo.getInc_heightmeasure());  
628 - linde.setLengthmeasure(deliveryInfo.getInc_lengthmeasure());  
629 - linde.setWidthmeasure(deliveryInfo.getInc_widthmeasure());  
630 - tr.setLinearSpatialDimension(linde);  
631 -  
632 - clide.setTransportlogisticspackage(tr);  
633 -  
634 -  
635 - ApplicableFreightRateServiceChargeXml app = new ApplicableFreightRateServiceChargeXml();  
636 - app.setAppliedamount(deliveryInfo.getInc_appliedamount());  
637 - app.setAppliedrate(deliveryInfo.getInc_appliedrate());  
638 - app.setCategorycode(deliveryInfo.getInc_chargeableweightmeasure());  
639 - app.setChargeableweightmeasure(deliveryInfo.getInc_chargeableweightmeasure());  
640 - app.setCommodityitemid(deliveryInfo.getInc_commodityitemid());  
641 - clide.setApplicablefreightrateservicecharge(app);  
642 -  
643 - mas.setIncludedmasterconsignmentitem(clide);  
644 -  
645 - //状态  
646 - ReportedStatusXml reop = new ReportedStatusXml();  
647 - reop.setReasonCode(deliveryInfo.getInc_reasoncode());  
648 - reop.setOperationCode(deliveryInfo.getInc_operationcode());  
649 -  
650 - EventTimeXml even = new EventTimeXml();  
651 - even.setOccurrencedatetime(deliveryInfo.getInc_occurrencedatetime().toString());  
652 - even.setDatetimetypecode(deliveryInfo.getInc_datetimetypecode());  
653 - reop.setEventTime(even);  
654 -  
655 - SpecifiedLocationXml spe = new SpecifiedLocationXml();  
656 - spe.setId(deliveryInfo.getSpe_id());  
657 - spe.setName(deliveryInfo.getSpe_name());  
658 - spe.setTypecode(deliveryInfo.getSpe_typecode());  
659 - reop.setSpecifiedLocation(spe);  
660 -  
661 - mas.setReportedstatus(reop);  
662 -  
663 - String xml = XmlUtil.convertToXml2(mas, path);  
664 -  
665 -// System.out.println(xml);  
666 -// IMFServletManifst mis = new IMFServletManifst();  
667 -// mis.init(xml.toString());  
668 - 367 + // 获取表中信息
  368 + DeliveryInfoEntity deliveryInfo = deliveryInfoService.findOne(id);
  369 + // 创建xml
  370 + DeliveryInfoMasterConsignmentXml mas = new DeliveryInfoMasterConsignmentXml();
  371 + mas.setId(deliveryInfo.getMawbNo());
  372 + mas.setNilcarriagevalueindicator("true");
  373 + mas.setDeclaredvalueforcarriageamount(deliveryInfo.getDeclaredvalueforcarriageamount());
  374 +
  375 + mas.setNilcustomsvalueindicator("true");
  376 + mas.setDeclaredvalueforcustomsamount(deliveryInfo.getDeclaredvalueforcustomsamount());
  377 +
  378 + mas.setNilinsurancevalueindicator("true");
  379 + mas.setInsurancevalueamount(deliveryInfo.getInsurancevalueamount());
  380 +
  381 + mas.setTotalchargeprepaidindicator("true");
  382 + mas.setTotaldisbursementprepaidindicator("true");
  383 + mas.setIncludedtaregrossweightmeasure(deliveryInfo.getWeight());
  384 + mas.setNetweightmeasure(deliveryInfo.getRecheckWeight());
  385 + mas.setGrossvolumemeasure(deliveryInfo.getCbm());
  386 + ;
  387 + mas.setTotalpiecequantity(deliveryInfo.getRecheckPieces());
  388 +
  389 + // 发货人
  390 + DeliveryInfoConsignorPartyXML deli = new DeliveryInfoConsignorPartyXML();
  391 + deli.setName(deliveryInfo.getC_name());
  392 + deli.setLegalid(deliveryInfo.getC_legalid());
  393 + deli.setAccountid(deliveryInfo.getC_accountid());
  394 + // 发货人地址
  395 + PostalStructuredAddressXml pos = new PostalStructuredAddressXml();
  396 + pos.setPostcodeCode(deliveryInfo.getC_postcodecode());
  397 + pos.setStreetName(deliveryInfo.getC_streetname());
  398 + pos.setCityName(deliveryInfo.getC_cityname());
  399 + pos.setCountryID(deliveryInfo.getC_countryid());
  400 + pos.setCountryName(deliveryInfo.getC_countryname());
  401 + pos.setCountrySubDivisionName(deliveryInfo.getC_countrysubdivisionname());
  402 + pos.setPostOfficeBox(deliveryInfo.getC_postofficebox());
  403 + pos.setCityID(deliveryInfo.getC_partycityid());
  404 + pos.setCountrySubDivisionID(deliveryInfo.getC_countrysubdivisionid());
  405 + deli.setPostalstructuredaddress(pos);
  406 + // 发货人电话
  407 + DefinedTradeContactXml def = new DefinedTradeContactXml();
  408 + def.setPersonname(deliveryInfo.getC_personname());
  409 + def.setDepartmentname(deliveryInfo.getC_departmentname());
  410 +
  411 + DirectTelephoneCommunicationXml die = new DirectTelephoneCommunicationXml();
  412 + die.setCompleteNumber(deliveryInfo.getC_number());
  413 + def.setDirecttelephonecommunication(die);
  414 +
  415 + FaxCommunicationxML fax = new FaxCommunicationxML();
  416 + fax.setCompletenumber(deliveryInfo.getC_completenumber());
  417 + def.setFaxcommunication(fax);
  418 +
  419 + URIEmailCommunicationXML uri = new URIEmailCommunicationXML();
  420 + uri.setUriid(deliveryInfo.getC_uriid());
  421 + def.setUriemailcommunication(uri);
  422 +
  423 + TelexCommunicationXml tel = new TelexCommunicationXml();
  424 + tel.setCompleteNumber(deliveryInfo.getC_completenumbers());
  425 + def.setTelexcommunication(tel);
  426 +
  427 + deli.setDefinedtradecontact(def);
  428 + mas.setConsignorparty(deli);
  429 +
  430 + // 收货人
  431 + DeliveryInfoConsigneePartyXml del = new DeliveryInfoConsigneePartyXml();
  432 + del.setName(deliveryInfo.getS_name());
  433 + del.setLegalid(deliveryInfo.getS_legalid());
  434 + del.setAccountid(deliveryInfo.getS_accountid());
  435 + // 地址
  436 + PostalStructuredAddressXml poss = new PostalStructuredAddressXml();
  437 + poss.setPostcodeCode(deliveryInfo.getS_postcodecode());
  438 + poss.setStreetName(deliveryInfo.getS_streetname());
  439 + poss.setCityName(deliveryInfo.getS_cityname());
  440 + poss.setCountryID(deliveryInfo.getS_countryid());
  441 + poss.setCountryName(deliveryInfo.getS_countryname());
  442 + poss.setCountrySubDivisionName(deliveryInfo.getS_countrysubdivisionname());
  443 + poss.setPostOfficeBox(deliveryInfo.getS_postofficebox());
  444 + poss.setCityID(deliveryInfo.getS_partycityid());
  445 + poss.setCountrySubDivisionID(deliveryInfo.getS_countrysubdivisionid());
  446 + del.setPostalstructuredaddress(poss);
  447 +
  448 + // 电话
  449 + DefinedTradeContactXml deff = new DefinedTradeContactXml();
  450 + deff.setPersonname(deliveryInfo.getS_personname());
  451 + deff.setDepartmentname(deliveryInfo.getC_departmentname());
  452 +
  453 + DirectTelephoneCommunicationXml diee = new DirectTelephoneCommunicationXml();
  454 + diee.setCompleteNumber(deliveryInfo.getS_number());
  455 + deff.setDirecttelephonecommunication(diee);
  456 +
  457 + FaxCommunicationxML faxx = new FaxCommunicationxML();
  458 + faxx.setCompletenumber(deliveryInfo.getS_completenumber());
  459 + deff.setFaxcommunication(faxx);
  460 +
  461 + URIEmailCommunicationXML urii = new URIEmailCommunicationXML();
  462 + urii.setUriid(deliveryInfo.getS_uriid());
  463 + deff.setUriemailcommunication(urii);
  464 +
  465 + TelexCommunicationXml tell = new TelexCommunicationXml();
  466 + tell.setCompleteNumber(deliveryInfo.getS_completenumbers());
  467 + deff.setTelexcommunication(tell);
  468 +
  469 + del.setDefinedtradecontact(deff);
  470 + mas.setConsigneeparty(del);
  471 +
  472 + // 填开代理人
  473 + DeliveryInfoFreightForwarderPartyXml defr = new DeliveryInfoFreightForwarderPartyXml();
  474 + defr.setName(deliveryInfo.getF_name());
  475 + defr.setLegalid(deliveryInfo.getF_legalid());
  476 + defr.setAccountid(deliveryInfo.getF_accountid());
  477 + // 地址
  478 + PostalStructuredAddressXml stru = new PostalStructuredAddressXml();
  479 + stru.setPostcodeCode(deliveryInfo.getF_postcodecode());
  480 + stru.setStreetName(deliveryInfo.getF_streetname());
  481 + stru.setCityName(deliveryInfo.getF_cityname());
  482 + stru.setCountryID(deliveryInfo.getF_countryid());
  483 + stru.setCountryName(deliveryInfo.getF_countryname());
  484 + stru.setCountrySubDivisionName(deliveryInfo.getF_countrysubdivisionname());
  485 + stru.setPostOfficeBox(deliveryInfo.getF_postofficebox());
  486 + stru.setCityID(deliveryInfo.getF_cityid());
  487 + stru.setCountrySubDivisionID(deliveryInfo.getF_countrysubdivisionid());
  488 + defr.setPostalstructuredaddress(stru);
  489 +
  490 + // 电话
  491 + DefinedTradeContactXml detf = new DefinedTradeContactXml();
  492 + detf.setPersonname(deliveryInfo.getF_personname());
  493 + detf.setDepartmentname(deliveryInfo.getF_departmentname());
  494 +
  495 + DirectTelephoneCommunicationXml dieef = new DirectTelephoneCommunicationXml();
  496 + dieef.setCompleteNumber(deliveryInfo.getF_number());
  497 + detf.setDirecttelephonecommunication(dieef);
  498 +
  499 + FaxCommunicationxML faxxf = new FaxCommunicationxML();
  500 + faxxf.setCompletenumber(deliveryInfo.getF_completenumber());
  501 + detf.setFaxcommunication(faxxf);
  502 +
  503 + URIEmailCommunicationXML uriif = new URIEmailCommunicationXML();
  504 + uriif.setUriid(deliveryInfo.getF_uriid());
  505 + detf.setUriemailcommunication(uriif);
  506 +
  507 + TelexCommunicationXml tellf = new TelexCommunicationXml();
  508 + tellf.setCompleteNumber(deliveryInfo.getF_completenumbers());
  509 + detf.setTelexcommunication(tellf);
  510 +
  511 + defr.setDefinedtradecontact(detf);
  512 + mas.setFreightforwarderparty(defr);
  513 +
  514 + // 其他代理人
  515 + DeliveryInfoAssociatedPartyXml deliin = new DeliveryInfoAssociatedPartyXml();
  516 + deliin.setName(deliveryInfo.getA_name());
  517 + deliin.setLegalid(deliveryInfo.getA_legalid());
  518 + deliin.setAccountid(deliveryInfo.getA_accountid());
  519 + // 地址
  520 + PostalStructuredAddressXml struip = new PostalStructuredAddressXml();
  521 + struip.setPostcodeCode(deliveryInfo.getP_postcodecode());
  522 + struip.setStreetName(deliveryInfo.getP_streetname());
  523 + struip.setCityName(deliveryInfo.getP_cityname());
  524 + struip.setCountryID(deliveryInfo.getP_countryid());
  525 + struip.setCountryName(deliveryInfo.getP_countryname());
  526 + struip.setCountrySubDivisionName(deliveryInfo.getP_countrysubdivisionname());
  527 + struip.setPostOfficeBox(deliveryInfo.getP_postofficebox());
  528 + struip.setCityID(deliveryInfo.getP_cityid());
  529 + struip.setCountrySubDivisionID(deliveryInfo.getP_countrysubdivisionid());
  530 + deliin.setPostalstructuredaddress(stru);
  531 +
  532 + // 电话
  533 + DefinedTradeContactXml detfip = new DefinedTradeContactXml();
  534 + detfip.setPersonname(deliveryInfo.getP_personname());
  535 + detfip.setDepartmentname(deliveryInfo.getP_departmentname());
  536 +
  537 + DirectTelephoneCommunicationXml dieefip = new DirectTelephoneCommunicationXml();
  538 + dieefip.setCompleteNumber(deliveryInfo.getP_number());
  539 + detfip.setDirecttelephonecommunication(dieefip);
  540 +
  541 + FaxCommunicationxML faxxfip = new FaxCommunicationxML();
  542 + faxxfip.setCompletenumber(deliveryInfo.getP_completenumber());
  543 + detfip.setFaxcommunication(faxxfip);
  544 +
  545 + URIEmailCommunicationXML uriifip = new URIEmailCommunicationXML();
  546 + uriifip.setUriid(deliveryInfo.getP_uriid());
  547 + detfip.setUriemailcommunication(uriifip);
  548 +
  549 + TelexCommunicationXml tellfip = new TelexCommunicationXml();
  550 + tellfip.setCompleteNumber(deliveryInfo.getP_completenumbers());
  551 + detfip.setTelexcommunication(tellfip);
  552 +
  553 + deliin.setDefinedtradecontact(detfip);
  554 + mas.setAssociatedparty(deliin);
  555 +
  556 + // 实发站
  557 + OriginLocationXml ori = new OriginLocationXml();
  558 + ori.setId(deliveryInfo.getOriginlocationid());
  559 + ori.setName(deliveryInfo.getOriginlocationname());
  560 + mas.setOriginlocation(ori);
  561 +
  562 + // 目的站
  563 + FinalDestinationLocationXml fina = new FinalDestinationLocationXml();
  564 + fina.setId(deliveryInfo.getFinaldestinationlocationid());
  565 + fina.setName(deliveryInfo.getFinaldestinationlocationname());
  566 + mas.setFinaldestinationlocation(fina);
  567 +
  568 + // 订仓信息
  569 + SpecifiedLogisticsTransportMovementXml spec = new SpecifiedLogisticsTransportMovementXml();
  570 + spec.setStagecode(deliveryInfo.getStagecode());
  571 + spec.setModecode(deliveryInfo.getModecode());
  572 + spec.setMode(deliveryInfo.getM_mode());
  573 + spec.setId(deliveryInfo.getM_id());
  574 +
  575 + UsedLogisticsTransportMeansXml used = new UsedLogisticsTransportMeansXml();
  576 + used.setName(deliveryInfo.getM_name());
  577 + spec.setUsedlogisticstransportmeans(used);
  578 +
  579 + ArrivalEventXml arrivalevent = new ArrivalEventXml();
  580 + arrivalevent.setScheduledoccurrencedatetime(deliveryInfo.getSc_datetime().toString());
  581 +
  582 + OccurrenceArrivalLocationXml occ = new OccurrenceArrivalLocationXml();
  583 + occ.setId(deliveryInfo.getSc_id());
  584 + occ.setName(deliveryInfo.getSc_name());
  585 + occ.setTypecode(deliveryInfo.getSc_typecode());
  586 + arrivalevent.setOccurrencearrivallocation(occ);
  587 + spec.setArrivalevent(arrivalevent);
  588 +
  589 + DepartureEventXml departureevent = new DepartureEventXml();
  590 + departureevent.setScheduledoccurrencedatetime(deliveryInfo.getSo_datetime().toString());
  591 +
  592 + OccurrenceDepartureLocationXml ocu = new OccurrenceDepartureLocationXml();
  593 + ocu.setId(deliveryInfo.getSc_id());
  594 + ocu.setName(deliveryInfo.getSc_name());
  595 + ocu.setTypecode(deliveryInfo.getSc_typecode());
  596 +
  597 + departureevent.setOccurrencedeparturelocation(ocu);
  598 + spec.setDepartureevent(departureevent);
  599 +
  600 + spec.setSequencenumeric("1");
  601 + mas.setSpecifiedlogisticstransportmovement(spec);
  602 +
  603 + // 处理说明
  604 + HandlingInstructionsXml hand = new HandlingInstructionsXml();
  605 + hand.setDescription(deliveryInfo.getSeq2_description());
  606 + hand.setDescriptioncode(deliveryInfo.getSeq2_descriptioncode());
  607 + mas.setHandlinginstructions(hand);
  608 +
  609 + // 相关文件
  610 + AssociatedReferenceDocumentXml ass = new AssociatedReferenceDocumentXml();
  611 + ass.setId(deliveryInfo.getAss_id());
  612 + ass.setIssuedatetime(deliveryInfo.getAss_issuedatetime().toString());
  613 + ass.setTypecode(deliveryInfo.getAss_typecode());
  614 + ass.setName(deliveryInfo.getAss_name());
  615 + mas.setAssociatedreferencedocument(ass);
  616 +
  617 + // 海关相关代码
  618 + IncludedCustomsNoteXml inc = new IncludedCustomsNoteXml();
  619 + inc.setContentcode(deliveryInfo.getAss_contentcode());
  620 + inc.setContent(deliveryInfo.getAss_content());
  621 + inc.setSubjectcode(deliveryInfo.getAss_subjectcode());
  622 + inc.setCountryid(deliveryInfo.getAss_countryid());
  623 + mas.setIncludedcustomsnote(inc);
  624 +
  625 + // 货物信息
  626 + IncludedMasterConsignmentItemXml clide = new IncludedMasterConsignmentItemXml();
  627 + clide.setSequencenumeric(deliveryInfo.getInc_sequencenumeric());
  628 + clide.setTypecode(deliveryInfo.getAss_typecode());
  629 + clide.setGrossweightmeasure(deliveryInfo.getInc_grossweightmeasure());
  630 + clide.setGrossvolumemeasure(deliveryInfo.getInc_grossvolumemeasure());
  631 + clide.setTotalchargeamount(deliveryInfo.getInc_totalchargeamount());
  632 + clide.setPiecequantity(deliveryInfo.getInc_piecequantity());
  633 + clide.setTareweightmeasure(deliveryInfo.getInc_tareweightmeasure());
  634 + clide.setVolumetricfactor(deliveryInfo.getInc_volumetricfactor());
  635 +
  636 + NatureIdentificationTransportCargoXml natu = new NatureIdentificationTransportCargoXml();
  637 + natu.setExtraidentification(deliveryInfo.getInc_extraidentification());
  638 + natu.setIdentification(deliveryInfo.getInc_identification());
  639 + clide.setNatureidentificationtransportcargo(natu);
  640 +
  641 + TransportLogisticsPackageXml tr = new TransportLogisticsPackageXml();
  642 + tr.setItemQuantity(deliveryInfo.getInc_itemquantity());
  643 +
  644 + LinearSpatialDimensionXml linde = new LinearSpatialDimensionXml();
  645 + linde.setDescription("true");
  646 + linde.setHeightmeasure(deliveryInfo.getInc_heightmeasure());
  647 + linde.setLengthmeasure(deliveryInfo.getInc_lengthmeasure());
  648 + linde.setWidthmeasure(deliveryInfo.getInc_widthmeasure());
  649 + tr.setLinearSpatialDimension(linde);
  650 +
  651 + clide.setTransportlogisticspackage(tr);
  652 +
  653 + ApplicableFreightRateServiceChargeXml app = new ApplicableFreightRateServiceChargeXml();
  654 + app.setAppliedamount(deliveryInfo.getInc_appliedamount());
  655 + app.setAppliedrate(deliveryInfo.getInc_appliedrate());
  656 + app.setCategorycode(deliveryInfo.getInc_chargeableweightmeasure());
  657 + app.setChargeableweightmeasure(deliveryInfo.getInc_chargeableweightmeasure());
  658 + app.setCommodityitemid(deliveryInfo.getInc_commodityitemid());
  659 + clide.setApplicablefreightrateservicecharge(app);
  660 +
  661 + mas.setIncludedmasterconsignmentitem(clide);
  662 +
  663 + // 状态
  664 + ReportedStatusXml reop = new ReportedStatusXml();
  665 + reop.setReasonCode(deliveryInfo.getInc_reasoncode());
  666 + reop.setOperationCode(deliveryInfo.getInc_operationcode());
  667 +
  668 + EventTimeXml even = new EventTimeXml();
  669 + even.setOccurrencedatetime(deliveryInfo.getInc_occurrencedatetime().toString());
  670 + even.setDatetimetypecode(deliveryInfo.getInc_datetimetypecode());
  671 + reop.setEventTime(even);
  672 +
  673 + SpecifiedLocationXml spe = new SpecifiedLocationXml();
  674 + spe.setId(deliveryInfo.getSpe_id());
  675 + spe.setName(deliveryInfo.getSpe_name());
  676 + spe.setTypecode(deliveryInfo.getSpe_typecode());
  677 + reop.setSpecifiedLocation(spe);
  678 +
  679 + mas.setReportedstatus(reop);
  680 +
  681 + String xml = XmlUtil.convertToXml2(mas, path);
  682 +
  683 + // System.out.println(xml);
  684 + // IMFServletManifst mis = new IMFServletManifst();
  685 + // mis.init(xml.toString());
  686 +
669 return xml; 687 return xml;
670 } 688 }
671 - 689 +
672 /** 690 /**
673 * * 模糊查询匹配信息 691 * * 模糊查询匹配信息
674 * 692 *
675 * @param manifest 693 * @param manifest
676 - * @return 694 + * @return
677 * @return 695 * @return
678 */ 696 */
679 - @RequestMapping(value = "/infor" ) 697 + @RequestMapping(value = "/infor")
680 @ResponseBody 698 @ResponseBody
681 public List<ManifestEntity> infor(String way) { 699 public List<ManifestEntity> infor(String way) {
682 List<ManifestEntity> li = manifestService.findByMawbNo(way); 700 List<ManifestEntity> li = manifestService.findByMawbNo(way);
683 - return li; 701 + return li;
684 } 702 }
685 - 703 +
686 } 704 }
@@ -161,7 +161,7 @@ public class HandleBillController extends BasicController{ @@ -161,7 +161,7 @@ public class HandleBillController extends BasicController{
161 // System.out.println("-------"); 161 // System.out.println("-------");
162 //发送redis储存数据 162 //发送redis储存数据
163 // System.out.println(xml); 163 // System.out.println(xml);
164 -// new RedisSaveMessage().saveMessage(xml); 164 +// new XmlSendTask().saveMessage(xml);
165 model.setStatus(200); 165 model.setStatus(200);
166 } catch (Exception e) { 166 } catch (Exception e) {
167 model.setStatus(500); 167 model.setStatus(500);
@@ -38,7 +38,6 @@ import com.agent.entity.agent.TBasCarrierEntity; @@ -38,7 +38,6 @@ import com.agent.entity.agent.TBasCarrierEntity;
38 import com.agent.entity.agent.WaybillReceiptEntity; 38 import com.agent.entity.agent.WaybillReceiptEntity;
39 import com.agent.entity.agent.WaybillReceiptType; 39 import com.agent.entity.agent.WaybillReceiptType;
40 import com.agent.entity.system.UserEntity; 40 import com.agent.entity.system.UserEntity;
41 -import com.agent.imf.agent.redis.RedisSaveMessage;  
42 import com.agent.service.agent.BasicAgentService; 41 import com.agent.service.agent.BasicAgentService;
43 import com.agent.service.agent.ConsigneeService; 42 import com.agent.service.agent.ConsigneeService;
44 import com.agent.service.agent.ConsignorService; 43 import com.agent.service.agent.ConsignorService;
@@ -55,6 +54,7 @@ import com.agent.service.system.RoleService; @@ -55,6 +54,7 @@ import com.agent.service.system.RoleService;
55 import com.agent.util.HttpJsonMsg; 54 import com.agent.util.HttpJsonMsg;
56 import com.agent.vo.ResponseModel; 55 import com.agent.vo.ResponseModel;
57 import com.agent.vo.agent.CommodityVo; 56 import com.agent.vo.agent.CommodityVo;
  57 +import com.agent.xml.XmlBuildTask;
58 import com.agent.xml.common.XmlHead; 58 import com.agent.xml.common.XmlHead;
59 import com.agent.xml.common.XmlUtil; 59 import com.agent.xml.common.XmlUtil;
60 import com.agent.xml.fhlsli.FSXmlKit; 60 import com.agent.xml.fhlsli.FSXmlKit;
@@ -139,6 +139,44 @@ public class ManifestController extends BasicController { @@ -139,6 +139,44 @@ public class ManifestController extends BasicController {
139 @Resource 139 @Resource
140 private WaybillReceiptService receiptService; 140 private WaybillReceiptService receiptService;
141 141
  142 + private BasicAgentEntity getAgent() {
  143 + UserEntity user = Tools.getUserEntity();
  144 + long agent_id = user.getAgent();
  145 + System.err.println("agent_id-->"+agent_id);
  146 +
  147 + BasicAgentEntity agent = agentService.findOne(agent_id);
  148 + if (agent == null) {
  149 + agent = new BasicAgentEntity();
  150 + }
  151 + if (StringUtils.isBlank(agent.getThreeCode())) {
  152 + agent.setThreeCode("");
  153 + }
  154 +
  155 + if (StringUtils.isBlank(agent.getNameCn())) {
  156 + agent.setNameCn("");
  157 + }
  158 +
  159 + return agent;
  160 + }
  161 +
  162 + /**
  163 + * 测试用,查看当前账号对应的代理人信息
  164 + * @param reuqest
  165 + * @param response
  166 + * @return
  167 + */
  168 + @RequestMapping(value = "/getAgent", method = { RequestMethod.GET })
  169 + @ResponseBody
  170 + public ResponseModel getAgentInfo(HttpServletRequest reuqest, HttpServletResponse response) {
  171 + ResponseModel model = new ResponseModel();
  172 + response.setHeader("Access-Control-Allow-Origin", "*");
  173 +
  174 + BasicAgentEntity agent = getAgent();
  175 + model.setData(agent);
  176 +
  177 + return model;
  178 + }
  179 +
142 /** 180 /**
143 * 列表页面 181 * 列表页面
144 * 182 *
@@ -273,13 +311,18 @@ public class ManifestController extends BasicController { @@ -273,13 +311,18 @@ public class ManifestController extends BasicController {
273 // 生成报文并且发送 311 // 生成报文并且发送
274 String rootPath = request.getSession().getServletContext().getRealPath("/"); 312 String rootPath = request.getSession().getServletContext().getRealPath("/");
275 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml"; 313 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml";
276 - System.out.println(path); // path  
277 - String ndlrxml = XmlUtil.convertToXml2(manifestService.sendNDLRXml(manifest), path);  
278 - String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDLCFXml(manifest), path);  
279 - System.out.println(ndlrxml);  
280 - System.err.println(dlcfxml);  
281 - new RedisSaveMessage().saveMessage(ndlrxml);  
282 - new RedisSaveMessage().saveMessage(dlcfxml); 314 +
  315 + // String ndlrxml = XmlUtil.convertToXml2(manifestService.sendNDLRXml(manifest),
  316 + // path);
  317 + // String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDLCFXml(manifest),
  318 + // path);
  319 + //
  320 + // new XmlSendTask(ndlrxml).send();
  321 + // new XmlSendTask(dlcfxml).send();
  322 +
  323 + new XmlBuildTask(manifestService.sendNDLRXml(manifest), path).perform();
  324 + new XmlBuildTask(manifestService.sendDLCFXml(manifest), path).perform();
  325 +
283 model.setStatus(200); 326 model.setStatus(200);
284 model.setMsg(HttpJsonMsg.SUCCESS); 327 model.setMsg(HttpJsonMsg.SUCCESS);
285 } 328 }
@@ -407,12 +450,19 @@ public class ManifestController extends BasicController { @@ -407,12 +450,19 @@ public class ManifestController extends BasicController {
407 // 生成报文并且发送 450 // 生成报文并且发送
408 String rootPath = request.getSession().getServletContext().getRealPath("/"); 451 String rootPath = request.getSession().getServletContext().getRealPath("/");
409 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml"; 452 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml";
410 - String ndlrxml = XmlUtil.convertToXml2(manifestService.presenddlcfNdlrXml(Preparesecondary), path);  
411 - String dlcfxml = XmlUtil.convertToXml2(manifestService.presenddlcfdlcfXml(Preparesecondary), path);  
412 - // 发送redis储存数据  
413 - // System.out.println(ndlrxml);  
414 - new RedisSaveMessage().saveMessage(ndlrxml);  
415 - new RedisSaveMessage().saveMessage(dlcfxml); 453 +
  454 + // String ndlrxml =
  455 + // XmlUtil.convertToXml2(manifestService.presenddlcfNdlrXml(Preparesecondary),
  456 + // path);
  457 + // String dlcfxml =
  458 + // XmlUtil.convertToXml2(manifestService.presenddlcfNdlrXml(Preparesecondary),
  459 + // path);
  460 + // new XmlSendTask(ndlrxml).send();
  461 + // new XmlSendTask(dlcfxml).send();
  462 +
  463 + new XmlBuildTask(manifestService.presenddlcfNdlrXml(Preparesecondary), path).perform();
  464 + new XmlBuildTask(manifestService.presenddlcfNdlrXml(Preparesecondary), path).perform();
  465 +
416 model.setData(Preparesecondary); 466 model.setData(Preparesecondary);
417 model.setStatus(200); 467 model.setStatus(200);
418 model.setMsg(HttpJsonMsg.SUCCESS); 468 model.setMsg(HttpJsonMsg.SUCCESS);
@@ -554,7 +604,7 @@ public class ManifestController extends BasicController { @@ -554,7 +604,7 @@ public class ManifestController extends BasicController {
554 // model.addAttribute("customsStatus",flag); 604 // model.addAttribute("customsStatus",flag);
555 605
556 String waybill_no = manifest != null ? manifest.getWaybillnomaster() : ""; 606 String waybill_no = manifest != null ? manifest.getWaybillnomaster() : "";
557 - WaybillReceiptEntity receipt = receiptService.findByWaybillNo(waybill_no); 607 + WaybillReceiptEntity receipt = receiptService.findMain(waybill_no);
558 request.setAttribute("receipt", receipt); 608 request.setAttribute("receipt", receipt);
559 609
560 return "manifest/edit"; 610 return "manifest/edit";
@@ -678,7 +728,7 @@ public class ManifestController extends BasicController { @@ -678,7 +728,7 @@ public class ManifestController extends BasicController {
678 if (pre != null && pre.getWaybillnosecondary() != null) { 728 if (pre != null && pre.getWaybillnosecondary() != null) {
679 sub_waybill_no = pre.getWaybillnosecondary(); 729 sub_waybill_no = pre.getWaybillnosecondary();
680 } 730 }
681 - WaybillReceiptEntity receipt = receiptService.findByWaybillNoAndSub(waybill_no, sub_waybill_no); 731 + WaybillReceiptEntity receipt = receiptService.findSub(waybill_no, sub_waybill_no);
682 request.setAttribute("receipt", receipt); 732 request.setAttribute("receipt", receipt);
683 733
684 return "manifest/sub_edit"; 734 return "manifest/sub_edit";
@@ -820,8 +870,8 @@ public class ManifestController extends BasicController { @@ -820,8 +870,8 @@ public class ManifestController extends BasicController {
820 manifest.setCarrier(carrier); 870 manifest.setCarrier(carrier);
821 manifest.setFlightno(flightno); 871 manifest.setFlightno(flightno);
822 872
823 -// consigneeService.saveFromManifest(manifest, Tools.getUserId());  
824 -// consignorService.saveFromManifest(manifest, Tools.getUserId()); 873 + // consigneeService.saveFromManifest(manifest, Tools.getUserId());
  874 + // consignorService.saveFromManifest(manifest, Tools.getUserId());
825 875
826 ResponseModel model = new ResponseModel(); 876 ResponseModel model = new ResponseModel();
827 try { 877 try {
@@ -870,11 +920,11 @@ public class ManifestController extends BasicController { @@ -870,11 +920,11 @@ public class ManifestController extends BasicController {
870 // System.out.println("===================deletexml==================="); 920 // System.out.println("===================deletexml===================");
871 // System.out.println(deletexml); 921 // System.out.println(deletexml);
872 922
873 - // new RedisSaveMessage().saveMessage(ndlxml); 923 + // new XmlSendTask().saveMessage(ndlxml);
874 // model.setStatus(200); 924 // model.setStatus(200);
875 925
876 WaybillReceiptType type = WaybillReceiptType.DELETE; 926 WaybillReceiptType type = WaybillReceiptType.DELETE;
877 - manifest.setResponse_text("主单——" + type.getName()); 927 + manifest.setResponse_text(type.getName());
878 manifest.setResponse_code(String.valueOf(type.getValue())); 928 manifest.setResponse_code(String.valueOf(type.getValue()));
879 manifestService.save(manifest); 929 manifestService.save(manifest);
880 receiptService.saveFromManifest(manifest, type); 930 receiptService.saveFromManifest(manifest, type);
@@ -922,8 +972,8 @@ public class ManifestController extends BasicController { @@ -922,8 +972,8 @@ public class ManifestController extends BasicController {
922 manifest.setCarrier(carrier); 972 manifest.setCarrier(carrier);
923 manifest.setFlightno(flightno); 973 manifest.setFlightno(flightno);
924 974
925 -// consigneeService.saveFromManifest(manifest, Tools.getUserId());  
926 -// consignorService.saveFromManifest(manifest, Tools.getUserId()); 975 + // consigneeService.saveFromManifest(manifest, Tools.getUserId());
  976 + // consignorService.saveFromManifest(manifest, Tools.getUserId());
927 977
928 ResponseModel model = new ResponseModel(); 978 ResponseModel model = new ResponseModel();
929 try { 979 try {
@@ -944,7 +994,7 @@ public class ManifestController extends BasicController { @@ -944,7 +994,7 @@ public class ManifestController extends BasicController {
944 // 保存 994 // 保存
945 manifest.setIsdelete(1); 995 manifest.setIsdelete(1);
946 manifest.setResponse_code(String.valueOf(type.getValue())); 996 manifest.setResponse_code(String.valueOf(type.getValue()));
947 - manifest.setResponse_text("主单——" + type.getName()); 997 + manifest.setResponse_text(type.getName());
948 manifest.setSave_time(System.currentTimeMillis()); 998 manifest.setSave_time(System.currentTimeMillis());
949 manifestService.save(manifest); 999 manifestService.save(manifest);
950 receiptService.saveFromManifest(manifest, type); 1000 receiptService.saveFromManifest(manifest, type);
@@ -954,29 +1004,32 @@ public class ManifestController extends BasicController { @@ -954,29 +1004,32 @@ public class ManifestController extends BasicController {
954 String dlcPath = MessageKit.getMessagePath(MessageType.DLCF); 1004 String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
955 String sliPath = MessageKit.getMessagePath(MessageType.SLI); 1005 String sliPath = MessageKit.getMessagePath(MessageType.SLI);
956 1006
957 - String ndlrxml = XmlUtil.convertToXml2(manifestService.sendNDLRXml(manifest), ndlrPath);  
958 - String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDLCFXml(manifest), dlcPath);  
959 - String slifxml = XmlUtil.convertToXml2(FSXmlKit.sliXml(manifest), sliPath);  
960 -  
961 - // RemoteFileKit.putFile(ndlrPath);  
962 - // RemoteFileKit.putFile(dlcPath);  
963 - // RemoteFileKit.putFile(sliPath);  
964 -  
965 - System.err.println("===================ndlrxml===================");  
966 - System.err.println(ndlrxml);  
967 - System.err.println(); 1007 + new XmlBuildTask(manifestService.sendNDLRXml(manifest), ndlrPath).perform();
  1008 + new XmlBuildTask(manifestService.sendDLCFXml(manifest), dlcPath).perform();
  1009 + new XmlBuildTask(FSXmlKit.sliXml(manifest, getAgent()), sliPath).perform();
968 1010
969 - System.err.println("===================dlcfxml===================");  
970 - System.err.println(dlcfxml);  
971 - System.err.println(); 1011 + // String ndlrxml = XmlUtil.convertToXml2(manifestService.sendNDLRXml(manifest),
  1012 + // ndlrPath);
  1013 + // String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDLCFXml(manifest),
  1014 + // dlcPath);
  1015 + // String slifxml = XmlUtil.convertToXml2(FSXmlKit.sliXml(manifest, getAgent()),
  1016 + // sliPath);
972 1017
973 - System.err.println("===================slifxml===================");  
974 - System.err.println(slifxml);  
975 - System.err.println(); 1018 + // System.err.println("===================ndlrxml===================");
  1019 + // System.err.println(ndlrxml);
  1020 + // System.err.println();
  1021 + //
  1022 + // System.err.println("===================dlcfxml===================");
  1023 + // System.err.println(dlcfxml);
  1024 + // System.err.println();
  1025 + //
  1026 + // System.err.println("===================slifxml===================");
  1027 + // System.err.println(slifxml);
  1028 + // System.err.println();
976 1029
977 - new RedisSaveMessage().saveMessage(ndlrxml);  
978 - new RedisSaveMessage().saveMessage(dlcfxml);  
979 - new RedisSaveMessage().saveMessage(slifxml); 1030 + // new XmlSendTask(ndlrxml).send();
  1031 + // new XmlSendTask(dlcfxml).send();
  1032 + // new XmlSendTask(slifxml).send();
980 1033
981 model.setData(manifest); 1034 model.setData(manifest);
982 model.setStatus(200); 1035 model.setStatus(200);
@@ -1015,9 +1068,12 @@ public class ManifestController extends BasicController { @@ -1015,9 +1068,12 @@ public class ManifestController extends BasicController {
1015 // 生成报文并且发送 1068 // 生成报文并且发送
1016 String rootPath = request.getSession().getServletContext().getRealPath("/"); 1069 String rootPath = request.getSession().getServletContext().getRealPath("/");
1017 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml"; 1070 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml";
1018 - String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDeliveryXml(manifest), path);  
1019 - // System.out.println(dlcfxml);  
1020 - new RedisSaveMessage().saveMessage(dlcfxml); 1071 + new XmlBuildTask(manifestService.sendDeliveryXml(manifest), path).perform();
  1072 +
  1073 + // String dlcfxml =
  1074 + // XmlUtil.convertToXml2(manifestService.sendDeliveryXml(manifest), path);
  1075 + // new XmlSendTask(dlcfxml).send();
  1076 +
1021 model.setStatus(200); 1077 model.setStatus(200);
1022 model.setMsg(HttpJsonMsg.SUCCESS); 1078 model.setMsg(HttpJsonMsg.SUCCESS);
1023 } 1079 }
@@ -1071,8 +1127,10 @@ public class ManifestController extends BasicController { @@ -1071,8 +1127,10 @@ public class ManifestController extends BasicController {
1071 preparesecondary.setCarrier(carrier); 1127 preparesecondary.setCarrier(carrier);
1072 preparesecondary.setFlightno(flightno); 1128 preparesecondary.setFlightno(flightno);
1073 1129
1074 -// consigneeService.saveFromPreparesecondary(preparesecondary, Tools.getUserId());  
1075 -// consignorService.saveFromPreparesecondary(preparesecondary, Tools.getUserId()); 1130 + // consigneeService.saveFromPreparesecondary(preparesecondary,
  1131 + // Tools.getUserId());
  1132 + // consignorService.saveFromPreparesecondary(preparesecondary,
  1133 + // Tools.getUserId());
1076 1134
1077 ResponseModel model = new ResponseModel(); 1135 ResponseModel model = new ResponseModel();
1078 try { 1136 try {
@@ -1118,10 +1176,10 @@ public class ManifestController extends BasicController { @@ -1118,10 +1176,10 @@ public class ManifestController extends BasicController {
1118 // path); 1176 // path);
1119 1177
1120 // System.out.println(ndlrxml); 1178 // System.out.println(ndlrxml);
1121 - // new RedisSaveMessage().saveMessage(ndlrxml); 1179 + // new XmlSendTask().saveMessage(ndlrxml);
1122 1180
1123 WaybillReceiptType type = WaybillReceiptType.DELETE; 1181 WaybillReceiptType type = WaybillReceiptType.DELETE;
1124 - preparesecondary.setResponse_text("分单——" + type.getName()); 1182 + preparesecondary.setResponse_text(type.getName());
1125 preparesecondary.setResponse_code(String.valueOf(type.getValue())); 1183 preparesecondary.setResponse_code(String.valueOf(type.getValue()));
1126 preparesecondaryServer.save(preparesecondary); 1184 preparesecondaryServer.save(preparesecondary);
1127 1185
@@ -1153,8 +1211,10 @@ public class ManifestController extends BasicController { @@ -1153,8 +1211,10 @@ public class ManifestController extends BasicController {
1153 preparesecondary.setCarrier(carrier); 1211 preparesecondary.setCarrier(carrier);
1154 preparesecondary.setFlightno(flightno); 1212 preparesecondary.setFlightno(flightno);
1155 1213
1156 -// consigneeService.saveFromPreparesecondary(preparesecondary, Tools.getUserId());  
1157 -// consignorService.saveFromPreparesecondary(preparesecondary, Tools.getUserId()); 1214 + // consigneeService.saveFromPreparesecondary(preparesecondary,
  1215 + // Tools.getUserId());
  1216 + // consignorService.saveFromPreparesecondary(preparesecondary,
  1217 + // Tools.getUserId());
1158 1218
1159 ResponseModel model = new ResponseModel(); 1219 ResponseModel model = new ResponseModel();
1160 try { 1220 try {
@@ -1174,7 +1234,7 @@ public class ManifestController extends BasicController { @@ -1174,7 +1234,7 @@ public class ManifestController extends BasicController {
1174 preparesecondary.setStowagedate(preparesecondary.getStowagedate(stowagedate)); 1234 preparesecondary.setStowagedate(preparesecondary.getStowagedate(stowagedate));
1175 preparesecondary.setIsdelete(1); 1235 preparesecondary.setIsdelete(1);
1176 preparesecondary.setResponse_code(String.valueOf(type.getValue())); 1236 preparesecondary.setResponse_code(String.valueOf(type.getValue()));
1177 - preparesecondary.setResponse_text("分单——" + type.getName()); 1237 + preparesecondary.setResponse_text(type.getName());
1178 preparesecondaryServer.save(preparesecondary); 1238 preparesecondaryServer.save(preparesecondary);
1179 receiptService.saveFromPreparesecondary(preparesecondary, type); 1239 receiptService.saveFromPreparesecondary(preparesecondary, type);
1180 1240
@@ -1183,30 +1243,39 @@ public class ManifestController extends BasicController { @@ -1183,30 +1243,39 @@ public class ManifestController extends BasicController {
1183 String dlcPath = MessageKit.getMessagePath(MessageType.DLCF); 1243 String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
1184 String fhlPath = MessageKit.getMessagePath(MessageType.FHL); 1244 String fhlPath = MessageKit.getMessagePath(MessageType.FHL);
1185 1245
1186 - String ndlrxml = XmlUtil.convertToXml2(manifestService.presenddlcfNdlrXml(preparesecondary), ndlrPath);  
1187 - String dlcfxml = XmlUtil.convertToXml2(manifestService.presenddlcfdlcfXml(preparesecondary), dlcPath);  
1188 - String fhlfxml = XmlUtil.convertToXml2(FSXmlKit.fhlXml(preparesecondary), fhlPath); 1246 + new XmlBuildTask(manifestService.presenddlcfNdlrXml(preparesecondary), ndlrPath).perform();
  1247 + new XmlBuildTask(manifestService.presenddlcfdlcfXml(preparesecondary), dlcPath).perform();
  1248 + new XmlBuildTask(FSXmlKit.fhlXml(preparesecondary, getAgent()), fhlPath).perform();
  1249 +
  1250 + // String ndlrxml =
  1251 + // XmlUtil.convertToXml2(manifestService.presenddlcfNdlrXml(preparesecondary),
  1252 + // ndlrPath);
  1253 + // String dlcfxml =
  1254 + // XmlUtil.convertToXml2(manifestService.presenddlcfdlcfXml(preparesecondary),
  1255 + // dlcPath);
  1256 + // String fhlfxml = XmlUtil.convertToXml2(FSXmlKit.fhlXml(preparesecondary,
  1257 + // getAgent()), fhlPath);
1189 1258
1190 // RemoteFileKit.putFile(ndlrPath); 1259 // RemoteFileKit.putFile(ndlrPath);
1191 // RemoteFileKit.putFile(dlcPath); 1260 // RemoteFileKit.putFile(dlcPath);
1192 // RemoteFileKit.putFile(fhlPath); 1261 // RemoteFileKit.putFile(fhlPath);
1193 1262
1194 // 发送redis储存数据 1263 // 发送redis储存数据
1195 - new RedisSaveMessage().saveMessage(ndlrxml);  
1196 - new RedisSaveMessage().saveMessage(dlcfxml);  
1197 - new RedisSaveMessage().saveMessage(fhlfxml);  
1198 -  
1199 - System.out.println("===================ndlrxml===================");  
1200 - System.out.println(ndlrxml);  
1201 - System.out.println(); 1264 + // new XmlSendTask(ndlrxml).send();
  1265 + // new XmlSendTask(dlcfxml).send();
  1266 + // new XmlSendTask(fhlfxml).send();
1202 1267
1203 - System.out.println("===================dlcfxml===================");  
1204 - System.err.println(dlcfxml);  
1205 - System.out.println();  
1206 -  
1207 - System.out.println("===================fhlfxml===================");  
1208 - System.err.println(fhlfxml);  
1209 - System.out.println(); 1268 + // System.out.println("===================ndlrxml===================");
  1269 + // System.out.println(ndlrxml);
  1270 + // System.out.println();
  1271 + //
  1272 + // System.out.println("===================dlcfxml===================");
  1273 + // System.err.println(dlcfxml);
  1274 + // System.out.println();
  1275 + //
  1276 + // System.out.println("===================fhlfxml===================");
  1277 + // System.err.println(fhlfxml);
  1278 + // System.out.println();
1210 1279
1211 model.setData(preparesecondary); 1280 model.setData(preparesecondary);
1212 model.setStatus(200); 1281 model.setStatus(200);
@@ -1242,10 +1311,12 @@ public class ManifestController extends BasicController { @@ -1242,10 +1311,12 @@ public class ManifestController extends BasicController {
1242 // 生成报文并且发送 1311 // 生成报文并且发送
1243 String rootPath = request.getSession().getServletContext().getRealPath("/"); 1312 String rootPath = request.getSession().getServletContext().getRealPath("/");
1244 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml"; 1313 String path = rootPath + "/excel/manifest" + new Date().getTime() + ".xml";
1245 - String dlcfxml = XmlUtil.convertToXml2(manifestService.sendPreXml(Preparesecondary), path);  
1246 - // 发送redis储存数据  
1247 - // System.out.println(dlcfxml);  
1248 - new RedisSaveMessage().saveMessage(dlcfxml); 1314 + // String dlcfxml =
  1315 + // XmlUtil.convertToXml2(manifestService.sendPreXml(Preparesecondary), path);
  1316 + // new XmlSendTask(dlcfxml).send();
  1317 +
  1318 + new XmlBuildTask(manifestService.sendPreXml(Preparesecondary), path).perform();
  1319 +
1249 model.setData(Preparesecondary); 1320 model.setData(Preparesecondary);
1250 model.setStatus(200); 1321 model.setStatus(200);
1251 model.setMsg(HttpJsonMsg.SUCCESS); 1322 model.setMsg(HttpJsonMsg.SUCCESS);
@@ -140,14 +140,14 @@ public class ReceiptController { @@ -140,14 +140,14 @@ public class ReceiptController {
140 * @return 140 * @return
141 */ 141 */
142 @RequestMapping(value = "/seeReceipt") 142 @RequestMapping(value = "/seeReceipt")
143 - public String seeReceipt(HttpServletRequest request, String no, boolean isMain) { 143 + public String seeReceipt(HttpServletRequest request, String waybill_no, String sub_waybill_no) {
144 List<WaybillReceiptEntity> dataList = null; 144 List<WaybillReceiptEntity> dataList = null;
145 - if (isMain) { 145 + if (StringUtils.isNotBlank(waybill_no) && StringUtils.isBlank(sub_waybill_no)) {
146 // 查询主单回执 146 // 查询主单回执
147 - dataList = receiptService.findMainList(no);  
148 - } else { 147 + dataList = receiptService.findMainList(waybill_no);
  148 + } else if (StringUtils.isNotBlank(waybill_no) && StringUtils.isNotBlank(sub_waybill_no)) {
149 // 查询分单回执 149 // 查询分单回执
150 - dataList = receiptService.findSubList(no); 150 + dataList = receiptService.findSubList(waybill_no, sub_waybill_no);
151 } 151 }
152 152
153 request.setAttribute("dataList", dataList); 153 request.setAttribute("dataList", dataList);
@@ -12,6 +12,7 @@ public class Constant { @@ -12,6 +12,7 @@ public class Constant {
12 12
13 // 日期格式化 13 // 日期格式化
14 public final static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); 14 public final static SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
  15 + public final static SimpleDateFormat dateFormat_ = new SimpleDateFormat("yyyyMMdd");
15 16
16 // 日期格式化 17 // 日期格式化
17 public final static SimpleDateFormat dateFormatYYYYMM = new SimpleDateFormat("yyyyMM"); 18 public final static SimpleDateFormat dateFormatYYYYMM = new SimpleDateFormat("yyyyMM");
@@ -9,149 +9,150 @@ import javax.persistence.Table; @@ -9,149 +9,150 @@ import javax.persistence.Table;
9 /** 9 /**
10 * Created by cohesion on 2017/3/28. 10 * Created by cohesion on 2017/3/28.
11 * 11 *
12 - * 代理人信息表 12 + * 代理人信息表
13 */ 13 */
14 @Entity 14 @Entity
15 @Table(name = "BASIC_AGENT") 15 @Table(name = "BASIC_AGENT")
16 public class BasicAgentEntity extends IdEntity { 16 public class BasicAgentEntity extends IdEntity {
17 17
18 - /**  
19 - * 代理人3字代码  
20 - */  
21 - private String threeCode;  
22 -  
23 - /**  
24 - * 代理人英文名  
25 - */  
26 - private String nameEn;  
27 -  
28 - /**  
29 - * 代理人中文名  
30 - */  
31 - private String nameCn;  
32 -  
33 - /**  
34 - * 代理人公司地址  
35 - */  
36 - private String address;  
37 -  
38 - /**  
39 - * 联系人  
40 - */  
41 - private String contact;  
42 -  
43 - /**  
44 - * 电话  
45 - */  
46 - private String tel;  
47 -  
48 - /**  
49 - * 邮箱  
50 - */  
51 - private String email;  
52 -  
53 - /**  
54 - * 国家代码  
55 - */  
56 - private String countryCode = "CN";  
57 -  
58 - /**  
59 - * 城市代码  
60 - */  
61 - private String cityCode;  
62 -  
63 - /**  
64 - * 代理人识别码  
65 - */  
66 - private String idCode;  
67 -  
68 - @Column(name = "CODE")  
69 - public String getThreeCode() {  
70 - return threeCode;  
71 - }  
72 -  
73 - public void setThreeCode(String threeCode) {  
74 - this.threeCode = threeCode;  
75 - }  
76 -  
77 - @Column(name = "NAME_EN")  
78 - public String getNameEn() {  
79 - return nameEn;  
80 - }  
81 -  
82 - public void setNameEn(String nameEn) {  
83 - this.nameEn = nameEn;  
84 - }  
85 -  
86 - @Column(name = "NAME_CN")  
87 - public String getNameCn() {  
88 - return nameCn;  
89 - }  
90 -  
91 - public void setNameCn(String nameCn) {  
92 - this.nameCn = nameCn;  
93 - }  
94 -  
95 - @Column(name = "ADDRESS")  
96 - public String getAddress() {  
97 - return address;  
98 - }  
99 -  
100 - public void setAddress(String address) {  
101 - this.address = address;  
102 - }  
103 -  
104 - @Column(name = "CONTACTS")  
105 - public String getContact() {  
106 - return contact;  
107 - }  
108 -  
109 - public void setContact(String contact) {  
110 - this.contact = contact;  
111 - }  
112 -  
113 - @Column(name = "TEL")  
114 - public String getTel() {  
115 - return tel;  
116 - }  
117 -  
118 - public void setTel(String tel) {  
119 - this.tel = tel;  
120 - }  
121 -  
122 - @Column(name = "EMAIL")  
123 - public String getEmail() {  
124 - return email;  
125 - }  
126 -  
127 - public void setEmail(String email) {  
128 - this.email = email;  
129 - }  
130 -  
131 - @Column(name = "COUNTRY_CODE")  
132 - public String getCountryCode() {  
133 - return countryCode;  
134 - }  
135 -  
136 - public void setCountryCode(String countryCode) {  
137 - this.countryCode = countryCode;  
138 - }  
139 -  
140 - @Column(name = "CITY_CODE")  
141 - public String getCityCode() {  
142 - return cityCode;  
143 - }  
144 -  
145 - public void setCityCode(String cityCode) {  
146 - this.cityCode = cityCode;  
147 - }  
148 -  
149 - @Column(name = "UK_ID")  
150 - public String getIdCode() {  
151 - return idCode;  
152 - }  
153 -  
154 - public void setIdCode(String idCode) {  
155 - this.idCode = idCode;  
156 - } 18 + /**
  19 + * 代理人3字代码
  20 + */
  21 + private String threeCode;
  22 +
  23 + /**
  24 + * 代理人英文名
  25 + */
  26 + private String nameEn;
  27 +
  28 + /**
  29 + * 代理人中文名
  30 + */
  31 + private String nameCn;
  32 +
  33 + /**
  34 + * 代理人公司地址
  35 + */
  36 + private String address;
  37 +
  38 + /**
  39 + * 联系人
  40 + */
  41 + private String contact;
  42 +
  43 + /**
  44 + * 电话
  45 + */
  46 + private String tel;
  47 +
  48 + /**
  49 + * 邮箱
  50 + */
  51 + private String email;
  52 +
  53 + /**
  54 + * 国家代码
  55 + */
  56 + private String countryCode = "CN";
  57 +
  58 + /**
  59 + * 城市代码
  60 + */
  61 + private String cityCode;
  62 +
  63 + /**
  64 + * 代理人识别码
  65 + */
  66 + private String idCode;
  67 +
  68 + @Column(name = "CODE")
  69 + public String getThreeCode() {
  70 + return threeCode;
  71 + }
  72 +
  73 + public void setThreeCode(String threeCode) {
  74 + this.threeCode = threeCode;
  75 + }
  76 +
  77 + @Column(name = "NAME_EN")
  78 + public String getNameEn() {
  79 + return nameEn;
  80 + }
  81 +
  82 + public void setNameEn(String nameEn) {
  83 + this.nameEn = nameEn;
  84 + }
  85 +
  86 + @Column(name = "NAME_CN")
  87 + public String getNameCn() {
  88 + return nameCn;
  89 + }
  90 +
  91 + public void setNameCn(String nameCn) {
  92 + this.nameCn = nameCn;
  93 + }
  94 +
  95 + @Column(name = "ADDRESS")
  96 + public String getAddress() {
  97 + return address;
  98 + }
  99 +
  100 + public void setAddress(String address) {
  101 + this.address = address;
  102 + }
  103 +
  104 + @Column(name = "CONTACTS")
  105 + public String getContact() {
  106 + return contact;
  107 + }
  108 +
  109 + public void setContact(String contact) {
  110 + this.contact = contact;
  111 + }
  112 +
  113 + @Column(name = "TEL")
  114 + public String getTel() {
  115 + return tel;
  116 + }
  117 +
  118 + public void setTel(String tel) {
  119 + this.tel = tel;
  120 + }
  121 +
  122 + @Column(name = "EMAIL")
  123 + public String getEmail() {
  124 + return email;
  125 + }
  126 +
  127 + public void setEmail(String email) {
  128 + this.email = email;
  129 + }
  130 +
  131 + @Column(name = "COUNTRY_CODE")
  132 + public String getCountryCode() {
  133 + return countryCode;
  134 + }
  135 +
  136 + public void setCountryCode(String countryCode) {
  137 + this.countryCode = countryCode;
  138 + }
  139 +
  140 + @Column(name = "CITY_CODE")
  141 + public String getCityCode() {
  142 + return cityCode;
  143 + }
  144 +
  145 + public void setCityCode(String cityCode) {
  146 + this.cityCode = cityCode;
  147 + }
  148 +
  149 + @Column(name = "UK_ID")
  150 + public String getIdCode() {
  151 + return idCode;
  152 + }
  153 +
  154 + public void setIdCode(String idCode) {
  155 + this.idCode = idCode;
  156 + }
  157 +
157 } 158 }
@@ -375,7 +375,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -375,7 +375,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
375 375
376 @Column(name = "DE_NUMBER") 376 @Column(name = "DE_NUMBER")
377 public String getDe_number() { 377 public String getDe_number() {
378 - return de_number; 378 + return getTotalpiece();
379 } 379 }
380 380
381 public void setDe_number(String de_number) { 381 public void setDe_number(String de_number) {
@@ -384,7 +384,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -384,7 +384,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
384 384
385 @Column(name = "DE_WEIGHT") 385 @Column(name = "DE_WEIGHT")
386 public String getDe_weight() { 386 public String getDe_weight() {
387 - return de_weight; 387 + return getTotalweight();
388 } 388 }
389 389
390 public void setDe_weight(String de_weight) { 390 public void setDe_weight(String de_weight) {
@@ -393,7 +393,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -393,7 +393,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
393 393
394 @Column(name = "DE_CHWEIGHT") 394 @Column(name = "DE_CHWEIGHT")
395 public String getDe_chweight() { 395 public String getDe_chweight() {
396 - return de_chweight; 396 + return getTotalweight();
397 } 397 }
398 398
399 public void setDe_chweight(String de_chweight) { 399 public void setDe_chweight(String de_chweight) {
@@ -537,7 +537,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -537,7 +537,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
537 537
538 @Column(name = "PREPARETOTALPIECE") 538 @Column(name = "PREPARETOTALPIECE")
539 public String getPreparetotalpiece() { 539 public String getPreparetotalpiece() {
540 - return StringUtils.isBlank(preparetotalpiece)?getTotalpiece():preparetotalpiece; 540 + return getTotalpiece();
541 } 541 }
542 542
543 public void setPreparetotalpiece(String preparetotalpiece) { 543 public void setPreparetotalpiece(String preparetotalpiece) {
@@ -546,7 +546,7 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -546,7 +546,7 @@ public class ManifestEntity extends BasicEntity implements Serializable {
546 546
547 @Column(name = "PREPARETOTALWEIGHT") 547 @Column(name = "PREPARETOTALWEIGHT")
548 public String getPreparetotalweight() { 548 public String getPreparetotalweight() {
549 - return StringUtils.isBlank(preparetotalweight)?getTotalweight():preparetotalweight; 549 + return getTotalweight();
550 } 550 }
551 551
552 public void setPreparetotalweight(String preparetotalweight) { 552 public void setPreparetotalweight(String preparetotalweight) {
@@ -385,7 +385,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -385,7 +385,7 @@ public class PreparesecondaryEntity extends BasicEntity {
385 385
386 @Column(name = "DE_NUMBER") 386 @Column(name = "DE_NUMBER")
387 public String getDe_number() { 387 public String getDe_number() {
388 - return de_number; 388 + return getTotalpiece();
389 } 389 }
390 390
391 public void setDe_number(String de_number) { 391 public void setDe_number(String de_number) {
@@ -394,7 +394,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -394,7 +394,7 @@ public class PreparesecondaryEntity extends BasicEntity {
394 394
395 @Column(name = "DE_WEIGHT") 395 @Column(name = "DE_WEIGHT")
396 public String getDe_weight() { 396 public String getDe_weight() {
397 - return de_weight; 397 + return getTotalweight();
398 } 398 }
399 399
400 public void setDe_weight(String de_weight) { 400 public void setDe_weight(String de_weight) {
@@ -403,7 +403,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -403,7 +403,7 @@ public class PreparesecondaryEntity extends BasicEntity {
403 403
404 @Column(name = "DE_CHWEIGHT") 404 @Column(name = "DE_CHWEIGHT")
405 public String getDe_chweight() { 405 public String getDe_chweight() {
406 - return de_chweight; 406 + return getTotalweight();
407 } 407 }
408 408
409 public void setDe_chweight(String de_chweight) { 409 public void setDe_chweight(String de_chweight) {
@@ -538,7 +538,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -538,7 +538,7 @@ public class PreparesecondaryEntity extends BasicEntity {
538 538
539 @Column(name = "PREPAREPIECE") 539 @Column(name = "PREPAREPIECE")
540 public String getPreparepiece() { 540 public String getPreparepiece() {
541 - return StringUtils.isBlank(preparepiece)?getTotalpiece():preparepiece; 541 + return getTotalpiece();
542 } 542 }
543 543
544 public void setPreparepiece(String preparepiece) { 544 public void setPreparepiece(String preparepiece) {
@@ -547,7 +547,7 @@ public class PreparesecondaryEntity extends BasicEntity { @@ -547,7 +547,7 @@ public class PreparesecondaryEntity extends BasicEntity {
547 547
548 @Column(name = "PREPAREWEIGHT") 548 @Column(name = "PREPAREWEIGHT")
549 public String getPrepareweight() { 549 public String getPrepareweight() {
550 - return StringUtils.isBlank(prepareweight)?getTotalweight():prepareweight; 550 + return getTotalweight();
551 } 551 }
552 552
553 public void setPrepareweight(String prepareweight) { 553 public void setPrepareweight(String prepareweight) {
@@ -148,7 +148,7 @@ public class UserEntity extends BasicEntity { @@ -148,7 +148,7 @@ public class UserEntity extends BasicEntity {
148 148
149 @Column(name = "AGENT_ID") 149 @Column(name = "AGENT_ID")
150 public Long getAgent() { 150 public Long getAgent() {
151 - return agent; 151 + return agent == null ? 0l : agent;
152 } 152 }
153 153
154 public void setAgent(Long agent) { 154 public void setAgent(Long agent) {
1 -package com.agent.imf.agent.redis;  
2 -  
3 -import org.apache.commons.lang3.StringUtils;  
4 -  
5 -import redis.clients.jedis.Jedis;  
6 -  
7 -//缓存数据  
8 -public class RedisSaveMessage {  
9 -  
10 - // 创建 缓存服务器的地址ip  
11 - Jedis jedis = new Jedis("10.50.3.71", 6379);  
12 -  
13 - // Jedis jedis = new Jedis("192.168.0.253", 6379);  
14 - public class JEDIS {  
15 -  
16 - }  
17 -  
18 - // 存信息  
19 - public long saveMessage(String str) {  
20 - if (StringUtils.isEmpty(str)) {  
21 - return -1;  
22 - }  
23 - return jedis.lpush("task-queue", str);  
24 - }  
25 -  
26 -}  
27 -// 北环  
28 -//  
@@ -19,10 +19,10 @@ public interface ConsigneeRepository @@ -19,10 +19,10 @@ public interface ConsigneeRepository
19 @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true) 19 @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true)
20 public List<ConsigneeEntity> findById(String id); 20 public List<ConsigneeEntity> findById(String id);
21 21
22 - @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1 and c.name LIKE %?2%) cr where cr.rn between ?3 and ?4", nativeQuery = true) 22 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1 and c.name LIKE %?2% order by c.id desc) cr where cr.rn between ?3 and ?4", nativeQuery = true)
23 public List<ConsigneeEntity> search(long user_id,String key,int start,int end); 23 public List<ConsigneeEntity> search(long user_id,String key,int start,int end);
24 24
25 - @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true) 25 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from PUB_CONSIGNEE c where c.creator=?1 order by c.id desc) cr where cr.rn between ?2 and ?3", nativeQuery = true)
26 public List<ConsigneeEntity> list(long user_id,int start,int end); 26 public List<ConsigneeEntity> list(long user_id,int start,int end);
27 27
28 @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true) 28 @Query(value = "SELECT * FROM PUB_CONSIGNEE WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true)
@@ -19,10 +19,10 @@ public interface ConsignorRepository @@ -19,10 +19,10 @@ public interface ConsignorRepository
19 @Query(value = "SELECT * FROM CONSIGNOR WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true) 19 @Query(value = "SELECT * FROM CONSIGNOR WHERE ID = ?1 ORDER BY ID DESC", nativeQuery = true)
20 public List<ConsignorEntity> findById(String id); 20 public List<ConsignorEntity> findById(String id);
21 21
22 - @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1 and c.co_company LIKE %?2%) cr where cr.rn between ?3 and ?4", nativeQuery = true) 22 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1 and c.co_company LIKE %?2% order by c.id desc) cr where cr.rn between ?3 and ?4", nativeQuery = true)
23 public List<ConsignorEntity> search(long user_id,String key,int start,int end); 23 public List<ConsignorEntity> search(long user_id,String key,int start,int end);
24 24
25 - @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1) cr where cr.rn between ?2 and ?3", nativeQuery = true) 25 + @Query(value = "SELECT * FROM(SELECT rownum rn,c.* from CONSIGNOR c where c.creator=?1 order by c.id desc) cr where cr.rn between ?2 and ?3", nativeQuery = true)
26 public List<ConsignorEntity> list(long user_id,int start,int end); 26 public List<ConsignorEntity> list(long user_id,int start,int end);
27 27
28 @Query(value = "SELECT * FROM CONSIGNOR WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true) 28 @Query(value = "SELECT * FROM CONSIGNOR WHERE CREATOR = ?1 ORDER BY ID DESC", nativeQuery = true)
@@ -16,8 +16,8 @@ public interface WaybillReceiptRepository @@ -16,8 +16,8 @@ public interface WaybillReceiptRepository
16 @Query(value = "SELECT * FROM WAYBILL_RECEIPT WHERE WAYBILL_NO = ?1 AND SUB_WAYBILL_NO = ?2 ORDER BY ID DESC", nativeQuery = true) 16 @Query(value = "SELECT * FROM WAYBILL_RECEIPT WHERE WAYBILL_NO = ?1 AND SUB_WAYBILL_NO = ?2 ORDER BY ID DESC", nativeQuery = true)
17 public List<WaybillReceiptEntity> findByWaybillNoAndSub(String waybill_no, String sub_waybill_no); 17 public List<WaybillReceiptEntity> findByWaybillNoAndSub(String waybill_no, String sub_waybill_no);
18 18
19 - @Query(value = "SELECT * FROM WAYBILL_RECEIPT WHERE SUB_WAYBILL_NO = ?1 ORDER BY ID DESC", nativeQuery = true)  
20 - public List<WaybillReceiptEntity> findSubList(String sub_waybill_no); 19 + @Query(value = "SELECT * FROM WAYBILL_RECEIPT WHERE WAYBILL_NO = ?1 AND SUB_WAYBILL_NO = ?2 ORDER BY ID DESC", nativeQuery = true)
  20 + public List<WaybillReceiptEntity> findSubList(String waybill_no,String sub_waybill_no);
21 21
22 @Query(value = "SELECT * FROM WAYBILL_RECEIPT WHERE WAYBILL_NO = ?1 AND SUB_WAYBILL_NO IS NULL ORDER BY ID DESC", nativeQuery = true) 22 @Query(value = "SELECT * FROM WAYBILL_RECEIPT WHERE WAYBILL_NO = ?1 AND SUB_WAYBILL_NO IS NULL ORDER BY ID DESC", nativeQuery = true)
23 public List<WaybillReceiptEntity> findMainList(String waybill_no); 23 public List<WaybillReceiptEntity> findMainList(String waybill_no);
@@ -14,81 +14,81 @@ import org.springframework.transaction.annotation.Transactional; @@ -14,81 +14,81 @@ import org.springframework.transaction.annotation.Transactional;
14 import javax.annotation.Resource; 14 import javax.annotation.Resource;
15 import java.util.List; 15 import java.util.List;
16 16
17 -  
18 @Service 17 @Service
19 public class BasicAgentService extends BasicService<BasicAgentEntity> { 18 public class BasicAgentService extends BasicService<BasicAgentEntity> {
20 19
21 - @Resource  
22 - private BasicAgentRepository agentRepository; 20 + @Resource
  21 + private BasicAgentRepository agentRepository;
  22 +
  23 + /**
  24 + * 分页查询
  25 + *
  26 + * @param pageForm
  27 + * 分页对象
  28 + * @return 包含分页信息和数据的分页对象
  29 + */
  30 + public Page<BasicAgentEntity> getPage(EasyPage<BasicAgentEntity> pageForm) {
  31 + PageRequest pageRequest = buildPageRequest(pageForm);
  32 + Specification<BasicAgentEntity> spec = buildSpecification(pageForm);
  33 + Page<BasicAgentEntity> page = agentRepository.findAll(spec, pageRequest);
  34 + return page;
  35 + }
  36 +
  37 + public List<BasicAgentEntity> findAll() {
  38 + return agentRepository.findAll();
  39 + }
  40 +
  41 + public BasicAgentEntity findOne(Long id) {
  42 + return agentRepository.findOne(id);
  43 + }
23 44
24 - /**  
25 - * 分页查询  
26 - *  
27 - * @param pageForm 分页对象  
28 - * @return 包含分页信息和数据的分页对象  
29 - */  
30 - public Page<BasicAgentEntity> getPage(EasyPage<BasicAgentEntity> pageForm) {  
31 - PageRequest pageRequest = buildPageRequest(pageForm);  
32 - Specification<BasicAgentEntity> spec = buildSpecification(pageForm);  
33 - Page<BasicAgentEntity> page = agentRepository.findAll(spec, pageRequest);  
34 - return page;  
35 - } 45 + /**
  46 + * 保存
  47 + *
  48 + * @param agent
  49 + * @return
  50 + */
  51 + @Transactional
  52 + public BasicAgentEntity save(BasicAgentEntity agent) {
  53 + return agentRepository.save(agent);
  54 + }
36 55
37 - public List<BasicAgentEntity> findAll(){  
38 - return agentRepository.findAll();  
39 - } 56 + @Transactional
  57 + public int save2(BasicAgentEntity agent) {
  58 + // 如果已经存在则直接返回
  59 + List<BasicAgentEntity> a = agentRepository.findWhere(agent.getContact(), agent.getCountryCode(),
  60 + agent.getNameCn(), agent.getAddress());
  61 + if (a != null && a.size() == 1) {
  62 + return a.get(0).getId().intValue();
  63 + }
40 64
41 - public BasicAgentEntity findOne(Long id){  
42 - return agentRepository.findOne(id);  
43 - } 65 + int is = agentRepository.save2(agent.getCityCode(), agent.getContact(), agent.getCountryCode(),
  66 + agent.getNameCn(), agent.getAddress());
  67 + if (is == 1) {
  68 + // 插入成功!
  69 + a = agentRepository.findWhere(agent.getContact(), agent.getCountryCode(), agent.getNameCn(),
  70 + agent.getAddress());
  71 + if (a != null && a.size() > 0) {
  72 + return a.get(0).getId().intValue();
  73 + }
  74 + System.out.println("null");
44 75
45 - /**  
46 - * 保存  
47 - *  
48 - * @param agent  
49 - * @return  
50 - */  
51 - @Transactional  
52 - public BasicAgentEntity save(BasicAgentEntity agent) {  
53 - //System.out.println("contacts:"+agent.getContact()+" NAME_CN:"+agent.getNameCn()+" CODE:"+agent.getCountryCode());  
54 - return agentRepository.save(agent);//agent.getCityCode(), agent.getContact(), agent.getCountryCode(), agent.getNameCn());  
55 - }  
56 -  
57 - @Transactional  
58 - public int save2(BasicAgentEntity agent){  
59 - //如果已经存在则直接返回  
60 - List<BasicAgentEntity> a = agentRepository.findWhere(agent.getContact(), agent.getCountryCode(), agent.getNameCn(), agent.getAddress());  
61 - if(a != null && a.size() == 1)  
62 - {  
63 - return a.get(0).getId().intValue();  
64 - }  
65 -  
66 - int is = agentRepository.save2(agent.getCityCode(), agent.getContact(), agent.getCountryCode(), agent.getNameCn(), agent.getAddress());  
67 - if(is == 1)  
68 - {  
69 - //插入成功!  
70 - a = agentRepository.findWhere(agent.getContact(), agent.getCountryCode(), agent.getNameCn(), agent.getAddress());  
71 - if(a != null && a.size() > 0)  
72 - {  
73 - return a.get(0).getId().intValue();  
74 - }  
75 - System.out.println("null");  
76 -  
77 - }  
78 - return -1;  
79 - } 76 + }
  77 + return -1;
  78 + }
80 79
81 - /**  
82 - * 批量删除  
83 - *  
84 - * @param ids 1,2,3  
85 - */  
86 - @Transactional  
87 - public void deleteAll(String ids) {  
88 - List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);  
89 - for (String id : list) {  
90 - agentRepository.delete(Long.parseLong(id));  
91 - }  
92 - } 80 + /**
  81 + * 批量删除
  82 + *
  83 + * @param ids
  84 + * 1,2,3
  85 + */
  86 + @Transactional
  87 + public void deleteAll(String ids) {
  88 + List<String> list = Splitter.on(",").trimResults().omitEmptyStrings().splitToList(ids);
  89 + for (String id : list) {
  90 + agentRepository.delete(Long.parseLong(id));
  91 + }
  92 + }
93 93
94 } 94 }
@@ -25,6 +25,7 @@ import com.agent.repository.agent.PreparesecondaryRepository; @@ -25,6 +25,7 @@ import com.agent.repository.agent.PreparesecondaryRepository;
25 import com.agent.service.BasicService; 25 import com.agent.service.BasicService;
26 import com.agent.xml.bill.ApplicableLogisticsAllowanceChargeXml; 26 import com.agent.xml.bill.ApplicableLogisticsAllowanceChargeXml;
27 import com.agent.xml.bill.ApplicableTradeCurrencyExchangeXml; 27 import com.agent.xml.bill.ApplicableTradeCurrencyExchangeXml;
  28 +import com.agent.xml.common.ContentXml;
28 import com.agent.xml.common.IDXml; 29 import com.agent.xml.common.IDXml;
29 import com.agent.xml.common.NameXml; 30 import com.agent.xml.common.NameXml;
30 import com.agent.xml.common.XmlHead; 31 import com.agent.xml.common.XmlHead;
@@ -117,7 +118,7 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -117,7 +118,7 @@ public class ManifestService extends BasicService<ManifestEntity> {
117 118
118 @Resource 119 @Resource
119 private ManifestService manifestService; 120 private ManifestService manifestService;
120 - 121 +
121 @Resource 122 @Resource
122 private WaybillReceiptService receiptService; 123 private WaybillReceiptService receiptService;
123 124
@@ -133,13 +134,13 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -133,13 +134,13 @@ public class ManifestService extends BasicService<ManifestEntity> {
133 Specification<ManifestEntity> spec = buildSpecification(pageForm); 134 Specification<ManifestEntity> spec = buildSpecification(pageForm);
134 135
135 Page<ManifestEntity> page = manifestRepository.findAll(spec, pageRequest); 136 Page<ManifestEntity> page = manifestRepository.findAll(spec, pageRequest);
136 - if(page!=null&&page.getContent()!=null) { 137 + if (page != null && page.getContent() != null) {
137 List<ManifestEntity> list = page.getContent(); 138 List<ManifestEntity> list = page.getContent();
138 for (int i = 0; i < list.size(); i++) { 139 for (int i = 0; i < list.size(); i++) {
139 ManifestEntity bean = list.get(i); 140 ManifestEntity bean = list.get(i);
140 - WaybillReceiptEntity re = receiptService.findByWaybillNo(bean.getWaybillnomaster());  
141 - bean.setResponse_code(re!=null?re.getResponse_code():"");  
142 - bean.setResponse_text(re!=null?re.getResponse_text():""); 141 + WaybillReceiptEntity re = receiptService.findMain(bean.getWaybillnomaster());
  142 + bean.setResponse_code(re != null ? re.getResponse_code() : "");
  143 + bean.setResponse_text(re != null ? re.getResponse_text() : "");
143 } 144 }
144 } 145 }
145 return page; 146 return page;
@@ -194,11 +195,11 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -194,11 +195,11 @@ public class ManifestService extends BasicService<ManifestEntity> {
194 public List<ManifestEntity> findByMawbNo(String mawbNo) { 195 public List<ManifestEntity> findByMawbNo(String mawbNo) {
195 return manifestRepository.findByMawbNo(mawbNo, Tools.getUserId()); 196 return manifestRepository.findByMawbNo(mawbNo, Tools.getUserId());
196 } 197 }
197 - 198 +
198 public List<ManifestEntity> findByManifestNo(String mawbNo) { 199 public List<ManifestEntity> findByManifestNo(String mawbNo) {
199 return manifestRepository.findByMawbNo(mawbNo); 200 return manifestRepository.findByMawbNo(mawbNo);
200 } 201 }
201 - 202 +
202 public List<ManifestEntity> queryAll() { 203 public List<ManifestEntity> queryAll() {
203 return manifestRepository.queryAll(); 204 return manifestRepository.queryAll();
204 } 205 }
@@ -877,22 +878,25 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -877,22 +878,25 @@ public class ManifestService extends BasicService<ManifestEntity> {
877 drp.setName("70678920X"); 878 drp.setName("70678920X");
878 declare.setRepresentativePerson(drp); 879 declare.setRepresentativePerson(drp);
879 880
880 - // 运输工具离境海关代码  
881 - IDXml decox = new IDXml();  
882 - decox.setId("CGO");  
883 - declare.setExitCustomsOffice(decox);  
884 -  
885 - // 预配舱单主表信息  
886 - // 承运人  
887 - IDXml carr = new IDXml();  
888 - carr.setId(isManifest ? me.getCarrier() : pe.getCarrier());  
889 - declare.setCarrier(carr); 881 + if (WaybillReceiptType.DELETE != type) {
  882 + // 运输工具离境海关代码
  883 + IDXml decox = new IDXml();
  884 + decox.setId("CGO");
  885 + declare.setExitCustomsOffice(decox);
  886 +
  887 + // 预配舱单主表信息
  888 + // 承运人
  889 + IDXml carr = new IDXml();
  890 + carr.setId(isManifest ? me.getCarrier() : pe.getCarrier());
  891 + declare.setCarrier(carr);
  892 + }
890 893
891 // 航班号-航班日期 894 // 航班号-航班日期
892 DeclareBorderTransportMeansXml mt = new DeclareBorderTransportMeansXml(); 895 DeclareBorderTransportMeansXml mt = new DeclareBorderTransportMeansXml();
893 - mt.setJourneyID(isManifest ? me.getFlightno()  
894 - : pe.getFlightno() + "/"  
895 - + Constant.dateFormat.format(isManifest ? me.getFlightdate() : pe.getFlightdate())); 896 + String carrier = isManifest ? me.getCarrier() : pe.getCarrier();
  897 + String flightno = isManifest ? me.getFlightno() : pe.getFlightno();
  898 + String dateStr = Constant.dateFormat_.format(isManifest ? me.getFlightdate() : pe.getFlightdate());
  899 + mt.setJourneyID(carrier + flightno + "/" + dateStr);
896 // 运输方式代码 900 // 运输方式代码
897 mt.setTypeCode("4"); 901 mt.setTypeCode("4");
898 declare.setBorderTransportMeans(mt); 902 declare.setBorderTransportMeans(mt);
@@ -902,7 +906,7 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -902,7 +906,7 @@ public class ManifestService extends BasicService<ManifestEntity> {
902 // 运单号 906 // 运单号
903 DeclareTransportContractDocumentXml mac = new DeclareTransportContractDocumentXml(); 907 DeclareTransportContractDocumentXml mac = new DeclareTransportContractDocumentXml();
904 mac.setId(isManifest ? me.getWaybillnomaster() : pe.getWaybillnomaster()); 908 mac.setId(isManifest ? me.getWaybillnomaster() : pe.getWaybillnomaster());
905 - mac.setChangeReasonCode(changeReasonCode == null ? "9999" : changeReasonCode); 909 + mac.setChangeReasonCode(changeReasonCode == null ? "999" : changeReasonCode);
906 mac.setConditionCode("10");// 暂时固定 910 mac.setConditionCode("10");// 暂时固定
907 consignment.setTransportContractDocument(mac); 911 consignment.setTransportContractDocument(mac);
908 912
@@ -913,93 +917,101 @@ public class ManifestService extends BasicService<ManifestEntity> { @@ -913,93 +917,101 @@ public class ManifestService extends BasicService<ManifestEntity> {
913 consignment.setAssociatedTransportDocument(matx); 917 consignment.setAssociatedTransportDocument(matx);
914 } 918 }
915 919
916 - // 装载日期  
917 - DeclareLoadingLocationXml ml = new DeclareLoadingLocationXml();  
918 - ml.setId("CGO/4604");  
919 - ml.setLoadingDate(new SimpleDateFormat("yyyy-MM-dd HH:mm")  
920 - .format(isManifest ? me.getStowagedate() : pe.getStowagedate()));  
921 - consignment.setLoadingLocation(ml);  
922 -  
923 - DeclareUnloadingLocationXml mu = new DeclareUnloadingLocationXml();  
924 - mu.setId("CGO/4604");  
925 - consignment.setUnloadingLocation(mu);  
926 -  
927 - IDXml transitDestination = new IDXml();  
928 - transitDestination.setId(isManifest ? me.getDe_trstation() : pe.getDe_trstation());  
929 - consignment.setTransitDestination(transitDestination);  
930 -  
931 - consignment.setCustomsStatusCode(isManifest ? me.getCustomscode() : pe.getCustomscode());  
932 - consignment.setTransportSplitIndicator(isManifest ? me.getCustomsstatus() : pe.getCustomsstatus()); 920 + if (WaybillReceiptType.DELETE != type) {
  921 + // 装载日期
  922 + DeclareLoadingLocationXml ml = new DeclareLoadingLocationXml();
  923 + ml.setId("CGO/4604");
  924 + ml.setLoadingDate(new SimpleDateFormat("yyyy-MM-dd HH:mm")
  925 + .format(isManifest ? me.getStowagedate() : pe.getStowagedate()));
  926 + consignment.setLoadingLocation(ml);
  927 +
  928 + DeclareUnloadingLocationXml mu = new DeclareUnloadingLocationXml();
  929 + mu.setId("CGO/4604");
  930 + consignment.setUnloadingLocation(mu);
  931 +
  932 + IDXml transitDestination = new IDXml();
  933 + transitDestination.setId(isManifest ? me.getDe_trstation() : pe.getDe_trstation());
  934 + consignment.setTransitDestination(transitDestination);
  935 +
  936 + consignment.setCustomsStatusCode(isManifest ? me.getCustomscode() : pe.getCustomscode());
  937 + consignment.setTransportSplitIndicator(isManifest ? me.getCustomsstatus() : pe.getCustomsstatus());
  938 +
  939 + // 运费支付方法代码
  940 + DeclareMethodCodeXml freightpayment = new DeclareMethodCodeXml();
  941 + freightpayment.setMethodCode(isManifest ? me.getPaymode() : pe.getPaymode());
  942 + consignment.setFreightPayment(freightpayment);
  943 +
  944 + // 货物总件数
  945 + DeclareConsignmentPackagingXml mcon = new DeclareConsignmentPackagingXml();
  946 + mcon.setQuantityQuantity(isManifest ? me.getTotalpiece() : pe.getTotalpiece());
  947 + consignment.setConsignmentPackaging(mcon);
  948 + consignment.setTotalGrossMassMeasure(isManifest ? me.getTotalweight() : pe.getTotalweight());
  949 +
  950 + // 收货人信息
  951 + DeclareConsigneeXml consignee = new DeclareConsigneeXml();
  952 + consignee.setName(isManifest ? me.getCo_name() : pe.getCo_name());
  953 + DeclareAddressXml consigneeAddressXml = new DeclareAddressXml();
  954 + consigneeAddressXml.setLine(isManifest ? me.getSh_address() : pe.getSh_address());
  955 + consigneeAddressXml.setCityName(isManifest ? me.getSh_city() : pe.getSh_city());
  956 + String sh_country = isManifest ? me.getSh_country() : pe.getSh_country();
  957 + if (!StringUtils.isBlank(sh_country)) {
  958 + consigneeAddressXml.setCountryCode(sh_country);
  959 + }
933 960
934 - // 运费支付方法代码  
935 - DeclareMethodCodeXml freightpayment = new DeclareMethodCodeXml();  
936 - freightpayment.setMethodCode(isManifest ? me.getPaymode() : pe.getPaymode());  
937 - consignment.setFreightPayment(freightpayment); 961 + String sh_provincecode = isManifest ? me.getSh_provincecode() : pe.getSh_provincecode();
  962 + if (!StringUtils.isBlank(sh_provincecode)) {
  963 + consigneeAddressXml.setCountrySubEntityID(sh_provincecode);
  964 + }
938 965
939 - // 货物总件数  
940 - DeclareConsignmentPackagingXml mcon = new DeclareConsignmentPackagingXml();  
941 - mcon.setQuantityQuantity(isManifest ? me.getTotalpiece() : pe.getTotalpiece());  
942 - consignment.setConsignmentPackaging(mcon);  
943 - consignment.setTotalGrossMassMeasure(isManifest ? me.getTotalweight() : pe.getTotalweight()); 966 + String sh_provincename = isManifest ? me.getSh_provincename() : pe.getSh_provincename();
  967 + if (!StringUtils.isBlank(sh_provincename)) {
  968 + consigneeAddressXml.setCountrySubEntityName(sh_provincename);
  969 + }
944 970
945 - // 收货人信息  
946 - DeclareConsigneeXml consignee = new DeclareConsigneeXml();  
947 - consignee.setName(isManifest ? me.getCo_name() : pe.getCo_name());  
948 - DeclareAddressXml consigneeAddressXml = new DeclareAddressXml();  
949 - consigneeAddressXml.setLine(isManifest ? me.getSh_address() : pe.getSh_address());  
950 - consigneeAddressXml.setCityName(isManifest ? me.getSh_city() : pe.getSh_city());  
951 - String sh_country = isManifest ? me.getSh_country() : pe.getSh_country();  
952 - if (!StringUtils.isBlank(sh_country)) {  
953 - consigneeAddressXml.setCountryCode(sh_country);  
954 - } 971 + String sh_zipcode = isManifest ? me.getSh_zipcode() : pe.getSh_zipcode();
  972 + if (!StringUtils.isBlank(sh_zipcode)) {
  973 + consigneeAddressXml.setPostcodeID(sh_zipcode);
  974 + }
955 975
956 - String sh_provincecode = isManifest ? me.getSh_provincecode() : pe.getSh_provincecode();  
957 - if (!StringUtils.isBlank(sh_provincecode)) {  
958 - consigneeAddressXml.setCountrySubEntityID(sh_provincecode);  
959 - } 976 + consignee.setAddress(consigneeAddressXml);
  977 + consignment.setConsignee(consignee);
  978 +
  979 + // 设置发货人货人信息
  980 + DeclareConsigneeXml consignor = new DeclareConsigneeXml();
  981 + consignor.setName(isManifest ? me.getSh_name() : pe.getSh_name());
  982 + DeclareAddressXml consignorAddressXml = new DeclareAddressXml();
  983 + consignorAddressXml.setLine(isManifest ? me.getCo_address() : pe.getCo_address());
  984 + consignorAddressXml.setCityName(isManifest ? me.getCo_city() : pe.getCo_city());
  985 + String co_country = isManifest ? me.getCo_country() : pe.getCo_country();
  986 + if (!StringUtils.isBlank(co_country)) {
  987 + consignorAddressXml.setCountryCode(co_country);
  988 + }
960 989
961 - String sh_provincename = isManifest ? me.getSh_provincename() : pe.getSh_provincename();  
962 - if (!StringUtils.isBlank(sh_provincename)) {  
963 - consigneeAddressXml.setCountrySubEntityName(sh_provincename);  
964 - } 990 + String co_deltaname = isManifest ? me.getCo_deltaname() : pe.getCo_deltaname();
  991 + if (!StringUtils.isBlank(co_deltaname)) {
  992 + consignorAddressXml.setCountrySubEntityName(co_deltaname);
  993 + }
965 994
966 - String sh_zipcode = isManifest ? me.getSh_zipcode() : pe.getSh_zipcode();  
967 - if (!StringUtils.isBlank(sh_zipcode)) {  
968 - consigneeAddressXml.setPostcodeID(sh_zipcode);  
969 - } 995 + String co_zipcode = isManifest ? me.getCo_zipcode() : pe.getCo_zipcode();
  996 + if (!StringUtils.isBlank(co_zipcode)) {
  997 + consignorAddressXml.setCountryCode(co_zipcode);
  998 + }
970 999
971 - consignee.setAddress(consigneeAddressXml);  
972 - consignment.setConsignee(consignee); 1000 + consignor.setAddress(consignorAddressXml);
  1001 + consignment.setConsignor(consignor);
973 1002
974 - // 设置发货人货人信息  
975 - DeclareConsigneeXml consignor = new DeclareConsigneeXml();  
976 - consignor.setName(isManifest ? me.getSh_name() : pe.getSh_name());  
977 - DeclareAddressXml consignorAddressXml = new DeclareAddressXml();  
978 - consignorAddressXml.setLine(isManifest ? me.getCo_address() : pe.getCo_address());  
979 - consignorAddressXml.setCityName(isManifest ? me.getCo_city() : pe.getCo_city());  
980 - String co_country = isManifest ? me.getCo_country() : pe.getCo_country();  
981 - if (!StringUtils.isBlank(co_country)) {  
982 - consignorAddressXml.setCountryCode(co_country); 1003 + DeclareConsignmentItemXml consignmentitem = new DeclareConsignmentItemXml();
  1004 + consignment.setConsignmentItem(consignmentitem);
983 } 1005 }
984 1006
985 - String co_deltaname = isManifest ? me.getCo_deltaname() : pe.getCo_deltaname();  
986 - if (!StringUtils.isBlank(co_deltaname)) {  
987 - consignorAddressXml.setCountrySubEntityName(co_deltaname);  
988 - } 1007 + declare.setConsignment(consignment);
989 1008
990 - String co_zipcode = isManifest ? me.getCo_zipcode() : pe.getCo_zipcode();  
991 - if (!StringUtils.isBlank(co_zipcode)) {  
992 - consignorAddressXml.setCountryCode(co_zipcode); 1009 + if (WaybillReceiptType.DELETE == type) {
  1010 + ContentXml additionalInformation = new ContentXml();
  1011 + additionalInformation.setContent("");
  1012 + declare.setAdditionalInformation(additionalInformation);
993 } 1013 }
994 1014
995 - consignor.setAddress(consignorAddressXml);  
996 - consignment.setConsignor(consignor);  
997 -  
998 - DeclareConsignmentItemXml consignmentitem = new DeclareConsignmentItemXml();  
999 - consignment.setConsignmentItem(consignmentitem);  
1000 -  
1001 - declare.setConsignment(consignment);  
1002 -  
1003 body.setDeclaration(declare); 1015 body.setDeclaration(declare);
1004 return body; 1016 return body;
1005 } 1017 }
@@ -35,7 +35,7 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity @@ -35,7 +35,7 @@ public class PreparesecondaryService extends BasicService<PreparesecondaryEntity
35 if(list!=null) { 35 if(list!=null) {
36 for (int i = 0; i < list.size(); i++) { 36 for (int i = 0; i < list.size(); i++) {
37 PreparesecondaryEntity bean = list.get(i); 37 PreparesecondaryEntity bean = list.get(i);
38 - WaybillReceiptEntity re = receiptService.findByWaybillNoAndSub(bean.getWaybillnomaster(), bean.getWaybillnosecondary()); 38 + WaybillReceiptEntity re = receiptService.findSub(bean.getWaybillnomaster(), bean.getWaybillnosecondary());
39 bean.setResponse_code(re!=null?re.getResponse_code():""); 39 bean.setResponse_code(re!=null?re.getResponse_code():"");
40 bean.setResponse_text(re!=null?re.getResponse_text():""); 40 bean.setResponse_text(re!=null?re.getResponse_text():"");
41 } 41 }
@@ -50,7 +50,15 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> { @@ -50,7 +50,15 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> {
50 } 50 }
51 } 51 }
52 52
53 - public WaybillReceiptEntity findByWaybillNoAndSub(String waybill_no, String sub_waybill_no) { 53 + public WaybillReceiptEntity findMain(String waybill_no) {
  54 + List<WaybillReceiptEntity> consigns = service.findMainList(waybill_no);
  55 + if (CollectionUtils.isNotEmpty(consigns)) {
  56 + return consigns.get(0);
  57 + }
  58 + return null;
  59 + }
  60 +
  61 + public WaybillReceiptEntity findSub(String waybill_no, String sub_waybill_no) {
54 List<WaybillReceiptEntity> consigns = service.findByWaybillNoAndSub(waybill_no, sub_waybill_no); 62 List<WaybillReceiptEntity> consigns = service.findByWaybillNoAndSub(waybill_no, sub_waybill_no);
55 if (CollectionUtils.isNotEmpty(consigns)) { 63 if (CollectionUtils.isNotEmpty(consigns)) {
56 return consigns.get(0); 64 return consigns.get(0);
@@ -63,19 +71,11 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> { @@ -63,19 +71,11 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> {
63 return list; 71 return list;
64 } 72 }
65 73
66 - public List<WaybillReceiptEntity> findSubList(String sub_waybill_no) {  
67 - List<WaybillReceiptEntity> list = service.findSubList(sub_waybill_no); 74 + public List<WaybillReceiptEntity> findSubList(String waybill_no, String sub_waybill_no) {
  75 + List<WaybillReceiptEntity> list = service.findSubList(waybill_no,sub_waybill_no);
68 return list; 76 return list;
69 } 77 }
70 78
71 - public WaybillReceiptEntity findByWaybillNo(String waybill_no) {  
72 - List<WaybillReceiptEntity> consigns = service.findMainList(waybill_no);  
73 - if (CollectionUtils.isNotEmpty(consigns)) {  
74 - return consigns.get(0);  
75 - }  
76 - return null;  
77 - }  
78 -  
79 public void save(WaybillReceiptEntity c) { 79 public void save(WaybillReceiptEntity c) {
80 if (c != null) { 80 if (c != null) {
81 if (c.getCreateDate() == null) { 81 if (c.getCreateDate() == null) {
@@ -115,7 +115,7 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> { @@ -115,7 +115,7 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> {
115 wre.setFlightno(manifest.getFlightno()); 115 wre.setFlightno(manifest.getFlightno());
116 wre.setMessage_type("MT2201"); 116 wre.setMessage_type("MT2201");
117 wre.setResponse_code(String.valueOf(type.getValue())); 117 wre.setResponse_code(String.valueOf(type.getValue()));
118 - wre.setResponse_text("主单——" + type.getName()); 118 + wre.setResponse_text(type.getName());
119 wre.setSendtime(Constant.dateTimeFormatnumber.format(new Date())); 119 wre.setSendtime(Constant.dateTimeFormatnumber.format(new Date()));
120 wre.setWaybill_no(manifest.getWaybillnomaster()); 120 wre.setWaybill_no(manifest.getWaybillnomaster());
121 wre.setCreator(Tools.getUserEntity()); 121 wre.setCreator(Tools.getUserEntity());
@@ -153,7 +153,7 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> { @@ -153,7 +153,7 @@ public class WaybillReceiptService extends BasicService<WaybillReceiptEntity> {
153 wre.setFlightno(prepare.getFlightno()); 153 wre.setFlightno(prepare.getFlightno());
154 wre.setMessage_type("MT2201"); 154 wre.setMessage_type("MT2201");
155 wre.setResponse_code(String.valueOf(type.getValue())); 155 wre.setResponse_code(String.valueOf(type.getValue()));
156 - wre.setResponse_text("分单——" + type.getName()); 156 + wre.setResponse_text(type.getName());
157 wre.setSendtime(Constant.dateTimeFormatnumber.format(new Date())); 157 wre.setSendtime(Constant.dateTimeFormatnumber.format(new Date()));
158 wre.setWaybill_no(prepare.getWaybillnomaster()); 158 wre.setWaybill_no(prepare.getWaybillnomaster());
159 wre.setSub_waybill_no(prepare.getWaybillnosecondary()); 159 wre.setSub_waybill_no(prepare.getWaybillnosecondary());
  1 +package com.agent.xml;
  2 +
  3 +import com.agent.xml.common.XmlUtil;
  4 +
  5 +/**
  6 + * Depiction: 报文缓存并发送任务
  7 + * <p>
  8 + * Modify:
  9 + * <p>
  10 + * Author: William Lynn
  11 + * <p>
  12 + * Create Date:2018年7月16日 下午12:00:13
  13 + *
  14 + */
  15 +public class XmlBuildTask extends Thread {
  16 + private Object obj;
  17 + private String path;
  18 +
  19 + public XmlBuildTask(Object obj, String path) {
  20 + this.obj = obj;
  21 + this.path = path;
  22 + }
  23 +
  24 + @Override
  25 + public void run() {
  26 + String xml = XmlUtil.convertToXml2(obj, path);
  27 + System.err.println();
  28 + System.err.println("===================xml===================");
  29 + System.err.println(xml);
  30 +
  31 + new XmlSendTask(xml).send();
  32 + }
  33 +
  34 + public void perform() {
  35 + this.start();
  36 + }
  37 +}
  1 +package com.agent.xml;
  2 +
  3 +import org.apache.commons.lang3.StringUtils;
  4 +
  5 +import redis.clients.jedis.Jedis;
  6 +
  7 +/**
  8 + *
  9 + * Depiction: 发送报文
  10 + * <p>
  11 + * Modify:
  12 + * <p>
  13 + * Author: William Lynn
  14 + * <p>
  15 + * Create Date:2018年7月16日 下午12:13:37
  16 + *
  17 + */
  18 +class XmlSendTask extends Thread {
  19 + // 创建 缓存服务器的地址ip
  20 + private Jedis jedis = new Jedis("10.50.3.71", 6379);
  21 +
  22 + private String xml;
  23 +
  24 + public XmlSendTask(String xml) {
  25 + this.xml = xml;
  26 + }
  27 +
  28 + @Override
  29 + public void run() {
  30 + long flag = -1;
  31 + if (!StringUtils.isEmpty(xml)) {
  32 + flag = jedis.lpush("task-queue", xml);
  33 + }
  34 +
  35 + System.err.println("redis result -->" + flag);
  36 + }
  37 +
  38 + public void send() {
  39 + this.start();
  40 + }
  41 +
  42 +}
@@ -4,15 +4,12 @@ import java.text.SimpleDateFormat; @@ -4,15 +4,12 @@ import java.text.SimpleDateFormat;
4 import java.util.Date; 4 import java.util.Date;
5 import java.util.Locale; 5 import java.util.Locale;
6 6
7 -import javax.annotation.Resource;  
8 -  
9 import org.apache.commons.lang.StringUtils; 7 import org.apache.commons.lang.StringUtils;
10 8
11 import com.agent.entity.Constant; 9 import com.agent.entity.Constant;
12 import com.agent.entity.agent.BasicAgentEntity; 10 import com.agent.entity.agent.BasicAgentEntity;
13 import com.agent.entity.agent.ManifestEntity; 11 import com.agent.entity.agent.ManifestEntity;
14 import com.agent.entity.agent.PreparesecondaryEntity; 12 import com.agent.entity.agent.PreparesecondaryEntity;
15 -import com.agent.service.agent.BasicAgentService;  
16 import com.agent.xml.fhlsli.common.ApplicableFreightRateServiceCharge; 13 import com.agent.xml.fhlsli.common.ApplicableFreightRateServiceCharge;
17 import com.agent.xml.fhlsli.common.ArrivalEvent; 14 import com.agent.xml.fhlsli.common.ArrivalEvent;
18 import com.agent.xml.fhlsli.common.AssociatedParty; 15 import com.agent.xml.fhlsli.common.AssociatedParty;
@@ -53,8 +50,6 @@ import com.agent.xml.fhlsli.sli.IncludedMasterConsignmentItem; @@ -53,8 +50,6 @@ import com.agent.xml.fhlsli.sli.IncludedMasterConsignmentItem;
53 import com.agent.xml.fhlsli.sli.ReportedStatus; 50 import com.agent.xml.fhlsli.sli.ReportedStatus;
54 import com.agent.xml.fhlsli.sli.SliMasterConsignment; 51 import com.agent.xml.fhlsli.sli.SliMasterConsignment;
55 52
56 -import tools.Tools;  
57 -  
58 /** 53 /**
59 * Depiction:给天信达用 54 * Depiction:给天信达用
60 * <p> 55 * <p>
@@ -67,25 +62,6 @@ import tools.Tools; @@ -67,25 +62,6 @@ import tools.Tools;
67 */ 62 */
68 public class FSXmlKit { 63 public class FSXmlKit {
69 64
70 - @Resource  
71 - private static BasicAgentService agentService;  
72 -  
73 - private static BasicAgentEntity getAgent() {  
74 - BasicAgentEntity agent = agentService.findOne(Tools.getUserId());  
75 - if(agent==null) {  
76 - agent = new BasicAgentEntity();  
77 - }  
78 - if(StringUtils.isBlank(agent.getThreeCode())){  
79 - agent.setThreeCode("");  
80 - }  
81 -  
82 - if(StringUtils.isBlank(agent.getNameCn())){  
83 - agent.setNameCn("");  
84 - }  
85 -  
86 - return agent;  
87 - }  
88 -  
89 private static String getDateWithZone() { 65 private static String getDateWithZone() {
90 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.CHINA); 66 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.CHINA);
91 return sdf.format(new Date()); 67 return sdf.format(new Date());
@@ -96,7 +72,7 @@ public class FSXmlKit { @@ -96,7 +72,7 @@ public class FSXmlKit {
96 * 72 *
97 * @param me 73 * @param me
98 */ 74 */
99 - public static SliCcs sliXml(ManifestEntity me) { 75 + public static SliCcs sliXml(ManifestEntity me,BasicAgentEntity agent) {
100 SliCcs msg = new SliCcs(); 76 SliCcs msg = new SliCcs();
101 77
102 Meta meta = new Meta(); 78 Meta meta = new Meta();
@@ -153,8 +129,8 @@ public class FSXmlKit { @@ -153,8 +129,8 @@ public class FSXmlKit {
153 sliMasterConsignment.setConsigneeParty(consigneeParty); 129 sliMasterConsignment.setConsigneeParty(consigneeParty);
154 130
155 FreightForwarderParty freightForwarderParty = new FreightForwarderParty(); 131 FreightForwarderParty freightForwarderParty = new FreightForwarderParty();
156 -// freightForwarderParty.setPrimaryID(getAgent().getThreeCode());//代理人代码  
157 -// freightForwarderParty.setName(getAgent().getNameEn());//代理人名称 132 + freightForwarderParty.setPrimaryID(agent.getThreeCode());//代理人代码
  133 + freightForwarderParty.setName(agent.getThreeCode());//代理人名称
158 PostalStructuredAddress agentdAddress = new PostalStructuredAddress(); 134 PostalStructuredAddress agentdAddress = new PostalStructuredAddress();
159 agentdAddress.setCityName(""); 135 agentdAddress.setCityName("");
160 agentdAddress.setCountryID(""); 136 agentdAddress.setCountryID("");
@@ -163,8 +139,11 @@ public class FSXmlKit { @@ -163,8 +139,11 @@ public class FSXmlKit {
163 139
164 AssociatedParty associatedParty = new AssociatedParty(); 140 AssociatedParty associatedParty = new AssociatedParty();
165 141
166 - associatedParty.setPrimaryID(getAgent().getThreeCode());//代理人代码  
167 - associatedParty.setName(getAgent().getNameEn());//代理人名称 142 + associatedParty.setPrimaryID(agent.getThreeCode());//代理人代码
  143 + associatedParty.setName(agent.getThreeCode());//代理人名称
  144 + associatedParty.setAccountID("INFOSKY:NULL");
  145 + associatedParty.setRoleCode("AGT");
  146 + associatedParty.setRole("Agent");
168 associatedParty.setPostalStructuredAddress(agentdAddress); 147 associatedParty.setPostalStructuredAddress(agentdAddress);
169 sliMasterConsignment.setAssociatedParty(associatedParty); 148 sliMasterConsignment.setAssociatedParty(associatedParty);
170 149
@@ -277,7 +256,7 @@ public class FSXmlKit { @@ -277,7 +256,7 @@ public class FSXmlKit {
277 * 256 *
278 * @param pe 257 * @param pe
279 */ 258 */
280 - public static FhlCcs fhlXml(PreparesecondaryEntity pe) { 259 + public static FhlCcs fhlXml(PreparesecondaryEntity pe,BasicAgentEntity agent) {
281 FhlCcs msg = new FhlCcs(); 260 FhlCcs msg = new FhlCcs();
282 261
283 Meta meta = new Meta(); 262 Meta meta = new Meta();
@@ -374,8 +353,8 @@ public class FSXmlKit { @@ -374,8 +353,8 @@ public class FSXmlKit {
374 includedHouseConsignment.setConsigneeParty(consigneeParty); 353 includedHouseConsignment.setConsigneeParty(consigneeParty);
375 354
376 FreightForwarderParty freightForwarderParty = new FreightForwarderParty(); 355 FreightForwarderParty freightForwarderParty = new FreightForwarderParty();
377 -// freightForwarderParty.setPrimaryID(getAgent().getThreeCode());//代理人代码  
378 -// freightForwarderParty.setName(getAgent().getNameEn());//代理人名称 356 + freightForwarderParty.setPrimaryID(agent.getThreeCode());//代理人代码
  357 + freightForwarderParty.setName(agent.getThreeCode());//代理人名称
379 358
380 PostalStructuredAddress agentdAddress = new PostalStructuredAddress(); 359 PostalStructuredAddress agentdAddress = new PostalStructuredAddress();
381 agentdAddress.setCityName(""); 360 agentdAddress.setCityName("");
@@ -384,8 +363,11 @@ public class FSXmlKit { @@ -384,8 +363,11 @@ public class FSXmlKit {
384 includedHouseConsignment.setFreightForwarderParty(freightForwarderParty); 363 includedHouseConsignment.setFreightForwarderParty(freightForwarderParty);
385 364
386 AssociatedParty associatedParty = new AssociatedParty(); 365 AssociatedParty associatedParty = new AssociatedParty();
387 - associatedParty.setPrimaryID(getAgent().getThreeCode());//代理人代码  
388 - associatedParty.setName(getAgent().getNameEn());//代理人名称 366 + associatedParty.setPrimaryID(agent.getThreeCode());//代理人代码
  367 + associatedParty.setName(agent.getThreeCode());//代理人名称
  368 + associatedParty.setAccountID("INFOSKY:NULL");
  369 + associatedParty.setRoleCode("AGT");
  370 + associatedParty.setRole("Agent");
389 associatedParty.setPostalStructuredAddress(agentdAddress); 371 associatedParty.setPostalStructuredAddress(agentdAddress);
390 includedHouseConsignment.setAssociatedParty(associatedParty); 372 includedHouseConsignment.setAssociatedParty(associatedParty);
391 373
@@ -27,6 +27,8 @@ public class AssociatedParty { @@ -27,6 +27,8 @@ public class AssociatedParty {
27 @XmlElement(name = "LegalID",required = false) 27 @XmlElement(name = "LegalID",required = false)
28 private String LegalID; 28 private String LegalID;
29 @XmlElement(name = "RoleCode",required = false) 29 @XmlElement(name = "RoleCode",required = false)
  30 + private String AccountID;
  31 + @XmlElement(name = "AccountID",required = false)
30 private String RoleCode; 32 private String RoleCode;
31 @XmlElement(name = "Role",required = false) 33 @XmlElement(name = "Role",required = false)
32 private String Role; 34 private String Role;
@@ -60,6 +62,15 @@ public class AssociatedParty { @@ -60,6 +62,15 @@ public class AssociatedParty {
60 public String getLegalID() { 62 public String getLegalID() {
61 return LegalID; 63 return LegalID;
62 } 64 }
  65 +
  66 +
  67 + public String getAccountID() {
  68 + return AccountID;
  69 + }
  70 +
  71 + public void setAccountID(String accountID) {
  72 + AccountID = accountID;
  73 + }
63 74
64 public void setRoleCode(String RoleCode) { 75 public void setRoleCode(String RoleCode) {
65 this.RoleCode = RoleCode; 76 this.RoleCode = RoleCode;
1 package com.framework.util; 1 package com.framework.util;
2 2
3 -import java.security.MessageDigest;  
4 -  
5 -/**  
6 - * MD5加密工具类  
7 - * <功能详细描述>  
8 - *  
9 - * @author chenlujun  
10 - * @version [版本号, 2014年10月1日]  
11 - * @see [相关类/方法]  
12 - * @since [产品/模块版本]  
13 - */  
14 -public abstract class MD5Tools  
15 -{  
16 - public final static String MD5(String pwd) {  
17 - //用于加密的字符  
18 - char md5String[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',  
19 - 'A', 'B', 'C', 'D', 'E', 'F' };  
20 - try {  
21 - //使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中  
22 - byte[] btInput = pwd.getBytes();  
23 -  
24 - //信息摘要是安全的单向哈希函数,它接收任意大小的数据,并输出固定长度的哈希值。  
25 - MessageDigest mdInst = MessageDigest.getInstance("MD5");  
26 -  
27 - //MessageDigest对象通过使用 update方法处理数据, 使用指定的byte数组更新摘要  
28 - mdInst.update(btInput);  
29 -  
30 - // 摘要更新之后,通过调用digest()执行哈希计算,获得密文  
31 - byte[] md = mdInst.digest();  
32 -  
33 - // 把密文转换成十六进制的字符串形式  
34 - int j = md.length;  
35 - char str[] = new char[j * 2];  
36 - int k = 0;  
37 - for (int i = 0; i < j; i++) { // i = 0  
38 - byte byte0 = md[i]; //95  
39 - str[k++] = md5String[byte0 >>> 4 & 0xf]; // 5  
40 - str[k++] = md5String[byte0 & 0xf]; // F  
41 - }  
42 -  
43 - //返回经过加密后的字符串  
44 - return new String(str);  
45 -  
46 - } catch (Exception e) {  
47 - return null;  
48 - }  
49 - }  
50 -  
51 -  
52 - public static void main(String[] args) {  
53 - System.out.println(MD5Tools.MD5("admin"));  
54 - }  
55 -} 3 +import java.security.MessageDigest;
  4 +
  5 +/**
  6 + * MD5加密工具类 <功能详细描述>
  7 + *
  8 + * @author chenlujun
  9 + * @version [版本号, 2014年10月1日]
  10 + * @see [相关类/方法]
  11 + * @since [产品/模块版本]
  12 + */
  13 +public abstract class MD5Tools {
  14 + public final static String MD5(String pwd) {
  15 + // 用于加密的字符
  16 + char md5String[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
  17 + try {
  18 + // 使用平台的默认字符集将此 String 编码为 byte序列,并将结果存储到一个新的 byte数组中
  19 + byte[] btInput = pwd.getBytes();
  20 +
  21 + // 信息摘要是安全的单向哈希函数,它接收任意大小的数据,并输出固定长度的哈希值。
  22 + MessageDigest mdInst = MessageDigest.getInstance("MD5");
  23 +
  24 + // MessageDigest对象通过使用 update方法处理数据, 使用指定的byte数组更新摘要
  25 + mdInst.update(btInput);
  26 +
  27 + // 摘要更新之后,通过调用digest()执行哈希计算,获得密文
  28 + byte[] md = mdInst.digest();
  29 +
  30 + // 把密文转换成十六进制的字符串形式
  31 + int j = md.length;
  32 + char str[] = new char[j * 2];
  33 + int k = 0;
  34 + for (int i = 0; i < j; i++) { // i = 0
  35 + byte byte0 = md[i]; // 95
  36 + str[k++] = md5String[byte0 >>> 4 & 0xf]; // 5
  37 + str[k++] = md5String[byte0 & 0xf]; // F
  38 + }
  39 +
  40 + // 返回经过加密后的字符串
  41 + return new String(str);
  42 +
  43 + } catch (Exception e) {
  44 + return null;
  45 + }
  46 + }
  47 +
  48 + public static void main(String[] args) {
  49 + System.out.println(MD5Tools.MD5("admin"));
  50 + }
  51 +}
@@ -128,4 +128,12 @@ public class InfoData { @@ -128,4 +128,12 @@ public class InfoData {
128 this.postcode = postcode; 128 this.postcode = postcode;
129 } 129 }
130 130
  131 + @Override
  132 + public String toString() {
  133 + return "InfoData [contact=" + contact + ", mobile=" + mobile + ", address=" + address + ", tel=" + tel
  134 + + ", company=" + company + ", company_logo=" + company_logo + ", company_info=" + company_info + ", qq="
  135 + + qq + ", bank=" + bank + ", bankno=" + bankno + ", rate=" + rate + ", regposition=" + regposition
  136 + + ", nature=" + nature + ", postcode=" + postcode + "]";
  137 + }
  138 +
131 } 139 }
@@ -19,6 +19,9 @@ public class LoginData { @@ -19,6 +19,9 @@ public class LoginData {
19 this.info = info; 19 this.info = info;
20 } 20 }
21 public InfoData getInfodata() { 21 public InfoData getInfodata() {
  22 + if(infodata==null) {
  23 + infodata = new InfoData();
  24 + }
22 return infodata; 25 return infodata;
23 } 26 }
24 public void setInfodata(InfoData infodata) { 27 public void setInfodata(InfoData infodata) {
@@ -204,7 +204,7 @@ @@ -204,7 +204,7 @@
204 //分单撤销按钮 204 //分单撤销按钮
205 function preoperatorFormat(val, row, index){ 205 function preoperatorFormat(val, row, index){
206 var html = "<a href='javascript:void(0)' onclick='prebackout("+row.id+")' style='text-decoration:none;color:blue;'><spring:message code='opt.backout' /></a>"; 206 var html = "<a href='javascript:void(0)' onclick='prebackout("+row.id+")' style='text-decoration:none;color:blue;'><spring:message code='opt.backout' /></a>";
207 - html+="<a href='javascript:void(0)' onclick='openSubReceipt(\""+row.waybillnosecondary+"\")' style='text-decoration:none;color:blue;margin-left:20px;'><spring:message code='opt.open.receipt'/></a>"; 207 + html+="<a href='javascript:void(0)' onclick='openSubReceipt(\""+row.waybillnomaster+"\",\""+row.waybillnosecondary+"\")' style='text-decoration:none;color:blue;margin-left:20px;'><spring:message code='opt.open.receipt'/></a>";
208 return html; 208 return html;
209 } 209 }
210 210
@@ -255,26 +255,29 @@ @@ -255,26 +255,29 @@
255 } 255 }
256 256
257 //查看分单回执 257 //查看分单回执
258 - function openSubReceipt(subno){ 258 + function openSubReceipt(waybill_no,subno){
  259 + if(typeof(waybill_no) == "undefined")
  260 + return;
259 if(typeof(subno) == "undefined") 261 if(typeof(subno) == "undefined")
260 return; 262 return;
261 - console.log("分单号-->"+subno);  
262 - seeReceipt(subno,false); 263 + seeReceipt(waybill_no,subno,false);
263 } 264 }
264 265
265 //查看主单回执 266 //查看主单回执
266 - function openReceipt(no){  
267 - if(typeof(no) == "undefined") 267 + function openReceipt(waybill_no){
  268 + if(typeof(waybill_no) == "undefined")
268 return; 269 return;
269 - console.log("主单号-->"+no);  
270 - seeReceipt(no,true); 270 + seeReceipt(waybill_no,"",true);
271 } 271 }
272 272
273 - function seeReceipt(no,isMain){ 273 + function seeReceipt(waybill_no,sub_waybill_no,isMain){
274 layui.use('layer', function(){ 274 layui.use('layer', function(){
275 var layer = layui.layer; 275 var layer = layui.layer;
276 var api="<%=basePath%>receipt/seeReceipt"; 276 var api="<%=basePath%>receipt/seeReceipt";
277 - var params = "no="+no+"&isMain="+isMain; 277 + var params = "waybill_no="+waybill_no;
  278 + if(!isMain){
  279 + params+="&sub_waybill_no="+sub_waybill_no;
  280 + }
278 var viewUrl = api+"?"+params; 281 var viewUrl = api+"?"+params;
279 282
280 parent.layer.open({ 283 parent.layer.open({
@@ -135,5 +135,8 @@ @@ -135,5 +135,8 @@
135 <location>/WEB-INF/views/login.jsp</location> 135 <location>/WEB-INF/views/login.jsp</location>
136 </error-page> 136 </error-page>
137 137
  138 + <session-config>
  139 + <session-timeout>120</session-timeout>
  140 + </session-config>
138 141
139 </web-app> 142 </web-app>