package com.pine.admin.modules.system.service.impl;


import com.pine.admin.modules.system.entity.SysPermission;
import com.pine.admin.modules.system.service.SysPermissionService;
import com.pine.admin.modules.system.service.SysService;
import com.pine.common.utils.RSAUtils;
import org.junit.Test;
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;

import java.util.List;

/**
 * @Author: Pine
 * @Date: 2019/7/27
 * @Email:771190883@qq.com
 */


@RunWith(SpringRunner.class)
@SpringBootTest
public class SysPermissionServiceImplTest {

    @Autowired
    private SysPermissionService sysPermissionService;
    @Autowired
    private SysService sysService;
    @Test
    public void getSysPermissionList() {
        List<SysPermission> sysPermissionList = sysPermissionService.getSysPermissionList(null);
    }
    @Test
    public void token() {
        String data =
//                "{\"account\":\"hh\",\"password\":6906,\"erp\":\"12818\",\"dealerId\":6906,\"name\":\"芜湖福瑞汽车销售有限公司\",\"roleType\":\"商城经销商\",\"createTime\":\"1570856401000\"}";
                "cscscs123";
        String encrypt = RSAUtils.encrypt(RSAUtils.publicKey, data);
        encrypt =
                "GitGts1op8Y%2B76cBxONNGXEwzaXlN/XbQOVygLUv3c7NA6EINwv1IsbiHLoMmqao8MGjyaVcFzKXg9nfxDh93vVI6vlJ4jQxltVMAzlR%2BX/nEpT%2BhNxPeEnyfhNwT6gkcR%2BNiOIkeU4%2BKUsfmr7nsYiM8d9JBpgdX9ibKFY%2BFpM=";
        //   防止URL 传参 + 号丢失
        encrypt  = encrypt.replace("+", "%2B");
        System.out.println(encrypt);
        sysService.decryptUser("127.0.0.1",encrypt);

    }
}
