作者 朱兆平

新舱单辅助管理-直接改配优化

  1 +FROM java:8u111
  2 +VOLUME /tmp
  3 +ADD *.jar app.jar
  4 +EXPOSE 10001
  5 +RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
  6 +RUN echo "Asia/Shanghai" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata
  7 +COPY xsd /xsd
  8 +ENTRYPOINT ["java","-jar","/app.jar"]
  9 +# Ubuntu 时区
  10 +
@@ -151,6 +151,22 @@ @@ -151,6 +151,22 @@
151 <verbose>true</verbose> 151 <verbose>true</verbose>
152 </configuration> 152 </configuration>
153 </plugin> 153 </plugin>
  154 + <plugin>
  155 + <artifactId>maven-antrun-plugin</artifactId>
  156 + <executions> <execution>
  157 + <id>gen-webadmin</id>
  158 + <phase>package</phase>
  159 + <configuration>
  160 + <tasks>
  161 + <copy todir="docker" file="target/${project.artifactId}-${project.version}.${project.packaging}" />
  162 + </tasks>
  163 + </configuration>
  164 + <goals>
  165 + <goal>run</goal>
  166 + </goals>
  167 + </execution>
  168 + </executions>
  169 + </plugin>
154 </plugins> 170 </plugins>
155 </build> 171 </build>
156 172
@@ -29,11 +29,12 @@ import java.io.File; @@ -29,11 +29,12 @@ import java.io.File;
29 29
30 import java.io.IOException; 30 import java.io.IOException;
31 import java.util.Date; 31 import java.util.Date;
  32 +import java.util.List;
