作者 shenhailong

修改数据类型

@@ -5,6 +5,7 @@ import com.tianbo.analysis.model.Originmanifestsecondary; @@ -5,6 +5,7 @@ import com.tianbo.analysis.model.Originmanifestsecondary;
5 import com.tianbo.analysis.model.ResultJson; 5 import com.tianbo.analysis.model.ResultJson;
6 import com.tianbo.analysis.service.NmmsImportService; 6 import com.tianbo.analysis.service.NmmsImportService;
7 import com.tianbo.analysis.service.OriginService; 7 import com.tianbo.analysis.service.OriginService;
  8 +import io.swagger.annotations.ApiOperation;
8 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.web.bind.annotation.*; 10 import org.springframework.web.bind.annotation.*;
10 11
@@ -32,15 +33,21 @@ public class NmmsImportController { @@ -32,15 +33,21 @@ public class NmmsImportController {
32 * @param originmanifestsecondary 33 * @param originmanifestsecondary
33 * @return 34 * @return
34 */ 35 */
35 - @RequestMapping(value = "/imp_removes") 36 + @ApiOperation(value = "批量删除")
  37 + @PostMapping(value = "/imp_removes")
36 @ResponseBody 38 @ResponseBody
37 public ResultJson antivirus_log_remove(@RequestBody Originmanifestsecondary originmanifestsecondary){ 39 public ResultJson antivirus_log_remove(@RequestBody Originmanifestsecondary originmanifestsecondary){
38 int r = 0; 40 int r = 0;
39 - List<String> awbhIds = originmanifestsecondary.getAwbhIds();  
40 - for (int i=0; i< awbhIds.size(); i++){  
41 - r += originService.deleteAwbh(awbhIds.get(i)); 41 + if(originmanifestsecondary != null){
  42 + if (originmanifestsecondary.getAwbhIds().contains(",")){
  43 + String[] split = originmanifestsecondary.getAwbhIds().split(",");
  44 + for (int i=0; i< split.length; i++){
  45 + r += originService.deleteAwbh(split[i]);
  46 + }
  47 + }
42 } 48 }
43 49
  50 +
44 return r > 0 ? new ResultJson("200", "批量删除成功") 51 return r > 0 ? new ResultJson("200", "批量删除成功")
45 : new ResultJson("201", "批量删除失败"); 52 : new ResultJson("201", "批量删除失败");
46 } 53 }
@@ -52,7 +59,8 @@ public class NmmsImportController { @@ -52,7 +59,8 @@ public class NmmsImportController {
52 * @param originmanifestmaster 59 * @param originmanifestmaster
53 * @return 60 * @return
54 */ 61 */
55 - @RequestMapping(value = "/mountAwbh") 62 + @ApiOperation(value = "分单批量挂载")
  63 + @PostMapping(value = "/mountAwbh")
56 @ResponseBody 64 @ResponseBody
57 public ResultJson antivirus_log_remove(@RequestBody ORIGINMANIFESTMASTER originmanifestmaster){ 65 public ResultJson antivirus_log_remove(@RequestBody ORIGINMANIFESTMASTER originmanifestmaster){
58 66
@@ -92,15 +92,15 @@ public class ORIGINMANIFESTMASTER extends ManifestBase{ @@ -92,15 +92,15 @@ public class ORIGINMANIFESTMASTER extends ManifestBase{
92 92
93 private String consigneePhone; 93 private String consigneePhone;
94 94
95 - public List<String> awbhIds; 95 + public String awbhIds;
96 96
97 public List<ORIGINMANIFESTMASTER> chidren; 97 public List<ORIGINMANIFESTMASTER> chidren;
98 98
99 - public List<String> getAwbhIds() { 99 + public String getAwbhIds() {
100 return awbhIds; 100 return awbhIds;
101 } 101 }
102 102
103 - public void setAwbhIds(List<String> awbhIds) { 103 + public void setAwbhIds(String awbhIds) {
104 this.awbhIds = awbhIds; 104 this.awbhIds = awbhIds;
105 } 105 }
106 106
@@ -95,13 +95,13 @@ public class Originmanifestsecondary { @@ -95,13 +95,13 @@ public class Originmanifestsecondary {
95 //报文结束标识 95 //报文结束标识
96 private static String END_WORD= "="; 96 private static String END_WORD= "=";
97 97
98 - private List<String> awbhIds; 98 + private String awbhIds;
99 99
100 - public List<String> getAwbhIds() { 100 + public String getAwbhIds() {
101 return awbhIds; 101 return awbhIds;
102 } 102 }
103 103
104 - public void setAwbhIds(List<String> awbhIds) { 104 + public void setAwbhIds(String awbhIds) {
105 this.awbhIds = awbhIds; 105 this.awbhIds = awbhIds;
106 } 106 }
107 107
@@ -32,21 +32,25 @@ public class NmmsImportServiceImpl implements NmmsImportService{ @@ -32,21 +32,25 @@ public class NmmsImportServiceImpl implements NmmsImportService{
32 int w = 0; 32 int w = 0;
33 try { 33 try {
34 String awba = ""; 34 String awba = "";
35 - List<String> awbhIds = master.getAwbhIds();  
36 - // 查询该分单绑定的主单id  
37 - for (int i=0; i< awbhIds.size(); i++){  
38 - Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(awbhIds.get(i));  
39 - log.info("查询的主单id:{}", originmanifestsecondary);  
40 - if (originmanifestsecondary != null){  
41 - awba = originmanifestsecondary.getWaybillnomaster();  
42 - // 查询需要挂载的主单id  
43 - ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, master.getFlightno(), master.getFlightDate());  
44 - // 修改分单表 所绑定的主单id  
45 - if (originmanifestmaster!=null){  
46 - log.info("挂载主单的id:{}", originmanifestmaster);  
47 - log.info("修改分单数据参数:{}", awbhIds, originmanifestmaster.getAutoid());  
48 - w = originmanifestsecondaryMapper.updateMasterAutoId(awbhIds.get(i), originmanifestmaster.getAutoid());  
49 - log.info("修改后的状态:{}", w); 35 + if(master != null){
  36 + if (master.getAwbhIds().contains(",")){
  37 + String[] split = master.getAwbhIds().split(",");
  38 + // 查询该分单绑定的主单id
  39 + for (int i=0; i< split.length; i++){
  40 + Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(split[i]);
  41 + log.info("查询的主单id:{}", originmanifestsecondary);
  42 + if (originmanifestsecondary != null){
  43 + awba = originmanifestsecondary.getWaybillnomaster();
  44 + // 查询需要挂载的主单id
  45 + ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, master.getFlightno(), master.getFlightDate());
  46 + // 修改分单表 所绑定的主单id
  47 + if (originmanifestmaster!=null){
  48 + log.info("挂载主单的id:{}", originmanifestmaster);
  49 + log.info("修改分单数据参数:{}", split, originmanifestmaster.getAutoid());
  50 + w = originmanifestsecondaryMapper.updateMasterAutoId(split[i], originmanifestmaster.getAutoid());
  51 + log.info("修改后的状态:{}", w);
  52 + }
  53 + }
50 } 54 }
51 } 55 }
52 } 56 }