123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- package com.webchat.admin.controller;
- import com.webchat.admin.service.AccountManagementService;
- import com.webchat.common.bean.APIPageResponseBean;
- import com.webchat.common.bean.APIResponseBean;
- import com.webchat.common.bean.APIResponseBeanUtil;
- import com.webchat.common.helper.SessionHelper;
- import com.webchat.domain.vo.request.CreatePublicAccountRequestVO;
- import com.webchat.domain.vo.request.CreateRobotRequestVO;
- import com.webchat.domain.vo.response.UserBaseResponseInfoVO;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.PostMapping;
- import org.springframework.web.bind.annotation.RequestBody;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import java.util.List;
- @RestController
- @RequestMapping("/admin-service/account")
- public class AccountManagementController {
- @Autowired
- private AccountManagementService accountManagementService;
- /**
- * 账号分页查询
- *
- * @param roleCode
- * @param userId
- * @param userName
- * @param mobile
- * @param pageNo
- * @param pageSize
- * @return
- */
- @GetMapping("/page")
- public APIPageResponseBean<UserBaseResponseInfoVO> page(
- @RequestParam(value = "roleCode") Integer roleCode,
- @RequestParam(value = "userId", required = false) String userId,
- @RequestParam(value = "userName", required = false) String userName,
- @RequestParam(value = "mobile", required = false) String mobile,
- @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
- @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
- return accountManagementService.page(userId, roleCode, userName, mobile, pageNo, pageSize);
- }
- /**
- * 账号搜索
- *
- * @param query
- * @param size
- * @return
- */
- @GetMapping("/suggest")
- public APIResponseBean<List<UserBaseResponseInfoVO>> suggest(
- @RequestParam(value = "q", required = false) String query,
- @RequestParam(value = "size", required = false, defaultValue = "10") Integer size) {
- return APIResponseBeanUtil.success(null);
- }
- /**
- * 创建机器人
- *
- * @return
- */
- @PostMapping("/createRobot")
- public APIResponseBean createRobot(@RequestBody CreateRobotRequestVO requestPram) {
- String userId = SessionHelper.getCurrentUserId();
- requestPram.setCreateUserId(userId);
- accountManagementService.createRobot(requestPram);
- return APIResponseBeanUtil.success("机器人创建成功");
- }
- /**
- * 创建公众号
- * 默认只有管理员可以创建公众号
- *
- * @return
- */
- @PostMapping("/createPublicAccount")
- public APIResponseBean createPublicAccount(@RequestBody CreatePublicAccountRequestVO requestPram) {
- String userId = SessionHelper.getCurrentUserId();
- requestPram.setCreateUserId(userId);
- accountManagementService.createPublicAccount(requestPram);
- return APIResponseBeanUtil.success("公众号创建成功");
- }
- }
|