作者 shenhailong

预配 远程调用

@@ -1149,6 +1149,9 @@ public class ManifestController extends BasicController { @@ -1149,6 +1149,9 @@ public class ManifestController extends BasicController {
1149 @RequestMapping(value = "/savesend", method = { RequestMethod.POST }) 1149 @RequestMapping(value = "/savesend", method = { RequestMethod.POST })
1150 @ResponseBody 1150 @ResponseBody
1151 public ResponseModel savesend(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) { 1151 public ResponseModel savesend(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) {
  1152 +
  1153 + System.out.println(manifest);
  1154 +
1152 //发货人 1155 //发货人
1153 String forShortShipper = request.getParameter("for_short_shipper"); 1156 String forShortShipper = request.getParameter("for_short_shipper");
1154 //订舱代理 1157 //订舱代理
@@ -1177,8 +1180,6 @@ public class ManifestController extends BasicController { @@ -1177,8 +1180,6 @@ public class ManifestController extends BasicController {
1177 manifest.setCarrier(carrier); 1180 manifest.setCarrier(carrier);
1178 manifest.setFlightno(flightno); 1181 manifest.setFlightno(flightno);
1179 1182
1180 - // consigneeService.saveFromManifest(manifest, Tools.getUserId());  
1181 - // consignorService.saveFromManifest(manifest, Tools.getUserId());  
1182 1183
1183 ResponseModel model = new ResponseModel(); 1184 ResponseModel model = new ResponseModel();
1184 try { 1185 try {
@@ -1187,11 +1188,7 @@ public class ManifestController extends BasicController { @@ -1187,11 +1188,7 @@ public class ManifestController extends BasicController {
1187 model.setStatus(500); 1188 model.setStatus(500);
1188 model.setMsg("该订单号已存在!"); 1189 model.setMsg("该订单号已存在!");
1189 } else { 1190 } else {
1190 - // String responseCode = manifest.getResponse_code();  
1191 - // int resCode = NumKit.parseInt(responseCode);  
1192 - // WaybillReceiptType oldType = WaybillReceiptType.valueOf(resCode);  
1193 - // WaybillReceiptType type = oldType != null ? WaybillReceiptType.UPDATE :  
1194 - // WaybillReceiptType.APPLY; 1191 +
1195 WaybillReceiptType type = WaybillReceiptType.APPLY; 1192 WaybillReceiptType type = WaybillReceiptType.APPLY;
1196 1193
1197 String stowagedate = request.getParameter("stowagedate"); 1194 String stowagedate = request.getParameter("stowagedate");
@@ -1236,28 +1233,6 @@ public class ManifestController extends BasicController { @@ -1236,28 +1233,6 @@ public class ManifestController extends BasicController {
1236 new XmlBuildTask(manifestService.sendDLCFXml(manifest), dlcPath).perform(); 1233 new XmlBuildTask(manifestService.sendDLCFXml(manifest), dlcPath).perform();
1237 new XmlBuildTask(FSXmlKit.sliXml(manifest, getAgent()), sliPath).perform(); 1234 new XmlBuildTask(FSXmlKit.sliXml(manifest, getAgent()), sliPath).perform();
1238 1235
1239 - // String ndlrxml = XmlUtil.convertToXml2(manifestService.sendNDLRXml(manifest),  
1240 - // ndlrPath);  
1241 - // String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDLCFXml(manifest),  
1242 - // dlcPath);  
1243 - // String slifxml = XmlUtil.convertToXml2(FSXmlKit.sliXml(manifest, getAgent()),  
1244 - // sliPath);  
1245 -  
1246 - // System.err.println("===================ndlrxml===================");  
1247 - // System.err.println(ndlrxml);  
1248 - // System.err.println();  
1249 - //  
1250 - // System.err.println("===================dlcfxml===================");  
1251 - // System.err.println(dlcfxml);  
1252 - // System.err.println();  
1253 - //  
1254 - // System.err.println("===================slifxml===================");  
1255 - // System.err.println(slifxml);  
1256 - // System.err.println();  
1257 -  
1258 - // new XmlSendTask(ndlrxml).send();  
1259 - // new XmlSendTask(dlcfxml).send();  
1260 - // new XmlSendTask(slifxml).send();  
1261 1236
1262 model.setData(manifest); 1237 model.setData(manifest);
1263 model.setStatus(200); 1238 model.setStatus(200);
@@ -1271,6 +1246,68 @@ public class ManifestController extends BasicController { @@ -1271,6 +1246,68 @@ public class ManifestController extends BasicController {
1271 return model; 1246 return model;
1272 } 1247 }
1273 1248
  1249 +
  1250 + /**
  1251 + * 远程调用 主单提交表单保存
  1252 + *
  1253 + * @param manifest
  1254 + * @return
  1255 + */
  1256 + @RequestMapping(value = "/savesendMainfest", method = { RequestMethod.POST })
  1257 + @ResponseBody
  1258 + public ResponseModel savesendMainfest(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) {
  1259 +
  1260 + ResponseModel model = new ResponseModel();
  1261 + if ("dcdf38d9a5d6411985e49155481882f5".equals(manifest.getPassword())){
  1262 + String flightno = manifest.getFlightno();
  1263 + String carrier = "";
  1264 + if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
  1265 + carrier = flightno.substring(0, 2);
  1266 + flightno = flightno.replace(carrier, "");
  1267 + }
  1268 + manifest.setCarrier(carrier);
  1269 + manifest.setFlightno(flightno);
  1270 +
  1271 +
  1272 + try {
  1273 + manifest.setUSER_ID(Tools.getUserId());
  1274 + if (manifestService.isExistsByWaybill(manifest)) {
  1275 + model.setStatus(201);
  1276 + model.setMsg("该订单号已存在!");
  1277 + } else {
  1278 + WaybillReceiptType type = WaybillReceiptType.APPLY;
  1279 +
  1280 + String stowagedate = request.getParameter("stowagedate");
  1281 + manifest.setStowagedate(ManifestEntity.getStowagedate(stowagedate));
  1282 + // 保存
  1283 + manifest.setIsdelete(1);
  1284 + manifest.setResponse_code(String.valueOf(type.getValue()));
  1285 + manifest.setResponse_text(type.getName());
  1286 + manifest.setSave_time(System.currentTimeMillis());
  1287 +
  1288 + manifestService.save(manifest);
  1289 + receiptService.saveFromManifest(manifest, type);
  1290 +
  1291 + manifest.setAgentcompany(getAgent().getNameCn());
  1292 + manifest.setAgentman(getAgent().getThreeCode());
  1293 + manifest.setAgentcompanycode(getAgent().getThreeCode());
  1294 +
  1295 + model.setData(manifest);
  1296 + model.setStatus(200);
  1297 + model.setMsg(HttpJsonMsg.SUCCESS);
  1298 + }
  1299 + } catch (Exception e) {
  1300 + model.setStatus(500);
  1301 + model.setMsg(HttpJsonMsg.ERROR);
  1302 + logger.error("系统异常 >>", e);
  1303 + }
  1304 + }else {
  1305 + model.setStatus(202);
  1306 + model.setMsg("缺少验证密码");
  1307 + }
  1308 + return model;
  1309 + }
  1310 +
1274 /** 1311 /**
1275 * 发送交运报并且保存 1312 * 发送交运报并且保存
1276 * 1313 *
@@ -289,6 +289,16 @@ public class ManifestEntity extends BasicEntity implements Serializable { @@ -289,6 +289,16 @@ public class ManifestEntity extends BasicEntity implements Serializable {
289 private Long save_time; 289 private Long save_time;
290 private Long USER_ID; // 报文所属的用户id 290 private Long USER_ID; // 报文所属的用户id
291 291
  292 + // 验证密码 调用使用
  293 + private String password;
  294 +
  295 + public String getPassword() {
  296 + return password;
  297 + }
  298 +
  299 + public void setPassword(String password) {
  300 + this.password = password;
  301 + }
292 302
293 public String getUnlodingcode() { 303 public String getUnlodingcode() {
294 return StringUtils.isBlank(unlodingcode) ? getDestinationstation() : unlodingcode; 304 return StringUtils.isBlank(unlodingcode) ? getDestinationstation() : unlodingcode;
@@ -76,6 +76,9 @@ @@ -76,6 +76,9 @@
76 <value> 76 <value>
77 /receipt/a0608c4054662dd902e1314f7e450e3eaa81c114 = anon 77 /receipt/a0608c4054662dd902e1314f7e450e3eaa81c114 = anon
78 /login = anon 78 /login = anon
  79 + <!--开放预配添加接口-->
  80 + /manifest/savesend = anon
  81 +
79 82
80 /druid/** = anon 83 /druid/** = anon
81 /unauthorized = anon 84 /unauthorized = anon