diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java index bbc5c1ba..38c68633 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/kc/ktgl/controller/KcKechengbiaoController.java @@ -112,7 +112,7 @@ public class KcKechengbiaoController extends JeecgController pageList = kcKechengbiaoService.listGroupBy(page, queryWrapper); return Result.OK(pageList); } - + /** * 添加 * @@ -127,7 +127,7 @@ public class KcKechengbiaoController extends JeecgController kcKechengbiaoQueryWrapper = new QueryWrapper<>(); kcKechengbiaoQueryWrapper.eq("rwbh",rwbh); kcKechengbiaoQueryWrapper.eq("xqxn",xqxn); + kcKechengbiaoQueryWrapper.eq("flag","0"); kcKechengbiaoQueryWrapper.last("limit 1"); KcKechengbiao kcKechengbiao = kcKechengbiaoService.getOne(kcKechengbiaoQueryWrapper); return Result.OK(kcKechengbiao); diff --git a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java index 4efcd795..f2fba6db 100644 --- a/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java +++ b/jeecg-module-main/src/main/java/org/jeecg/modules/wps/controller/WpsController.java @@ -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 { - @Autowired - private IZyInfoStudentService zyInfoStudentService; + @Autowired + private IZyInfoStudentService zyInfoStudentService; @Autowired private ISysUserService sysUserService; /** * 文档预览 + * * @param fileId * @return */ - @RequestMapping(value = "/files/{fileId}", method = {RequestMethod.GET}) - public Map 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 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 download(@PathVariable("fileId") String fileId) { - ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); - Map mapRet = new HashMap<>(); - Map 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 permission(@PathVariable("fileId") String fileId) { - ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); - Map mapRet = new HashMap<>(); - Map 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 versions(@PathVariable("fileId") String fileId) { + @RequestMapping(value = "/files/{fileId}", method = {RequestMethod.GET}) + public Map files(@PathVariable("fileId") String fileId) { ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); WpsEnti map = new WpsEnti(); @@ -132,91 +61,168 @@ public class WpsController extends JeecgController mapRet = new HashMap<>(); - mapRet.put("code",0); - mapRet.put("data",map); + Map 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 download(@PathVariable("fileId") String fileId) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + Map 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 permission(@PathVariable("fileId") String fileId, + @RequestHeader(value = "X-WebOffice-Token", required = false) String webOfficeToken) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + Map 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 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 mapRet = new HashMap<>(); + mapRet.put("code", 0); + mapRet.put("data", map); return mapRet; } @GetMapping(value = "/users") - public Map users(@RequestParam(name="user_ids",required=true) String user_ids) { + public Map users(@RequestParam(name = "user_ids", required = true) String user_ids) { System.out.println("user_ids : " + user_ids); String userIds[] = user_ids.split(","); - List> list = new ArrayList<>(); - Map mapRet = new HashMap<>(); - mapRet.put("code",0); - for(String userId : userIds){ + List> list = new ArrayList<>(); + Map mapRet = new HashMap<>(); + mapRet.put("code", 0); + for (String userId : userIds) { SysUser sysUser = sysUserService.getUserByName(userId); System.out.println("sysUser : " + sysUser); - Map map = new HashMap<>(); - map.put("id",sysUser.getUsername()); - map.put("name",sysUser.getRealname()); + Map 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 prepare(@PathVariable("fileId") String fileId) { - Map mapRet = new HashMap<>(); - mapRet.put("code",0); - Map 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 prepare(@PathVariable("fileId") String fileId) { + Map mapRet = new HashMap<>(); + mapRet.put("code", 0); + Map 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 address(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti) { - ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); - Map mapRet = new HashMap<>(); - mapRet.put("code",0); - Map 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 address(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti) { + ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); + Map mapRet = new HashMap<>(); + mapRet.put("code", 0); + Map 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 complete(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti,HttpServletRequest request, HttpServletResponse response) { + public Map complete(@PathVariable("fileId") String fileId, @RequestBody WpsUploadEnti wpsUploadEnti, HttpServletRequest request, HttpServletResponse response) { ZyInfoStudent zyInfoStudent = zyInfoStudentService.getById(fileId); - Map mapRet = new HashMap<>(); - mapRet.put("code",0); + Map 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; }