Merge branches 'API-2023-07-30-bug' and 'master' of http://118.178.128.178//Fedex/iClear-api
Conflicts: src/main/java/com/erry/iclear/dateInterface/service/ApiService.java
Showing
25 changed files
with
688 additions
and
84 deletions
| ... | @@ -49,6 +49,26 @@ md5 小写 16位 | ... | @@ -49,6 +49,26 @@ md5 小写 16位 |
| 49 | IKNOWUiClearExportCTest | 49 | IKNOWUiClearExportCTest |
| 50 | IKNOWUiClearExportCProd | 50 | IKNOWUiClearExportCProd |
| 51 | 51 | ||
| 52 | +RunaTong的Secret | ||
| 53 | +md5 小写 16位 | ||
| 54 | +明文: | ||
| 55 | + RunaTongiClearExportCDev | ||
| 56 | + RunaTongiClearExportCTest | ||
| 57 | + RunaTongiClearExportCProd | ||
| 58 | + | ||
| 59 | +fsyingde的Secret | ||
| 60 | +md5 小写 16位 | ||
| 61 | +明文: | ||
| 62 | + fsyingdeiClearExportCDev | ||
| 63 | + fsyingdeiClearExportCTest | ||
| 64 | + fsyingdeiClearExportCProd | ||
| 65 | + | ||
| 66 | +SCMHOME的Secret | ||
| 67 | +md5 小写 16位 | ||
| 68 | +明文: | ||
| 69 | + SCMHOMEiClearExportCDev | ||
| 70 | + SCMHOMEiClearExportCTest | ||
| 71 | + SCMHOMEiClearExportCProd | ||
| 52 | 72 | ||
| 53 | 1、接口数据模型调研 2 | 73 | 1、接口数据模型调研 2 |
| 54 | 2、设计数据接口 2 | 74 | 2、设计数据接口 2 | ... | ... |
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | -import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 4 | import com.erry.iclear.dateInterface.api.request.Mawb; | 3 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 5 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 6 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 5 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| 6 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 7 | import com.erry.iclear.dateInterface.repository.MawbAdd; | 7 | import com.erry.iclear.dateInterface.repository.MawbAdd; |
| 8 | import com.erry.iclear.dateInterface.service.*; | 8 | import com.erry.iclear.dateInterface.service.*; |
| 9 | import com.erry.iclear.dateInterface.util.StringUtil; | 9 | import com.erry.iclear.dateInterface.util.StringUtil; |
| ... | @@ -16,7 +16,9 @@ import org.springframework.validation.annotation.Validated; | ... | @@ -16,7 +16,9 @@ import org.springframework.validation.annotation.Validated; |
| 16 | import org.springframework.web.bind.annotation.*; | 16 | import org.springframework.web.bind.annotation.*; |
| 17 | 17 | ||
| 18 | import javax.servlet.http.HttpServletRequest; | 18 | import javax.servlet.http.HttpServletRequest; |
| 19 | -import java.util.*; | 19 | +import java.util.Date; |
| 20 | +import java.util.Map; | ||
| 21 | +import java.util.Objects; | ||
| 20 | 22 | ||
| 21 | /** | 23 | /** |
| 22 | * @author Administrator | 24 | * @author Administrator |
| ... | @@ -74,7 +76,12 @@ public class CustomsDataInterface { | ... | @@ -74,7 +76,12 @@ public class CustomsDataInterface { |
| 74 | String appKey=(String) request.getHeader("Appkey"); | 76 | String appKey=(String) request.getHeader("Appkey"); |
| 75 | String timeStamp=(String) request.getHeader("TimeStamp"); | 77 | String timeStamp=(String) request.getHeader("TimeStamp"); |
| 76 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp)))); | 78 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,new Date(Long.valueOf(timeStamp)))); |
| 77 | - | 79 | + String checkUser = mawbService.checkUser(appId); |
| 80 | + if (!StringUtil.isEmpty(checkUser)){ | ||
| 81 | + result.setCode(ErrorCodeEnum.ERROR_30003.getCode()); | ||
| 82 | + result.setMsg(checkUser); | ||
| 83 | + return result; | ||
| 84 | + } | ||
| 78 | mawb.setAppId(appId); | 85 | mawb.setAppId(appId); |
| 79 | if(!Objects.equals(saveIClearApiLogResult,null)){ | 86 | if(!Objects.equals(saveIClearApiLogResult,null)){ |
| 80 | log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); | 87 | log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); |
| ... | @@ -108,13 +115,20 @@ public class CustomsDataInterface { | ... | @@ -108,13 +115,20 @@ public class CustomsDataInterface { |
| 108 | } | 115 | } |
| 109 | sw.stop(); | 116 | sw.stop(); |
| 110 | 117 | ||
| 118 | + //校验单据币制 | ||
| 119 | + result = mawbService.checkCurrency(mawb); | ||
| 120 | + if(!result.getSuccess()){ | ||
| 121 | + return result; | ||
| 122 | + } | ||
| 123 | + | ||
| 111 | 124 | ||
| 112 | //2、TODO 校验主单 | 125 | //2、TODO 校验主单 |
| 113 | sw.start("checkMawb"); | 126 | sw.start("checkMawb"); |
| 114 | - result=mawbService.checkMawb(mawb); | 127 | + result=mawbService.checkMawb(mawb,appId); |
| 115 | if(!result.getSuccess()){ | 128 | if(!result.getSuccess()){ |
| 116 | return result; | 129 | return result; |
| 117 | } | 130 | } |
| 131 | + | ||
| 118 | sw.stop(); | 132 | sw.stop(); |
| 119 | 133 | ||
| 120 | // //3、TODO 校验子单 | 134 | // //3、TODO 校验子单 | ... | ... |
| ... | @@ -36,6 +36,9 @@ public class FedexDataInterface { | ... | @@ -36,6 +36,9 @@ public class FedexDataInterface { |
| 36 | private FedexService fedexService; | 36 | private FedexService fedexService; |
| 37 | 37 | ||
| 38 | @Autowired | 38 | @Autowired |
| 39 | + private MawbService mawbService; | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 39 | private ChmConsignmentService chmConsignmentService; | 42 | private ChmConsignmentService chmConsignmentService; |
| 40 | 43 | ||
| 41 | @Autowired | 44 | @Autowired |
| ... | @@ -98,10 +101,16 @@ public class FedexDataInterface { | ... | @@ -98,10 +101,16 @@ public class FedexDataInterface { |
| 98 | sw.start("generate FedexMawb"); | 101 | sw.start("generate FedexMawb"); |
| 99 | fedexc.setAppId(appId); | 102 | fedexc.setAppId(appId); |
| 100 | FedexMawb saveMawbFedexResult = fedexService.generateFedexMawb(fedexc); | 103 | FedexMawb saveMawbFedexResult = fedexService.generateFedexMawb(fedexc); |
| 104 | + | ||
| 105 | + //检验运单币制是否有效 | ||
| 106 | + ResultRS resultRS = mawbService.checkCurrency(saveMawbFedexResult); | ||
| 107 | + if(!resultRS.getSuccess()){ | ||
| 108 | + return resultRS; | ||
| 109 | + } | ||
| 101 | sw.stop(); | 110 | sw.stop(); |
| 102 | 111 | ||
| 103 | sw.start("checkFedexMawb"); | 112 | sw.start("checkFedexMawb"); |
| 104 | - ResultRS iclearCheckRs = fedexService.checkFedexMawb(saveMawbFedexResult,appInfo); | 113 | + ResultRS iclearCheckRs = fedexService.checkFedexMawb(saveMawbFedexResult,appInfo,appId); |
| 105 | //返回结果 | 114 | //返回结果 |
| 106 | ResultRS result = new ResultRS(Boolean.TRUE,ErrorCodeEnum.SUCCESS.getCode(),null,null); | 115 | ResultRS result = new ResultRS(Boolean.TRUE,ErrorCodeEnum.SUCCESS.getCode(),null,null); |
| 107 | if(nonEmptyCheck.getSuccess() && iclearCheckRs.getSuccess()){ | 116 | if(nonEmptyCheck.getSuccess() && iclearCheckRs.getSuccess()){ |
| ... | @@ -157,7 +166,12 @@ public class FedexDataInterface { | ... | @@ -157,7 +166,12 @@ public class FedexDataInterface { |
| 157 | String appKey=(String) request.getHeader("Appkey"); | 166 | String appKey=(String) request.getHeader("Appkey"); |
| 158 | String timeStamp=(String) request.getHeader("TimeStamp"); | 167 | String timeStamp=(String) request.getHeader("TimeStamp"); |
| 159 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogC(fedexc,appId,appKey,new Date(Long.valueOf(timeStamp)))); | 168 | IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogC(fedexc,appId,appKey,new Date(Long.valueOf(timeStamp)))); |
| 160 | - | 169 | + String checkUser = mawbService.checkUser(appId); |
| 170 | + if (!StringUtil.isEmpty(checkUser)){ | ||
| 171 | + result.setCode(ErrorCodeEnum.ERROR_30003.getCode()); | ||
| 172 | + result.setMsg(checkUser); | ||
| 173 | + return result; | ||
| 174 | + } | ||
| 161 | fedexc.setAppId(appId); | 175 | fedexc.setAppId(appId); |
| 162 | FedexMawb saveMawbFedexResult = null; | 176 | FedexMawb saveMawbFedexResult = null; |
| 163 | if(!Objects.equals(saveIClearApiLogResult,null)){ | 177 | if(!Objects.equals(saveIClearApiLogResult,null)){ |
| ... | @@ -177,10 +191,16 @@ public class FedexDataInterface { | ... | @@ -177,10 +191,16 @@ public class FedexDataInterface { |
| 177 | } | 191 | } |
| 178 | sw.stop(); | 192 | sw.stop(); |
| 179 | 193 | ||
| 194 | + //检验运单币制是否有效 | ||
| 195 | + ResultRS resultRS = mawbService.checkCurrency(saveMawbFedexResult); | ||
| 196 | + if(!resultRS.getSuccess()){ | ||
| 197 | + return resultRS; | ||
| 198 | + } | ||
| 199 | + | ||
| 180 | 200 | ||
| 181 | //2、TODO 校验主单 | 201 | //2、TODO 校验主单 |
| 182 | sw.start("checkFedexMawb"); | 202 | sw.start("checkFedexMawb"); |
| 183 | - result=fedexService.checkFedexMawb(saveMawbFedexResult,null); | 203 | + result=fedexService.checkFedexMawb(saveMawbFedexResult,null,appId); |
| 184 | if(!result.getSuccess()){ | 204 | if(!result.getSuccess()){ |
| 185 | return result; | 205 | return result; |
| 186 | } | 206 | } |
| ... | @@ -201,6 +221,7 @@ public class FedexDataInterface { | ... | @@ -201,6 +221,7 @@ public class FedexDataInterface { |
| 201 | return result; | 221 | return result; |
| 202 | } | 222 | } |
| 203 | sw.stop(); | 223 | sw.stop(); |
| 224 | + log.info("saveIClearApiLogResult.getCreateTime():"+saveIClearApiLogResult.getCreateTime()); | ||
| 204 | ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime()); | 225 | ChmConsignment chmGetId = chmConsignmentRepository.findChmConsignmentByConsignmentCode(saveIClearApiLogResult.getBillNo(), saveIClearApiLogResult.getCreateTime()); |
| 205 | //调用IClear接口进行运单推送EXP002 | 226 | //调用IClear接口进行运单推送EXP002 |
| 206 | String objJson = JsonToJava.toJson(chmGetId.getId()); | 227 | String objJson = JsonToJava.toJson(chmGetId.getId()); |
| ... | @@ -359,4 +380,4 @@ public class FedexDataInterface { | ... | @@ -359,4 +380,4 @@ public class FedexDataInterface { |
| 359 | result.setCode(ErrorCodeEnum.SUCCESS.getCode()); | 380 | result.setCode(ErrorCodeEnum.SUCCESS.getCode()); |
| 360 | return result; | 381 | return result; |
| 361 | } | 382 | } |
| 362 | -} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 383 | +} | ... | ... |
| ... | @@ -23,7 +23,7 @@ import java.util.Date; | ... | @@ -23,7 +23,7 @@ import java.util.Date; |
| 23 | @Slf4j | 23 | @Slf4j |
| 24 | public class VersionInterface { | 24 | public class VersionInterface { |
| 25 | //当前版本号 | 25 | //当前版本号 |
| 26 | - final String VERSION = "2.2"; | 26 | + final String VERSION = "2.6.1"; |
| 27 | 27 | ||
| 28 | @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version") | 28 | @ApiOperation(value = "获取当前API版本", httpMethod = "GET", notes = "ex: http://192.168.1.71:8080/version/version") |
| 29 | @GetMapping("/version") | 29 | @GetMapping("/version") | ... | ... |
| ... | @@ -100,4 +100,21 @@ public class Constant { | ... | @@ -100,4 +100,21 @@ public class Constant { |
| 100 | * 监管条件 | 100 | * 监管条件 |
| 101 | */ | 101 | */ |
| 102 | public static final String supervise_condition = "superviseRestrict"; | 102 | public static final String supervise_condition = "superviseRestrict"; |
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * DM004接收取件信息 | ||
| 106 | + */ | ||
| 107 | + public static final String FILE_TYPE_GET_PICK_INFORMATION = "fileType_5"; | ||
| 108 | + | ||
| 109 | + //OSPR状态 | ||
| 110 | + /** | ||
| 111 | + * 未完成 | ||
| 112 | + */ | ||
| 113 | + public static final String OSPR_STATUS_INCOMPLETED = "OSPRStatus_1"; | ||
| 114 | + | ||
| 115 | + //扫描代码 | ||
| 116 | + /** | ||
| 117 | + * C类已取件 | ||
| 118 | + */ | ||
| 119 | + public static final String SCAN_CODE_TAKEN_PART= "scanCode_1"; | ||
| 103 | } | 120 | } | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.dto; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.HsCodeAndDescription; | ||
| 4 | +import com.erry.iclear.dateInterface.entity.SysUser; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +@Data | ||
| 10 | +public class HsCodeAndDescriptionDto { | ||
| 11 | + | ||
| 12 | + private Long id; | ||
| 13 | + | ||
| 14 | + private String a; | ||
| 15 | + | ||
| 16 | + private String b; | ||
| 17 | + | ||
| 18 | + /*** | ||
| 19 | + * 类型 | ||
| 20 | + * 1表示hsCode清单 | ||
| 21 | + | ||
| 22 | + * 2表示品名品名清单 | ||
| 23 | + */ | ||
| 24 | + private int type; | ||
| 25 | + | ||
| 26 | + //用户 | ||
| 27 | + private SysUser sysUser; | ||
| 28 | + | ||
| 29 | + private Date createTime; | ||
| 30 | + | ||
| 31 | + private String errorMsg; | ||
| 32 | + | ||
| 33 | + private String rowNum; | ||
| 34 | + | ||
| 35 | + public HsCodeAndDescriptionDto() { | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public HsCodeAndDescriptionDto(HsCodeAndDescription hsCodeAndDescription) { | ||
| 39 | + this.setId(hsCodeAndDescription.getId()); | ||
| 40 | + this.setA(hsCodeAndDescription.getA()); | ||
| 41 | + this.setB(hsCodeAndDescription.getB()); | ||
| 42 | + this.setType(hsCodeAndDescription.getType()); | ||
| 43 | + this.setSysUser(hsCodeAndDescription.getSysUser()); | ||
| 44 | + this.setCreateTime(hsCodeAndDescription.getCreateTime()); | ||
| 45 | + } | ||
| 46 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -3,7 +3,6 @@ package com.erry.iclear.dateInterface.entity; | ... | @@ -3,7 +3,6 @@ package com.erry.iclear.dateInterface.entity; |
| 3 | 3 | ||
| 4 | import com.fasterxml.jackson.annotation.JsonIgnore; | 4 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 5 | import lombok.Data; | 5 | import lombok.Data; |
| 6 | -import org.springframework.format.annotation.DateTimeFormat; | ||
| 7 | 6 | ||
| 8 | import javax.persistence.*; | 7 | import javax.persistence.*; |
| 9 | import java.io.Serializable; | 8 | import java.io.Serializable; |
| ... | @@ -413,6 +412,62 @@ public class ChmConsignment implements Serializable { | ... | @@ -413,6 +412,62 @@ public class ChmConsignment implements Serializable { |
| 413 | @Column(name = "EANNO") | 412 | @Column(name = "EANNO") |
| 414 | private String eanNo; | 413 | private String eanNo; |
| 415 | 414 | ||
| 415 | + /** | ||
| 416 | + * 扫描代码ID | ||
| 417 | + */ | ||
| 418 | + @JsonIgnore | ||
| 419 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 420 | + @JoinColumn(name = "SCAN_CODE_ID") | ||
| 421 | + private DictionaryEntries scanCodeDic; | ||
| 422 | + | ||
| 423 | + /** | ||
| 424 | + * 扫描代码 | ||
| 425 | + */ | ||
| 426 | + @Column(name = "SCAN_CODE") | ||
| 427 | + private String scanCode; | ||
| 428 | + | ||
| 429 | + /** | ||
| 430 | + * 扫描状态日期 | ||
| 431 | + */ | ||
| 432 | + @Column(name = "SCAN_STATUS_TIME") | ||
| 433 | + private Date scanStatusTime; | ||
| 434 | + | ||
| 435 | + /** | ||
| 436 | + * 运单类型ID | ||
| 437 | + */ | ||
| 438 | +// @JsonIgnore | ||
| 439 | +// @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 440 | +// @JoinColumn(name = "CONS_TYPE_ID") | ||
| 441 | +// private DictionaryEntries consTypeDic; | ||
| 442 | + | ||
| 443 | + /** | ||
| 444 | + * OSPR状态ID | ||
| 445 | + */ | ||
| 446 | + @JsonIgnore | ||
| 447 | + @ManyToOne(targetEntity = DictionaryEntries.class) | ||
| 448 | + @JoinColumn(name = "OSPR_STATUS_ID") | ||
| 449 | + private DictionaryEntries osprStatusDic; | ||
| 450 | + | ||
| 451 | + /** | ||
| 452 | + * 站点 | ||
| 453 | + */ | ||
| 454 | + @JsonIgnore | ||
| 455 | + @ManyToOne(targetEntity = Organization.class) | ||
| 456 | + @JoinColumn(name = "STATION_ID") | ||
| 457 | + private Organization station; | ||
| 458 | + | ||
| 459 | + /** | ||
| 460 | + * 站点名称 | ||
| 461 | + */ | ||
| 462 | + @Column(name = "STATION_NAME") | ||
| 463 | + private String stationName; | ||
| 464 | + | ||
| 465 | + /** | ||
| 466 | + * 取件日期 | ||
| 467 | + */ | ||
| 468 | + @Column(name = "PICK_UP_DATE") | ||
| 469 | + private Date pickUpDate; | ||
| 470 | + | ||
| 416 | @OneToMany(mappedBy = "chmConsignment", cascade = CascadeType.ALL) | 471 | @OneToMany(mappedBy = "chmConsignment", cascade = CascadeType.ALL) |
| 417 | private List<ChmConsignmentDetail> chmConsignmentDetailList; | 472 | private List<ChmConsignmentDetail> chmConsignmentDetailList; |
| 418 | 473 | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.entity; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import javax.persistence.*; | ||
| 7 | +import java.util.Date; | ||
| 8 | + | ||
| 9 | +@Entity | ||
| 10 | +@Table(name = "T_AU_HSCODE_DESCRIPTION") | ||
| 11 | +@Data | ||
| 12 | +public class HsCodeAndDescription { | ||
| 13 | + | ||
| 14 | + private static final long serialVersionUID = 1L; | ||
| 15 | + | ||
| 16 | + @Id | ||
| 17 | + @GeneratedValue | ||
| 18 | + @Column(name = "ID") | ||
| 19 | + private Long id; | ||
| 20 | + | ||
| 21 | + @Column(name = "A") | ||
| 22 | + private String a; | ||
| 23 | + | ||
| 24 | + @Column(name = "B") | ||
| 25 | + private String b; | ||
| 26 | + | ||
| 27 | + /*** | ||
| 28 | + * 类型 | ||
| 29 | + * 1表示hsCode清单 | ||
| 30 | + | ||
| 31 | + * 2表示品名品名清单 | ||
| 32 | + */ | ||
| 33 | + @Column(name = "TYPE") | ||
| 34 | + private int type; | ||
| 35 | + | ||
| 36 | + //用户 | ||
| 37 | + @JsonIgnore | ||
| 38 | + @ManyToOne(targetEntity = SysUser.class) | ||
| 39 | + @JoinColumn(name = "USER_ID") | ||
| 40 | + private SysUser sysUser; | ||
| 41 | + | ||
| 42 | + //创建时间 | ||
| 43 | + @Column(name = "CREATETIME") | ||
| 44 | + private Date createTime; | ||
| 45 | + | ||
| 46 | +} |
| ... | @@ -27,7 +27,8 @@ public enum ErrorCodeEnum { | ... | @@ -27,7 +27,8 @@ public enum ErrorCodeEnum { |
| 27 | ERROR_30102("30102","hscode编码字段长度超过2000字符"), | 27 | ERROR_30102("30102","hscode编码字段长度超过2000字符"), |
| 28 | ERROR_30103("30103","skuCode与skuName必须传递一项"), | 28 | ERROR_30103("30103","skuCode与skuName必须传递一项"), |
| 29 | ERROR_30104("30104","skuCode或skuName长度超出限制"), | 29 | ERROR_30104("30104","skuCode或skuName长度超出限制"), |
| 30 | - ERROR_30105("30105","skuCode编码最少输入4位字符,skuName最少输入2个字符"); | 30 | + ERROR_30105("30105","skuCode编码最少输入4位字符,skuName最少输入2个字符"), |
| 31 | + ERROR_30106("30106","此申报{columnName}币制不在海关要求的范围内 请修改!"); | ||
| 31 | 32 | ||
| 32 | 33 | ||
| 33 | ErrorCodeEnum(String code,String name){ | 34 | ErrorCodeEnum(String code,String name){ | ... | ... |
| ... | @@ -4,7 +4,6 @@ import com.erry.iclear.dateInterface.entity.ChmConsignment; | ... | @@ -4,7 +4,6 @@ import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 4 | import org.springframework.data.jpa.repository.JpaRepository; | 4 | import org.springframework.data.jpa.repository.JpaRepository; |
| 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
| 6 | import org.springframework.data.jpa.repository.Query; | 6 | import org.springframework.data.jpa.repository.Query; |
| 7 | -import org.springframework.data.repository.query.Param; | ||
| 8 | import org.springframework.stereotype.Repository; | 7 | import org.springframework.stereotype.Repository; |
| 9 | 8 | ||
| 10 | import java.util.Date; | 9 | import java.util.Date; |
| ... | @@ -33,6 +32,15 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo | ... | @@ -33,6 +32,15 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo |
| 33 | public ChmConsignment findChmConsignmentByConsignmentCode(String consignmentCode,Date startDate); | 32 | public ChmConsignment findChmConsignmentByConsignmentCode(String consignmentCode,Date startDate); |
| 34 | 33 | ||
| 35 | /** | 34 | /** |
| 35 | + * 根据运单号查找多条数据 | ||
| 36 | + * @param consignmentCode | ||
| 37 | + * @param startDate | ||
| 38 | + * @return | ||
| 39 | + */ | ||
| 40 | + @Query( nativeQuery = true,value ="select * from T_CHM_CONSIGNMENT where CONSIGNMENT_CODE = ?1 and CREATE_TIME>= ?2 and CREATOR = ?3" ) | ||
| 41 | + public List<ChmConsignment> findChmConsignmentByConsignmentCodes(String consignmentCode,Date startDate,String creator); | ||
| 42 | + | ||
| 43 | + /** | ||
| 36 | * 根据运单ID查运单 | 44 | * 根据运单ID查运单 |
| 37 | * @param id | 45 | * @param id |
| 38 | * @return | 46 | * @return | ... | ... |
src/main/java/com/erry/iclear/dateInterface/repository/HsCodeAndDescriptionRepository.java
0 → 100644
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.HsCodeAndDescription; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.stereotype.Repository; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | +@Repository | ||
| 11 | +public interface HsCodeAndDescriptionRepository extends JpaSpecificationExecutor<HsCodeAndDescription>, JpaRepository<HsCodeAndDescription, Long> { | ||
| 12 | + @Query(nativeQuery = true,value = "select * from T_AU_HSCODE_DESCRIPTION where TYPE = ?1 ") | ||
| 13 | + public List<HsCodeAndDescription> selectAndType(int type); | ||
| 14 | +} |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.Organization; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.data.repository.query.Param; | ||
| 8 | +import org.springframework.stereotype.Repository; | ||
| 9 | + | ||
| 10 | +@Repository | ||
| 11 | +public interface OrganizationRepository extends JpaSpecificationExecutor<Organization>, JpaRepository<Organization, Long> { | ||
| 12 | + @Query(nativeQuery = true, value = "select top 1 * from T_AU_ORGANIZATION o where o.NAME = :name ") | ||
| 13 | + public Organization findOrganizationByName(@Param("name") String name); | ||
| 14 | +} |
| 1 | +package com.erry.iclear.dateInterface.repository; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.entity.TaskInfo; | ||
| 4 | +import org.springframework.data.jpa.repository.JpaRepository; | ||
| 5 | +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | ||
| 6 | +import org.springframework.data.jpa.repository.Query; | ||
| 7 | +import org.springframework.data.repository.query.Param; | ||
| 8 | +import org.springframework.stereotype.Repository; | ||
| 9 | + | ||
| 10 | +@Repository | ||
| 11 | +public interface TaskInfoRepository extends JpaSpecificationExecutor<TaskInfo>, JpaRepository<TaskInfo, Long> { | ||
| 12 | + | ||
| 13 | + @Query(nativeQuery = true, value = "select top 1 * from T_TASK_INFO info where info.FILE_TYPE_ID = :fileTypeId and " + | ||
| 14 | + "info.AWB_NUMBER = :consignmentCode order by CREATE_TIME DESC") | ||
| 15 | + public TaskInfo findTaskInfoByConsignment(@Param("fileTypeId") Long taskStatusId,@Param("consignmentCode") String consignmentCode); | ||
| 16 | + | ||
| 17 | +} |
| ... | @@ -212,7 +212,7 @@ public class ApiService { | ... | @@ -212,7 +212,7 @@ public class ApiService { |
| 212 | }); | 212 | }); |
| 213 | this.sendMawb(token,mawbList); | 213 | this.sendMawb(token,mawbList); |
| 214 | }catch(Exception ex){ | 214 | }catch(Exception ex){ |
| 215 | - log.error("pushMawbAcc",ex); | 215 | + log.error(ex.getMessage(),ex); |
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| 218 | /** | 218 | /** |
| ... | @@ -245,7 +245,7 @@ public class ApiService { | ... | @@ -245,7 +245,7 @@ public class ApiService { |
| 245 | declearTask.setPushTime(new Date()); | 245 | declearTask.setPushTime(new Date()); |
| 246 | String objJson = JsonToJava.toJson(d); | 246 | String objJson = JsonToJava.toJson(d); |
| 247 | //推送海关回执数据 | 247 | //推送海关回执数据 |
| 248 | - String json = HttpUtils.doProxyPost(this.customsUrl,objJson,headerMap,this.proxyUrl,this.proxyPort); | 248 | + String json = HttpUtils.doProxyPost(this.completeMsgUrl,objJson,headerMap,this.proxyUrl,this.proxyPort); |
| 249 | log.info("sendMawb:"+json); | 249 | log.info("sendMawb:"+json); |
| 250 | //接口响应时间 | 250 | //接口响应时间 |
| 251 | declearTask.setResponseTime(new Date()); | 251 | declearTask.setResponseTime(new Date()); | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | 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.enums.ErrorCodeEnum; | 4 | + |
| 5 | import com.erry.iclear.dateInterface.api.request.FedexMawb; | 5 | import com.erry.iclear.dateInterface.api.request.FedexMawb; |
| 6 | import com.erry.iclear.dateInterface.api.request.FedexReceipt; | 6 | import com.erry.iclear.dateInterface.api.request.FedexReceipt; |
| 7 | import com.erry.iclear.dateInterface.api.request.Mawb; | 7 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 8 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 8 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 9 | import com.erry.iclear.dateInterface.common.Constant; | 9 | import com.erry.iclear.dateInterface.common.Constant; |
| 10 | import com.erry.iclear.dateInterface.entity.*; | 10 | import com.erry.iclear.dateInterface.entity.*; |
| 11 | -import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository; | 11 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; |
| 12 | -import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | 12 | +import com.erry.iclear.dateInterface.repository.*; |
| 13 | -import com.erry.iclear.dateInterface.repository.SysUserRepository; | ||
| 14 | import com.erry.iclear.dateInterface.util.DateUtils; | 13 | import com.erry.iclear.dateInterface.util.DateUtils; |
| 15 | import com.erry.iclear.dateInterface.util.NumberUtils; | 14 | import com.erry.iclear.dateInterface.util.NumberUtils; |
| 16 | import com.erry.iclear.dateInterface.util.StringUtil; | 15 | import com.erry.iclear.dateInterface.util.StringUtil; |
| ... | @@ -21,10 +20,8 @@ import org.springframework.stereotype.Service; | ... | @@ -21,10 +20,8 @@ import org.springframework.stereotype.Service; |
| 21 | import javax.transaction.Transactional; | 20 | import javax.transaction.Transactional; |
| 22 | import java.text.ParseException; | 21 | import java.text.ParseException; |
| 23 | import java.text.SimpleDateFormat; | 22 | import java.text.SimpleDateFormat; |
| 24 | -import java.util.ArrayList; | 23 | +import java.util.*; |
| 25 | -import java.util.Date; | 24 | +import java.util.stream.Collectors; |
| 26 | -import java.util.List; | ||
| 27 | -import java.util.Objects; | ||
| 28 | 25 | ||
| 29 | /** | 26 | /** |
| 30 | * @author Administrator | 27 | * @author Administrator |
| ... | @@ -49,6 +46,12 @@ public class ChmConsignmentService { | ... | @@ -49,6 +46,12 @@ public class ChmConsignmentService { |
| 49 | @Autowired | 46 | @Autowired |
| 50 | private SysUserRepository sysUserRepository; | 47 | private SysUserRepository sysUserRepository; |
| 51 | 48 | ||
| 49 | + @Autowired | ||
| 50 | + private TaskInfoRepository taskInfoRepository; | ||
| 51 | + | ||
| 52 | + @Autowired | ||
| 53 | + private OrganizationRepository organizationRepository; | ||
| 54 | + | ||
| 52 | /** | 55 | /** |
| 53 | * 转换主单 | 56 | * 转换主单 |
| 54 | * @return | 57 | * @return |
| ... | @@ -230,8 +233,14 @@ public class ChmConsignmentService { | ... | @@ -230,8 +233,14 @@ public class ChmConsignmentService { |
| 230 | 233 | ||
| 231 | //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 | 234 | //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 |
| 232 | result.setCreateTime(new Date()); | 235 | result.setCreateTime(new Date()); |
| 233 | - result.setUpdateTime(pushTime); | 236 | + result.setUpdateTime(new Date()); |
| 234 | - result.setCreator(creator); | 237 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); |
| 238 | + if (sysUser == null){ | ||
| 239 | + result.setCreator(creator); | ||
| 240 | + }else { | ||
| 241 | + result.setCreatorId(sysUser); | ||
| 242 | + result.setCreator(sysUser.getUserName()); | ||
| 243 | + } | ||
| 235 | 244 | ||
| 236 | }catch (Exception e){ | 245 | }catch (Exception e){ |
| 237 | result=null; | 246 | result=null; |
| ... | @@ -290,11 +299,12 @@ public class ChmConsignmentService { | ... | @@ -290,11 +299,12 @@ public class ChmConsignmentService { |
| 290 | //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 | 299 | //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 |
| 291 | result.setCreateTime(new Date()); | 300 | result.setCreateTime(new Date()); |
| 292 | result.setUpdateTime(pushTime); | 301 | result.setUpdateTime(pushTime); |
| 293 | - if (!creator.equals("IDE-ICLEAR-API")){ | 302 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); |
| 294 | - SysUser sysUser = sysUserRepository.findUserByLoginName(creator); | 303 | + if (sysUser == null){ |
| 295 | - | 304 | + result.setCreator(creator); |
| 305 | + }else { | ||
| 296 | result.setCreatorId(sysUser); | 306 | result.setCreatorId(sysUser); |
| 297 | - result.setCreator(sysUser.getLoginName()); | 307 | + result.setCreator(sysUser.getUserName()); |
| 298 | } | 308 | } |
| 299 | }catch (Exception e){ | 309 | }catch (Exception e){ |
| 300 | result=null; | 310 | result=null; |
| ... | @@ -484,6 +494,20 @@ public class ChmConsignmentService { | ... | @@ -484,6 +494,20 @@ public class ChmConsignmentService { |
| 484 | } | 494 | } |
| 485 | 495 | ||
| 486 | /** | 496 | /** |
| 497 | + * 根据运单号查找多条数据 | ||
| 498 | + * @param consignmentCode | ||
| 499 | + * @return | ||
| 500 | + */ | ||
| 501 | + public List<ChmConsignment> findChmConsignmentByConsignmentCodes(String consignmentCode, Date startDate,String creator){ | ||
| 502 | + try { | ||
| 503 | + return chmConsignmentRepository.findChmConsignmentByConsignmentCodes(consignmentCode,startDate,creator); | ||
| 504 | + }catch (Exception e){ | ||
| 505 | + log.error("findChmConsignmentByConsignmentCode() error:"+ e.getMessage()); | ||
| 506 | + } | ||
| 507 | + return null; | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + /** | ||
| 487 | * 保存或更新 iclear中的运单信息 | 511 | * 保存或更新 iclear中的运单信息 |
| 488 | * @param mawb | 512 | * @param mawb |
| 489 | * @param timeStamp | 513 | * @param timeStamp |
| ... | @@ -505,19 +529,46 @@ public class ChmConsignmentService { | ... | @@ -505,19 +529,46 @@ public class ChmConsignmentService { |
| 505 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); | 529 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); |
| 506 | 530 | ||
| 507 | //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 | 531 | //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 |
| 508 | - ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7)); | 532 | + ChmConsignment chmConsignmentDB = null; |
| 533 | +// ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7)); | ||
| 534 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); | ||
| 535 | + String username = null; | ||
| 536 | + if (sysUser == null){ | ||
| 537 | + username = creator; | ||
| 538 | + }else { | ||
| 539 | + //设置当前运单创建人ID | ||
| 540 | + chmConsignment.setCreatorId(sysUser); | ||
| 541 | + username = sysUser.getUserName(); | ||
| 542 | + } | ||
| 543 | + List<ChmConsignment> chmConsignmentDBs=this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),username); | ||
| 544 | + List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>(); | ||
| 545 | + for (ChmConsignment chmConsignments : chmConsignmentDBs) { | ||
| 546 | + //如果有该用户曾经提交过得,运单状态为预审不通过或者中心审核已通过并且没有dm004的优先覆盖 | ||
| 547 | + if (chmConsignments.getConsStatusDic().getCode().equals("transferWaybillStatus_3")){ | ||
| 548 | + chmConsignmentDB = chmConsignments; | ||
| 549 | + break; | ||
| 550 | + }else if ((chmConsignments.getConsStatusDic().getCode().equals("transferWaybillStatus_15") | ||
| 551 | + || chmConsignments.getConsStatusDic().getCode().equals("transferWaybillStatus_1") || chmConsignments.getConsStatusDic().getCode().equals("transferWaybillStatus_24"))){ | ||
| 552 | + //如果有新建、sep新建、草稿状态的,先存下来,按创建日期排序覆盖最后一个 | ||
| 553 | + newChmConsignments.add(chmConsignments); | ||
| 554 | + } | ||
| 555 | + } | ||
| 556 | + | ||
| 557 | + if (chmConsignmentDB == null && !newChmConsignments.isEmpty()){ | ||
| 558 | + List<ChmConsignment> sortList = newChmConsignments.stream().sorted(Comparator.comparing(ChmConsignment::getCreateTime).reversed()).collect(Collectors.toList()); | ||
| 559 | + chmConsignmentDB = sortList.get(0); | ||
| 560 | + } | ||
| 509 | 561 | ||
| 510 | //获取用户账号信息 | 562 | //获取用户账号信息 |
| 511 | - SysUser sysUser = sysUserRepository.findUserByLoginName("CUSTOMS"); | ||
| 512 | - //设置当前运单创建人ID | ||
| 513 | - chmConsignment.setCreatorId(sysUser); | ||
| 514 | //设置创建人名称 | 563 | //设置创建人名称 |
| 515 | - chmConsignment.setCreator(sysUser.getUserName()); | 564 | + chmConsignment.setCreator(username); |
| 516 | 565 | ||
| 517 | //3、新增或更新 | 566 | //3、新增或更新 |
| 518 | //新增:如果没有就插入 | 567 | //新增:如果没有就插入 |
| 519 | if (Objects.equals(chmConsignmentDB,null)){ | 568 | if (Objects.equals(chmConsignmentDB,null)){ |
| 520 | log.info("新增主单"+ mawb.getBillNo()); | 569 | log.info("新增主单"+ mawb.getBillNo()); |
| 570 | + //如果有dm004把dm004更新上去 | ||
| 571 | + updateDM004(chmConsignment); | ||
| 521 | ChmConsignment chmConsignmentSaveResult = this.saveChmConsignment(chmConsignment); | 572 | ChmConsignment chmConsignmentSaveResult = this.saveChmConsignment(chmConsignment); |
| 522 | if(!Objects.equals(chmConsignmentSaveResult,null)){ | 573 | if(!Objects.equals(chmConsignmentSaveResult,null)){ |
| 523 | log.info("主单"+ mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); | 574 | log.info("主单"+ mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); |
| ... | @@ -532,9 +583,9 @@ public class ChmConsignmentService { | ... | @@ -532,9 +583,9 @@ public class ChmConsignmentService { |
| 532 | //条件1、状态为 待申报海关 | 583 | //条件1、状态为 待申报海关 |
| 533 | //条件2、本次推送时间 > 上次推送的时间 | 584 | //条件2、本次推送时间 > 上次推送的时间 |
| 534 | }else if(!Objects.equals(chmConsignmentDB,null) | 585 | }else if(!Objects.equals(chmConsignmentDB,null) |
| 535 | - && Objects.equals(chmConsignmentDB.getConsStatusDic().getCode(),"transferWaybillStatus_5") | 586 | + //&& Objects.equals(chmConsignmentDB.getConsStatusDic().getCode(),"transferWaybillStatus_5") |
| 536 | //TODO 提交时需要打开 | 587 | //TODO 提交时需要打开 |
| 537 | - && pushTime.getTime()>chmConsignmentDB.getUpdateTime().getTime() | 588 | + //&& pushTime.getTime()>chmConsignmentDB.getUpdateTime().getTime() |
| 538 | ){ | 589 | ){ |
| 539 | //更新数据 | 590 | //更新数据 |
| 540 | log.info("更新主单"+ mawb.getBillNo()); | 591 | log.info("更新主单"+ mawb.getBillNo()); |
| ... | @@ -547,11 +598,13 @@ public class ChmConsignmentService { | ... | @@ -547,11 +598,13 @@ public class ChmConsignmentService { |
| 547 | } | 598 | } |
| 548 | } | 599 | } |
| 549 | } | 600 | } |
| 601 | + //如果有dm004把dm004更新上去 | ||
| 602 | + updateDM004(chmConsignment); | ||
| 550 | 603 | ||
| 551 | chmConsignment.setId(chmConsignmentDB.getId()); | 604 | chmConsignment.setId(chmConsignmentDB.getId()); |
| 552 | 605 | ||
| 553 | chmConsignment.setCreateTime(chmConsignmentDB.getCreateTime()); | 606 | chmConsignment.setCreateTime(chmConsignmentDB.getCreateTime()); |
| 554 | - chmConsignment.setUpdateTime(pushTime); | 607 | + chmConsignment.setUpdateTime(new Date()); |
| 555 | ChmConsignment updateResult = this.saveChmConsignment(chmConsignment); | 608 | ChmConsignment updateResult = this.saveChmConsignment(chmConsignment); |
| 556 | if(!Objects.equals(updateResult,null)){ | 609 | if(!Objects.equals(updateResult,null)){ |
| 557 | log.info("主单"+ mawb.getBillNo()+" 更新成功,chmConsignmentId:"+updateResult.getId()); | 610 | log.info("主单"+ mawb.getBillNo()+" 更新成功,chmConsignmentId:"+updateResult.getId()); |
| ... | @@ -563,13 +616,48 @@ public class ChmConsignmentService { | ... | @@ -563,13 +616,48 @@ public class ChmConsignmentService { |
| 563 | } | 616 | } |
| 564 | } | 617 | } |
| 565 | }catch (Exception e){ | 618 | }catch (Exception e){ |
| 566 | - log.error(""+e.getMessage()); | 619 | + log.error(""+e.getMessage(),e); |
| 567 | } | 620 | } |
| 568 | result.setSuccess(Boolean.TRUE); | 621 | result.setSuccess(Boolean.TRUE); |
| 569 | return result; | 622 | return result; |
| 570 | } | 623 | } |
| 571 | 624 | ||
| 572 | /** | 625 | /** |
| 626 | + * 如果dm004已经来了,但是运单未提交,则直接更新dm004的数据 | ||
| 627 | + */ | ||
| 628 | + public ChmConsignment updateDM004(ChmConsignment chmConsignment){ | ||
| 629 | + TaskInfo taskInfo = new TaskInfo(); | ||
| 630 | + DictionaryEntries dictionaryEntries = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.FILE_TYPE_GET_PICK_INFORMATION); | ||
| 631 | + taskInfo = taskInfoRepository.findTaskInfoByConsignment(dictionaryEntries.getId(),chmConsignment.getConsignmentCode()); | ||
| 632 | + if (StringUtil.isEmpty(chmConsignment.getScanCode()) && taskInfo!= null){ | ||
| 633 | + chmConsignment.setScanCode(taskInfo.getScanCode()); | ||
| 634 | + chmConsignment.setScanCodeDic(taskInfo.getScanCodeDic()); | ||
| 635 | + chmConsignment.setScanStatusTime(taskInfo.getScanStatusTime()); | ||
| 636 | + | ||
| 637 | + //D类OSPR未完成可以修改站点 | ||
| 638 | + Organization organizationByName = organizationRepository.findOrganizationByName(taskInfo.getStationName()); | ||
| 639 | + if(organizationByName !=null){ | ||
| 640 | + DictionaryEntries dictionaryEntries3 = dictionaryEntriesRepository.findDictionaryEntriesByCode(Constant.consType_D); | ||
| 641 | + if (chmConsignment.getConsType().equals(dictionaryEntries3.getChineseName())){ | ||
| 642 | + if (chmConsignment.getOsprStatusDic()!=null){ | ||
| 643 | + if(chmConsignment.getOsprStatusDic().getCode().equals(Constant.OSPR_STATUS_INCOMPLETED)){ | ||
| 644 | + chmConsignment.setStation(organizationByName); | ||
| 645 | + chmConsignment.setStationName(organizationByName.getName()); | ||
| 646 | + } | ||
| 647 | + } | ||
| 648 | + }else{ | ||
| 649 | + chmConsignment.setStation(organizationByName); | ||
| 650 | + chmConsignment.setStationName(organizationByName.getName()); | ||
| 651 | + } | ||
| 652 | + } | ||
| 653 | + if(taskInfo.getScanCode().equals(Constant.SCAN_CODE_TAKEN_PART)){ | ||
| 654 | + chmConsignment.setPickUpDate(taskInfo.getScanStatusTime()); | ||
| 655 | + } | ||
| 656 | + } | ||
| 657 | + return chmConsignment; | ||
| 658 | + } | ||
| 659 | + | ||
| 660 | + /** | ||
| 573 | * 保存或更新 iclear中的运单信息 | 661 | * 保存或更新 iclear中的运单信息 |
| 574 | * @param fedexMawb | 662 | * @param fedexMawb |
| 575 | * @param timeStamp | 663 | * @param timeStamp |
| ... | @@ -590,14 +678,39 @@ public class ChmConsignmentService { | ... | @@ -590,14 +678,39 @@ public class ChmConsignmentService { |
| 590 | chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetailFedex(detail, chmConsignment,Boolean.FALSE)); | 678 | chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetailFedex(detail, chmConsignment,Boolean.FALSE)); |
| 591 | }); | 679 | }); |
| 592 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); | 680 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); |
| 593 | - | 681 | + ChmConsignment chmConsignmentDB = null; |
| 594 | //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 | 682 | //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 |
| 595 | - ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7)); | 683 | + SysUser sysUser = sysUserRepository.findUserByLoginName(creator); |
| 596 | - | 684 | + String username = null; |
| 685 | + if (sysUser == null){ | ||
| 686 | + username = creator; | ||
| 687 | + }else { | ||
| 688 | + username = sysUser.getUserName(); | ||
| 689 | + } | ||
| 690 | + List<ChmConsignment> chmConsignments = this.findChmConsignmentByConsignmentCodes(chmConsignment.getConsignmentCode(), DateUtils.addDate(DateUtils.getCurrentDate(),-7),username); | ||
| 691 | + //如果没有C类待申报,从list中拿时间最晚的一条去覆盖 | ||
| 692 | + List<ChmConsignment> newChmConsignments = new ArrayList<ChmConsignment>(); | ||
| 693 | + for (ChmConsignment consignment : chmConsignments) { | ||
| 694 | + //如果是C类待申报的,覆盖 | ||
| 695 | + if (consignment.getConsStatusDic().getCode().equals("transferWaybillStatus_16")){ | ||
| 696 | + chmConsignmentDB = consignment; | ||
| 697 | + break; | ||
| 698 | + }else if ((consignment.getConsStatusDic().getCode().equals("transferWaybillStatus_15") | ||
| 699 | + || consignment.getConsStatusDic().getCode().equals("transferWaybillStatus_1") || consignment.getConsStatusDic().getCode().equals("transferWaybillStatus_24"))){ | ||
| 700 | + newChmConsignments.add(consignment); | ||
| 701 | + } | ||
| 702 | + } | ||
| 703 | + if (chmConsignmentDB == null && !newChmConsignments.isEmpty()){ | ||
| 704 | + List<ChmConsignment> sortList = newChmConsignments.stream().sorted(Comparator.comparing(ChmConsignment::getCreateTime).reversed()).collect(Collectors.toList()); | ||
| 705 | + chmConsignmentDB = sortList.get(0); | ||
| 706 | + } | ||
| 597 | //3、新增或更新 | 707 | //3、新增或更新 |
| 708 | + //新增:如果没有就插入,或者存在草稿、sep新建、新建的并且运单id不一样就新增一条 | ||
| 598 | //新增:如果没有就插入 | 709 | //新增:如果没有就插入 |
| 599 | if (Objects.equals(chmConsignmentDB,null)){ | 710 | if (Objects.equals(chmConsignmentDB,null)){ |
| 600 | log.info("新增主单"+ fedexMawb.getBillNo()); | 711 | log.info("新增主单"+ fedexMawb.getBillNo()); |
| 712 | + //如果有dm004把dm004更新上去 | ||
| 713 | + updateDM004(chmConsignment); | ||
| 601 | ChmConsignment chmConsignmentSaveResult = this.saveChmConsignment(chmConsignment); | 714 | ChmConsignment chmConsignmentSaveResult = this.saveChmConsignment(chmConsignment); |
| 602 | if(!Objects.equals(chmConsignmentSaveResult,null)){ | 715 | if(!Objects.equals(chmConsignmentSaveResult,null)){ |
| 603 | log.info("主单"+ fedexMawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); | 716 | log.info("主单"+ fedexMawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId()); |
| ... | @@ -612,9 +725,9 @@ public class ChmConsignmentService { | ... | @@ -612,9 +725,9 @@ public class ChmConsignmentService { |
| 612 | //条件1、状态为 C类待申报 | 725 | //条件1、状态为 C类待申报 |
| 613 | //条件2、本次推送时间 > 上次推送的时间 | 726 | //条件2、本次推送时间 > 上次推送的时间 |
| 614 | }else if(!Objects.equals(chmConsignmentDB,null) | 727 | }else if(!Objects.equals(chmConsignmentDB,null) |
| 615 | - && Objects.equals(chmConsignmentDB.getConsStatusDic().getCode(),"transferWaybillStatus_16") | 728 | + //&& Objects.equals(chmConsignmentDB.getConsStatusDic().getCode(),"transferWaybillStatus_16") |
| 616 | //TODO 提交时需要打开 | 729 | //TODO 提交时需要打开 |
| 617 | - && pushTime.getTime()>chmConsignmentDB.getUpdateTime().getTime() | 730 | + //&& pushTime.getTime()>chmConsignmentDB.getUpdateTime().getTime() |
| 618 | ){ | 731 | ){ |
| 619 | //更新数据 | 732 | //更新数据 |
| 620 | log.info("更新主单"+ fedexMawb.getBillNo()); | 733 | log.info("更新主单"+ fedexMawb.getBillNo()); |
| ... | @@ -627,9 +740,10 @@ public class ChmConsignmentService { | ... | @@ -627,9 +740,10 @@ public class ChmConsignmentService { |
| 627 | } | 740 | } |
| 628 | } | 741 | } |
| 629 | } | 742 | } |
| 630 | - | 743 | + //如果有dm004把dm004更新上去 |
| 744 | + updateDM004(chmConsignment); | ||
| 631 | chmConsignment.setId(chmConsignmentDB.getId()); | 745 | chmConsignment.setId(chmConsignmentDB.getId()); |
| 632 | - chmConsignment.setCreateTime(chmConsignmentDB.getCreateTime()); | 746 | + //chmConsignment.setCreateTime(chmConsignmentDB.getCreateTime()); |
| 633 | chmConsignment.setUpdateTime(pushTime); | 747 | chmConsignment.setUpdateTime(pushTime); |
| 634 | ChmConsignment updateResult = this.saveChmConsignment(chmConsignment); | 748 | ChmConsignment updateResult = this.saveChmConsignment(chmConsignment); |
| 635 | if(!Objects.equals(updateResult,null)){ | 749 | if(!Objects.equals(updateResult,null)){ |
| ... | @@ -640,6 +754,13 @@ public class ChmConsignmentService { | ... | @@ -640,6 +754,13 @@ public class ChmConsignmentService { |
| 640 | result.setMsg("主单"+ fedexMawb.getBillNo()+" 更新失败"); | 754 | result.setMsg("主单"+ fedexMawb.getBillNo()+" 更新失败"); |
| 641 | return result; | 755 | return result; |
| 642 | } | 756 | } |
| 757 | + }else{ | ||
| 758 | + //条件1、状态为 C类待申报 | ||
| 759 | + //条件2、本次推送时间 > 上次推送的时间 条件不满足 | ||
| 760 | + log.info("主单"+ fedexMawb.getBillNo()+" 更新失败"); | ||
| 761 | + result.setCode(ErrorCodeEnum.ERROR_30003.getCode()); | ||
| 762 | + result.setMsg("主单"+ fedexMawb.getBillNo()+" 条件1、状态为 C类待申报,条件2、本次推送时间 > 上次推送的时间,条件不满足更新失败"); | ||
| 763 | + return result; | ||
| 643 | } | 764 | } |
| 644 | }catch (Exception e){ | 765 | }catch (Exception e){ |
| 645 | log.error(""+e.getMessage()); | 766 | log.error(""+e.getMessage()); | ... | ... |
| ... | @@ -113,13 +113,13 @@ public class FedexService { | ... | @@ -113,13 +113,13 @@ public class FedexService { |
| 113 | * @param fedexMawb | 113 | * @param fedexMawb |
| 114 | * @return | 114 | * @return |
| 115 | */ | 115 | */ |
| 116 | - public ResultRS checkFedexMawb(FedexMawb fedexMawb,AppInfo appInfo){ | 116 | + public ResultRS checkFedexMawb(FedexMawb fedexMawb,AppInfo appInfo,String appId){ |
| 117 | ResultRS result = new ResultRS(Boolean.FALSE,null,null,null); | 117 | ResultRS result = new ResultRS(Boolean.FALSE,null,null,null); |
| 118 | try{ | 118 | try{ |
| 119 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); | 119 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(fedexMawb)); |
| 120 | 120 | ||
| 121 | //1、将请求转换为运单 | 121 | //1、将请求转换为运单 |
| 122 | - ChmConsignment chmConsignment=consignmentService.convertToChmConsignmentFedex(fedexMawb,null,"IDE-ICLEAR-API",appInfo); | 122 | + ChmConsignment chmConsignment=consignmentService.convertToChmConsignmentFedex(fedexMawb,null,appId,appInfo); |
| 123 | if(Objects.equals(chmConsignment,null)){ | 123 | if(Objects.equals(chmConsignment,null)){ |
| 124 | result.setCode(ErrorCodeEnum.ERROR_7.getCode()); | 124 | result.setCode(ErrorCodeEnum.ERROR_7.getCode()); |
| 125 | result.setMsg(ErrorCodeEnum.ERROR_7.getName()); | 125 | result.setMsg(ErrorCodeEnum.ERROR_7.getName()); | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | -import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 4 | import com.erry.iclear.dateInterface.api.request.HsCodeParam; | 3 | import com.erry.iclear.dateInterface.api.request.HsCodeParam; |
| 5 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; | 4 | import com.erry.iclear.dateInterface.api.response.ResultHsCode; |
| 6 | import com.erry.iclear.dateInterface.common.Constant; | 5 | import com.erry.iclear.dateInterface.common.Constant; |
| 6 | +import com.erry.iclear.dateInterface.dto.HsCodeAndDescriptionDto; | ||
| 7 | import com.erry.iclear.dateInterface.entity.HsCode; | 7 | import com.erry.iclear.dateInterface.entity.HsCode; |
| 8 | +import com.erry.iclear.dateInterface.entity.HsCodeAndDescription; | ||
| 9 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 8 | import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | 10 | import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; |
| 11 | +import com.erry.iclear.dateInterface.repository.HsCodeAndDescriptionRepository; | ||
| 9 | import com.erry.iclear.dateInterface.repository.HsCodeRepository; | 12 | import com.erry.iclear.dateInterface.repository.HsCodeRepository; |
| 10 | import com.erry.iclear.dateInterface.util.StringUtil; | 13 | import com.erry.iclear.dateInterface.util.StringUtil; |
| 11 | import lombok.extern.slf4j.Slf4j; | 14 | import lombok.extern.slf4j.Slf4j; |
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | import org.springframework.stereotype.Service; | 16 | import org.springframework.stereotype.Service; |
| 14 | 17 | ||
| 15 | -import java.util.*; | 18 | +import java.math.BigDecimal; |
| 19 | +import java.util.Arrays; | ||
| 20 | +import java.util.HashMap; | ||
| 21 | +import java.util.List; | ||
| 22 | +import java.util.Map; | ||
| 16 | 23 | ||
| 17 | /** | 24 | /** |
| 18 | * hscode service | 25 | * hscode service |
| ... | @@ -27,6 +34,8 @@ public class HsCodeService { | ... | @@ -27,6 +34,8 @@ public class HsCodeService { |
| 27 | HsCodeRepository hsCodeRepository; | 34 | HsCodeRepository hsCodeRepository; |
| 28 | @Autowired | 35 | @Autowired |
| 29 | DictionaryEntriesRepository dicEntriesRepository; | 36 | DictionaryEntriesRepository dicEntriesRepository; |
| 37 | + @Autowired | ||
| 38 | + HsCodeAndDescriptionRepository hsCodeAndDescriptionRepository; | ||
| 30 | 39 | ||
| 31 | /** | 40 | /** |
| 32 | * 根据hscode编码查询对应的hscode | 41 | * 根据hscode编码查询对应的hscode |
| ... | @@ -168,29 +177,73 @@ public class HsCodeService { | ... | @@ -168,29 +177,73 @@ public class HsCodeService { |
| 168 | * 2023年2月24日17:29:49 | 177 | * 2023年2月24日17:29:49 |
| 169 | */ | 178 | */ |
| 170 | public void setHscodeSupervise(List<HsCode> hsCodeList){ | 179 | public void setHscodeSupervise(List<HsCode> hsCodeList){ |
| 171 | - List<Long> hsCodeIds = new ArrayList<>(); | 180 | + Map hsCodeAndDescription1 = new HashMap(); |
| 172 | - Map<String,Object> hscodeMap = this.getHscodeSupervise(); | 181 | + List<HsCodeAndDescription> hsCodeAndDescriptionList = hsCodeAndDescriptionRepository.selectAndType(1); |
| 173 | - StringBuffer shsql = new StringBuffer("'"); | 182 | + if (hsCodeAndDescriptionList.size() > 0) { |
| 174 | - if (hscodeMap !=null && hscodeMap.size()>0){ | 183 | + for (HsCodeAndDescription hsCodeAndDescription : hsCodeAndDescriptionList) { |
| 175 | - for (Map.Entry hscodeEntry :hscodeMap.entrySet()){ | 184 | + HsCodeAndDescriptionDto hsCodeAndDescriptionDto = new HsCodeAndDescriptionDto(hsCodeAndDescription); |
| 176 | - HsCode hsCode = (HsCode) hscodeEntry.getValue(); | 185 | + hsCodeAndDescription1.put(hsCodeAndDescriptionDto.getB(), hsCodeAndDescriptionDto); |
| 177 | - hsCodeIds.add(hsCode.getId()); | ||
| 178 | } | 186 | } |
| 179 | } | 187 | } |
| 180 | - hsCodeList.forEach(hsCode->{ | 188 | + List<String> dictionaryEntriesList = dicEntriesRepository.findDicEntByCodeList(Constant.supervise_condition,1); |
| 181 | - //判断该hscode是否只能申报D类 | 189 | + for (HsCode hsCode : hsCodeList) { |
| 182 | - if(hsCodeIds.contains(hsCode.getId())){ | 190 | + Map<String,Object> hscodeMap = new HashMap<>(); |
| 183 | - //d类 | 191 | + hscodeMap.put("success",false); |
| 184 | - hsCode.setRestrictedC(1); | 192 | + Boolean isTrue = false; |
| 185 | - }else{ | 193 | + if (hsCode !=null){ |
| 186 | - //C类 | 194 | + if(hsCodeAndDescription1.size()>0){ |
| 187 | - hsCode.setRestrictedC(0); | 195 | + String fieldValue =getSubHscode(hsCode.getSkuCode()); |
| 188 | - } | 196 | + if (hsCodeAndDescription1.size()>0 && !StringUtil.isEmptyWithTrim(fieldValue)){ |
| 189 | - //如果ID为空,则设置为空 | 197 | + //hsCodeAndDescription1.get(fieldValue); |
| 190 | - if(hsCode.getId() == null){ | 198 | + if (hsCodeAndDescription1.get(fieldValue) != null){ |
| 191 | - hsCode.setRestrictedC(null); | 199 | + isTrue = true; |
| 192 | - } | 200 | + } |
| 193 | - }); | 201 | + } |
| 202 | + } | ||
| 203 | + if (dictionaryEntriesList != null && dictionaryEntriesList.size() >0){ | ||
| 204 | + for (String str : dictionaryEntriesList){ | ||
| 205 | + if (!StringUtil.isEmptyWithTrim(hsCode.getMonitorCondition()) || hsCode.getOutRate() != null){ | ||
| 206 | + if (hsCode.getMonitorCondition().indexOf(str) > -1 || hsCode.getOutRate().compareTo(BigDecimal.valueOf(0)) > 0){ | ||
| 207 | + isTrue = true; | ||
| 208 | + } | ||
| 209 | + } | ||
| 210 | + } | ||
| 211 | + } | ||
| 212 | + if (isTrue){ | ||
| 213 | + hsCode.setRestrictedC(1); | ||
| 214 | + }else { | ||
| 215 | + hsCode.setRestrictedC(0); | ||
| 216 | + } | ||
| 217 | + if (hsCode.getId()==null){ | ||
| 218 | + hsCode.setRestrictedC(null); | ||
| 219 | + } | ||
| 220 | + } | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + | ||
| 224 | +// List<Long> hsCodeIds = new ArrayList<>(); | ||
| 225 | +// Map<String,Object> hscodeMap = this.getHscodeSupervise(); | ||
| 226 | +// StringBuffer shsql = new StringBuffer("'"); | ||
| 227 | +// if (hscodeMap !=null && hscodeMap.size()>0){ | ||
| 228 | +// for (Map.Entry hscodeEntry :hscodeMap.entrySet()){ | ||
| 229 | +// HsCode hsCode = (HsCode) hscodeEntry.getValue(); | ||
| 230 | +// hsCodeIds.add(hsCode.getId()); | ||
| 231 | +// } | ||
| 232 | +// } | ||
| 233 | +// hsCodeList.forEach(hsCode->{ | ||
| 234 | +// //判断该hscode是否只能申报D类 | ||
| 235 | +// if(hsCodeIds.contains(hsCode.getId())){ | ||
| 236 | +// //d类 | ||
| 237 | +// hsCode.setRestrictedC(1); | ||
| 238 | +// }else{ | ||
| 239 | +// //C类 | ||
| 240 | +// hsCode.setRestrictedC(0); | ||
| 241 | +// } | ||
| 242 | +// //如果ID为空,则设置为空 | ||
| 243 | +// if(hsCode.getId() == null){ | ||
| 244 | +// hsCode.setRestrictedC(null); | ||
| 245 | +// } | ||
| 246 | +// }); | ||
| 194 | } | 247 | } |
| 195 | 248 | ||
| 196 | /** | 249 | /** | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | -import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | 3 | +import com.erry.iclear.dateInterface.api.request.FedexMawb; |
| 4 | +import com.erry.iclear.dateInterface.api.request.FedexMawbDetail; | ||
| 4 | import com.erry.iclear.dateInterface.api.request.Mawb; | 5 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 5 | import com.erry.iclear.dateInterface.api.request.MawbDetail; | 6 | import com.erry.iclear.dateInterface.api.request.MawbDetail; |
| 6 | import com.erry.iclear.dateInterface.api.response.IClearCheckResult; | 7 | import com.erry.iclear.dateInterface.api.response.IClearCheckResult; |
| 7 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 8 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 9 | +import com.erry.iclear.dateInterface.common.Constant; | ||
| 8 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 10 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 9 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | 11 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 12 | +import com.erry.iclear.dateInterface.entity.DictionaryEntries; | ||
| 13 | +import com.erry.iclear.dateInterface.entity.SysUser; | ||
| 14 | +import com.erry.iclear.dateInterface.enums.ErrorCodeEnum; | ||
| 15 | +import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository; | ||
| 10 | import com.erry.iclear.dateInterface.repository.MawbRepository; | 16 | import com.erry.iclear.dateInterface.repository.MawbRepository; |
| 17 | +import com.erry.iclear.dateInterface.repository.SysUserRepository; | ||
| 11 | import com.erry.iclear.dateInterface.util.HttpUtils; | 18 | import com.erry.iclear.dateInterface.util.HttpUtils; |
| 12 | import com.erry.iclear.dateInterface.util.JsonToJava; | 19 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 13 | import com.erry.iclear.dateInterface.util.StringUtil; | 20 | import com.erry.iclear.dateInterface.util.StringUtil; |
| 14 | import com.google.gson.Gson; | 21 | import com.google.gson.Gson; |
| 15 | import lombok.extern.slf4j.Slf4j; | 22 | import lombok.extern.slf4j.Slf4j; |
| 23 | +import org.apache.commons.lang3.StringUtils; | ||
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 24 | import org.springframework.beans.factory.annotation.Autowired; |
| 17 | import org.springframework.beans.factory.annotation.Value; | 25 | import org.springframework.beans.factory.annotation.Value; |
| 18 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
| ... | @@ -40,6 +48,12 @@ public class MawbService { | ... | @@ -40,6 +48,12 @@ public class MawbService { |
| 40 | @Autowired | 48 | @Autowired |
| 41 | private ChmConsignmentDetailService consignmentDetailService; | 49 | private ChmConsignmentDetailService consignmentDetailService; |
| 42 | 50 | ||
| 51 | + @Autowired | ||
| 52 | + private DictionaryEntriesRepository dictionaryEntriesRepository; | ||
| 53 | + | ||
| 54 | + @Autowired | ||
| 55 | + private SysUserRepository sysUserRepository; | ||
| 56 | + | ||
| 43 | /** | 57 | /** |
| 44 | * 保存主单Request | 58 | * 保存主单Request |
| 45 | * @param mawb | 59 | * @param mawb |
| ... | @@ -60,6 +74,16 @@ public class MawbService { | ... | @@ -60,6 +74,16 @@ public class MawbService { |
| 60 | return map; | 74 | return map; |
| 61 | } | 75 | } |
| 62 | 76 | ||
| 77 | + public String checkUser(String loginName){ | ||
| 78 | + String result = null; | ||
| 79 | + SysUser sysUser = sysUserRepository.findUserByLoginName(loginName); | ||
| 80 | + if (sysUser == null){ | ||
| 81 | + result = "该用户不存在"; | ||
| 82 | + return result; | ||
| 83 | + } | ||
| 84 | + return result; | ||
| 85 | + } | ||
| 86 | + | ||
| 63 | 87 | ||
| 64 | public String checkMawbBaseInfo(Mawb mawb){ | 88 | public String checkMawbBaseInfo(Mawb mawb){ |
| 65 | 89 | ||
| ... | @@ -165,18 +189,138 @@ public class MawbService { | ... | @@ -165,18 +189,138 @@ public class MawbService { |
| 165 | } | 189 | } |
| 166 | return ""; | 190 | return ""; |
| 167 | } | 191 | } |
| 192 | + /** | ||
| 193 | + * 检查成交币制在系统中是否有效 Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr(); | ||
| 194 | + * 成交币制 TradeCurr | ||
| 195 | + * 杂费币制 OtherCurr | ||
| 196 | + * 运费币制 FeeCurr | ||
| 197 | + * 保费币制 InsurCurr | ||
| 198 | + * | ||
| 199 | + */ | ||
| 200 | + public ResultRS checkCurrency(Mawb mawb){ | ||
| 201 | + ResultRS result = new ResultRS(Boolean.TRUE,null,null,null); | ||
| 202 | + | ||
| 203 | + String feeCurr = mawb.getFeeCurr(); | ||
| 204 | + DictionaryEntries feeCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + feeCurr); | ||
| 205 | + | ||
| 206 | + String otherCurr = mawb.getOtherCurr(); | ||
| 207 | + DictionaryEntries otherCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + otherCurr); | ||
| 208 | + | ||
| 209 | + String insurCurr = mawb.getInsurCurr(); | ||
| 210 | + DictionaryEntries insurCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + insurCurr); | ||
| 211 | + | ||
| 212 | + //运费币制检查 | ||
| 213 | + if (StringUtils.isNotEmpty(feeCurr) && Objects.isNull(feeCurrDict) ){ | ||
| 214 | + result.setSuccess(Boolean.FALSE); | ||
| 215 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 216 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","运费")); | ||
| 217 | + return result; | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + //杂费币制检查 | ||
| 221 | + if (StringUtils.isNotEmpty(otherCurr) && Objects.isNull(otherCurrDict) ){ | ||
| 222 | + result.setSuccess(Boolean.FALSE); | ||
| 223 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 224 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","杂费")); | ||
| 225 | + return result; | ||
| 226 | + } | ||
| 227 | + | ||
| 228 | + //保费币制检查 | ||
| 229 | + if (StringUtils.isNotEmpty(insurCurr) && Objects.isNull(insurCurrDict) ){ | ||
| 230 | + result.setSuccess(Boolean.FALSE); | ||
| 231 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 232 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","保费")); | ||
| 233 | + return result; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + //申报币制检查 | ||
| 237 | + List<MawbDetail> mawbDetailList = mawb.getMawbDetailList(); | ||
| 238 | + for (int i = 0, maxi = mawbDetailList.size(); i < maxi; i++) { | ||
| 239 | + MawbDetail mawbDetail = mawbDetailList.get(i); | ||
| 240 | + String tradeCurr = mawbDetail.getTradeCurr(); | ||
| 241 | + DictionaryEntries tradeCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + tradeCurr); | ||
| 242 | + if((StringUtils.isNotEmpty(tradeCurr) && Objects.isNull(tradeCurrDict))){ | ||
| 243 | + result.setSuccess(Boolean.FALSE); | ||
| 244 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 245 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","")); | ||
| 246 | + break; | ||
| 247 | + } | ||
| 248 | + } | ||
| 249 | + | ||
| 250 | + return result; | ||
| 251 | + } | ||
| 252 | + /** | ||
| 253 | + * 检查成交币制在系统中是否有效 Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr(); | ||
| 254 | + * 成交币制 TradeCurr | ||
| 255 | + * 杂费币制 OtherCurr | ||
| 256 | + * 运费币制 FeeCurr | ||
| 257 | + * 保费币制 InsurCurr | ||
| 258 | + * | ||
| 259 | + */ | ||
| 260 | + public ResultRS checkCurrency(FedexMawb mawb){ | ||
| 261 | + ResultRS result = new ResultRS(Boolean.TRUE,null,null,null); | ||
| 262 | + | ||
| 263 | + String feeCurr = mawb.getFeeCurr(); | ||
| 264 | + DictionaryEntries feeCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + feeCurr); | ||
| 265 | + | ||
| 266 | + String otherCurr = mawb.getOtherCurr(); | ||
| 267 | + DictionaryEntries otherCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + otherCurr); | ||
| 268 | + | ||
| 269 | + String insurCurr = mawb.getInsurCurr(); | ||
| 270 | + DictionaryEntries insurCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + insurCurr); | ||
| 271 | + | ||
| 272 | + //运费币制检查 | ||
| 273 | + if (StringUtils.isNotEmpty(feeCurr) && Objects.isNull(feeCurrDict) ){ | ||
| 274 | + result.setSuccess(Boolean.FALSE); | ||
| 275 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 276 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","运费")); | ||
| 277 | + return result; | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + //杂费币制检查 | ||
| 281 | + if (StringUtils.isNotEmpty(otherCurr) && Objects.isNull(otherCurrDict) ){ | ||
| 282 | + result.setSuccess(Boolean.FALSE); | ||
| 283 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 284 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","杂费")); | ||
| 285 | + return result; | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + //保费币制检查 | ||
| 289 | + if (StringUtils.isNotEmpty(insurCurr) && Objects.isNull(insurCurrDict) ){ | ||
| 290 | + result.setSuccess(Boolean.FALSE); | ||
| 291 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 292 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","保费")); | ||
| 293 | + return result; | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + //申报币制检查 | ||
| 297 | + List<FedexMawbDetail> mawbDetailList = mawb.getMawbDetailList(); | ||
| 298 | + for (int i = 0, maxi = mawbDetailList.size(); i < maxi; i++) { | ||
| 299 | + FedexMawbDetail mawbDetail = mawbDetailList.get(i); | ||
| 300 | + String tradeCurr = mawbDetail.getTradeCurr(); | ||
| 301 | + DictionaryEntries tradeCurrDict = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM + tradeCurr); | ||
| 302 | + if((StringUtils.isNotEmpty(tradeCurr) && Objects.isNull(tradeCurrDict))){ | ||
| 303 | + result.setSuccess(Boolean.FALSE); | ||
| 304 | + result.setCode(ErrorCodeEnum.ERROR_30106.getCode()); | ||
| 305 | + result.setMsg(ErrorCodeEnum.ERROR_30106.getName().replace("{columnName}","")); | ||
| 306 | + break; | ||
| 307 | + } | ||
| 308 | + } | ||
| 309 | + | ||
| 310 | + return result; | ||
| 311 | + } | ||
| 168 | 312 | ||
| 169 | /** | 313 | /** |
| 170 | * 校验主单 | 314 | * 校验主单 |
| 171 | * @param mawb | 315 | * @param mawb |
| 172 | * @return | 316 | * @return |
| 173 | */ | 317 | */ |
| 174 | - public ResultRS checkMawb(Mawb mawb){ | 318 | + public ResultRS checkMawb(Mawb mawb,String appId){ |
| 175 | ResultRS result = new ResultRS(Boolean.FALSE,null,null,null); | 319 | ResultRS result = new ResultRS(Boolean.FALSE,null,null,null); |
| 176 | try{ | 320 | try{ |
| 177 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)); | 321 | log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)); |
| 178 | //1、将请求转换为运单 | 322 | //1、将请求转换为运单 |
| 179 | - ChmConsignment chmConsignment=consignmentService.convertToChmConsignment(mawb,null,"IDE-ICLEAR-API"); | 323 | + ChmConsignment chmConsignment=consignmentService.convertToChmConsignment(mawb,null,appId); |
| 180 | if(Objects.equals(chmConsignment,null)){ | 324 | if(Objects.equals(chmConsignment,null)){ |
| 181 | result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); | 325 | result.setCode(ErrorCodeEnum.ERROR_30001.getCode()); |
| 182 | result.setMsg(ErrorCodeEnum.ERROR_30001.getName()); | 326 | result.setMsg(ErrorCodeEnum.ERROR_30001.getName()); | ... | ... |
| ... | @@ -91,8 +91,13 @@ public class FileUtils { | ... | @@ -91,8 +91,13 @@ public class FileUtils { |
| 91 | // convertBase64ToFile(sb.toString(),"C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\","6666666666666.PDF"); | 91 | // convertBase64ToFile(sb.toString(),"C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\","6666666666666.PDF"); |
| 92 | // String str = convertFileToBase64("C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\PEK00000008IM202307061516013911.PDF"); | 92 | // String str = convertFileToBase64("C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\PEK00000008IM202307061516013911.PDF"); |
| 93 | // convertBase64ToFile(str,"C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\","6666666666666.PDF"); | 93 | // convertBase64ToFile(str,"C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\","6666666666666.PDF"); |
| 94 | - String str = convertFileToBase64("C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\20220909134833_0159806202504.PDF"); | 94 | + String str = convertFileToBase64("C:\\Users\\erry-Fedex\\Desktop\\630315652909.pdf"); |
| 95 | - convertBase64ToFile(str,"C:\\Users\\erry-Fedex\\Documents\\WeChat Files\\hyssmt\\FileStorage\\File\\2023-07\\","77777777777777.PDF"); | 95 | +// convertBase64ToFile(str,"C:\\Users\\erry-Fedex\\Desktop\\","77777777777777.PDF"); |
| 96 | + System.out.println(str); | ||
| 96 | 97 | ||
| 98 | + String filePath="C:\\Users\\erry-Fedex\\Desktop\\33333.txt"; | ||
| 99 | + FileOutputStream fos = new FileOutputStream(filePath); | ||
| 100 | + fos.write(str.getBytes()); | ||
| 101 | + fos.close(); | ||
| 97 | } | 102 | } |
| 98 | } | 103 | } | ... | ... |
| ... | @@ -44,4 +44,8 @@ stamp_path=D:/workspace/prjIClear/src/main/webapp/upload/attachment/slipType_chm | ... | @@ -44,4 +44,8 @@ stamp_path=D:/workspace/prjIClear/src/main/webapp/upload/attachment/slipType_chm |
| 44 | stamp_file_name=stamp.png | 44 | stamp_file_name=stamp.png |
| 45 | #\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 | 45 | #\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 |
| 46 | api.address.proxy-url=cn2-proxy.apac.fedex.com | 46 | api.address.proxy-url=cn2-proxy.apac.fedex.com |
| 47 | -api.address.proxy-port=3128 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 47 | +api.address.proxy-port=3128 | ||
| 48 | + | ||
| 49 | +#return_message job email | ||
| 50 | +send_email_msg=zhouling.zhang@erry.com; | ||
| 51 | +send_email_cc=ICE-IClear-Support@erry.com | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -38,3 +38,7 @@ stamp_file_name=stamp.png | ... | @@ -38,3 +38,7 @@ stamp_file_name=stamp.png |
| 38 | #\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 | 38 | #\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 |
| 39 | api.address.proxy-url=cn2-proxy.apac.fedex.com | 39 | api.address.proxy-url=cn2-proxy.apac.fedex.com |
| 40 | api.address.proxy-port=3128 | 40 | api.address.proxy-port=3128 |
| 41 | + | ||
| 42 | +#return_message job email | ||
| 43 | +send_email_msg=hyssmt@vip.qq.com,li.chang@erry.com,yi.zhou@erry.com,peterhuang@fedex.com | ||
| 44 | +send_email_cc=ICE-IClear-Support@erry.com | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -37,4 +37,8 @@ stamp_path=/var/share/iclear/resources/upload/attachment/slipType_chm/ | ... | @@ -37,4 +37,8 @@ stamp_path=/var/share/iclear/resources/upload/attachment/slipType_chm/ |
| 37 | stamp_file_name=stamp.png | 37 | stamp_file_name=stamp.png |
| 38 | #\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 | 38 | #\u4EE3\u7406\u5730\u5740\uFF08\u5237\u65B0token\u3001\u4F20\u8F93\u6D77\u5173\u56DE\u6267\u5730\u5740\u3001\u63A8\u9001\u5B8C\u6574\u62A5\u6587\u5730\u5740\uFF09 |
| 39 | api.address.proxy-url=cn2-proxy.apac.fedex.com | 39 | api.address.proxy-url=cn2-proxy.apac.fedex.com |
| 40 | -api.address.proxy-port=3128 | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 40 | +api.address.proxy-port=3128 | ||
| 41 | + | ||
| 42 | +#return_message job email | ||
| 43 | +send_email_msg=zhouling.zhang@erry.com; | ||
| 44 | +send_email_cc=ICE-IClear-Support@erry.com | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -26,9 +26,4 @@ smtp_pwd= | ... | @@ -26,9 +26,4 @@ smtp_pwd= |
| 26 | #bcc | 26 | #bcc |
| 27 | email_bcc=donotreply@fedex.com | 27 | email_bcc=donotreply@fedex.com |
| 28 | #email link | 28 | #email link |
| 29 | -#email_link=http://localhost:8080/Exp | 29 | +#email_link=http://localhost:8080/Exp |
| 30 | -#user email | ||
| 31 | -send_email=hyssmt@vip.qq.com,li.chang@erry.com | ||
| 32 | -#return_message job email | ||
| 33 | -send_email_msg=hyssmt@vip.qq.com,li.chang@erry.com,yi.zhou@erry.com | ||
| 34 | -send_email_cc=ICE-IClear-Support@erry.com | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -33,7 +33,7 @@ public class ApiTest { | ... | @@ -33,7 +33,7 @@ public class ApiTest { |
| 33 | public static void main(String[] args) throws Exception{ | 33 | public static void main(String[] args) throws Exception{ |
| 34 | // BASF,iClearExportC,6db193cb4165a71b | 34 | // BASF,iClearExportC,6db193cb4165a71b |
| 35 | System.out.println(new Date(Long.valueOf(timeStamp))); | 35 | System.out.println(new Date(Long.valueOf(timeStamp))); |
| 36 | - String token = SHA256Util.getSHA256String("IMPORT" + "iClearExportIMPORT" + "2486378add08d872" + ApiTest.timeStamp); | 36 | + String token = SHA256Util.getSHA256String("SCMHOME" + "iClearExportSCMHOME" + "e9b55bcf692eb698" + ApiTest.timeStamp); |
| 37 | System.out.println(token); | 37 | System.out.println(token); |
| 38 | 38 | ||
| 39 | //D类申报的数据落地接口 | 39 | //D类申报的数据落地接口 | ... | ... |
-
Please register or login to post a comment