tao.mo

All | 修改 | 处理ce501数据调整

mt
2024年11月5日19:15:18
......@@ -54,8 +54,8 @@ public class CacheSystem implements CommandLineRunner {
/**
* @Author mt
* @Description 获取目录层级下所有目录
* @Date 2024/11/4
* @Description 根据dicCode获取目录层级下所有目录
* @Date 2024年11月5日18:38:28
* @param dicCode
* @return java.util.List<com.fedex.connect.common.model.bi.DictionaryEntries>
*/
......@@ -65,8 +65,8 @@ public class CacheSystem implements CommandLineRunner {
/**
* @Author mt
* @Description 获取用户类型指定字典项
* @Date 2024/11/4
* @Description 根据code获取用户类型指定字典项
* @Date 2024年11月5日18:38:28
* @param code
* @return com.fedex.connect.common.model.bi.DictionaryEntries
*/
......@@ -77,8 +77,8 @@ public class CacheSystem implements CommandLineRunner {
/**
* @Author mt
* @Description 获取运单状态指定字典项
* @Date 2024/11/4
* @Description 根据code获取运单状态指定字典项
* @Date 2024年11月5日18:38:28
* @param code
* @return com.fedex.connect.common.model.bi.DictionaryEntries
*/
......@@ -86,5 +86,28 @@ public class CacheSystem implements CommandLineRunner {
List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.CONSIGNMENT_STATUS).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList());
return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
}
}
/**
* @Author mt
* @Description 根据code获取国家指定字典项
* @Date 2024年11月5日18:38:28
* @param code
* @return com.fedex.connect.common.model.bi.DictionaryEntries
*/
public DictionaryEntries getDicCountry(String code){
List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList());
return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
}
/**
* @Author mt
* @Description 根据ext1获取国家指定字典项
* @Date 2024/11/5
* @param ext1
* @return com.fedex.connect.common.model.bi.DictionaryEntries
*/
public DictionaryEntries getDicCountryByExt1(String ext1){
List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> ext1.equals(p.getExt1())).collect(Collectors.toList());
return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
}
}
\ No newline at end of file
......
......@@ -22,5 +22,15 @@ public interface BaseConstants {
String MODIFY_USER_NAME = "modifyUserName";
}
//运单表基础字段
interface CONSIGNMENT_TABLE_COLUMN_KEYS{
//预计取件时间
String SHIP_DATE = "shipDate";
//原产国全称
String ORIGIN_COUNTRY = "originCountry";
//发货人计费账号
String SHIPPER_ACCOUNT = "shipperAccount";
//目的国全称
String DESTINATION_COUNTRY = "destinationCountry";
}
}
\ No newline at end of file
......
......@@ -10,4 +10,6 @@ public interface DictionaryConstants {
String CONSIGNMENT_STATUS = "CONSIGNMENT_STATUS";
//用户类型
String USER_TYPE = "USER_TYPE";
//国家
String COUNTRY = "COUNTRY";
}
......
package com.fedex.connect.kafka.constants;
import com.fedex.connect.common.dependencies.contants.BaseConstants;
/**
* @Author mt
* @Description 类说明 常量接口
......@@ -39,11 +41,26 @@ public interface Constant {
//代理人
String BROKEN = "BROKEN";
}
//地址类型常量
//收发件人国家二字码
interface CE_INFO_KEYS{
//发件人国家
String TW = "TW";
//收件人国家
String CN = "CN";
}
//ceInfo转换为consignment忽略字段
interface CE_CONSIGNMENT_COPY_IGNORE_PROP_KEYS{
String[] IGNORE_PROPERTIES = {
BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.SHIP_DATE,
BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.ORIGIN_COUNTRY,
BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.SHIPPER_ACCOUNT,
BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.DESTINATION_COUNTRY,
BaseConstants.BASE_TABLE_COLUMN_KEYS.CREATE_TIME,
BaseConstants.BASE_TABLE_COLUMN_KEYS.CREATE_USER_ID,
BaseConstants.BASE_TABLE_COLUMN_KEYS.CREATE_USER_NAME,
BaseConstants.BASE_TABLE_COLUMN_KEYS.MODIFY_TIME,
BaseConstants.BASE_TABLE_COLUMN_KEYS.MODIFY_USER_ID,
BaseConstants.BASE_TABLE_COLUMN_KEYS.MODIFY_USER_NAME,
};
}
}
......
......@@ -121,12 +121,17 @@ public class Dm501Util {
* @return void
*/
private void generateCeInfoShipper(CeInfo ceInfo,Dm501ConAddresses shipperAddress){
//发件人国家
//发件人国家(二字码)
String shipperCountry = shipperAddress.getCountry();
//始发国(二字码)
ceInfo.setShipperCountry(shipperCountry);
//原产国全称
// ceInfo.setOriginCountry();
//根据发件人国家二字码获取字典
DictionaryEntries shipperCountryEntries = cacheSystem.getDicCountryByExt1(shipperCountry);
//根据二字码能获取到二字码则赋值始发国全称
if(Objects.nonNull(shipperCountryEntries)){
//原产国全称
ceInfo.setOriginCountry(shipperCountryEntries.getEnglishName());
}
//发货联系人姓名
ceInfo.setShipperContactName(shipperAddress.getContactName());
//发货人手机号
......@@ -157,8 +162,13 @@ public class Dm501Util {
String recipientCountry = recipientAddress.getCountry();
// //目的国家二字码
ceInfo.setRecipientCountry(recipientCountry);
//目的国全称
// ceInfo.setDestinationCountry();
//根据发件人国家二字码获取字典
DictionaryEntries countryEntries = cacheSystem.getDicCountryByExt1(recipientCountry);
//根据二字码能获取到二字码则赋值目的国全称
if(Objects.nonNull(countryEntries)){
//目的国全称
ceInfo.setDestinationCountry(countryEntries.getEnglishName());
}
//收件联系人姓名
ceInfo.setRecipientContactName(recipientAddress.getContactName());
//收件人手机号
......@@ -185,7 +195,7 @@ public class Dm501Util {
* @return com.fedex.connect.common.model.biz.Consignment
*/
public Consignment generateConsignment(CeInfo ceInfo) throws Exception{
Consignment rsConsignment = null;
Consignment rsConsignment;
/**
* 根据运单号查找30天之前运单
*/
......@@ -203,15 +213,12 @@ public class Dm501Util {
AssignmentFieldUtils.assignmentTableBaseField(resultConsignment);
rsConsignment = resultConsignment;
}else{
//原产国全称
// String originCountry = consignment.getOriginCountry();
//发货人国家二字码
// String shipperCountry = consignment.getShipperCountry();
BeanUtils.copyProperties(ceInfo,consignment);
//ceInfo转换为consignment忽略字段
String[] ignoreProperties = Constant.CE_CONSIGNMENT_COPY_IGNORE_PROP_KEYS.IGNORE_PROPERTIES;
//字段拷贝
BeanUtils.copyProperties(ceInfo,consignment,ignoreProperties);
rsConsignment = consignment;
}
return rsConsignment;
}
......