|
@@ -0,0 +1,102 @@
|
|
|
+package com.caimei.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.caimei.model.ResponseJson;
|
|
|
+import com.caimei.model.vo.AuthVo;
|
|
|
+import com.caimei.model.vo.ClubUserVo;
|
|
|
+import com.caimei.model.vo.ClubVo;
|
|
|
+import com.caimei.service.AuthClubService;
|
|
|
+import com.caimei.service.AuthService;
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 供应商API
|
|
|
+ *
|
|
|
+ * @author : Aslee
|
|
|
+ * @date : 2021/5/11
|
|
|
+ */
|
|
|
+@Api(tags = "机构API")
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@RequiredArgsConstructor
|
|
|
+@RequestMapping("/club")
|
|
|
+public class AuthClubApi {
|
|
|
+
|
|
|
+ private final AuthClubService authClubService;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("机构列表")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "authUserId", required = true, value = "供应商用户id"),
|
|
|
+ @ApiImplicitParam(name = "clubName", required = false, value = "机构名称"),
|
|
|
+ @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
|
|
|
+ })
|
|
|
+ @GetMapping("/list")
|
|
|
+ public ResponseJson<PageInfo<ClubVo>> getClubList(Integer authUserId, String clubName,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
+ return authClubService.getClubList(authUserId, clubName, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("机构用户列表")
|
|
|
+ @GetMapping("/user/list")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(name = "authId", required = true, value = "机构id"),
|
|
|
+ @ApiImplicitParam(name = "mobile", required = false, value = "手机号"),
|
|
|
+ @ApiImplicitParam(name = "status", required = false, value = "状态:1未绑定,2已绑定,3已过期"),
|
|
|
+ @ApiImplicitParam(name = "pageNum", required = false, value = "第几页"),
|
|
|
+ @ApiImplicitParam(name = "pageSize", required = false, value = "一页多少条")
|
|
|
+ })
|
|
|
+ public ResponseJson<PageInfo<ClubUserVo>> getClubUserList(Integer authId, String mobile, Integer status,
|
|
|
+ @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
|
|
|
+ return authClubService.getClubUserList(authId, mobile, status, pageNum, pageSize);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("生成邀请码")
|
|
|
+ @PostMapping("/user/code/generate")
|
|
|
+ @ApiImplicitParam(name = "params", value = "authId:授权机构id", required = true)
|
|
|
+ public ResponseJson generateCode(@RequestBody String params) {
|
|
|
+ JSONObject paramsMap = JSONObject.parseObject(params);
|
|
|
+ Integer authId = paramsMap.getInteger("authId");
|
|
|
+ if (null == authId) {
|
|
|
+ return ResponseJson.error("参数异常,请输入授权机构id");
|
|
|
+ }
|
|
|
+ return authClubService.generateCode(authId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("解绑邀请码")
|
|
|
+ @PostMapping("/user/code/unbind")
|
|
|
+ @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id", required = true)
|
|
|
+ public ResponseJson unbindCode(@RequestBody String params) {
|
|
|
+ JSONObject paramsMap = JSONObject.parseObject(params);
|
|
|
+ Integer clubUserId = paramsMap.getInteger("clubUserId");
|
|
|
+ if (null == clubUserId) {
|
|
|
+ return ResponseJson.error("参数异常,请输入机构用户id");
|
|
|
+ }
|
|
|
+ return authClubService.unbindCode(clubUserId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("更新邀请码")
|
|
|
+ @PostMapping("/user/code/update")
|
|
|
+ @ApiImplicitParam(name = "params", value = "clubUserId:机构用户id", required = true)
|
|
|
+ public ResponseJson updateCode(@RequestBody String params) {
|
|
|
+ JSONObject paramsMap = JSONObject.parseObject(params);
|
|
|
+ Integer clubUserId = paramsMap.getInteger("clubUserId");
|
|
|
+ if (null == clubUserId) {
|
|
|
+ return ResponseJson.error("参数异常,请输入机构用户id");
|
|
|
+ }
|
|
|
+ return authClubService.updateCode(clubUserId);
|
|
|
+ }
|
|
|
+}
|