作者 shenhailong

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

@@ -2465,310 +2465,6 @@ public class ManifestController extends BasicController { @@ -2465,310 +2465,6 @@ public class ManifestController extends BasicController {
2465 return model; 2465 return model;
2466 } 2466 }
2467 2467
2468 - /**  
2469 - * excel 导入  
2470 - * @return  
2471 - */  
2472 -// @RequestMapping(value = "/excelView")  
2473 -// public String excelView(){  
2474 -// return "manifest/excel_upload";  
2475 -// }  
2476 -//  
2477 -// @RequestMapping(value = "/excelUpload")  
2478 -// @ResponseBody  
2479 -// public ResponseModel excelUpload(HttpServletRequest request,  
2480 -// HttpServletResponse response,  
2481 -// HttpSession session,  
2482 -// @RequestParam MultipartFile file) throws IOException {  
2483 -// ResponseModel model = new ResponseModel();  
2484 -//  
2485 -// //获取当前登录用户id  
2486 -// UserEntity user = (UserEntity) session.getAttribute("user");  
2487 -// Long userId = user.getId();  
2488 -//  
2489 -// List<ArrayList<String>> readResult = null;//总行记录  
2490 -// try {  
2491 -//  
2492 -// //判断文件是否为空  
2493 -// if (file.isEmpty()) {  
2494 -// model.setStatus(500);  
2495 -// model.setMsg("上传文件为空");  
2496 -// }  
2497 -// //判断文件大小  
2498 -// long size = file.getSize();  
2499 -// String name = file.getOriginalFilename();  
2500 -// if (StringUtils.isBlank(name) || size == 0) {  
2501 -// model.setStatus(500);  
2502 -// model.setMsg("上传文件为空");  
2503 -// }  
2504 -// String postfix = ExcelUtil.getPostfix(name);  
2505 -// //读取文件内容  
2506 -// if (StringUtils.equals("xlsx", postfix)) {  
2507 -// readResult = ExcelUtil.readXlsx(file);  
2508 -// } else if (StringUtils.equals("xls", postfix)) {  
2509 -// readResult = ExcelUtil.readXls(file);  
2510 -// } else {  
2511 -// model.setStatus(500);  
2512 -// model.setMsg("文件类型错误");  
2513 -// }  
2514 -//  
2515 -// if (readResult == null || readResult.size() == 0) {  
2516 -// model.setStatus(500);  
2517 -// model.setMsg("文件解析失败");  
2518 -// }  
2519 -//  
2520 -//  
2521 -// for (ArrayList<String> arr: readResult) {  
2522 -// String wbm = "";  
2523 -//  
2524 -// if (!StringUtils.isBlank(arr.get(1)) && arr.get(1).length()== 12) {  
2525 -//  
2526 -// if (arr.get(1).contains("-")) {  
2527 -// wbm = arr.get(1);  
2528 -// } else {  
2529 -// String s1 = arr.get(1);  
2530 -// String substring = s1.substring(0, 3);  
2531 -// String substring1 = s1.substring(3);  
2532 -// wbm = substring + "-" + substring1;  
2533 -// }  
2534 -// // 如果分单不为空  
2535 -// if (StringUtils.isBlank(arr.get(2))) {  
2536 -// // 查询主单号是否存在  
2537 -// ManifestEntity wbm1 = manifestService.findWbm(wbm);  
2538 -// if (wbm1 == null) {  
2539 -// ManifestEntity manifestEntity = new ManifestEntity();  
2540 -// manifestEntity.setUSER_ID(userId);  
2541 -// // 主单号  
2542 -// manifestEntity.setWaybillnomaster(wbm);  
2543 -// // 航班号  
2544 -// manifestEntity.setFlightno(arr.get(3).substring(2));  
2545 -// // 航班日期  
2546 -// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");  
2547 -// String s = arr.get(4);  
2548 -// Date parse = simpleDateFormat.parse(s);  
2549 -// manifestEntity.setFlightdate(parse);  
2550 -// // 承运人代码  
2551 -// manifestEntity.setCarrier(arr.get(3).substring(0, 2));  
2552 -// // 运费支付方式  
2553 -// manifestEntity.setPaymode(arr.get(5));  
2554 -// // 装货地代码  
2555 -// manifestEntity.setOriginatingstation(arr.get(6));  
2556 -// // 卸货地代码  
2557 -// manifestEntity.setDestinationstation(arr.get(7));  
2558 -// // 货物装载运输时间  
2559 -// manifestEntity.setStowagedate(new Date());  
2560 -// // 海关关区代码  
2561 -// manifestEntity.setCustomscode(arr.get(9));  
2562 -// // 货物件数  
2563 -// manifestEntity.setTotalpiece(arr.get(10));  
2564 -// // 货物毛重  
2565 -// manifestEntity.setTotalweight(arr.get(11));  
2566 -// // 货物简要描述  
2567 -// manifestEntity.setProductname(arr.get(12));  
2568 -// // 发货人代码  
2569 -// manifestEntity.setShpcusid(arr.get(13));  
2570 -// // 发货人公司  
2571 -// manifestEntity.setCo_company(arr.get(14));  
2572 -// // 发货人地址  
2573 -// manifestEntity.setCo_address(arr.get(15));  
2574 -// // 发货人国家代码  
2575 -// manifestEntity.setSh_country(arr.get(16));  
2576 -// // 发货人传真  
2577 -// manifestEntity.setSh_fax(arr.get(17));  
2578 -// // 发货人联系号码  
2579 -// manifestEntity.setCo_telephone(arr.get(18));  
2580 -// // 收货人代码  
2581 -// manifestEntity.setCnecusid(arr.get(19));  
2582 -// // 收货人公司  
2583 -// manifestEntity.setSh_company(arr.get(20));  
2584 -// // 收货人地址  
2585 -// manifestEntity.setSh_address(arr.get(21));  
2586 -// // 收货人城市  
2587 -// manifestEntity.setSh_city(arr.get(22));  
2588 -// // 收货人国家代码  
2589 -// manifestEntity.setSh_country(arr.get(23));  
2590 -// // 收货人传真  
2591 -// manifestEntity.setSh_fax(arr.get(24));  
2592 -// // 收货人联系号码  
2593 -// manifestEntity.setSh_telephone(arr.get(25));  
2594 -//  
2595 -// // 货物海关状态代码  
2596 -// manifestEntity.setCustomsstatus(arr.get(26));  
2597 -//  
2598 -// // 安检申报  
2599 -//  
2600 -// if (StringUtils.isNotBlank(arr.get(27)) && StringUtils.isNotBlank(arr.get(28)) && StringUtils.isNotBlank(arr.get(29))  
2601 -// && StringUtils.isNotBlank(arr.get(32)) && StringUtils.isNotBlank(arr.get(33))){  
2602 -// SecurityDeclarationEntity sd = new SecurityDeclarationEntity();  
2603 -// sd.setSd_waybill(wbm);  
2604 -// // 航空货物托运人名称  
2605 -// sd.setSd_cargo_shipper_name(arr.get(27));  
2606 -// // 航空货物销售代理人名称  
2607 -// sd.setSd_cargo_agent_name(arr.get(28));  
2608 -// // 航协资质编号  
2609 -// if (!StringUtils.isBlank(arr.get(29))) {  
2610 -// sd.setSd_iata_number(arr.get(29));  
2611 -// }  
2612 -//  
2613 -// sd.setSd_static("1");  
2614 -// // 发布时间  
2615 -// SimpleDateFormat simpleDateFormat2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");  
2616 -// String format = simpleDateFormat2.format(new Date());  
2617 -// sd.setOperation_time(format);  
2618 -//  
2619 -// // 运输条件鉴定书  
2620 -// if (!StringUtils.isBlank(arr.get(30))) {  
2621 -//  
2622 -// String certificate = arr.get(30);  
2623 -// if (certificate != null) {  
2624 -// String s2 = certificate.replaceAll(",", ",");  
2625 -// sd.setSd_transport_certificate(s2);  
2626 -// }  
2627 -// }  
2628 -//  
2629 -// // 航空公司同意运输证明  
2630 -// if (!StringUtils.isBlank(arr.get(31))) {  
2631 -//  
2632 -// String prove = arr.get(31);  
2633 -// if (prove != null) {  
2634 -// String s2 = prove.replaceAll(",", ",");  
2635 -// sd.setSd_transportation_prove(s2);  
2636 -// }  
2637 -// }  
2638 -//  
2639 -// // 用户ID  
2640 -// sd.setUSER_ID(userId);  
2641 -//  
2642 -// // 航空货物性质  
2643 -// SDCargoTypeEntity sdCargoTypeEntity = new SDCargoTypeEntity();  
2644 -// sdCargoTypeEntity.setSd_waybill(wbm);  
2645 -// sdCargoTypeEntity.setSd_cargo_type(arr.get(32));  
2646 -// sdCargoTypeService.save(sdCargoTypeEntity);  
2647 -//  
2648 -// // 航空货物品名  
2649 -// String replace = arr.get(33).replace(",", ",");  
2650 -//  
2651 -// String[] cargoName = replace.split(",");  
2652 -// for (int i = 0; i < cargoName.length; i++) {  
2653 -// SDCargoNameEntity sdCargoNameEntity = new SDCargoNameEntity();  
2654 -// sdCargoNameEntity.setSd_waybill(wbm);  
2655 -// sdCargoNameEntity.setSd_cargo_name(cargoName[i]);  
2656 -// sdCargoNameService.save(sdCargoNameEntity);  
2657 -// }  
2658 -// securityDeclarationService.save(sd);  
2659 -// }  
2660 -//  
2661 -//  
2662 -// manifestService.save(manifestEntity);  
2663 -//  
2664 -// model.setStatus(200);  
2665 -//  
2666 -// }else {  
2667 -// model.setStatus(201);  
2668 -// model.setMsg(wbm1.getWaybillnomaster() + "单号已存在");  
2669 -// break;  
2670 -// }  
2671 -// }else {  
2672 -//  
2673 -// ManifestEntity wbm1 = manifestService.findWbm(wbm);  
2674 -// if(wbm1 == null){  
2675 -//  
2676 -// model.setStatus(202);  
2677 -// model.setMsg("请先添加主单号");  
2678 -// break;  
2679 -// }else {  
2680 -// String waybill = preparesecondaryServer.findWaybill(arr.get(2));  
2681 -//  
2682 -// if (waybill != arr.get(2)) {  
2683 -//  
2684 -// PreparesecondaryEntity seconday = new PreparesecondaryEntity();  
2685 -// seconday.setPreparemasterid(wbm1.getId());  
2686 -// // 主单号  
2687 -// seconday.setWaybillnomaster(wbm);  
2688 -// // 分单号  
2689 -// seconday.setWaybillnosecondary(arr.get(2));  
2690 -// // 航班号  
2691 -// seconday.setFlightno(arr.get(3).substring(2));  
2692 -// // 航班日期  
2693 -// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");  
2694 -// String s = arr.get(4);  
2695 -// Date parse = simpleDateFormat.parse(s);  
2696 -// seconday.setFlightdate(parse);  
2697 -// // 承运人代码  
2698 -// seconday.setCarrier(arr.get(3).substring(0, 2));  
2699 -// // 运费支付方式  
2700 -// seconday.setPaymode(arr.get(5));  
2701 -// // 装货地代码  
2702 -// seconday.setOriginatingstation(arr.get(6));  
2703 -// // 卸货地代码  
2704 -// seconday.setDestinationstation(arr.get(7));  
2705 -// // 货物装载运输时间  
2706 -// SimpleDateFormat simpleDateFormat1 = new SimpleDateFormat("yyyyMMddHHmmss");  
2707 -// seconday.setStowagedate(simpleDateFormat1.parse(arr.get(8)));  
2708 -// // 海关关区代码  
2709 -// seconday.setCustomscode(arr.get(9));  
2710 -// // 货物件数  
2711 -//// String s3 = arr.get(11);  
2712 -// seconday.setTotalpiece(arr.get(10));  
2713 -// // 货物毛重  
2714 -//// String s1 = arr.get(12);  
2715 -// seconday.setTotalweight(arr.get(11));  
2716 -// // 货物简要描述  
2717 -// seconday.setProductname(arr.get(12));  
2718 -// // 发货人代码  
2719 -// seconday.setShpcusid(arr.get(13));  
2720 -// // 发货人公司  
2721 -// seconday.setCo_company(arr.get(14));  
2722 -// // 发货人地址  
2723 -// seconday.setCo_address(arr.get(15));  
2724 -// // 发货人国家代码  
2725 -// seconday.setSh_country(arr.get(16));  
2726 -// // 发货人传真  
2727 -// seconday.setSh_fax(arr.get(17));  
2728 -// // 发货人联系号码  
2729 -// seconday.setCo_telephone(arr.get(18));  
2730 -// // 收货人代码  
2731 -// seconday.setCnecusid(arr.get(19));  
2732 -// // 收货人公司  
2733 -// seconday.setSh_company(arr.get(20));  
2734 -// // 收货人地址  
2735 -// seconday.setSh_address(arr.get(21));  
2736 -// // 收货人城市  
2737 -// seconday.setSh_city(arr.get(22));  
2738 -// // 收货人国家代码  
2739 -// seconday.setSh_country(arr.get(23));  
2740 -// // 收货人传真  
2741 -// seconday.setSh_fax(arr.get(24));  
2742 -// // 收货人联系号码  
2743 -// seconday.setSh_telephone(arr.get(25));  
2744 -//  
2745 -// // 货物海关状态代码  
2746 -// seconday.setCustomsstatus(arr.get(26));  
2747 -// seconday.setCreateDate(new Date());  
2748 -// preparesecondaryServer.save(seconday);  
2749 -// model.setStatus(200);  
2750 -// } else {  
2751 -// model.setStatus(201);  
2752 -// model.setMsg(waybill + "分单号已存在");  
2753 -// break;  
2754 -// }  
2755 -// }  
2756 -// }  
2757 -// }else {  
2758 -//  
2759 -// model.setStatus(300);  
2760 -// model.setMsg("主单号格式有误");  
2761 -// break;  
2762 -// }  
2763 -// }  
2764 -// return model;  
2765 -// } catch (Exception e) {  
2766 -// model.setStatus(500);  
2767 -// model.setMsg("格式有误");  
2768 -// e.printStackTrace();  
2769 -// }  
2770 -// return model;  
2771 -// }  
2772 2468
2773 /** 2469 /**
2774 * excel 导入 2470 * excel 导入
@@ -2994,6 +2690,7 @@ public class ManifestController extends BasicController { @@ -2994,6 +2690,7 @@ public class ManifestController extends BasicController {
2994 seconday.setShpcusid(arr.get(13)); 2690 seconday.setShpcusid(arr.get(13));
2995 // 发货人公司 2691 // 发货人公司
2996 seconday.setCo_company(arr.get(14)); 2692 seconday.setCo_company(arr.get(14));
  2693 + seconday.setCo_name(arr.get(14));
2997 // 发货人地址 2694 // 发货人地址
2998 seconday.setCo_address(arr.get(15)); 2695 seconday.setCo_address(arr.get(15));
2999 // 发货人国家代码 2696 // 发货人国家代码