wei.zhou

保存业务数据

Showing 37 changed files with 2750 additions and 63 deletions
CREATE TABLE T_ICLEAR_API_APPINFO(
ID INT primary key
,APPID VARCHAR(40)
,APPKEY VARCHAR(40)
,SECURITY VARCHAR(16)
,CREATE_TIME DATE
,IS_ENABLE VARCHAR(1)
)
INSERT INTO T_ICLEAR_API_APPINFO VALUES(1,'CTM','iClearExport','b92131f03f19a348',GETDATE(),'1');
CREATE TABLE T_ICLEAR_API_LOG(
MSGID int identity(1,1) primary key --PK
,MSG_TYPE VARCHAR(20) --类型
......
......@@ -3,24 +3,22 @@ package com.erry.iclear.dateInterface.api;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.api.response.ResultRS;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.ChmConsignment;
import com.erry.iclear.dateInterface.entity.ChmConsignmentDetail;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import com.erry.iclear.dateInterface.service.IClearApiLogService;
import com.erry.iclear.dateInterface.service.MawbDetailService;
import com.erry.iclear.dateInterface.service.MawbService;
import com.erry.iclear.dateInterface.service.*;
import com.erry.iclear.dateInterface.util.MD5Util;
import com.erry.iclear.dateInterface.util.SHA256Util;
import com.google.gson.Gson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
import org.springframework.util.Assert;
import org.springframework.util.StopWatch;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Objects;
import java.util.*;
/**
* @author Administrator
......@@ -41,64 +39,113 @@ public class CustomsDataInterface {
@Autowired
private IClearApiLogService iClearApiLogService;
@Autowired
private ChmConsignmentService chmConsignmentService;
@Autowired
private ChmConsignmentDetailService chmConsignmentDetailService;
@ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb")
@PostMapping("/sendMawb")
@ResponseBody
public ResultRS sendMawb(HttpServletRequest request
, @RequestBody Mawb mawb) {
log.info("接收到主单数据:" + gson.toJson(mawb));
log.info("接收到请求数据billNo:"+mawb.getBillNo()+" data:" + gson.toJson(mawb));
ResultRS result = new ResultRS();
result.setSuccess(Boolean.FALSE);
if(Objects.equals(mawb,null)){
result.setCode("-7");
result.setMsg("主单信息不能为空");
result.setMsg("请求信息不能为空");
return result;
}
//0、保存请求信息,保存到iClear的 SQLServer
StopWatch sw = new StopWatch("receice mawb");
sw.start("save log");
String appId=(String) request.getHeader("Appid");
String appkey=(String) request.getHeader("Appkey");
IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appkey));
if(!Objects.equals(saveIClearApiLogResult,null)){
log.info("请求保存成功,msgId:"+saveIClearApiLogResult.getMsgId());
mawb.setMsgId(saveIClearApiLogResult.getMsgId());
// mawb.getMawbDetailList().forEach(d->{
// d.setMsgId(saveIClearApiLogResult.getMsgId());
// });
mawb.getMawbDetailList().forEach(d->{
d.setMsgId(saveIClearApiLogResult.getMsgId());
});
Mawb saveMawbResult= mawbService.saveMawb(mawb);
if(!Objects.equals(saveMawbResult,null)){
log.info("请求主单数据保存成功,msgId:"+saveMawbResult.getMsgId());
log.info("请求数据主单号"+mawb.getBillNo()+"保存成功,msgId:"+saveMawbResult.getMsgId());
}else{
log.info("请求主单数据保存失败,msgId:"+saveMawbResult.getMsgId());
log.info("请求数据主单号"+mawb.getBillNo()+"保存失败,msgId:"+saveMawbResult.getMsgId());
}
}else{
log.info("请求保存失败,msgId:"+saveIClearApiLogResult.getMsgId());
log.info("请求日志保存失败,BillNo:"+mawb.getBillNo());
}
sw.stop();
//1、TODO 校验用户名密码
//1、校验用户名密码
sw.start("checkAppSecret");
result=this.checkAppSecret(request, result);
sw.stop();
//2、TODO 校验主单
sw.start("checkMawb");
if(result.getSuccess()==true){
result.setSuccess(mawbService.checkMawb(mawb));
//result.setSuccess(mawbService.checkMawb(mawb));
}
sw.stop();
//3、TODO 校验子单
sw.start("checkMawbDetail");
if(result.getSuccess()==true){
}
//4、TODO 保存主单
sw.stop();
//4、保存运单到iclear中
sw.start("saveToIClear");
if(result.getSuccess()==true){
ChmConsignment chmConsignment=chmConsignmentService.convertToChmConsignment(mawb);
List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>();
mawb.getMawbDetailList().forEach(detail ->{
chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail));
});
chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
ChmConsignment chmConsignmentSaveResult = chmConsignmentService.saveChmConsignment(chmConsignment);
if(!Objects.equals(chmConsignmentSaveResult,null)){
log.info("主单"+mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId());
}else{
log.info("主单"+mawb.getBillNo()+" 保存失败");
}
}
sw.stop();
//5、更新日志
sw.start("updateIClearApiLog");
if(!Objects.equals(saveIClearApiLogResult,null)){
saveIClearApiLogResult.setReceiveResult(result.getSuccess().toString());
saveIClearApiLogResult.setResponseTime(new Date());
saveIClearApiLogResult.setSpendTime(sw.getTotalTimeMillis());
iClearApiLogService.updateIClearApiLog(saveIClearApiLogResult);
}
log.info("请求数据billNo:"+mawb.getBillNo() +" 接收结束");
sw.stop();
log.info(sw.prettyPrint());
//6、return result
result.setSuccess(Boolean.TRUE);
result.setCode("0");
return result;
}
......@@ -146,7 +193,7 @@ public class CustomsDataInterface {
}
HashMap<String,String> secretMap = Constant.appIdSecurity.get(appId);
HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId);
if(secretMap==null){
result.setCode("-100");
result.setMsg("系统异常,该appId没有注册");
......@@ -160,8 +207,9 @@ public class CustomsDataInterface {
return result;
}
String md5Str= MD5Util.md5(appId+appkey+secretInSys+timeStamp);
if(!token.equals(md5Str)){
String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp);
if(!token.equals(sha256Str)){
result.setCode("-4");
result.setMsg("Token验证失败");
return result;
......
......@@ -23,13 +23,14 @@ import java.util.List;
@Data
public class Mawb implements Serializable {
private static final long serialVersionUID = -7092144710653831972L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id", insertable = false, nullable = false)
private Integer id;
private Long id;
@Column(name = "MSGID")
private Integer msgId;
private Long msgId;
@ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E")
@Column(name = "IEFLAG")
......
......@@ -18,16 +18,17 @@ import java.math.BigDecimal;
@Data
public class MawbDetail implements Serializable {
private static final long serialVersionUID = -6706944312498119267L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "Id", insertable = false, nullable = false)
private Integer id;
private Long id;
@Column(name = "MSGID")
private Integer msgId;
private Long msgId;
@Column(name="MAWBID")
private Integer MAWBID;
private Long MAWBID;
@ApiModelProperty(value = "商品编号", example = "空值")
@Column(name = "CLASSMARK")
......
package com.erry.iclear.dateInterface.common;
import com.erry.iclear.dateInterface.entity.ChmCarryPort;
import com.erry.iclear.dateInterface.entity.DictionaryEntries;
import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping;
import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping;
import org.springframework.stereotype.Component;
import java.util.HashMap;
......@@ -11,12 +15,37 @@ import java.util.Map;
@Component
public class Constant {
public static Map<String,HashMap<String,String>> appIdSecurity = new HashMap<>();
public static Map<String,HashMap<String,String>> appIdSecurityCache = new HashMap<>();
//字典表
public static Map<String , DictionaryEntries> dictionaryEntriesCache = new HashMap<>();
//货源地
public static Map<String,DomesticDestinationMapping> domesticDestinationMappingCache = new HashMap();
//目的港口
public static Map<String, OrigplacecodeMapping> origplacecodeMappingCache = new HashMap<>();
//港口表
public static Map<String, ChmCarryPort> chmCarryPortCache = new HashMap<>();
public static String MSG_TYPE_C="C";
public static String MSG_TYPE_D="D";
public static String LEVY_TYPE="levyType_";
public static String TRANSACTION_UNIT="transactionUnit_";
public static String COUNTRY = "Country_";
public static String CURRENCY_SYSTEM = "currencySystem_";
public static String VEHICLE_WAY_CODE = "VehicleWayCode_";
public static String CLINCH_TYPE = "ClinchType_";
public static String NEW_PACKAGE_TYPE = "NewPackageType_";
}
......
package com.erry.iclear.dateInterface.controller;
import com.erry.iclear.dateInterface.service.IClearApiSystemService;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -10,22 +13,30 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
@RequestMapping("/system")
@Slf4j
public class IClearExportInterface {
@ApiOperation(value = "IClear 健康检查" ,httpMethod ="GET" ,notes="ex: http://localhost:8080/system/healthCheck")
@Autowired
private IClearApiSystemService iClearApiSystemService;
@ApiOperation(value = "IClear 健康检查", httpMethod = "GET", notes = "ex: http://localhost:8080/system/healthCheck")
@GetMapping("/healthCheck")
public String healthCheck() {
return "iClearApi 当前时间:"+System.currentTimeMillis();
return "iClearApi 当前时间:" + System.currentTimeMillis();
}
@ApiOperation(value = "IClear 刷新缓存" ,httpMethod ="GET" ,notes="ex: http://192.168.0.75:8080/system/refreshCache")
@GetMapping("/refreshCache")
@ApiOperation(value = "IClear 刷新缓存", httpMethod = "GET", notes = "ex: http://192.168.1.75:8080/system/refreshAppInfoCache")
@GetMapping("/refreshAppInfoCache")
public String refreshCache() {
return "Success";
try{
iClearApiSystemService.refreshAppInfoCache();
return "Success";
}catch (Exception e){
log.error("refreshCache() error:"+e.getMessage());
}
return "Faile";
}
}
......
package com.erry.iclear.dateInterface.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* @author Administrator
*/
@Entity
@Table(name = "T_ICLEAR_API_APPINFO")
@Data
public class AppInfo implements Serializable {
private static final long serialVersionUID = 1023722733043865770L;
@Id
@Column(name = "ID")
private Integer id;
@Column(name = "APPID")
private String appId;
@Column(name = "APPKEY")
private String appKey;
@Column(name = "SECURITY")
private String security;
@Column(name = "CREATE_TIME")
private Date createTime;
@Column(name = "IS_ENABLE")
private String isEnable;
}
package com.erry.iclear.dateInterface.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* 港口表
* Created by Erry 2019/6/15.
* @author Administrator
*/
@Entity
@Table(name = "T_CHM_CARRY_PORT")
@Data
public class ChmCarryPort implements Serializable {
private static final long serialVersionUID = 2693103610036977383L;
/**
* 运单表ID,自动增加
*/
@Id
@GeneratedValue
@Column(name = "ID")
private Long id;
/**
*
*/
@Column(name = "PORT_NAME")
private String portName;
/**
*
*/
@Column(name = "PORT_NO")
private String portNo;
/**
* 创建人
*/
@Column(name = "CREATE_BY")
private String createName;
/**
*
*/
@Column(name = "CREATE_TIME")
private String createTime;
/**
* 代码
*/
@Column(name = "P_CODE")
private String pcCode;
/**
* 英文名称
*/
@Column(name = "PORT_ENG_NAME")
private String portEngName;
}
package com.erry.iclear.dateInterface.entity;
import com.erry.iclear.dateInterface.api.request.MawbDetail;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 运单表
* Created by Erry 2019/5/30.
* @author Administrator
*/
@Entity
@Table(name = "T_CHM_CONSIGNMENT")
@Data
public class ChmConsignment implements Serializable {
private static final long serialVersionUID = 2693103610036977383L;
/**
* 运单表ID,自动增加
*/
@Id
@GeneratedValue
@Column(name = "ID")
private Long id;
/**
* 报关单类型ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "DECLARED_DOC_TYPE_ID")
private DictionaryEntries declaredDocTypeDic;
/**
* 报关单类型
*/
@Column(name = "DECLARED_DOC_TYPE")
private String declaredDocType;
/**
* 申报单位
*/
@Column(name = "DECLARED_UNIT_NAME")
private String declaredUnitName;
/**
* 合同协议号
*/
@Column(name = "CONTRACT_CODE")
private String contractCode;
/**
* 征免性质ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "TAX_NATURE_ID")
private DictionaryEntries taxNatureDic;
/**
* 征免性质
*/
@Column(name = "TAX_NATURE")
private String taxNature;
/**
* 指运港ID
*/
@ManyToOne(targetEntity = ChmCarryPort.class)
@JoinColumn(name = "THROUGH_STOP_PORT_ID")
private ChmCarryPort throughStopPortDic;
/**
* 指运港
*/
@Column(name = "THROUGH_STOP_PORT")
private String throughStopPort;
/**
* 运费(币制)ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "TRANS_CURRENCY_ID")
private DictionaryEntries transCurrencyDic;
/**
* 运费(币制)
*/
@Column(name = "TRANS_CURRENCY")
private String transCurrency;
/**
* 运费
*/
@Column(name = "TRANS_COST")
private BigDecimal transCost;
/**
* 毛重(公斤)
*/
@Column(name = "GROSS_WEIGHT")
private BigDecimal grossWeight;
/**
* 保费
*/
@Column(name = "INSURANCE_COST")
private BigDecimal insuranceCost;
/**
* 保费(币制)ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "INSURANCE_CURRENCY_ID")
private DictionaryEntries insuranceCostCurrencyDic;
/**
* 保费(币制)
*/
@Column(name = "INSURANCE_CURRENCY")
private String insuranceCostCurrency;
/**
* 备案号
*/
@Column(name = "RECORD_CODE")
private String recordCode;
/**
* 净重(公斤)
*/
@Column(name = "NET_WEIGHT")
private BigDecimal netWeight;
/**
* 杂费
*/
@Column(name = "OTHER_COST")
private BigDecimal otherCost;
/**
* 杂费(币制)ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "OTHER_CURRENCY_ID")
private DictionaryEntries otherCurrencyDic;
/**
* 杂费(币制)
*/
@Column(name = "OTHER_CURRENCY")
private String otherCurrency;
/**
* 件数
*/
@Column(name = "COUNTS")
private Long counts;
/**
* 预录入编号
*/
@Column(name = "ENTERING_NO")
private String enteringNo;
/**
* 监管方式ID
*/
// @JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "TRADE_MODE_ID")
private DictionaryEntries tradeModeDic;
/**
* 监管方式
*/
@Column(name = "TRADE_MODE")
private String tradeMode;
/**
* 境内发货人编码
*/
@Column(name = "TRADE_CO_SCC")
private String tradeCoSCC;
/**
* 境内发货人(经营单位编码)
*/
@Column(name = "OPERATE_UNIT_CODE")
private String operateUnitCode;
/**
* 境内发货人(经营单位名称)
*/
@Column(name = "OPERATE_UNIT_NAME")
private String operateUnitName;
/**
* 运输方式ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "VEHICLE_WAY_ID")
private DictionaryEntries vehicleWay;
/**
* 运输方式
*/
@Column(name = "VEHICLE_WAY_CODE")
private String vehicleWayCode;
/**
* 成交方式ID
*/
// @JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "DEAL_MODE_ID")
private DictionaryEntries dealModeDic;
/**
* 成交方式
*/
@Column(name = "DEAL_MODE")
private String dealMode;
/**
* 包装种类ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "PACKAGE_TYPE_ID")
private DictionaryEntries packageTypeDic;
/**
* 包装种类
*/
@Column(name = "PACKAGE_TYPE")
private String packageType;
/**
* 报关形式类型ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "DECLARED_FORM_TYPE_ID")
private DictionaryEntries declaredFromTypeDic;
/**
* 报关形式类型
*/
@Column(name = "DECLARED_FORM_TYPE")
private String declaredFromType;
/**
* 生产核销单位编码
*/
@Column(name = "OWNER_CODE_SCC")
private String ownerCodeScc;
/**
* 贸易国(地区)ID
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "TRADE_AREA_CODE_ID")
private DictionaryEntries tradeAreaCodeDic;
/**
* 贸易国(地区)
*/
@Column(name = "TRADE_AREA_CODE")
private String tradeAreaCode;
//------------------------------------------------------------------------------------
/**
* 出境口岸ID
*/
// @JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "EXIT_PORT_ID")
private DictionaryEntries exitPortDic;
//author : wy on 2021/01/12 新增“fedEx账户”
@Column(name = "FEDEXACCOUNT")
private String fedExAccount;
/**
* 出境口岸
*/
// @Pattern(regexp = "[A-Z][a-z][0-9]")
// private String passWord;
@Column(name = "EXIT_PORT")
private String exitPort;
/**
* 出境关别代码
*/
@Column(name = "EXIT_CUS_CODE")
private String exitCusCode;
/**
* 出境关别ID
*/
// @JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "EXIT_CUS_ID")
private DictionaryEntries exitCusDic;
/**
* 出境关别
*/
@Column(name = "EXIT_CUS")
private String exitCus;
/**
* 海关编号
*/
@Column(name = "CUSTOMS_NO")
private String customsNo;
/**
* 出口日期
*/
@Column(name = "IMPORT_DATE")
private Date importDate;
/**
* 申报日期
*/
@Column(name = "CUSTOMS_DATE")
private Date customsDate;
/**
* 生产核销位海关编码
*/
@Column(name = "OWNER_CODE")
private String ownerCode;
/**
* 生产核销单位
*/
@Column(name = "OWNER_NAME")
private String ownerName;
/**
* 运单号
*/
@Column(name = "CONSIGNMENT_CODE")
private String consignmentCode;
/**
* 总运单号
*/
@Column(name = "CONSIGNMENT_HEAD_CODE")
private String consignmentHeadCode;
/**
* 报关转关类型ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "DECLARED_TYPE_ID")
private DictionaryEntries declaredTypeDic;
/**
* 报关转关类型
*/
@Column(name = "DECLARED_TYPE")
private String declaredType;
/**
* 许可证号
*/
@Column(name = "LICENSE_CODE")
private String licenseCode;
/**
* 抵运国(地区)ID
*/
// @JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "FROM_COUNTRY_ID")
private DictionaryEntries fromCountryDic;
/**
* 抵运国(地区)
*/
@Column(name = "FROM_COUNTRY")
private String fromCountry;
/**
* 随附单据及编号
*/
@Column(name = "SLIP")
private String slip;
/**
* 特殊关系确认
*/
@Column(name = "PROMISE_ITMES1")
private String promiseItmes1;
;
/**
* 价格影响确认
*/
@Column(name = "PROMISE_ITMES2")
private String promiseItmes2;
/**
* 支付特许权使用费确认
*/
@Column(name = "PROMISE_ITMES3")
private String promiseItmes3;
/**
* 境外收货人
*/
@Column(name = "OVERSEAS_CONSIGNOR_FN_CNAME")
private String overseasConsignorFnCname;
/**
* 境外收货人编码
*/
@Column(name = "OVERSEAS_CONSIGNOR_CODE")
private String overseasConsignorCode;
/**
* 运输工具名称及航次号
*/
@Column(name = "FLIGHT_CLASS_NO")
private String flightClassNo;
/**
* 标记唛码及备注 (标记唛码)
*/
@Column(name = "DECLARED_REMARK")
private String declaredRemark;
/**
* 标记唛码及备注 (备注)
*/
@Column(name = "REMARK_MARK")
private String remarkMark;
/**
* 报关员证号
*/
@Column(name = "DECLARED_CODE")
private String declaredCode;
/**
* 电话
*/
@Column(name = "TELEPHONE")
private String telephone;
/**
* 运单类型ID
*/
// @JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "CONS_TYPE_ID")
private DictionaryEntries consTypeDic;
/**
* 运单类型
*/
@Column(name = "CONS_TYPE")
private String consType;
/**
* 发件人姓名
*/
@Column(name = "SENDER")
private String sender;
/**
* 企业代码
*/
@Column(name = "ENTERPRISE_CODE")
private String enterpriseCode;
/**
* 纳税单位
*/
@Column(name = "TAX_UNIT")
private String taxUnit;
/**
* 运单图片打印状态ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "PRINT_STATUS_ID")
private DictionaryEntries printStatusDic;
/**
* 运单图片打印状态
*/
@Column(name = "PRINT_STATUS")
private String printStatus;
/**
* 委托书是否盖章ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "IS_STAMP_ID")
private DictionaryEntries stampDic;
/**
* 委托书是否盖章
*/
@Column(name = "IS_STAMP")
private String stamp;
/**
* 上传文件状态ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "UP_FILE_STATUS_ID")
private DictionaryEntries upFileStatusDic;
/**
* 上传文件状态
*/
@Column(name = "UP_FILE_STATUS")
private String upFileStatus;
/**
* 上传文件时间
*/
@Column(name = "UP_FILE_TIME")
private Date upFileTime;
/**
* 上传文件人员ID
*/
// @JsonIgnore
// @ManyToOne(targetEntity = SysUser.class)
// @JoinColumn(name = "UP_FILE_USER_ID")
// private SysUser upFileUserDic;
/**
* 上传文件人员
*/
@Column(name = "UP_FILE_USER")
private String upFileUser;
/**
* 图片任务状态ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "TASK_STATUS_ID")
private DictionaryEntries taskStatusDic;
/**
* 图片任务状态
*/
@Column(name = "TASK_STATUS")
private String taskStatus;
/**
* 图片合成时间
*/
@Column(name = "PDF_TIME")
private Date pdfTime;
/**
* 海关帐号
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "PRINT_NO_ID")
private DictionaryEntries printNoDic;
/**
* 海关帐号
*/
@Column(name = "PRINT_NO")
private String printNo;
/**
* 海关帐号 变更记录
*/
@Column(name = "PRINT_NO_MSG")
private String printNoMsg;
/**
* 最后一次打印时间
*/
@Column(name = "PRINT_TIME")
private Date printTime;
/**
* 运单创建时间
*/
@Column(name = "CREATE_TIME")
private Date createTime;
/**
* 运单创建人ID
*/
// @JsonIgnore
// @ManyToOne(targetEntity = SysUser.class)
// @JoinColumn(name = "CREATOR_ID")
// private SysUser creatorId;
/**
* 运单创建人
*/
@Column(name = "CREATOR")
private String creator;
/**
* 运单更新时间
*/
@Column(name = "UPDATE_TIME")
private Date updateTime;
/**
* 运单更新人ID
*/
// @JsonIgnore
// @ManyToOne(targetEntity = SysUser.class)
// @JoinColumn(name = "UPDATE_USER_ID")
// private SysUser updateUser;
/**
* 运单更新人
*/
@Column(name = "UPDATE_USER")
private String updateUserName;
/**
* 运单状态ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "CONS_STATUS_ID")
private DictionaryEntries consStatusDic;
/**
* 运单状态
*/
@Column(name = "CONS_STATUS")
private String consStatus;
/**
* OSPR状态ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "OSPR_STATUS_ID")
private DictionaryEntries osprStatusDic;
/**
* OSPR状态
*/
@Column(name = "OSPR_STATUS")
private String osprStatus;
/**
* 申报口岸
*/
@Column(name = "DECLARED_PORT")
private String declaredPort;
/**
* 站点
*/
// @JsonIgnore
// @ManyToOne(targetEntity = Organization.class)
// @JoinColumn(name = "STATION_ID")
// private Organization station;
/**
* 站点名称
*/
@Column(name = "STATION_NAME")
private String stationName;
/**
* 口岸
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "PORT_ID")
private DictionaryEntries port;
/**
* 口岸名称
*/
@Column(name = "PORT_NAME")
private String portName;
/**
* 航班日期
*/
@DateTimeFormat(pattern = "yyy-MM-dd")
@Column(name = "FLIIGHT_DATE")
private Date flightDate;
/**
* 航班号
*/
@Column(name = "FLIIGHT_NO")
private String flightNo;
/**
* 航线
*/
@Column(name = "ROUTE")
private String route;
/**
* 速递员
*/
@Column(name = "COURIER")
private String courier;
/**
* 备注
*/
@Column(name = "REMARK")
private String remark;
/**
* 是否启用报关单
*/
@Column(name = "ENABLE_DECLARATION")
private String enableDeclaration;
/**
* 图片是否已上传
*/
@Column(name = "PIC_UPLOADED")
private Boolean picUploaded;
/**
* 图片最后上传时间
*/
@Column(name = "PIC_UPLOAD_TIME")
private Date picUploadTime;
/**
* 图片最后上传人
*/
// @JsonIgnore
// @ManyToOne(targetEntity = SysUser.class)
// @JoinColumn(name = "PIC_UPLOAD_USER_ID")
// private SysUser picUploadUser;
/**
* 创建渠道
*/
@Column(name = "CREATING_CHANNELS")
private String creatingChannels;
/**
* 货品名称
*/
@Column(name = "SKUNAME")
private String skuName;
/**
* 是否导出
*/
@Column(name = "IS_EXPORT")
private String export;
/**
* 联系人
*/
@Column(name = "CONTACTS")
private String contacts;
/**
* 联系方式
*/
@Column(name = "CONTACT_INFORMATION")
private String contactInformation;
/**
* 取件城市
* author: wy on 2021/01/26 新增字段
*/
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "PICKUP_CITY")
private DictionaryEntries pickUpCity;
/**
* 取件城市名称
*/
@Column(name = "PICKUPCITY_NAME")
private String pickUpCityName;
/**
* 反填标志(DM002是否反填,航班号,航班日期)
* author: wy on 2021/02/03
*/
@Column(name = "ISRETURNDATA")
private Boolean isReturnData;
/**
* 审批备注(审批不通过)
*/
@Column(name = "REJECT_REMARK")
private String rejectRemark;
/**
* 是否需要站点协助 站点协助(审批不通过)
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "SITE_ASSISTANCE_ID")
private DictionaryEntries siteAssistanceDic;
/**
* 取件日期
*/
@Column(name = "PICK_UP_DATE")
private Date pickUpDate;
/**
* 海关回执
*/
@Column(name = "CUSTOMS_RECEIPT")
private String customsReceipt;
/**
* 海关回执时间
*/
@Column(name = "CUSTOMS_RECEIPT_TIME")
private Date customsReceiptTime;
/**
* remark运单备注信息
*/
@Column(name = "DM_REMARK")
private String dmRemark;
/**
* 扫描代码ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "SCAN_CODE_ID")
private DictionaryEntries scanCodeDic;
/**
* 扫描代码
*/
@Column(name = "SCAN_CODE")
private String scanCode;
/**
* 扫描状态日期
*/
@Column(name = "SCAN_STATUS_TIME")
private Date scanStatusTime;
/**
* 是否PPE
*/
@Column(name = "IS_PPE")
private String ppe;
/**
* 运单录入的类型
*/
@Column(name = "CHMCONSIGMENT_TYPE")
private String chmConsigmentType;
/**
* 是否是同一批批量导入的运单
*/
@Column(name = "IS_BATCH_IMPORT")
private String isBatchimport;
@OneToMany(cascade = CascadeType.PERSIST)
@JoinColumn(name = "CONSIGNMENT_ID")
private List<ChmConsignmentDetail> chmConsignmentDetailList;
@Override
public String toString() {
return "ChmConsignment{" +
"id=" + id +
//", version=" + version +
", exitPortDic=" + exitPortDic +
", exitPort='" + exitPort + '\'' +
", exitCusCode='" + exitCusCode + '\'' +
", exitCusDic=" + exitCusDic +
", exitCus='" + exitCus + '\'' +
", enteringNo='" + enteringNo + '\'' +
", customsNo='" + customsNo + '\'' +
", recordCode='" + recordCode + '\'' +
", importDate=" + importDate +
", customsDate=" + customsDate +
", ownerCodeScc='" + ownerCodeScc + '\'' +
", ownerCode='" + ownerCode + '\'' +
", ownerName='" + ownerName + '\'' +
", vehicleWay=" + vehicleWay +
", vehicleWayCode='" + vehicleWayCode + '\'' +
", consignmentCode='" + consignmentCode + '\'' +
", consignmentHeadCode='" + consignmentHeadCode + '\'' +
", tradeModeDic=" + tradeModeDic +
", tradeMode='" + tradeMode + '\'' +
", taxNatureDic=" + taxNatureDic +
", taxNature='" + taxNature + '\'' +
", dealModeDic=" + dealModeDic +
", dealMode='" + dealMode + '\'' +
", packageTypeDic=" + packageTypeDic +
", packageType='" + packageType + '\'' +
", declaredDocTypeDic=" + declaredDocTypeDic +
", declaredDocType='" + declaredDocType + '\'' +
", declaredTypeDic=" + declaredTypeDic +
", declaredType='" + declaredType + '\'' +
", declaredFromTypeDic=" + declaredFromTypeDic +
", declaredFromType='" + declaredFromType + '\'' +
", licenseCode='" + licenseCode + '\'' +
", fromCountryDic=" + fromCountryDic +
", fromCountry='" + fromCountry + '\'' +
", throughStopPortDic=" + throughStopPortDic +
", throughStopPort='" + throughStopPort + '\'' +
", tradeAreaCodeDic=" + tradeAreaCodeDic +
", tradeAreaCode='" + tradeAreaCode + '\'' +
", transCost=" + transCost +
", transCurrencyDic=" + transCurrencyDic +
", transCurrency='" + transCurrency + '\'' +
", insuranceCost=" + insuranceCost +
", insuranceCostCurrencyDic=" + insuranceCostCurrencyDic +
", insuranceCostCurrency='" + insuranceCostCurrency + '\'' +
", otherCost=" + otherCost +
", otherCurrencyDic=" + otherCurrencyDic +
", otherCurrency='" + otherCurrency + '\'' +
", contractCode='" + contractCode + '\'' +
", counts=" + counts +
", grossWeight=" + grossWeight +
", netWeight=" + netWeight +
", slip='" + slip + '\'' +
", promiseItmes1='" + promiseItmes1 + '\'' +
", promiseItmes2='" + promiseItmes2 + '\'' +
", promiseItmes3='" + promiseItmes3 + '\'' +
", tradeCoSCC='" + tradeCoSCC + '\'' +
", operateUnitCode='" + operateUnitCode + '\'' +
", operateUnitName='" + operateUnitName + '\'' +
", overseasConsignorFnCname='" + overseasConsignorFnCname + '\'' +
", overseasConsignorCode='" + overseasConsignorCode + '\'' +
", flightClassNo='" + flightClassNo + '\'' +
", declaredRemark='" + declaredRemark + '\'' +
", remarkMark='" + remarkMark + '\'' +
", declaredCode='" + declaredCode + '\'' +
", declaredUnitName='" + declaredUnitName + '\'' +
", telephone='" + telephone + '\'' +
", consTypeDic=" + consTypeDic +
", consType='" + consType + '\'' +
", sender='" + sender + '\'' +
", enterpriseCode='" + enterpriseCode + '\'' +
", taxUnit='" + taxUnit + '\'' +
", printStatusDic=" + printStatusDic +
", printStatus='" + printStatus + '\'' +
", stampDic=" + stampDic +
", stamp='" + stamp + '\'' +
", upFileStatusDic=" + upFileStatusDic +
", upFileStatus='" + upFileStatus + '\'' +
", upFileTime=" + upFileTime +
//", upFileUserDic=" + upFileUserDic +
", upFileUser='" + upFileUser + '\'' +
", taskStatusDic=" + taskStatusDic +
", taskStatus='" + taskStatus + '\'' +
", pdfTime=" + pdfTime +
", printNoDic=" + printNoDic +
", printNo='" + printNo + '\'' +
", printNoMsg='" + printNoMsg + '\'' +
", printTime=" + printTime +
", createTime=" + createTime +
//", creatorId=" + creatorId +
", creator='" + creator + '\'' +
", updateTime=" + updateTime +
//", updateUser=" + updateUser +
", updateUserName='" + updateUserName + '\'' +
", consStatusDic=" + consStatusDic +
", consStatus='" + consStatus + '\'' +
", osprStatusDic=" + osprStatusDic +
", osprStatus='" + osprStatus + '\'' +
", declaredPort='" + declaredPort + '\'' +
//", station=" + station +
", stationName='" + stationName + '\'' +
", flightDate=" + flightDate +
", flightNo='" + flightNo + '\'' +
", route='" + route + '\'' +
", courier='" + courier + '\'' +
", remark='" + remark + '\'' +
", enableDeclaration='" + enableDeclaration + '\'' +
", picUploaded=" + picUploaded +
", picUploadTime=" + picUploadTime +
//", picUploadUser=" + picUploadUser +
", creatingChannels='" + creatingChannels + '\'' +
", skuName='" + skuName + '\'' +
", export='" + export + '\'' +
", contacts='" + contacts + '\'' +
", contactInformation='" + contactInformation + '\'' +
", rejectRemark='" + rejectRemark + '\'' +
", siteAssistanceDic=" + siteAssistanceDic +
", pickUpDate=" + pickUpDate +
", customsReceipt='" + customsReceipt + '\'' +
", customsReceiptTime=" + customsReceiptTime +
", dmRemark='" + dmRemark + '\'' +
", scanCodeDic=" + scanCodeDic +
", scanCode='" + scanCode + '\'' +
", scanStatusTime=" + scanStatusTime +
", ppe='" + ppe + '\'' +
", chmConsigmentType='" + chmConsigmentType + '\'' +
", isBatchimport='" + isBatchimport + '\'' +
// ", exitPortDicId=" + exitPortDicId +
// ", exitPortDicName='" + exitPortDicName + '\'' +
// ", exitCusDicId=" + exitCusDicId +
// ", exitCusDicName='" + exitCusDicName + '\'' +
// ", vehicleWayId=" + vehicleWayId +
// ", vehicleWayName='" + vehicleWayName + '\'' +
// ", tradeModeDicId=" + tradeModeDicId +
// ", tradeModeDicName='" + tradeModeDicName + '\'' +
// ", taxNatureDicId=" + taxNatureDicId +
// ", taxNatureDicName='" + taxNatureDicName + '\'' +
// ", dealModeDicId=" + dealModeDicId +
// ", dealModeDicName='" + dealModeDicName + '\'' +
// ", packageTypeDicId=" + packageTypeDicId +
// ", packageTypeDicName='" + packageTypeDicName + '\'' +
// ", consTypeDicId=" + consTypeDicId +
// ", consTypeDicName='" + consTypeDicName + '\'' +
// ", fromCountryDicId=" + fromCountryDicId +
// ", fromCountryDicName='" + fromCountryDicName + '\'' +
// ", tradeAreaCodeDicId=" + tradeAreaCodeDicId +
// ", tradeAreaCodeDicName='" + tradeAreaCodeDicName + '\'' +
// ", transCurrencyDicId=" + transCurrencyDicId +
// ", transCurrencyDicName='" + transCurrencyDicName + '\'' +
// ", insuranceCostCurrencyDicId=" + insuranceCostCurrencyDicId +
// ", insuranceCostCurrencyDicName='" + insuranceCostCurrencyDicName + '\'' +
// ", otherCurrencyDicId=" + otherCurrencyDicId +
// ", otherCurrencyDicName='" + otherCurrencyDicName + '\'' +
// ", throughStopPortDicId=" + throughStopPortDicId +
// ", throughStopPortDicName='" + throughStopPortDicName + '\'' +
// ", consStatusDicCode='" + consStatusDicCode + '\'' +
// ", siteAssistanceDicName='" + siteAssistanceDicName + '\'' +
// ", stampDicCode='" + stampDicCode + '\'' +
", pickUpCity='" + pickUpCity + '\'' +
", pickUpCityName='" + pickUpCityName + '\'' +
", isReturnData='" + isReturnData + '\'' +
", fedExAccount='" + fedExAccount + '\'' +
'}';
}
}
package com.erry.iclear.dateInterface.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 明细表
* Created by Erry 2019/5/30.
*
* @author Administrator
*/
@Entity
@Table(name = "T_CHM_CONSIGNMENT_DETAIL")
@Data
public class ChmConsignmentDetail implements Serializable {
private static final long serialVersionUID = 2693103610036977383L;
/**
* 运单明细表ID,自动增加
*/
@Id
@GeneratedValue
@Column(name = "ID")
private Long id;
/**
* 运单
@ManyToOne(targetEntity = ChmConsignment.class)
@JoinColumn(name = "CONSIGNMENT_ID")
private ChmConsignment chmConsignment;
*/
@Column(name = "CONSIGNMENT_ID")
private Integer consignmentId;
/**
* 商品编号CodeTS
*/
@Column(name = "SKU_CODE")
private String skuCode;
/**
* 原产国(地区)单价
*/
@Column(name = "ORI_REGION")
private BigDecimal oriRegion;
/**
* 总价
*/
@Column(name = "AMOUNT")
private BigDecimal amount;
/**
* 征免ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "LEVY_TYPE_ID")
private DictionaryEntries levyTypeDic;
/**
* 征免
*/
@Column(name = "LEVY_TYPE")
private String levyType;
/**
* 数量及单位(第一(法定)计量单位)ID
* lwz
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "UNIT_LEGAL_FIRST_ID")
private DictionaryEntries unitLegalFirstId;
/**
* 数量及单位(第一(法定)计量单位)
*/
@Column(name = "UNIT_LEGAL_FIRST")
private String unitLegalFirst;
/**
* 数量及单位(第一(法定)数量)
*/
@Column(name = "QTY_LEGAL_FIRST")
private BigDecimal qtyLegalFirst;
/**
* 数量及单位(成交数量)
*/
@Column(name = "KNOCKDOWN_NUMBER")
private BigDecimal knockdownNumber;
/**
* 成交单位ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "KNOCKDOWN_UNIT_ID")
private DictionaryEntries knockdownUnitDic;
/**
* 数量及单位(成交单位)
*/
@Column(name = "KNOCKDOWN_UNIT")
private String knockdownUnit;
/**
* 商品名称及规格型号
*/
@Column(name = "MODEL")
private String model;
/**
* 商品名称
*/
@Column(name = "SKUNAME")
private String skuName;
/**
* 原产地ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "HABITAT_ID")
private DictionaryEntries habitatDic;
/**
* 原产地
*/
@Column(name = "HABITAT")
private String habitat;
/**
* 数量及单位(第二(法定)数量)
*/
@Column(name = "QTY_LEGAL_SECOND")
private BigDecimal qtyLegalSecond;
/**
* 数量及单位(第二(法定)计量单位)ID
* lwz
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "UNIT_LEGAL_SECOND_ID")
private DictionaryEntries unitLegalSecondId;
/**
* 数量及单位(第二(法定)计量单位)
*/
@Column(name = "UNIT_LEGAL_SECOND")
private String unitLegalSecond;
/**
* 币制ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "CURRENCY_ID")
private DictionaryEntries currencyDic;
/**
* 币制(货币代码)
*/
@Column(name = "CURRENCY")
private String currency;
/**
* 最终目的国(地区)ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DictionaryEntries.class)
@JoinColumn(name = "DESTINATION_COUNTRY_ID")
private DictionaryEntries destinationCountryDic;
/**
* 最终目的国(地区)
*/
@Column(name = "DESTINATION_COUNTRY")
private String destinationCountry;
/**
* 境内货源地ID
*/
@JsonIgnore
@ManyToOne(targetEntity = DomesticDestinationMapping.class)
@JoinColumn(name = "DOMESTIC_DESTINATION_ID")
private DomesticDestinationMapping domesticDestinationMapping;
/**
* 境内货源地
*/
@Column(name = "DOMESTIC_DESTINATION")
private String domesticDestination;
/**
* 货源地(目的地)ID
*/
@JsonIgnore
@ManyToOne(targetEntity = OrigplacecodeMapping.class)
@JoinColumn(name = "ORIGPLACECODE_ID")
private OrigplacecodeMapping origplacecodeMapping;
/**
* 货源地(目的地)
*/
@Column(name = "ORIGPLACECODE")
private String origplacecode;
/**
* author : wy on 2021/01/12 新增“英文品名”
*/
@Column(name = "CONTENTDESCRIPTION")
private String contentDescription;
//------------------------------------------------------------------------------------
/**
* 备注
* */
// @Column(name = "REMARK")
// private String remark;
/**
* 申报重量
* */
// @Column(name = "DECLARED_WEIGHT")
// private BigDecimal declaredWeight;
/**
* 录入品名
*/
// @Column(name = "INPUT_ITEM")
// private String inputItem;
@Override
public String toString() {
return "ChmConsignmentDetail{" +
"id=" + id +
", consignmentId=" + consignmentId +
", skuCode='" + skuCode + '\'' +
", skuName='" + skuName + '\'' +
", model='" + model + '\'' +
", knockdownNumber=" + knockdownNumber +
", knockdownUnitDic=" + knockdownUnitDic +
", knockdownUnit='" + knockdownUnit + '\'' +
", qtyLegalFirst=" + qtyLegalFirst +
", unitLegalFirst='" + unitLegalFirst + '\'' +
", qtyLegalSecond=" + qtyLegalSecond +
", unitLegalSecond='" + unitLegalSecond + '\'' +
", habitatDic=" + habitatDic +
", habitat='" + habitat + '\'' +
", oriRegion=" + oriRegion +
", amount=" + amount +
", levyTypeDic=" + levyTypeDic +
", levyType='" + levyType + '\'' +
", currency='" + currency + '\'' +
", destinationCountry='" + destinationCountry + '\'' +
", domesticDestination='" + domesticDestination + '\'' +
", origplacecodeDic=" + origplacecodeMapping +
", origplacecode='" + origplacecode + '\'' +
//", remark='" + remark + '\'' +
//", declaredWeight='" + declaredWeight + '\'' +
", contentDescription='" + contentDescription + '\'' +
'}';
}
}
package com.erry.iclear.dateInterface.entity;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author ligang
* @date 2017/3/13
*/
@Entity
@Table(name = "T_BI_DICTIONARY_ENTRIES")
@Data
public class DictionaryEntries implements Serializable {
private static final long serialVersionUID = -8423170334642989557L;
@Id
@Column(name = "ID")
private Long id;
@Column(name = "CODE")
private String code;
@Column(name = "DICT_CODE")
private String dictCode;
@Column(name = "CHINESE_NAME")
private String chineseName;
@Column(name = "ENGLISH_NAME")
private String englishName;
@Column(name = "DESCRIPTION")
private String description;
@Column(name = "STATUS")
private Integer status;
@Column(name = "EXT1")
private Integer ext1;
@Column(name = "EXT2")
private String ext2;
@Column(name = "EXT3")
private String ext3;
@Column(name = "EXT4")
private BigDecimal ext4;
@Column(name = "EXT5")
private Integer ext5;
@Column(name = "ORDINAL")
private Integer ordinal;
@Column(name = "EXT6")
private String ext6;
}
package com.erry.iclear.dateInterface.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* 国内目的地表
* Created by Erry 2019/6/15.
* @author Administrator
*/
@Entity
@Table(name = "T_DOMESTIC_DESTINATION_MAPPING")
@Data
public class DomesticDestinationMapping implements Serializable {
private static final long serialVersionUID = 1183214016253488527L;
/**
* 运单表ID,自动增加
*/
@Id
@GeneratedValue
@Column(name = "ID")
private Long id;
/**
*国内地区代码
*/
@Column(name = "DISTRICTCODE")
private String districtCode;
/**
*国内地区名称
*/
@Column(name = "DISTRICTNAME")
private String districtName;
}
......@@ -14,12 +14,11 @@ import java.util.Date;
@Data
public class IClearApiLog implements Serializable {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 8299265671871200609L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "MSGID", insertable = false, nullable = false)
private Integer msgId;
private Long msgId;
@Column(name = "MSG_TYPE")
private String msgType;
......
package com.erry.iclear.dateInterface.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
/**
* 目的地
* Created by Erry 2019/6/15.
*
* @author Administrator
*/
@Entity
@Table(name = "T_ORIGPLACECODE_MAPPING")
@Data
public class OrigplacecodeMapping implements Serializable {
private static final long serialVersionUID = -1205560923546470604L;
/**
* 运单表ID,自动增加
*/
@Id
@Column(name = "ID")
private Long id;
/**
* 国内口岸代码
*/
@Column(name = "ORIGPLACECODE")
private String origplaceCode;
/**
* 国内口岸名称
*/
@Column(name = "ORIGPLACENAME")
private String origplaceName;
}
package com.erry.iclear.dateInterface.init;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
/**
* @author Administrator
......@@ -19,6 +23,22 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext
private ApplicationContext applicationContext;
@Autowired
private AppInfoService appInfoService;
@Autowired
private DomesticDestinationMappingService domesticDestinationMappingService;
@Autowired
private DictionaryEntriesService dictionaryEntriesService;
@Autowired
private OrigplacecodeMappingService origplacecodeMappingService;
@Autowired
private ChmCarryPortService chmCarryPortService;
@Override
public void setApplicationContext(ApplicationContext applicationContext)throws BeansException {
this.applicationContext = applicationContext;
......@@ -28,19 +48,46 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext
@Override
public void afterPropertiesSet() throws Exception {
try{
log.info("init appIdSecurity start>>>>>>>>>");
//TODO 需要从数据库中读取,然后加载到map中
String appId="CTM";
String appKey="iClearExport";
String security="b92131f03f19a348";
HashMap<String,String> appkeyMap = new HashMap<>();
appkeyMap.put(appKey,security);
Constant.appIdSecurity.put(appId,appkeyMap);
log.info("init appIdSecurity end>>>>>>>>>");
log.info("init initAppInfo start>>>>>>>>>");
appInfoService.initAppInfo();
log.info("init initAppInfo end>>>>>>>>>");
log.info("init initDictionaryEntries start>>>>>>>>>");
dictionaryEntriesService.initDictionaryEntries();
log.info("init initDictionaryEntries end>>>>>>>>>");
log.info("init initDomesticDestinationMapping start>>>>>>>>>");
domesticDestinationMappingService.initDomesticDestinationMapping();
log.info("init initDomesticDestinationMapping end>>>>>>>>>");
log.info("init initOrigplacecodeMapping start>>>>>>>>>");
origplacecodeMappingService.initOrigplacecodeMapping();
log.info("init initOrigplacecodeMapping end>>>>>>>>>");
log.info("init initChmCarryPort start>>>>>>>>>");
chmCarryPortService.initChmCarryPort();
log.info("init initChmCarryPort start>>>>>>>>>");
}catch (Exception e){
log.error("init appIdSecurity error:" + e.getMessage());
log.error("init afterPropertiesSet error:" + e.getMessage());
}
}
}
......
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author Administrator
*/
@Repository
@Transactional(rollbackFor = Exception.class)
public interface AppInfoRepository extends JpaRepository<AppInfo, Integer>, JpaSpecificationExecutor<AppInfo> {
/**
* 查找所有有效的appInfo
* @return
*/
@Query(nativeQuery = true, value = "select * from T_ICLEAR_API_APPINFO where IS_ENABLE = '1' ")
public List<AppInfo> getAllEnableAppInfo();
}
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.entity.ChmCarryPort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 港口表 Repository
* Created by Erry 2019/6/15.
* @author Administrator
*/
@Repository
public interface ChmCarryPortRepository extends JpaSpecificationExecutor<ChmCarryPort>, JpaRepository<ChmCarryPort, Long> {
/**
* 查找所有港口表数据
* @param
* @return
*/
@Query(nativeQuery = true, value = "SELECT * FROM T_CHM_CARRY_PORT")
public List<ChmCarryPort> findAllChmCarryPort();
/**
* 模糊查询所有港口表数据
* @param
* @return
*/
@Query(nativeQuery = true, value = "SELECT * FROM T_CHM_CARRY_PORT WHERE PORT_NAME LIKE ?1")
public List<ChmCarryPort> findAllChmCarryPortLikePortName(String portName);
}
\ No newline at end of file
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.entity.ChmConsignment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.Date;
import java.util.List;
/**
* @author Administrator
*/
@Repository
public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmConsignment>, JpaRepository<ChmConsignment, Long> {
/**
* 根据运单号集合+创建时间 运单
* @return
*/
@Query( nativeQuery = true,value ="select * from T_CHM_CONSIGNMENT where CONSIGNMENT_CODE IN ?1 and CREATE_TIME > ?2 " )
public List<ChmConsignment> findChmByCodeListAndCreateTime(List chmConCodeList, Date createTime);
}
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.entity.DictionaryEntries;
import com.erry.iclear.dateInterface.entity.IClearApiLog;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author Administrator
*/
@Repository
@Transactional(rollbackFor = Exception.class)
public interface DictionaryEntriesRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> {
/**
* 根据code查找
* @param code
* @return
*/
@Query(nativeQuery = true, value = "select * from T_BI_DICTIONARY_ENTRIES where CODE = ?1 AND STATUS=1 order by ORDINAL, ID")
public DictionaryEntries findDictionaryEntriesByCode(String code);
/**
* 查找全部DictionaryEntries
* @return
*/
@Query(nativeQuery = true, value = "select * from T_BI_DICTIONARY_ENTRIES where STATUS=1")
public List<DictionaryEntries> findAllDictionaryEntries();
}
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author Administrator
*/
@Repository
@Transactional(rollbackFor = Exception.class)
public interface DomesticDestinationMappingRepository extends JpaSpecificationExecutor<DomesticDestinationMapping>, JpaRepository<DomesticDestinationMapping, Long> {
/**
* 查找所有国内目的地表数据
* @param
* @return
*/
@Query(nativeQuery = true, value = "SELECT * FROM T_DOMESTIC_DESTINATION_MAPPING")
public List<DomesticDestinationMapping> findAllDomesticDestinationMapping();
/**
* 根据name查找国内目的地
* @param districtName
* @return
*/
@Query(nativeQuery = true, value = "SELECT * FROM T_DOMESTIC_DESTINATION_MAPPING WHERE DISTRICTNAME =?1")
public DomesticDestinationMapping findDomesticDestinationMappingByName(String districtName);
}
......@@ -5,9 +5,14 @@ import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
* @author Administrator
*/
......@@ -16,4 +21,11 @@ import org.springframework.transaction.annotation.Transactional;
@Repository
@Transactional(rollbackFor = Exception.class)
public interface IClearApiLogRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> {
//执行更新
@Modifying(clearAutomatically = false)
@Query("update IClearApiLog u set u.spendTime =:spendTime , u.responseTime =:responseTime , u.receiveResult =:receiveResult where u.msgId =:msgId")
public void updateIClearApiLog(@Param("msgId") Long msgId,@Param("spendTime") Long spendTime, @Param("responseTime") Date responseTime, @Param("receiveResult") String receiveResult);
}
......
package com.erry.iclear.dateInterface.repository;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* @author Administrator
*/
@Repository
@Transactional(rollbackFor = Exception.class)
public interface OrigplacecodeMappingRepository extends JpaRepository<OrigplacecodeMapping, Integer>, JpaSpecificationExecutor<OrigplacecodeMapping> {
/**
* 查找所有目的地
*
* @param
* @return
*/
@Query(nativeQuery = true, value = "SELECT * FROM T_ORIGPLACECODE_MAPPING")
public List<OrigplacecodeMapping> findAllOrigplacecodeMappingList();
/**
* 根据oriName查找目的地
*
* @param oriName
* @return
*/
@Query(nativeQuery = true, value = "SELECT * FROM T_ORIGPLACECODE_MAPPING WHERE ORIGPLACENAME =?1")
public OrigplacecodeMapping findOrigplacecodeMappingByOriName(String oriName);
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.repository.AppInfoRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class AppInfoService {
@Autowired
private AppInfoRepository appInfoRepository;
public List<AppInfo> getAllEnableAppInfo() {
List<AppInfo> result = new ArrayList<AppInfo>();
try {
result = appInfoRepository.getAllEnableAppInfo();
} catch (Exception e) {
log.error("getAllEnableAppInfo() error:" + e.getMessage());
}
return result;
}
/**
* 初始化AppInfo
*/
public void initAppInfo() {
try {
List<AppInfo> appInfoList = this.getAllEnableAppInfo();
for (AppInfo appInfo : appInfoList) {
HashMap<String, String> appkeyMap = new HashMap<String, String>();
appkeyMap.put(appInfo.getAppKey(), appInfo.getSecurity());
Constant.appIdSecurityCache.put(appInfo.getAppId(), appkeyMap);
}
} catch (Exception e) {
log.error("initAppInfo() error" + e.getMessage());
}
}
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.entity.ChmCarryPort;
import com.erry.iclear.dateInterface.repository.ChmCarryPortRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@Service
@Slf4j
public class ChmCarryPortService {
@Autowired
private ChmCarryPortRepository chmCarryPortRepository;
public List<ChmCarryPort> findAllChmCarryPort(){
List<ChmCarryPort> result = new ArrayList<>();
try{
result=chmCarryPortRepository.findAllChmCarryPort();
}catch (Exception e){
log.error("findAllChmCarryPort() error"+e.getMessage());
}
return result;
}
/**
* 初始化AppInfo
*/
public void initChmCarryPort() {
try {
List<ChmCarryPort> appInfoList = this.findAllChmCarryPort();
for (ChmCarryPort chmCarryPort : appInfoList) {
Constant.chmCarryPortCache.put(chmCarryPort.getPcCode(), chmCarryPort);
}
} catch (Exception e) {
log.error("initAppInfo() error" + e.getMessage());
}
}
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.api.request.MawbDetail;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* @author Administrator
*/
@Service
@Slf4j
public class ChmConsignmentDetailService {
/**
* 转换运单明细
* @param mawbDetail
* @return
*/
public ChmConsignmentDetail convertToChmConsignmentDetail(MawbDetail mawbDetail){
ChmConsignmentDetail result = new ChmConsignmentDetail();
try{
//归类标志
//商品编号
result.setSkuCode(mawbDetail.getCodeTS());
//申报单价
result.setOriRegion(mawbDetail.getDeclPrice());
//申报总价
result.setAmount(mawbDetail.getDeclTotal());
//征免方式
DictionaryEntries levyTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.LEVY_TYPE+mawbDetail.getDutyMode());
result.setLevyTypeDic(levyTypeDictionaryEntries);
result.setLevyType(levyTypeDictionaryEntries.getChineseName());
//货号
//版本号
//第一计量单位(法定单位)
DictionaryEntries firstUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit());
result.setUnitLegalFirstId(firstUnitDictionaryEntries);
result.setKnockdownUnit(firstUnitDictionaryEntries.getChineseName());
//第一法定数量
result.setQtyLegalFirst(BigDecimal.valueOf(mawbDetail.getFirstQty().doubleValue()));
//成交计量单位
DictionaryEntries knockdownUnitEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit());
result.setKnockdownUnitDic(knockdownUnitEntries);
result.setKnockdownUnit(knockdownUnitEntries.getChineseName());
//商品规格、型号
result.setModel(mawbDetail.getGModel());
//商品名称
result.setSkuName(mawbDetail.getGName());
//商品序号
//成交数量
result.setKnockdownNumber(BigDecimal.valueOf(mawbDetail.getGQty().doubleValue()));
//原产国
DictionaryEntries habitatDictonaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getOriginCountry());
result.setHabitatDic(habitatDictonaryEntries);
result.setHabitat(habitatDictonaryEntries.getChineseName());
//第二计量单位
DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit());
result.setUnitLegalSecondId(secondUnitDictionaryEntries);
result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName());
//第二法定数量
result.setQtyLegalSecond(BigDecimal.valueOf(mawbDetail.getSecondQty().doubleValue()));
//成交币制
DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr());
result.setCurrencyDic(currencyDictionaryEntries);
result.setCurrency(currencyDictionaryEntries.getChineseName());
//用途/生产厂家
//工缴费
//最终目的国
DictionaryEntries destinationCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getDestinationCountry());
result.setDestinationCountryDic(destinationCountryDictionaryEntries);
result.setDestinationCountry(destinationCountryDictionaryEntries.getChineseName());
//检验检疫编码
//申报货物英文名称
result.setContentDescription(mawbDetail.getDeclGoodsEname());
//目的地代码
OrigplacecodeMapping origplacecodeMapping = Constant.origplacecodeMappingCache.get(mawbDetail.getDestCode());
result.setOrigplacecodeMapping(origplacecodeMapping);
result.setOrigplacecode(origplacecodeMapping.getOrigplaceName());
//境内目的地/境内货源地
DomesticDestinationMapping domesticDestinationDictionaryEntries = Constant.domesticDestinationMappingCache.get(mawbDetail.getDistrictCode());
result.setDomesticDestinationMapping(domesticDestinationDictionaryEntries);
result.setDomesticDestination(destinationCountryDictionaryEntries.getChineseName());
}catch (Exception e){
log.error("convertToChmConsignmentDetail() error:"+e.getMessage());
}
return result;
}
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.ChmCarryPort;
import com.erry.iclear.dateInterface.entity.ChmConsignment;
import com.erry.iclear.dateInterface.entity.DictionaryEntries;
import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* @author Administrator
*/
@Service
@Slf4j
public class ChmConsignmentService {
@Autowired
private ChmConsignmentRepository chmConsignmentRepository;
/**
* 转换主单
* @return
*/
public ChmConsignment convertToChmConsignment(Mawb mawb){
ChmConsignment result = new ChmConsignment();
try{
//进出口标志:固定值 E
//报关类型:填写固定值EX,但字典表里没有这个值
// result.setDeclaredDocTypeDic();
// result.setDeclaredCode();
//申报单位代码:固定值 1111980005
result.setDeclaredUnitName(mawb.getAgentName());
//申报单位名称:固定值 联邦快递(中国)有限公司
//提单号:有总单号则取值“总单号_运单号”,没有总单号则取值“运单号”
String billNo[]=mawb.getBillNo().split("_");
result.setConsignmentHeadCode(billNo[0]);
result.setConsignmentCode(billNo[1]);
//合同号
result.setContractCode(mawb.getContrNo());
//主管海关(申报地海关)
result.setCustomsNo(mawb.getCustomMaster());
//征免性质
DictionaryEntries levyTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.LEVY_TYPE+mawb.getCutMode());
result.setTaxNatureDic(levyTypeDictionaryEntries);
result.setTaxNature(levyTypeDictionaryEntries.getChineseName());
//报关/转关关系标志:固定值0 ,但数据字典里没有0
//经停港/指运港
ChmCarryPort chmCarryPort =Constant.chmCarryPortCache.get(mawb.getDistinatePort());
result.setThroughStopPortDic(chmCarryPort);
result.setThroughStopPort(chmCarryPort.getPortNo());
//报关标志
//海关编号
result.setCustomsNo(mawb.getEntryId());
//运费币制
DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+mawb.getFeeCurr());
result.setTransCurrencyDic(currencyDictionaryEntries);
result.setTransCurrency(currencyDictionaryEntries.getChineseName());
//运费标记:固定值 3
//运费总价
result.setTransCost(mawb.getFeeRate());
//毛重
result.setGrossWeight(BigDecimal.valueOf(mawb.getGrossWet()));
//出入境关闭:固定值 0101
//录入人名称:固定值 必填项,但填的值是空值
//保险费币制
DictionaryEntries insuranceDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+mawb.getInsurCurr());
result.setInsuranceCostCurrencyDic(insuranceDictionaryEntries);
result.setInsuranceCostCurrency(insuranceDictionaryEntries.getChineseName());
//保险费标记
//保险费/率
result.setInsuranceCost(mawb.getInsurRate());
//备案号
result.setRecordCode(mawb.getManualNo());
//净重
result.setNetWeight(mawb.getNetWt());
//杂费币制
DictionaryEntries otherDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+mawb.getOtherCurr());
result.setInsuranceCostCurrencyDic(otherDictionaryEntries);
result.setInsuranceCostCurrency(otherDictionaryEntries.getChineseName());
//杂费/率
result.setOtherCost(mawb.getOtherRate());
//杂费标志
//消费使用/生产销售单位代码
//消费使用/生产销售单位名称
//件数
result.setCounts(mawb.getPackNo().longValue());
//预录入编号
result.setEnteringNo(mawb.getPreEntryId());
//启运国/运抵国
DictionaryEntries fromCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getOtherCurr());
result.setFromCountryDic(fromCountryDictionaryEntries);
result.setFromCountry(fromCountryDictionaryEntries.getChineseName());
//监管方式
DictionaryEntries tradeModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getOtherCurr());
result.setTradeModeDic(tradeModeDictionaryEntries);
result.setTradeMode(tradeModeDictionaryEntries.getChineseName());
//境内收发货人编号
result.setTradeCoSCC(mawb.getTradeCode());
//运输方式代码
DictionaryEntries vehicleWayDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.VEHICLE_WAY_CODE+mawb.getTrafMode());
result.setVehicleWay(vehicleWayDictionaryEntries);
result.setVehicleWayCode(vehicleWayDictionaryEntries.getCode());
//境内收发货人名称
result.setOperateUnitName(mawb.getTradeName());
//成交方式
DictionaryEntries dealModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CLINCH_TYPE+mawb.getTransMode());
result.setDealModeDic(dealModeDictionaryEntries);
result.setDealMode(dealModeDictionaryEntries.getChineseName());
//包装种类
DictionaryEntries packageTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.NEW_PACKAGE_TYPE+mawb.getWrapType());
result.setPackageTypeDic(packageTypeDictionaryEntries);
result.setPackageType(packageTypeDictionaryEntries.getChineseName());
//生产核销单位统一信用代码---报关形式类型
//消费使用/生产销售单位单位统一编码
//贸易国别
DictionaryEntries tradeAreaCodeDictionaryEntries=Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getTradeAreaCode());
result.setTradeAreaCodeDic(tradeAreaCodeDictionaryEntries);
result.setTradeAreaCode(tradeAreaCodeDictionaryEntries.getChineseName());
//标记及号码
result.setDeclaredRemark(mawb.getMarkNo());
//入境口岸代码:固定值 310302
//存放地点:固定值 空值
//申报人员姓名---报关员证号
result.setDeclaredUnitName(mawb.getDeclareName());
//境外发货人代码
//境外收货人编码
result.setOverseasConsignorCode(mawb.getOverseasConsigneeCode());
//境外收货人名称(外文)
result.setOverseasConsignorFnCname(mawb.getOverseasConsigneeEname());
}catch (Exception e){
log.error("convertToChmConsignment() error:"+e.getMessage());
}
return result;
}
/**
* 保存主单
* @param chmConsignment
* @return
*/
public ChmConsignment saveChmConsignment(ChmConsignment chmConsignment){
try{
return chmConsignmentRepository.save(chmConsignment);
}catch (Exception e){
log.error("saveChmConsignment() error:"+e.getMessage());
}
return null;
}
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.DictionaryEntries;
import com.erry.iclear.dateInterface.repository.DictionaryEntriesRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class DictionaryEntriesService {
@Autowired
private DictionaryEntriesRepository dictionaryEntriesRepository;
public List<DictionaryEntries> getAllDictionaryEntries(){
List<DictionaryEntries> result = new ArrayList<DictionaryEntries>();
try {
result=dictionaryEntriesRepository.findAllDictionaryEntries();
}catch (Exception e){
log.error("getAllDictionaryEntries() error:"+e.getMessage());
}
return result;
}
/**
* 初始化AppInfo
*/
public void initDictionaryEntries() {
try {
List<DictionaryEntries> dictionaryEntriesList = this.getAllDictionaryEntries();
for (DictionaryEntries dictionaryEntries : dictionaryEntriesList) {
Constant.dictionaryEntriesCache.put(dictionaryEntries.getCode(),dictionaryEntries);
}
} catch (Exception e) {
log.error("initAppInfo() error" + e.getMessage());
}
}
}
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping;
import com.erry.iclear.dateInterface.repository.DomesticDestinationMappingRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class DomesticDestinationMappingService {
@Autowired
private DomesticDestinationMappingRepository domesticDestinationMappingRepository;
public List<DomesticDestinationMapping> findAllDomesticDestinationMapping(){
List<DomesticDestinationMapping> result = new ArrayList<>();
try{
result=domesticDestinationMappingRepository.findAllDomesticDestinationMapping();
}catch (Exception e){
log.error("findAllDomesticDestinationMapping() error:" + e.getMessage());
}
return result;
}
/**
* 初始化DomesticDestinationMapping
*/
public void initDomesticDestinationMapping() {
try {
List<DomesticDestinationMapping> domList = this.findAllDomesticDestinationMapping();
for (DomesticDestinationMapping dom : domList) {
Constant.domesticDestinationMappingCache.put(dom.getDistrictCode(), dom);
}
} catch (Exception e) {
log.error("initDomesticDestinationMapping() error" + e.getMessage());
}
}
}
......@@ -59,4 +59,14 @@ public class IClearApiLogService {
}
public void updateIClearApiLog(IClearApiLog iClearApiLog){
try{
iClearApiLogRepository.updateIClearApiLog(iClearApiLog.getMsgId(),iClearApiLog.getSpendTime(),iClearApiLog.getResponseTime(),iClearApiLog.getReceiveResult());
}catch (Exception e){
log.error("updateIClearApiLog() error:"+e.getMessage());
}
}
}
......
......@@ -2,6 +2,7 @@ package com.erry.iclear.dateInterface.service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
......@@ -11,11 +12,14 @@ import org.springframework.stereotype.Service;
@Slf4j
public class IClearApiSystemService {
@Autowired
private AppInfoService appInfoService;
/**
* TODO 刷新缓存
* 刷新缓存
*/
public void refreshCache(){
public void refreshAppInfoCache(){
appInfoService.initAppInfo();
}
......
......@@ -52,9 +52,7 @@ public class MawbService {
//checkResult=
log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)
+" result :" +checkResult
);
log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb) +" result :" +checkResult );
return checkResult;
......@@ -64,6 +62,4 @@ public class MawbService {
return Boolean.FALSE;
}
}
......
package com.erry.iclear.dateInterface.service;
import com.erry.iclear.dateInterface.common.Constant;
import com.erry.iclear.dateInterface.entity.AppInfo;
import com.erry.iclear.dateInterface.entity.DomesticDestinationMapping;
import com.erry.iclear.dateInterface.entity.OrigplacecodeMapping;
import com.erry.iclear.dateInterface.repository.OrigplacecodeMappingRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
/**
* @author Administrator
*/
@Service
@Slf4j
public class OrigplacecodeMappingService {
@Autowired
private OrigplacecodeMappingRepository origplacecodeMappingRepository;
public List<OrigplacecodeMapping> findAllOrigplacecodeMapping(){
List<OrigplacecodeMapping> result = new ArrayList<>();
try{
result=origplacecodeMappingRepository.findAllOrigplacecodeMappingList();
}catch (Exception e){
log.error("findAllOrigplacecodeMapping() error:"+e.getMessage());
}
return result;
}
/**
* 初始化DomesticDestinationMapping
*/
public void initOrigplacecodeMapping() {
try {
List<OrigplacecodeMapping> domList = this.findAllOrigplacecodeMapping();
for (OrigplacecodeMapping dom : domList) {
Constant.origplacecodeMappingCache.put(dom.getOrigplaceCode(), dom);
}
} catch (Exception e) {
log.error("initDomesticDestinationMapping() error" + e.getMessage());
}
}
}
......@@ -12,7 +12,7 @@ import org.springframework.stereotype.Component;
public class IClearApiTask {
/**
* TODO 定时任务:每分钟推送
* TODO 定时任务:每分钟推送: 报关数据、回执
*/
@Scheduled(cron = "${task.pushMawbToIClear}")
public void pushMawbToIClear(){
......
package com.erry.iclear.dateInterface.util;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* @author Administrator
*/
public class SHA256Util {
/**
* 用java原生的摘要实现SHA256加密
* @param str 加密前的报文
* @return
*/
public static String getSHA256String(String str) {
String encodeStr = "";
try {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(str.getBytes("UTF-8"));
encodeStr = byte2Hex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new RuntimeException("SHA256签名过程中出现错误");
}
return encodeStr;
}
/**
* byte[]转为16进制
*
* @param bytes
* @return
*/
private static String byte2Hex(byte[] bytes) {
StringBuffer stringBuffer = new StringBuffer();
for (int i = 0; i < bytes.length; i++) {
String temp = Integer.toHexString(bytes[i] & 0xFF);
if (temp.length() == 1) {
stringBuffer.append("0");
}
stringBuffer.append(temp);
}
return stringBuffer.toString();
}
}
......@@ -13,7 +13,7 @@ public class ApiTest {
public static void main(String[] args) {
//{"IEFlag":"E","type":"EX","agentCode":"1111980005","agentName":"联邦快递(中国)有限公司","billNo":"202105210784","contrNo":"NO.565733","customMaster":"0101","cutMode":"101","declTrnRel":"0","distinatePort":"ASM000","ediId":"001","entryId":"25512456","feeCurr":"USD","feeMark":"3","feeRate":100.58,"grossWet":500,"IEPort":"0101","inputerName":"","insurCurr":"MOP","insurMark":"3","insurRate":23.44,"manualNo":"备案号","netWt":80,"otherCurr":"001","otherRate":10,"otherMark":"","ownerCode":"Z321654987","ownerName":"上海保险","packNo":1,"preEntryId":"","tradeCountry":"USA","tradeMode":"0200","tradeCode":"Z321654987","trafMode":"1","tradeName":"上海铢怡国际货物运输代理有限公司","transMode":"3","wrapType":"22","tradeCodeScc":"A74125896321456987","ownerCodeScc":"A74125896321456987","tradeAreaCode":"USA","markNo":"N/M","entyPortCode":"310302","goodsPlace":"","declareName":"张安","overseasConsignorCode":"Z785421","overseasConsigneeCode":"Z785421","overseasConsigneeEname":"出口时必填收件人公司名(原)","mawbDetailList":[{"classMark":"","codeTS":"69125472","declPrice":111.123,"declTotal":788,"dutyMode":"1","exgNo":"","exgVersion":"","firstUnit":"","firstQty":11,"GUnit":"007","GModel":"商品规格、型号","GName":"餐桌","GNo":"1","GQty":1,"originCountry":"USA","secondUnit":"007","secondQty":2,"tradeCurr":"USA","useTo":"","ciqCode":"","destinationCountry":"CHN","declGoodsEname":"","destCode":"","districtCode":"4408W"},{"classMark":"","codeTS":"69125472","declPrice":45.72,"declTotal":33,"dutyMode":"1","exgNo":"","exgVersion":"","firstUnit":"","firstQty":11,"GUnit":"007","GModel":"商品规格、型号","GName":"餐桌","GNo":"2","GQty":22,"originCountry":"USA","secondUnit":"007","secondQty":3,"tradeCurr":"USA","useTo":"","ciqCode":"","destinationCountry":"CHN","declGoodsEname":"","destCode":"","districtCode":"4408W"}]}
MawbDetail d1 = new MawbDetail();
......@@ -128,7 +128,7 @@ public class ApiTest {
mawb.setOverseasConsignorCode("Z785421");
mawb.setOverseasConsigneeCode("Z785421");
mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)");
//mawb.setMawbDetailList(mawbDetailList);
mawb.setMawbDetailList(mawbDetailList);
......
package com.erry.iclear.dateInterface;
import com.erry.iclear.dateInterface.util.SHA256Util;
public class SHA256Test {
public static void main(String[] args) {
long time =System.currentTimeMillis();
System.out.println(time);
String str = "CTM"+"iClearExport"+"b92131f03f19a348"+time;
System.out.println(SHA256Util.getSHA256String(str));
//
// 1623920478192
// eaf279997145f440ab5064e43f1a9cfdac15322886936801d57e022cde29919b
}
}