MouldFileController.java 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. package com.hssx.cloudmodel.controller;
  2. import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
  3. import com.hssx.cloudmodel.entity.MouldFile;
  4. import com.hssx.cloudmodel.entity.ProjectFile;
  5. import com.hssx.cloudmodel.entity.User;
  6. import com.hssx.cloudmodel.entity.vo.UserVO;
  7. import com.hssx.cloudmodel.service.MouldFileService;
  8. import com.hssx.cloudmodel.service.MouldService;
  9. import com.hssx.cloudmodel.service.UserService;
  10. import com.hssx.cloudmodel.util.HttpRespMsg;
  11. import io.swagger.annotations.ApiOperation;
  12. import org.springframework.beans.factory.annotation.Autowired;
  13. import org.springframework.beans.factory.annotation.Value;
  14. import org.springframework.web.bind.annotation.RequestMapping;
  15. import org.springframework.web.bind.annotation.RequestParam;
  16. import org.springframework.web.bind.annotation.ResponseBody;
  17. import org.springframework.web.bind.annotation.RestController;
  18. import org.springframework.web.multipart.MultipartFile;
  19. import javax.servlet.http.HttpServletRequest;
  20. import javax.servlet.http.HttpServletResponse;
  21. /**
  22. * <p>
  23. * 前端控制器
  24. * </p>
  25. *
  26. * @author 吴涛涛
  27. * @since 2019-08-07
  28. */
  29. @RestController
  30. @RequestMapping("/mouldfile")
  31. public class MouldFileController {
  32. @Value("${upload.path}")
  33. private String path;
  34. @Autowired
  35. private MouldFileService mouldFileService;
  36. @Autowired
  37. private UserService userService;
  38. /**
  39. * 模具文档的上传
  40. * 参数: token 用户身份凭证,
  41. * mouldId 模具id ,
  42. * blongType 文档类型(0-模具文档 1-零件文档 2-试模验收 2-保养方案 3-模具更新 4-模具报废),
  43. * file 文件信息
  44. *
  45. * @return
  46. */
  47. @ApiOperation("模具文档的上传")
  48. @RequestMapping("/uploadFile")
  49. @ResponseBody
  50. public HttpRespMsg uploadFile(@RequestParam(required = false) MultipartFile file,@RequestParam(required = false, defaultValue = "0") Integer blongType,
  51. HttpServletResponse response, HttpServletRequest request, UserVO userVO) throws Exception {
  52. System.out.println("开始上传文件" + "file+" + file.getOriginalFilename());
  53. HttpRespMsg msg = new HttpRespMsg();
  54. msg = mouldFileService.addFile(userVO,blongType, file,path);
  55. return msg;
  56. }
  57. @ApiOperation("模具文档的审核")
  58. @RequestMapping("/check")
  59. @ResponseBody
  60. public HttpRespMsg check(@RequestParam Integer mouldFileId,@RequestParam Integer isPass,
  61. HttpServletResponse response, HttpServletRequest request, UserVO userVO) throws Exception {
  62. HttpRespMsg msg = new HttpRespMsg();
  63. msg = mouldFileService.check(mouldFileId,isPass, userVO);
  64. return msg;
  65. }
  66. /**
  67. * 模具文档的列表
  68. * 参数: token 用户身份凭证,mouldId 模具id, type文档类型:0-模具文档,1-零件文档
  69. *
  70. * @return
  71. */
  72. @ApiOperation("模具文档的列表")
  73. @RequestMapping("/list")
  74. @ResponseBody
  75. public HttpRespMsg list(@RequestParam Integer mouldId, @RequestParam Integer blongType, UserVO userVO){
  76. HttpRespMsg msg = mouldFileService.getFileList(mouldId,blongType, userVO);
  77. return msg;
  78. }
  79. /**
  80. * 模具文档的列表
  81. * 参数: token 用户身份凭证,mouldId 模具id, type文档类型:0-模具文档,1-零件文档
  82. *
  83. * @return
  84. */
  85. @ApiOperation("模具所有类型的文档列表")
  86. @RequestMapping("/allList")
  87. @ResponseBody
  88. public HttpRespMsg allList(@RequestParam Integer mouldId, UserVO userVO){
  89. HttpRespMsg msg = mouldFileService.getAllFileList(mouldId,userVO);
  90. return msg;
  91. }
  92. /**
  93. * 项目文档的下载
  94. * 参数: token 用户身份凭证,id 项目id
  95. *
  96. * @return
  97. */
  98. @ApiOperation("模具所有类型文档的下载")
  99. @RequestMapping("/dowloadFile")
  100. @ResponseBody
  101. public HttpRespMsg dowloadFile(MouldFile mouldFile, String token){
  102. HttpRespMsg msg = mouldFileService.dowloadFile(mouldFile,token);
  103. return msg;
  104. }
  105. }