...
|
...
|
@@ -30,6 +30,7 @@ import org.apache.commons.lang.StringUtils; |
|
|
import org.apache.shiro.SecurityUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.ui.Model;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
...
|
...
|
@@ -43,6 +44,7 @@ import tools.Tools; |
|
|
import tools.oclass.FemyList;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.jnlp.PersistenceService;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.servlet.http.HttpSession;
|
...
|
...
|
@@ -51,6 +53,7 @@ import java.sql.Connection; |
|
|
import java.sql.ResultSet;
|
|
|
import java.sql.SQLException;
|
|
|
import java.sql.Statement;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
...
|
...
|
@@ -118,7 +121,7 @@ public class ManifestController extends BasicController { |
|
|
@Resource
|
|
|
private SDCargoNameService sdCargoNameService;
|
|
|
|
|
|
@Resource
|
|
|
@Resource
|
|
|
private SDCargoTypeService sdCargoTypeService;
|
|
|
|
|
|
private BasicAgentEntity getAgent() {
|
...
|
...
|
@@ -2224,7 +2227,10 @@ public class ManifestController extends BasicController { |
|
|
return model;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
* excel 导入
|
|
|
* @return
|
|
|
*/
|
|
|
@RequestMapping(value = "/excelView")
|
|
|
public String excelView(){
|
|
|
return "manifest/excel_upload";
|
...
|
...
|
@@ -2275,156 +2281,234 @@ public class ManifestController extends BasicController { |
|
|
|
|
|
for (ArrayList<String> arr: readResult) {
|
|
|
String wbm = "";
|
|
|
if (!StringUtils.isBlank(arr.get(1))){
|
|
|
if(arr.get(1).contains("-")){
|
|
|
|
|
|
wbm = arr.get(1);
|
|
|
}else {
|
|
|
String s1 = arr.get(1);
|
|
|
String substring = s1.substring(0, 3);
|
|
|
String substring1 = s1.substring(3);
|
|
|
wbm = substring+"-"+substring1;
|
|
|
}
|
|
|
|
|
|
|
|
|
//查询主单号时候存在
|
|
|
ManifestEntity wbm1 = manifestService.findWbm(wbm);
|
|
|
if (wbm1==null){
|
|
|
ManifestEntity manifestEntity = new ManifestEntity();
|
|
|
manifestEntity.setUSER_ID(userId);
|
|
|
//主单号
|
|
|
manifestEntity.setWaybillnomaster(wbm);
|
|
|
//分单号
|
|
|
|
|
|
//航班号
|
|
|
manifestEntity.setFlightno(arr.get(3));
|
|
|
//航班日期
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
String s = arr.get(4);
|
|
|
Date parse = simpleDateFormat.parse(s);
|
|
|
manifestEntity.setFlightdate(parse);
|
|
|
//承运人代码
|
|
|
manifestEntity.setCarrier(arr.get(5));
|
|
|
//运费支付方式
|
|
|
manifestEntity.setPaymode(arr.get(6));
|
|
|
//装货地代码
|
|
|
manifestEntity.setOriginatingstation(arr.get(7));
|
|
|
//卸货地代码
|
|
|
manifestEntity.setDestinationstation(arr.get(8));
|
|
|
//货物装载运输时间
|
|
|
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
manifestEntity.setStowagedate(simpleDateFormat1.parse(arr.get(9)));
|
|
|
//海关关区代码
|
|
|
manifestEntity.setCustomscode(arr.get(10));
|
|
|
|
|
|
//中转启运地代码
|
|
|
|
|
|
//中转目的地代码
|
|
|
|
|
|
//货物件数
|
|
|
manifestEntity.setTotalpiece(arr.get(13));
|
|
|
//货物毛重
|
|
|
manifestEntity.setTotalweight(arr.get(14));
|
|
|
//货物简要描述
|
|
|
manifestEntity.setProductname(arr.get(15));
|
|
|
//发货人代码
|
|
|
manifestEntity.setShpcusid(arr.get(16));
|
|
|
//发货人名称
|
|
|
manifestEntity.setCo_name(arr.get(17));
|
|
|
//发货人地址
|
|
|
manifestEntity.setCo_address(arr.get(18));
|
|
|
//发货人国家代码
|
|
|
manifestEntity.setSh_country(arr.get(19));
|
|
|
//发货人传真
|
|
|
manifestEntity.setSh_fax(arr.get(20));
|
|
|
//发货人联系号码
|
|
|
manifestEntity.setCo_telephone(arr.get(21));
|
|
|
//收货人代码
|
|
|
manifestEntity.setCnecusid(arr.get(22));
|
|
|
//收货人名称
|
|
|
manifestEntity.setSh_name(arr.get(23));
|
|
|
//收货人地址
|
|
|
manifestEntity.setSh_address(arr.get(24));
|
|
|
//收货人城市
|
|
|
manifestEntity.setSh_city(arr.get(25));
|
|
|
//收货人国家代码
|
|
|
manifestEntity.setSh_country(arr.get(26));
|
|
|
//收货人传真
|
|
|
manifestEntity.setSh_fax(arr.get(27));
|
|
|
//收货人联系号码
|
|
|
manifestEntity.setSh_telephone(arr.get(28));
|
|
|
//危险品编号
|
|
|
|
|
|
//危险品联系人姓名
|
|
|
|
|
|
//危险品通讯方式类别代码
|
|
|
|
|
|
//危险品联系人联系号码
|
|
|
|
|
|
//货物海关状态代码
|
|
|
manifestEntity.setCustomsstatus(arr.get(33));
|
|
|
|
|
|
// 安检申报
|
|
|
SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
|
|
|
sd.setSd_waybill(wbm);
|
|
|
// 航空货物托运人名称
|
|
|
sd.setSd_cargo_shipper_name(arr.get(34));
|
|
|
// 航空货物销售代理人名称
|
|
|
sd.setSd_cargo_agent_name(arr.get(35));
|
|
|
// 航协资质编号
|
|
|
if (!StringUtils.isBlank(arr.get(36))){
|
|
|
sd.setSd_iata_number(arr.get(36));
|
|
|
}
|
|
|
|
|
|
sd.setSd_static("1");
|
|
|
// 发布时间
|
|
|
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format = simpleDateFormat2.format(new Date());
|
|
|
sd.setOperation_time(format);
|
|
|
// 运输条件鉴定书
|
|
|
if (!StringUtils.isBlank(arr.get(37))){
|
|
|
|
|
|
String certificate = arr.get(37);
|
|
|
if (certificate != null){
|
|
|
String s2 = certificate.replaceAll(",", ",");
|
|
|
sd.setSd_transportation_prove(s2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 航空公司同意运输证明
|
|
|
if (!StringUtils.isBlank(arr.get(38))){
|
|
|
if (!StringUtils.isBlank(arr.get(1))) {
|
|
|
|
|
|
if (arr.get(1).contains("-")) {
|
|
|
wbm = arr.get(1);
|
|
|
} else {
|
|
|
String s1 = arr.get(1);
|
|
|
String substring = s1.substring(0, 3);
|
|
|
String substring1 = s1.substring(3);
|
|
|
wbm = substring + "-" + substring1;
|
|
|
}
|
|
|
//如果分单不给
|
|
|
if (StringUtils.isBlank(arr.get(2))) {
|
|
|
// 查询主单号是否存在
|
|
|
ManifestEntity wbm1 = manifestService.findWbm(wbm);
|
|
|
if (wbm1 == null) {
|
|
|
ManifestEntity manifestEntity = new ManifestEntity();
|
|
|
manifestEntity.setUSER_ID(userId);
|
|
|
// 主单号
|
|
|
manifestEntity.setWaybillnomaster(wbm);
|
|
|
// 航班号
|
|
|
manifestEntity.setFlightno(arr.get(3));
|
|
|
// 航班日期
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
String s = arr.get(4);
|
|
|
Date parse = simpleDateFormat.parse(s);
|
|
|
manifestEntity.setFlightdate(parse);
|
|
|
// 承运人代码
|
|
|
manifestEntity.setCarrier(arr.get(5));
|
|
|
// 运费支付方式
|
|
|
manifestEntity.setPaymode(arr.get(6));
|
|
|
// 装货地代码
|
|
|
manifestEntity.setOriginatingstation(arr.get(7));
|
|
|
// 卸货地代码
|
|
|
manifestEntity.setDestinationstation(arr.get(8));
|
|
|
// 货物装载运输时间
|
|
|
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
manifestEntity.setStowagedate(simpleDateFormat1.parse(arr.get(9)));
|
|
|
// 海关关区代码
|
|
|
manifestEntity.setCustomscode(arr.get(10));
|
|
|
// 货物件数
|
|
|
// String s3 = arr.get(11);
|
|
|
manifestEntity.setTotalpiece(arr.get(11));
|
|
|
// 货物毛重
|
|
|
// String s1 = arr.get(12);
|
|
|
manifestEntity.setTotalweight(arr.get(12));
|
|
|
// 货物简要描述
|
|
|
manifestEntity.setProductname(arr.get(13));
|
|
|
// 发货人代码
|
|
|
manifestEntity.setShpcusid(arr.get(14));
|
|
|
// 发货人名称
|
|
|
manifestEntity.setCo_name(arr.get(15));
|
|
|
// 发货人地址
|
|
|
manifestEntity.setCo_address(arr.get(16));
|
|
|
// 发货人国家代码
|
|
|
manifestEntity.setSh_country(arr.get(17));
|
|
|
// 发货人传真
|
|
|
manifestEntity.setSh_fax(arr.get(18));
|
|
|
// 发货人联系号码
|
|
|
manifestEntity.setCo_telephone(arr.get(19));
|
|
|
// 收货人代码
|
|
|
manifestEntity.setCnecusid(arr.get(20));
|
|
|
// 收货人名称
|
|
|
manifestEntity.setSh_name(arr.get(21));
|
|
|
// 收货人地址
|
|
|
manifestEntity.setSh_address(arr.get(22));
|
|
|
// 收货人城市
|
|
|
manifestEntity.setSh_city(arr.get(23));
|
|
|
// 收货人国家代码
|
|
|
manifestEntity.setSh_country(arr.get(24));
|
|
|
// 收货人传真
|
|
|
manifestEntity.setSh_fax(arr.get(25));
|
|
|
// 收货人联系号码
|
|
|
manifestEntity.setSh_telephone(arr.get(26));
|
|
|
|
|
|
// 货物海关状态代码
|
|
|
manifestEntity.setCustomsstatus(arr.get(27));
|
|
|
|
|
|
// 安检申报
|
|
|
SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
|
|
|
sd.setSd_waybill(wbm);
|
|
|
// 航空货物托运人名称
|
|
|
sd.setSd_cargo_shipper_name(arr.get(28));
|
|
|
// 航空货物销售代理人名称
|
|
|
sd.setSd_cargo_agent_name(arr.get(29));
|
|
|
// 航协资质编号
|
|
|
if (!StringUtils.isBlank(arr.get(30))) {
|
|
|
sd.setSd_iata_number(arr.get(30));
|
|
|
}
|
|
|
|
|
|
sd.setSd_static("1");
|
|
|
// 发布时间
|
|
|
SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
String format = simpleDateFormat2.format(new Date());
|
|
|
sd.setOperation_time(format);
|
|
|
// 运输条件鉴定书
|
|
|
if (!StringUtils.isBlank(arr.get(31))) {
|
|
|
|
|
|
String certificate = arr.get(31);
|
|
|
if (certificate != null) {
|
|
|
String s2 = certificate.replaceAll(",", ",");
|
|
|
sd.setSd_transportation_prove(s2);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 航空公司同意运输证明
|
|
|
if (!StringUtils.isBlank(arr.get(32))) {
|
|
|
|
|
|
String prove = arr.get(32);
|
|
|
if (prove != null) {
|
|
|
String s2 = prove.replaceAll(",", ",");
|
|
|
sd.setSd_transportation_prove(s2);
|
|
|
}
|
|
|
}
|
|
|
// 用户ID
|
|
|
sd.setUSER_ID(userId);
|
|
|
|
|
|
// 航空货物性质
|
|
|
SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
|
|
|
sdCargoTypeEntity.setSd_waybill(wbm);
|
|
|
sdCargoTypeEntity.setSd_cargo_type(arr.get(33));
|
|
|
sdCargoTypeService.save(sdCargoTypeEntity);
|
|
|
|
|
|
// 航空货物品名
|
|
|
String replace = arr.get(34).replace(",", ",");
|
|
|
|
|
|
String[] cargoName = replace.split(",");
|
|
|
for (int i = 0; i < cargoName.length; i++) {
|
|
|
SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
|
|
|
sdCargoNameEntity.setSd_waybill(wbm);
|
|
|
sdCargoNameEntity.setSd_cargo_name(cargoName[i]);
|
|
|
sdCargoNameService.save(sdCargoNameEntity);
|
|
|
}
|
|
|
securityDeclarationService.save(sd);
|
|
|
|
|
|
manifestService.save(manifestEntity);
|
|
|
|
|
|
model.setStatus(200);
|
|
|
return model;
|
|
|
|
|
|
}else {
|
|
|
model.setStatus(201);
|
|
|
model.setMsg(wbm1.getWaybillnomaster() + "单号已存在");
|
|
|
break;
|
|
|
}
|
|
|
}else {
|
|
|
|
|
|
String prove = arr.get(38);
|
|
|
if (prove != null){
|
|
|
String s2 = prove.replaceAll(",", ",");
|
|
|
sd.setSd_transportation_prove(s2);
|
|
|
ManifestEntity wbm1 = manifestService.findWbm(wbm);
|
|
|
if(wbm1 == null){
|
|
|
|
|
|
model.setStatus(202);
|
|
|
model.setMsg("请先添加主单号");
|
|
|
break;
|
|
|
}else {
|
|
|
String waybill = preparesecondaryServer.findWaybill(arr.get(2));
|
|
|
|
|
|
if (waybill != arr.get(2)) {
|
|
|
|
|
|
PreparesecondaryEntity seconday = new PreparesecondaryEntity();
|
|
|
seconday.setPreparemasterid(wbm1.getId());
|
|
|
// 主单
|
|
|
seconday.setWaybillnomaster(wbm);
|
|
|
// 分单
|
|
|
seconday.setWaybillnosecondary(arr.get(2));
|
|
|
// 航班号
|
|
|
seconday.setFlightno(arr.get(3));
|
|
|
// 航班日期
|
|
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
String s = arr.get(4);
|
|
|
Date parse = simpleDateFormat.parse(s);
|
|
|
seconday.setFlightdate(parse);
|
|
|
// 承运人代码
|
|
|
seconday.setCarrier(arr.get(5));
|
|
|
// 运费支付方式
|
|
|
seconday.setPaymode(arr.get(6));
|
|
|
// 装货地代码
|
|
|
seconday.setOriginatingstation(arr.get(7));
|
|
|
// 卸货地代码
|
|
|
seconday.setDestinationstation(arr.get(8));
|
|
|
// 货物装载运输时间
|
|
|
SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
seconday.setStowagedate(simpleDateFormat1.parse(arr.get(9)));
|
|
|
// 海关关区代码
|
|
|
seconday.setCustomscode(arr.get(10));
|
|
|
// 货物件数
|
|
|
seconday.setTotalpiece(arr.get(11));
|
|
|
// 货物毛重
|
|
|
seconday.setTotalweight(arr.get(12));
|
|
|
// 货物简要描述
|
|
|
seconday.setProductname(arr.get(13));
|
|
|
// 发货人代码
|
|
|
seconday.setShpcusid(arr.get(14));
|
|
|
// 发货人名称
|
|
|
seconday.setCo_name(arr.get(15));
|
|
|
// 发货人地址
|
|
|
seconday.setCo_address(arr.get(16));
|
|
|
// 发货人国家代码
|
|
|
seconday.setSh_country(arr.get(17));
|
|
|
// 发货人传真
|
|
|
seconday.setSh_fax(arr.get(18));
|
|
|
// 发货人联系号码
|
|
|
seconday.setCo_telephone(arr.get(19));
|
|
|
// 收货人代码
|
|
|
seconday.setCnecusid(arr.get(20));
|
|
|
// 收货人名称
|
|
|
seconday.setSh_name(arr.get(21));
|
|
|
// 收货人地址
|
|
|
seconday.setSh_address(arr.get(22));
|
|
|
// 收货人城市
|
|
|
seconday.setSh_city(arr.get(23));
|
|
|
// 收货人国家代码
|
|
|
seconday.setSh_country(arr.get(24));
|
|
|
// 收货人传真
|
|
|
seconday.setSh_fax(arr.get(25));
|
|
|
// 收货人联系号码
|
|
|
seconday.setSh_telephone(arr.get(26));
|
|
|
|
|
|
// 货物海关状态代码
|
|
|
seconday.setCustomsstatus(arr.get(27));
|
|
|
seconday.setCreateDate(new Date());
|
|
|
preparesecondaryServer.save(seconday);
|
|
|
model.setStatus(200);
|
|
|
return model;
|
|
|
} else {
|
|
|
model.setStatus(201);
|
|
|
model.setMsg(waybill + "分单号已存在");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
// 用户ID
|
|
|
sd.setUSER_ID(userId);
|
|
|
|
|
|
// 航空货物性质
|
|
|
SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();
|
|
|
sdCargoTypeEntity.setSd_waybill(wbm);
|
|
|
sdCargoTypeEntity.setSd_cargo_type(arr.get(39));
|
|
|
sdCargoTypeService.save(sdCargoTypeEntity);
|
|
|
|
|
|
// 航空货物品名
|
|
|
String[] cargoName = arr.get(40).replace(",",",").split(",");
|
|
|
for (int i = 0; i < cargoName.length; i++){
|
|
|
SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();
|
|
|
sdCargoNameEntity.setSd_waybill(wbm);
|
|
|
sdCargoNameEntity.setSd_cargo_name(cargoName[i]);
|
|
|
sdCargoNameService.save(sdCargoNameEntity);
|
|
|
}
|
|
|
securityDeclarationService.save(sd);
|
|
|
|
|
|
manifestService.save(manifestEntity);
|
|
|
model.setStatus(200);
|
|
|
}else {
|
|
|
model.setStatus(201);
|
|
|
model.setMsg(wbm1.getWaybillnomaster()+"单号已存在");
|
|
|
break;
|
|
|
}
|
|
|
}else {
|
|
|
break;
|
...
|
...
|
@@ -2439,4 +2523,5 @@ public class ManifestController extends BasicController { |
|
|
return model;
|
|
|
}
|
|
|
|
|
|
|
|
|
} |
...
|
...
|
|