作者 shenhailong

解决 excel 导入代理人显示发货人名称 新仓不显示问题

... ... @@ -2465,310 +2465,6 @@ public class ManifestController extends BasicController {
return model;
}
/**
* excel 导入
* @return
*/
// @RequestMapping(value = "/excelView")
// public String excelView(){
// return "manifest/excel_upload";
// }
//
// @RequestMapping(value = "/excelUpload")
// @ResponseBody
// public ResponseModel excelUpload(HttpServletRequest request,
// HttpServletResponse response,
// HttpSession session,
// @RequestParam MultipartFile file) throws IOException {
// ResponseModel model = new ResponseModel();
//
// //获取当前登录用户id
// UserEntity user = (UserEntity) session.getAttribute("user");
// Long userId = user.getId();
//
// List<ArrayList<String>> readResult = null;//总行记录
// try {
//
// //判断文件是否为空
// if (file.isEmpty()) {
// model.setStatus(500);
// model.setMsg("上传文件为空");
// }
// //判断文件大小
// long size = file.getSize();
// String name = file.getOriginalFilename();
// if (StringUtils.isBlank(name) || size == 0) {
// model.setStatus(500);
// model.setMsg("上传文件为空");
// }
// String postfix = ExcelUtil.getPostfix(name);
// //读取文件内容
// if (StringUtils.equals("xlsx", postfix)) {
// readResult = ExcelUtil.readXlsx(file);
// } else if (StringUtils.equals("xls", postfix)) {
// readResult = ExcelUtil.readXls(file);
// } else {
// model.setStatus(500);
// model.setMsg("文件类型错误");
// }
//
// if (readResult == null || readResult.size() == 0) {
// model.setStatus(500);
// model.setMsg("文件解析失败");
// }
//
//
// for (ArrayList<String> arr: readResult) {
// String wbm = "";
//
// if (!StringUtils.isBlank(arr.get(1)) && arr.get(1).length()== 12) {
//
// 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).substring(2));
// // 航班日期
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String s = arr.get(4);
// Date parse = simpleDateFormat.parse(s);
// manifestEntity.setFlightdate(parse);
// // 承运人代码
// manifestEntity.setCarrier(arr.get(3).substring(0, 2));
// // 运费支付方式
// manifestEntity.setPaymode(arr.get(5));
// // 装货地代码
// manifestEntity.setOriginatingstation(arr.get(6));
// // 卸货地代码
// manifestEntity.setDestinationstation(arr.get(7));
// // 货物装载运输时间
// manifestEntity.setStowagedate(new Date());
// // 海关关区代码
// manifestEntity.setCustomscode(arr.get(9));
// // 货物件数
// manifestEntity.setTotalpiece(arr.get(10));
// // 货物毛重
// manifestEntity.setTotalweight(arr.get(11));
// // 货物简要描述
// manifestEntity.setProductname(arr.get(12));
// // 发货人代码
// manifestEntity.setShpcusid(arr.get(13));
// // 发货人公司
// manifestEntity.setCo_company(arr.get(14));
// // 发货人地址
// manifestEntity.setCo_address(arr.get(15));
// // 发货人国家代码
// manifestEntity.setSh_country(arr.get(16));
// // 发货人传真
// manifestEntity.setSh_fax(arr.get(17));
// // 发货人联系号码
// manifestEntity.setCo_telephone(arr.get(18));
// // 收货人代码
// manifestEntity.setCnecusid(arr.get(19));
// // 收货人公司
// manifestEntity.setSh_company(arr.get(20));
// // 收货人地址
// manifestEntity.setSh_address(arr.get(21));
// // 收货人城市
// manifestEntity.setSh_city(arr.get(22));
// // 收货人国家代码
// manifestEntity.setSh_country(arr.get(23));
// // 收货人传真
// manifestEntity.setSh_fax(arr.get(24));
// // 收货人联系号码
// manifestEntity.setSh_telephone(arr.get(25));
//
// // 货物海关状态代码
// manifestEntity.setCustomsstatus(arr.get(26));
//
// // 安检申报
//
// if (StringUtils.isNotBlank(arr.get(27)) && StringUtils.isNotBlank(arr.get(28)) && StringUtils.isNotBlank(arr.get(29))
// && StringUtils.isNotBlank(arr.get(32)) && StringUtils.isNotBlank(arr.get(33))){
// SecurityDeclarationEntity sd = new SecurityDeclarationEntity();
// sd.setSd_waybill(wbm);
// // 航空货物托运人名称
// sd.setSd_cargo_shipper_name(arr.get(27));
// // 航空货物销售代理人名称
// sd.setSd_cargo_agent_name(arr.get(28));
// // 航协资质编号
// if (!StringUtils.isBlank(arr.get(29))) {
// sd.setSd_iata_number(arr.get(29));
// }
//
// 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(30))) {
//
// String certificate = arr.get(30);
// if (certificate != null) {
// String s2 = certificate.replaceAll(",", ",");
// sd.setSd_transport_certificate(s2);
// }
// }
//
// // 航空公司同意运输证明
// if (!StringUtils.isBlank(arr.get(31))) {
//
// String prove = arr.get(31);
// 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(32));
// sdCargoTypeService.save(sdCargoTypeEntity);
//
// // 航空货物品名
// String replace = arr.get(33).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);
//
// }else {
// model.setStatus(201);
// model.setMsg(wbm1.getWaybillnomaster() + "单号已存在");
// break;
// }
// }else {
//
// 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).substring(2));
// // 航班日期
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
// String s = arr.get(4);
// Date parse = simpleDateFormat.parse(s);
// seconday.setFlightdate(parse);
// // 承运人代码
// seconday.setCarrier(arr.get(3).substring(0, 2));
// // 运费支付方式
// seconday.setPaymode(arr.get(5));
// // 装货地代码
// seconday.setOriginatingstation(arr.get(6));
// // 卸货地代码
// seconday.setDestinationstation(arr.get(7));
// // 货物装载运输时间
// SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");
// seconday.setStowagedate(simpleDateFormat1.parse(arr.get(8)));
// // 海关关区代码
// seconday.setCustomscode(arr.get(9));
// // 货物件数
//// String s3 = arr.get(11);
// seconday.setTotalpiece(arr.get(10));
// // 货物毛重
//// String s1 = arr.get(12);
// seconday.setTotalweight(arr.get(11));
// // 货物简要描述
// seconday.setProductname(arr.get(12));
// // 发货人代码
// seconday.setShpcusid(arr.get(13));
// // 发货人公司
// seconday.setCo_company(arr.get(14));
// // 发货人地址
// seconday.setCo_address(arr.get(15));
// // 发货人国家代码
// seconday.setSh_country(arr.get(16));
// // 发货人传真
// seconday.setSh_fax(arr.get(17));
// // 发货人联系号码
// seconday.setCo_telephone(arr.get(18));
// // 收货人代码
// seconday.setCnecusid(arr.get(19));
// // 收货人公司
// seconday.setSh_company(arr.get(20));
// // 收货人地址
// seconday.setSh_address(arr.get(21));
// // 收货人城市
// seconday.setSh_city(arr.get(22));
// // 收货人国家代码
// seconday.setSh_country(arr.get(23));
// // 收货人传真
// seconday.setSh_fax(arr.get(24));
// // 收货人联系号码
// seconday.setSh_telephone(arr.get(25));
//
// // 货物海关状态代码
// seconday.setCustomsstatus(arr.get(26));
// seconday.setCreateDate(new Date());
// preparesecondaryServer.save(seconday);
// model.setStatus(200);
// } else {
// model.setStatus(201);
// model.setMsg(waybill + "分单号已存在");
// break;
// }
// }
// }
// }else {
//
// model.setStatus(300);
// model.setMsg("主单号格式有误");
// break;
// }
// }
// return model;
// } catch (Exception e) {
// model.setStatus(500);
// model.setMsg("格式有误");
// e.printStackTrace();
// }
// return model;
// }
/**
* excel 导入
... ... @@ -2994,6 +2690,7 @@ public class ManifestController extends BasicController {
seconday.setShpcusid(arr.get(13));
// 发货人公司
seconday.setCo_company(arr.get(14));
seconday.setCo_name(arr.get(14));
// 发货人地址
seconday.setCo_address(arr.get(15));
// 发货人国家代码
... ...