...
|
...
|
@@ -15,6 +15,7 @@ import com.agent.vo.agent.SDVo; |
|
|
import com.agent.vo.agent.SecurityDeclarationVo;
|
|
|
import com.agent.xml.XmlBuildTask;
|
|
|
import com.framework.core.Servlets;
|
|
|
import com.framework.mail.MailSenderService;
|
|
|
import com.framework.util.MessageKit;
|
|
|
import com.framework.util.MessageType;
|
|
|
import com.framework.util.StringUtils;
|
...
|
...
|
@@ -29,6 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import tools.Tools;
|
|
|
|
|
|
import javax.print.attribute.standard.ReferenceUriSchemesSupported;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
...
|
...
|
@@ -37,6 +39,7 @@ import java.net.URL; |
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
...
|
...
|
@@ -129,6 +132,14 @@ public class SecurityDeclarationController { |
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 跳转国际安检申报添加
|
|
|
*/
|
|
|
@RequestMapping(value = "/inlandSaveView")
|
|
|
public String inlandSaveView(){
|
|
|
return "declaration/inlandsave";
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 保存并发送报文
|
|
|
* @param request
|
|
|
* @param waybill
|
...
|
...
|
@@ -153,10 +164,15 @@ public class SecurityDeclarationController { |
|
|
//货物品名
|
|
|
String cargoName = request.getParameter("sd_cargo_name");
|
|
|
//运输条件鉴定书
|
|
|
String transportCertificate = request.getParameter("sd_transport_certificate");
|
|
|
String transportCertificate = "";
|
|
|
if ( request.getParameter("sd_transport_certificate") != null){
|
|
|
transportCertificate = request.getParameter("sd_transport_certificate");
|
|
|
}
|
|
|
//航空公司同意运输证明
|
|
|
String transportationProve = request.getParameter("sd_transportation_prove");
|
|
|
|
|
|
String transportationProve = "";
|
|
|
if (request.getParameter("sd_transportation_prove") != null){
|
|
|
transportationProve = request.getParameter("sd_transportation_prove");
|
|
|
}
|
|
|
//货物性质是否多选
|
|
|
List<String> list = new ArrayList();
|
|
|
if (!StringUtils.isBlank(one)){
|
...
|
...
|
@@ -250,6 +266,223 @@ public class SecurityDeclarationController { |
|
|
|
|
|
|
|
|
/**
|
|
|
* 保存并发送报文
|
|
|
* @param request
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/inlandsave")
|
|
|
@ResponseBody
|
|
|
public ResponseModel inlandsave(HttpServletRequest request) throws ParseException {
|
|
|
ResponseModel model = new ResponseModel();
|
|
|
/**
|
|
|
* 预配
|
|
|
*/
|
|
|
//订单号
|
|
|
String waybill = "";
|
|
|
|
|
|
String waybill1 = request.getParameter("waybill");
|
|
|
|
|
|
if (waybill1.contains("-")){
|
|
|
waybill = waybill1;
|
|
|
}else {
|
|
|
String substring = waybill1.substring(0, waybill1.length() - 8);
|
|
|
String substring1 = waybill1.substring(3);
|
|
|
waybill = substring+"-"+substring1;
|
|
|
}
|
|
|
|
|
|
//承运人公司
|
|
|
String carrier = request.getParameter("carrier");
|
|
|
//航班号
|
|
|
String flightno = request.getParameter("flightno");
|
|
|
//航班日期
|
|
|
String flightdates = request.getParameter("flightdate");
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date flightdate = simpleDateFormat.parse(flightdates);
|
|
|
|
|
|
//公斤
|
|
|
String totalweight = request.getParameter("totalweight");
|
|
|
//件数
|
|
|
String totalpiece = request.getParameter("totalpiece");
|
|
|
//目的地
|
|
|
String destinationstation = request.getParameter("destinationstation");
|
|
|
/**
|
|
|
* 安检申报
|
|
|
*/
|
|
|
//货物性质(类型)
|
|
|
String one = request.getParameter("one");
|
|
|
String two = request.getParameter("two");
|
|
|
String three = request.getParameter("three");
|
|
|
String four = request.getParameter("four");
|
|
|
//航空货物托运人名称
|
|
|
String cargoShipperName = request.getParameter("sd_cargo_shipper_name");
|
|
|
//航空货运销售代理人名称
|
|
|
String cargoAgentName = request.getParameter("sd_cargo_agent_name");
|
|
|
//航协编号
|
|
|
String iataNumber = request.getParameter("sd_iata_number");
|
|
|
//货物品名
|
|
|
String cargoName = request.getParameter("sd_cargo_name");
|
|
|
//运输条件鉴定书
|
|
|
String transportCertificate = "";
|
|
|
if ( request.getParameter("sd_transport_certificate") != null){
|
|
|
transportCertificate = request.getParameter("sd_transport_certificate");
|
|
|
}
|
|
|
//航空公司同意运输证明
|
|
|
String transportationProve = "";
|
|
|
if (request.getParameter("sd_transportation_prove") != null){
|
|
|
transportationProve = request.getParameter("sd_transportation_prove");
|
|
|
}
|
|
|
|
|
|
|
|
|
//货物性质是否多选
|
|
|
List<String> list = new ArrayList();
|
|
|
if (!StringUtils.isBlank(one)){
|
|
|
list.add(one);
|
|
|
}
|
|
|
if (!StringUtils.isBlank(two)){
|
|
|
list.add(two);
|
|
|
}
|
|
|
if (!StringUtils.isBlank(three)){
|
|
|
list.add(three);
|
|
|
}
|
|
|
if (!StringUtils.isBlank(four)){
|
|
|
list.add(four);
|
|
|
}
|
|
|
|
|
|
|
|
|
//查询是否存在
|
|
|
if (securityDeclarationService.findWaybill(waybill) == 0 && manifestService.findWbm(waybill) == null){
|
|
|
//货物性质(类型)添加
|
|
|
for (String type: list){
|
|
|
SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
|
|
|
sdCargoTypeEntity.setSd_waybill(waybill);
|
|
|
sdCargoTypeEntity.setSd_cargo_type(type);
|
|
|
sdCargoTypeService.save(sdCargoTypeEntity);
|
|
|
}
|
|
|
|
|
|
//货物品名
|
|
|
String cName = cargoName.replaceAll(",", ",");
|
|
|
String[] split = cName.split(",");
|
|
|
for (int i=0; i<split.length; i++){
|
|
|
if (!StringUtils.isBlank(split[i]) || !"".equals(split[i])){
|
|
|
SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
|
|
|
sdCargoNameEntity.setSd_waybill(waybill);
|
|
|
sdCargoNameEntity.setSd_cargo_name(split[i]);
|
|
|
sdCargoNameService.save(sdCargoNameEntity);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");
|
|
|
|
|
|
ManifestEntity manifestEntity = new ManifestEntity();
|
|
|
|
|
|
//添加安检申报
|
|
|
SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
|
|
|
sd.setSd_waybill(waybill);
|
|
|
sd.setSd_cargo_agent_name(cargoAgentName);
|
|
|
sd.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
sd.setSd_iata_number(iataNumber);
|
|
|
sd.setSd_transport_certificate(transportCertificate);
|
|
|
sd.setSd_transportation_prove(transportationProve);
|
|
|
sd.setSd_static("1");
|
|
|
if (ue != null){
|
|
|
if (ue.getId() != null ){
|
|
|
sd.setUSER_ID(ue.getId());
|
|
|
manifestEntity.setUSER_ID(ue.getId());
|
|
|
}
|
|
|
}
|
|
|
securityDeclarationService.save(sd);
|
|
|
|
|
|
// 生成报文并且发送
|
|
|
String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
|
|
|
|
|
|
//存放数据Vo
|
|
|
SDVo sdVo = new SDVo();
|
|
|
sdVo.setSd_waybill(waybill);
|
|
|
sdVo.setSd_cargo_agent_name(cargoAgentName);
|
|
|
sdVo.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
sdVo.setSd_iata_number(iataNumber);
|
|
|
sdVo.setSd_transport_certificate(transportCertificate);
|
|
|
sdVo.setSd_transportation_prove(transportationProve);
|
|
|
//品名
|
|
|
sdVo.setSd_cargo_name(cargoName);
|
|
|
//货物类型
|
|
|
String cargoType = "";
|
|
|
for (String s: list){
|
|
|
cargoType+=s+",";
|
|
|
}
|
|
|
sdVo.setSd_cargo_type(cargoType);
|
|
|
|
|
|
//添加预配信息
|
|
|
manifestEntity.setWaybillnomaster(waybill);
|
|
|
manifestEntity.setFlightdate(flightdate);
|
|
|
manifestEntity.setFlightno(flightno);
|
|
|
manifestEntity.setCarrier(carrier);
|
|
|
manifestEntity.setTotalpiece(totalpiece);
|
|
|
manifestEntity.setTotalweight(totalweight);
|
|
|
manifestEntity.setDestinationstation(destinationstation);
|
|
|
manifestService.save(manifestEntity);
|
|
|
|
|
|
//生成报文
|
|
|
sdVo.setFlightno(flightno);
|
|
|
sdVo.setFlightdate(flightdate);
|
|
|
sdVo.setCarrier(carrier);
|
|
|
sdVo.setTotalpiece(totalpiece);
|
|
|
sdVo.setTotalweight(totalweight);
|
|
|
sdVo.setDestinationstation(destinationstation);
|
|
|
new XmlBuildTask(securityDeclarationService.sendNDLRXml(sdVo), ndlrPath).perform();
|
|
|
|
|
|
model.setStatus(200);
|
|
|
}else {
|
|
|
model.setStatus(203);
|
|
|
}
|
|
|
|
|
|
return model;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 查看信息
|
|
|
*/
|
|
|
@RequestMapping(value = "/findone")
|
|
|
public String findOne(Model model, Long id){
|
|
|
|
|
|
String cargoName = "";
|
|
|
String cargoType = "";
|
|
|
SecurityDeclarationEntity sd = securityDeclarationService.findOne(id);
|
|
|
model.addAttribute("sd", sd);
|
|
|
|
|
|
//查询预配
|
|
|
ManifestEntity wbm = manifestService.findWbm(sd.getSd_waybill());
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
String format = simpleDateFormat.format(new Date());
|
|
|
|
|
|
model.addAttribute("date", format);
|
|
|
|
|
|
model.addAttribute("wbm", wbm);
|
|
|
|
|
|
List<SDCargoTypeEntity> sdCargoTypeEntities = sdCargoTypeService.waybillAll(sd.getSd_waybill());
|
|
|
for (SDCargoTypeEntity type: sdCargoTypeEntities){
|
|
|
cargoType+=type.getSd_cargo_type();
|
|
|
}
|
|
|
//货物性质(类型)
|
|
|
|
|
|
model.addAttribute("type", cargoType);
|
|
|
model.addAttribute("types", sdCargoTypeEntities);
|
|
|
|
|
|
List<SDCargoNameEntity> sdCargoNameEntities = sdCargoNameService.waybillAll(sd.getSd_waybill());
|
|
|
for (SDCargoNameEntity sdCargoNameEntity: sdCargoNameEntities){
|
|
|
cargoName+=sdCargoNameEntity.getSd_cargo_name()+",";
|
|
|
}
|
|
|
String name = cargoName.substring(0, cargoName.length() - 1);
|
|
|
model.addAttribute("name", name);
|
|
|
|
|
|
return "declaration/findOne";
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* 调转编辑页面
|
|
|
*/
|
|
|
@RequestMapping(value = "/edit")
|
...
|
...
|
@@ -263,6 +496,12 @@ public class SecurityDeclarationController { |
|
|
//查询预配
|
|
|
ManifestEntity wbm = manifestService.findWbm(sd.getSd_waybill());
|
|
|
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
String format = simpleDateFormat.format(wbm.getFlightdate());
|
|
|
|
|
|
model.addAttribute("date", format);
|
|
|
|
|
|
model.addAttribute("wbm", wbm);
|
|
|
|
|
|
List<SDCargoTypeEntity> sdCargoTypeEntities = sdCargoTypeService.waybillAll(sd.getSd_waybill());
|
...
|
...
|
@@ -286,20 +525,75 @@ public class SecurityDeclarationController { |
|
|
|
|
|
/**
|
|
|
* 安检申报修改
|
|
|
* @param sd
|
|
|
* @param request
|
|
|
* @param waybill
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping("/update")
|
|
|
@ResponseBody
|
|
|
public ResponseModel update(SecurityDeclarationEntity sd, HttpServletRequest request, String waybill){
|
|
|
public ResponseModel update(HttpServletRequest request) throws ParseException {
|
|
|
ResponseModel model = new ResponseModel();
|
|
|
|
|
|
/**
|
|
|
* 预配
|
|
|
*/
|
|
|
//订单号
|
|
|
String waybill = "";
|
|
|
|
|
|
String waybill1 = request.getParameter("waybill");
|
|
|
|
|
|
if (waybill1.contains("-")){
|
|
|
waybill = waybill1;
|
|
|
}else {
|
|
|
String substring = waybill1.substring(0, waybill1.length() - 8);
|
|
|
String substring1 = waybill1.substring(3);
|
|
|
waybill = substring+"-"+substring1;
|
|
|
}
|
|
|
|
|
|
String id = request.getParameter("id");
|
|
|
|
|
|
|
|
|
//承运人公司
|
|
|
String carrier = request.getParameter("carrier");
|
|
|
//航班号
|
|
|
String flightno = request.getParameter("flightno");
|
|
|
//航班日期
|
|
|
String flightdates = request.getParameter("flightdate");
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
Date flightdate = simpleDateFormat.parse(flightdates);
|
|
|
|
|
|
//公斤
|
|
|
String totalweight = request.getParameter("totalweight");
|
|
|
//件数
|
|
|
String totalpiece = request.getParameter("totalpiece");
|
|
|
//目的地
|
|
|
String destinationstation = request.getParameter("destinationstation");
|
|
|
/**
|
|
|
* 安检申报
|
|
|
*/
|
|
|
//货物性质(类型)
|
|
|
String one = request.getParameter("one");
|
|
|
String two = request.getParameter("two");
|
|
|
String three = request.getParameter("three");
|
|
|
String four = request.getParameter("four");
|
|
|
//航空货物托运人名称
|
|
|
String cargoShipperName = request.getParameter("sd_cargo_shipper_name");
|
|
|
//航空货运销售代理人名称
|
|
|
String cargoAgentName = request.getParameter("sd_cargo_agent_name");
|
|
|
//航协编号
|
|
|
String iataNumber = request.getParameter("sd_iata_number");
|
|
|
//货物品名
|
|
|
String cargoName = request.getParameter("sd_cargo_name");
|
|
|
//运输条件鉴定书
|
|
|
String transportCertificate = "";
|
|
|
if ( request.getParameter("sd_transport_certificate") != null){
|
|
|
transportCertificate = request.getParameter("sd_transport_certificate");
|
|
|
}
|
|
|
//航空公司同意运输证明
|
|
|
String transportationProve = "";
|
|
|
if (request.getParameter("sd_transportation_prove") != null){
|
|
|
transportationProve = request.getParameter("sd_transportation_prove");
|
|
|
}
|
|
|
|
|
|
|
|
|
List<String> list = new ArrayList();
|
|
|
if (!StringUtils.isBlank(one)){
|
...
|
...
|
@@ -339,22 +633,40 @@ public class SecurityDeclarationController { |
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (securityDeclarationService.update(sd, waybill)>0){
|
|
|
|
|
|
|
|
|
//修改安检申报
|
|
|
UserEntity ue = (UserEntity)SecurityUtils.getSubject().getSession().getAttribute("user");
|
|
|
SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
|
|
|
sd.setId(Long.valueOf(id));
|
|
|
sd.setSd_waybill(waybill);
|
|
|
sd.setSd_cargo_agent_name(cargoAgentName);
|
|
|
sd.setSd_cargo_shipper_name(cargoShipperName);
|
|
|
sd.setSd_iata_number(iataNumber);
|
|
|
sd.setSd_transport_certificate(transportCertificate);
|
|
|
sd.setSd_transportation_prove(transportationProve);
|
|
|
sd.setSd_static("1");
|
|
|
sd.setUSER_ID(ue.getId());
|
|
|
|
|
|
if (securityDeclarationService.update(sd)>0){
|
|
|
model.setStatus(200);
|
|
|
}
|
|
|
|
|
|
// 生成报文并且发送
|
|
|
String ndlrPath = MessageKit.getMessagePath(MessageType.NDLR);
|
|
|
String dlcPath = MessageKit.getMessagePath(MessageType.DLCF);
|
|
|
String sliPath = MessageKit.getMessagePath(MessageType.SLI);
|
|
|
|
|
|
//存放数据Vo
|
|
|
SDVo sdVo = new SDVo();
|
|
|
sdVo.setSd_waybill(waybill);
|
|
|
sdVo.setSd_cargo_agent_name(sd.getSd_cargo_agent_name());
|
|
|
sdVo.setSd_cargo_shipper_name(sd.getSd_cargo_shipper_name());
|
|
|
sdVo.setSd_iata_number(sd.getSd_iata_number());
|
|
|
if (sd.getSd_transport_certificate() != null){
|
|
|
sdVo.setSd_transport_certificate(sd.getSd_transport_certificate());
|
|
|
}
|
|
|
if (sd.getSd_transportation_prove() != null){
|
|
|
sdVo.setSd_transportation_prove(sd.getSd_transportation_prove());
|
|
|
}
|
|
|
//品名
|
|
|
sdVo.setSd_cargo_name(request.getParameter("sd_cargo_name").replaceAll(",", ","));
|
|
|
//货物类型
|
...
|
...
|
@@ -364,13 +676,30 @@ public class SecurityDeclarationController { |
|
|
}
|
|
|
sdVo.setSd_cargo_type(cargoType);
|
|
|
|
|
|
// ManifestEntity wbm = manifestService.findWbm(waybill);
|
|
|
ManifestEntity manifestEntity = new ManifestEntity();
|
|
|
//修改预配信息
|
|
|
// manifestEntity.setId(wbm.getId());
|
|
|
manifestEntity.setWaybillnomaster(waybill);
|
|
|
manifestEntity.setFlightdate(flightdate);
|
|
|
manifestEntity.setFlightno(flightno);
|
|
|
manifestEntity.setCarrier(carrier);
|
|
|
manifestEntity.setTotalpiece(totalpiece);
|
|
|
manifestEntity.setTotalweight(totalweight);
|
|
|
manifestEntity.setDestinationstation(destinationstation);
|
|
|
// if (manifestService.deleteOne(waybill)>0){
|
|
|
// manifestService.save(manifestEntity);
|
|
|
// }
|
|
|
manifestService.update(manifestEntity);
|
|
|
|
|
|
//预配信息
|
|
|
ManifestEntity wbm = manifestService.findWbm(waybill);
|
|
|
sdVo.setFlightno(wbm.getFlightno());
|
|
|
sdVo.setFlightdate(wbm.getFlightdate());
|
|
|
sdVo.setCarrier(wbm.getCarrier());
|
|
|
sdVo.setTotalpiece(wbm.getTotalpiece());
|
|
|
sdVo.setTotalweight(wbm.getTotalweight());
|
|
|
sdVo.setFlightno(flightno);
|
|
|
sdVo.setFlightdate(flightdate);
|
|
|
sdVo.setCarrier(carrier);
|
|
|
sdVo.setTotalpiece(totalpiece);
|
|
|
sdVo.setTotalweight(totalweight);
|
|
|
sdVo.setTotalweight(totalweight);
|
|
|
sdVo.setDestinationstation(destinationstation);
|
|
|
|
|
|
new XmlBuildTask(securityDeclarationService.sendNDLRXml(sdVo), ndlrPath).perform();
|
|
|
|
...
|
...
|
@@ -388,6 +717,12 @@ public class SecurityDeclarationController { |
|
|
|
|
|
//安检申报数据
|
|
|
SecurityDeclarationEntity sd = securityDeclarationService.findOne(id);
|
|
|
if (sd.getSd_transport_certificate() == null){
|
|
|
sd.setSd_transport_certificate("无");
|
|
|
}
|
|
|
if(sd.getSd_transportation_prove() == null){
|
|
|
sd.setSd_transportation_prove("无");
|
|
|
}
|
|
|
model.addAttribute("sd", sd);
|
|
|
|
|
|
//航空公司运输证明
|
...
|
...
|
@@ -403,13 +738,12 @@ public class SecurityDeclarationController { |
|
|
//生成条形码
|
|
|
BarCodeUtil.generateFile(replace, s);
|
|
|
|
|
|
|
|
|
model.addAttribute("path", replace);
|
|
|
|
|
|
//查询预配
|
|
|
ManifestEntity wbm = manifestService.findWbm(sd.getSd_waybill());
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
String format = simpleDateFormat.format(wbm.getFlightdate());
|
|
|
String format = simpleDateFormat.format(new Date());
|
|
|
model.addAttribute("date", format);
|
|
|
//主单数据
|
|
|
model.addAttribute("wbm", wbm);
|
...
|
...
|
|