作者 shenhailong

预配 远程调用

... ... @@ -1149,6 +1149,9 @@ public class ManifestController extends BasicController {
@RequestMapping(value = "/savesend", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel savesend(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) {
System.out.println(manifest);
//发货人
String forShortShipper = request.getParameter("for_short_shipper");
//订舱代理
... ... @@ -1177,8 +1180,6 @@ public class ManifestController extends BasicController {
manifest.setCarrier(carrier);
manifest.setFlightno(flightno);
// consigneeService.saveFromManifest(manifest, Tools.getUserId());
// consignorService.saveFromManifest(manifest, Tools.getUserId());
ResponseModel model = new ResponseModel();
try {
... ... @@ -1187,11 +1188,7 @@ public class ManifestController extends BasicController {
model.setStatus(500);
model.setMsg("该订单号已存在!");
} else {
// String responseCode = manifest.getResponse_code();
// int resCode = NumKit.parseInt(responseCode);
// WaybillReceiptType oldType = WaybillReceiptType.valueOf(resCode);
// WaybillReceiptType type = oldType != null ? WaybillReceiptType.UPDATE :
// WaybillReceiptType.APPLY;
WaybillReceiptType type = WaybillReceiptType.APPLY;
String stowagedate = request.getParameter("stowagedate");
... ... @@ -1236,28 +1233,6 @@ public class ManifestController extends BasicController {
new XmlBuildTask(manifestService.sendDLCFXml(manifest), dlcPath).perform();
new XmlBuildTask(FSXmlKit.sliXml(manifest, getAgent()), sliPath).perform();
// String ndlrxml = XmlUtil.convertToXml2(manifestService.sendNDLRXml(manifest),
// ndlrPath);
// String dlcfxml = XmlUtil.convertToXml2(manifestService.sendDLCFXml(manifest),
// dlcPath);
// String slifxml = XmlUtil.convertToXml2(FSXmlKit.sliXml(manifest, getAgent()),
// sliPath);
// System.err.println("===================ndlrxml===================");
// System.err.println(ndlrxml);
// System.err.println();
//
// System.err.println("===================dlcfxml===================");
// System.err.println(dlcfxml);
// System.err.println();
//
// System.err.println("===================slifxml===================");
// System.err.println(slifxml);
// System.err.println();
// new XmlSendTask(ndlrxml).send();
// new XmlSendTask(dlcfxml).send();
// new XmlSendTask(slifxml).send();
model.setData(manifest);
model.setStatus(200);
... ... @@ -1271,6 +1246,68 @@ public class ManifestController extends BasicController {
return model;
}
/**
* 远程调用 主单提交表单保存
*
* @param manifest
* @return
*/
@RequestMapping(value = "/savesendMainfest", method = { RequestMethod.POST })
@ResponseBody
public ResponseModel savesendMainfest(ManifestEntity manifest, HttpServletRequest request, HttpServletResponse response) {
ResponseModel model = new ResponseModel();
if ("dcdf38d9a5d6411985e49155481882f5".equals(manifest.getPassword())){
String flightno = manifest.getFlightno();
String carrier = "";
if (StringUtils.isNotBlank(flightno) && flightno.length() > 2) {
carrier = flightno.substring(0, 2);
flightno = flightno.replace(carrier, "");
}
manifest.setCarrier(carrier);
manifest.setFlightno(flightno);
try {
manifest.setUSER_ID(Tools.getUserId());
if (manifestService.isExistsByWaybill(manifest)) {
model.setStatus(201);
model.setMsg("该订单号已存在!");
} else {
WaybillReceiptType type = WaybillReceiptType.APPLY;
String stowagedate = request.getParameter("stowagedate");
manifest.setStowagedate(ManifestEntity.getStowagedate(stowagedate));
// 保存
manifest.setIsdelete(1);
manifest.setResponse_code(String.valueOf(type.getValue()));
manifest.setResponse_text(type.getName());
manifest.setSave_time(System.currentTimeMillis());
manifestService.save(manifest);
receiptService.saveFromManifest(manifest, type);
manifest.setAgentcompany(getAgent().getNameCn());
manifest.setAgentman(getAgent().getThreeCode());
manifest.setAgentcompanycode(getAgent().getThreeCode());
model.setData(manifest);
model.setStatus(200);
model.setMsg(HttpJsonMsg.SUCCESS);
}
} catch (Exception e) {
model.setStatus(500);
model.setMsg(HttpJsonMsg.ERROR);
logger.error("系统异常 >>", e);
}
}else {
model.setStatus(202);
model.setMsg("缺少验证密码");
}
return model;
}
/**
* 发送交运报并且保存
*
... ...
... ... @@ -289,6 +289,16 @@ public class ManifestEntity extends BasicEntity implements Serializable {
private Long save_time;
private Long USER_ID; // 报文所属的用户id
// 验证密码 调用使用
private String password;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUnlodingcode() {
return StringUtils.isBlank(unlodingcode) ? getDestinationstation() : unlodingcode;
... ...
... ... @@ -76,6 +76,9 @@
<value>
/receipt/a0608c4054662dd902e1314f7e450e3eaa81c114 = anon
/login = anon
<!--开放预配添加接口-->
/manifest/savesend = anon
/druid/** = anon
/unauthorized = anon
... ...