Showing
16 changed files
with
617 additions
and
53 deletions
| 1 | package com.erry.iclear.dateInterface.api; | 1 | package com.erry.iclear.dateInterface.api; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Basfc; | ||
| 3 | import com.erry.iclear.dateInterface.api.request.Mawb; | 4 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 4 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 5 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 5 | import com.erry.iclear.dateInterface.common.Constant; | 6 | import com.erry.iclear.dateInterface.common.Constant; |
| 6 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 7 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| 8 | +import com.erry.iclear.dateInterface.repository.MawbAdd; | ||
| 7 | import com.erry.iclear.dateInterface.service.*; | 9 | import com.erry.iclear.dateInterface.service.*; |
| 8 | import com.erry.iclear.dateInterface.util.DateUtils; | 10 | import com.erry.iclear.dateInterface.util.DateUtils; |
| 9 | import com.erry.iclear.dateInterface.util.SHA256Util; | 11 | import com.erry.iclear.dateInterface.util.SHA256Util; |
| ... | @@ -49,7 +51,7 @@ public class CustomsDataInterface { | ... | @@ -49,7 +51,7 @@ public class CustomsDataInterface { |
| 49 | @PostMapping("/sendMawb") | 51 | @PostMapping("/sendMawb") |
| 50 | @ResponseBody | 52 | @ResponseBody |
| 51 | public ResultRS sendMawb(HttpServletRequest request | 53 | public ResultRS sendMawb(HttpServletRequest request |
| 52 | - ,@Validated @RequestBody Mawb mawb) { | 54 | + ,@Validated(MawbAdd.class) @RequestBody Mawb mawb) { |
| 53 | log.info("接收到请求数据billNo:"+mawb.getBillNo()+" data:" + gson.toJson(mawb)); | 55 | log.info("接收到请求数据billNo:"+mawb.getBillNo()+" data:" + gson.toJson(mawb)); |
| 54 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); | 56 | ResultRS result = new ResultRS(Boolean.FALSE,"",""); |
| 55 | 57 | ||
| ... | @@ -134,6 +136,94 @@ public class CustomsDataInterface { | ... | @@ -134,6 +136,94 @@ public class CustomsDataInterface { |
| 134 | return result; | 136 | return result; |
| 135 | } | 137 | } |
| 136 | 138 | ||
| 139 | + @ApiOperation(value = "BASF推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawbBasf") | ||
| 140 | + @PostMapping("/sendMawbBasf") | ||
| 141 | + @ResponseBody | ||
| 142 | + public ResultRS sendMawbBasf(HttpServletRequest request | ||
| 143 | + ,@Validated @RequestBody Basfc basfc) { | ||
| 144 | + log.info("接收到请求数据consignmentCode:"+basfc.getConsignmentCode()+" data:" + gson.toJson(basfc)); | ||
| 145 | + ResultRS result = new ResultRS(Boolean.FALSE,"",""); | ||
| 146 | + | ||
| 147 | + if(Objects.equals(basfc,null)){ | ||
| 148 | + result.setCode("-7"); | ||
| 149 | + result.setMsg("请求信息不能为空"); | ||
| 150 | + return result; | ||
| 151 | + } | ||
| 152 | + //1、保存请求信息,保存到iClear的 SQLServer | ||
| 153 | + | ||
| 154 | + StopWatch sw = new StopWatch("receice mawbBasf"); | ||
| 155 | + sw.start("save log"); | ||
| 156 | + | ||
| 157 | + String appId=(String) request.getHeader("Appid"); | ||
| 158 | + String appKey=(String) request.getHeader("Appkey"); | ||
| 159 | + String timeStamp=(String) request.getHeader("TimeStamp"); | ||
| 160 | + IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogC(basfc,appId,appKey,new Date(Long.valueOf(timeStamp)))); | ||
| 161 | + | ||
| 162 | + basfc.setAppId(appId); | ||
| 163 | + Mawb saveMawbBasfResult = null; | ||
| 164 | + if(!Objects.equals(saveIClearApiLogResult,null)){ | ||
| 165 | + log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId()); | ||
| 166 | + basfc.setMsgId(saveIClearApiLogResult.getMsgId()); | ||
| 167 | + basfc.getBasfcDetailList().forEach(d->{ | ||
| 168 | + d.setMsgId(saveIClearApiLogResult.getMsgId()); | ||
| 169 | + }); | ||
| 170 | + saveMawbBasfResult = mawbService.saveMawbBasf(basfc); | ||
| 171 | + if(!Objects.equals(saveMawbBasfResult,null)){ | ||
| 172 | + log.info("请求数据运单号"+basfc.getConsignmentCode()+"保存成功,msgId:"+saveMawbBasfResult.getMsgId()); | ||
| 173 | + }else{ | ||
| 174 | + log.info("请求数据运单号"+basfc.getConsignmentCode()+"保存失败,msgId:"+saveMawbBasfResult.getMsgId()); | ||
| 175 | + } | ||
| 176 | + }else{ | ||
| 177 | + log.info("请求日志保存失败,consignmentCode:"+basfc.getConsignmentCode()); | ||
| 178 | + } | ||
| 179 | + sw.stop(); | ||
| 180 | + | ||
| 181 | + | ||
| 182 | + //2、TODO 校验主单 | ||
| 183 | + /* sw.start("checkMawb"); | ||
| 184 | + result=mawbService.checkMawb(mawb); | ||
| 185 | + if(!result.getSuccess()){ | ||
| 186 | + return result; | ||
| 187 | + } | ||
| 188 | + sw.stop();*/ | ||
| 189 | + | ||
| 190 | +// //3、TODO 校验子单 | ||
| 191 | +// sw.start("checkMawbDetail"); | ||
| 192 | +// result=mawbDetailServicel.checkMawbDetail(mawb); | ||
| 193 | +// if(!result.getSuccess()){ | ||
| 194 | +// return result; | ||
| 195 | +// } | ||
| 196 | +// sw.stop(); | ||
| 197 | + | ||
| 198 | + | ||
| 199 | + //4、保存运单到iclear中 | ||
| 200 | + sw.start("processChmConsignment"); | ||
| 201 | + result = chmConsignmentService.processChmConsignment(saveMawbBasfResult, timeStamp,appId); | ||
| 202 | + if(!result.getSuccess()){ | ||
| 203 | + return result; | ||
| 204 | + } | ||
| 205 | + sw.stop(); | ||
| 206 | + | ||
| 207 | + | ||
| 208 | + //5、更新日志 | ||
| 209 | + sw.start("updateIClearApiLog"); | ||
| 210 | + if(!Objects.equals(saveIClearApiLogResult,null)){ | ||
| 211 | + saveIClearApiLogResult.setReceiveResult(result.getSuccess().toString()); | ||
| 212 | + saveIClearApiLogResult.setErrorCode(result.getCode()); | ||
| 213 | + saveIClearApiLogResult.setResponseTime(new Date()); | ||
| 214 | + saveIClearApiLogResult.setSpendTime(sw.getTotalTimeMillis()); | ||
| 215 | + | ||
| 216 | + iClearApiLogService.updateIClearApiLog(saveIClearApiLogResult); | ||
| 217 | + } | ||
| 218 | + log.info("请求数据consignmentCode:"+basfc.getConsignmentCode() +" 接收结束"); | ||
| 219 | + sw.stop(); | ||
| 220 | + log.info(sw.prettyPrint()); | ||
| 221 | + | ||
| 222 | + //6、return result | ||
| 223 | + result.setSuccess(Boolean.TRUE); | ||
| 224 | + result.setCode("0"); | ||
| 225 | + return result; | ||
| 226 | + } | ||
| 137 | } | 227 | } |
| 138 | 228 | ||
| 139 | 229 | ... | ... |
| 1 | +package com.erry.iclear.dateInterface.api.request; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import io.swagger.annotations.ApiOperation; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import org.hibernate.annotations.DynamicInsert; | ||
| 8 | +import org.hibernate.annotations.DynamicUpdate; | ||
| 9 | + | ||
| 10 | +import javax.persistence.*; | ||
| 11 | +import javax.validation.Valid; | ||
| 12 | +import javax.validation.constraints.NotBlank; | ||
| 13 | +import java.io.Serializable; | ||
| 14 | +import java.util.List; | ||
| 15 | + | ||
| 16 | +@ApiModel(value = "basfc", description = "主运单") | ||
| 17 | +@Entity | ||
| 18 | +@Table(name = "T_ICLEAR_API_BASFC") | ||
| 19 | +@DynamicInsert | ||
| 20 | +@DynamicUpdate | ||
| 21 | +@Data | ||
| 22 | +public class Basfc implements Serializable { | ||
| 23 | + | ||
| 24 | + | ||
| 25 | + private static final long serialVersionUID = -7092144710653831972L; | ||
| 26 | + @Id | ||
| 27 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 28 | + @Column(name = "Id", insertable = false, nullable = false) | ||
| 29 | + private Long id; | ||
| 30 | + | ||
| 31 | + @ApiModelProperty(value = "用户ID", name = "AppId", example = "BASF") | ||
| 32 | + @Column(name = "APPID") | ||
| 33 | + private String AppId; | ||
| 34 | + | ||
| 35 | + @Column(name = "MSGID") | ||
| 36 | + private Long msgId; | ||
| 37 | + | ||
| 38 | + /*@ApiModelProperty(value = "权限", name = "AppKey", example = "iClearExportC") | ||
| 39 | + @Column(name = "APP_KEY") | ||
| 40 | + private String AppKey;*/ | ||
| 41 | + | ||
| 42 | + @ApiModelProperty(value = "加密码", name = "Secret") | ||
| 43 | + @Column(name = "SECRET") | ||
| 44 | + private String secret; | ||
| 45 | + | ||
| 46 | + @ApiModelProperty(value = "运单号", name = "consignmentCode") | ||
| 47 | + @Column(name = "CONSIGNMENTCODE") | ||
| 48 | + @NotBlank(message="参数consignmentCode不能为空!") | ||
| 49 | + private String consignmentCode; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty(value = "运单ID", name = "consignmentId", example = "运单记录的唯一ID") | ||
| 52 | + @Column(name = "CONSIGNMENTID") | ||
| 53 | + @NotBlank(message="参数consignmentId不能为空!") | ||
| 54 | + private Long consignmentId; | ||
| 55 | + | ||
| 56 | + @ApiModelProperty(value = "运单类型",name = "consType", example = "A/B/C/D") | ||
| 57 | + @Column(name = "CONSTYPE") | ||
| 58 | + @NotBlank(message = "参数consType不能为空!") | ||
| 59 | + private String consType; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty(value = "发件人", name = "sender") | ||
| 62 | + @Column(name = "SENDER") | ||
| 63 | + @NotBlank(message = "参数sender不能为空!") | ||
| 64 | + private String sender; | ||
| 65 | + | ||
| 66 | + @ApiModelProperty(value = "发件人海关编码", name = "shipperCustomsCode") | ||
| 67 | + @Column(name = "SHIPPERCUSTOMSCODE") | ||
| 68 | + private String shipperCustomsCode; | ||
| 69 | + | ||
| 70 | + @ApiModelProperty(value = "发件人社会信用证代码", name = "shipperSCC") | ||
| 71 | + @Column(name = "SHIPPERSCC") | ||
| 72 | + @NotBlank(message = "参数shipperSCC不能为空!") | ||
| 73 | + private String shipperSCC; | ||
| 74 | + | ||
| 75 | + @ApiModelProperty(value = "经营单位", name = "operateUnitName") | ||
| 76 | + @Column(name = "OPERATEUNITNAME") | ||
| 77 | + private String operateUnitName; | ||
| 78 | + | ||
| 79 | + @ApiModelProperty(value = "经营单位海关编码", name = "operateUnitCode") | ||
| 80 | + @Column(name = "OPERATEUNITCODE") | ||
| 81 | + private String operateUnitCode; | ||
| 82 | + | ||
| 83 | + @ApiModelProperty(value = "经营单位社会信用证代码", name = "operateSCC") | ||
| 84 | + @Column(name = "OPERATESCC") | ||
| 85 | + private String operateSCC; | ||
| 86 | + | ||
| 87 | + @ApiModelProperty(value = "EANNo", name = "EANNo") | ||
| 88 | + @Column(name = "EANNO") | ||
| 89 | + private String EANNo; | ||
| 90 | + | ||
| 91 | + @Valid | ||
| 92 | + @ApiModelProperty(value = "运单明细", name = "basfcDetailList", example = "") | ||
| 93 | + @OneToMany(cascade = CascadeType.PERSIST) | ||
| 94 | + @JoinColumn(name = "BASFCID") | ||
| 95 | + private List<BasfcDetail> basfcDetailList; | ||
| 96 | +} |
| 1 | +package com.erry.iclear.dateInterface.api.request; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import javax.persistence.*; | ||
| 8 | +import javax.validation.constraints.NotBlank; | ||
| 9 | +import javax.validation.constraints.NotNull; | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +@ApiModel(value = "basfcDetail", description = "运单明细") | ||
| 14 | +@Entity | ||
| 15 | +@Table(name = "T_ICLEAR_API_BASFCDETAIL") | ||
| 16 | +@Data | ||
| 17 | +public class BasfcDetail { | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + private static final long serialVersionUID = -6706944312498119267L; | ||
| 21 | + @Id | ||
| 22 | + @GeneratedValue(strategy = GenerationType.IDENTITY) | ||
| 23 | + @Column(name = "Id", insertable = false, nullable = false) | ||
| 24 | + private Long id; | ||
| 25 | + | ||
| 26 | + @Column(name = "MSGID") | ||
| 27 | + private Long msgId; | ||
| 28 | + | ||
| 29 | + @Column(name="BASFCID") | ||
| 30 | + private Long basfId; | ||
| 31 | + | ||
| 32 | + @Column(name="CONSIGNMENTDETAILID") | ||
| 33 | + @NotBlank(message="参数consignmentDetailId不能为空") | ||
| 34 | + private String consignmentDetailId; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty(value = "商品编号") | ||
| 37 | + @NotBlank(message="参数skuCode不能为空") | ||
| 38 | + @Column(name = "SKUCODE") | ||
| 39 | + private String skuCode; | ||
| 40 | + | ||
| 41 | + @ApiModelProperty(value = "品名") | ||
| 42 | + @NotBlank(message = "参数skuName不能为空") | ||
| 43 | + @Column(name = "SKUNAME") | ||
| 44 | + private String skuName; | ||
| 45 | + | ||
| 46 | + @ApiModelProperty(value = "规格型号") | ||
| 47 | + @NotBlank(message="参数model不能为空") | ||
| 48 | + @Column(name = "MODEL") | ||
| 49 | + private String model; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty(value = "第一计量单位(法定单位)") | ||
| 52 | + @NotBlank(message="参数unitLegalFirst不能为空") | ||
| 53 | + @Column(name = "UNITLEGALFIRST") | ||
| 54 | + private String unitLegalFirst; | ||
| 55 | + | ||
| 56 | + @ApiModelProperty(value = "第一法定数量") | ||
| 57 | + @NotNull(message="参数qtyLegalFirst不能为空") | ||
| 58 | + @Column(name = "QTY_LEGALFIRST") | ||
| 59 | + private BigDecimal qtyLegalFirst; | ||
| 60 | + | ||
| 61 | + @ApiModelProperty(value = "成交计量单位") | ||
| 62 | + @NotBlank(message="参数knockdownUnit不能为空") | ||
| 63 | + @Column(name = "KNOCKDOWNUNIT") | ||
| 64 | + private String knockdownUnit; | ||
| 65 | + | ||
| 66 | + @ApiModelProperty(value = "成交数量") | ||
| 67 | + @NotNull(message="参数knockdownNumber不能为空") | ||
| 68 | + @Column(name = "KNOCKDOWNNUMBER") | ||
| 69 | + private BigDecimal knockdownNumber; | ||
| 70 | + | ||
| 71 | + @ApiModelProperty(value = "第二计量单位") | ||
| 72 | + @Column(name = "UNITLEGALSECOND") | ||
| 73 | + private String unitLegalSecond; | ||
| 74 | + | ||
| 75 | + @ApiModelProperty(value = "第二法定数量") | ||
| 76 | + @NotNull(message="参数qtyLegalSecond不能为空") | ||
| 77 | + @Column(name = "QTYLEGALSECOND") | ||
| 78 | + private BigDecimal qtyLegalSecond; | ||
| 79 | + | ||
| 80 | + @ApiModelProperty(value = "申报金额") | ||
| 81 | + @NotBlank(message = "参数declaredAmount不能为空") | ||
| 82 | + @Column(name = "DECLAREDAMOUNT") | ||
| 83 | + private BigDecimal declaredAmount; | ||
| 84 | + | ||
| 85 | + @ApiModelProperty(value = "币制") | ||
| 86 | + @NotBlank(message="参数currency不能为空") | ||
| 87 | + @Column(name = "CURRENCY") | ||
| 88 | + private String currency; | ||
| 89 | + | ||
| 90 | + @ApiModelProperty(value = "申报重量") | ||
| 91 | + @NotBlank(message = "参数declaredWeight不能为空") | ||
| 92 | + @Column(name = "DECLAREDWEIGHT") | ||
| 93 | + private BigDecimal declaredWeight; | ||
| 94 | +} |
| 1 | package com.erry.iclear.dateInterface.api.request; | 1 | package com.erry.iclear.dateInterface.api.request; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.repository.MawbAdd; | ||
| 3 | import io.swagger.annotations.ApiModel; | 4 | import io.swagger.annotations.ApiModel; |
| 4 | import io.swagger.annotations.ApiModelProperty; | 5 | import io.swagger.annotations.ApiModelProperty; |
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| ... | @@ -41,12 +42,12 @@ public class Mawb implements Serializable { | ... | @@ -41,12 +42,12 @@ public class Mawb implements Serializable { |
| 41 | 42 | ||
| 42 | 43 | ||
| 43 | @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") | 44 | @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") |
| 44 | - @NotBlank(message="参数ieFlag不能为空") | 45 | + @NotBlank(message="参数ieFlag不能为空", groups = {MawbAdd.class}) |
| 45 | @Column(name = "IEFLAG") | 46 | @Column(name = "IEFLAG") |
| 46 | private String ieFlag; | 47 | private String ieFlag; |
| 47 | 48 | ||
| 48 | @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX") | 49 | @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX") |
| 49 | - @NotBlank(message="参数type不能为空") | 50 | + @NotBlank(message="参数type不能为空", groups = {MawbAdd.class}) |
| 50 | @Column(name = "TYPE") | 51 | @Column(name = "TYPE") |
| 51 | private String type; | 52 | private String type; |
| 52 | 53 | ||
| ... | @@ -70,12 +71,12 @@ public class Mawb implements Serializable { | ... | @@ -70,12 +71,12 @@ public class Mawb implements Serializable { |
| 70 | private String contrNo; | 71 | private String contrNo; |
| 71 | 72 | ||
| 72 | @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101") | 73 | @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101") |
| 73 | - @NotBlank(message="参数customMaster不能为空") | 74 | + @NotBlank(message="参数customMaster不能为空", groups = {MawbAdd.class}) |
| 74 | @Column(name = "CUSTOMMASTER") | 75 | @Column(name = "CUSTOMMASTER") |
| 75 | private String customMaster; | 76 | private String customMaster; |
| 76 | 77 | ||
| 77 | @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101") | 78 | @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101") |
| 78 | - @NotBlank(message="参数cutMode不能为空") | 79 | + @NotBlank(message="参数cutMode不能为空", groups = {MawbAdd.class}) |
| 79 | @Column(name = "CUTMODE") | 80 | @Column(name = "CUTMODE") |
| 80 | private String cutMode; | 81 | private String cutMode; |
| 81 | 82 | ||
| ... | @@ -85,12 +86,12 @@ public class Mawb implements Serializable { | ... | @@ -85,12 +86,12 @@ public class Mawb implements Serializable { |
| 85 | private String declTrnRel; | 86 | private String declTrnRel; |
| 86 | 87 | ||
| 87 | @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000") | 88 | @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000") |
| 88 | - @NotBlank(message="参数distinatePort不能为空") | 89 | + @NotBlank(message="参数distinatePort不能为空", groups = {MawbAdd.class}) |
| 89 | @Column(name = "DISTINATEPORT") | 90 | @Column(name = "DISTINATEPORT") |
| 90 | private String distinatePort; | 91 | private String distinatePort; |
| 91 | 92 | ||
| 92 | @ApiModelProperty(value = "报关标志", name = "EdiId", example = "001") | 93 | @ApiModelProperty(value = "报关标志", name = "EdiId", example = "001") |
| 93 | - @NotBlank(message="参数ediId不能为空") | 94 | + @NotBlank(message="参数ediId不能为空", groups = {MawbAdd.class}) |
| 94 | @Column(name = "EDIID") | 95 | @Column(name = "EDIID") |
| 95 | private String ediId; | 96 | private String ediId; |
| 96 | 97 | ||
| ... | @@ -99,27 +100,27 @@ public class Mawb implements Serializable { | ... | @@ -99,27 +100,27 @@ public class Mawb implements Serializable { |
| 99 | private String entryId; | 100 | private String entryId; |
| 100 | 101 | ||
| 101 | @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") | 102 | @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") |
| 102 | - @NotBlank(message="参数feeCurr不能为空") | 103 | + @NotBlank(message="参数feeCurr不能为空", groups = {MawbAdd.class}) |
| 103 | @Column(name = "FEECURR") | 104 | @Column(name = "FEECURR") |
| 104 | private String feeCurr; | 105 | private String feeCurr; |
| 105 | 106 | ||
| 106 | @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") | 107 | @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") |
| 107 | - @NotBlank(message="参数feeMark不能为空") | 108 | + @NotBlank(message="参数feeMark不能为空", groups = {MawbAdd.class}) |
| 108 | @Column(name = "FEEMARK") | 109 | @Column(name = "FEEMARK") |
| 109 | private String feeMark; | 110 | private String feeMark; |
| 110 | 111 | ||
| 111 | @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358") | 112 | @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358") |
| 112 | - @NotNull(message="参数feeRate不能为空") | 113 | + @NotNull(message="参数feeRate不能为空", groups = {MawbAdd.class}) |
| 113 | @Column(name = "FEERATE") | 114 | @Column(name = "FEERATE") |
| 114 | private BigDecimal feeRate; | 115 | private BigDecimal feeRate; |
| 115 | 116 | ||
| 116 | @ApiModelProperty(value = "毛重", name = "grossWet", example = "") | 117 | @ApiModelProperty(value = "毛重", name = "grossWet", example = "") |
| 117 | - @NotNull(message="参数grossWet不能为空") | 118 | + @NotNull(message="参数grossWet不能为空", groups = {MawbAdd.class}) |
| 118 | @Column(name = "CROSSWET") | 119 | @Column(name = "CROSSWET") |
| 119 | private BigDecimal grossWet; | 120 | private BigDecimal grossWet; |
| 120 | 121 | ||
| 121 | @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101") | 122 | @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101") |
| 122 | - @NotBlank(message="参数iePort不能为空") | 123 | + @NotBlank(message="参数iePort不能为空", groups = {MawbAdd.class}) |
| 123 | @Column(name = "IEPORT") | 124 | @Column(name = "IEPORT") |
| 124 | private String iePort; | 125 | private String iePort; |
| 125 | 126 | ||
| ... | @@ -128,7 +129,7 @@ public class Mawb implements Serializable { | ... | @@ -128,7 +129,7 @@ public class Mawb implements Serializable { |
| 128 | private String inputerName; | 129 | private String inputerName; |
| 129 | 130 | ||
| 130 | @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") | 131 | @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") |
| 131 | - @NotBlank(message="参数insurCurr不能为空") | 132 | + @NotBlank(message="参数insurCurr不能为空", groups = {MawbAdd.class}) |
| 132 | @Column(name = "INSURCURR") | 133 | @Column(name = "INSURCURR") |
| 133 | private String insurCurr; | 134 | private String insurCurr; |
| 134 | 135 | ||
| ... | @@ -137,7 +138,7 @@ public class Mawb implements Serializable { | ... | @@ -137,7 +138,7 @@ public class Mawb implements Serializable { |
| 137 | private String insurMark; | 138 | private String insurMark; |
| 138 | 139 | ||
| 139 | @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "") | 140 | @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "") |
| 140 | - @NotNull(message="参数insurRate不能为空") | 141 | + @NotNull(message="参数insurRate不能为空", groups = {MawbAdd.class}) |
| 141 | @Column(name = "INSURRATE") | 142 | @Column(name = "INSURRATE") |
| 142 | private BigDecimal insurRate; | 143 | private BigDecimal insurRate; |
| 143 | 144 | ||
| ... | @@ -146,7 +147,7 @@ public class Mawb implements Serializable { | ... | @@ -146,7 +147,7 @@ public class Mawb implements Serializable { |
| 146 | private String manualNo; | 147 | private String manualNo; |
| 147 | 148 | ||
| 148 | @ApiModelProperty(value = "净重", name = "netWt", example = "") | 149 | @ApiModelProperty(value = "净重", name = "netWt", example = "") |
| 149 | - @NotNull(message="参数netWt不能为空") | 150 | + @NotNull(message="参数netWt不能为空", groups = {MawbAdd.class}) |
| 150 | @Column(name = "NETWT") | 151 | @Column(name = "NETWT") |
| 151 | private BigDecimal netWt; | 152 | private BigDecimal netWt; |
| 152 | 153 | ||
| ... | @@ -163,17 +164,17 @@ public class Mawb implements Serializable { | ... | @@ -163,17 +164,17 @@ public class Mawb implements Serializable { |
| 163 | private String otherMark; | 164 | private String otherMark; |
| 164 | 165 | ||
| 165 | @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987") | 166 | @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987") |
| 166 | - @NotBlank(message="参数ownerCode不能为空") | 167 | + @NotBlank(message="参数ownerCode不能为空", groups = {MawbAdd.class}) |
| 167 | @Column(name = "OWNERCODE") | 168 | @Column(name = "OWNERCODE") |
| 168 | private String ownerCode; | 169 | private String ownerCode; |
| 169 | 170 | ||
| 170 | @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险") | 171 | @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险") |
| 171 | - @NotBlank(message="参数ownerName不能为空") | 172 | + @NotBlank(message="参数ownerName不能为空", groups = {MawbAdd.class}) |
| 172 | @Column(name = "OWNERNAME") | 173 | @Column(name = "OWNERNAME") |
| 173 | private String ownerName; | 174 | private String ownerName; |
| 174 | 175 | ||
| 175 | @ApiModelProperty(value = "件数", name = "packNo", example = "") | 176 | @ApiModelProperty(value = "件数", name = "packNo", example = "") |
| 176 | - @NotNull(message="参数packNo不能为空") | 177 | + @NotNull(message="参数packNo不能为空", groups = {MawbAdd.class}) |
| 177 | @Column(name = "PACKNO") | 178 | @Column(name = "PACKNO") |
| 178 | private Integer packNo; | 179 | private Integer packNo; |
| 179 | 180 | ||
| ... | @@ -181,12 +182,12 @@ public class Mawb implements Serializable { | ... | @@ -181,12 +182,12 @@ public class Mawb implements Serializable { |
| 181 | private String preEntryId; | 182 | private String preEntryId; |
| 182 | 183 | ||
| 183 | @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA") | 184 | @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA") |
| 184 | - @NotBlank(message="参数tradeCountry不能为空") | 185 | + @NotBlank(message="参数tradeCountry不能为空", groups = {MawbAdd.class}) |
| 185 | @Column(name = "TRADECOUNTRY") | 186 | @Column(name = "TRADECOUNTRY") |
| 186 | private String tradeCountry; | 187 | private String tradeCountry; |
| 187 | 188 | ||
| 188 | @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200") | 189 | @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200") |
| 189 | - @NotBlank(message="参数tradeMode不能为空") | 190 | + @NotBlank(message="参数tradeMode不能为空", groups = {MawbAdd.class}) |
| 190 | @Column(name = "TRADEMODE") | 191 | @Column(name = "TRADEMODE") |
| 191 | private String tradeMode; | 192 | private String tradeMode; |
| 192 | 193 | ||
| ... | @@ -196,7 +197,7 @@ public class Mawb implements Serializable { | ... | @@ -196,7 +197,7 @@ public class Mawb implements Serializable { |
| 196 | private String tradeCode; | 197 | private String tradeCode; |
| 197 | 198 | ||
| 198 | @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1") | 199 | @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1") |
| 199 | - @NotBlank(message="参数trafMode不能为空") | 200 | + @NotBlank(message="参数trafMode不能为空", groups = {MawbAdd.class}) |
| 200 | @Column(name = "TRAFMODE") | 201 | @Column(name = "TRAFMODE") |
| 201 | private String trafMode; | 202 | private String trafMode; |
| 202 | 203 | ||
| ... | @@ -206,12 +207,12 @@ public class Mawb implements Serializable { | ... | @@ -206,12 +207,12 @@ public class Mawb implements Serializable { |
| 206 | private String tradeName; | 207 | private String tradeName; |
| 207 | 208 | ||
| 208 | @ApiModelProperty(value = "成交方式", name = "transMode", example = "2") | 209 | @ApiModelProperty(value = "成交方式", name = "transMode", example = "2") |
| 209 | - @NotBlank(message="参数transMode不能为空") | 210 | + @NotBlank(message="参数transMode不能为空", groups = {MawbAdd.class}) |
| 210 | @Column(name = "TRANSMODE") | 211 | @Column(name = "TRANSMODE") |
| 211 | private String transMode; | 212 | private String transMode; |
| 212 | 213 | ||
| 213 | @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22") | 214 | @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22") |
| 214 | - @NotBlank(message="参数wrapType不能为空") | 215 | + @NotBlank(message="参数wrapType不能为空", groups = {MawbAdd.class}) |
| 215 | @Column(name = "WRAPTYPE") | 216 | @Column(name = "WRAPTYPE") |
| 216 | private String wrapType; | 217 | private String wrapType; |
| 217 | 218 | ||
| ... | @@ -221,12 +222,12 @@ public class Mawb implements Serializable { | ... | @@ -221,12 +222,12 @@ public class Mawb implements Serializable { |
| 221 | private String tradeCodeScc; | 222 | private String tradeCodeScc; |
| 222 | 223 | ||
| 223 | @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "") | 224 | @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "") |
| 224 | - @NotBlank(message="参数ownerCodeScc不能为空") | 225 | + @NotBlank(message="参数ownerCodeScc不能为空", groups = {MawbAdd.class}) |
| 225 | @Column(name = "OWNERCODESCC") | 226 | @Column(name = "OWNERCODESCC") |
| 226 | private String ownerCodeScc; | 227 | private String ownerCodeScc; |
| 227 | 228 | ||
| 228 | @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "") | 229 | @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "") |
| 229 | - @NotBlank(message="参数tradeAreaCode不能为空") | 230 | + @NotBlank(message="参数tradeAreaCode不能为空", groups = {MawbAdd.class}) |
| 230 | @Column(name = "TRADEAREACODE") | 231 | @Column(name = "TRADEAREACODE") |
| 231 | private String tradeAreaCode; | 232 | private String tradeAreaCode; |
| 232 | 233 | ||
| ... | @@ -235,7 +236,7 @@ public class Mawb implements Serializable { | ... | @@ -235,7 +236,7 @@ public class Mawb implements Serializable { |
| 235 | private String markNo; | 236 | private String markNo; |
| 236 | 237 | ||
| 237 | @ApiModelProperty(value = "入境口岸代码", name = "entyPortCode", example = "固定值:310302") | 238 | @ApiModelProperty(value = "入境口岸代码", name = "entyPortCode", example = "固定值:310302") |
| 238 | - @NotBlank(message="参数entyPortCode不能为空") | 239 | + @NotBlank(message="参数entyPortCode不能为空", groups = {MawbAdd.class}) |
| 239 | @Column(name = "ENTYPORTCODE") | 240 | @Column(name = "ENTYPORTCODE") |
| 240 | private String entyPortCode; | 241 | private String entyPortCode; |
| 241 | 242 | ||
| ... | @@ -255,10 +256,18 @@ public class Mawb implements Serializable { | ... | @@ -255,10 +256,18 @@ public class Mawb implements Serializable { |
| 255 | private String overseasConsigneeCode; | 256 | private String overseasConsigneeCode; |
| 256 | 257 | ||
| 257 | @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "") | 258 | @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "") |
| 258 | - @NotBlank(message="参数overseasConsigneeEname不能为空") | 259 | + @NotBlank(message="参数overseasConsigneeEname不能为空", groups = {MawbAdd.class}) |
| 259 | @Column(name = "OVERSEASCONSIGNEEENAME") | 260 | @Column(name = "OVERSEASCONSIGNEEENAME") |
| 260 | private String overseasConsigneeEname; | 261 | private String overseasConsigneeEname; |
| 261 | 262 | ||
| 263 | + @ApiModelProperty(value = "运单ID", name = "consignmentCodeId", example = "") | ||
| 264 | + @Column(name = "CONSIGNMENTCODEID") | ||
| 265 | + private Long consignmentCodeId; | ||
| 266 | + | ||
| 267 | + @ApiModelProperty(value = "EANNo", name = "EANNo", example = "") | ||
| 268 | + @Column(name = "EANNO") | ||
| 269 | + private String EANNo; | ||
| 270 | + | ||
| 262 | @Valid | 271 | @Valid |
| 263 | @ApiModelProperty(value = "运单明细", name = "mawbDetailList", example = "") | 272 | @ApiModelProperty(value = "运单明细", name = "mawbDetailList", example = "") |
| 264 | @OneToMany(cascade = CascadeType.PERSIST) | 273 | @OneToMany(cascade = CascadeType.PERSIST) | ... | ... |
| 1 | package com.erry.iclear.dateInterface.api.request; | 1 | package com.erry.iclear.dateInterface.api.request; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.repository.MawbAdd; | ||
| 3 | import io.swagger.annotations.ApiModel; | 4 | import io.swagger.annotations.ApiModel; |
| 4 | import io.swagger.annotations.ApiModelProperty; | 5 | import io.swagger.annotations.ApiModelProperty; |
| 5 | import lombok.Data; | 6 | import lombok.Data; |
| ... | @@ -46,7 +47,7 @@ public class MawbDetail implements Serializable{ | ... | @@ -46,7 +47,7 @@ public class MawbDetail implements Serializable{ |
| 46 | private String codeTS; | 47 | private String codeTS; |
| 47 | 48 | ||
| 48 | @ApiModelProperty(value = "申报单价", example = "空值") | 49 | @ApiModelProperty(value = "申报单价", example = "空值") |
| 49 | - @NotNull(message="参数declPrice不能为空") | 50 | + @NotNull(message="参数declPrice不能为空", groups = {MawbAdd.class}) |
| 50 | @Column(name = "DECLPRICE") | 51 | @Column(name = "DECLPRICE") |
| 51 | private BigDecimal declPrice; | 52 | private BigDecimal declPrice; |
| 52 | 53 | ||
| ... | @@ -56,7 +57,7 @@ public class MawbDetail implements Serializable{ | ... | @@ -56,7 +57,7 @@ public class MawbDetail implements Serializable{ |
| 56 | private BigDecimal declTotal; | 57 | private BigDecimal declTotal; |
| 57 | 58 | ||
| 58 | @ApiModelProperty(value = "征免方式") | 59 | @ApiModelProperty(value = "征免方式") |
| 59 | - @NotBlank(message="参数dutyMode不能为空") | 60 | + @NotBlank(message="参数dutyMode不能为空", groups = {MawbAdd.class}) |
| 60 | @Column(name = "DUTYMODE") | 61 | @Column(name = "DUTYMODE") |
| 61 | private String dutyMode; | 62 | private String dutyMode; |
| 62 | 63 | ||
| ... | @@ -94,7 +95,7 @@ public class MawbDetail implements Serializable{ | ... | @@ -94,7 +95,7 @@ public class MawbDetail implements Serializable{ |
| 94 | private String gname; | 95 | private String gname; |
| 95 | 96 | ||
| 96 | @ApiModelProperty(value = "商品序号") | 97 | @ApiModelProperty(value = "商品序号") |
| 97 | - @NotBlank(message="参数gno不能为空") | 98 | + @NotBlank(message="参数gno不能为空", groups = {MawbAdd.class}) |
| 98 | @Column(name = "GNO") | 99 | @Column(name = "GNO") |
| 99 | private String gno; | 100 | private String gno; |
| 100 | 101 | ||
| ... | @@ -104,7 +105,7 @@ public class MawbDetail implements Serializable{ | ... | @@ -104,7 +105,7 @@ public class MawbDetail implements Serializable{ |
| 104 | private BigDecimal gqty; | 105 | private BigDecimal gqty; |
| 105 | 106 | ||
| 106 | @ApiModelProperty(value = "原产国") | 107 | @ApiModelProperty(value = "原产国") |
| 107 | - @NotBlank(message="参数originCountry不能为空") | 108 | + @NotBlank(message="参数originCountry不能为空", groups = {MawbAdd.class}) |
| 108 | @Column(name = "ORIGINCURRENTY") | 109 | @Column(name = "ORIGINCURRENTY") |
| 109 | private String originCountry; | 110 | private String originCountry; |
| 110 | 111 | ||
| ... | @@ -135,7 +136,7 @@ public class MawbDetail implements Serializable{ | ... | @@ -135,7 +136,7 @@ public class MawbDetail implements Serializable{ |
| 135 | private String ciqCode; | 136 | private String ciqCode; |
| 136 | 137 | ||
| 137 | @ApiModelProperty(value = "最终目的国(地区)") | 138 | @ApiModelProperty(value = "最终目的国(地区)") |
| 138 | - @NotBlank(message="参数destinationCountry不能为空") | 139 | + @NotBlank(message="参数destinationCountry不能为空", groups = {MawbAdd.class}) |
| 139 | @Column(name = "DESTINATIONCOUNTRY") | 140 | @Column(name = "DESTINATIONCOUNTRY") |
| 140 | private String destinationCountry; | 141 | private String destinationCountry; |
| 141 | 142 | ||
| ... | @@ -148,9 +149,11 @@ public class MawbDetail implements Serializable{ | ... | @@ -148,9 +149,11 @@ public class MawbDetail implements Serializable{ |
| 148 | private String destCode; | 149 | private String destCode; |
| 149 | 150 | ||
| 150 | @ApiModelProperty(value = "境内目的地/境内货源地") | 151 | @ApiModelProperty(value = "境内目的地/境内货源地") |
| 151 | - @NotBlank(message="参数districtCode不能为空") | 152 | + @NotBlank(message="参数districtCode不能为空", groups = {MawbAdd.class}) |
| 152 | @Column(name = "DISTRICTCODE") | 153 | @Column(name = "DISTRICTCODE") |
| 153 | private String districtCode; | 154 | private String districtCode; |
| 154 | 155 | ||
| 155 | - | 156 | + @ApiModelProperty(value = "申报重量") |
| 157 | + @Column(name = "DECLAREDWEIGHT") | ||
| 158 | + private BigDecimal declaredWeight; | ||
| 156 | } | 159 | } | ... | ... |
| ... | @@ -246,8 +246,8 @@ public class ChmConsignmentDetail implements Serializable { | ... | @@ -246,8 +246,8 @@ public class ChmConsignmentDetail implements Serializable { |
| 246 | /** | 246 | /** |
| 247 | * 申报重量 | 247 | * 申报重量 |
| 248 | * */ | 248 | * */ |
| 249 | -// @Column(name = "DECLARED_WEIGHT") | 249 | + @Column(name = "DECLARED_WEIGHT") |
| 250 | -// private BigDecimal declaredWeight; | 250 | + private BigDecimal declaredWeight; |
| 251 | /** | 251 | /** |
| 252 | * 录入品名 | 252 | * 录入品名 |
| 253 | */ | 253 | */ | ... | ... |
| ... | @@ -297,7 +297,7 @@ public class ApiService { | ... | @@ -297,7 +297,7 @@ public class ApiService { |
| 297 | String nDate = DateUtils.formatDate(noticeDate,"yyyy-MM-dd HH:mm:ss"); | 297 | String nDate = DateUtils.formatDate(noticeDate,"yyyy-MM-dd HH:mm:ss"); |
| 298 | receiptMessage.setNoticeDate(nDate); | 298 | receiptMessage.setNoticeDate(nDate); |
| 299 | } | 299 | } |
| 300 | - this.sendCustoms(token,receiptMessageList); | 300 | + sendCustoms(token,receiptMessageList); |
| 301 | } | 301 | } |
| 302 | } | 302 | } |
| 303 | /** | 303 | /** |
| ... | @@ -311,6 +311,6 @@ public class ApiService { | ... | @@ -311,6 +311,6 @@ public class ApiService { |
| 311 | if (declearTaskList == null){ | 311 | if (declearTaskList == null){ |
| 312 | return; | 312 | return; |
| 313 | } | 313 | } |
| 314 | - this.pushMawbAcc(token,declearTaskList); | 314 | + pushMawbAcc(token,declearTaskList); |
| 315 | } | 315 | } |
| 316 | } | 316 | } | ... | ... |
| ... | @@ -131,6 +131,62 @@ public class ChmConsignmentDetailService { | ... | @@ -131,6 +131,62 @@ public class ChmConsignmentDetailService { |
| 131 | 131 | ||
| 132 | /** | 132 | /** |
| 133 | * 转换运单明细 | 133 | * 转换运单明细 |
| 134 | + * @param mawbDetail | ||
| 135 | + * @return | ||
| 136 | + */ | ||
| 137 | + public ChmConsignmentDetail convertToChmConsignmentDetailBasf(MawbDetail mawbDetail,ChmConsignment chmConsignment){ | ||
| 138 | + ChmConsignmentDetail result = new ChmConsignmentDetail(); | ||
| 139 | + try{ | ||
| 140 | + result.setChmConsignment(chmConsignment); | ||
| 141 | + //商品编号 | ||
| 142 | + result.setSkuCode(mawbDetail.getCodeTS()); | ||
| 143 | + //申报总价 | ||
| 144 | + result.setAmount(mawbDetail.getDeclTotal()); | ||
| 145 | + //第一计量单位(法定单位) | ||
| 146 | + DictionaryEntries firstUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit()); | ||
| 147 | + if(!Objects.equals(firstUnitDictionaryEntries,null)){ | ||
| 148 | + result.setUnitLegalFirstId(firstUnitDictionaryEntries); | ||
| 149 | + result.setUnitLegalFirst(firstUnitDictionaryEntries.getChineseName()); | ||
| 150 | + } | ||
| 151 | + //第一法定数量 | ||
| 152 | + result.setQtyLegalFirst(BigDecimal.valueOf(mawbDetail.getFirstQty().doubleValue())); | ||
| 153 | + //成交计量单位 | ||
| 154 | + //2021年7月8日 成交单位有修改,原取值第一法定计量单位,先取值成交单位。xjq | ||
| 155 | + DictionaryEntries knockdownUnitEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getGunit()); | ||
| 156 | + if(!Objects.equals(knockdownUnitEntries,null)){ | ||
| 157 | + result.setKnockdownUnitDic(knockdownUnitEntries); | ||
| 158 | + result.setKnockdownUnit(knockdownUnitEntries.getChineseName()); | ||
| 159 | + } | ||
| 160 | + //商品规格、型号 | ||
| 161 | + result.setModel(mawbDetail.getGmodel()); | ||
| 162 | + //商品名称 | ||
| 163 | + result.setSkuName(mawbDetail.getGname()); | ||
| 164 | + //成交数量 | ||
| 165 | + result.setKnockdownNumber(BigDecimal.valueOf(mawbDetail.getGqty().doubleValue())); | ||
| 166 | + //第二计量单位 | ||
| 167 | + DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit()); | ||
| 168 | + if(!Objects.equals(secondUnitDictionaryEntries,null)){ | ||
| 169 | + result.setUnitLegalSecondId(secondUnitDictionaryEntries); | ||
| 170 | + result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName()); | ||
| 171 | + } | ||
| 172 | + //第二法定数量 | ||
| 173 | + result.setQtyLegalSecond(BigDecimal.valueOf(mawbDetail.getSecondQty().doubleValue())); | ||
| 174 | + //成交币制 | ||
| 175 | + DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr()); | ||
| 176 | + if(!Objects.equals(currencyDictionaryEntries,null)){ | ||
| 177 | + result.setCurrencyDic(currencyDictionaryEntries); | ||
| 178 | + result.setCurrency(currencyDictionaryEntries.getChineseName()); | ||
| 179 | + } | ||
| 180 | + result.setDeclaredWeight(mawbDetail.getDeclaredWeight()); | ||
| 181 | + result.setDetailId(mawbDetail.getDetailId()); | ||
| 182 | + }catch (Exception e){ | ||
| 183 | + log.error("convertToChmConsignmentDetailBasf() error:"+e.getMessage()); | ||
| 184 | + } | ||
| 185 | + return result; | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + /** | ||
| 189 | + * 转换运单明细 | ||
| 134 | * @param detail | 190 | * @param detail |
| 135 | * @param gno | 191 | * @param gno |
| 136 | * @return | 192 | * @return | ... | ... |
| ... | @@ -224,6 +224,59 @@ public class ChmConsignmentService { | ... | @@ -224,6 +224,59 @@ public class ChmConsignmentService { |
| 224 | return result; | 224 | return result; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | + public ChmConsignment convertToChmConsignmentBasf(Mawb mawb,Date pushTime,String creator){ | ||
| 228 | + ChmConsignment result = new ChmConsignment(); | ||
| 229 | + try{ | ||
| 230 | + //运单号 | ||
| 231 | + result.setConsignmentCode(mawb.getBillNo()); | ||
| 232 | + //运单类型 | ||
| 233 | + DictionaryEntries consType = Constant.dictionaryEntriesCache.get(Constant.MSG_TYPE_C); | ||
| 234 | + if(consType != null){ | ||
| 235 | + result.setConsTypeId(consType); | ||
| 236 | + result.setConsType(consType.getChineseName()); | ||
| 237 | + } | ||
| 238 | + //监管方式 | ||
| 239 | + /*DictionaryEntries tradeModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.SUPERVISION_MODE+Integer.parseInt(mawb.getTradeMode())); | ||
| 240 | + if(!Objects.equals(tradeModeDictionaryEntries,null)){ | ||
| 241 | + result.setTradeModeDic(tradeModeDictionaryEntries); | ||
| 242 | + result.setTradeMode(tradeModeDictionaryEntries.getChineseName()); | ||
| 243 | + }*/ | ||
| 244 | + //境内收发货人社会信用证代码 | ||
| 245 | + result.setTradeCoSCC(mawb.getTradeCodeScc()); | ||
| 246 | + //境内发货人(经营单位编码) | ||
| 247 | + result.setOperateUnitCode(mawb.getTradeCode()); | ||
| 248 | + //境内收发货人名称 | ||
| 249 | + result.setOperateUnitName(mawb.getTradeName()); | ||
| 250 | + //经营单位 | ||
| 251 | + result.setOwnerName(mawb.getOwnerName()); | ||
| 252 | + //经营单位海关编码 | ||
| 253 | + result.setOwnerCode(mawb.getOwnerCode()); | ||
| 254 | + //经营单位社会信用证代码 | ||
| 255 | + result.setOwnerCodeScc(mawb.getOwnerCodeScc()); | ||
| 256 | + | ||
| 257 | + /*//TODO 生产核销单位统一信用代码---报关形式类型 | ||
| 258 | + result.setTradeCoSCC(mawb.getTradeCodeScc()); | ||
| 259 | + //TODO 消费使用/生产销售单位单位统一编码 | ||
| 260 | + result.setOwnerCodeScc(mawb.getOwnerCodeScc());*/ | ||
| 261 | + //运单状态: C类待申报 | ||
| 262 | + DictionaryEntries transferWaybillStatusDictionaryEntries=Constant.dictionaryEntriesCache.get(Constant.TRANSFER_WAY_BILL_STATUS+"16"); | ||
| 263 | + if(!Objects.equals(transferWaybillStatusDictionaryEntries,null)){ | ||
| 264 | + result.setConsStatusDic(transferWaybillStatusDictionaryEntries); | ||
| 265 | + result.setConsStatus(transferWaybillStatusDictionaryEntries.getChineseName()); | ||
| 266 | + } | ||
| 267 | + //推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据 | ||
| 268 | + result.setCreateTime(new Date()); | ||
| 269 | + result.setUpdateTime(pushTime); | ||
| 270 | + result.setCreator(creator); | ||
| 271 | + | ||
| 272 | + }catch (Exception e){ | ||
| 273 | + result=null; | ||
| 274 | + e.printStackTrace(); | ||
| 275 | + log.error("convertToChmConsignmentBasf() error:"+e.getMessage()); | ||
| 276 | + } | ||
| 277 | + return result; | ||
| 278 | + } | ||
| 279 | + | ||
| 227 | /** | 280 | /** |
| 228 | * 运单转换主单 | 281 | * 运单转换主单 |
| 229 | * @return | 282 | * @return |
| ... | @@ -414,18 +467,29 @@ public class ChmConsignmentService { | ... | @@ -414,18 +467,29 @@ public class ChmConsignmentService { |
| 414 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); | 467 | ResultRS result = new ResultRS(Boolean.FALSE,null,null); |
| 415 | try { | 468 | try { |
| 416 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); | 469 | Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp)); |
| 417 | - | 470 | + ChmConsignment chmConsignment = null; |
| 418 | //1、将请求转换为运单 | 471 | //1、将请求转换为运单 |
| 419 | - ChmConsignment chmConsignment=this.convertToChmConsignment(mawb,pushTime,creator); | 472 | + if(mawb.getType().equals(Constant.MSG_TYPE_C)){ |
| 473 | + chmConsignment=this.convertToChmConsignmentBasf(mawb,pushTime,creator); | ||
| 474 | + }else{ | ||
| 475 | + chmConsignment=this.convertToChmConsignment(mawb,pushTime,creator); | ||
| 476 | + } | ||
| 420 | if(Objects.equals(chmConsignment,null)){ | 477 | if(Objects.equals(chmConsignment,null)){ |
| 421 | result.setCode("30001"); | 478 | result.setCode("30001"); |
| 422 | result.setMsg("数据格式不正确"); | 479 | result.setMsg("数据格式不正确"); |
| 423 | return result; | 480 | return result; |
| 424 | } | 481 | } |
| 425 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); | 482 | List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>(); |
| 426 | - mawb.getMawbDetailList().forEach(detail ->{ | 483 | + ChmConsignment finalChmConsignment = chmConsignment; |
| 427 | - chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail,chmConsignment)); | 484 | + if (mawb.getType().equals(Constant.MSG_TYPE_C)){ |
| 428 | - }); | 485 | + mawb.getMawbDetailList().forEach(detail ->{ |
| 486 | + chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetailBasf(detail, finalChmConsignment)); | ||
| 487 | + }); | ||
| 488 | + }else { | ||
| 489 | + mawb.getMawbDetailList().forEach(detail ->{ | ||
| 490 | + chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail, finalChmConsignment)); | ||
| 491 | + }); | ||
| 492 | + } | ||
| 429 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); | 493 | chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList); |
| 430 | 494 | ||
| 431 | //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 | 495 | //2、校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入 | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Basfc; | ||
| 3 | import com.erry.iclear.dateInterface.api.request.Mawb; | 4 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 4 | import com.erry.iclear.dateInterface.common.Constant; | 5 | import com.erry.iclear.dateInterface.common.Constant; |
| 5 | import com.erry.iclear.dateInterface.entity.IClearApiLog; | 6 | import com.erry.iclear.dateInterface.entity.IClearApiLog; |
| ... | @@ -58,6 +59,29 @@ public class IClearApiLogService { | ... | @@ -58,6 +59,29 @@ public class IClearApiLogService { |
| 58 | return result; | 59 | return result; |
| 59 | } | 60 | } |
| 60 | 61 | ||
| 62 | + /** | ||
| 63 | + * 创建日志 | ||
| 64 | + * @return | ||
| 65 | + */ | ||
| 66 | + public IClearApiLog convertToIClearApiLogC(Basfc basfc, String appId, String appKey, Date pushTime){ | ||
| 67 | + IClearApiLog result = new IClearApiLog(); | ||
| 68 | + try{ | ||
| 69 | + result.setMsgType(Constant.MSG_TYPE_C); | ||
| 70 | + result.setAppId(appId); | ||
| 71 | + result.setAppKey(appKey); | ||
| 72 | + result.setCreateTime(new Date()); | ||
| 73 | + result.setPushTime(pushTime); | ||
| 74 | + result.setReceiveResult(null); | ||
| 75 | + result.setResponseTime(null); | ||
| 76 | + result.setSpendTime(null); | ||
| 77 | + result.setSendTimes(1); | ||
| 78 | + result.setBillNo(basfc.getConsignmentCode()); | ||
| 79 | + //result.setContrNo(mawb.getContrNo()); | ||
| 80 | + }catch (Exception e){ | ||
| 81 | + log.error("convertToIClearApiLog() error:"+e.getMessage()); | ||
| 82 | + } | ||
| 83 | + return result; | ||
| 84 | + } | ||
| 61 | 85 | ||
| 62 | 86 | ||
| 63 | public void updateIClearApiLog(IClearApiLog iClearApiLog){ | 87 | public void updateIClearApiLog(IClearApiLog iClearApiLog){ | ... | ... |
| ... | @@ -3,21 +3,25 @@ package com.erry.iclear.dateInterface.service; | ... | @@ -3,21 +3,25 @@ package com.erry.iclear.dateInterface.service; |
| 3 | import com.arronlong.httpclientutil.HttpClientUtil; | 3 | import com.arronlong.httpclientutil.HttpClientUtil; |
| 4 | import com.arronlong.httpclientutil.common.HttpConfig; | 4 | import com.arronlong.httpclientutil.common.HttpConfig; |
| 5 | import com.arronlong.httpclientutil.common.HttpHeader; | 5 | import com.arronlong.httpclientutil.common.HttpHeader; |
| 6 | +import com.erry.iclear.dateInterface.api.request.Basfc; | ||
| 7 | +import com.erry.iclear.dateInterface.api.request.BasfcDetail; | ||
| 6 | import com.erry.iclear.dateInterface.api.request.Mawb; | 8 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 9 | +import com.erry.iclear.dateInterface.api.request.MawbDetail; | ||
| 7 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; | 10 | import com.erry.iclear.dateInterface.api.response.IClearCheckResponseResult; |
| 8 | import com.erry.iclear.dateInterface.api.response.ResultRS; | 11 | import com.erry.iclear.dateInterface.api.response.ResultRS; |
| 9 | -import com.erry.iclear.dateInterface.api.response.TokenResult; | ||
| 10 | import com.erry.iclear.dateInterface.entity.ChmConsignment; | 12 | import com.erry.iclear.dateInterface.entity.ChmConsignment; |
| 11 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; | 13 | import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail; |
| 14 | +import com.erry.iclear.dateInterface.repository.MawbAdd; | ||
| 12 | import com.erry.iclear.dateInterface.repository.MawbRepository; | 15 | import com.erry.iclear.dateInterface.repository.MawbRepository; |
| 13 | import com.erry.iclear.dateInterface.util.JsonToJava; | 16 | import com.erry.iclear.dateInterface.util.JsonToJava; |
| 17 | +import com.erry.iclear.dateInterface.util.NumberUtils; | ||
| 14 | import com.google.gson.Gson; | 18 | import com.google.gson.Gson; |
| 15 | import lombok.extern.slf4j.Slf4j; | 19 | import lombok.extern.slf4j.Slf4j; |
| 16 | import org.apache.http.Header; | 20 | import org.apache.http.Header; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.beans.factory.annotation.Value; | 22 | import org.springframework.beans.factory.annotation.Value; |
| 19 | -import org.springframework.scheduling.annotation.Scheduled; | ||
| 20 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 24 | +import org.springframework.validation.annotation.Validated; | ||
| 21 | 25 | ||
| 22 | import java.util.ArrayList; | 26 | import java.util.ArrayList; |
| 23 | import java.util.List; | 27 | import java.util.List; |
| ... | @@ -62,6 +66,66 @@ public class MawbService { | ... | @@ -62,6 +66,66 @@ public class MawbService { |
| 62 | 66 | ||
| 63 | 67 | ||
| 64 | /** | 68 | /** |
| 69 | + * 保存主单Request --basfc | ||
| 70 | + * @param basfc | ||
| 71 | + */ | ||
| 72 | + public Mawb saveMawbBasf(Basfc basfc){ | ||
| 73 | + Mawb result=null; | ||
| 74 | + try{ | ||
| 75 | + log.info("saveMawb start>>>>>>>>>>>"); | ||
| 76 | + //运单头部信息 | ||
| 77 | + Mawb mawb = new Mawb(); | ||
| 78 | + mawb.setAppId(basfc.getAppId()); | ||
| 79 | + mawb.setMsgId(basfc.getMsgId()); | ||
| 80 | + mawb.setConsignmentCodeId(basfc.getConsignmentId()); | ||
| 81 | + mawb.setType(basfc.getConsType()); | ||
| 82 | + //TODO 记录时为同一张表,用 '-->' 记录具体存放字段(方便查看,以免误解) | ||
| 83 | + //运单号-->提单号 | ||
| 84 | + mawb.setBillNo(basfc.getConsignmentCode()); | ||
| 85 | + //经营单位 --> 消费使用/生产销售单位名称 | ||
| 86 | + mawb.setOwnerName(basfc.getOperateUnitName()); | ||
| 87 | + //经营单位海关编码 --> 消费使用/生产销售单位代码 | ||
| 88 | + mawb.setOwnerCode(basfc.getOperateUnitCode()); | ||
| 89 | + //经营单位社会信用证代码 --> 消费使用/生产销售单位单位统一编码 | ||
| 90 | + mawb.setOwnerCodeScc(basfc.getOperateSCC()); | ||
| 91 | + //发件人 --> 境内收发货人名称 | ||
| 92 | + mawb.setTradeName(basfc.getSender()); | ||
| 93 | + //发件人海关编码 --> 境内收发货人编号 | ||
| 94 | + mawb.setTradeCode(basfc.getShipperCustomsCode()); | ||
| 95 | + //发件人社会信用证代码 --> 生产核销单位统一信用代码---报关形式类型 | ||
| 96 | + mawb.setTradeCodeScc(basfc.getShipperSCC()); | ||
| 97 | + | ||
| 98 | + mawb.setEANNo(basfc.getEANNo()); | ||
| 99 | + //明细 | ||
| 100 | + List<MawbDetail> mawbDetailList = new ArrayList<>(); | ||
| 101 | + if (basfc.getBasfcDetailList().size()>0){ | ||
| 102 | + for (BasfcDetail basfcDetail : basfc.getBasfcDetailList()){ | ||
| 103 | + MawbDetail mawbDetail = new MawbDetail(); | ||
| 104 | + mawbDetail.setDetailId(basfcDetail.getConsignmentDetailId()); | ||
| 105 | + mawbDetail.setGmodel(basfcDetail.getModel()); | ||
| 106 | + mawbDetail.setCodeTS(basfcDetail.getSkuCode()); | ||
| 107 | + mawbDetail.setGname(basfcDetail.getSkuName()); | ||
| 108 | + mawbDetail.setGqty(basfcDetail.getKnockdownNumber()); | ||
| 109 | + mawbDetail.setGunit(basfcDetail.getKnockdownUnit()); | ||
| 110 | + mawbDetail.setFirstUnit(basfcDetail.getUnitLegalFirst()); | ||
| 111 | + mawbDetail.setFirstQty(NumberUtils.bigDecimalToIntger(basfcDetail.getQtyLegalFirst())); | ||
| 112 | + mawbDetail.setSecondQty(NumberUtils.bigDecimalToIntger(basfcDetail.getQtyLegalSecond())); | ||
| 113 | + mawbDetail.setSecondUnit(basfcDetail.getUnitLegalSecond()); | ||
| 114 | + mawbDetail.setDeclTotal(basfcDetail.getDeclaredAmount()); | ||
| 115 | + mawbDetail.setTradeCurr(basfcDetail.getCurrency()); | ||
| 116 | + mawbDetail.setDeclaredWeight(basfcDetail.getDeclaredWeight()); | ||
| 117 | + mawbDetailList.add(mawbDetail); | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + mawb.setMawbDetailList(mawbDetailList); | ||
| 121 | + result = mawbRepository.save(mawb); | ||
| 122 | + log.info("saveMawb end>>>>>>>>>>>"); | ||
| 123 | + }catch (Exception e){ | ||
| 124 | + log.error("saveMawb() error:"+e.getMessage()); | ||
| 125 | + } | ||
| 126 | + return result; | ||
| 127 | + } | ||
| 128 | + /** | ||
| 65 | * 校验主单 | 129 | * 校验主单 |
| 66 | * @param mawb | 130 | * @param mawb |
| 67 | * @return | 131 | * @return | ... | ... |
| ... | @@ -12,9 +12,9 @@ task: | ... | @@ -12,9 +12,9 @@ task: |
| 12 | #推送完整报文 | 12 | #推送完整报文 |
| 13 | pushMawbTask: 0 0/1 * * * ? | 13 | pushMawbTask: 0 0/1 * * * ? |
| 14 | #推送失败的回执数据 | 14 | #推送失败的回执数据 |
| 15 | - pushErrorReturnDate: 0 0/1 * * * ? | 15 | + pushErrorReturnDate: 0 0/30 * * * ? |
| 16 | #推送失败的申报数据 | 16 | #推送失败的申报数据 |
| 17 | - pushErrorDeclareDate: 0 0/1 * * * ? | 17 | + pushErrorDeclareDate: 0 0/30 * * * ? |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | #推送地址 | 20 | #推送地址 | ... | ... |
| ... | @@ -12,9 +12,9 @@ task: | ... | @@ -12,9 +12,9 @@ task: |
| 12 | #推送完整报文 | 12 | #推送完整报文 |
| 13 | pushMawbTask: 0 0/1 * * * ? | 13 | pushMawbTask: 0 0/1 * * * ? |
| 14 | #推送失败的回执数据 | 14 | #推送失败的回执数据 |
| 15 | - pushErrorReturnDate: 0 0/1 * * * ? | 15 | + pushErrorReturnDate: 0 0/30 * * * ? |
| 16 | #推送失败的申报数据 | 16 | #推送失败的申报数据 |
| 17 | - pushErrorDeclareDate: 0 0/1 * * * ? | 17 | + pushErrorDeclareDate: 0 0/30 * * * ? |
| 18 | 18 | ||
| 19 | #推送地址 | 19 | #推送地址 |
| 20 | api: | 20 | api: | ... | ... |
| ... | @@ -12,9 +12,9 @@ task: | ... | @@ -12,9 +12,9 @@ task: |
| 12 | #推送完整报文 | 12 | #推送完整报文 |
| 13 | pushMawbTask: 0 0/1 * * * ? | 13 | pushMawbTask: 0 0/1 * * * ? |
| 14 | #推送失败的回执数据 | 14 | #推送失败的回执数据 |
| 15 | - pushErrorReturnDate: 0 0/1 * * * ? | 15 | + pushErrorReturnDate: 0 0/30 * * * ? |
| 16 | #推送失败的申报数据 | 16 | #推送失败的申报数据 |
| 17 | - pushErrorDeclareDate: 0 0/1 * * * ? | 17 | + pushErrorDeclareDate: 0 0/30 * * * ? |
| 18 | 18 | ||
| 19 | #推送地址 | 19 | #推送地址 |
| 20 | api: | 20 | api: | ... | ... |
| 1 | package com.erry.iclear.dateInterface; | 1 | package com.erry.iclear.dateInterface; |
| 2 | 2 | ||
| 3 | +import com.erry.iclear.dateInterface.api.CustomsDataInterface; | ||
| 4 | +import com.erry.iclear.dateInterface.api.request.Basfc; | ||
| 5 | +import com.erry.iclear.dateInterface.api.request.BasfcDetail; | ||
| 3 | import com.erry.iclear.dateInterface.api.request.Mawb; | 6 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 4 | import com.erry.iclear.dateInterface.api.request.MawbDetail; | 7 | import com.erry.iclear.dateInterface.api.request.MawbDetail; |
| 8 | +import com.erry.iclear.dateInterface.api.response.ResultRS; | ||
| 9 | +import com.erry.iclear.dateInterface.repository.MawbAdd; | ||
| 5 | import com.erry.iclear.dateInterface.service.ChmConsignmentService; | 10 | import com.erry.iclear.dateInterface.service.ChmConsignmentService; |
| 11 | +import com.erry.iclear.dateInterface.service.MawbService; | ||
| 6 | import org.junit.Test; | 12 | import org.junit.Test; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 8 | 15 | ||
| 9 | import java.math.BigDecimal; | 16 | import java.math.BigDecimal; |
| 10 | import java.util.ArrayList; | 17 | import java.util.ArrayList; |
| ... | @@ -17,6 +24,12 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { | ... | @@ -17,6 +24,12 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { |
| 17 | @Autowired | 24 | @Autowired |
| 18 | private ChmConsignmentService chmConsignmentService; | 25 | private ChmConsignmentService chmConsignmentService; |
| 19 | 26 | ||
| 27 | + @Autowired | ||
| 28 | + private CustomsDataInterface customsDataInterface; | ||
| 29 | + | ||
| 30 | + @Autowired | ||
| 31 | + private MawbService mawbService; | ||
| 32 | + | ||
| 20 | 33 | ||
| 21 | @Test | 34 | @Test |
| 22 | public void testProcessChmConsignment(){ | 35 | public void testProcessChmConsignment(){ |
| ... | @@ -30,10 +43,57 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { | ... | @@ -30,10 +43,57 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { |
| 30 | } | 43 | } |
| 31 | } | 44 | } |
| 32 | 45 | ||
| 46 | + @Test | ||
| 47 | + public void testProcessChmConsignment1(){ | ||
| 48 | + try{ | ||
| 49 | + Basfc basfc = this.createNewBasf(); | ||
| 50 | + Mawb mawb = mawbService.saveMawbBasf(basfc); | ||
| 51 | + //Basfc basfc = this.createNewBasf(); | ||
| 52 | + String timeStamp = String.valueOf(new Date().getTime()); | ||
| 53 | + ResultRS resultRS = chmConsignmentService.processChmConsignment(mawb, timeStamp, "BASF"); | ||
| 54 | + System.out.println(resultRS.toString()); | ||
| 55 | + }catch (Exception e){ | ||
| 56 | + e.printStackTrace(); | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + private Basfc createNewBasf(){ | ||
| 61 | + List<BasfcDetail> basfcDetailList = new ArrayList<>(); | ||
| 62 | + BasfcDetail basfcDetail = new BasfcDetail(); | ||
| 63 | + basfcDetail.setConsignmentDetailId("111"); | ||
| 64 | + basfcDetail.setSkuCode(""); | ||
| 65 | + basfcDetail.setSkuName("测试"); | ||
| 66 | + basfcDetail.setModel("0|0|1|||||||||"); | ||
| 67 | + basfcDetail.setUnitLegalFirst("035"); | ||
| 68 | + basfcDetail.setQtyLegalFirst(BigDecimal.valueOf(1)); | ||
| 69 | + basfcDetail.setKnockdownUnit("035"); | ||
| 70 | + basfcDetail.setKnockdownNumber(BigDecimal.valueOf(1)); | ||
| 71 | + basfcDetail.setUnitLegalSecond("007"); | ||
| 72 | + basfcDetail.setQtyLegalSecond(BigDecimal.valueOf(1)); | ||
| 73 | + basfcDetail.setDeclaredAmount(BigDecimal.valueOf(1)); | ||
| 74 | + basfcDetail.setCurrency("USD"); | ||
| 75 | + basfcDetail.setDeclaredWeight(BigDecimal.valueOf(1)); | ||
| 76 | + basfcDetailList.add(basfcDetail); | ||
| 77 | + | ||
| 78 | + Basfc basfc = new Basfc(); | ||
| 79 | + basfc.setConsignmentCode("211015001"); | ||
| 80 | + basfc.setConsignmentId(1L); | ||
| 81 | + basfc.setConsType("C"); | ||
| 82 | + basfc.setSender("发件人"); | ||
| 83 | + basfc.setShipperCustomsCode("1234567890"); | ||
| 84 | + basfc.setShipperSCC("123456789012345678"); | ||
| 85 | + basfc.setOperateUnitName(""); | ||
| 86 | + basfc.setOperateUnitCode(""); | ||
| 87 | + basfc.setOperateSCC(""); | ||
| 88 | + basfc.setEANNo(""); | ||
| 89 | + basfc.setBasfcDetailList(basfcDetailList); | ||
| 90 | + return basfc; | ||
| 91 | + } | ||
| 92 | + | ||
| 33 | private Mawb createNewMawb(){ | 93 | private Mawb createNewMawb(){ |
| 34 | MawbDetail d1 = new MawbDetail(); | 94 | MawbDetail d1 = new MawbDetail(); |
| 35 | d1.setClassMark(""); | 95 | d1.setClassMark(""); |
| 36 | - d1.setCodeTS("69125472"); | 96 | + d1.setCodeTS(""); |
| 37 | d1.setDeclPrice(BigDecimal.valueOf(111.123)); | 97 | d1.setDeclPrice(BigDecimal.valueOf(111.123)); |
| 38 | d1.setDeclTotal(BigDecimal.valueOf(788)); | 98 | d1.setDeclTotal(BigDecimal.valueOf(788)); |
| 39 | d1.setDutyMode("1"); | 99 | d1.setDutyMode("1"); |
| ... | @@ -100,7 +160,7 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { | ... | @@ -100,7 +160,7 @@ public class ChmConsignmentServiceTest extends IClearApiApplicationTests { |
| 100 | mawb.setType("EX"); | 160 | mawb.setType("EX"); |
| 101 | mawb.setAgentCode("1111980005"); | 161 | mawb.setAgentCode("1111980005"); |
| 102 | mawb.setAgentName("联邦快递(中国)有限公司"); | 162 | mawb.setAgentName("联邦快递(中国)有限公司"); |
| 103 | - mawb.setBillNo("202105210784"); | 163 | + mawb.setBillNo("211015002"); |
| 104 | mawb.setContrNo("NO.565733"); | 164 | mawb.setContrNo("NO.565733"); |
| 105 | mawb.setCustomMaster("0101"); | 165 | mawb.setCustomMaster("0101"); |
| 106 | mawb.setCutMode("101"); | 166 | mawb.setCutMode("101"); | ... | ... |
-
Please register or login to post a comment