wei.zhou

提交代码

......@@ -29,11 +29,12 @@ INSERT INTO T_ICLEAR_API_APPINFO VALUES(1,'CTM','iClearExport','b92131f03f19a348
CREATE TABLE T_ICLEAR_API_LOG(
MSGID int identity(1,1) primary key --PK
,MSG_TYPE VARCHAR(20) --类型
,MSG_TYPE VARCHAR(20) --类型: C D
,APPID VARCHAR(20) --用户ID
,APPKEY VARCHAR(20) --用户key
,CREATE_TIME datetime --创建时间
,UPDATE_TIME datetime --更新时间
,PUSH_TIME datetime --消息推送时间
--,REQUEST_MSG VARCHAR(500)
,RECEIVE_RESULT VARCHAR(100) --记录接收后是否验证通过的结果
,RESPONSE_TIME datetime -- 响应时间
......
......@@ -3,11 +3,9 @@ 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.*;
import com.erry.iclear.dateInterface.util.MD5Util;
import com.erry.iclear.dateInterface.util.DateUtils;
import com.erry.iclear.dateInterface.util.SHA256Util;
import com.google.gson.Gson;
import io.swagger.annotations.ApiOperation;
......@@ -65,8 +63,9 @@ public class CustomsDataInterface {
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));
String appKey=(String) request.getHeader("Appkey");
String timeStamp=(String) request.getHeader("TimeStamp");
IClearApiLog saveIClearApiLogResult = iClearApiLogService.saveIClearApiLog(iClearApiLogService.convertToIClearApiLog(mawb,appId,appKey,DateUtils.convertToDate(timeStamp)));
if(!Objects.equals(saveIClearApiLogResult,null)){
......@@ -110,22 +109,10 @@ public class CustomsDataInterface {
//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()+" 保存失败");
}
chmConsignmentService.processChmConsignment(mawb, timeStamp);
}
sw.stop();
......@@ -150,6 +137,8 @@ public class CustomsDataInterface {
}
/**
* 校验用户
* @param request
......@@ -220,6 +209,21 @@ public class CustomsDataInterface {
}
/**
* 检查状态是否小于已报关
* @param statusCode
* @return
* true:报关之前
* false:报关之后
*/
private boolean compareStatusCode(String statusCode){
return false;
}
}
......
......@@ -47,5 +47,9 @@ public class Constant {
public static String NEW_PACKAGE_TYPE = "NewPackageType_";
public static String TRANSFER_WAY_BILL_STATUS = "transferWaybillStatus_";
public static String SUPERVISION_MODE ="supervisionMode_";
}
......
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;
......@@ -28,7 +27,7 @@ public class ChmConsignment implements Serializable {
* 运单表ID,自动增加
*/
@Id
@GeneratedValue
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
......
......@@ -24,7 +24,7 @@ public class ChmConsignmentDetail implements Serializable {
* 运单明细表ID,自动增加
*/
@Id
@GeneratedValue
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Long id;
......
......@@ -20,47 +20,52 @@ public class DictionaryEntries implements Serializable {
private static final long serialVersionUID = -8423170334642989557L;
@Id
@GeneratedValue
@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;
// @Column(name = "DICT_CODE")
// private String dictCode;
//
// @Column(name = "ENGLISH_NAME")
// private String englishName;
//
// @Column(name = "DESCRIPTION")
// private String description;
//
// @Column(name = "STATUS")
// private Integer status;
//
// @Column(name="DICT_ID")
// private String dictId;
//
// @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;
}
......
......@@ -38,6 +38,8 @@ public class IClearApiLog implements Serializable {
//收到的json,用 T_ICLEAR_API_MAWB表保存
//@Column(name= "REQUEST_MSG")
//private String request_msg;
@Column(name= "PUSH_TIME")
private Date pushTime;
@Column(name= "RECEIVE_RESULT")
private String receiveResult;
......
......@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
import java.util.HashMap;
import java.util.List;
......@@ -48,6 +49,8 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext
@Override
public void afterPropertiesSet() throws Exception {
try{
StopWatch sw = new StopWatch("initSystemCache");
sw.start("initCache");
log.info("init initAppInfo start>>>>>>>>>");
appInfoService.initAppInfo();
log.info("init initAppInfo end>>>>>>>>>");
......@@ -68,6 +71,8 @@ public class IClearApiSystemInit implements InitializingBean, ApplicationContext
chmCarryPortService.initChmCarryPort();
log.info("init initChmCarryPort start>>>>>>>>>");
sw.stop();
System.out.println(sw.prettyPrint());
}catch (Exception e){
log.error("init afterPropertiesSet error:" + e.getMessage());
......
......@@ -4,6 +4,7 @@ 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.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import java.util.Date;
......@@ -22,4 +23,13 @@ public interface ChmConsignmentRepository extends JpaSpecificationExecutor<ChmCo
@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);
/**
* 根据运单号查找
* @param consignmentCode
* @param startDate
* @return
*/
@Query( nativeQuery = true,value ="select * from T_CHM_CONSIGNMENT where CONSIGNMENT_CODE = ?1 and CREATE_TIME>= ?2" )
public ChmConsignment findChmConsignmentByConsignmentCode(String consignmentCode,Date startDate);
}
......
......@@ -15,7 +15,7 @@ import java.util.List;
*/
@Repository
@Transactional(rollbackFor = Exception.class)
public interface DictionaryEntriesRepository extends JpaRepository<IClearApiLog, Integer>, JpaSpecificationExecutor<IClearApiLog> {
public interface DictionaryEntriesRepository extends JpaRepository<DictionaryEntries, Integer>, JpaSpecificationExecutor<DictionaryEntries> {
/**
* 根据code查找
......@@ -30,7 +30,7 @@ public interface DictionaryEntriesRepository extends JpaRepository<IClearApiLog
* 查找全部DictionaryEntries
* @return
*/
@Query(nativeQuery = true, value = "select * from T_BI_DICTIONARY_ENTRIES where STATUS=1")
@Query(nativeQuery = true, value = "select ID,CODE,CHINESE_NAME from T_BI_DICTIONARY_ENTRIES where STATUS=1")
public List<DictionaryEntries> findAllDictionaryEntries();
......
......@@ -6,6 +6,9 @@ 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 MawbDetailRepository extends JpaRepository<MawbDetail, Integer>, JpaSpecificationExecutor<MawbDetail> {
......
......@@ -4,9 +4,11 @@ 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.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.Objects;
/**
* @author Administrator
......@@ -84,9 +86,12 @@ public class ChmConsignmentDetailService {
//申报货物英文名称
result.setContentDescription(mawbDetail.getDeclGoodsEname());
//目的地代码
OrigplacecodeMapping origplacecodeMapping = Constant.origplacecodeMappingCache.get(mawbDetail.getDestCode());
result.setOrigplacecodeMapping(origplacecodeMapping);
result.setOrigplacecode(origplacecodeMapping.getOrigplaceName());
if(StringUtils.isNotBlank(mawbDetail.getDestCode())){
OrigplacecodeMapping origplacecodeMapping = Constant.origplacecodeMappingCache.get(mawbDetail.getDestCode());
result.setOrigplacecodeMapping(origplacecodeMapping);
result.setOrigplacecode(origplacecodeMapping.getOrigplaceName());
}
//境内目的地/境内货源地
......
package com.erry.iclear.dateInterface.service;
import cn.hutool.core.date.DateUtil;
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.ChmConsignmentDetail;
import com.erry.iclear.dateInterface.entity.DictionaryEntries;
import com.erry.iclear.dateInterface.repository.ChmConsignmentRepository;
import com.erry.iclear.dateInterface.util.DateUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
* @author Administrator
*/
@Service
@Slf4j
@Transactional(rollbackOn = Exception.class)
public class ChmConsignmentService {
@Autowired
private ChmConsignmentRepository chmConsignmentRepository;
@Autowired
private ChmConsignmentDetailService chmConsignmentDetailService;
/**
* 转换主单
* @return
*/
public ChmConsignment convertToChmConsignment(Mawb mawb){
public ChmConsignment convertToChmConsignment(Mawb mawb,Date pushTime){
ChmConsignment result = new ChmConsignment();
try{
//进出口标志:固定值 E
......@@ -37,9 +49,15 @@ public class ChmConsignmentService {
result.setDeclaredUnitName(mawb.getAgentName());
//申报单位名称:固定值 联邦快递(中国)有限公司
//提单号:有总单号则取值“总单号_运单号”,没有总单号则取值“运单号”
String billNo[]=mawb.getBillNo().split("_");
result.setConsignmentHeadCode(billNo[0]);
result.setConsignmentCode(billNo[1]);
String[] billNo=mawb.getBillNo().split("_");
if(billNo.length==1){
result.setConsignmentCode(billNo[0]);
}
if(billNo.length==2){
result.setConsignmentHeadCode(billNo[0]);
result.setConsignmentCode(billNo[1]);
}
//合同号
result.setContractCode(mawb.getContrNo());
//主管海关(申报地海关)
......@@ -97,13 +115,13 @@ public class ChmConsignmentService {
//预录入编号
result.setEnteringNo(mawb.getPreEntryId());
//启运国/运抵国
DictionaryEntries fromCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getOtherCurr());
DictionaryEntries fromCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getTradeCountry());
result.setFromCountryDic(fromCountryDictionaryEntries);
result.setFromCountry(fromCountryDictionaryEntries.getChineseName());
//监管方式
DictionaryEntries tradeModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+mawb.getOtherCurr());
DictionaryEntries tradeModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.SUPERVISION_MODE+mawb.getTradeMode());
result.setTradeModeDic(tradeModeDictionaryEntries);
result.setTradeMode(tradeModeDictionaryEntries.getChineseName());
......@@ -117,8 +135,9 @@ public class ChmConsignmentService {
//境内收发货人名称
result.setOperateUnitName(mawb.getTradeName());
//成交方式
DictionaryEntries dealModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CLINCH_TYPE+mawb.getTransMode());
//TODO 成交方式
// DictionaryEntries dealModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CLINCH_TYPE+mawb.getTransMode());
DictionaryEntries dealModeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CLINCH_TYPE+"CIF");
result.setDealModeDic(dealModeDictionaryEntries);
result.setDealMode(dealModeDictionaryEntries.getChineseName());
......@@ -151,7 +170,15 @@ public class ChmConsignmentService {
result.setOverseasConsignorFnCname(mawb.getOverseasConsigneeEname());
//运单状态: 待申报海关
DictionaryEntries transferWaybillStatusDictionaryEntries=Constant.dictionaryEntriesCache.get(Constant.TRANSFER_WAY_BILL_STATUS+"5");
result.setConsStatusDic(transferWaybillStatusDictionaryEntries);
result.setConsStatus(transferWaybillStatusDictionaryEntries.getChineseName());
//推送时间作为创建时间,可以用来校验数据的有序性,如果新的推送时间小于已有的创建时间,就不更新数据
result.setCreateTime(pushTime);
}catch (Exception e){
e.printStackTrace();
log.error("convertToChmConsignment() error:"+e.getMessage());
}
return result;
......@@ -173,4 +200,80 @@ public class ChmConsignmentService {
}
/**
* 根据运单号查找数据
* @param consignmentCode
* @return
*/
public ChmConsignment findChmConsignmentByConsignmentCode(String consignmentCode, Date startDate){
try {
return chmConsignmentRepository.findChmConsignmentByConsignmentCode(consignmentCode,startDate);
}catch (Exception e){
log.error("findChmConsignmentByConsignmentCode() error:"+ e.getMessage());
}
return null;
}
/**
* 保存或更新 iclear中的运单信息
* @param mawb
* @param timeStamp
*/
public void processChmConsignment(Mawb mawb, String timeStamp) {
try {
Date pushTime = DateUtils.timeStampToDate(Long.valueOf(timeStamp));
ChmConsignment chmConsignment=this.convertToChmConsignment(mawb,pushTime);
List<ChmConsignmentDetail> chmConsignmentDetailList = new ArrayList<>();
mawb.getMawbDetailList().forEach(detail ->{
chmConsignmentDetailList.add(chmConsignmentDetailService.convertToChmConsignmentDetail(detail));
});
chmConsignment.setChmConsignmentDetailList(chmConsignmentDetailList);
//校验 7天+运单 ,如果有数据并且 还未报关就更新,如果数据就插入
ChmConsignment chmConsignmentDB=this.findChmConsignmentByConsignmentCode(mawb.getBillNo(), DateUtils.addDate(DateUtils.getCurrentDate(),-7));
//新增:如果没有就插入
if (Objects.equals(chmConsignmentDB,null)){
log.info("新增主单"+ mawb.getBillNo());
ChmConsignment chmConsignmentSaveResult = this.saveChmConsignment(chmConsignment);
if(!Objects.equals(chmConsignmentSaveResult,null)){
log.info("主单"+ mawb.getBillNo()+" 保存成功,chmConsignmentId:"+chmConsignmentSaveResult.getId());
}else{
log.info("主单"+ mawb.getBillNo()+" 保存失败");
}
//更新:
//如果有数据并且满足条件后才能更新数据
//条件1、状态为 待申报海关
//条件2、推送时间小于 上次推送的时间
}else if(!Objects.equals(chmConsignmentDB,null)
&& Objects.equals(chmConsignmentDB.getConsStatusDic().getCode(),"transferWaybillStatus_5")
&& pushTime.getTime()<chmConsignmentDB.getCreateTime().getTime()){
//TODO 更新数据
log.info("更新主单"+ mawb.getBillNo());
}
}catch (Exception e){
log.error(""+e.getMessage());
}
}
}
......
......@@ -26,6 +26,7 @@ public class DictionaryEntriesService {
try {
result=dictionaryEntriesRepository.findAllDictionaryEntries();
}catch (Exception e){
e.printStackTrace();
log.error("getAllDictionaryEntries() error:"+e.getMessage());
}
return result;
......
......@@ -38,7 +38,7 @@ public class IClearApiLogService {
* 创建日志
* @return
*/
public IClearApiLog convertToIClearApiLog(Mawb mawb,String appId,String appKey){
public IClearApiLog convertToIClearApiLog(Mawb mawb,String appId,String appKey,Date pushTime){
IClearApiLog result = new IClearApiLog();
try{
result.setMsgType(Constant.MSG_TYPE_D);
......@@ -46,6 +46,7 @@ public class IClearApiLogService {
result.setAppKey(appKey);
result.setCreateTime(new Date());
result.setUpdateTime(new Date());
result.setPushTime(pushTime);
result.setReceiveResult(null);
result.setResponseTime(null);
result.setSpendTime(null);
......
This diff is collapsed. Click to expand it.
package com.erry.iclear.dateInterface;
import com.erry.iclear.dateInterface.api.request.Mawb;
import com.erry.iclear.dateInterface.api.request.MawbDetail;
import com.erry.iclear.dateInterface.service.ChmConsignmentService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
public class ChmConsignmentServiceTest extends IClearApiApplicationTests {
@Autowired
private ChmConsignmentService chmConsignmentService;
@Test
public void testProcessChmConsignment(){
try{
Mawb mawb = this.createNewMawb();
String timeStamp = String.valueOf(new Date().getTime());
chmConsignmentService.processChmConsignment(mawb,timeStamp);
}catch (Exception e){
e.printStackTrace();
}
}
private Mawb createNewMawb(){
MawbDetail d1 = new MawbDetail();
d1.setClassMark("");
d1.setCodeTS("69125472");
d1.setDeclPrice(BigDecimal.valueOf(111.123));
d1.setDeclTotal(BigDecimal.valueOf(788));
d1.setDutyMode("1");
d1.setExgNo("");
d1.setExgVersion("");
d1.setFirstUnit("001");
d1.setFirstQty(11);
d1.setGUnit("007");
d1.setGModel("商品规格、型号");
d1.setGName("餐桌");
d1.setGNo("1");
d1.setGQty(1);
d1.setOriginCountry("US");
d1.setSecondUnit("007");
d1.setSecondQty(2);
d1.setTradeCurr("USD");
d1.setUseTo("");
d1.setWorkUsd(null);
d1.setDestinationCountry("CN");
d1.setCiqCode("");
d1.setDeclGoodsEname("");
d1.setDestCode("");
d1.setDistrictCode("4408W");
MawbDetail d2 = new MawbDetail();
d2.setClassMark("");
d2.setCodeTS("69125472");
d2.setDeclPrice(BigDecimal.valueOf(45.72));
d2.setDeclTotal(BigDecimal.valueOf(33));
d2.setDutyMode("1");
d2.setExgNo("");
d2.setExgVersion("");
d2.setFirstUnit("001");
d2.setFirstQty(11);
d2.setGUnit("007");
d2.setGModel("商品规格、型号");
d2.setGName("餐桌");
d2.setGNo("2");
d2.setGQty(22);
d2.setOriginCountry("US");
d2.setSecondUnit("007");
d2.setSecondQty(3);
d2.setTradeCurr("USD");
d2.setUseTo("");
d2.setWorkUsd(null);
d2.setDestinationCountry("CN");
d2.setCiqCode("");
d2.setDeclGoodsEname("");
d2.setDestCode("");
d2.setDistrictCode("4408W");
List<MawbDetail> mawbDetailList = new ArrayList<MawbDetail>();
mawbDetailList.add(d1);
mawbDetailList.add(d2);
Mawb mawb = new Mawb();
mawb.setIEFlag("E");
mawb.setType("EX");
mawb.setAgentCode("1111980005");
mawb.setAgentName("联邦快递(中国)有限公司");
mawb.setBillNo("202105210784");
mawb.setContrNo("NO.565733");
mawb.setCustomMaster("0101");
mawb.setCutMode("1");//TODO levyType_1 到底是什么code?
mawb.setDeclTrnRel("0");
mawb.setDistinatePort("ASM000");
mawb.setEdiId("001");
mawb.setEntryId("25512456");
mawb.setFeeCurr("USD");
mawb.setFeeMark("3");
mawb.setFeeRate(BigDecimal.valueOf(100.58));
mawb.setGrossWet(500);
mawb.setIEPort("0101");
mawb.setInputerName("");
mawb.setInsurCurr("MOP");
mawb.setInsurMark("3");
mawb.setInsurRate(BigDecimal.valueOf(23.44));
mawb.setManualNo("备案号");
mawb.setNetWt(BigDecimal.valueOf(80));
mawb.setOtherCurr("USD");
mawb.setOtherRate(BigDecimal.valueOf(10));
mawb.setOtherMark("");
mawb.setOwnerCode("Z321654987");
mawb.setOwnerName("上海保险");
mawb.setPackNo(1);
mawb.setPreEntryId("");
mawb.setTradeCountry("US");
mawb.setTradeMode("110");
mawb.setTradeCode("Z321654987");
mawb.setTrafMode("1");
mawb.setTradeName("上海铢怡国际货物运输代理有限公司");
mawb.setTransMode("3");
mawb.setWrapType("22");
mawb.setTradeCodeScc("A74125896321456987");
mawb.setOwnerCodeScc("A74125896321456987");
mawb.setTradeAreaCode("US");
mawb.setMarkNo("N/M");
mawb.setEntyPortCode("310302");
mawb.setGoodsPlace("");
mawb.setDeclareName("张安");
mawb.setOverseasConsignorCode("Z785421");
mawb.setOverseasConsigneeCode("Z785421");
mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)");
mawb.setMawbDetailList(mawbDetailList);
return mawb;
}
}
package com.erry.iclear.dateInterface;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.web.WebAppConfiguration;
@RunWith(SpringRunner.class)
@SpringBootTest
@WebAppConfiguration
@ActiveProfiles("dev")
class IClearApiApplicationTests {
@Test
void contextLoads() {
public void contextLoads() {
}
}
......
package com.erry.iclear.dateInterface;
import cn.hutool.core.date.DateUtil;
import com.erry.iclear.dateInterface.util.DateUtils;
import com.erry.iclear.dateInterface.util.SHA256Util;
import java.util.Date;
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));
// long time =System.currentTimeMillis();
// System.out.println(time);
// String str = "CTM"+"iClearExport"+"b92131f03f19a348"+time;
//
//
// System.out.println(SHA256Util.getSHA256String(str));
//
// 1623920478192
// eaf279997145f440ab5064e43f1a9cfdac15322886936801d57e022cde29919b
//
// //String s ="aaa_2222";
// String s ="2222";
// String str[]=s.split("_");
// System.out.println(str[0]);
// //System.out.println(str[1]);
//
// System.out.println(DateUtils.addDate(DateUtils.getCurrentDate(),-7));
//
Date currentDate = new Date();
long timeStamp = currentDate.getTime();
System.out.println(timeStamp);
String tStr = String.valueOf(timeStamp);
System.out.println(tStr);
System.out.println(Long.valueOf(tStr));
System.out.println(DateUtils.timeStampToDate(Long.valueOf(tStr)));
}
}
......