jiangping
2024-07-16 1be9f9fdb13f7c5cdcf29494cb72ced35cd7af10
server/web/src/main/java/com/doumee/api/web/PersonnelApi.java
@@ -1,21 +1,32 @@
package com.doumee.api.web;
import com.doumee.biz.zbom.ZbomCRMService;
import com.doumee.config.annotation.LoginRequired;
import com.doumee.config.annotation.UserLoginRequired;
import com.doumee.core.annotation.trace.Trace;
import com.doumee.core.model.ApiResponse;
import com.doumee.core.model.PageData;
import com.doumee.core.model.PageWrap;
import com.doumee.dao.business.model.Shop;
import com.doumee.dao.business.model.SmsEmail;
import com.doumee.dao.web.reqeust.EditMemberRequest;
import com.doumee.dao.web.reqeust.EditShopDTO;
import com.doumee.dao.web.reqeust.EditUsersRequest;
import com.doumee.dao.web.reqeust.ContentShareImgDto;
import com.doumee.dao.web.response.AccountResponse;
import com.doumee.service.business.MemberService;
import com.doumee.service.business.ShopService;
import com.doumee.service.business.SmsEmailService;
import com.doumee.service.business.UsersService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * Created by IntelliJ IDEA.
@@ -23,7 +34,7 @@
 * @Author : Rk
 * @create 2024/7/10 18:06
 */
@Api(tags = "员工端小程序用户业务")
@Api(tags = "【B端小程序】用户业务")
@Trace(exclude = true)
@RestController
@RequestMapping("/web/personnel")
@@ -33,6 +44,11 @@
    @Autowired
    public UsersService usersService;
    @Autowired
    public SmsEmailService smsEmailService;
    @Autowired
    public ShopService shopService;
    @ApiOperation(value = "小程序登陆", notes = "员工端小程序")
    @GetMapping("/loginByWx")
@@ -42,6 +58,19 @@
    public ApiResponse<AccountResponse> loginByWx(@RequestParam String code) {
        return  ApiResponse.success(usersService.wxLogin(code));
    }
    @ApiOperation(value = "发送短信验证码", notes = "员工端小程序")
    @GetMapping("/sendSms")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "手机号", required = true),
    })
    public ApiResponse sendSms(@RequestParam String phone) {
        SmsEmail smsEmail = new SmsEmail();
        smsEmail.setPhone(phone);
        smsEmailService.sendSms(smsEmail);
        return  ApiResponse.success("发送成功");
    }
    @ApiOperation(value = "手机号验证码登陆", notes = "员工端小程序")
@@ -59,6 +88,7 @@
    @ApiOperation(value = "绑定openid", notes = "员工端小程序")
    @GetMapping("/bindingOpenid")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true),
    })
    public ApiResponse bindingOpenid(@RequestParam String code) {
@@ -66,4 +96,73 @@
        return  ApiResponse.success("操作成功");
    }
    @UserLoginRequired
    @ApiOperation(value = "获取个人信息详情", notes = "员工端小程序")
    @GetMapping("/getUserDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse getUserDetail() {
        usersService.usersDetail(getMemberId());
        return  ApiResponse.success("操作成功");
    }
    @UserLoginRequired
    @ApiOperation(value = "更新个人信息", notes = "员工端小程序")
    @PostMapping("/editUsers")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse editUsers(@RequestBody EditUsersRequest editUsersRequest) {
        editUsersRequest.setUserId(getMemberId());
        usersService.editUserInfo(editUsersRequest);
        return  ApiResponse.success("更新成功");
    }
    @UserLoginRequired
    @ApiOperation(value = "门店分页", notes = "员工端小程序")
    @PostMapping("/shopPage")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse<PageData<Shop>> shopPage (@RequestBody PageWrap<Shop> pageWrap) {
        return ApiResponse.success(shopService.findPage(pageWrap));
    }
    @UserLoginRequired
    @ApiOperation(value = "门店详情", notes = "员工端小程序")
    @GetMapping("/shopDetail")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true),
            @ApiImplicitParam(paramType = "query", dataType = "Long", name = "shopId", value = "门店主键", required = true)
    })
    public ApiResponse<Shop> shopDetail (@RequestParam Long shopId) {
        return ApiResponse.success(shopService.shopDetail(shopId,null));
    }
    @UserLoginRequired
    @ApiOperation(value = "修改门店信息", notes = "员工端小程序")
    @GetMapping("/updShop")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true)
    })
    public ApiResponse updShop(@RequestBody EditShopDTO editShopDTO) {
        shopService.updShop(editShopDTO);
        return ApiResponse.success("操作成功");
    }
    @ApiOperation(value = "获取个人名片", notes = "员工端小程序")
    @PostMapping("/getUserCard")
    public ApiResponse<String> getUserCard() {
        return  ApiResponse.success(usersService.getUserCard(this.getLoginUserInfo()));
    }
    @ApiOperation(value = "获取内容分享海报", notes = "获取内容分享海报,加小程序码")
    @PostMapping("/getContentShareImg")
    public ApiResponse<String> getContentShareImg(@RequestBody ContentShareImgDto param) {
        return  ApiResponse.success(usersService.getContentShareImg(this.getLoginUserInfo(),param));
    }
}