zhangf
2024-06-24 21362fd048558832cdcaca8ee957d2d7aa753be2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.ruoyi.web.controller.system;
 
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.signature.AESUtils;
import com.ruoyi.framework.web.domain.threeAccess.req.AccessReqDTO;
import com.ruoyi.framework.web.service.ThreeInstitutionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
 
@RestController
public class ThreeAccessController extends BaseController {
    @Autowired
    private ThreeInstitutionService threeInstitutionService;
 
    @PostMapping("/gov-server/token")
    public AjaxResult getToken(@RequestBody JSONObject jsonObject){
 
        return ok(threeInstitutionService.getToken(jsonObject));
    }
 
    public static void main(String[] args) {
        AccessReqDTO accessReqDTO = new AccessReqDTO();
        accessReqDTO.setAccessKey("Opq98lRKQ0NbBR59Ddi0");
        accessReqDTO.setSecretKey("AKKYCSZCYGCxCmxR7bsO");
        String jsonString = JSONObject.toJSONString(accessReqDTO);
        String encrypt = AESUtils.encrypt(jsonString);
        System.out.println(encrypt);
        String decrypt = AESUtils.decrypt("ASg/NElcGyKiKSUu334t5DXcYjgpxb11mFr5YSf6sHICkQCrZ++NSQ55ZoMw1p+hKgFiuNEPXsDLp2lOtR52zDGaFLFKSQIqEgSJ7IL6YBCExaF3fQSqIFZFX62KygHb");
        System.out.println(decrypt);
    }
}