|  |  |  | 
|---|
|  |  |  | package com.doumee.api.web; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.doumee.biz.system.SystemDictDataBiz; | 
|---|
|  |  |  | import com.doumee.biz.zbom.ZbomCRMService; | 
|---|
|  |  |  | import com.doumee.biz.zbom.model.crm.CrmCustomerListRequest; | 
|---|
|  |  |  | import com.doumee.biz.zbom.model.crm.response.CRMBaseResponse; | 
|---|
|  |  |  | import com.doumee.biz.zbom.model.crm.response.CRMCustomerListResponse; | 
|---|
|  |  |  | import com.doumee.biz.zbom.model.zhongtai.*; | 
|---|
|  |  |  | import com.doumee.biz.zbom.model.zhongtai.response.*; | 
|---|
|  |  |  | 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.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Shop; | 
|---|
|  |  |  | import com.doumee.dao.business.model.SmsEmail; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.ContentShareImgDto; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Users; | 
|---|
|  |  |  | import com.doumee.dao.system.model.SystemDictData; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.*; | 
|---|
|  |  |  | import com.doumee.dao.web.response.AccountResponse; | 
|---|
|  |  |  | import com.doumee.service.business.MemberService; | 
|---|
|  |  |  | import com.doumee.service.business.SmsEmailService; | 
|---|
|  |  |  | import com.doumee.service.business.UsersService; | 
|---|
|  |  |  | import com.doumee.service.business.*; | 
|---|
|  |  |  | import com.doumee.service.system.SystemDictDataService; | 
|---|
|  |  |  | 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.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.validation.Valid; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Objects; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * Created by IntelliJ IDEA. | 
|---|
|  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | public SmsEmailService smsEmailService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | public ShopService shopService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | public GetCrmDataService getCrmDataService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private GetZhongTaiDataService getZhongTaiDataService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "小程序登陆", notes = "员工端小程序") | 
|---|
|  |  |  | @GetMapping("/loginByWx") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse<AccountResponse> loginByWx(@RequestParam String code) { | 
|---|
|  |  |  | return  ApiResponse.success(usersService.wxLogin(code)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "发送短信验证码", notes = "员工端小程序") | 
|---|
|  |  |  | @GetMapping("/sendSms") | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "手机号验证码登陆", notes = "员工端小程序") | 
|---|
|  |  |  | @GetMapping("/loginByPhone") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "phone", value = "手机号", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "短信验证码", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "openid", value = "openid", required = false), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<AccountResponse> loginByPhone(@RequestParam String phone,@RequestParam String code) { | 
|---|
|  |  |  | return  ApiResponse.success(usersService.phoneLogin(phone,code)); | 
|---|
|  |  |  | public ApiResponse<AccountResponse> loginByPhone(@RequestParam String phone,@RequestParam String code,String openid) { | 
|---|
|  |  |  | return  ApiResponse.success(usersService.phoneLogin(phone,code,openid)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "绑定openid", notes = "员工端小程序") | 
|---|
|  |  |  | @GetMapping("/bindingOpenid") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "code", value = "微信code", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true), | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "openid", value = "openid", required = true), | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse bindingOpenid(@RequestParam String code) { | 
|---|
|  |  |  | usersService.bindingOpenid(code,getMemberId()); | 
|---|
|  |  |  | public ApiResponse bindingOpenid(@RequestParam String openid) { | 
|---|
|  |  |  | usersService.bindingOpenid(openid,getUserId()); | 
|---|
|  |  |  | return  ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation(value = "手机号快捷登录", notes = "员工端小程序") | 
|---|
|  |  |  | @PostMapping("/getWxMiniPhoneLogin") | 
|---|
|  |  |  | public ApiResponse<AccountResponse> getWxMiniPhone(@Valid @RequestBody WxPhoneRequest wxPhoneRequest) { | 
|---|
|  |  |  | return  ApiResponse.success("获取成功",usersService.getWxMiniPhoneLogin(wxPhoneRequest)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "获取个人信息详情", notes = "员工端小程序") | 
|---|
|  |  |  | @GetMapping("/getUserDetail") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<Users> getUserDetail() { | 
|---|
|  |  |  | return  ApiResponse.success("操作成功",usersService.usersDetailById(getUserId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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(getUserId()); | 
|---|
|  |  |  | 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("/userShopList") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<List<Shop>> userShopList () { | 
|---|
|  |  |  | return ApiResponse.success(shopService.getUserShopList(getMemberId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @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 = "员工端小程序") | 
|---|
|  |  |  | @PostMapping("/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("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "获取个人名片", notes = "员工端小程序") | 
|---|
|  |  |  | @PostMapping("/getUserCard") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<String> getUserCard() { | 
|---|
|  |  |  | return  ApiResponse.success(usersService.getUserCard(this.getLoginUserInfo())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private SystemDictDataBiz systemDictDataBiz; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "更新token", notes = "员工端小程序") | 
|---|
|  |  |  | @GetMapping("/updateToken") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse updateToken () { | 
|---|
|  |  |  | systemDictDataBiz.updWxMiniToken(); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "获取内容分享海报", notes = "获取内容分享海报,加小程序码") | 
|---|
|  |  |  | @PostMapping("/getContentShareImg") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<String> getContentShareImg(@RequestBody ContentShareImgDto param) { | 
|---|
|  |  |  | return  ApiResponse.success(usersService.getContentShareImg(this.getLoginUserInfo(),param)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "获取客户/潜客列表", notes = "员工端小程序") | 
|---|
|  |  |  | @PostMapping("/getCustomerList") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<CRMBaseResponse<List<CRMCustomerListResponse>>> getCustomerList(@RequestBody CrmCustomerListRequest crmCustomerListRequest) { | 
|---|
|  |  |  | crmCustomerListRequest.setUserId(getUserId()); | 
|---|
|  |  |  | return  ApiResponse.success(getCrmDataService.getCrmCustomerList(crmCustomerListRequest)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @LoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "批量添加喜欢给客户", notes = "员工端小程序") | 
|---|
|  |  |  | @PostMapping("/batchAddLike") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse batchAddLike(@RequestBody ZTBatchAddListRequest ztBatchAddListRequest) { | 
|---|
|  |  |  | ztBatchAddListRequest.setUserType(getUserType()); | 
|---|
|  |  |  | ztBatchAddListRequest.setUserId(getUserId().toString()); | 
|---|
|  |  |  | getZhongTaiDataService.batchAddLike(ztBatchAddListRequest); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @UserLoginRequired | 
|---|
|  |  |  | @ApiOperation(value = "用户注销", notes = "员工端小程序") | 
|---|
|  |  |  | @PostMapping("/logOff") | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "header", dataType = "String", name = "token", value = "用户token值", required = true) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse logOff() { | 
|---|
|  |  |  | ZTBaseRequst ztBaseRequst = usersService.logOff(getUserId(),getToken()); | 
|---|
|  |  |  | if(Objects.nonNull(ztBaseRequst)){ | 
|---|
|  |  |  | getZhongTaiDataService.userLogout(ztBaseRequst); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|