ShopApi.java 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. package com.caimei.controller;
  2. import com.caimei.model.ResponseJson;
  3. import com.caimei.model.dto.ShopSaveDto;
  4. import com.caimei.model.vo.BrandVo;
  5. import com.caimei.model.vo.CountryVo;
  6. import com.caimei.model.vo.ShopFormVo;
  7. import com.caimei.model.vo.ShopListVo;
  8. import com.caimei.service.ShopService;
  9. import com.github.pagehelper.PageInfo;
  10. import io.swagger.annotations.Api;
  11. import io.swagger.annotations.ApiImplicitParam;
  12. import io.swagger.annotations.ApiImplicitParams;
  13. import io.swagger.annotations.ApiOperation;
  14. import lombok.RequiredArgsConstructor;
  15. import lombok.extern.slf4j.Slf4j;
  16. import org.springframework.web.bind.annotation.*;
  17. import org.springframework.web.multipart.MultipartFile;
  18. import java.util.List;
  19. import java.util.Map;
  20. /**
  21. * 供应商API
  22. *
  23. * @author : Aslee
  24. * @date : 2021/5/11
  25. */
  26. @Api(tags = "供应商API")
  27. @Slf4j
  28. @RestController
  29. @RequiredArgsConstructor
  30. @RequestMapping("/shop")
  31. public class ShopApi {
  32. private final ShopService shopService;
  33. /**
  34. * 供应商列表
  35. */
  36. @ApiOperation("供应商列表")
  37. @ApiImplicitParams({
  38. @ApiImplicitParam(name = "shopName", required = false, value = "供应商名称"),
  39. @ApiImplicitParam(name = "shopType", required = false, value = "供应商类型:1品牌方,2代理商"),
  40. @ApiImplicitParam(name = "brandId", required = false, value = "所属品牌id"),
  41. @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
  42. @ApiImplicitParam(name = "linkMan", required = false, value = "联系人"),
  43. @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
  44. @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
  45. })
  46. @GetMapping("/list")
  47. public ResponseJson<PageInfo<ShopListVo>> getShopList(String shopName, Integer shopType, Integer brandId, String mobile, String linkMan,
  48. @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
  49. @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
  50. return shopService.getShopList(shopName, shopType, brandId, mobile, linkMan, pageNum, pageSize);
  51. }
  52. /**
  53. * 获取供应商表单数据
  54. *
  55. * @param authUserId 供应商用户id
  56. * @return ShopVo
  57. */
  58. @ApiOperation("供应商表单数据")
  59. @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id")
  60. @GetMapping("/form/data")
  61. public ResponseJson<ShopFormVo> getShopFormData(Integer authUserId) {
  62. return shopService.getShopFormData(authUserId);
  63. }
  64. /**
  65. * 添加供应商
  66. * @param shopSaveDto {
  67. * shopType 供应商类型:1代理商,2品牌方
  68. * brandId 品牌id
  69. * shopName 供应商名称
  70. * mobile 手机号
  71. * linkMan 联系人
  72. * countryId 产地国家id
  73. * brandAuthLogo 品牌授权logo
  74. * shopStatus 供应商状态:0停用 1启用
  75. * securityLink 官网认证链接
  76. * statementType 代理声明类型:1弹窗 2链接 3图片 4文件(.doc .ppt .pdf)
  77. * statementContent 声明弹窗内容
  78. * statementLink 声明链接
  79. * statementImage 声明图片
  80. * statementFileId 声明文件id
  81. * createBy 创建人用户id
  82. * }
  83. */
  84. @ApiOperation("添加/编辑供应商")
  85. @PostMapping("/save")
  86. public ResponseJson saveShop(@RequestBody ShopSaveDto shopSaveDto) {
  87. return shopService.saveShop(shopSaveDto);
  88. }
  89. /**
  90. * 更新供应商状态
  91. */
  92. @ApiOperation("更新供应商状态")
  93. @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id;status:供应商状态:0停用 1启用", required = true)
  94. @PostMapping("/update/status")
  95. public ResponseJson updateShopStatus(@RequestBody Map<String,Integer> params) {
  96. Integer authUserId = params.get("authUserId");
  97. Integer status = params.get("status");
  98. return shopService.updateShopStatus(authUserId, status);
  99. }
  100. /**
  101. * 重置密码
  102. */
  103. @ApiOperation("重置密码")
  104. @ApiImplicitParam(name = "params", value = "authUserId:供应商用户id", required = true)
  105. @PostMapping("/reset/password")
  106. public ResponseJson resetShopPassword(@RequestBody Map<String,Integer> params) {
  107. Integer authUserId = params.get("authUserId");
  108. return shopService.resetShopPassword(authUserId);
  109. }
  110. /**
  111. * 代理声明文件上传
  112. *
  113. * @param authUserId:供应商用户id
  114. * @param file:代理声明文件
  115. * @return
  116. */
  117. @ApiOperation("代理声明文件上传")
  118. @ApiImplicitParams({
  119. @ApiImplicitParam(name = "authUserId", required = false, value = "供应商用户id"),
  120. @ApiImplicitParam(name = "file", required = false, value = "代理声明文件"),
  121. })
  122. @PostMapping("/upload/file")
  123. public ResponseJson<Integer> uploadFile(Integer authUserId, MultipartFile file) {
  124. return shopService.uploadFile(authUserId, file);
  125. }
  126. /**
  127. * 品牌列表
  128. * @param type 1品牌方品牌列表,2代理商品牌列表
  129. * @return AuthVo
  130. */
  131. @ApiOperation("品牌列表")
  132. @ApiImplicitParam(name = "type", value = "1品牌方品牌列表,2代理商品牌列表", required = true)
  133. @GetMapping("/brand/list")
  134. public ResponseJson<List<BrandVo>> getBrandList(Integer type){
  135. return shopService.getBrandList(type);
  136. }
  137. /**
  138. * 产地国家列表
  139. */
  140. @ApiOperation("产地国家列表")
  141. @GetMapping("/country/list")
  142. public ResponseJson<List<CountryVo>> getCountryList(){
  143. return shopService.getCountryList();
  144. }
  145. }