feat: 测试接入wps

v0.0.1-final^2
zhanglei 2026-07-17 14:42:15 +08:00
parent 1042adfc6f
commit 6f7b84f414
3 changed files with 17 additions and 22 deletions

View File

@ -1,16 +1,15 @@
package org.qinan.safetyeval.adapter.web;
import com.alibaba.fastjson2.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.qinan.safetyeval.infrastructure.mapper.AccountMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
/**
*
* <p>
@ -22,32 +21,24 @@ import java.util.HashMap;
@RequestMapping("/safetyEval-h5/wsp")
public class H5OpenController {
@Autowired
private AccountMapper accountMapper;
@ApiOperation("wps回调预览")
@GetMapping(value = "/v3/3rd/files/{file_id}", produces = MediaType.APPLICATION_JSON_VALUE)
public String getWpsInfoByFileId(@PathVariable("file_id") String fileId) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 0);
jsonObject.put("data", new HashMap<String, Object>() {{
put("create_time", 1670218748L);
put("creator_id", "404");
put("id", fileId);
put("modifier_id", "404");
put("modify_time", 1670328304L);
put("name", "统计月报.xlsx");
put("size", 18961);
put("version", 180);
}});
return jsonObject.toJSONString();
return accountMapper.getWps(1);
}
@ApiOperation("wps回调下载")
@GetMapping(value = "/v3/3rd/files/{file_id}/download", produces = MediaType.APPLICATION_JSON_VALUE)
public String getWpsDownloadByFileId(@PathVariable("file_id") String fileId) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("code", 0);
jsonObject.put("data", new HashMap<String, Object>() {{
put("url", "https://jjb-cloud.oss-cn-hangzhou.aliyuncs.com/2.docx");
}});
return jsonObject.toJSONString();
return accountMapper.getWps(2);
}
@ApiOperation("wps回调用户信息")
@GetMapping(value = "/v3/3rd/files/{file_id}/permission", produces = MediaType.APPLICATION_JSON_VALUE)
public String getWpsPermissionByFileId(@PathVariable("file_id") String fileId) {
return accountMapper.getWps(3);
}
}

View File

@ -6,4 +6,5 @@ import org.qinan.safetyeval.infrastructure.dataobject.AccountDO;
@Mapper
public interface AccountMapper extends BaseMapper<AccountDO> {
String getWps(int i);
}

View File

@ -28,5 +28,8 @@
<sql id="Base_Column_List">
`id`, `user_name`, `account`, `phone`, `password`, `profile_url`, `type`, `delete_enum`, `remarks`, `create_name`, `update_name`, `tenant_id`, `version`, `create_time`, `update_time`, `create_id`, `update_id`, `env`
</sql>
<select id="getWps" resultType="java.lang.String">
SELECT val FROM `wps` WHERE `key` = #{id}
</select>
</mapper>