Jiaqi.xu

basf接口返回数据调整

1 package com.erry.iclear.dateInterface.api; 1 package com.erry.iclear.dateInterface.api;
2 2
3 -import com.alibaba.fastjson.JSON; 3 +
4 import com.arronlong.httpclientutil.HttpClientUtil; 4 import com.arronlong.httpclientutil.HttpClientUtil;
5 import com.arronlong.httpclientutil.common.HttpConfig; 5 import com.arronlong.httpclientutil.common.HttpConfig;
6 import com.arronlong.httpclientutil.common.HttpHeader; 6 import com.arronlong.httpclientutil.common.HttpHeader;
7 import com.arronlong.httpclientutil.exception.HttpProcessException; 7 import com.arronlong.httpclientutil.exception.HttpProcessException;
8 import com.erry.iclear.dateInterface.api.request.*; 8 import com.erry.iclear.dateInterface.api.request.*;
9 +import com.erry.iclear.dateInterface.api.response.BasfResultChmRS;
9 import com.erry.iclear.dateInterface.api.response.BasfResultRS; 10 import com.erry.iclear.dateInterface.api.response.BasfResultRS;
10 import com.erry.iclear.dateInterface.api.response.ResultRS; 11 import com.erry.iclear.dateInterface.api.response.ResultRS;
11 import com.erry.iclear.dateInterface.entity.ChmConsignment; 12 import com.erry.iclear.dateInterface.entity.ChmConsignment;
...@@ -168,10 +169,10 @@ public class BasfDataInterface { ...@@ -168,10 +169,10 @@ public class BasfDataInterface {
168 @ApiOperation(value = "BASF获取申报信息", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/selectDecListBasf") 169 @ApiOperation(value = "BASF获取申报信息", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/selectDecListBasf")
169 @PostMapping("/selectDecListBasf") 170 @PostMapping("/selectDecListBasf")
170 @ResponseBody 171 @ResponseBody
171 - public BasfResultRS selectDecListBasf(HttpServletRequest request 172 + public BasfResultChmRS selectDecListBasf(HttpServletRequest request
172 , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { 173 , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception {
173 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); 174 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode));
174 - BasfResultRS result = new BasfResultRS(Boolean.FALSE,"","",""); 175 + BasfResultChmRS result = new BasfResultChmRS(Boolean.FALSE,"","",null);
175 //获取请求的运单号 176 //获取请求的运单号
176 String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); 177 String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),",");
177 if(splitConsignment.length > 20){ 178 if(splitConsignment.length > 20){
...@@ -199,7 +200,7 @@ public class BasfDataInterface { ...@@ -199,7 +200,7 @@ public class BasfDataInterface {
199 //返回申报数据 200 //返回申报数据
200 if(basfConsignments.size() > 0){ 201 if(basfConsignments.size() > 0){
201 result.setSuccess(Boolean.TRUE); 202 result.setSuccess(Boolean.TRUE);
202 - result.setConsignmentList(JSON.toJSONString(basfConsignments)); 203 + result.setConsignmentList(basfConsignments);
203 result.setMsg("操作成功!"); 204 result.setMsg("操作成功!");
204 }else{ 205 }else{
205 result.setSuccess(Boolean.TRUE); 206 result.setSuccess(Boolean.TRUE);
...@@ -230,7 +231,7 @@ public class BasfDataInterface { ...@@ -230,7 +231,7 @@ public class BasfDataInterface {
230 public BasfResultRS selectChmListBasf(HttpServletRequest request 231 public BasfResultRS selectChmListBasf(HttpServletRequest request
231 , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { 232 , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception {
232 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); 233 log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode));
233 - BasfResultRS result = new BasfResultRS(Boolean.FALSE,"","",""); 234 + BasfResultRS result = new BasfResultRS(Boolean.FALSE,"","",null);
234 //获取请求的运单号 235 //获取请求的运单号
235 String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); 236 String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),",");
236 if(splitConsignment.length > 20){ 237 if(splitConsignment.length > 20){
...@@ -259,7 +260,7 @@ public class BasfDataInterface { ...@@ -259,7 +260,7 @@ public class BasfDataInterface {
259 //返回申报数据 260 //返回申报数据
260 if(chmConsignments.size() > 0){ 261 if(chmConsignments.size() > 0){
261 result.setSuccess(Boolean.TRUE); 262 result.setSuccess(Boolean.TRUE);
262 - result.setConsignmentList(JSON.toJSONString(chmConsignments)); 263 + result.setConsignmentList(chmConsignments);
263 result.setMsg("操作成功!"); 264 result.setMsg("操作成功!");
264 }else{ 265 }else{
265 result.setSuccess(Boolean.TRUE); 266 result.setSuccess(Boolean.TRUE);
......
1 +package com.erry.iclear.dateInterface.api.response;
2 +
3 +
4 +import com.erry.iclear.dateInterface.api.request.BasfConsignment;
5 +import lombok.AllArgsConstructor;
6 +import lombok.Data;
7 +
8 +import java.io.Serializable;
9 +import java.util.List;
10 +
11 +/**
12 + * @author Administrator
13 + */
14 +@Data
15 +@AllArgsConstructor
16 +public class BasfResultChmRS implements Serializable {
17 +
18 + //成功标识
19 + private Boolean success = true;
20 + private String code;
21 +
22 + //错误信息
23 + private String msg;
24 + //Object data;
25 + private List<BasfConsignment> consignmentList;
26 +
27 +}
1 package com.erry.iclear.dateInterface.api.response; 1 package com.erry.iclear.dateInterface.api.response;
2 2
3 +import com.erry.iclear.dateInterface.api.request.BasfConsignment;
4 +import com.erry.iclear.dateInterface.api.request.BasfcReceipt;
3 import lombok.AllArgsConstructor; 5 import lombok.AllArgsConstructor;
4 import lombok.Data; 6 import lombok.Data;
5 7
6 import java.io.Serializable; 8 import java.io.Serializable;
9 +import java.util.List;
7 10
8 /** 11 /**
9 * @author Administrator 12 * @author Administrator
...@@ -19,6 +22,6 @@ public class BasfResultRS implements Serializable { ...@@ -19,6 +22,6 @@ public class BasfResultRS implements Serializable {
19 //错误信息 22 //错误信息
20 private String msg; 23 private String msg;
21 //Object data; 24 //Object data;
22 - private String consignmentList; 25 + private List<BasfcReceipt> consignmentList;
23 26
24 } 27 }
......
...@@ -20,6 +20,6 @@ public interface DeclaredInfoRepository extends JpaRepository<DeclaredInfo, Inte ...@@ -20,6 +20,6 @@ public interface DeclaredInfoRepository extends JpaRepository<DeclaredInfo, Inte
20 * 根据运单号在申报数据表中查询数据 20 * 根据运单号在申报数据表中查询数据
21 * @return 21 * @return
22 */ 22 */
23 - @Query(nativeQuery = true, value = "select * from T_DECLARED_INFO where CONSIGNMENT_ID IN (SELECT MAX(ID)AS ID FROM T_CHM_CONSIGNMENT WHERE T_CHM_CONSIGNMENT.CONS_TYPE_ID = ?2 CONSIGNMENT_CODE IN ?1 group by CONSIGNMENT_CODE)") 23 + @Query(nativeQuery = true, value = "select * from T_DECLARED_INFO where CONSIGNMENT_ID IN (SELECT MAX(ID)AS ID FROM T_CHM_CONSIGNMENT WHERE T_CHM_CONSIGNMENT.CONS_TYPE_ID = ?2 and CONSIGNMENT_CODE IN ?1 group by CONSIGNMENT_CODE)")
24 public List<DeclaredInfo> getDeclaredInfoByAll(List<String> consignmentCodeList,Long consTypeId); 24 public List<DeclaredInfo> getDeclaredInfoByAll(List<String> consignmentCodeList,Long consTypeId);
25 } 25 }
......