正在显示
14 个修改的文件
包含
525 行增加
和
2 行删除
@@ -7,6 +7,9 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | @@ -7,6 +7,9 @@ import org.springframework.cloud.netflix.eureka.EnableEurekaClient; | ||
7 | import org.springframework.cloud.openfeign.EnableFeignClients; | 7 | import org.springframework.cloud.openfeign.EnableFeignClients; |
8 | import org.springframework.transaction.annotation.EnableTransactionManagement; | 8 | import org.springframework.transaction.annotation.EnableTransactionManagement; |
9 | 9 | ||
10 | +/** | ||
11 | + * @author 子诚 | ||
12 | + */ | ||
10 | @SpringBootApplication | 13 | @SpringBootApplication |
11 | @MapperScan("com.sunyo.wlpt.transport.provide.mapper") | 14 | @MapperScan("com.sunyo.wlpt.transport.provide.mapper") |
12 | @EnableFeignClients | 15 | @EnableFeignClients |
1 | +package com.sunyo.wlpt.transport.provide.common; | ||
2 | + | ||
3 | +import com.fasterxml.jackson.annotation.JsonFormat; | ||
4 | +import lombok.AllArgsConstructor; | ||
5 | +import lombok.Data; | ||
6 | +import lombok.NoArgsConstructor; | ||
7 | + | ||
8 | +import java.io.Serializable; | ||
9 | +import java.util.Date; | ||
10 | + | ||
11 | +/** | ||
12 | + * @author 子诚 | ||
13 | + * Description:实体类:新舱单——理货信息.最终返回结果类 | ||
14 | + * 时间:2020/5/20 10:40 | ||
15 | + */ | ||
16 | +@Data | ||
17 | +@AllArgsConstructor | ||
18 | +@NoArgsConstructor | ||
19 | +public class ResultExitData implements Serializable { | ||
20 | + | ||
21 | + private static final long serialVersionUID = -260680809813827352L; | ||
22 | + | ||
23 | + /** | ||
24 | + * 1.id | ||
25 | + */ | ||
26 | + private String autoId; | ||
27 | + | ||
28 | + /** | ||
29 | + * 2.运单号 | ||
30 | + */ | ||
31 | + private String waybillNoMaster; | ||
32 | + | ||
33 | + /** | ||
34 | + * 3.航班号 | ||
35 | + */ | ||
36 | + private String flightNo; | ||
37 | + | ||
38 | + /** | ||
39 | + * 4.航班日期 | ||
40 | + */ | ||
41 | + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") | ||
42 | + private Date flightDate; | ||
43 | + | ||
44 | + /** | ||
45 | + * 5.航段 | ||
46 | + */ | ||
47 | + private String segment; | ||
48 | + | ||
49 | + /** | ||
50 | + * 6.航班起始站 | ||
51 | + */ | ||
52 | + private String originatingStation; | ||
53 | + | ||
54 | + /** | ||
55 | + * 7.航班目的站 | ||
56 | + */ | ||
57 | + private String destinationStation; | ||
58 | + | ||
59 | + /** | ||
60 | + * 8.理货件数 | ||
61 | + */ | ||
62 | + private String tallyTotalPiece; | ||
63 | + | ||
64 | + /** | ||
65 | + * 9.理货重量 | ||
66 | + */ | ||
67 | + private String tallyTotalWeight; | ||
68 | + | ||
69 | + /** | ||
70 | + * 10.承运人二字码 | ||
71 | + */ | ||
72 | + private String carrier; | ||
73 | + | ||
74 | + /** | ||
75 | + * 11.发货人名称 | ||
76 | + */ | ||
77 | + private String shipperName; | ||
78 | + | ||
79 | + /** | ||
80 | + * 12.收货人名称 | ||
81 | + */ | ||
82 | + private String consigneeName; | ||
83 | + | ||
84 | + /** | ||
85 | + * 13.货物目的站 | ||
86 | + */ | ||
87 | + private String aimStation; | ||
88 | + /** | ||
89 | + * 14.国家代码 | ||
90 | + */ | ||
91 | + private String country; | ||
92 | + | ||
93 | + /** | ||
94 | + * 15.航班目的区域,中文描述,所属洲 | ||
95 | + */ | ||
96 | + private String areaDescChn; | ||
97 | + | ||
98 | + /** | ||
99 | + * 16.代理人全称 | ||
100 | + */ | ||
101 | + private String fullName; | ||
102 | + | ||
103 | + /** | ||
104 | + * 17.货主类型 | ||
105 | + * 111 = 发货代理 | ||
106 | + * 222 = 订舱代理 | ||
107 | + * 333 = 操作代理/结算代理 | ||
108 | + */ | ||
109 | + private String theShipperType; | ||
110 | + | ||
111 | + /** | ||
112 | + * 18.品名 | ||
113 | + */ | ||
114 | + private String sdCargoName; | ||
115 | + | ||
116 | + /** | ||
117 | + * 19.二级类名称 | ||
118 | + */ | ||
119 | + private String twoTypeName; | ||
120 | + | ||
121 | + /** | ||
122 | + * 20.一级类名称 | ||
123 | + */ | ||
124 | + private String typeName; | ||
125 | + | ||
126 | + /** | ||
127 | + * 21.航空公司 | ||
128 | + */ | ||
129 | + private String airCompany; | ||
130 | + | ||
131 | + /** | ||
132 | + * 22.机型 | ||
133 | + */ | ||
134 | + private String cfTp; | ||
135 | + | ||
136 | + /** | ||
137 | + * 23.机号 | ||
138 | + */ | ||
139 | + private String cfNo; | ||
140 | + | ||
141 | + /** | ||
142 | + * 24.航班(起飞)时间 | ||
143 | + */ | ||
144 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||
145 | + private Date flightTime; | ||
146 | + | ||
147 | + /** | ||
148 | + * 25.航班计划日期 | ||
149 | + */ | ||
150 | + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") | ||
151 | + private Date flightPlanDate; | ||
152 | + | ||
153 | + /** | ||
154 | + * 26.航班计划时间 | ||
155 | + */ | ||
156 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||
157 | + private Date flightPlanTime; | ||
158 | +} |
1 | +package com.sunyo.wlpt.transport.provide.controller; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.common.ResultExitData; | ||
4 | +import com.sunyo.wlpt.transport.provide.domain.DePeAir; | ||
5 | +import com.sunyo.wlpt.transport.provide.domain.FlightDfDl; | ||
6 | +import com.sunyo.wlpt.transport.provide.service.DePeAirService; | ||
7 | +import com.sunyo.wlpt.transport.provide.service.FlightDfDlService; | ||
8 | +import org.springframework.beans.propertyeditors.CustomDateEditor; | ||
9 | +import org.springframework.web.bind.WebDataBinder; | ||
10 | +import org.springframework.web.bind.annotation.*; | ||
11 | + | ||
12 | +import javax.annotation.Resource; | ||
13 | +import java.text.ParsePosition; | ||
14 | +import java.text.SimpleDateFormat; | ||
15 | +import java.util.Date; | ||
16 | +import java.util.List; | ||
17 | + | ||
18 | +/** | ||
19 | + * @author 子诚 | ||
20 | + * Description: | ||
21 | + * 时间:2020/5/22 11:04 | ||
22 | + */ | ||
23 | +@CrossOrigin | ||
24 | +@RequestMapping("transport") | ||
25 | +@RestController | ||
26 | +public class TransportController { | ||
27 | + @Resource | ||
28 | + private FlightDfDlService flightDfDlService; | ||
29 | + | ||
30 | + @Resource | ||
31 | + private DePeAirService dePeAirService; | ||
32 | + | ||
33 | + /** | ||
34 | + * 根据承运人二字码、航班号、航班日期,获取,运输工具服务中的相关数据 | ||
35 | + * 航空公司、机型、机号、实际起飞时间、计划起飞时间 | ||
36 | + * | ||
37 | + * @param resultList {@link ResultExitData} | ||
38 | + * @return | ||
39 | + */ | ||
40 | + @PutMapping("/getInfo") | ||
41 | + public List<ResultExitData> getInfo(@RequestBody List<ResultExitData> resultList) { | ||
42 | + | ||
43 | + System.out.println("开始调用:运输工具服务"); | ||
44 | + System.out.println("长度为" + resultList.size()); | ||
45 | + for (int i = 0, resultSize = resultList.size(); i < resultSize; i++) { | ||
46 | + ResultExitData result = resultList.get(i); | ||
47 | + System.out.println(i + "运单号" + result.getWaybillNoMaster()); | ||
48 | + List<FlightDfDl> fd = flightDfDlService.getFlightDfDlInfo(result); | ||
49 | + if (fd != null && fd.size() > 0) { | ||
50 | + //机型 | ||
51 | + result.setCfTp(fd.get(0).getCfTp()); | ||
52 | + //机号 | ||
53 | + result.setCfNo(fd.get(0).getCfNo()); | ||
54 | + //航班计划日期,直接设置为航班日期的值 | ||
55 | + result.setFlightPlanDate(result.getFlightDate()); | ||
56 | + List<DePeAir> dePeAirs = dePeAirService.getDePeAirInfo(fd.get(0).getFlId()); | ||
57 | + if (dePeAirs != null && dePeAirs.size() > 0) { | ||
58 | + //航班公司 | ||
59 | + result.setAirCompany(dePeAirs.get(0).getFfId().substring(0, 2)); | ||
60 | + //航班实际起飞时间(航班时间) | ||
61 | + result.setFlightTime(dePeAirs.get(0).getFrTt()); | ||
62 | + //航班计划时间,直接设置为航班时间 | ||
63 | + result.setFlightPlanTime(dePeAirs.get(0).getFrTt()); | ||
64 | + } | ||
65 | + } | ||
66 | + } | ||
67 | + System.out.println("完成调用:运输工具服务"); | ||
68 | + return resultList; | ||
69 | + } | ||
70 | +} |
1 | +package com.sunyo.wlpt.transport.provide.domain; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +import lombok.AllArgsConstructor; | ||
7 | +import lombok.Data; | ||
8 | +import lombok.NoArgsConstructor; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author 子诚 | ||
12 | + * Description:运输工具——航班离港信息 | ||
13 | + * 时间:2020/5/22 11:00 | ||
14 | + */ | ||
15 | +@Data | ||
16 | +@AllArgsConstructor | ||
17 | +@NoArgsConstructor | ||
18 | +public class DePeAir implements Serializable { | ||
19 | + | ||
20 | + private static final long serialVersionUID = 5631854615861533199L; | ||
21 | + | ||
22 | + /** | ||
23 | + * 航班id | ||
24 | + */ | ||
25 | + private String flId; | ||
26 | + | ||
27 | + /** | ||
28 | + * 航班,标识 | ||
29 | + * 航空公司二字码-航班号-计划时间 | ||
30 | + */ | ||
31 | + private String ffId; | ||
32 | + | ||
33 | + /** | ||
34 | + * 航班实际起飞时间 | ||
35 | + */ | ||
36 | + private Date frTt; | ||
37 | +} |
1 | +package com.sunyo.wlpt.transport.provide.domain; | ||
2 | + | ||
3 | +import java.io.Serializable; | ||
4 | +import java.util.Date; | ||
5 | + | ||
6 | +import lombok.AllArgsConstructor; | ||
7 | +import lombok.Data; | ||
8 | +import lombok.NoArgsConstructor; | ||
9 | + | ||
10 | +/** | ||
11 | + * @author 子诚 | ||
12 | + * Description:运输工具 | ||
13 | + * 时间:2020/5/22 10:26 | ||
14 | + */ | ||
15 | +@Data | ||
16 | +@AllArgsConstructor | ||
17 | +@NoArgsConstructor | ||
18 | +public class FlightDfDl implements Serializable { | ||
19 | + | ||
20 | + private static final long serialVersionUID = 5811801930754677941L; | ||
21 | + | ||
22 | + /** | ||
23 | + * 航班唯一 id | ||
24 | + */ | ||
25 | + private String flId; | ||
26 | + | ||
27 | + /** | ||
28 | + * 航班,标识 | ||
29 | + * 航空公司二字码-航班号-计划时间 | ||
30 | + */ | ||
31 | + private String ffId; | ||
32 | + | ||
33 | + /** | ||
34 | + * 承运人 | ||
35 | + */ | ||
36 | + private String awCd; | ||
37 | + | ||
38 | + /** | ||
39 | + * 航班号 | ||
40 | + */ | ||
41 | + private String flNo; | ||
42 | + | ||
43 | + /** | ||
44 | + * 航班计划起飞日期 | ||
45 | + */ | ||
46 | + private Date feXd; | ||
47 | + | ||
48 | + /** | ||
49 | + * 机型 | ||
50 | + */ | ||
51 | + private String cfTp; | ||
52 | + | ||
53 | + /** | ||
54 | + * 机号 | ||
55 | + */ | ||
56 | + private String cfNo; | ||
57 | + | ||
58 | +} |
1 | +package com.sunyo.wlpt.transport.provide.mapper; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.domain.DePeAir; | ||
4 | +import org.apache.ibatis.annotations.Mapper; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description: | ||
11 | + * 时间:2020/5/22 11:00 | ||
12 | + */ | ||
13 | +@Mapper | ||
14 | +public interface DePeAirMapper { | ||
15 | + /** | ||
16 | + * 根据 航班唯一 id 查询 运输工具——航班离港信息. | ||
17 | + * | ||
18 | + * @param flId 航班唯一 id | ||
19 | + * @return {@link DePeAir} | ||
20 | + */ | ||
21 | + List<DePeAir> getDePeAirInfo(String flId); | ||
22 | +} |
1 | +package com.sunyo.wlpt.transport.provide.mapper; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.common.ResultExitData; | ||
4 | +import com.sunyo.wlpt.transport.provide.domain.FlightDfDl; | ||
5 | +import org.apache.ibatis.annotations.Mapper; | ||
6 | + | ||
7 | +import java.util.List; | ||
8 | + | ||
9 | +/** | ||
10 | + * @author 子诚 | ||
11 | + * Description: | ||
12 | + * 时间:2020/5/22 10:26 | ||
13 | + */ | ||
14 | +@Mapper | ||
15 | +public interface FlightDfDlMapper { | ||
16 | + /** | ||
17 | + * 获取运输工具的相关信息 | ||
18 | + * | ||
19 | + * @param result 新舱单传输来的最终结果类 | ||
20 | + * @return {@link FlightDfDl} | ||
21 | + */ | ||
22 | + List<FlightDfDl> getFlightDfDlInfo(ResultExitData result); | ||
23 | +} |
1 | +package com.sunyo.wlpt.transport.provide.service; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.domain.DePeAir; | ||
4 | + | ||
5 | +import java.util.List; | ||
6 | + | ||
7 | +/** | ||
8 | + * @author 子诚 | ||
9 | + * Description: | ||
10 | + * 时间:2020/5/22 11:00 | ||
11 | + */ | ||
12 | +public interface DePeAirService { | ||
13 | + | ||
14 | + /** | ||
15 | + * 根据 航班唯一 id 查询 运输工具——航班离港信息. | ||
16 | + * | ||
17 | + * @param flId 航班唯一 id | ||
18 | + * @return {@link DePeAir} | ||
19 | + */ | ||
20 | + List<DePeAir> getDePeAirInfo(String flId); | ||
21 | +} |
1 | +package com.sunyo.wlpt.transport.provide.service; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.common.ResultExitData; | ||
4 | +import com.sunyo.wlpt.transport.provide.domain.FlightDfDl; | ||
5 | + | ||
6 | +import java.util.List; | ||
7 | + | ||
8 | +/** | ||
9 | + * @author 子诚 | ||
10 | + * Description: | ||
11 | + * 时间:2020/5/22 10:26 | ||
12 | + */ | ||
13 | +public interface FlightDfDlService { | ||
14 | + | ||
15 | + /** | ||
16 | + * 获取运输工具的相关信息 | ||
17 | + * | ||
18 | + * @param result 新舱单传输来的最终结果类 | ||
19 | + * @return {@link FlightDfDl} | ||
20 | + */ | ||
21 | + List<FlightDfDl> getFlightDfDlInfo(ResultExitData result); | ||
22 | +} |
1 | +package com.sunyo.wlpt.transport.provide.service.impl; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.domain.DePeAir; | ||
4 | +import org.springframework.stereotype.Service; | ||
5 | + | ||
6 | +import javax.annotation.Resource; | ||
7 | + | ||
8 | +import com.sunyo.wlpt.transport.provide.mapper.DePeAirMapper; | ||
9 | +import com.sunyo.wlpt.transport.provide.service.DePeAirService; | ||
10 | + | ||
11 | +import java.util.List; | ||
12 | + | ||
13 | +/** | ||
14 | + * @author 子诚 | ||
15 | + * Description: | ||
16 | + * 时间:2020/5/22 11:00 | ||
17 | + */ | ||
18 | +@Service | ||
19 | +public class DePeAirServiceImpl implements DePeAirService { | ||
20 | + | ||
21 | + @Resource | ||
22 | + private DePeAirMapper dePeAirMapper; | ||
23 | + | ||
24 | + @Override | ||
25 | + public List<DePeAir> getDePeAirInfo(String flId) { | ||
26 | + return dePeAirMapper.getDePeAirInfo(flId); | ||
27 | + } | ||
28 | +} |
1 | +package com.sunyo.wlpt.transport.provide.service.impl; | ||
2 | + | ||
3 | +import com.sunyo.wlpt.transport.provide.common.ResultExitData; | ||
4 | +import com.sunyo.wlpt.transport.provide.domain.FlightDfDl; | ||
5 | +import org.springframework.stereotype.Service; | ||
6 | + | ||
7 | +import javax.annotation.Resource; | ||
8 | + | ||
9 | +import com.sunyo.wlpt.transport.provide.mapper.FlightDfDlMapper; | ||
10 | +import com.sunyo.wlpt.transport.provide.service.FlightDfDlService; | ||
11 | + | ||
12 | +import java.util.List; | ||
13 | + | ||
14 | +/** | ||
15 | + * @author 子诚 | ||
16 | + * Description: | ||
17 | + * 时间:2020/5/22 10:26 | ||
18 | + */ | ||
19 | +@Service | ||
20 | +public class FlightDfDlServiceImpl implements FlightDfDlService { | ||
21 | + | ||
22 | + @Resource | ||
23 | + private FlightDfDlMapper flightDfDlMapper; | ||
24 | + | ||
25 | + @Override | ||
26 | + public List<FlightDfDl> getFlightDfDlInfo(ResultExitData result) { | ||
27 | + return flightDfDlMapper.getFlightDfDlInfo(result); | ||
28 | + } | ||
29 | +} |
@@ -4,7 +4,7 @@ server: | @@ -4,7 +4,7 @@ server: | ||
4 | # spring \u914D\u7F6E | 4 | # spring \u914D\u7F6E |
5 | spring: | 5 | spring: |
6 | application: | 6 | application: |
7 | - name: cgonms-provide | 7 | + name: transport-provide |
8 | datasource: | 8 | datasource: |
9 | type: com.alibaba.druid.pool.DruidDataSource | 9 | type: com.alibaba.druid.pool.DruidDataSource |
10 | driver-class-name: com.mysql.cj.jdbc.Driver | 10 | driver-class-name: com.mysql.cj.jdbc.Driver |
@@ -39,7 +39,7 @@ mybatis: | @@ -39,7 +39,7 @@ mybatis: | ||
39 | # level: | 39 | # level: |
40 | # com.sunyo.wlpt.transport.provide.mapper: debug | 40 | # com.sunyo.wlpt.transport.provide.mapper: debug |
41 | #logback: | 41 | #logback: |
42 | -# appname: cgonms-provide | 42 | +# appname: transport-provide |
43 | # logdir: ./log | 43 | # logdir: ./log |
44 | 44 | ||
45 | 45 |
src/main/resources/mapper/DePeAirMapper.xml
0 → 100644
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sunyo.wlpt.transport.provide.mapper.DePeAirMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.wlpt.transport.provide.domain.DePeAir"> | ||
5 | + <!--@mbg.generated--> | ||
6 | + <!--@Table depe_air--> | ||
7 | + <id column="FLID" jdbcType="VARCHAR" property="flId"/> | ||
8 | + <result column="FFID" jdbcType="VARCHAR" property="ffId"/> | ||
9 | + <result column="FRTT" jdbcType="TIMESTAMP" property="frTt"/> | ||
10 | + </resultMap> | ||
11 | + <sql id="Base_Column_List"> | ||
12 | + <!--@mbg.generated--> | ||
13 | + FLID, FFID, FRTT | ||
14 | + </sql> | ||
15 | + <select id="getDePeAirInfo" parameterType="java.lang.String" resultMap="BaseResultMap"> | ||
16 | + select | ||
17 | + <include refid="Base_Column_List"/> | ||
18 | + from depe_air | ||
19 | + where FLID =#{flId,jdbcType=VARCHAR} | ||
20 | + </select> | ||
21 | +</mapper> |
1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | ||
3 | +<mapper namespace="com.sunyo.wlpt.transport.provide.mapper.FlightDfDlMapper"> | ||
4 | + <resultMap id="BaseResultMap" type="com.sunyo.wlpt.transport.provide.domain.FlightDfDl"> | ||
5 | + <!--@mbg.generated--> | ||
6 | + <!--@Table flight_dfdl--> | ||
7 | + <id column="FLID" jdbcType="VARCHAR" property="flId"/> | ||
8 | + <result column="FFID" jdbcType="VARCHAR" property="ffId"/> | ||
9 | + <result column="AWCD" jdbcType="VARCHAR" property="awCd"/> | ||
10 | + <result column="FLNO" jdbcType="VARCHAR" property="flNo"/> | ||
11 | + <result column="FEXD" jdbcType="DATE" property="feXd"/> | ||
12 | + <result column="CFTP" jdbcType="VARCHAR" property="cfTp"/> | ||
13 | + <result column="CFNO" jdbcType="VARCHAR" property="cfNo"/> | ||
14 | + </resultMap> | ||
15 | + <sql id="Base_Column_List"> | ||
16 | + <!--@mbg.generated--> | ||
17 | + FLID, FFID, AWCD, FLNO, FEXD, CFTP, CFNO | ||
18 | + </sql> | ||
19 | + <select id="getFlightDfDlInfo" parameterType="com.sunyo.wlpt.transport.provide.common.ResultExitData" | ||
20 | + resultMap="BaseResultMap"> | ||
21 | + select | ||
22 | + <include refid="Base_Column_List"/> | ||
23 | + from flight_dfdl | ||
24 | + where | ||
25 | + AWCD = #{carrier,jdbcType=VARCHAR} | ||
26 | + and | ||
27 | + concat_ws('',AWCD,FLNO) = #{flightNo,jdbcType=VARCHAR} | ||
28 | + and | ||
29 | + FEXD=#{flightDate,jdbcType=DATE} | ||
30 | + </select> | ||
31 | +</mapper> |
-
请 注册 或 登录 后发表评论