|
|
|
@ -31,100 +31,29 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @Description: kc_casusers
|
|
|
|
|
* @Author: jeecg-boot
|
|
|
|
|
* @Date: 2023-05-22
|
|
|
|
|
* @Version: V1.0
|
|
|
|
|
*/
|
|
|
|
|
* @Description: kc_casusers
|
|
|
|
|
* @Author: jeecg-boot
|
|
|
|
|
* @Date: 2023-05-22
|
|
|
|
|
* @Version: V1.0
|
|
|
|
|
*/
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/v3/3rd")
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class WpsController extends JeecgController<KcCasusers, IKcCasusersService> {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IZyInfoStudentService zyInfoStudentService;
|
|
|
|
|
@Autowired
|
|
|
|
|
private IZyInfoStudentService zyInfoStudentService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private ISysUserService sysUserService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 文档预览
|
|
|
|
|
*
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String,Object> files(@PathVariable("fileId") String fileId) {
|
|
|
|
|
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
WpsEnti map = new WpsEnti();
|
|
|
|
|
map.setId(zyInfoStudent.getId());
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath());
|
|
|
|
|
map.setVersion(1);
|
|
|
|
|
map.setSize(1);
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/")+1));
|
|
|
|
|
Long createTime = zyInfoStudent.getCreateTime().getTime()/1000;
|
|
|
|
|
Long updateTime = zyInfoStudent.getUpdateTime().getTime()/1000;
|
|
|
|
|
map.setCreate_time(Integer.parseInt(createTime+""));
|
|
|
|
|
map.setModify_time(Integer.parseInt(updateTime+""));
|
|
|
|
|
map.setCreator_id(zyInfoStudent.getCreateBy());
|
|
|
|
|
map.setModifier_id(zyInfoStudent.getUpdateBy());
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
mapRet.put("data",map);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 文件下载地址
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/download", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String,Object> download(@PathVariable("fileId") String fileId) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
Map<String,Object> mapRet2 = new HashMap<>();
|
|
|
|
|
// https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/temp/QA%E4%BD%9C%E4%B8%9A%E7%B3%BB%E7%BB%9F%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98_1733101749150.docx
|
|
|
|
|
mapRet2.put("url","https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/"+zyInfoStudent.getFilePath());
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
mapRet.put("data",mapRet2);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取文档用户权限
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/permission", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String,Object> permission(@PathVariable("fileId") String fileId) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
Map<String,Object> mapRet2 = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
mapRet2.put("comment",1);
|
|
|
|
|
// mapRet2.put("copy",1);
|
|
|
|
|
mapRet2.put("download",1);
|
|
|
|
|
mapRet2.put("history",1);
|
|
|
|
|
mapRet2.put("print",1);
|
|
|
|
|
mapRet2.put("read",1);
|
|
|
|
|
// mapRet2.put("rename",1);
|
|
|
|
|
// mapRet2.put("saveas",1);
|
|
|
|
|
mapRet2.put("update",1);
|
|
|
|
|
mapRet2.put("user_id",zyInfoStudent.getCreateBy());
|
|
|
|
|
|
|
|
|
|
mapRet.put("data",mapRet2);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 文档预览
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/versions", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String,Object> versions(@PathVariable("fileId") String fileId) {
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String, Object> files(@PathVariable("fileId") String fileId) {
|
|
|
|
|
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
WpsEnti map = new WpsEnti();
|
|
|
|
@ -132,91 +61,168 @@ public class WpsController extends JeecgController<KcCasusers, IKcCasusersServic
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath());
|
|
|
|
|
map.setVersion(1);
|
|
|
|
|
map.setSize(1);
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/")+1));
|
|
|
|
|
Long createTime = zyInfoStudent.getCreateTime().getTime()/1000;
|
|
|
|
|
Long updateTime = zyInfoStudent.getUpdateTime().getTime()/1000;
|
|
|
|
|
map.setCreate_time(Integer.parseInt(createTime+""));
|
|
|
|
|
map.setModify_time(Integer.parseInt(updateTime+""));
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/") + 1));
|
|
|
|
|
Long createTime = zyInfoStudent.getCreateTime().getTime() / 1000;
|
|
|
|
|
Long updateTime = zyInfoStudent.getUpdateTime().getTime() / 1000;
|
|
|
|
|
map.setCreate_time(Integer.parseInt(createTime + ""));
|
|
|
|
|
map.setModify_time(Integer.parseInt(updateTime + ""));
|
|
|
|
|
map.setCreator_id(zyInfoStudent.getCreateBy());
|
|
|
|
|
map.setModifier_id(zyInfoStudent.getUpdateBy());
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
mapRet.put("data",map);
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
mapRet.put("data", map);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 文件下载地址
|
|
|
|
|
*
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/download", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String, Object> download(@PathVariable("fileId") String fileId) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
Map<String, Object> mapRet2 = new HashMap<>();
|
|
|
|
|
// https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/temp/QA%E4%BD%9C%E4%B8%9A%E7%B3%BB%E7%BB%9F%E5%B8%B8%E8%A7%81%E9%97%AE%E9%A2%98_1733101749150.docx
|
|
|
|
|
mapRet2.put("url", "https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/" + zyInfoStudent.getFilePath());
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
mapRet.put("data", mapRet2);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取文档用户权限
|
|
|
|
|
*
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/permission", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String, Object> permission(@PathVariable("fileId") String fileId,
|
|
|
|
|
@RequestHeader(value = "X-WebOffice-Token", required = false) String webOfficeToken) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
Map<String, Object> mapRet2 = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
mapRet2.put("comment", 1);
|
|
|
|
|
// mapRet2.put("copy",1);
|
|
|
|
|
mapRet2.put("download", 1);
|
|
|
|
|
mapRet2.put("history", 1);
|
|
|
|
|
mapRet2.put("print", 1);
|
|
|
|
|
mapRet2.put("read", 1);
|
|
|
|
|
// mapRet2.put("rename",1);
|
|
|
|
|
// mapRet2.put("saveas",1);
|
|
|
|
|
mapRet2.put("update", webOfficeToken.equals(zyInfoStudent.getCreateBy()) ? 0 : 1);
|
|
|
|
|
// mapRet2.put("user_id",zyInfoStudent.getCreateBy());
|
|
|
|
|
mapRet2.put("user_id", webOfficeToken);
|
|
|
|
|
mapRet.put("data", mapRet2);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 文档预览
|
|
|
|
|
*
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/versions", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String, Object> versions(@PathVariable("fileId") String fileId) {
|
|
|
|
|
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
WpsEnti map = new WpsEnti();
|
|
|
|
|
map.setId(zyInfoStudent.getId());
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath());
|
|
|
|
|
map.setVersion(1);
|
|
|
|
|
map.setSize(1);
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/") + 1));
|
|
|
|
|
Long createTime = zyInfoStudent.getCreateTime().getTime() / 1000;
|
|
|
|
|
Long updateTime = zyInfoStudent.getUpdateTime().getTime() / 1000;
|
|
|
|
|
map.setCreate_time(Integer.parseInt(createTime + ""));
|
|
|
|
|
map.setModify_time(Integer.parseInt(updateTime + ""));
|
|
|
|
|
map.setCreator_id(zyInfoStudent.getCreateBy());
|
|
|
|
|
map.setModifier_id(zyInfoStudent.getUpdateBy());
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
mapRet.put("data", map);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/users")
|
|
|
|
|
public Map<String, Object> users(@RequestParam(name="user_ids",required=true) String user_ids) {
|
|
|
|
|
public Map<String, Object> users(@RequestParam(name = "user_ids", required = true) String user_ids) {
|
|
|
|
|
System.out.println("user_ids : " + user_ids);
|
|
|
|
|
String userIds[] = user_ids.split(",");
|
|
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
for(String userId : userIds){
|
|
|
|
|
List<Map<String, Object>> list = new ArrayList<>();
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
for (String userId : userIds) {
|
|
|
|
|
SysUser sysUser = sysUserService.getUserByName(userId);
|
|
|
|
|
System.out.println("sysUser : " + sysUser);
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
|
map.put("id",sysUser.getUsername());
|
|
|
|
|
map.put("name",sysUser.getRealname());
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
map.put("id", sysUser.getUsername());
|
|
|
|
|
map.put("name", sysUser.getRealname());
|
|
|
|
|
list.add(map);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mapRet.put("data",list);
|
|
|
|
|
mapRet.put("data", list);
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 准备上传阶段
|
|
|
|
|
*
|
|
|
|
|
* @param fileId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/upload/prepare", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String,Object> prepare(@PathVariable("fileId") String fileId) {
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
Map<String,Object> mapRet2 = new HashMap<>();
|
|
|
|
|
String jmArr[] = {"sha1"};
|
|
|
|
|
mapRet2.put("digest_types",jmArr);
|
|
|
|
|
mapRet.put("data",mapRet2);
|
|
|
|
|
mapRet.put("message","");
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/upload/prepare", method = {RequestMethod.GET})
|
|
|
|
|
public Map<String, Object> prepare(@PathVariable("fileId") String fileId) {
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
Map<String, Object> mapRet2 = new HashMap<>();
|
|
|
|
|
String jmArr[] = {"sha1"};
|
|
|
|
|
mapRet2.put("digest_types", jmArr);
|
|
|
|
|
mapRet.put("data", mapRet2);
|
|
|
|
|
mapRet.put("message", "");
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/upload/address", method = {RequestMethod.POST})
|
|
|
|
|
public Map<String,Object> address(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
Map<String,Object> mapRet2 = new HashMap<>();
|
|
|
|
|
mapRet2.put("url","https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/"+zyInfoStudent.getFilePath());
|
|
|
|
|
mapRet2.put("method","POST");
|
|
|
|
|
mapRet.put("data",mapRet2);
|
|
|
|
|
mapRet.put("message","");
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/upload/address", method = {RequestMethod.POST})
|
|
|
|
|
public Map<String, Object> address(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
Map<String, Object> mapRet2 = new HashMap<>();
|
|
|
|
|
mapRet2.put("url", "https://kczxcs.nenu.edu.cn/jeecg-boot/sys/common/static/" + zyInfoStudent.getFilePath());
|
|
|
|
|
mapRet2.put("method", "POST");
|
|
|
|
|
mapRet.put("data", mapRet2);
|
|
|
|
|
mapRet.put("message", "");
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/files/{fileId}/upload/complete", method = {RequestMethod.POST})
|
|
|
|
|
public Map<String,Object> complete(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti,HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
public Map<String, Object> complete(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
|
ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId);
|
|
|
|
|
Map<String,Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code",0);
|
|
|
|
|
Map<String, Object> mapRet = new HashMap<>();
|
|
|
|
|
mapRet.put("code", 0);
|
|
|
|
|
WpsEnti map = new WpsEnti();
|
|
|
|
|
map.setId(zyInfoStudent.getId());
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath());
|
|
|
|
|
map.setVersion(2);
|
|
|
|
|
map.setSize(1);
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/")+1));
|
|
|
|
|
Long createTime = zyInfoStudent.getCreateTime().getTime()/1000;
|
|
|
|
|
Long updateTime = zyInfoStudent.getUpdateTime().getTime()/1000;
|
|
|
|
|
map.setCreate_time(Integer.parseInt(createTime+""));
|
|
|
|
|
map.setModify_time(Integer.parseInt(updateTime+""));
|
|
|
|
|
map.setName(zyInfoStudent.getFilePath().substring(zyInfoStudent.getFilePath().lastIndexOf("/") + 1));
|
|
|
|
|
Long createTime = zyInfoStudent.getCreateTime().getTime() / 1000;
|
|
|
|
|
Long updateTime = zyInfoStudent.getUpdateTime().getTime() / 1000;
|
|
|
|
|
map.setCreate_time(Integer.parseInt(createTime + ""));
|
|
|
|
|
map.setModify_time(Integer.parseInt(updateTime + ""));
|
|
|
|
|
map.setCreator_id(zyInfoStudent.getCreateBy());
|
|
|
|
|
map.setModifier_id(zyInfoStudent.getUpdateBy());
|
|
|
|
|
mapRet.put("data",map);
|
|
|
|
|
mapRet.put("message","");
|
|
|
|
|
mapRet.put("data", map);
|
|
|
|
|
mapRet.put("message", "");
|
|
|
|
|
return mapRet;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|