| | |
| | | import com.ruoyi.system.service.ISysClientAppService; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | | import com.ruoyi.common.annotation.Anonymous; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | |
| | | /** |
| | | * 客户应用配置Controller |
| | |
| | | public AjaxResult remove(@PathVariable Long[] appIds) { |
| | | return toAjax(sysClientAppService.deleteSysClientAppByAppIds(appIds)); |
| | | } |
| | | |
| | | @Anonymous(needSign=true) |
| | | @GetMapping("/testSign") |
| | | public AjaxResult testSign(){ |
| | | return AjaxResult.success("成功"); |
| | | } |
| | | /** |
| | | * 生成签名 |
| | | */ |
| | | @Anonymous |
| | | @GetMapping("/generateSign/{appId}") |
| | | public AjaxResult generateSign(@PathVariable("appId") String appId) |
| | | { |
| | | // 获取当前系统时间戳 |
| | | long timestamp = System.currentTimeMillis(); |
| | | |
| | | // 查询应用信息获取securityKey |
| | | SysClientApp clientApp = sysClientAppService.selectSysClientAppByAppKey(appId); |
| | | if (clientApp == null) |
| | | { |
| | | return AjaxResult.error("应用不存在"); |
| | | } |
| | | |
| | | // 生成签名 |
| | | String signStr = appId + timestamp + clientApp.getSecurityKey(); |
| | | String sign = SecurityUtils.md5(signStr); |
| | | |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("use","md5(appId+timestamp+securityKey)"); |
| | | ajax.put("appId", appId); |
| | | ajax.put("timestamp", String.valueOf(timestamp)); |
| | | ajax.put("sign", sign); |
| | | //ajax.put("signStr", signStr); // 用于调试,显示拼接的字符串 |
| | | return ajax; |
| | | } |
| | | } |
| | | |