master:解析协议为转以后的json格式;

pull/1121/head
liujiang 2025-11-11 20:59:35 +08:00
parent 0416b75455
commit 9682948168
1 changed files with 10 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package com.ruoyi.web.controller.common;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.BooleanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
@ -32,6 +33,7 @@ import org.springframework.web.bind.annotation.*;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZoneOffset;
@ -232,6 +234,14 @@ public class CommonController {
return R.ok(BeanUtil.toBean(dto, BusinessLicenseVO.class));
}
public static void main(String[] args) {
String str = FileUtil.readString("C:\\Users\\123\\Desktop\\privacyPolicy(1).html", Charset.forName("UTF-8"));
Map<String, String> json = new HashMap<>();
json.put("title", "aaa");
json.put("content", str);
System.out.println(JSONUtil.toJsonStr(json));
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin')")
@ApiOperation("保存html需登录管理员用户")
@PostMapping("/html/save")