|
@@ -0,0 +1,255 @@
|
|
|
+package com.gree.mall.contest.controller.pc.member;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.gree.mall.contest.bean.user.UserApplyBean;
|
|
|
+import com.gree.mall.contest.bean.user.UserWxBean;
|
|
|
+import com.gree.mall.contest.exception.RemoteServiceException;
|
|
|
+import com.gree.mall.contest.helper.ResponseHelper;
|
|
|
+import com.gree.mall.contest.logic.user.UserLogic;
|
|
|
+import com.gree.mall.contest.plus.entity.*;
|
|
|
+import com.gree.mall.contest.utils.CommonUtils;
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.IOException;
|
|
|
+
|
|
|
+@Slf4j
|
|
|
+@RestController
|
|
|
+@Tag(name = "会员管理", description = "会员管理")
|
|
|
+@RequestMapping(value = "/member", produces = "application/json; charset=utf-8")
|
|
|
+@RequiredArgsConstructor
|
|
|
+public class MemberController {
|
|
|
+
|
|
|
+ private final UserLogic userLogic;
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/list/page")
|
|
|
+ @Operation(description = "会员列表")
|
|
|
+ public ResponseHelper<Page<User>> page(HttpServletRequest request,
|
|
|
+ @Parameter(description = "名称/电话") @RequestParam(required = false) String keyword,
|
|
|
+ @Parameter(description = "用户角色,GENERAL=普通用户 SERVICE=业务员") @RequestParam(required = false) String type,
|
|
|
+ @Parameter(description = "是否为团长(true=是 false=否)") @RequestParam(required = false) Boolean promotionGroupLeader,
|
|
|
+ @Parameter(description = "是否为内部人员(true=是 false=否)") @RequestParam(required = false) Boolean innerr,
|
|
|
+ @Parameter(description = "网点id", required = false) @RequestParam(required = false) String websitId,
|
|
|
+ @Parameter(description = "是否有优惠码权限") @RequestParam(required = false) Boolean isExchangeCode,
|
|
|
+ @Parameter(description = "注册开始时间") @RequestParam(required = false) String startTime,
|
|
|
+ @Parameter(description = "注册结束时间") @RequestParam(required = false) String endTime,
|
|
|
+ @Parameter(description = "排序json格式[{sortColumn: 'ID', type: true },...] " +
|
|
|
+ "sortColumn:会员排序对应值 ID=编号 SEX=性别 CREATE=注册时间 STATUS=状态, " +
|
|
|
+ "type: true=升序 false=倒序")
|
|
|
+ @RequestParam(required = false) String sortJson,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ IPage<User> page = userLogic.page(request,keyword, type,promotionGroupLeader,innerr, startTime, endTime, sortJson,websitId,isExchangeCode, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/apply/page")
|
|
|
+ @Operation(description = "业务员申请列表")
|
|
|
+ public ResponseHelper<Page<UserApplyBean>> applyPage(HttpServletRequest request,
|
|
|
+ @Parameter(description = "名称/电话") @RequestParam(required = false) String keyword,
|
|
|
+ @Parameter(description = "状态 WAIT待审核 OK通过 FAIL拒绝") @RequestParam(required = false) String status,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ IPage<UserApplyBean> page = userLogic.applyPage(request, keyword, status, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(page);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/export")
|
|
|
+ @Operation(description = "会员导出")
|
|
|
+ public void export(HttpServletRequest request, HttpServletResponse response,
|
|
|
+ @Parameter(description = "名称/电话") @RequestParam(required = false) String keyword,
|
|
|
+ @Parameter(description = "用户角色,GENERAL=普通用户 SERVICE=业务员") @RequestParam(required = false) String type,
|
|
|
+ @Parameter(description = "是否为团长(true=是 false=否)") @RequestParam(required = false) Boolean promotionGroupLeader,
|
|
|
+ @Parameter(description = "是否为内部人员(true=是 false=否)") @RequestParam(required = false) Boolean innerr,
|
|
|
+ @Parameter(description = "网点id", required = false) @RequestParam(required = false) String websitId,
|
|
|
+ @Parameter(description = "注册开始时间") @RequestParam(required = false) String startTime,
|
|
|
+ @Parameter(description = "注册结束时间") @RequestParam(required = false) String endTime
|
|
|
+ ) throws Exception {
|
|
|
+ userLogic.export(request, response, keyword, type,websitId, startTime, endTime);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/update")
|
|
|
+ @Operation(description = "修改会员")
|
|
|
+ public ResponseHelper update(
|
|
|
+ @Parameter(description = "object", required = true) @RequestBody User user)
|
|
|
+ throws RemoteServiceException {
|
|
|
+ userLogic.update(user);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/updateUserInnerStatus")
|
|
|
+ @Operation(description = "修改会员内部人员状态")
|
|
|
+ public ResponseHelper updateUserInnerStatus(
|
|
|
+ @Parameter(description = "用户id", required = true) @RequestParam String userId,
|
|
|
+ @Parameter(description = "true:内部人员,false:非内部人员", required = true) @RequestParam Boolean inner)
|
|
|
+ throws RemoteServiceException {
|
|
|
+ userLogic.updateUserInnerStatus(userId, inner);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/change/service/user")
|
|
|
+ @Operation(description = "修改会员业务人员状态")
|
|
|
+ public ResponseHelper changeServiceUser(
|
|
|
+ @Parameter(description = "用户id", required = true) @RequestParam String userId,
|
|
|
+ @Parameter(description = "网点编号") @RequestParam(required = false) String websitId,
|
|
|
+ @Parameter(description = "网点名称") @RequestParam(required = false) String websitName,
|
|
|
+ @Parameter(description = "账号") @RequestParam(required = false) String workUserId,
|
|
|
+ @Parameter(description = "姓名") @RequestParam(required = false) String workName,
|
|
|
+ @Parameter(description = "职位") @RequestParam(required = false) String position,
|
|
|
+ @Parameter(description = "联系电话") @RequestParam(required = false) String mobile,
|
|
|
+ @Parameter(description = "true:业务员,false:非业务员", required = true) @RequestParam Boolean isService)
|
|
|
+ throws RemoteServiceException {
|
|
|
+ userLogic.changeServiceUser(userId, websitId, websitName, workUserId, workName, position, mobile, isService);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/downLoadUserInnerTimplate")
|
|
|
+ @Operation(description = "内部人员批量设置模板")
|
|
|
+ public ResponseHelper downLoadUserInnerTimplate(HttpServletResponse response)
|
|
|
+ throws RemoteServiceException, IOException {
|
|
|
+ CommonUtils.downloadFile("/static/用户批量设置内部人员模板.xlsx",response);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/localUpdateInner")
|
|
|
+ @Operation(description = "/导入跟新内部人员状态")
|
|
|
+ public ResponseHelper<Void> localUpdateInner(
|
|
|
+ HttpServletRequest request,
|
|
|
+ @RequestParam("file") MultipartFile file
|
|
|
+ ) throws Exception {
|
|
|
+ userLogic.localUpdateInner(request, file);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/groupleader")
|
|
|
+ @Operation(description = "设置/取消团长")
|
|
|
+ public ResponseHelper groupleader(
|
|
|
+ @Parameter(description = "用户id", required = true) @RequestParam String userId,
|
|
|
+ @Parameter(description = "true=设置 false=取消", required = true) @RequestParam Boolean promotionGroupLeader
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ userLogic.groupleader(userId,promotionGroupLeader);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/status/update")
|
|
|
+ @Operation(description = "更改会员状态")
|
|
|
+ public ResponseHelper change(
|
|
|
+ @Parameter(description = "会员id", required = true) @RequestParam String userId,
|
|
|
+ @Parameter(description = "状态:false=正常 true=禁用", required = true) @RequestParam Boolean status
|
|
|
+ ) {
|
|
|
+ userLogic.updateState(userId, status);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @GetMapping("/detail")
|
|
|
+ @Operation(description = "用户详情")
|
|
|
+ public ResponseHelper<UserWxBean> detail(
|
|
|
+ @Parameter(description = "会员id", required = true) @RequestParam String userId
|
|
|
+ ) {
|
|
|
+ UserWxBean detail = userLogic.detail(userId);
|
|
|
+ return ResponseHelper.success(detail);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/updateNickName")
|
|
|
+ @Operation(description = "修改会员昵称")
|
|
|
+ public ResponseHelper<Void> updateNickName(
|
|
|
+ @Parameter(description = "用户id",required = true)@RequestParam String userId,
|
|
|
+ @Parameter(description = "新昵称",required = true)@RequestParam String newNickName
|
|
|
+ ){
|
|
|
+ userLogic.updateUserNickName(userId,newNickName);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/address")
|
|
|
+ @Operation(description = "会员地址")
|
|
|
+ public ResponseHelper<IPage<UserAddress>> addressList(
|
|
|
+ @Parameter(required = true, description = "用户id") @RequestParam(required = true) String userId,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) {
|
|
|
+ IPage<UserAddress> userAddressIPage = userLogic.addressList(userId, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(userAddressIPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/favorite")
|
|
|
+ @Operation(description = "收藏记录")
|
|
|
+ public ResponseHelper<IPage<Goods>> favoriteList(
|
|
|
+ @Parameter(required = true, description = "用户id") @RequestParam(required = true) String userId,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) {
|
|
|
+ IPage<Goods> goodsFavoriteIPage = userLogic.goodsFavoriteList(userId, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(goodsFavoriteIPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/goods/visit")
|
|
|
+ @Operation(description = "我的浏览记录")
|
|
|
+ public ResponseHelper<IPage<GoodsVisit>> goodsVisitList(
|
|
|
+ @Parameter(required = true, description = "用户id") @RequestParam(required = true) String userId,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) {
|
|
|
+ IPage<GoodsVisit> goodsVisitIPage = userLogic.goodsVisitList(userId, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(goodsVisitIPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @GetMapping("/coupon")
|
|
|
+ @Operation(description = "我的优惠券")
|
|
|
+ public ResponseHelper<IPage<UserCoupon>> couponList(
|
|
|
+ @Parameter(required = true, description = "用户id") @RequestParam(required = true) String userId,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) {
|
|
|
+ IPage<UserCoupon> userCouponIPage = userLogic.couponList(userId, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(userCouponIPage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/examine/apply")
|
|
|
+ @Operation(description = "审核申请业务员")
|
|
|
+ public ResponseHelper examineApply(
|
|
|
+ @Parameter(description = "id", required = true) @RequestParam String id,
|
|
|
+ @Parameter(description = "网点编号") @RequestParam(required = false) String websitId,
|
|
|
+ @Parameter(description = "网点名称") @RequestParam(required = false) String websitName,
|
|
|
+ @Parameter(description = "账号", required = true) @RequestParam String workUserId,
|
|
|
+ @Parameter(description = "姓名", required = true) @RequestParam String workName,
|
|
|
+ @Parameter(description = "职位", required = true) @RequestParam String position,
|
|
|
+ @Parameter(description = "手机号", required = true) @RequestParam String mobile,
|
|
|
+ @Parameter(description = "true:通过,false:拒绝", required = true) @RequestParam Boolean isOK)
|
|
|
+ throws RemoteServiceException {
|
|
|
+ userLogic.examineApply(id, websitId, websitName, workUserId, workName, position, mobile, isOK);
|
|
|
+ return ResponseHelper.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @PostMapping("/import/member/list")
|
|
|
+ @Operation(description = "导入业务员列表")
|
|
|
+ public ResponseHelper<IPage<UserServiceWait>> importMemberList(
|
|
|
+ @Parameter(description = "网点编号") @RequestParam(required = false) String websitId,
|
|
|
+ @Parameter(description = "网点名称") @RequestParam(required = false) String websitName,
|
|
|
+ @Parameter(description = "账号") @RequestParam(required = false) String workUserId,
|
|
|
+ @Parameter(description = "姓名") @RequestParam(required = false) String workName,
|
|
|
+ @Parameter(description = "职位") @RequestParam(required = false) String position,
|
|
|
+ @Parameter(description = "手机号") @RequestParam(required = false) String mobile,
|
|
|
+ @Parameter(description = "页号", required = true) @RequestParam Integer pageNum,
|
|
|
+ @Parameter(description = "页大小", required = true) @RequestParam Integer pageSize
|
|
|
+ ) throws RemoteServiceException {
|
|
|
+ IPage<UserServiceWait> waitIPage = userLogic.importMemberList(websitId, websitName, workUserId, workName, position, mobile, pageNum, pageSize);
|
|
|
+ return ResponseHelper.success(waitIPage);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|