正在显示
5 个修改的文件
包含
55 行增加
和
43 行删除
@@ -5,10 +5,16 @@ import com.tianbo.analysis.model.Originmanifestsecondary; | @@ -5,10 +5,16 @@ 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 com.tianbo.util.Date.DateUtil; | ||
8 | import io.swagger.annotations.ApiOperation; | 9 | import io.swagger.annotations.ApiOperation; |
10 | +import org.apache.commons.lang.StringUtils; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
10 | import org.springframework.web.bind.annotation.*; | 12 | import org.springframework.web.bind.annotation.*; |
13 | +import org.thymeleaf.util.DateUtils; | ||
11 | 14 | ||
15 | +import java.text.ParseException; | ||
16 | +import java.text.SimpleDateFormat; | ||
17 | +import java.util.Date; | ||
12 | import java.util.List; | 18 | import java.util.List; |
13 | 19 | ||
14 | /** | 20 | /** |
@@ -28,42 +34,46 @@ public class NmmsImportController { | @@ -28,42 +34,46 @@ public class NmmsImportController { | ||
28 | NmmsImportService nmmsImportService; | 34 | NmmsImportService nmmsImportService; |
29 | 35 | ||
30 | /** | 36 | /** |
31 | - * awbhIds[] 分单id | ||
32 | * 批量删除 | 37 | * 批量删除 |
33 | - * @param originmanifestsecondary | 38 | + * @param awbhIds |
34 | * @return | 39 | * @return |
35 | */ | 40 | */ |
36 | @ApiOperation(value = "批量删除") | 41 | @ApiOperation(value = "批量删除") |
37 | @PostMapping(value = "/imp_removes") | 42 | @PostMapping(value = "/imp_removes") |
38 | @ResponseBody | 43 | @ResponseBody |
39 | - public ResultJson antivirus_log_remove(@RequestBody Originmanifestsecondary originmanifestsecondary){ | 44 | + public ResultJson antivirus_log_remove(@RequestParam(value ="awbhIds", required= true) String awbhIds){ |
40 | int r = 0; | 45 | int r = 0; |
41 | - if(originmanifestsecondary != null){ | ||
42 | - if (originmanifestsecondary.getAwbhIds().contains(",")){ | ||
43 | - String[] split = originmanifestsecondary.getAwbhIds().split(","); | 46 | + if (awbhIds.contains(",")){ |
47 | + String[] split = awbhIds.split(","); | ||
44 | for (int i=0; i< split.length; i++){ | 48 | for (int i=0; i< split.length; i++){ |
45 | r += originService.deleteAwbh(split[i]); | 49 | r += originService.deleteAwbh(split[i]); |
46 | } | 50 | } |
51 | + }else { | ||
52 | + r += originService.deleteAwbh(awbhIds); | ||
47 | } | 53 | } |
48 | - } | ||
49 | - | ||
50 | - | ||
51 | return r > 0 ? new ResultJson("200", "批量删除成功") | 54 | return r > 0 ? new ResultJson("200", "批量删除成功") |
52 | : new ResultJson("201", "批量删除失败"); | 55 | : new ResultJson("201", "批量删除失败"); |
53 | } | 56 | } |
54 | 57 | ||
55 | /** | 58 | /** |
56 | - * awbhIds[] 分单id | ||
57 | - * flightDate 航班日期 | ||
58 | - * flightno 航班号 | ||
59 | - * @param originmanifestmaster | 59 | + * 分单挂载主单 |
60 | + * @param awbhIds | ||
61 | + * @param flightNo | ||
62 | + * @param flightDate | ||
60 | * @return | 63 | * @return |
61 | */ | 64 | */ |
62 | @ApiOperation(value = "分单批量挂载") | 65 | @ApiOperation(value = "分单批量挂载") |
63 | @PostMapping(value = "/mountAwbh") | 66 | @PostMapping(value = "/mountAwbh") |
64 | @ResponseBody | 67 | @ResponseBody |
65 | - public ResultJson antivirus_log_remove(@RequestBody ORIGINMANIFESTMASTER originmanifestmaster){ | ||
66 | - | 68 | + public ResultJson antivirus_log_remove(@RequestParam(value ="awbhIds", required= true) String awbhIds, |
69 | + @RequestParam(value ="flightNo", required= true) String flightNo, | ||
70 | + @RequestParam(value ="flightDate", required= true) String flightDate) throws ParseException { | ||
71 | + ORIGINMANIFESTMASTER originmanifestmaster = new ORIGINMANIFESTMASTER(); | ||
72 | + originmanifestmaster.setAwbhIds(awbhIds); | ||
73 | + originmanifestmaster.setFlightno(flightNo); | ||
74 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); | ||
75 | + Date parse = simpleDateFormat.parse(flightDate); | ||
76 | + originmanifestmaster.setFlightDate(parse); | ||
67 | return nmmsImportService.mountAwbh(originmanifestmaster) > 0 ? new ResultJson("200", "分单挂载成功") | 77 | return nmmsImportService.mountAwbh(originmanifestmaster) > 0 ? new ResultJson("200", "分单挂载成功") |
68 | : new ResultJson("201", "分单挂载失败"); | 78 | : new ResultJson("201", "分单挂载失败"); |
69 | } | 79 | } |
@@ -24,7 +24,7 @@ public interface ORIGINMANIFESTMASTERMapper { | @@ -24,7 +24,7 @@ public interface ORIGINMANIFESTMASTERMapper { | ||
24 | @Param("flightDate")String var3 | 24 | @Param("flightDate")String var3 |
25 | ); | 25 | ); |
26 | 26 | ||
27 | - ORIGINMANIFESTMASTER findAwba(@Param("waybillnomaster") String var1, | 27 | + ORIGINMANIFESTMASTER findAwba(@Param("awba") String var1, |
28 | @Param("flightNo")String var2, | 28 | @Param("flightNo")String var2, |
29 | @Param("flightDate") Date var3 | 29 | @Param("flightDate") Date var3 |
30 | ); | 30 | ); |
@@ -95,16 +95,6 @@ public class Originmanifestsecondary { | @@ -95,16 +95,6 @@ public class Originmanifestsecondary { | ||
95 | //报文结束标识 | 95 | //报文结束标识 |
96 | private static String END_WORD= "="; | 96 | private static String END_WORD= "="; |
97 | 97 | ||
98 | - private String awbhIds; | ||
99 | - | ||
100 | - public String getAwbhIds() { | ||
101 | - return awbhIds; | ||
102 | - } | ||
103 | - | ||
104 | - public void setAwbhIds(String awbhIds) { | ||
105 | - this.awbhIds = awbhIds; | ||
106 | - } | ||
107 | - | ||
108 | public String getAutoid() { | 98 | public String getAutoid() { |
109 | return autoid; | 99 | return autoid; |
110 | } | 100 | } |
@@ -9,6 +9,7 @@ import lombok.extern.slf4j.Slf4j; | @@ -9,6 +9,7 @@ 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.Date; | ||
12 | import java.util.List; | 13 | import java.util.List; |
13 | 14 | ||
14 | /** | 15 | /** |
@@ -30,34 +31,45 @@ public class NmmsImportServiceImpl implements NmmsImportService{ | @@ -30,34 +31,45 @@ public class NmmsImportServiceImpl implements NmmsImportService{ | ||
30 | public int mountAwbh(ORIGINMANIFESTMASTER master) { | 31 | public int mountAwbh(ORIGINMANIFESTMASTER master) { |
31 | 32 | ||
32 | int w = 0; | 33 | int w = 0; |
33 | - try { | ||
34 | String awba = ""; | 34 | String awba = ""; |
35 | - if(master != null){ | 35 | + try { |
36 | if (master.getAwbhIds().contains(",")){ | 36 | if (master.getAwbhIds().contains(",")){ |
37 | String[] split = master.getAwbhIds().split(","); | 37 | String[] split = master.getAwbhIds().split(","); |
38 | // 查询该分单绑定的主单id | 38 | // 查询该分单绑定的主单id |
39 | for (int i=0; i< split.length; i++){ | 39 | for (int i=0; i< split.length; i++){ |
40 | - Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(split[i]); | 40 | + w = mountAwbhBreakUp(master.getAwbhIds(), master.getFlightno(), master.getFlightDate()); |
41 | + } | ||
42 | + }else { | ||
43 | + w = mountAwbhBreakUp(master.getAwbhIds(), master.getFlightno(), master.getFlightDate()); | ||
44 | + } | ||
45 | + return w; | ||
46 | + }catch (Exception e){ | ||
47 | + e.printStackTrace(); | ||
48 | + return w; | ||
49 | + } | ||
50 | + } | ||
51 | + | ||
52 | + private int mountAwbhBreakUp(String awbh, String flightNo, Date flightDate){ | ||
53 | + int w = 0; | ||
54 | + String awba = ""; | ||
55 | + // 查询需要挂载的主单号 | ||
56 | + Originmanifestsecondary originmanifestsecondary = originmanifestsecondaryMapper.findAwba(awbh); | ||
41 | log.info("查询的主单id:{}", originmanifestsecondary); | 57 | log.info("查询的主单id:{}", originmanifestsecondary); |
42 | if (originmanifestsecondary != null){ | 58 | if (originmanifestsecondary != null){ |
43 | awba = originmanifestsecondary.getWaybillnomaster(); | 59 | awba = originmanifestsecondary.getWaybillnomaster(); |
44 | - // 查询需要挂载的主单id | ||
45 | - ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, master.getFlightno(), master.getFlightDate()); | 60 | + // 通过主单号 航班号 航班日期 查询相对应的主单id |
61 | + ORIGINMANIFESTMASTER originmanifestmaster = originmanifestmasterMapper.findAwba(awba, flightNo, flightDate); | ||
46 | // 修改分单表 所绑定的主单id | 62 | // 修改分单表 所绑定的主单id |
47 | if (originmanifestmaster!=null){ | 63 | if (originmanifestmaster!=null){ |
48 | log.info("挂载主单的id:{}", originmanifestmaster); | 64 | log.info("挂载主单的id:{}", originmanifestmaster); |
49 | - log.info("修改分单数据参数:{}", split, originmanifestmaster.getAutoid()); | ||
50 | - w = originmanifestsecondaryMapper.updateMasterAutoId(split[i], originmanifestmaster.getAutoid()); | 65 | + log.info("修改分单数据参数:{}", awbh, originmanifestmaster.getAutoid()); |
66 | + w = originmanifestsecondaryMapper.updateMasterAutoId(awbh, originmanifestmaster.getAutoid()); | ||
51 | log.info("修改后的状态:{}", w); | 67 | log.info("修改后的状态:{}", w); |
52 | } | 68 | } |
53 | } | 69 | } |
54 | - } | ||
55 | - } | ||
56 | - } | ||
57 | - return w; | ||
58 | - }catch (Exception e){ | ||
59 | - e.printStackTrace(); | 70 | + |
71 | + | ||
72 | + | ||
60 | return w; | 73 | return w; |
61 | } | 74 | } |
62 | - } | ||
63 | } | 75 | } |
@@ -487,12 +487,12 @@ GROUP BY | @@ -487,12 +487,12 @@ GROUP BY | ||
487 | messagetype ASC | 487 | messagetype ASC |
488 | </select> | 488 | </select> |
489 | 489 | ||
490 | - <select id="findAwba" parameterType="java.lang.String" resultMap="BaseResultMap"> | 490 | + <select id="findAwba" parameterType="java.util.Map" resultMap="BaseResultMap"> |
491 | select * from ORIGINMANIFESTMASTER | 491 | select * from ORIGINMANIFESTMASTER |
492 | where | 492 | where |
493 | - WAYBILLNOMASTER = #{waybillnomaster,jdbcType=VARCHAR} | 493 | + WAYBILLNOMASTER = #{awba,jdbcType=VARCHAR} |
494 | and FLIGHTNO = #{flightNo,jdbcType=VARCHAR} | 494 | and FLIGHTNO = #{flightNo,jdbcType=VARCHAR} |
495 | - and flight_date = TO_DATE( #{flightDate ,jdbcType=DATE}, 'yyyy-MM-dd' ) | 495 | + and FLIGHT_DATE = #{flightDate ,jdbcType=DATE} |
496 | </select> | 496 | </select> |
497 | 497 | ||
498 | <select id="searchSec" parameterType="string" resultMap="BaseResultMap"> | 498 | <select id="searchSec" parameterType="string" resultMap="BaseResultMap"> |
-
请 注册 或 登录 后发表评论