tao.mo

BASF接口

mt
2021年9月15日10:44:06
package com.erry.iclear.dateInterface.api;
import com.erry.iclear.dateInterface.api.request.Basfc;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.api.response.ResultRS;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import com.erry.iclear.dateInterface.service.BasfService;
import com.erry.iclear.dateInterface.service.IClearApiLogService;
import com.erry.iclear.dateInterface.service.MawbService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StopWatch;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.Objects;
@RestController
@RequestMapping("/basf")
@Slf4j
public class BasfDataInterface {
private Gson gson = new Gson();
@Autowired
private BasfService basfService;
@Autowired
private IClearApiLogService iClearApiLogService;
@ApiOperation(value = "BASF推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawbBasf")
@PostMapping("/sendMawbBasf")
@ResponseBody
public ResultRS sendMawbBasf(HttpServletRequest request
, @Validated @RequestBody Basfc basfc) {
log.info("接收到请求数据consignmentCode:"+basfc.getConsignmentCode()+" data:" + gson.toJson(basfc));
ResultRS result = new ResultRS(Boolean.FALSE,"","");
if(Objects.equals(basfc,null)){
result.setCode("-7");
result.setMsg("请求信息不能为空");
return result;
}
//1、保存请求信息,保存到iClear的 SQLServer
StopWatch sw = new StopWatch("receice mawbBasf");
sw.start("save log");
String appId=(String) request.getHeader("Appid");
String appKey=(String) request.getHeader("Appkey");
String timeStamp=(String) request.getHeader("TimeStamp");
IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogC(basfc,appId,appKey,new Date(Long.valueOf(timeStamp))));
basfc.setAppId(appId);
Mawb saveMawbBasfResult = null;
if(!Objects.equals(saveIClearApiLogResult,null)){
log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId());
basfc.setMsgId(saveIClearApiLogResult.getMsgId());
basfc.getBasfcDetailList().forEach(d->{
d.setMsgId(saveIClearApiLogResult.getMsgId());
});
saveMawbBasfResult = basfService.saveMawbBasf(basfc);
if(!Objects.equals(saveMawbBasfResult,null)){
log.info("请求数据运单号"+basfc.getConsignmentCode()+"保存成功,msgId:"+saveMawbBasfResult.getMsgId());
}else{
log.info("请求数据运单号"+basfc.getConsignmentCode()+"保存失败,msgId:"+saveMawbBasfResult.getMsgId());
}
}else{
log.info("请求日志保存失败,consignmentCode:"+basfc.getConsignmentCode());
}
sw.stop();
//2、TODO 校验主单
/* sw.start("checkMawb");
result=mawbService.checkMawb(mawb);
if(!result.getSuccess()){
return result;
}
sw.stop();*/
// //3、TODO 校验子单
// sw.start("checkMawbDetail");
// result=mawbDetailServicel.checkMawbDetail(mawb);
// if(!result.getSuccess()){
// return result;
// }
// sw.stop();
//4、保存运单到iclear中
sw.start("processChmConsignment");
result = chmConsignmentService.processChmConsignment(saveMawbBasfResult, timeStamp,appId);
if(!result.getSuccess()){
return result;
}
sw.stop();
//5、更新日志
sw.start("updateIClearApiLog");
if(!Objects.equals(saveIClearApiLogResult,null)){
saveIClearApiLogResult.setReceiveResult(result.getSuccess().toString());
saveIClearApiLogResult.setErrorCode(result.getCode());
saveIClearApiLogResult.setResponseTime(new Date());
saveIClearApiLogResult.setSpendTime(sw.getTotalTimeMillis());
iClearApiLogService.updateIClearApiLog(saveIClearApiLogResult);
}
log.info("请求数据consignmentCode:"+basfc.getConsignmentCode() +" 接收结束");
sw.stop();
log.info(sw.prettyPrint());
//6、return result
result.setSuccess(Boolean.TRUE);
result.setCode("0");
return result;
}
}
......@@ -135,95 +135,6 @@ public class CustomsDataInterface {
result.setCode("0");
return result;
}
@ApiOperation(value = "BASF推送运单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawbBasf")
@PostMapping("/sendMawbBasf")
@ResponseBody
public ResultRS sendMawbBasf(HttpServletRequest request
,@Validated @RequestBody Basfc basfc) {
log.info("接收到请求数据consignmentCode:"+basfc.getConsignmentCode()+" data:" + gson.toJson(basfc));
ResultRS result = new ResultRS(Boolean.FALSE,"","");
if(Objects.equals(basfc,null)){
result.setCode("-7");
result.setMsg("请求信息不能为空");
return result;
}
//1、保存请求信息,保存到iClear的 SQLServer
StopWatch sw = new StopWatch("receice mawbBasf");
sw.start("save log");
String appId=(String) request.getHeader("Appid");
String appKey=(String) request.getHeader("Appkey");
String timeStamp=(String) request.getHeader("TimeStamp");
IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLogC(basfc,appId,appKey,new Date(Long.valueOf(timeStamp))));
basfc.setAppId(appId);
Mawb saveMawbBasfResult = null;
if(!Objects.equals(saveIClearApiLogResult,null)){
log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId());
basfc.setMsgId(saveIClearApiLogResult.getMsgId());
basfc.getBasfcDetailList().forEach(d->{
d.setMsgId(saveIClearApiLogResult.getMsgId());
});
saveMawbBasfResult = mawbService.saveMawbBasf(basfc);
if(!Objects.equals(saveMawbBasfResult,null)){
log.info("请求数据运单号"+basfc.getConsignmentCode()+"保存成功,msgId:"+saveMawbBasfResult.getMsgId());
}else{
log.info("请求数据运单号"+basfc.getConsignmentCode()+"保存失败,msgId:"+saveMawbBasfResult.getMsgId());
}
}else{
log.info("请求日志保存失败,consignmentCode:"+basfc.getConsignmentCode());
}
sw.stop();
//2、TODO 校验主单
/* sw.start("checkMawb");
result=mawbService.checkMawb(mawb);
if(!result.getSuccess()){
return result;
}
sw.stop();*/
// //3、TODO 校验子单
// sw.start("checkMawbDetail");
// result=mawbDetailServicel.checkMawbDetail(mawb);
// if(!result.getSuccess()){
// return result;
// }
// sw.stop();
//4、保存运单到iclear中
sw.start("processChmConsignment");
result = chmConsignmentService.processChmConsignment(saveMawbBasfResult, timeStamp,appId);
if(!result.getSuccess()){
return result;
}
sw.stop();
//5、更新日志
sw.start("updateIClearApiLog");
if(!Objects.equals(saveIClearApiLogResult,null)){
saveIClearApiLogResult.setReceiveResult(result.getSuccess().toString());
saveIClearApiLogResult.setErrorCode(result.getCode());
saveIClearApiLogResult.setResponseTime(new Date());
saveIClearApiLogResult.setSpendTime(sw.getTotalTimeMillis());
iClearApiLogService.updateIClearApiLog(saveIClearApiLogResult);
}
log.info("请求数据consignmentCode:"+basfc.getConsignmentCode() +" 接收结束");
sw.stop();
log.info(sw.prettyPrint());
//6、return result
result.setSuccess(Boolean.TRUE);
result.setCode("0");
return result;
}
}
......
package com.erry.iclear.dateInterface.api.request;
import com.erry.iclear.dateInterface.repository.MawbAdd;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import javax.persistence.*;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* @author Administrator
*/
@ApiModel(value = "mawb", description = "主运单")
@Entity
@Table(name = "T_ICLEAR_API_MAWB")
@DynamicInsert
@DynamicUpdate
@Data
public class BasfMawb implements Serializable {
private static final long serialVersionUID = -7092144710653831972L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id", insertable = false, nullable = false)
private Long id;
@Column(name = "MSGID")
private Long msgId;
@ApiModelProperty(value = "用户ID", name = "AppId", example = "IDE")
@Column(name = "APPID")
private String AppId;
@ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E")
@NotBlank(message="参数ieFlag不能为空", groups = {MawbAdd.class})
@Column(name = "IEFLAG")
private String ieFlag;
@ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX")
@NotBlank(message="参数type不能为空", groups = {MawbAdd.class})
@Column(name = "TYPE")
private String type;
@ApiModelProperty(value = "申报单位代码", name = "agentCode", example = "固定值:1111980005")
//@NotBlank(message="参数agentCode不能为空")
@Column(name = "AGENTCODE")
private String agentCode;
@ApiModelProperty(value = "申报单位名称", name = "agentName", example = "固定值:联邦快递(中国)有限公司")
//@NotBlank(message="参数agentName不能为空")
@Column(name = "AGENTNAME")
private String agentName;
@ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘")
@NotBlank(message="参数billNo不能为空")
@Column(name = "BILLNO")
private String billNo;
@ApiModelProperty(value = "合同号", name = "contrNo", example = "")
@Column(name = "CONTRNO")
private String contrNo;
@ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101")
@NotBlank(message="参数customMaster不能为空", groups = {MawbAdd.class})
@Column(name = "CUSTOMMASTER")
private String customMaster;
@ApiModelProperty(value = "征免性质", name = "cutMode", example = "101")
@NotBlank(message="参数cutMode不能为空", groups = {MawbAdd.class})
@Column(name = "CUTMODE")
private String cutMode;
@ApiModelProperty(value = "报关/转关关系标志", name = "declTrnRel", example = "固定值:0")
//@NotBlank(message="参数declTrnRel不能为空")
@Column(name = "DECLTRNREL")
private String declTrnRel;
@ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000")
@NotBlank(message="参数distinatePort不能为空", groups = {MawbAdd.class})
@Column(name = "DISTINATEPORT")
private String distinatePort;
@ApiModelProperty(value = "报关标志", name = "EdiId", example = "001")
@NotBlank(message="参数ediId不能为空", groups = {MawbAdd.class})
@Column(name = "EDIID")
private String ediId;
@ApiModelProperty(value = "海关编号", name = "EntryId", example = "001")
@Column(name = "ENTRYID")
private String entryId;
@ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3")
@NotBlank(message="参数feeCurr不能为空", groups = {MawbAdd.class})
@Column(name = "FEECURR")
private String feeCurr;
@ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22")
@NotBlank(message="参数feeMark不能为空", groups = {MawbAdd.class})
@Column(name = "FEEMARK")
private String feeMark;
@ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358")
@NotNull(message="参数feeRate不能为空", groups = {MawbAdd.class})
@Column(name = "FEERATE")
private BigDecimal feeRate;
@ApiModelProperty(value = "毛重", name = "grossWet", example = "")
@NotNull(message="参数grossWet不能为空", groups = {MawbAdd.class})
@Column(name = "CROSSWET")
private BigDecimal grossWet;
@ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101")
@NotBlank(message="参数iePort不能为空", groups = {MawbAdd.class})
@Column(name = "IEPORT")
private String iePort;
@ApiModelProperty(value = "录入人名称", name = "InputerName", example = "固定值:0101")
@Column(name = "INPUTERNAME")
private String inputerName;
@ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP")
@NotBlank(message="参数insurCurr不能为空", groups = {MawbAdd.class})
@Column(name = "INSURCURR")
private String insurCurr;
@ApiModelProperty(value = "保险费标记", name = "insurMark", example = "固定值:3")
@Column(name = "INSURMARK")
private String insurMark;
@ApiModelProperty(value = "保险费/率", name = "insurRate", example = "")
@NotNull(message="参数insurRate不能为空", groups = {MawbAdd.class})
@Column(name = "INSURRATE")
private BigDecimal insurRate;
@ApiModelProperty(value = "备案号", name = "manualNo", example = "")
@Column(name = "MANUALNO")
private String manualNo;
@ApiModelProperty(value = "净重", name = "netWt", example = "")
@NotNull(message="参数netWt不能为空", groups = {MawbAdd.class})
@Column(name = "NETWT")
private BigDecimal netWt;
@ApiModelProperty(value = "杂费币制", name = "otherCurr", example = "")
@Column(name = "OTHERCURR")
private String otherCurr;
@ApiModelProperty(value = "杂费/率", name = "otherRate", example = "")
@Column(name = "OTHERRATE")
private BigDecimal otherRate;
@ApiModelProperty(value = "杂费标志", name = "otherMark", example = "")
@Column(name = "OTHERMARK")
private String otherMark;
@ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987")
@NotBlank(message="参数ownerCode不能为空", groups = {MawbAdd.class})
@Column(name = "OWNERCODE")
private String ownerCode;
@ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险")
@NotBlank(message="参数ownerName不能为空", groups = {MawbAdd.class})
@Column(name = "OWNERNAME")
private String ownerName;
@ApiModelProperty(value = "件数", name = "packNo", example = "")
@NotNull(message="参数packNo不能为空", groups = {MawbAdd.class})
@Column(name = "PACKNO")
private Integer packNo;
@ApiModelProperty(value = "预录入编号", name = "preEntryId", example = "")
private String preEntryId;
@ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA")
@NotBlank(message="参数tradeCountry不能为空", groups = {MawbAdd.class})
@Column(name = "TRADECOUNTRY")
private String tradeCountry;
@ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200")
@NotBlank(message="参数tradeMode不能为空", groups = {MawbAdd.class})
@Column(name = "TRADEMODE")
private String tradeMode;
@ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987")
@NotBlank(message="参数tradeCode不能为空")
@Column(name = "TRADECODE")
private String tradeCode;
@ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1")
@NotBlank(message="参数trafMode不能为空", groups = {MawbAdd.class})
@Column(name = "TRAFMODE")
private String trafMode;
@ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司")
@NotBlank(message="参数tradeName不能为空")
@Column(name = "TRADENAME")
private String tradeName;
@ApiModelProperty(value = "成交方式", name = "transMode", example = "2")
@NotBlank(message="参数transMode不能为空", groups = {MawbAdd.class})
@Column(name = "TRANSMODE")
private String transMode;
@ApiModelProperty(value = "包装种类", name = "wrapType", example = "22")
@NotBlank(message="参数wrapType不能为空", groups = {MawbAdd.class})
@Column(name = "WRAPTYPE")
private String wrapType;
@ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987")
@NotBlank(message="参数tradeCodeScc不能为空")
@Column(name = "TRADECODESCC")
private String tradeCodeScc;
@ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "")
@NotBlank(message="参数ownerCodeScc不能为空", groups = {MawbAdd.class})
@Column(name = "OWNERCODESCC")
private String ownerCodeScc;
@ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "")
@NotBlank(message="参数tradeAreaCode不能为空", groups = {MawbAdd.class})
@Column(name = "TRADEAREACODE")
private String tradeAreaCode;
@ApiModelProperty(value = "标记及号码", name = "markNo", example = "N/M")
@Column(name = "MARKNO")
private String markNo;
@ApiModelProperty(value = "入境口岸代码", name = "entyPortCode", example = "固定值:310302")
@NotBlank(message="参数entyPortCode不能为空", groups = {MawbAdd.class})
@Column(name = "ENTYPORTCODE")
private String entyPortCode;
@ApiModelProperty(value = "入境口岸代码", name = "goodsPlace", example = "固定值:空值")
@Column(name = "GOODSPLACE")
private String goodsPlace;
@ApiModelProperty(value = "申报人员姓名---报关员证号", name = "declareName", example = "固定值:空值")
@Column(name = "DECLARENAME")
private String declareName;
@ApiModelProperty(value = "境外发货人代码", name = "overseasConsignorCode", example = "")
private String overseasConsignorCode;
@ApiModelProperty(value = "境外收货人编码", name = "overseasConsigneeCode", example = "")
@Column(name = "OVERSEASCONSIGNEECODE")
private String overseasConsigneeCode;
@ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "")
@NotBlank(message="参数overseasConsigneeEname不能为空", groups = {MawbAdd.class})
@Column(name = "OVERSEASCONSIGNEEENAME")
private String overseasConsigneeEname;
@ApiModelProperty(value = "运单ID", name = "consignmentCodeId", example = "")
@Column(name = "CONSIGNMENTCODEID")
private Long consignmentCodeId;
@ApiModelProperty(value = "EANNo", name = "EANNo", example = "")
@Column(name = "EANNO")
private String EANNo;
@Valid
@ApiModelProperty(value = "运单明细", name = "mawbDetailList", example = "")
@OneToMany(cascade = CascadeType.PERSIST)
@JoinColumn(name = "mawbId")
private List<MawbDetail> mawbDetailList;
}
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.api.request.BasfMawb;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
/**
* @author Administrator
*/
@Repository
@Transactional(rollbackFor = Exception.class)
public interface BasfMawbRepository extends JpaRepository<BasfMawb, Integer>, JpaSpecificationExecutor<BasfMawb> {
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.api.request.*;
import com.erry.iclear.dateInterface.repository.BasfMawbRepository;
import com.erry.iclear.dateInterface.util.NumberUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class BasfService {
@Autowired
private BasfMawbRepository basfMawbRepository;
/**
* 保存主单Request --basfc
* @param basfc
*/
public Mawb saveMawbBasf(Basfc basfc){
Mawb result=null;
try{
log.info("saveMawb start>>>>>>>>>>>");
//运单头部信息
BasfMawb mawb = new BasfMawb();
mawb.setAppId(basfc.getAppId());
mawb.setMsgId(basfc.getMsgId());
mawb.setConsignmentCodeId(basfc.getConsignmentId());
mawb.setType(basfc.getConsType());
//TODO 记录时为同一张表,用 '-->' 记录具体存放字段(方便查看,以免误解)
//运单号-->提单号
mawb.setBillNo(basfc.getConsignmentCode());
//经营单位 --> 消费使用/生产销售单位名称
mawb.setOwnerName(basfc.getOperateUnitName());
//经营单位海关编码 --> 消费使用/生产销售单位代码
mawb.setOwnerCode(basfc.getOperateUnitCode());
//经营单位社会信用证代码 --> 消费使用/生产销售单位单位统一编码
mawb.setOwnerCodeScc(basfc.getOperateSCC());
//发件人 --> 境内收发货人名称
mawb.setTradeName(basfc.getSender());
//发件人海关编码 --> 境内收发货人编号
mawb.setTradeCode(basfc.getShipperCustomsCode());
//发件人社会信用证代码 --> 生产核销单位统一信用代码---报关形式类型
mawb.setTradeCodeScc(basfc.getShipperSCC());
mawb.setEANNo(basfc.getEANNo());
//明细
List<MawbDetail> mawbDetailList = new ArrayList<>();
if (basfc.getBasfcDetailList().size()>0){
for (BasfcDetail basfcDetail : basfc.getBasfcDetailList()){
MawbDetail mawbDetail = new MawbDetail();
mawbDetail.setDetailId(basfcDetail.getConsignmentDetailId());
mawbDetail.setGmodel(basfcDetail.getModel());
mawbDetail.setCodeTS(basfcDetail.getSkuCode());
mawbDetail.setGname(basfcDetail.getSkuName());
mawbDetail.setGqty(basfcDetail.getKnockdownNumber());
mawbDetail.setGunit(basfcDetail.getKnockdownUnit());
mawbDetail.setFirstUnit(basfcDetail.getUnitLegalFirst());
mawbDetail.setFirstQty(NumberUtils.bigDecimalToIntger(basfcDetail.getQtyLegalFirst()));
mawbDetail.setSecondQty(NumberUtils.bigDecimalToIntger(basfcDetail.getQtyLegalSecond()));
mawbDetail.setSecondUnit(basfcDetail.getUnitLegalSecond());
mawbDetail.setDeclTotal(basfcDetail.getDeclaredAmount());
mawbDetail.setTradeCurr(basfcDetail.getCurrency());
mawbDetail.setDeclaredWeight(basfcDetail.getDeclaredWeight());
mawbDetailList.add(mawbDetail);
}
}
mawb.setMawbDetailList(mawbDetailList);
result = basfMawbRepository.save(mawb);
log.info("saveMawb end>>>>>>>>>>>");
}catch (Exception e){
log.error("saveMawb() error:"+e.getMessage());
}
return result;
}
}
......@@ -66,66 +66,6 @@ public class MawbService {
/**
* 保存主单Request --basfc
* @param basfc
*/
public Mawb saveMawbBasf(Basfc basfc){
Mawb result=null;
try{
log.info("saveMawb start>>>>>>>>>>>");
//运单头部信息
Mawb mawb = new Mawb();
mawb.setAppId(basfc.getAppId());
mawb.setMsgId(basfc.getMsgId());
mawb.setConsignmentCodeId(basfc.getConsignmentId());
mawb.setType(basfc.getConsType());
//TODO 记录时为同一张表,用 '-->' 记录具体存放字段(方便查看,以免误解)
//运单号-->提单号
mawb.setBillNo(basfc.getConsignmentCode());
//经营单位 --> 消费使用/生产销售单位名称
mawb.setOwnerName(basfc.getOperateUnitName());
//经营单位海关编码 --> 消费使用/生产销售单位代码
mawb.setOwnerCode(basfc.getOperateUnitCode());
//经营单位社会信用证代码 --> 消费使用/生产销售单位单位统一编码
mawb.setOwnerCodeScc(basfc.getOperateSCC());
//发件人 --> 境内收发货人名称
mawb.setTradeName(basfc.getSender());
//发件人海关编码 --> 境内收发货人编号
mawb.setTradeCode(basfc.getShipperCustomsCode());
//发件人社会信用证代码 --> 生产核销单位统一信用代码---报关形式类型
mawb.setTradeCodeScc(basfc.getShipperSCC());
mawb.setEANNo(basfc.getEANNo());
//明细
List<MawbDetail> mawbDetailList = new ArrayList<>();
if (basfc.getBasfcDetailList().size()>0){
for (BasfcDetail basfcDetail : basfc.getBasfcDetailList()){
MawbDetail mawbDetail = new MawbDetail();
mawbDetail.setDetailId(basfcDetail.getConsignmentDetailId());
mawbDetail.setGmodel(basfcDetail.getModel());
mawbDetail.setCodeTS(basfcDetail.getSkuCode());
mawbDetail.setGname(basfcDetail.getSkuName());
mawbDetail.setGqty(basfcDetail.getKnockdownNumber());
mawbDetail.setGunit(basfcDetail.getKnockdownUnit());
mawbDetail.setFirstUnit(basfcDetail.getUnitLegalFirst());
mawbDetail.setFirstQty(NumberUtils.bigDecimalToIntger(basfcDetail.getQtyLegalFirst()));
mawbDetail.setSecondQty(NumberUtils.bigDecimalToIntger(basfcDetail.getQtyLegalSecond()));
mawbDetail.setSecondUnit(basfcDetail.getUnitLegalSecond());
mawbDetail.setDeclTotal(basfcDetail.getDeclaredAmount());
mawbDetail.setTradeCurr(basfcDetail.getCurrency());
mawbDetail.setDeclaredWeight(basfcDetail.getDeclaredWeight());
mawbDetailList.add(mawbDetail);
}
}
mawb.setMawbDetailList(mawbDetailList);
result = mawbRepository.save(mawb);
log.info("saveMawb end>>>>>>>>>>>");
}catch (Exception e){
log.error("saveMawb() error:"+e.getMessage());
}
return result;
}
/**
* 校验主单
* @param mawb
* @return
......