区块链调试
This commit is contained in:
BIN
lib/access_token1.3.jar
Normal file
BIN
lib/access_token1.3.jar
Normal file
Binary file not shown.
4
pom.xml
4
pom.xml
@ -98,9 +98,9 @@
|
||||
<dependency>
|
||||
<groupId>cryp.access</groupId>
|
||||
<artifactId>accessToken</artifactId>
|
||||
<version>1.0</version>
|
||||
<version>1.3</version>
|
||||
<scope>system</scope>
|
||||
<systemPath>${basedir}/lib/access_token1.1.jar</systemPath>
|
||||
<systemPath>${basedir}/lib/access_token1.3.jar</systemPath>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -3,15 +3,11 @@ package com.chinaunicom.mall.ebtp.extend.crypconfigure.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.chinaunicom.baas.util.AccessToken;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.common.constant.CommonConstants;
|
||||
import com.chinaunicom.mall.ebtp.common.crypto.service.CrypServiceImpl;
|
||||
import com.chinaunicom.mall.ebtp.common.crypto.tenderfee.test;
|
||||
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
|
||||
import com.chinaunicom.mall.ebtp.common.uniBss.constant.UniBssConstant;
|
||||
import com.chinaunicom.mall.ebtp.common.uniBss.entity.*;
|
||||
@ -27,13 +23,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URL;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@ -165,7 +159,7 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
|
||||
log.info("加密参数1:"+object);
|
||||
String json = JSONArray.toJSONString(object);
|
||||
Map<String,Object> jsonMap = JSONArray.parseObject(json,Map.class);
|
||||
Map<String,Object> jsonMap = JSONArray.parseObject(json);
|
||||
Object signObject = new Object();
|
||||
|
||||
if(jsonMap.get("BODY_LIST")!=null){
|
||||
@ -276,10 +270,36 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Map<String,Object> parseJSON2Map(String jsonStr){
|
||||
Map<String,Object> map = new HashMap<String,Object>();
|
||||
Map strmap = JSONArray.parseObject(jsonStr,Map.class);
|
||||
for(Object k : strmap.keySet()){
|
||||
Object v = strmap.get(k);
|
||||
if(v instanceof JSONArray){
|
||||
List<Map<String,Object>> list = new ArrayList<Map<String,Object>>();
|
||||
Iterator it = ((JSONArray)v).iterator();
|
||||
while (it.hasNext()){
|
||||
Object json2 = it.next();
|
||||
list.add(parseJSON2Map(json2.toString()));
|
||||
}
|
||||
map.put(k.toString(),list);
|
||||
}else{
|
||||
map.put(k.toString(),v);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws ClassNotFoundException, IllegalAccessException, InstantiationException, UnsupportedEncodingException {
|
||||
// String token = AccessToken.tokenCreate("123");
|
||||
// System.out.println(token);
|
||||
//String json = "{\"RESULT_ID\":\"1\",\"TP_ID\":\"2\",\"SECTION_ID\":\"3\",\"REPORT_ID\":\"4\",\"RESULTDETAIL\":[{\"RESULT_DETAIL_ID\":\"51\",\"RESULT_ID\":\"52\",\"TENDERER_ID\":\"53\",\"WINNER_CANDIDATE\":\"54\",\"PRICE\":\"55\",\"PRICE_REVIEW\":\"56\",\"BUSINESS_SCORE\":\"57\",\"TECHNICAL_SCORE\":\"58\",\"SERVICE_SCORE\":\"59\",\"PRICE_SCORE\":\"60\",\"TOTAL_SCORE\":\"61\",\"CONTRACTED_MONEY\":\"62\",\"TAX_RATE_PRICE\":\"63\",\"SCOREDETAIL\":[{\"RESULT_DETAIL_ID\":\"71\",\"TENDERER_ID\":\"72\",\"USER_ID\":\"73\",\"BUSINESS_SCORE\":\"74\",\"TECHNICAL_SCORE\":\"75\",\"SERVICE_SCORE\":\"76\",\"PRICE_SCORE\":\"77\"}]}]}";
|
||||
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
//format.setTimeZone(TimeZone.getTimeZone("GMT"));
|
||||
String date = format.format(new Date());
|
||||
|
||||
String token = AccessToken.tokenCreate("bidding");
|
||||
System.out.println(token);
|
||||
// example of HashMap entity, treeMap can also work out,
|
||||
// but LinkedHashMap is NOT supported
|
||||
// Map<String,Object> mapb= new HashMap<>();
|
||||
@ -294,25 +314,24 @@ public class CrypConfigureServiceImpl extends BaseServiceImpl<CrypConfigureMappe
|
||||
// List list = new ArrayList();
|
||||
// list.add(map);
|
||||
//mapb.put("BODY_LIST",list);
|
||||
String json = "{\"BODY_LIST\":[{\"AMOUNT\":\"0\",\"SHOPPINGCART_ID\":\"1434792850257195008\",\"TENDERER_ID\":\"100002372\",\"TP_ID\":\"1433613698540576768\",\"SECTION_ID\":\"1433613698543464448\"}]}";
|
||||
Map jsonMap = JSONArray.parseObject(json,Map.class);
|
||||
|
||||
|
||||
|
||||
CrypConfigureServiceImpl crypService = new CrypConfigureServiceImpl();
|
||||
|
||||
CrypBean bean = new CrypBean();
|
||||
|
||||
bean = crypService.signObject(jsonMap);
|
||||
// String json = "{\"BODY_LIST\":[{\"AMOUNT\":\"0\",\"SHOPPINGCART_ID\":\"1434792850257195008\",\"TENDERER_ID\":\"100002372\",\"TP_ID\":\"1433613698540576768\",\"SECTION_ID\":\"1433613698543464448\"}]}";
|
||||
// Map jsonMap = parseJSON2Map(json);
|
||||
// System.out.println(jsonMap);
|
||||
// CrypConfigureServiceImpl crypService = new CrypConfigureServiceImpl();
|
||||
//
|
||||
// CrypBean bean = new CrypBean();
|
||||
//
|
||||
// String key = crypService.getSignValue(jsonMap);
|
||||
// System.out.println(key);
|
||||
//bean.setObject(jsonMap);
|
||||
//bean.setSign("MEUCIQCqbcS4d8je+XvTwlSJ1/5IEgiZBYgJlQ+nU/oi2ZeLAgIgd+SZ72Hk8xdKhcVnxwrFsIL6gHMKOFDIbo4nLzmYroM=");
|
||||
System.out.println(bean);
|
||||
// System.out.println(bean);
|
||||
//System.out.println("signature of Map: "+bean.getSign());
|
||||
//System.out.println("signature object of Map: "+bean.getObject());
|
||||
//byte[] b = JSON.toJSONBytes(bean.getObject(), new SerializerFeature[]{SerializerFeature.MapSortField, SerializerFeature.SortField});
|
||||
//System.out.println("signature object2 of Map: "+new String(b));
|
||||
boolean isOk = crypService.verifyObject(bean);
|
||||
System.out.println("verify result of Map: "+ isOk);
|
||||
// boolean isOk = crypService.verifyObject(bean);
|
||||
// System.out.println("verify result of Map: "+ isOk);
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user