32 33
33 34
34 @Slf4j 35 @Slf4j
35 @RestController 36 @RestController
36 -@RequestMapping("/mt8024/") 37 +@RequestMapping("/mt8204/")
37 public class MT8204Controller { 38 public class MT8204Controller {
38 39
39 @Autowired 40 @Autowired
@@ -47,7 +48,7 @@ public class MT8204Controller { @@ -47,7 +48,7 @@ public class MT8204Controller {
47 @RequestParam(value = "waybillnomaster",required = false) String waybillNo){ 48 @RequestParam(value = "waybillnomaster",required = false) String waybillNo){
48 MANIFEST_AIR_CHANGE manifest_air_change = new MANIFEST_AIR_CHANGE(); 49 MANIFEST_AIR_CHANGE manifest_air_change = new MANIFEST_AIR_CHANGE();
49 if(StringUtils.isNotEmpty(flightDate)){ 50 if(StringUtils.isNotEmpty(flightDate)){
50 - Date flight_Date = DateUtil.parseDate(flightDate,"yyyy-MM-dd"); 51 + Date flight_Date = DateUtil.parseDate(flightDate,"yyyyMMdd");
51 manifest_air_change.setFlightDate(flight_Date); 52 manifest_air_change.setFlightDate(flight_Date);
52 } 53 }
53 manifest_air_change.setFlightno(flightNo); 54 manifest_air_change.setFlightno(flightNo);
@@ -85,7 +86,9 @@ public class MT8204Controller { @@ -85,7 +86,9 @@ public class MT8204Controller {
85 } 86 }
86 87
87 @PostMapping("batchSend") 88 @PostMapping("batchSend")
88 - public ResultJson batchSend(@RequestBody MANIFEST_AIR_CHANGE manifest_air_change,@CookieValue("username") String username,@CookieValue("userid") String userid){  
89 - return mt8204Service.send(manifest_air_change,username) ? new ResultJson(ResponseReason.MT8204_SUCCESS) : new ResultJson(ResponseReason.MT8204_SEND_ERR); 89 + public ResultJson batchSend(@RequestBody List<String> autoIDlist, @CookieValue("username") String username, @CookieValue("userid") String userid){
  90 + ResultJson resultJson = mt8204Service.batchSend(autoIDlist,username);
  91 + return resultJson;
  92 +// : new ResultJson(ResponseReason.MT8204_SEND_ERR);
90 } 93 }
91 } 94 }
@@ -5,7 +5,8 @@ public enum ResponseReason { @@ -5,7 +5,8 @@ public enum ResponseReason {
5 MT8204_ADD_ERR("8204400","直接改配申请添加失败,存在重复申请,请检查后重试"), 5 MT8204_ADD_ERR("8204400","直接改配申请添加失败,存在重复申请,请检查后重试"),
6 MT8204_EDIT_ERR("8204401","直接改配申请更新失败"), 6 MT8204_EDIT_ERR("8204401","直接改配申请更新失败"),
7 MT8204_DEL_ERR("8204402","直接改配申请更新失败"), 7 MT8204_DEL_ERR("8204402","直接改配申请更新失败"),
8 - MT8204_SEND_ERR("8204404","直接改配发送失败"); 8 + MT8204_SEND_ERR("8204404","直接改配发送失败"),
  9 + MT8204_BATCH_SUCCESS("200","直接改配批量申请操作成功");
9 private String code; 10 private String code;
10 private String msg; 11 private String msg;
11 12
@@ -17,6 +17,8 @@ public interface MANIFEST_AIR_CHANGEMapper { @@ -17,6 +17,8 @@ public interface MANIFEST_AIR_CHANGEMapper {
17 17
18 List<MANIFEST_AIR_CHANGE> selectList(MANIFEST_AIR_CHANGE record); 18 List<MANIFEST_AIR_CHANGE> selectList(MANIFEST_AIR_CHANGE record);
19 19
  20 + List<MANIFEST_AIR_CHANGE> selectListByAutoIDS(List<String> idList);
  21 +
20 int updateByPrimaryKeySelective(MANIFEST_AIR_CHANGE record); 22 int updateByPrimaryKeySelective(MANIFEST_AIR_CHANGE record);
21 23
22 int updateByPrimaryKey(MANIFEST_AIR_CHANGE record); 24 int updateByPrimaryKey(MANIFEST_AIR_CHANGE record);
@@ -33,9 +33,9 @@ public class MANIFEST_AIR_CHANGE { @@ -33,9 +33,9 @@ public class MANIFEST_AIR_CHANGE {
33 //批量新增列表 33 //批量新增列表
34 private List<String> waybillList; 34 private List<String> waybillList;
35 35
36 - @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 36 + @JsonFormat(pattern = "yyyyMMdd", timezone = "GMT+8")
37 private Date flightDate; 37 private Date flightDate;
38 - @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") 38 + @JsonFormat(pattern = "yyyyMMdd", timezone = "GMT+8")
39 private Date changeFlightDate; 39 private Date changeFlightDate;
40 40
41 public String getAutoid() { 41 public String getAutoid() {
@@ -4,11 +4,16 @@ import com.github.pagehelper.PageInfo; @@ -4,11 +4,16 @@ import com.github.pagehelper.PageInfo;
4 import com.tianbo.analysis.model.DOMTRANSIT; 4 import com.tianbo.analysis.model.DOMTRANSIT;
5 import com.tianbo.analysis.model.LAND_BUSINEESTYPE_LIST_INFO; 5 import com.tianbo.analysis.model.LAND_BUSINEESTYPE_LIST_INFO;
6 import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE; 6 import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;
  7 +import com.tianbo.analysis.model.ResultJson;
  8 +
  9 +import java.util.List;
7 10
8 public interface MT8204Service { 11 public interface MT8204Service {
9 12
10 PageInfo<MANIFEST_AIR_CHANGE> selectList(MANIFEST_AIR_CHANGE record, int pageNum, int pageSize); 13 PageInfo<MANIFEST_AIR_CHANGE> selectList(MANIFEST_AIR_CHANGE record, int pageNum, int pageSize);
11 14
  15 + public List<MANIFEST_AIR_CHANGE> selectListByAutoIDS(List<String> autoIDlist);
  16 +
12 boolean add(MANIFEST_AIR_CHANGE record); 17 boolean add(MANIFEST_AIR_CHANGE record);
13 18
14 boolean edit(MANIFEST_AIR_CHANGE record); 19 boolean edit(MANIFEST_AIR_CHANGE record);
@@ -17,4 +22,6 @@ public interface MT8204Service { @@ -17,4 +22,6 @@ public interface MT8204Service {
17 22
18 boolean send(MANIFEST_AIR_CHANGE record,String username); 23 boolean send(MANIFEST_AIR_CHANGE record,String username);
19 24
  25 + ResultJson batchSend(List<String> autoIDlist, String username);
  26 +
20 } 27 }
@@ -5,9 +5,7 @@ import com.github.pagehelper.PageHelper; @@ -5,9 +5,7 @@ import com.github.pagehelper.PageHelper;
5 import com.github.pagehelper.PageInfo; 5 import com.github.pagehelper.PageInfo;
6 import com.tianbo.analysis.dao.MANIFEST_AIR_CHANGEMapper; 6 import com.tianbo.analysis.dao.MANIFEST_AIR_CHANGEMapper;
7 import com.tianbo.analysis.dao.SENDLOGMapper; 7 import com.tianbo.analysis.dao.SENDLOGMapper;
8 -import com.tianbo.analysis.model.CustomsHead;  
9 -import com.tianbo.analysis.model.MANIFEST_AIR_CHANGE;  
10 -import com.tianbo.analysis.model.SENDLOG; 8 +import com.tianbo.analysis.model.*;
11 import com.tianbo.analysis.service.MT8204Service; 9 import com.tianbo.analysis.service.MT8204Service;
12 import com.tianbo.util.Date.DateUtil; 10 import com.tianbo.util.Date.DateUtil;
13 import lombok.extern.slf4j.Slf4j; 11 import lombok.extern.slf4j.Slf4j;
@@ -75,6 +73,12 @@ public class MT8204ServiceImp implements MT8204Service { @@ -75,6 +73,12 @@ public class MT8204ServiceImp implements MT8204Service {
75 } 73 }
76 74
77 @Override 75 @Override
  76 + public List<MANIFEST_AIR_CHANGE> selectListByAutoIDS(List<String> autoIDlist){
  77 + List<MANIFEST_AIR_CHANGE> list = manifest_air_changeMapper.selectListByAutoIDS(autoIDlist);
  78 + return list;
  79 + }
  80 +
  81 + @Override
78 public boolean add(MANIFEST_AIR_CHANGE record) { 82 public boolean add(MANIFEST_AIR_CHANGE record) {
79 if (record.getWaybillList()!=null && !record.getWaybillList().isEmpty()){ 83 if (record.getWaybillList()!=null && !record.getWaybillList().isEmpty()){
80 int i=0; 84 int i=0;
@@ -191,6 +195,23 @@ public class MT8204ServiceImp implements MT8204Service { @@ -191,6 +195,23 @@ public class MT8204ServiceImp implements MT8204Service {
191 } 195 }
192 } 196 }
193 197
  198 + @Override
  199 + public ResultJson batchSend(List<String> autoIDlist, String username) {
  200 + ResultJson resultJson = new ResultJson();
  201 + String message = "";
  202 + List<MANIFEST_AIR_CHANGE> list = selectListByAutoIDS(autoIDlist);
  203 + for (MANIFEST_AIR_CHANGE manifestAirChange : list) {
  204 + boolean result = send(manifestAirChange,username);
  205 + if (!result){
  206 + message = message + manifestAirChange.getWaybillnomaster() +"发送失败\n";
  207 + }
  208 + }
  209 + resultJson.setCode("200");
  210 + resultJson.setMsg(message);
  211 + return resultJson;
  212 +
  213 + }
  214 +
194 public boolean validateXMLSchema(String xsdPath, String xmlStr) throws IOException { 215 public boolean validateXMLSchema(String xsdPath, String xmlStr) throws IOException {
195 ByteArrayInputStream bais = new ByteArrayInputStream(xmlStr.getBytes("UTF-8")); 216 ByteArrayInputStream bais = new ByteArrayInputStream(xmlStr.getBytes("UTF-8"));
196 try { 217 try {
@@ -77,6 +77,40 @@ @@ -77,6 +77,40 @@
77 </if> 77 </if>
78 order by CREATEDATE desc 78 order by CREATEDATE desc
79 </select> 79 </select>
  80 +
  81 + <select id="selectListByAutoIDS" resultMap="BaseResultMap" parameterType="java.util.List" >
  82 + SELECT
  83 + <include refid="Custom_Receipt" />
  84 + FROM
  85 + (
  86 + SELECT
  87 + <include refid="Custom_Receipt" />
  88 + FROM
  89 + (
  90 + SELECT
  91 + <include refid="Base_Column_List" />
  92 + FROM
  93 + MANIFEST_AIR_CHANGE
  94 + where AUTOID in
  95 + <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
  96 + #{item}
  97 + </foreach>
  98 + ) t1
  99 + LEFT JOIN (
  100 + SELECT
  101 + RECEIPTION,
  102 + MESSAGEAUTOID,
  103 + MESSAGETYPE,
  104 + ROW_NUMBER () OVER ( PARTITION BY MESSAGEAUTOID ORDER BY CREATEDATE DESC ) rn
  105 + FROM
  106 + SENDLOG
  107 + where
  108 + MESSAGETYPE = 'MT8204'
  109 + ) t2 ON t1.AUTOID = t2.MESSAGEAUTOID
  110 + AND t2.rn = 1
  111 + ) t3
  112 + order by CREATEDATE desc
  113 + </select>
80 <delete id="deleteByPrimaryKey" parameterType="java.lang.String" > 114 <delete id="deleteByPrimaryKey" parameterType="java.lang.String" >
81 delete from CGONMS.MANIFEST_AIR_CHANGE 115 delete from CGONMS.MANIFEST_AIR_CHANGE
82 where AUTOID = #{autoid,jdbcType=VARCHAR} 116 where AUTOID = #{autoid,jdbcType=VARCHAR}