123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- package com.hssx.cloudmodel.controller;
- import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
- import com.hssx.cloudmodel.entity.MouldFile;
- import com.hssx.cloudmodel.entity.ProjectFile;
- import com.hssx.cloudmodel.entity.User;
- import com.hssx.cloudmodel.entity.vo.UserVO;
- import com.hssx.cloudmodel.service.MouldFileService;
- import com.hssx.cloudmodel.service.MouldService;
- import com.hssx.cloudmodel.service.UserService;
- import com.hssx.cloudmodel.util.HttpRespMsg;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.ResponseBody;
- import org.springframework.web.bind.annotation.RestController;
- import org.springframework.web.multipart.MultipartFile;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author 吴涛涛
- * @since 2019-08-07
- */
- @RestController
- @RequestMapping("/mouldfile")
- public class MouldFileController {
- @Value("${upload.path}")
- private String path;
- @Autowired
- private MouldFileService mouldFileService;
- @Autowired
- private UserService userService;
- /**
- * 模具文档的上传
- * 参数: token 用户身份凭证,
- * mouldId 模具id ,
- * blongType 文档类型(0-模具文档 1-零件文档 2-试模验收 2-保养方案 3-模具更新 4-模具报废),
- * file 文件信息
- *
- * @return
- */
- @ApiOperation("模具文档的上传")
- @RequestMapping("/uploadFile")
- @ResponseBody
- public HttpRespMsg uploadFile(@RequestParam(required = false) MultipartFile file,@RequestParam(required = false, defaultValue = "0") Integer blongType,
- HttpServletResponse response, HttpServletRequest request, UserVO userVO) throws Exception {
- System.out.println("开始上传文件" + "file+" + file.getOriginalFilename());
- HttpRespMsg msg = new HttpRespMsg();
- msg = mouldFileService.addFile(userVO,blongType, file,path);
- return msg;
- }
- @ApiOperation("模具文档的审核")
- @RequestMapping("/check")
- @ResponseBody
- public HttpRespMsg check(@RequestParam Integer mouldFileId,@RequestParam Integer isPass,
- HttpServletResponse response, HttpServletRequest request, UserVO userVO) throws Exception {
- HttpRespMsg msg = new HttpRespMsg();
- msg = mouldFileService.check(mouldFileId,isPass, userVO);
- return msg;
- }
- /**
- * 模具文档的列表
- * 参数: token 用户身份凭证,mouldId 模具id, type文档类型:0-模具文档,1-零件文档
- *
- * @return
- */
- @ApiOperation("模具文档的列表")
- @RequestMapping("/list")
- @ResponseBody
- public HttpRespMsg list(@RequestParam Integer mouldId, @RequestParam Integer blongType, UserVO userVO){
- HttpRespMsg msg = mouldFileService.getFileList(mouldId,blongType, userVO);
- return msg;
- }
- /**
- * 模具文档的列表
- * 参数: token 用户身份凭证,mouldId 模具id, type文档类型:0-模具文档,1-零件文档
- *
- * @return
- */
- @ApiOperation("模具所有类型的文档列表")
- @RequestMapping("/allList")
- @ResponseBody
- public HttpRespMsg allList(@RequestParam Integer mouldId, UserVO userVO){
- HttpRespMsg msg = mouldFileService.getAllFileList(mouldId,userVO);
- return msg;
- }
- /**
- * 项目文档的下载
- * 参数: token 用户身份凭证,id 项目id
- *
- * @return
- */
- @ApiOperation("模具所有类型文档的下载")
- @RequestMapping("/dowloadFile")
- @ResponseBody
- public HttpRespMsg dowloadFile(MouldFile mouldFile, String token){
- HttpRespMsg msg = mouldFileService.dowloadFile(mouldFile,token);
- return msg;
- }
- }
|