feat: 测试接入wps
parent
1042adfc6f
commit
6f7b84f414
|
|
@ -1,16 +1,15 @@
|
||||||
package org.qinan.safetyeval.adapter.web;
|
package org.qinan.safetyeval.adapter.web;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
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.http.MediaType;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 对外开放接口(免鉴权)。
|
* 对外开放接口(免鉴权)。
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -22,32 +21,24 @@ import java.util.HashMap;
|
||||||
@RequestMapping("/safetyEval-h5/wsp")
|
@RequestMapping("/safetyEval-h5/wsp")
|
||||||
public class H5OpenController {
|
public class H5OpenController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private AccountMapper accountMapper;
|
||||||
|
|
||||||
@ApiOperation("wps回调预览")
|
@ApiOperation("wps回调预览")
|
||||||
@GetMapping(value = "/v3/3rd/files/{file_id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/v3/3rd/files/{file_id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public String getWpsInfoByFileId(@PathVariable("file_id") String fileId) {
|
public String getWpsInfoByFileId(@PathVariable("file_id") String fileId) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
return accountMapper.getWps(1);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("wps回调下载")
|
@ApiOperation("wps回调下载")
|
||||||
@GetMapping(value = "/v3/3rd/files/{file_id}/download", produces = MediaType.APPLICATION_JSON_VALUE)
|
@GetMapping(value = "/v3/3rd/files/{file_id}/download", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
public String getWpsDownloadByFileId(@PathVariable("file_id") String fileId) {
|
public String getWpsDownloadByFileId(@PathVariable("file_id") String fileId) {
|
||||||
JSONObject jsonObject = new JSONObject();
|
return accountMapper.getWps(2);
|
||||||
jsonObject.put("code", 0);
|
}
|
||||||
jsonObject.put("data", new HashMap<String, Object>() {{
|
|
||||||
put("url", "https://jjb-cloud.oss-cn-hangzhou.aliyuncs.com/2.docx");
|
@ApiOperation("wps回调用户信息")
|
||||||
}});
|
@GetMapping(value = "/v3/3rd/files/{file_id}/permission", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
return jsonObject.toJSONString();
|
public String getWpsPermissionByFileId(@PathVariable("file_id") String fileId) {
|
||||||
|
return accountMapper.getWps(3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,4 +6,5 @@ import org.qinan.safetyeval.infrastructure.dataobject.AccountDO;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface AccountMapper extends BaseMapper<AccountDO> {
|
public interface AccountMapper extends BaseMapper<AccountDO> {
|
||||||
|
String getWps(int i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,5 +28,8 @@
|
||||||
<sql id="Base_Column_List">
|
<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`
|
`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>
|
</sql>
|
||||||
|
<select id="getWps" resultType="java.lang.String">
|
||||||
|
SELECT val FROM `wps` WHERE `key` = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue