作者 shenhailong

分单批量删除 分单批量挂载 接收参数 完善

主分单实体添加 分单集合变量
1 package com.tianbo.analysis.controller; 1 package com.tianbo.analysis.controller;
2 2
  3 +import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
  4 +import com.tianbo.analysis.model.Originmanifestsecondary;
3 import com.tianbo.analysis.model.ResultJson; 5 import com.tianbo.analysis.model.ResultJson;
4 import com.tianbo.analysis.service.NmmsImportService; 6 import com.tianbo.analysis.service.NmmsImportService;
5 import com.tianbo.analysis.service.OriginService; 7 import com.tianbo.analysis.service.OriginService;
6 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.*; 9 import org.springframework.web.bind.annotation.*;
8 10
  11 +import java.util.List;
  12 +
  13 +import static sun.plugin2.os.windows.OSVERSIONINFOA.size;
  14 +
9 /** 15 /**
10 * @author shenhl 16 * @author shenhl
11 * <p> 17 * <p>
@@ -23,16 +29,18 @@ public class NmmsImportController { @@ -23,16 +29,18 @@ public class NmmsImportController {
23 NmmsImportService nmmsImportService; 29 NmmsImportService nmmsImportService;
24 30
25 /** 31 /**
  32 + * awbhIds[] 分单id
26 * 批量删除 33 * 批量删除
27 - * @param awbhIds 34 + * @param originmanifestsecondary
28 * @return 35 * @return
29 */ 36 */
30 @RequestMapping(value = "/imp_removes") 37 @RequestMapping(value = "/imp_removes")
31 @ResponseBody 38 @ResponseBody
32 - public ResultJson antivirus_log_remove(String[] awbhIds){ 39 + public ResultJson antivirus_log_remove(@RequestBody Originmanifestsecondary originmanifestsecondary){
33 int r = 0; 40 int r = 0;
34 - for (int i=0; i< awbhIds.length; i++){  
35 - r += originService.deleteAwbh(awbhIds[i]); 41 + List<String> awbhIds = originmanifestsecondary.getAwbhIds();
  42 + for (int i=0; i< awbhIds.size(); i++){
  43 + r += originService.deleteAwbh(awbhIds.get(i));
36 } 44 }
37 45
38 return r > 0 ? new ResultJson("200", "批量删除成功") 46 return r > 0 ? new ResultJson("200", "批量删除成功")
@@ -40,19 +48,17 @@ public class NmmsImportController { @@ -40,19 +48,17 @@ public class NmmsImportController {
40 } 48 }
41 49
42 /** 50 /**
43 - *  
44 - * @param awbhIds  
45 - * @param flightNo  
46 - * @param flightDate 51 + * awbhIds[] 分单id
  52 + * flightDate 航班日期
  53 + * flightno 航班号
  54 + * @param originmanifestmaster
47 * @return 55 * @return
48 */ 56 */
49 @RequestMapping(value = "/mountAwbh") 57 @RequestMapping(value = "/mountAwbh")
50 @ResponseBody 58 @ResponseBody
51 - public ResultJson antivirus_log_remove(@RequestParam(value ="awbhIds")String[] awbhIds,  
52 - @RequestParam(value ="flightNo") String flightNo,  
53 - @RequestParam(value ="flightDate") String flightDate){ 59 + public ResultJson antivirus_log_remove(@RequestBody ORIGINMANIFESTMASTER originmanifestmaster){
54 60
55 - return nmmsImportService.mountAwbh(awbhIds,flightNo,flightDate) > 0 ? new ResultJson("200", "分单挂载成功") 61 + return nmmsImportService.mountAwbh(originmanifestmaster) > 0 ? new ResultJson("200", "分单挂载成功")
56 : new ResultJson("201", "分单挂载失败"); 62 : new ResultJson("201", "分单挂载失败");
57 } 63 }
58 } 64 }
@@ -3,6 +3,7 @@ package com.tianbo.analysis.dao; @@ -3,6 +3,7 @@ package com.tianbo.analysis.dao;
3 import com.tianbo.analysis.model.ORIGINMANIFESTMASTER; 3 import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
4 import org.apache.ibatis.annotations.Param; 4 import org.apache.ibatis.annotations.Param;
5 5
  6 +import java.util.Date;
