Showing
5 changed files
with
79 additions
and
20 deletions
| ... | @@ -54,8 +54,8 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -54,8 +54,8 @@ public class CacheSystem implements CommandLineRunner { |
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| 56 | * @Author mt | 56 | * @Author mt |
| 57 | - * @Description 获取目录层级下所有目录 | 57 | + * @Description 根据dicCode获取目录层级下所有目录 |
| 58 | - * @Date 2024/11/4 | 58 | + * @Date 2024年11月5日18:38:28 |
| 59 | * @param dicCode | 59 | * @param dicCode |
| 60 | * @return java.util.List<com.fedex.connect.common.model.bi.DictionaryEntries> | 60 | * @return java.util.List<com.fedex.connect.common.model.bi.DictionaryEntries> |
| 61 | */ | 61 | */ |
| ... | @@ -65,8 +65,8 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -65,8 +65,8 @@ public class CacheSystem implements CommandLineRunner { |
| 65 | 65 | ||
| 66 | /** | 66 | /** |
| 67 | * @Author mt | 67 | * @Author mt |
| 68 | - * @Description 获取用户类型指定字典项 | 68 | + * @Description 根据code获取用户类型指定字典项 |
| 69 | - * @Date 2024/11/4 | 69 | + * @Date 2024年11月5日18:38:28 |
| 70 | * @param code | 70 | * @param code |
| 71 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 71 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 72 | */ | 72 | */ |
| ... | @@ -77,8 +77,8 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -77,8 +77,8 @@ public class CacheSystem implements CommandLineRunner { |
| 77 | 77 | ||
| 78 | /** | 78 | /** |
| 79 | * @Author mt | 79 | * @Author mt |
| 80 | - * @Description 获取运单状态指定字典项 | 80 | + * @Description 根据code获取运单状态指定字典项 |
| 81 | - * @Date 2024/11/4 | 81 | + * @Date 2024年11月5日18:38:28 |
| 82 | * @param code | 82 | * @param code |
| 83 | * @return com.fedex.connect.common.model.bi.DictionaryEntries | 83 | * @return com.fedex.connect.common.model.bi.DictionaryEntries |
| 84 | */ | 84 | */ |
| ... | @@ -86,5 +86,28 @@ public class CacheSystem implements CommandLineRunner { | ... | @@ -86,5 +86,28 @@ public class CacheSystem implements CommandLineRunner { |
| 86 | List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.CONSIGNMENT_STATUS).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | 86 | List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.CONSIGNMENT_STATUS).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); |
| 87 | return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | 87 | return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); |
| 88 | } | 88 | } |
| 89 | -} | ||
| 90 | 89 | ||
| 90 | + /** | ||
| 91 | + * @Author mt | ||
| 92 | + * @Description 根据code获取国家指定字典项 | ||
| 93 | + * @Date 2024年11月5日18:38:28 | ||
| 94 | + * @param code | ||
| 95 | + * @return com.fedex.connect.common.model.bi.DictionaryEntries | ||
| 96 | + */ | ||
| 97 | + public DictionaryEntries getDicCountry(String code){ | ||
| 98 | + List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList()); | ||
| 99 | + return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + /** | ||
| 103 | + * @Author mt | ||
| 104 | + * @Description 根据ext1获取国家指定字典项 | ||
| 105 | + * @Date 2024/11/5 | ||
| 106 | + * @param ext1 | ||
| 107 | + * @return com.fedex.connect.common.model.bi.DictionaryEntries | ||
| 108 | + */ | ||
| 109 | + public DictionaryEntries getDicCountryByExt1(String ext1){ | ||
| 110 | + List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> ext1.equals(p.getExt1())).collect(Collectors.toList()); | ||
| 111 | + return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); | ||
| 112 | + } | ||
| 113 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -22,5 +22,15 @@ public interface BaseConstants { | ... | @@ -22,5 +22,15 @@ public interface BaseConstants { |
| 22 | String MODIFY_USER_NAME = "modifyUserName"; | 22 | String MODIFY_USER_NAME = "modifyUserName"; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | - | 25 | + //运单表基础字段 |
| 26 | + interface CONSIGNMENT_TABLE_COLUMN_KEYS{ | ||
| 27 | + //预计取件时间 | ||
| 28 | + String SHIP_DATE = "shipDate"; | ||
| 29 | + //原产国全称 | ||
| 30 | + String ORIGIN_COUNTRY = "originCountry"; | ||
| 31 | + //发货人计费账号 | ||
| 32 | + String SHIPPER_ACCOUNT = "shipperAccount"; | ||
| 33 | + //目的国全称 | ||
| 34 | + String DESTINATION_COUNTRY = "destinationCountry"; | ||
| 35 | + } | ||
| 26 | } | 36 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -10,4 +10,6 @@ public interface DictionaryConstants { | ... | @@ -10,4 +10,6 @@ public interface DictionaryConstants { |
| 10 | String CONSIGNMENT_STATUS = "CONSIGNMENT_STATUS"; | 10 | String CONSIGNMENT_STATUS = "CONSIGNMENT_STATUS"; |
| 11 | //用户类型 | 11 | //用户类型 |
| 12 | String USER_TYPE = "USER_TYPE"; | 12 | String USER_TYPE = "USER_TYPE"; |
| 13 | + //国家 | ||
| 14 | + String COUNTRY = "COUNTRY"; | ||
| 13 | } | 15 | } | ... | ... |
| 1 | package com.fedex.connect.kafka.constants; | 1 | package com.fedex.connect.kafka.constants; |
| 2 | 2 | ||
| 3 | +import com.fedex.connect.common.dependencies.contants.BaseConstants; | ||
| 4 | + | ||
| 3 | /** | 5 | /** |
| 4 | * @Author mt | 6 | * @Author mt |
| 5 | * @Description 类说明 常量接口 | 7 | * @Description 类说明 常量接口 |
| ... | @@ -39,11 +41,26 @@ public interface Constant { | ... | @@ -39,11 +41,26 @@ public interface Constant { |
| 39 | //代理人 | 41 | //代理人 |
| 40 | String BROKEN = "BROKEN"; | 42 | String BROKEN = "BROKEN"; |
| 41 | } | 43 | } |
| 42 | - //地址类型常量 | 44 | + //收发件人国家二字码 |
| 43 | interface CE_INFO_KEYS{ | 45 | interface CE_INFO_KEYS{ |
| 44 | //发件人国家 | 46 | //发件人国家 |
| 45 | String TW = "TW"; | 47 | String TW = "TW"; |
| 46 | //收件人国家 | 48 | //收件人国家 |
| 47 | String CN = "CN"; | 49 | String CN = "CN"; |
| 48 | } | 50 | } |
| 51 | + //ceInfo转换为consignment忽略字段 | ||
| 52 | + interface CE_CONSIGNMENT_COPY_IGNORE_PROP_KEYS{ | ||
| 53 | + String[] IGNORE_PROPERTIES = { | ||
| 54 | + BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.SHIP_DATE, | ||
| 55 | + BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.ORIGIN_COUNTRY, | ||
| 56 | + BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.SHIPPER_ACCOUNT, | ||
| 57 | + BaseConstants.CONSIGNMENT_TABLE_COLUMN_KEYS.DESTINATION_COUNTRY, | ||
| 58 | + BaseConstants.BASE_TABLE_COLUMN_KEYS.CREATE_TIME, | ||
| 59 | + BaseConstants.BASE_TABLE_COLUMN_KEYS.CREATE_USER_ID, | ||
| 60 | + BaseConstants.BASE_TABLE_COLUMN_KEYS.CREATE_USER_NAME, | ||
| 61 | + BaseConstants.BASE_TABLE_COLUMN_KEYS.MODIFY_TIME, | ||
| 62 | + BaseConstants.BASE_TABLE_COLUMN_KEYS.MODIFY_USER_ID, | ||
| 63 | + BaseConstants.BASE_TABLE_COLUMN_KEYS.MODIFY_USER_NAME, | ||
| 64 | + }; | ||
| 65 | + } | ||
| 49 | } | 66 | } | ... | ... |
| ... | @@ -121,12 +121,17 @@ public class Dm501Util { | ... | @@ -121,12 +121,17 @@ public class Dm501Util { |
| 121 | * @return void | 121 | * @return void |
| 122 | */ | 122 | */ |
| 123 | private void generateCeInfoShipper(CeInfo ceInfo,Dm501ConAddresses shipperAddress){ | 123 | private void generateCeInfoShipper(CeInfo ceInfo,Dm501ConAddresses shipperAddress){ |
| 124 | - //发件人国家 | 124 | + //发件人国家(二字码) |
| 125 | String shipperCountry = shipperAddress.getCountry(); | 125 | String shipperCountry = shipperAddress.getCountry(); |
| 126 | //始发国(二字码) | 126 | //始发国(二字码) |
| 127 | ceInfo.setShipperCountry(shipperCountry); | 127 | ceInfo.setShipperCountry(shipperCountry); |
| 128 | + //根据发件人国家二字码获取字典 | ||
| 129 | + DictionaryEntries shipperCountryEntries = cacheSystem.getDicCountryByExt1(shipperCountry); | ||
| 130 | + //根据二字码能获取到二字码则赋值始发国全称 | ||
| 131 | + if(Objects.nonNull(shipperCountryEntries)){ | ||
| 128 | //原产国全称 | 132 | //原产国全称 |
| 129 | -// ceInfo.setOriginCountry(); | 133 | + ceInfo.setOriginCountry(shipperCountryEntries.getEnglishName()); |
| 134 | + } | ||
| 130 | //发货联系人姓名 | 135 | //发货联系人姓名 |
| 131 | ceInfo.setShipperContactName(shipperAddress.getContactName()); | 136 | ceInfo.setShipperContactName(shipperAddress.getContactName()); |
| 132 | //发货人手机号 | 137 | //发货人手机号 |
| ... | @@ -157,8 +162,13 @@ public class Dm501Util { | ... | @@ -157,8 +162,13 @@ public class Dm501Util { |
| 157 | String recipientCountry = recipientAddress.getCountry(); | 162 | String recipientCountry = recipientAddress.getCountry(); |
| 158 | // //目的国家二字码 | 163 | // //目的国家二字码 |
| 159 | ceInfo.setRecipientCountry(recipientCountry); | 164 | ceInfo.setRecipientCountry(recipientCountry); |
| 165 | + //根据发件人国家二字码获取字典 | ||
| 166 | + DictionaryEntries countryEntries = cacheSystem.getDicCountryByExt1(recipientCountry); | ||
| 167 | + //根据二字码能获取到二字码则赋值目的国全称 | ||
| 168 | + if(Objects.nonNull(countryEntries)){ | ||
| 160 | //目的国全称 | 169 | //目的国全称 |
| 161 | -// ceInfo.setDestinationCountry(); | 170 | + ceInfo.setDestinationCountry(countryEntries.getEnglishName()); |
| 171 | + } | ||
| 162 | //收件联系人姓名 | 172 | //收件联系人姓名 |
| 163 | ceInfo.setRecipientContactName(recipientAddress.getContactName()); | 173 | ceInfo.setRecipientContactName(recipientAddress.getContactName()); |
| 164 | //收件人手机号 | 174 | //收件人手机号 |
| ... | @@ -185,7 +195,7 @@ public class Dm501Util { | ... | @@ -185,7 +195,7 @@ public class Dm501Util { |
| 185 | * @return com.fedex.connect.common.model.biz.Consignment | 195 | * @return com.fedex.connect.common.model.biz.Consignment |
| 186 | */ | 196 | */ |
| 187 | public Consignment generateConsignment(CeInfo ceInfo) throws Exception{ | 197 | public Consignment generateConsignment(CeInfo ceInfo) throws Exception{ |
| 188 | - Consignment rsConsignment = null; | 198 | + Consignment rsConsignment; |
| 189 | /** | 199 | /** |
| 190 | * 根据运单号查找30天之前运单 | 200 | * 根据运单号查找30天之前运单 |
| 191 | */ | 201 | */ |
| ... | @@ -203,15 +213,12 @@ public class Dm501Util { | ... | @@ -203,15 +213,12 @@ public class Dm501Util { |
| 203 | AssignmentFieldUtils.assignmentTableBaseField(resultConsignment); | 213 | AssignmentFieldUtils.assignmentTableBaseField(resultConsignment); |
| 204 | rsConsignment = resultConsignment; | 214 | rsConsignment = resultConsignment; |
| 205 | }else{ | 215 | }else{ |
| 206 | - //原产国全称 | 216 | + //ceInfo转换为consignment忽略字段 |
| 207 | -// String originCountry = consignment.getOriginCountry(); | 217 | + String[] ignoreProperties = Constant.CE_CONSIGNMENT_COPY_IGNORE_PROP_KEYS.IGNORE_PROPERTIES; |
| 208 | - //发货人国家二字码 | 218 | + //字段拷贝 |
| 209 | -// String shipperCountry = consignment.getShipperCountry(); | 219 | + BeanUtils.copyProperties(ceInfo,consignment,ignoreProperties); |
| 210 | - | ||
| 211 | - BeanUtils.copyProperties(ceInfo,consignment); | ||
| 212 | rsConsignment = consignment; | 220 | rsConsignment = consignment; |
| 213 | } | 221 | } |
| 214 | - | ||
| 215 | return rsConsignment; | 222 | return rsConsignment; |
| 216 | } | 223 | } |
| 217 | 224 | ... | ... |
-
Please register or login to post a comment