Showing
10 changed files
with
261 additions
and
11 deletions
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
| 4 | -import com.erry.iclear.dateInterface.api.request.BasfConsignment; | 4 | +import com.arronlong.httpclientutil.HttpClientUtil; |
| 5 | -import com.erry.iclear.dateInterface.api.request.BasfMawb; | 5 | +import com.arronlong.httpclientutil.common.HttpConfig; |
| 6 | -import com.erry.iclear.dateInterface.api.request.Basfc; | 6 | +import com.arronlong.httpclientutil.common.HttpHeader; |
| 7 | -import com.erry.iclear.dateInterface.api.request.ConsignmentCode; | 7 | +import com.arronlong.httpclientutil.exception.HttpProcessException; |
| 8 | +import com.erry.iclear.dateInterface.api.request.*; | ||
| 8 | import com.erry.iclear.dateInterface.api.response.BasfResultRS; | 9 | import com.erry.iclear.dateInterface.api.response.BasfResultRS; |
| 9 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 10 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 11 | +import com.erry.iclear.dateInterface.entity.ChmConsignment; | ||
| 10 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 12 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; |
| 11 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 13 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| 14 | +import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; | ||
| 12 | import com.erry.iclear.dateInterface.service.*; | 15 | import com.erry.iclear.dateInterface.service.*; |
| 16 | +import com.erry.iclear.dateInterface.util.JsonToJava; | ||
| 13 | import com.erry.iclear.dateInterface.util.StringUtil; | 17 | import com.erry.iclear.dateInterface.util.StringUtil; |
| 14 | import com.google.gson.Gson; | 18 | import com.google.gson.Gson; |
| 15 | import io.swagger.annotations.ApiOperation; | 19 | import io.swagger.annotations.ApiOperation; |
| 16 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
| 21 | +import org.apache.http.Header; | ||
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 23 | +import org.springframework.beans.factory.annotation.Value; | ||
| 18 | import org.springframework.util.StopWatch; | 24 | import org.springframework.util.StopWatch; |
| 19 | import org.springframework.validation.annotation.Validated; | 25 | import org.springframework.validation.annotation.Validated; |
| 20 | import org.springframework.web.bind.annotation.*; | 26 | import org.springframework.web.bind.annotation.*; |
| ... | @@ -48,11 +54,18 @@ public class BasfDataInterface { | ... | @@ -48,11 +54,18 @@ public class BasfDataInterface { |
| 48 | @Autowired | 54 | @Autowired |
| 49 | private DeclearTaskService declearTaskService; | 55 | private DeclearTaskService declearTaskService; |
| 50 | 56 | ||
| 57 | + @Autowired | ||
| 58 | + private ChmConsignmentRepository chmConsignmentRepository; | ||
| 59 | + | ||
| 60 | + @Value("${api.address.iclear-submit-url}") | ||
| 61 | + String iclearCSubmitUrl; | ||
| 62 | + | ||
| 63 | + | ||
| 51 | @ApiOperation(value = "BASF推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawbBasf") | 64 | @ApiOperation(value = "BASF推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawbBasf") |
| 52 | @PostMapping("/sendMawbBasf") | 65 | @PostMapping("/sendMawbBasf") |
| 53 | @ResponseBody | 66 | @ResponseBody |
| 54 | public ResultRS sendMawbBasf(HttpServletRequest request | 67 | public ResultRS sendMawbBasf(HttpServletRequest request |
| 55 | - , @Validated @RequestBody Basfc basfc) { | 68 | + , @Validated @RequestBody Basfc basfc) throws HttpProcessException { |
| 56 | log.info("接收到请求数据consignmentCode:"+basfc.getConsignmentCode()+" data:" + gson.toJson(basfc)); | 69 | log.info("接收到请求数据consignmentCode:"+basfc.getConsignmentCode()+" data:" + gson.toJson(basfc)); |
| 57 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 70 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 58 | 71 | ||
| ... | @@ -115,6 +128,21 @@ public class BasfDataInterface { | ... | @@ -115,6 +128,21 @@ public class BasfDataInterface { |
| 115 | return result; | 128 | return result; |
| 116 | } | 129 | } |
| 117 | sw.stop(); | 130 | sw.stop(); |
| 131 | + ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime()); | ||
| 132 | + //调用IClear接口进行运单推送EXP002 | ||
| 133 | + String objJson = JsonToJava.toJson(chmGetId.getId()); | ||
| 134 | + Header[] headers = HttpHeader.custom() | ||
| 135 | + .other("Content-Type", "application/json") | ||
| 136 | + .build(); | ||
| 137 | + log.info("******************* : " + this.iclearCSubmitUrl); | ||
| 138 | + //推送海关回执数据 | ||
| 139 | + HttpConfig config = HttpConfig.custom() | ||
| 140 | + .headers(headers) | ||
| 141 | + .url(this.iclearCSubmitUrl) | ||
| 142 | + .encoding("utf-8") | ||
| 143 | + .json(objJson); | ||
| 144 | + String json = HttpClientUtil.post(config); | ||
| 145 | + log.info("<<<<<<<< checkbasfMawb start >>>>>>>>>> result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); | ||
| 118 | 146 | ||
| 119 | 147 | ||
| 120 | //5、更新日志 | 148 | //5、更新日志 |
| ... | @@ -195,4 +223,64 @@ public class BasfDataInterface { | ... | @@ -195,4 +223,64 @@ public class BasfDataInterface { |
| 195 | result.setCode("0"); | 223 | result.setCode("0"); |
| 196 | return result; | 224 | return result; |
| 197 | } | 225 | } |
| 226 | + | ||
| 227 | + @ApiOperation(value = "BASF获取回执信息", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/selectChmListBasf") | ||
| 228 | + @PostMapping("/selectChmListBasf") | ||
| 229 | + @ResponseBody | ||
| 230 | + public BasfResultRS selectChmListBasf(HttpServletRequest request | ||
| 231 | + , @Validated @RequestBody ConsignmentCode consignmentCode) throws Exception { | ||
| 232 | + log.info("接收到请求数据consignmentCode:"+consignmentCode.getConsignmentCode()+" data:" + gson.toJson(consignmentCode)); | ||
| 233 | + BasfResultRS result = new BasfResultRS(Boolean.FALSE,"","",""); | ||
| 234 | + //获取请求的运单号 | ||
| 235 | + String[] splitConsignment = StringUtil.split(consignmentCode.getConsignmentCode(),","); | ||
| 236 | + if(splitConsignment.length > 20){ | ||
| 237 | + result.setCode("30001"); | ||
| 238 | + result.setMsg("请求信息不能大于20条运单"); | ||
| 239 | + return result; | ||
| 240 | + } | ||
| 241 | + if(splitConsignment.length<1){ | ||
| 242 | + result.setCode("-7"); | ||
| 243 | + result.setMsg("请求信息不能为空"); | ||
| 244 | + return result; | ||
| 245 | + } | ||
| 246 | + StopWatch sw = new StopWatch("receice mawbBasf"); | ||
| 247 | + sw.start("save log"); | ||
| 248 | + | ||
| 249 | + String appId=(String) request.getHeader("Appid"); | ||
| 250 | + String appKey=(String) request.getHeader("Appkey"); | ||
| 251 | + String timeStamp=(String) request.getHeader("TimeStamp"); | ||
| 252 | + //记录请求的运单 | ||
| 253 | + IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogCselect(consignmentCode.getConsignmentCode(),appId,appKey,new Date(Long.valueOf(timeStamp)))); | ||
| 254 | + //查询请求需要得运单申报信息 | ||
| 255 | + //List<DeclaredInfo> declaredInfos = declaredInfoService.selectDeclaredInfo(splitConsignment); | ||
| 256 | + List<BasfcReceipt> chmConsignments = chmConsignmentService.getConsignmentCode(splitConsignment); | ||
| 257 | + //构造返回数据 | ||
| 258 | + //List<BasfConsignment> basfConsignments = basfConsignmentService.basfConsignmentList(declaredInfos); | ||
| 259 | + //返回申报数据 | ||
| 260 | + if(chmConsignments.size() > 0){ | ||
| 261 | + result.setSuccess(Boolean.TRUE); | ||
| 262 | + result.setConsignmentList(JSON.toJSONString(chmConsignments)); | ||
| 263 | + result.setMsg("操作成功!"); | ||
| 264 | + }else{ | ||
| 265 | + result.setSuccess(Boolean.TRUE); | ||
| 266 | + result.setMsg("操作成功,无回执数据!"); | ||
| 267 | + } | ||
| 268 | + //更新记录的请求信息 | ||
| 269 | + if(!Objects.equals(saveIClearApiLogResult,null)){ | ||
| 270 | + saveIClearApiLogResult.setReceiveResult(result.getSuccess().toString()); | ||
| 271 | + saveIClearApiLogResult.setErrorCode(result.getCode()); | ||
| 272 | + saveIClearApiLogResult.setResponseTime(new Date()); | ||
| 273 | + saveIClearApiLogResult.setSpendTime(sw.getTotalTimeMillis()); | ||
| 274 | + iClearApiLogService.updateIClearApiLog(saveIClearApiLogResult); | ||
| 275 | + } | ||
| 276 | + //记录返回的申报数据记录 | ||
| 277 | + if(result.getSuccess()){ | ||
| 278 | + declearTaskService.insertChmTask(chmConsignments, saveIClearApiLogResult.getMsgId()); | ||
| 279 | + } | ||
| 280 | + log.info("BASF回执数据请求成功!"); | ||
| 281 | + //6、return result | ||
| 282 | + result.setSuccess(Boolean.TRUE); | ||
| 283 | + result.setCode("0"); | ||
| 284 | + return result; | ||
| 285 | + } | ||
| 198 | } | 286 | } | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.api.request; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 5 | +import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | + | ||
| 8 | +import java.io.Serializable; | ||
| 9 | +import java.util.Date; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * BASF回执数据构造 xjq 2021年11月16日 | ||
| 13 | + */ | ||
| 14 | +public class BasfcReceipt implements Serializable { | ||
| 15 | + | ||
| 16 | + @Autowired | ||
| 17 | + private DictionaryEntriesRepository dictionaryEntriesRepository; | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 运单ID | ||
| 21 | + */ | ||
| 22 | + private Long consignmentId; | ||
| 23 | + /** | ||
| 24 | + * 运单号 | ||
| 25 | + */ | ||
| 26 | + private String consignmentCode; | ||
| 27 | + /** | ||
| 28 | + * 运单类型 | ||
| 29 | + */ | ||
| 30 | + private String consignmentType; | ||
| 31 | + /** | ||
| 32 | + * 回执状态(状态码) | ||
| 33 | + */ | ||
| 34 | + private String customsReceiptStatus; | ||
| 35 | + /** | ||
| 36 | + * 回执状态时间 | ||
| 37 | + */ | ||
| 38 | + private Date customsReceiptTime; | ||
| 39 | + | ||
| 40 | + public Long getConsignmentId() { | ||
| 41 | + return consignmentId; | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + public void setConsignmentId(Long consignmentId) { | ||
| 45 | + this.consignmentId = consignmentId; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + public String getConsignmentCode() { | ||
| 49 | + return consignmentCode; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void setConsignmentCode(String consignmentCode) { | ||
| 53 | + this.consignmentCode = consignmentCode; | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + public String getConsignmentType() { | ||
| 57 | + return consignmentType; | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + public void setConsignmentType(String consignmentType) { | ||
| 61 | + /*DictionaryEntries dictionaryEntriesByCode = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); | ||
| 62 | + if (consignmentType.equals(dictionaryEntriesByCode.getChineseName())){ | ||
| 63 | + this.consignmentType = consignmentType; | ||
| 64 | + }*/ | ||
| 65 | + this.consignmentType = "C"; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + public String getCustomsReceiptStatus() { | ||
| 69 | + return customsReceiptStatus; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + public void setCustomsReceiptStatus(String customsReceiptStatus) { | ||
| 73 | + this.customsReceiptStatus = customsReceiptStatus; | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + public Date getCustomsReceiptTime() { | ||
| 77 | + return customsReceiptTime; | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public void setCustomsReceiptTime(Date customsReceiptTime) { | ||
| 81 | + this.customsReceiptTime = customsReceiptTime; | ||
| 82 | + } | ||
| 83 | +} |
| ... | @@ -39,4 +39,12 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo | ... | @@ -39,4 +39,12 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo |
| 39 | */ | 39 | */ |
| 40 | @Query( nativeQuery = true,value ="select * from T_CHM_CONSIGNMENT where ID = ?1 " ) | 40 | @Query( nativeQuery = true,value ="select * from T_CHM_CONSIGNMENT where ID = ?1 " ) |
| 41 | public ChmConsignment findChmConsignmentById(Long id); | 41 | public ChmConsignment findChmConsignmentById(Long id); |
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 根据运单号查询最新的运单(回执信息) | ||
| 45 | + */ | ||
| 46 | + @Query( nativeQuery = true,value = "select ID,CONSIGNMENT_CODE,CUSTOMS_RECEIPT,CONS_TYPE,CUSTOMS_RECEIPT_TIME from T_CHM_CONSIGNMENT where ID IN(\n" + | ||
| 47 | + "select MAX(ID)as ID from T_CHM_CONSIGNMENT \n" + | ||
| 48 | + "where CONS_TYPE_ID = ?2 and CUSTOMS_RECEIPT is not null AND CONSIGNMENT_CODE IN ?1 GROUP BY CONSIGNMENT_CODE)") | ||
| 49 | + public List<Object[]> findChmByConsignmentCode(List<String> consignmentCode, Long consTypeId); | ||
| 42 | } | 50 | } | ... | ... |
| ... | @@ -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 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 CONSIGNMENT_CODE IN ?1 group by CONSIGNMENT_CODE)") |
| 24 | - public List<DeclaredInfo> getDeclaredInfoByAll(List<String> consignmentCodeList); | 24 | + public List<DeclaredInfo> getDeclaredInfoByAll(List<String> consignmentCodeList,Long consTypeId); |
| 25 | } | 25 | } | ... | ... |
| ... | @@ -143,6 +143,7 @@ public class BasfService { | ... | @@ -143,6 +143,7 @@ public class BasfService { |
| 143 | String json = HttpClientUtil.post(config); | 143 | String json = HttpClientUtil.post(config); |
| 144 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); | 144 | IClearCheckResponseResult iclearCheckResponseResult = JsonToJava.parseJson(json, IClearCheckResponseResult.class); |
| 145 | result.setSuccess(iclearCheckResponseResult.getSuccess()); | 145 | result.setSuccess(iclearCheckResponseResult.getSuccess()); |
| 146 | + result.setCode(iclearCheckResponseResult.getCode()); | ||
| 146 | result.setMsg(iclearCheckResponseResult.getMessage()); | 147 | result.setMsg(iclearCheckResponseResult.getMessage()); |
| 147 | log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(basfMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); | 148 | log.info("<<<<<<<< checkMawb start >>>>>>>>>> mawb:"+gson.toJson(basfMawb) +" result :" +result.getSuccess() +" iclear check response : " + json + " status : " + result.getSuccess()); |
| 148 | }catch (Exception e){ | 149 | }catch (Exception e){ | ... | ... |
| ... | @@ -2,6 +2,7 @@ package com.erry.iclear.dateInterface.service; | ... | @@ -2,6 +2,7 @@ package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | //import cn.hutool.core.date.DateUtil; | 3 | //import cn.hutool.core.date.DateUtil; |
| 4 | import com.erry.iclear.dateInterface.api.request.BasfMawb; | 4 | import com.erry.iclear.dateInterface.api.request.BasfMawb; |
| 5 | +import com.erry.iclear.dateInterface.api.request.BasfcReceipt; | ||
| 5 | import com.erry.iclear.dateInterface.api.request.Mawb; | 6 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 6 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 7 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 7 | import com.erry.iclear.dateInterface.common.Constant; | 8 | import com.erry.iclear.dateInterface.common.Constant; |
| ... | @@ -20,6 +21,8 @@ import org.springframework.stereotype.Service; | ... | @@ -20,6 +21,8 @@ import org.springframework.stereotype.Service; |
| 20 | 21 | ||
| 21 | import javax.transaction.Transactional; | 22 | import javax.transaction.Transactional; |
| 22 | import java.math.BigDecimal; | 23 | import java.math.BigDecimal; |
| 24 | +import java.text.ParseException; | ||
| 25 | +import java.text.SimpleDateFormat; | ||
| 23 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
| 24 | import java.util.Date; | 27 | import java.util.Date; |
| 25 | import java.util.List; | 28 | import java.util.List; |
| ... | @@ -42,6 +45,9 @@ public class ChmConsignmentService { | ... | @@ -42,6 +45,9 @@ public class ChmConsignmentService { |
| 42 | @Autowired | 45 | @Autowired |
| 43 | private DictionaryEntriesRepository dictionaryEntriesRepository; | 46 | private DictionaryEntriesRepository dictionaryEntriesRepository; |
| 44 | 47 | ||
| 48 | + @Autowired | ||
| 49 | + private DeclaredInfoService declaredInfoService; | ||
| 50 | + | ||
| 45 | /** | 51 | /** |
| 46 | * 转换主单 | 52 | * 转换主单 |
| 47 | * @return | 53 | * @return |
| ... | @@ -624,4 +630,28 @@ public class ChmConsignmentService { | ... | @@ -624,4 +630,28 @@ public class ChmConsignmentService { |
| 624 | result.setSuccess(Boolean.TRUE); | 630 | result.setSuccess(Boolean.TRUE); |
| 625 | return result; | 631 | return result; |
| 626 | } | 632 | } |
| 633 | + | ||
| 634 | + public List<BasfcReceipt> getConsignmentCode(String[] consignmentCode) throws ParseException { | ||
| 635 | + DictionaryEntries consTypeC = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); | ||
| 636 | + List<String> stringList = declaredInfoService.stringList(consignmentCode); | ||
| 637 | + List<Object[]> chmByConsignmentCode = chmConsignmentRepository.findChmByConsignmentCode(stringList, consTypeC.getId()); | ||
| 638 | + List<BasfcReceipt> basfcReceiptList = new ArrayList<>(); | ||
| 639 | + if(chmByConsignmentCode.size()>0){ | ||
| 640 | + for (int i = 0; i < chmByConsignmentCode.size(); i++) { | ||
| 641 | + Object[] objs = chmByConsignmentCode.get(i); | ||
| 642 | + BasfcReceipt basfcReceipt = new BasfcReceipt(); | ||
| 643 | + basfcReceipt.setConsignmentId(Long.valueOf(objs[0].toString())); | ||
| 644 | + basfcReceipt.setConsignmentCode(objs[1].toString()); | ||
| 645 | + basfcReceipt.setConsignmentType("C"); | ||
| 646 | + basfcReceipt.setCustomsReceiptStatus(objs[2].toString()); | ||
| 647 | + SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss"); | ||
| 648 | + String str = objs[4].toString(); | ||
| 649 | + System.out.println(str); | ||
| 650 | + Date date = sdf.parse(objs[4].toString()); | ||
| 651 | + basfcReceipt.setCustomsReceiptTime(date); | ||
| 652 | + basfcReceiptList.add(basfcReceipt); | ||
| 653 | + } | ||
| 654 | + } | ||
| 655 | + return basfcReceiptList; | ||
| 656 | + } | ||
| 627 | } | 657 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 3 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; | 4 | import com.erry.iclear.dateInterface.entity.DeclaredInfo; |
| 5 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 4 | import com.erry.iclear.dateInterface.repository.DeclaredInfoRepository; | 6 | import com.erry.iclear.dateInterface.repository.DeclaredInfoRepository; |
| 7 | +import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | ||
| 5 | import lombok.extern.slf4j.Slf4j; | 8 | import lombok.extern.slf4j.Slf4j; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.stereotype.Service; | 10 | import org.springframework.stereotype.Service; |
| ... | @@ -21,16 +24,25 @@ public class DeclaredInfoService { | ... | @@ -21,16 +24,25 @@ public class DeclaredInfoService { |
| 21 | @Autowired | 24 | @Autowired |
| 22 | private DeclaredInfoRepository declaredInfoRepository; | 25 | private DeclaredInfoRepository declaredInfoRepository; |
| 23 | 26 | ||
| 27 | + @Autowired | ||
| 28 | + private DictionaryEntriesRepository dictionaryEntriesRepository; | ||
| 29 | + | ||
| 24 | public List<DeclaredInfo> selectDeclaredInfo(String[] consignmentCode){ | 30 | public List<DeclaredInfo> selectDeclaredInfo(String[] consignmentCode){ |
| 25 | List<DeclaredInfo> DeclaredInfo = new ArrayList<>(); | 31 | List<DeclaredInfo> DeclaredInfo = new ArrayList<>(); |
| 32 | + DictionaryEntries consTypeC = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_C); | ||
| 33 | + List<String> consignmentCodeList = stringList(consignmentCode); | ||
| 34 | + DeclaredInfo = declaredInfoRepository.getDeclaredInfoByAll(consignmentCodeList,consTypeC.getId()); | ||
| 35 | + return DeclaredInfo; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public List<String> stringList(String[] consignmentCode){ | ||
| 26 | List consignmentCodeList = new ArrayList(); | 39 | List consignmentCodeList = new ArrayList(); |
| 27 | if(consignmentCode.length>0){ | 40 | if(consignmentCode.length>0){ |
| 28 | for(int i = 0; i < consignmentCode.length; i++){ | 41 | for(int i = 0; i < consignmentCode.length; i++){ |
| 29 | consignmentCodeList.add(consignmentCode[i]); | 42 | consignmentCodeList.add(consignmentCode[i]); |
| 30 | } | 43 | } |
| 31 | } | 44 | } |
| 32 | - DeclaredInfo = declaredInfoRepository.getDeclaredInfoByAll(consignmentCodeList); | 45 | + return consignmentCodeList; |
| 33 | - return DeclaredInfo; | ||
| 34 | } | 46 | } |
| 35 | 47 | ||
| 36 | } | 48 | } | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | import com.erry.iclear.dateInterface.api.request.BasfConsignment; | 3 | import com.erry.iclear.dateInterface.api.request.BasfConsignment; |
| 4 | +import com.erry.iclear.dateInterface.api.request.BasfcReceipt; | ||
| 4 | import com.erry.iclear.dateInterface.common.BaseModel; | 5 | import com.erry.iclear.dateInterface.common.BaseModel; |
| 5 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 6 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 6 | import com.erry.iclear.dateInterface.entity.DeclearTask; | 7 | import com.erry.iclear.dateInterface.entity.DeclearTask; |
| ... | @@ -51,4 +52,29 @@ public class DeclearTaskService{ | ... | @@ -51,4 +52,29 @@ public class DeclearTaskService{ |
| 51 | } | 52 | } |
| 52 | 53 | ||
| 53 | } | 54 | } |
| 55 | + | ||
| 56 | + public void insertChmTask(List<BasfcReceipt> basfConsignments, Long logId) throws Exception { | ||
| 57 | + List<DeclearTask> declareTaskList = new ArrayList<>(); | ||
| 58 | + try{ | ||
| 59 | + if (basfConsignments.size()>0){ | ||
| 60 | + for (BasfcReceipt basfConsignment : basfConsignments) { | ||
| 61 | + DeclearTask declareTask = new DeclearTask(); | ||
| 62 | + declareTask.setChmsignmentId(BigDecimal.valueOf(basfConsignment.getConsignmentId())); | ||
| 63 | + declareTask.setChmsignmentCode(basfConsignment.getConsignmentCode()); | ||
| 64 | + declareTask.setOperationTime(new Date()); | ||
| 65 | + declareTask.setFileType("2"); | ||
| 66 | + declareTask.setOperationName("root"); | ||
| 67 | + declareTask.setDataSource(String.valueOf(3)); | ||
| 68 | + declareTask.setResponseTime(new Date()); | ||
| 69 | + declareTask.setResponseResults("true"); | ||
| 70 | + declareTask.setDecelearInfoId(String.valueOf(logId)); | ||
| 71 | + declareTaskList.add(declareTask); | ||
| 72 | + } | ||
| 73 | + declareTaskRepository.saveAll(declareTaskList); | ||
| 74 | + } | ||
| 75 | + }catch (Exception e){ | ||
| 76 | + e.printStackTrace(); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + } | ||
| 54 | } | 80 | } | ... | ... |
| ... | @@ -84,7 +84,7 @@ public class IClearApiLogService { | ... | @@ -84,7 +84,7 @@ public class IClearApiLogService { |
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | /** | 86 | /** |
| 87 | - * BASF请求申报数据-添加日志 2021年11月3日 xjq | 87 | + * BASF请求申报/回执数据-添加日志 2021年11月3日 xjq |
| 88 | * @return | 88 | * @return |
| 89 | */ | 89 | */ |
| 90 | public IClearApiLog convertToIClearApiLogCselect(String basfc, String appId, String appKey, Date pushTime){ | 90 | public IClearApiLog convertToIClearApiLogCselect(String basfc, String appId, String appKey, Date pushTime){ | ... | ... |
| ... | @@ -27,8 +27,10 @@ api: | ... | @@ -27,8 +27,10 @@ api: |
| 27 | address: | 27 | address: |
| 28 | #IClear校验运单地址 | 28 | #IClear校验运单地址 |
| 29 | iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD | 29 | iclear-check-url: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliD |
| 30 | + #IClearC类提交运单地址 | ||
| 31 | + iclear-submit-url: http://localhost:8080/chmConsignmentController/submitConsignments | ||
| 30 | #IClear校验C类运单地址 | 32 | #IClear校验C类运单地址 |
| 31 | - iclear-check-url-c: http://139.217.114.139:8082/chmConsignmentController/checkChmAndDetaliC | 33 | + iclear-check-url-c: http://localhost:8080/chmConsignmentController/checkChmAndDetaliC |
| 32 | #获取token地址 | 34 | #获取token地址 |
| 33 | token-url: https://apiuat.iclrccd-fedex.com/login | 35 | token-url: https://apiuat.iclrccd-fedex.com/login |
| 34 | #刷新token地址 | 36 | #刷新token地址 | ... | ... |
-
Please register or login to post a comment