wei.zhou

代码优化

...@@ -134,65 +134,6 @@ public class CustomsDataInterface { ...@@ -134,65 +134,6 @@ public class CustomsDataInterface {
134 return result; 134 return result;
135 } 135 }
136 136
137 -
138 -
139 -
140 - /**
141 - * 校验用户
142 - * @param request
143 - * @param result
144 -
145 - private ResultRS checkAppSecret(HttpServletRequest request, ResultRS result) {
146 - String appId=(String) request.getHeader("Appid");
147 - String appkey=(String) request.getHeader("Appkey");
148 - String timeStamp=(String) request.getHeader("TimeStamp");
149 - String token= (String) request.getHeader("token");
150 - if(StringUtils.isBlank(appId)){
151 - result.setCode("-1");
152 - result.setMsg("Appid 不能为空");
153 - return result;
154 - }
155 - if(StringUtils.isBlank(appkey)){
156 - result.setCode("-2");
157 - result.setMsg("Appkey 不能为空");
158 - return result;
159 - }
160 - if(StringUtils.isBlank(timeStamp)){
161 - result.setCode("-6");
162 - result.setMsg("TimeStamp 不能为空");
163 - return result;
164 - }
165 - if(StringUtils.isBlank(token)){
166 - result.setCode("-4");
167 - result.setMsg("token 不能为空");
168 - return result;
169 - }
170 -
171 - HashMap<String,String> secretMap = Constant.appIdSecurityCache.get(appId);
172 - if(secretMap==null){
173 - result.setCode("-100");
174 - result.setMsg("系统异常,该appId没有注册");
175 - return result;
176 - }
177 -
178 - String secretInSys = secretMap.get(appkey);
179 - if (StringUtils.isBlank(secretInSys)) {
180 - result.setCode("-101");
181 - result.setMsg("系统异常,该appId没有权限/密码");
182 - return result;
183 - }
184 -
185 - String sha256Str = SHA256Util.getSHA256String(appId+appkey+secretInSys+timeStamp);
186 - if(!token.equals(sha256Str)){
187 - result.setCode("-4");
188 - result.setMsg("Token验证失败");
189 - return result;
190 - }
191 - result.setSuccess(true);
192 - return result;
193 - }
194 - */
195 -
196 } 137 }
197 138
198 139
......
...@@ -47,22 +47,31 @@ public class ChmConsignmentDetailService { ...@@ -47,22 +47,31 @@ public class ChmConsignmentDetailService {
47 result.setAmount(mawbDetail.getDeclTotal()); 47 result.setAmount(mawbDetail.getDeclTotal());
48 //征免方式 48 //征免方式
49 DictionaryEntries levyTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.LEVY_TYPE+mawbDetail.getDutyMode()); 49 DictionaryEntries levyTypeDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.LEVY_TYPE+mawbDetail.getDutyMode());
50 + if(!Objects.equals(levyTypeDictionaryEntries,null)){
50 result.setLevyTypeDic(levyTypeDictionaryEntries); 51 result.setLevyTypeDic(levyTypeDictionaryEntries);
51 result.setLevyType(levyTypeDictionaryEntries.getChineseName()); 52 result.setLevyType(levyTypeDictionaryEntries.getChineseName());
53 + }
54 +
52 //货号 55 //货号
53 //版本号 56 //版本号
54 //第一计量单位(法定单位) 57 //第一计量单位(法定单位)
55 DictionaryEntries firstUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit()); 58 DictionaryEntries firstUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getFirstUnit());
59 + if(!Objects.equals(firstUnitDictionaryEntries,null)){
56 result.setUnitLegalFirstId(firstUnitDictionaryEntries); 60 result.setUnitLegalFirstId(firstUnitDictionaryEntries);
57 result.setUnitLegalFirst(firstUnitDictionaryEntries.getChineseName()); 61 result.setUnitLegalFirst(firstUnitDictionaryEntries.getChineseName());
62 + }
63 +
58 64
59 //第一法定数量 65 //第一法定数量
60 result.setQtyLegalFirst(BigDecimal.valueOf(mawbDetail.getFirstQty().doubleValue())); 66 result.setQtyLegalFirst(BigDecimal.valueOf(mawbDetail.getFirstQty().doubleValue()));
61 //成交计量单位 67 //成交计量单位
62 //2021年7月8日 成交单位有修改,原取值第一法定计量单位,先取值成交单位。xjq 68 //2021年7月8日 成交单位有修改,原取值第一法定计量单位,先取值成交单位。xjq
63 DictionaryEntries knockdownUnitEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getGunit()); 69 DictionaryEntries knockdownUnitEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getGunit());
70 + if(!Objects.equals(knockdownUnitEntries,null)){
64 result.setKnockdownUnitDic(knockdownUnitEntries); 71 result.setKnockdownUnitDic(knockdownUnitEntries);
65 result.setKnockdownUnit(knockdownUnitEntries.getChineseName()); 72 result.setKnockdownUnit(knockdownUnitEntries.getChineseName());
73 + }
74 +
66 //商品规格、型号 75 //商品规格、型号
67 result.setModel(mawbDetail.getGmodel()); 76 result.setModel(mawbDetail.getGmodel());
68 //商品名称 77 //商品名称
...@@ -72,26 +81,39 @@ public class ChmConsignmentDetailService { ...@@ -72,26 +81,39 @@ public class ChmConsignmentDetailService {
72 result.setKnockdownNumber(BigDecimal.valueOf(mawbDetail.getGqty().doubleValue())); 81 result.setKnockdownNumber(BigDecimal.valueOf(mawbDetail.getGqty().doubleValue()));
73 //原产国 82 //原产国
74 DictionaryEntries habitatDictonaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getOriginCountry()); 83 DictionaryEntries habitatDictonaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getOriginCountry());
84 + if(!Objects.equals(habitatDictonaryEntries,null)){
75 result.setHabitatDic(habitatDictonaryEntries); 85 result.setHabitatDic(habitatDictonaryEntries);
76 result.setHabitat(habitatDictonaryEntries.getChineseName()); 86 result.setHabitat(habitatDictonaryEntries.getChineseName());
87 + }
88 +
77 89
78 //第二计量单位 90 //第二计量单位
79 DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit()); 91 DictionaryEntries secondUnitDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.TRANSACTION_UNIT+ mawbDetail.getSecondUnit());
92 + if(!Objects.equals(secondUnitDictionaryEntries,null)){
80 result.setUnitLegalSecondId(secondUnitDictionaryEntries); 93 result.setUnitLegalSecondId(secondUnitDictionaryEntries);
81 result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName()); 94 result.setUnitLegalSecond(secondUnitDictionaryEntries.getChineseName());
95 + }
96 +
97 +
82 //第二法定数量 98 //第二法定数量
83 result.setQtyLegalSecond(BigDecimal.valueOf(mawbDetail.getSecondQty().doubleValue())); 99 result.setQtyLegalSecond(BigDecimal.valueOf(mawbDetail.getSecondQty().doubleValue()));
84 //成交币制 100 //成交币制
85 DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr()); 101 DictionaryEntries currencyDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.CURRENCY_SYSTEM+ mawbDetail.getTradeCurr());
102 + if(!Objects.equals(currencyDictionaryEntries,null)){
86 result.setCurrencyDic(currencyDictionaryEntries); 103 result.setCurrencyDic(currencyDictionaryEntries);
87 result.setCurrency(currencyDictionaryEntries.getChineseName()); 104 result.setCurrency(currencyDictionaryEntries.getChineseName());
105 + }
106 +
88 107
89 //用途/生产厂家 108 //用途/生产厂家
90 //工缴费 109 //工缴费
91 //最终目的国 110 //最终目的国
92 DictionaryEntries destinationCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getDestinationCountry()); 111 DictionaryEntries destinationCountryDictionaryEntries = Constant.dictionaryEntriesCache.get(Constant.COUNTRY+ mawbDetail.getDestinationCountry());
112 + if(!Objects.equals(destinationCountryDictionaryEntries,null)){
93 result.setDestinationCountryDic(destinationCountryDictionaryEntries); 113 result.setDestinationCountryDic(destinationCountryDictionaryEntries);
94 result.setDestinationCountry(destinationCountryDictionaryEntries.getChineseName()); 114 result.setDestinationCountry(destinationCountryDictionaryEntries.getChineseName());
115 + }
116 +
95 117
96 118
97 //检验检疫编码 119 //检验检疫编码
...@@ -101,15 +123,18 @@ public class ChmConsignmentDetailService { ...@@ -101,15 +123,18 @@ public class ChmConsignmentDetailService {
101 if(StringUtils.isNotBlank(mawbDetail.getDestCode())){ 123 if(StringUtils.isNotBlank(mawbDetail.getDestCode())){
102 OrigplacecodeMapping origplacecodeMapping = Constant.origplacecodeMappingCache.get(mawbDetail.getDestCode()); 124 OrigplacecodeMapping origplacecodeMapping = Constant.origplacecodeMappingCache.get(mawbDetail.getDestCode());
103 result.setOrigplacecodeMapping(origplacecodeMapping); 125 result.setOrigplacecodeMapping(origplacecodeMapping);
104 - result.setOrigplacecode(origplacecodeMapping.getOrigplaceName()); 126 + result.setOrigplacecode(Objects.equals(origplacecodeMapping,null)?"":origplacecodeMapping.getOrigplaceName());
105 } 127 }
106 128
107 129
108 130
109 //境内目的地/境内货源地 131 //境内目的地/境内货源地
110 DomesticDestinationMapping domesticDestinationDictionaryEntries = Constant.domesticDestinationMappingCache.get(mawbDetail.getDistrictCode()); 132 DomesticDestinationMapping domesticDestinationDictionaryEntries = Constant.domesticDestinationMappingCache.get(mawbDetail.getDistrictCode());
133 + if(!Objects.equals(domesticDestinationDictionaryEntries,null)){
111 result.setDomesticDestinationMapping(domesticDestinationDictionaryEntries); 134 result.setDomesticDestinationMapping(domesticDestinationDictionaryEntries);
112 - result.setDomesticDestination(destinationCountryDictionaryEntries.getChineseName()); 135 + result.setDomesticDestination(Objects.equals(destinationCountryDictionaryEntries,null)?"":destinationCountryDictionaryEntries.getChineseName());
136 + }
137 +
113 138
114 result.setDetailId(mawbDetail.getDetailId()); 139 result.setDetailId(mawbDetail.getDetailId());
115 140
......
1 spring: 1 spring:
2 - jpa:
3 - database: sql_server
4 - show-sql: true
5 - hibernate:
6 - ddl-auto: none
7 - naming:
8 - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
9 datasource: 2 datasource:
10 url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev 3 url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDev
11 username: sa 4 username: sa
......
1 spring: 1 spring:
2 - jpa:
3 - database: sql_server
4 - show-sql: true
5 - hibernate:
6 - ddl-auto: none
7 - naming:
8 - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
9 datasource: 2 datasource:
10 url: jdbc:sqlserver://yilansql.database.chinacloudapi.cn:1433;DatabaseName=IClear_Prod 3 url: jdbc:sqlserver://yilansql.database.chinacloudapi.cn:1433;DatabaseName=IClear_Prod
11 username: sqladmin 4 username: sqladmin
......
1 spring: 1 spring:
2 - jpa:
3 - database: sql_server
4 - show-sql: true
5 - hibernate:
6 - ddl-auto: none
7 - naming:
8 - physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
9 datasource: 2 datasource:
10 url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDemo 3 url: jdbc:sqlserver://40.73.78.157:1433;DatabaseName=IClearDemo
11 username: sa 4 username: sa
......
...@@ -16,4 +16,14 @@ spring: ...@@ -16,4 +16,14 @@ spring:
16 name: iClearExport.DataInterface 16 name: iClearExport.DataInterface
17 profiles: 17 profiles:
18 active: @activatedProperties@ 18 active: @activatedProperties@
19 - 19 + jpa:
20 + database: sql_server
21 + show-sql: true
22 + hibernate:
23 + ddl-auto: none
24 + naming:
25 + physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
26 + properties:
27 + event:
28 + merge:
29 + entity_copy_observer: allow
......
...@@ -23,7 +23,14 @@ public class HttpClientTest { ...@@ -23,7 +23,14 @@ public class HttpClientTest {
23 // System.out.println(HttpClientUtil.get(HttpConfig.custom().url("https://40.73.78.157:8780/system/healthCheck"))); 23 // System.out.println(HttpClientUtil.get(HttpConfig.custom().url("https://40.73.78.157:8780/system/healthCheck")));
24 // System.out.println(HttpClientUtil.post(HttpConfig.custom().url("https://40.73.78.157:8780/customs/sendMawb"))); 24 // System.out.println(HttpClientUtil.post(HttpConfig.custom().url("https://40.73.78.157:8780/customs/sendMawb")));
25 25
26 - String timeStamp = "1623920478192"; 26 +
27 +
28 + String masbJson ="{\"ieFlag\":\"E\",\"type\":\"EX\",\"agentCode\":\"1111980005\",\"agentName\":\"联邦快递(中国)有限公司\",\"billNo\":\"07127275242_00062210\",\"contrNo\":\"FY2016\",\"customMaster\":\"2233\",\"cutMode\":\"101\",\"declTrnRel\":\"0\",\"distinatePort\":\"ASM000\",\"ediId\":\"001\",\"entryId\":\"25512456\",\"feeCurr\":\"EUR\",\"feeMark\":\"3\",\"feeRate\":3.65,\"grossWet\":4,\"iePort\":\"0101\",\"insurCurr\":\"MOP\",\"insurMark\":\"3\",\"insurRate\":0.02457,\"netWt\":3.857,\"ownerCode\":\"1234567890\",\"ownerName\":\"琥博信息科技有限公司\",\"packNo\":1,\"tradeCountry\":\"US\",\"tradeMode\":\"0110\",\"tradeCode\":\"1234567890\",\"trafMode\":\"5\",\"tradeName\":\"琥博信息科技有限公司\",\"transMode\":\"3\",\"wrapType\":\"22\",\"tradeCodeScc\":\"123456789012345678\",\"ownerCodeScc\":\"123456789012345678\",\"tradeAreaCode\":\"US\",\"entyPortCode\":\"310302\",\"goodsPlace\":\"\",\"declareName\":\"申报人员姓名_50\",\"overseasConsignorCode\":\"AEO Code 50位\",\"overseasConsigneeCode\":\"境外收货人编码_50位\",\"overseasConsigneeEname\":\"境外收货人名称(外文)_400\",\"mawbDetailList\":[{\"detailId\":\"12251\",\"classMark\":\"\",\"codeTS\":\"8538900000\",\"declPrice\":128,\"declTotal\":128,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"035\",\"firstQty\":0,\"gunit\":\"007\",\"gmodel\":\"用于PLC可编程控制器|琥博|6ES7153|无其他1\",\"gname\":\"PLC可编程控制器零件/接口模块\",\"gno\":\"1\",\"gqty\":1,\"originCountry\":\"US\",\"secondQty\":222,\"tradeCurr\":\"USD\",\"useTo\":\"03\",\"ciqCode\":\"001\",\"destinationCountry\":\"CNY\",\"destCode\":\"110102\",\"districtCode\":\"4408W\"},{\"detailId\":\"12252\",\"classMark\":\"\",\"codeTS\":\"8538900000\",\"declPrice\":94.47,\"declTotal\":188.94,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"035\",\"firstQty\":0,\"gunit\":\"007\",\"gmodel\":\"用于PLC可编程控制器|琥博|6ES7331|无其他2\",\"gname\":\"PLC可编程控制器零件/输入模块\",\"gno\":\"2\",\"gqty\":2,\"originCountry\":\"US\",\"secondQty\":222,\"tradeCurr\":\"USD\",\"useTo\":\"03\",\"ciqCode\":\"\",\"destinationCountry\":\"CHN\",\"destCode\":\"\",\"districtCode\":\"4408W\"},{\"detailId\":\"12601\",\"classMark\":\"\",\"codeTS\":\"8538900001\",\"declPrice\":94.47,\"declTotal\":188.94,\"dutyMode\":\"1\",\"exgNo\":\"\",\"exgVersion\":\"\",\"firstUnit\":\"035\",\"firstQty\":0,\"gunit\":\"007\",\"gmodel\":\"用于PLC可编程控制器|琥博|6ES7331|无其他3\",\"gname\":\"PLC可编程控制器零件/输入模块\",\"gno\":\"2\",\"gqty\":2,\"originCountry\":\"US\",\"secondQty\":222,\"tradeCurr\":\"USD\",\"useTo\":\"03\",\"ciqCode\":\"\",\"destinationCountry\":\"CHN\",\"destCode\":\"\",\"districtCode\":\"4408W\"}]}";
29 +
30 +
31 +
32 +
33 + String timeStamp = "1623971478192";
27 //String timeStamp = "1624263798669"; 34 //String timeStamp = "1624263798669";
28 System.out.println(new Date(Long.valueOf(timeStamp))); 35 System.out.println(new Date(Long.valueOf(timeStamp)));
29 String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + "b92131f03f19a348" + timeStamp); 36 String token = SHA256Util.getSHA256String("IDE" + "iClearExport" + "b92131f03f19a348" + timeStamp);
...@@ -52,7 +59,8 @@ public class HttpClientTest { ...@@ -52,7 +59,8 @@ public class HttpClientTest {
52 .url(url) 59 .url(url)
53 .encoding("utf-8") 60 .encoding("utf-8")
54 .client(hcb.build()) 61 .client(hcb.build())
55 - .json(new Gson().toJson(createMawb())); 62 +// .json(new Gson().toJson(createMawb()));
63 + .json(masbJson);
56 System.out.println(HttpClientUtil.post(config)); 64 System.out.println(HttpClientUtil.post(config));
57 } 65 }
58 66
......