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); } }