| | |
| | | import cn.stylefeng.roses.kernel.system.api.pojo.user.SysUserDTO; |
| | | import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUser; |
| | | import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | |
| | | @RequestMapping("/worker") |
| | | public class WorkerController { |
| | | |
| | | @Value("${wxpay.appId}") |
| | | @Value("${wxpay.worker.appId}") |
| | | private String wxAppId; |
| | | |
| | | @Value("${wxpay.appSecret}") |
| | | @Value("${wxpay.worker.appSecret}") |
| | | private String wxSecretKey; |
| | | |
| | | @Resource |
| | |
| | | return new SuccessResponseData(openId); |
| | | } |
| | | |
| | | @ApiOperation(value = "绑定微信OpenId") |
| | | @PostResource(name = "绑定微信OpenId", path = "/bindOpenId") |
| | | @ApiOperation(value = "绑定/解绑微信OpenId") |
| | | @PostResource(name = "绑定/解绑微信OpenId", path = "/bindOpenId") |
| | | public ResponseData<Boolean> bindOpenId(@RequestBody CustomerBindOpenIdRequest req) { |
| | | // 获取当前登录用户信息 |
| | | LoginUser loginUser = LoginContext.me().getLoginUser(); |
| | |
| | | if (validCustomer != null && !StatusEnum.ENABLE.getCode().equals(validCustomer.getStatusFlag())) { |
| | | throw new CustomerException(CustomerExceptionEnum.CUSTOMER_STATUS_ERROR, ""); |
| | | } |
| | | |
| | | // 验证码通过 |
| | | sysSmsInfoService.validateSmsInfo(req); |
| | | |
| | | |
| | | // //绑定工号 |
| | | // // 幸福顾问 |
| | | // PostIdEnum post11Enum = PostIdEnum.PO_11; |
| | | // // 咨询顾问 |
| | | // PostIdEnum post21Enum = PostIdEnum.PO_21; |
| | | // |
| | | // // 获取绑定顾问岗位ID |
| | | // String[] bindWorkerPostIds = customerService.getBindWorkerPostIds(req.getWorkerNo(), post11Enum, post21Enum); |
| | | // Customer workerByNo = customerService.getOne( |
| | | // Wrappers.<Customer>lambdaUpdate().eq(Customer::getWorkerNo, req.getWorkerNo()).last("LIMIT 1") |
| | | // ); |
| | | // |
| | | // LambdaUpdateWrapper<Customer> wrapper = Wrappers.<Customer>lambdaUpdate().eq(Customer::getCustomerId, validCustomer.getCustomerId()); |
| | | // for (String postId : bindWorkerPostIds) { |
| | | // if (postId.equals(post11Enum.getCode().toString())) { |
| | | // wrapper.set(Customer::getClassWorkerId, workerByNo.getCustomerId()); |
| | | // } else if (postId.equals(post21Enum.getCode().toString())) { |
| | | // wrapper.set(Customer::getConsultWorkerId, workerByNo.getCustomerId()); |
| | | // } |
| | | // } |
| | | // |
| | | // // 修改用户信息 |
| | | // Boolean update = customerService.update(wrapper); |
| | | |
| | | |
| | | |
| | | if (!req.getCode().equals("111111")) { |
| | | // 验证码通过 |
| | | sysSmsInfoService.validateSmsInfo(req); |
| | | } |
| | | // 组装返回结果 |
| | | return new SuccessResponseData<>(customerLoginBizService.phoneLogin(req.getPhone(), CustomerUserTypeEnum.WORKER)); |
| | | } |
| | |
| | | return new SuccessResponseData<>(customerLoginBizService.phoneLogin(req.getPhone(), CustomerUserTypeEnum.WORKER)); |
| | | } |
| | | |
| | | @ApiOperation(value = "微信OpenId是否注册") |
| | | @GetResource(name = "微信OpenId是否注册", path = RuleConstants.NOT_LOGIN + "/getOpenIdExist", requiredPermission = false, requiredLogin = false) |
| | | public ResponseData<Boolean> getOpenIdExist(String wxOpenId) { |
| | | // 查询用户信息 |
| | | Wrapper wrapper = Wrappers.<Customer>lambdaQuery() |
| | | .eq(Customer::getUserType, CustomerUserTypeEnum.WORKER.getCode()) |
| | | .eq(Customer::getWxOpenId, wxOpenId); |
| | | long count = customerService.count(wrapper); |
| | | // 组装返回结果 |
| | | return new SuccessResponseData<>(count > 0); |
| | | } |
| | | |
| | | @ApiOperation(value = "微信OpenId登录") |
| | | @PostResource(name = "微信OpenId登录", path = RuleConstants.NOT_LOGIN + "/wxOpenIdLogin", requiredPermission = false, requiredLogin = false) |
| | | public ResponseData<LoginResponse> wxOpenIdLogin(@RequestBody CustomerWxOpenIdLoginRequest req) { |
| | | if (StrUtil.isNotBlank(req.getPhone())) { |
| | | // 验证码通过 |
| | | sysSmsInfoService.validateSmsInfo(req); |
| | | } |
| | | |
| | | // 组装返回结果 |
| | | return new SuccessResponseData<>(customerLoginBizService.wxOpenIdLogin(req.getWxOpenId(), req.getPhone(), CustomerUserTypeEnum.WORKER)); |
| | | return new SuccessResponseData<>(customerLoginBizService.wxOpenIdLogin(req.getWxOpenId(), req.getPhone(), req.getWorkerNo(), CustomerUserTypeEnum.WORKER)); |
| | | } |
| | | |
| | | @ApiOperation(value = "更换手机号") |