6 import java.util.HashMap; 7 import java.util.HashMap;
7 import java.util.List; 8 import java.util.List;
8 import java.util.Map; 9 import java.util.Map;
@@ -25,7 +26,7 @@ public interface ORIGINMANIFESTMASTERMapper { @@ -25,7 +26,7 @@ public interface ORIGINMANIFESTMASTERMapper {
25 26
26 ORIGINMANIFESTMASTER findAwba(@Param("waybillnomaster") String var1, 27 ORIGINMANIFESTMASTER findAwba(@Param("waybillnomaster") String var1,
27 @Param("flightNo")String var2, 28 @Param("flightNo")String var2,
28 - @Param("flightDate")String var3 29 + @Param("flightDate") Date var3
29 ); 30 );
30 31
31 List<ORIGINMANIFESTMASTER> searchSec(String autoid); 32 List<ORIGINMANIFESTMASTER> searchSec(String autoid);
@@ -92,8 +92,18 @@ public class ORIGINMANIFESTMASTER extends ManifestBase{ @@ -92,8 +92,18 @@ public class ORIGINMANIFESTMASTER extends ManifestBase{
92 92
93 private String consigneePhone; 93 private String consigneePhone;
94 94
  95 + public List<String> awbhIds;
  96 +
95 public List<ORIGINMANIFESTMASTER> chidren; 97 public List<ORIGINMANIFESTMASTER> chidren;
96 98
  99 + public List<String> getAwbhIds() {
  100 + return awbhIds;
  101 + }
  102 +
  103 + public void setAwbhIds(List<String> awbhIds) {
  104 + this.awbhIds = awbhIds;
  105 + }
  106 +
97 public String getAutoid() { 107 public String getAutoid() {
98 return autoid; 108 return autoid;
99 } 109 }
@@ -95,6 +95,16 @@ public class Originmanifestsecondary { @@ -95,6 +95,16 @@ public class Originmanifestsecondary {
95 //报文结束标识 95 //报文结束标识
96 private static String END_WORD= "="; 96 private static String END_WORD= "=";
97 97
  98 + private List<String> awbhIds;
  99 +
  100 + public List<String> getAwbhIds() {
  101 + return awbhIds;
  102 + }
  103 +
  104 + public void setAwbhIds(List<String> awbhIds) {
  105 + this.awbhIds = awbhIds;
  106 + }
  107 +
98 public String getAutoid() { 108 public String getAutoid() {
99 return autoid; 109 return autoid;
100 } 110 }
1 package com.tianbo.analysis.service; 1 package com.tianbo.analysis.service;
2 2
  3 +import com.tianbo.analysis.model.ORIGINMANIFESTMASTER;
3 import com.tianbo.analysis.model.ResultJson; 4 import com.tianbo.analysis.model.ResultJson;
4 5
  6 +import java.util.List;
  7 +
5 /** 8 /**
6 * @author shenhl 9 * @author shenhl
7 * <p> 10 * <p>
@@ -9,8 +12,6 @@ import com.tianbo.analysis.model.ResultJson; @@ -9,8 +12,6 @@ import com.tianbo.analysis.model.ResultJson;
9 */ 12 */
10 public interface NmmsImportService { 13 public interface NmmsImportService {
11 14
12 - int mountAwbh(String[] awbhIds,  
13 - String flightNo,  
14 - String flightDate); 15 + int mountAwbh(ORIGINMANIFESTMASTER originmanifestmaster);
15 16
16 } 17 }
@@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j; @@ -9,6 +9,8 @@ import lombok.extern.slf4j.Slf4j;
9 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
11 11
  12 +import java.util.List;
  13 +
12 /** 14 /**
13 * @author shenhl 15 * @author shenhl
14 * <p> 16 * <p>
@@ -25,24 +27,29 @@ public class NmmsImportServiceImpl implements NmmsImportService{ @@ -25,24 +27,29 @@ public class NmmsImportServiceImpl implements NmmsImportService{
25 ORIGINMANIFESTMASTERMapper originmanifestmasterMapper; 27 ORIGINMANIFESTMASTERMapper originmanifestmasterMapper;
26 28
27 @Override 29 @Override
28 - public int mountAwbh(String[] awbhIds, String flightNo, String flightDate) { 30 + public int mountAwbh(ORIGINMANIFESTMASTER master) {
29 31
30 int w = 0; 32 int w = 0;
31 try { 33 try {
32 String awba = ""; 34 String awba = "";
  35 + List<String> awbhIds = master.getAwbhIds();
33 // 查询该分单绑定的主单id 36 // 查询该分单绑定的主单id
34 - for (int i=0; i< awbhIds.length; i++){  
35 - Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(awbhIds[i]); 37 + for (int i=0; i< awbhIds.size(); i++){
  38 + Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(awbhIds.get(i));
36 log.info("查询的主单id:{}", originmanifestsecondary); 39 log.info("查询的主单id:{}", originmanifestsecondary);
  40 + if (originmanifestsecondary != null){
37 awba = originmanifestsecondary.getWaybillnomaster(); 41 awba = originmanifestsecondary.getWaybillnomaster();
38 // 查询需要挂载的主单id 42 // 查询需要挂载的主单id
39 - ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, flightNo, flightDate); 43 + ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, master.getFlightno(), master.getFlightDate());
  44 + // 修改分单表 所绑定的主单id
  45 + if (originmanifestmaster!=null){
40 log.info("挂载主单的id:{}", originmanifestmaster); 46 log.info("挂载主单的id:{}", originmanifestmaster);
41 log.info("修改分单数据参数:{}", awbhIds, originmanifestmaster.getAutoid()); 47 log.info("修改分单数据参数:{}", awbhIds, originmanifestmaster.getAutoid());
42 - // 修改分单表 所绑定的主单id  
43 - w = originmanifestsecondaryMapper.updateMasterAutoId(awbhIds[i], originmanifestmaster.getAutoid()); 48 + w = originmanifestsecondaryMapper.updateMasterAutoId(awbhIds.get(i), originmanifestmaster.getAutoid());
44 log.info("修改后的状态:{}", w); 49 log.info("修改后的状态:{}", w);
45 } 50 }
  51 + }
  52 + }
46 return w; 53 return w;
47 }catch (Exception e){ 54 }catch (Exception e){
48 e.printStackTrace(); 55 e.printStackTrace();