提交 f48c3a0d 编写于 作者: Chongwen.jiang's avatar Chongwen.jiang

增加测试代码。。。

上级 53595cd3
......@@ -182,6 +182,12 @@
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
......
package com.pica.cloud.account.account.server.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.pica.cloud.account.account.server.entity.EncryptEntity;
import com.pica.cloud.account.account.server.req.BaseRequest;
import java.util.HashMap;
import java.util.Map;
/**
......@@ -32,6 +35,29 @@ public class CryptoUtil {
// return encryptEntity;
// }
public static void aa(String data) throws Exception{
//1、产生AES密钥
String keyString = "1234567890123456";
//2、用AES法加密数据
String content = AESUtil.aesEncrypt(data, keyString);
//3、用RSA加密AES密钥
String finalKey = RSAUtil.encrypt(keyString);
Map<String, Object> param = new HashMap<>(2);
param.put("key", finalKey);
param.put("content", content);
System.out.println(JSON.toJSONString(param));
}
public static void main(String[] args) throws Exception {
Map<String, Object> param = new HashMap<>(10);
param.put("bizType", 1);
param.put("weChatLoginType", 1);
param.put("weChatCode", "071KMzjM1ge35a1oDekM1zptjM1KMzjO");
aa(JSON.toJSONString(param));
}
/**
* 解密数据
*
......
package com.pica.cloud.account.account.server.mapper;// Copyright 2016-2101 Pica.
import com.pica.cloud.account.account.server.entity.AccountWeChatInfoEntity;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* @ClassName com.pica.cloud.account.account.server.mapper.Test
* @Description junit test
* @Author Chongwen.jiang
* @Date 2020/2/25 14:51
* @ModifyDate 2020/2/25 14:51
* @Version 1.0
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class AccountWeChatInfoMapperTest {
@Autowired
private AccountWeChatInfoMapper weChatInfoMapper;
@org.junit.Test
public void test1(){
/* AccountWeChatInfoEntity record = new AccountWeChatInfoEntity();
record.setNickname("Zz");
record.setSex(1);
record.setCountry("中国");
record.setCity("邵阳");
int count = weChatInfoMapper.insertSelective(record);
System.out.println(count);*/
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册