GoldenGoodsVideoController.java 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.crm.custom.controller;
  2. import com.crm.custom.service.GoldenGoodsVideoService;
  3. import com.crm.rely.backend.core.constant.Constants;
  4. import com.crm.rely.backend.core.constant.FeignClientAnnotation;
  5. import com.crm.rely.backend.core.dto.base.BaseResultDto;
  6. import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
  7. import com.crm.rely.backend.core.entity.base.SingleLongEntity;
  8. import com.crm.rely.backend.model.dto.golden.goods.GoldenGoodsVideoListDto;
  9. import com.crm.rely.backend.model.entity.custom.info.CustomInfoEntity;
  10. import com.crm.rely.backend.model.entity.golden.goods.GoldenGoodsVideoAddEntity;
  11. import com.crm.rely.backend.model.entity.golden.goods.GoldenGoodsVideoDeleteEntitys;
  12. import com.crm.rely.backend.model.entity.golden.goods.GoldenGoodsVideoSearchEntity;
  13. import com.crm.rely.backend.model.entity.golden.goods.GoldenGoodsVideoUpdateEntity;
  14. import org.springframework.beans.factory.annotation.Autowired;
  15. import org.springframework.validation.annotation.Validated;
  16. import org.springframework.web.bind.annotation.*;
  17. import org.springframework.web.multipart.MultipartFile;
  18. import javax.servlet.http.HttpServletRequest;
  19. @RestController
  20. @RequestMapping("/goods/video")
  21. public class GoldenGoodsVideoController {
  22. @Autowired
  23. private GoldenGoodsVideoService goldenGoodsVideoService;
  24. @PostMapping("/search/list")
  25. public ResultWithPagerDto<GoldenGoodsVideoListDto> customPageList(@RequestBody GoldenGoodsVideoSearchEntity entity, CustomInfoEntity infoEntity) throws Exception {
  26. return goldenGoodsVideoService.customPageList(entity, infoEntity);
  27. }
  28. @PostMapping("/manager/add")
  29. @FeignClientAnnotation
  30. public BaseResultDto add(@RequestBody @Validated GoldenGoodsVideoAddEntity entity) throws Exception {
  31. goldenGoodsVideoService.add(entity);
  32. return BaseResultDto.success();
  33. }
  34. @PostMapping("/manager/delete")
  35. @FeignClientAnnotation
  36. public BaseResultDto delete(@RequestBody @Validated GoldenGoodsVideoDeleteEntitys entitys) throws Exception {
  37. goldenGoodsVideoService.delete(entitys);
  38. return BaseResultDto.success();
  39. }
  40. @PostMapping("/manager/update")
  41. @FeignClientAnnotation
  42. public BaseResultDto update(@RequestBody @Validated GoldenGoodsVideoUpdateEntity entity) throws Exception {
  43. goldenGoodsVideoService.update(entity);
  44. return BaseResultDto.success();
  45. }
  46. @PostMapping("/manager/search/list")
  47. @FeignClientAnnotation
  48. public ResultWithPagerDto<GoldenGoodsVideoListDto> pageList(@RequestBody GoldenGoodsVideoSearchEntity entity) throws Exception {
  49. return goldenGoodsVideoService.searchPageList(entity);
  50. }
  51. @PostMapping("/manager/search/single")
  52. @FeignClientAnnotation
  53. public BaseResultDto searchSingle(@RequestBody @Validated SingleLongEntity entity) throws Exception {
  54. return BaseResultDto.success(goldenGoodsVideoService.searchSingle(entity));
  55. }
  56. @PostMapping("/manager/upload/{goodsId}")
  57. @FeignClientAnnotation
  58. public BaseResultDto managerUpload(@RequestParam(value = "file", required = false) MultipartFile file,
  59. @PathVariable("goodsId") Long goodsId, HttpServletRequest req) throws Exception {
  60. //goldenGoodsVideoService.validatedVideo(file);
  61. String path = goldenGoodsVideoService.uploadFile(goodsId, file);
  62. return BaseResultDto.success(Constants.UPLOAD_SUCCESS, path);
  63. }
  64. }