Showing
5 changed files
with
9 additions
and
109 deletions
| ... | @@ -6,7 +6,7 @@ | ... | @@ -6,7 +6,7 @@ |
| 6 | <groupId>org.springframework.boot</groupId> | 6 | <groupId>org.springframework.boot</groupId> |
| 7 | <artifactId>spring-boot-starter-parent</artifactId> | 7 | <artifactId>spring-boot-starter-parent</artifactId> |
| 8 | <version>2.1.17.RELEASE</version> | 8 | <version>2.1.17.RELEASE</version> |
| 9 | - <relativePath/> <!-- lookup parent from repository --> | 9 | + <relativePath/> |
| 10 | </parent> | 10 | </parent> |
| 11 | <groupId>com.erry.iclear</groupId> | 11 | <groupId>com.erry.iclear</groupId> |
| 12 | <artifactId>iclear-api</artifactId> | 12 | <artifactId>iclear-api</artifactId> |
| ... | @@ -85,30 +85,13 @@ | ... | @@ -85,30 +85,13 @@ |
| 85 | <artifactId>lombok</artifactId> | 85 | <artifactId>lombok</artifactId> |
| 86 | <scope>provided</scope> | 86 | <scope>provided</scope> |
| 87 | </dependency> | 87 | </dependency> |
| 88 | - <dependency> | 88 | + |
| 89 | - <groupId>cn.hutool</groupId> | 89 | + |
| 90 | - <artifactId>hutool-all</artifactId> | ||
| 91 | - <version>5.2.3</version> | ||
| 92 | - </dependency> | ||
| 93 | - <dependency> | ||
| 94 | - <groupId>com.alibaba</groupId> | ||
| 95 | - <artifactId>fastjson</artifactId> | ||
| 96 | - <version>1.2.60</version> | ||
| 97 | - </dependency> | ||
| 98 | <dependency> | 90 | <dependency> |
| 99 | <groupId>org.apache.commons</groupId> | 91 | <groupId>org.apache.commons</groupId> |
| 100 | <artifactId>commons-lang3</artifactId> | 92 | <artifactId>commons-lang3</artifactId> |
| 101 | </dependency> | 93 | </dependency> |
| 102 | - <dependency> | ||
| 103 | - <groupId>com.google.guava</groupId> | ||
| 104 | - <artifactId>guava</artifactId> | ||
| 105 | - <version>20.0</version> | ||
| 106 | - </dependency> | ||
| 107 | 94 | ||
| 108 | - <dependency> | ||
| 109 | - <groupId>commons-codec</groupId> | ||
| 110 | - <artifactId>commons-codec</artifactId> | ||
| 111 | - </dependency> | ||
| 112 | 95 | ||
| 113 | 96 | ||
| 114 | 97 | ... | ... |
| ... | @@ -95,14 +95,14 @@ public class CustomsDataInterface { | ... | @@ -95,14 +95,14 @@ public class CustomsDataInterface { |
| 95 | 95 | ||
| 96 | //2、TODO 校验主单 | 96 | //2、TODO 校验主单 |
| 97 | sw.start("checkMawb"); | 97 | sw.start("checkMawb"); |
| 98 | - if(result.getSuccess()==true){ | 98 | + if(result.getSuccess()){ |
| 99 | //result.setSuccess(mawbService.checkMawb(mawb)); | 99 | //result.setSuccess(mawbService.checkMawb(mawb)); |
| 100 | } | 100 | } |
| 101 | sw.stop(); | 101 | sw.stop(); |
| 102 | 102 | ||
| 103 | //3、TODO 校验子单 | 103 | //3、TODO 校验子单 |
| 104 | sw.start("checkMawbDetail"); | 104 | sw.start("checkMawbDetail"); |
| 105 | - if(result.getSuccess()==true){ | 105 | + if(result.getSuccess()){ |
| 106 | 106 | ||
| 107 | } | 107 | } |
| 108 | sw.stop(); | 108 | sw.stop(); |
| ... | @@ -111,7 +111,7 @@ public class CustomsDataInterface { | ... | @@ -111,7 +111,7 @@ public class CustomsDataInterface { |
| 111 | //4、保存运单到iclear中 | 111 | //4、保存运单到iclear中 |
| 112 | 112 | ||
| 113 | sw.start("saveToIClear"); | 113 | sw.start("saveToIClear"); |
| 114 | - if(result.getSuccess()==true){ | 114 | + if(result.getSuccess()){ |
| 115 | chmConsignmentService.processChmConsignment(mawb, timeStamp); | 115 | chmConsignmentService.processChmConsignment(mawb, timeStamp); |
| 116 | } | 116 | } |
| 117 | sw.stop(); | 117 | sw.stop(); |
| ... | @@ -177,7 +177,7 @@ public class CustomsDataInterface { | ... | @@ -177,7 +177,7 @@ public class CustomsDataInterface { |
| 177 | 177 | ||
| 178 | if(StringUtils.isBlank(token)){ | 178 | if(StringUtils.isBlank(token)){ |
| 179 | result.setCode("-4"); | 179 | result.setCode("-4"); |
| 180 | - result.setMsg("TimeStamp 不能为空"); | 180 | + result.setMsg("token 不能为空"); |
| 181 | return result; | 181 | return result; |
| 182 | } | 182 | } |
| 183 | 183 | ... | ... |
| 1 | package com.erry.iclear.dateInterface.service; | 1 | package com.erry.iclear.dateInterface.service; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.date.DateUtil; | 3 | +//import cn.hutool.core.date.DateUtil; |
| 4 | import com.erry.iclear.dateInterface.api.request.Mawb; | 4 | import com.erry.iclear.dateInterface.api.request.Mawb; |
| 5 | import com.erry.iclear.dateInterface.common.Constant; | 5 | import com.erry.iclear.dateInterface.common.Constant; |
| 6 | import com.erry.iclear.dateInterface.entity.ChmCarryPort; | 6 | import com.erry.iclear.dateInterface.entity.ChmCarryPort; | ... | ... |
| 1 | -package com.erry.iclear.dateInterface.util; | ||
| 2 | - | ||
| 3 | -import java.io.UnsupportedEncodingException; | ||
| 4 | -import java.util.Map; | ||
| 5 | -import java.util.Map.Entry; | ||
| 6 | -import java.util.Set; | ||
| 7 | -import java.util.TreeMap; | ||
| 8 | - | ||
| 9 | -import org.apache.commons.codec.digest.DigestUtils; | ||
| 10 | -import org.apache.commons.logging.Log; | ||
| 11 | -import org.apache.commons.logging.LogFactory; | ||
| 12 | - | ||
| 13 | -import com.alibaba.fastjson.JSON; | ||
| 14 | -import com.alibaba.fastjson.JSONArray; | ||
| 15 | -import com.alibaba.fastjson.JSONException; | ||
| 16 | -import com.alibaba.fastjson.JSONObject; | ||
| 17 | -import com.alibaba.fastjson.parser.Feature; | ||
| 18 | - | ||
| 19 | -/** | ||
| 20 | - * @author Administrator | ||
| 21 | - */ | ||
| 22 | -public class MD5Util { | ||
| 23 | - private static Log logger = LogFactory.getLog(MD5Util.class); | ||
| 24 | - public static String md5(String inStr) { | ||
| 25 | - try { | ||
| 26 | - return DigestUtils.md5Hex(inStr.getBytes("UTF-8")); | ||
| 27 | - } catch (UnsupportedEncodingException e) { | ||
| 28 | - throw new RuntimeException("MD5签名过程中出现错误"); | ||
| 29 | - } | ||
| 30 | - } | ||
| 31 | - | ||
| 32 | - public static String sign(Map<String, Object> params, String appSecret) { | ||
| 33 | - StringBuilder valueSb = new StringBuilder(); | ||
| 34 | - // 将参数以参数名的字典升序排序 | ||
| 35 | - Map<String, Object> sortParams = new TreeMap<String, Object>(params); | ||
| 36 | - Set<Entry<String, Object>> entrys = sortParams.entrySet(); | ||
| 37 | - // 遍历排序的字典,并拼接value1+value2......格式 | ||
| 38 | - for (Entry<String, Object> entry : entrys) { | ||
| 39 | - valueSb.append(entry.getValue()); | ||
| 40 | - } | ||
| 41 | - valueSb.append(appSecret); | ||
| 42 | - return md5(valueSb.toString()); | ||
| 43 | - } | ||
| 44 | - public static String getParam(JSONObject jsonObj, StringBuffer sb) { | ||
| 45 | - if(jsonObj.get("sign")!=null){ | ||
| 46 | - jsonObj.remove("sign"); | ||
| 47 | - } | ||
| 48 | - // 将参数以参数名的字典升序排序 | ||
| 49 | - for (Entry<String, Object> entry : jsonObj.entrySet()) { | ||
| 50 | - try{ | ||
| 51 | - JSONArray array = JSONArray.parseArray(entry.getValue().toString()); | ||
| 52 | - if(array!=null) { | ||
| 53 | - for (int i = 0; i < array.size(); i++) { | ||
| 54 | - getParam(array.getJSONObject(i), sb); | ||
| 55 | - } | ||
| 56 | - } | ||
| 57 | - | ||
| 58 | - }catch (JSONException e){ | ||
| 59 | - try{ | ||
| 60 | - JSONObject obj = JSONObject.parseObject(entry.getValue().toString()); | ||
| 61 | - getParam(obj,sb); | ||
| 62 | - }catch (JSONException E2){ | ||
| 63 | - sb.append(entry.getValue()); | ||
| 64 | - } | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - return sb.toString(); | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - public static String md5(Object inStr,String key) { | ||
| 71 | - try { | ||
| 72 | - JSONObject json = JSON.parseObject(JSONObject.toJSONString(inStr), Feature.OrderedField); | ||
| 73 | - String str = MD5Util.getParam(json,new StringBuffer()); | ||
| 74 | - return DigestUtils.md5Hex((str+key).getBytes("UTF-8")); | ||
| 75 | - } catch (UnsupportedEncodingException e) { | ||
| 76 | - throw new RuntimeException("MD5签名过程中出现错误"); | ||
| 77 | - } | ||
| 78 | - } | ||
| 79 | - | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - | ||
| 83 | -} |
| 1 | package com.erry.iclear.dateInterface; | 1 | package com.erry.iclear.dateInterface; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.date.DateUtil; | 3 | +//import cn.hutool.core.date.DateUtil; |
| 4 | import com.erry.iclear.dateInterface.util.DateUtils; | 4 | import com.erry.iclear.dateInterface.util.DateUtils; |
| 5 | import com.erry.iclear.dateInterface.util.SHA256Util; | 5 | import com.erry.iclear.dateInterface.util.SHA256Util; |
| 6 | 6 | ... | ... |
-
Please register or login to post a comment