| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.dsh.account.dto.SelectDto; |
| | | import com.dsh.account.entity.Coach; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.model.AddAppUserVo; |
| | | import com.dsh.account.model.JoinPlayPaiVo; |
| | | import com.dsh.account.model.LoginSMSCodeVo; |
| | | import com.dsh.account.model.LoginWeChatVo; |
| | | import com.dsh.account.entity.TCourseInfoRecord; |
| | | import com.dsh.account.model.*; |
| | | import com.dsh.account.model.query.appUserQuery.QueryAppUser; |
| | | import com.dsh.account.model.vo.QueryAppUserVO; |
| | | import com.dsh.account.service.IVipPaymentService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.service.TCourseInfoRecordService; |
| | | import com.dsh.account.util.PayMoneyUtil; |
| | | import com.dsh.account.util.ResultUtil; |
| | | import com.dsh.account.util.TokenUtil; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.PrintWriter; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | @Autowired |
| | | private TokenUtil tokenUtil; |
| | | |
| | | @Autowired |
| | | private TCourseInfoRecordService courseInfoRecordService; |
| | | |
| | | /** |
| | | * 获取所有用户 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryAppUserList") |
| | | public List<TAppUser> queryAppUserList(@RequestBody AppUserByNameAndPhoneDTO dto){ |
| | | return appUserService.queryAPPUserByNameAndPhone(dto); |
| | | } |
| | | /** |
| | | * 根据用户姓名和电话模糊查询 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryAPPUserByNameAndPhone") |
| | | public List<TAppUser> queryAPPUserByNameAndPhone(@RequestBody AppUserByNameAndPhoneDTO dto){ |
| | | return appUserService.queryAPPUserByNameAndPhone(dto); |
| | | } |
| | | /** |
| | | * 根据用户id获取用户信息 |
| | | * @param appUserId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryAppUser1") |
| | | public TAppUser queryAppUser1(@RequestBody Integer appUserId){ |
| | | TAppUser appUser = appUserService.getById(appUserId); |
| | | return appUser; |
| | | } |
| | | /** |
| | | * 冻结/解冻 1=解冻 2=冻结 |
| | | */ |
| | | @RequestMapping("/base/appUser/changeState") |
| | | public Object changeState(@RequestBody AdvertisementChangeStateDTO dto){ |
| | | return appUserService.changeState(dto); |
| | | } |
| | | /** |
| | | * 后台添加 |
| | | */ |
| | | @RequestMapping("/base/appUser/addAppUser1") |
| | | public Object addAppUser1(@RequestBody TAppUser query){ |
| | | // 修改 |
| | | if (query.getId()!=null){ |
| | | TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", query.getPhone()).ne("id",query.getId())); |
| | | if (null != phone){ |
| | | return 5001; |
| | | } |
| | | } |
| | | query.setIsVip(0); |
| | | query.setPassword("111111"); |
| | | query.setInsertTime(new Date()); |
| | | return appUserService.saveOrUpdate(query); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息列表数据 |
| | | */ |
| | | @RequestMapping("/base/appUser/listAll") |
| | | public List<QueryAppUserVO> listAll(@RequestBody QueryAppUser query){ |
| | | |
| | | return appUserService.listAll(query); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户手机号获取用户id |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/base/appUser/getAppUserByPhone/{phone}") |
| | | public TAppUser getAppUserByPhone(@PathVariable("phone") String phone){ |
| | | TAppUser appUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", phone)); |
| | | return appUser; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/getSMSCode") |
| | |
| | | @ApiImplicitParam(value = "类型(1:登录,2:注册,3:修改密码,4:忘记密码)", name = "type", dataType = "int", required = true), |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil getSMSCode(@RequestBody Integer type, @RequestBody String phone){ |
| | | public ResultUtil getSMSCode(Integer type, String phone){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @ApiOperation(value = "注册用户", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil addAppUser(@RequestBody AddAppUserVo addAppUserVo){ |
| | | public ResultUtil addAppUser(AddAppUserVo addAppUserVo){ |
| | | try { |
| | | return appUserService.addAppUser(addAppUserVo); |
| | | }catch (Exception e){ |
| | |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "登录密码", name = "password", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil<String> loginPassword(@RequestBody String phone, @RequestBody String password){ |
| | | public ResultUtil<String> loginPassword(String phone, String password){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @ApiOperation(value = "短信验证码登录", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<String> loginSMSCode(@RequestBody LoginSMSCodeVo loginSMSCodeVo){ |
| | | public ResultUtil<String> loginSMSCode(LoginSMSCodeVo loginSMSCodeVo){ |
| | | try { |
| | | return appUserService.loginSMSCode(loginSMSCodeVo); |
| | | }catch (Exception e){ |
| | |
| | | @ApiOperation(value = "微信登录", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<String> loginWeChat(@RequestBody LoginWeChatVo loginWeChatVo){ |
| | | public ResultUtil<String> loginWeChat(LoginWeChatVo loginWeChatVo){ |
| | | try { |
| | | return appUserService.loginWechat(loginWeChatVo); |
| | | }catch (Exception e){ |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil updatePassword(@RequestBody String phone, @RequestBody String code, @RequestBody String password){ |
| | | public ResultUtil updatePassword(String phone, String code, String password){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @ApiImplicitParam(value = "短信验证码", name = "code", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "新密码", name = "password", dataType = "string", required = true) |
| | | }) |
| | | public ResultUtil forgetPassword(@RequestBody String phone, @RequestBody String code, @RequestBody String password){ |
| | | public ResultUtil forgetPassword(String phone, String code, String password){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResultUtil.paranErr("phone"); |
| | | } |
| | |
| | | @PostMapping("/api/appUser/queryJoinPlayPai") |
| | | @ApiOperation(value = "获取加入玩湃首页数据", tags = {"APP-加入玩湃"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = true), |
| | | @ApiImplicitParam(value = "经度", name = "lon", dataType = "string", required = false), |
| | | @ApiImplicitParam(value = "纬度", name = "lat", dataType = "string", required = false), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(@RequestBody String lon, @RequestBody String lat){ |
| | | if(ToolUtil.isEmpty(lon)){ |
| | | return ResultUtil.paranErr("lon"); |
| | | } |
| | | if(ToolUtil.isEmpty(lat)){ |
| | | return ResultUtil.paranErr("lat"); |
| | | } |
| | | public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(String lon, String lat){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "payType", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addVipPayment(@RequestBody Integer payType){ |
| | | public ResultUtil addVipPayment(Integer payType){ |
| | | if(ToolUtil.isEmpty(payType)){ |
| | | return ResultUtil.paranErr("payType"); |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/appUser/getAllUser") |
| | | @ResponseBody |
| | | public List<TAppUser> getAllUser(){ |
| | | try { |
| | | return appUserService.list(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/base/appUser/queryByNamePhone") |
| | | public List<TAppUser> queryByNamePhone(@RequestBody QueryByNamePhone queryByNamePhone){ |
| | | try { |
| | | LambdaQueryWrapper<TAppUser> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(queryByNamePhone.getName())){ |
| | | tAppUserLambdaQueryWrapper.like(TAppUser::getName,queryByNamePhone.getName()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(queryByNamePhone.getPhone())){ |
| | | tAppUserLambdaQueryWrapper.like(TAppUser::getPhone,queryByNamePhone.getPhone()); |
| | | } |
| | | List<TAppUser> list = appUserService.list(tAppUserLambdaQueryWrapper); |
| | | return list; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ArrayList<>(); |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/base/appUser/queryById") |
| | | public TAppUser queryById(@RequestBody Integer appUserId){ |
| | | try { |
| | | return appUserService.getById(appUserId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new TAppUser(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据名称模糊搜索用户 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/appUser/queryAppUserListByName") |
| | | public List<TAppUser> queryAppUserListByName(@RequestBody String name){ |
| | | return appUserService.list(new QueryWrapper<TAppUser>().eq("state", 1).like("name", name)); |
| | | } |
| | | |
| | | |
| | | |
| | | @PostMapping("/appUser/addCourseInfoRecord") |
| | | public Boolean addCourseInfoRecord(@RequestBody TCourseInfoRecord tCourseInfoRecord){ |
| | | boolean save = courseInfoRecordService.save(tCourseInfoRecord); |
| | | return save; |
| | | } |
| | | |
| | | @PostMapping("/appUser/getSelects") |
| | | public List<SelectDto> getSelects(@RequestBody List<Integer> studentIds){ |
| | | List<SelectDto> selectDtos = appUserService.getSelects(studentIds); |
| | | System.out.println("=======selectDtos======>"+selectDtos); |
| | | return selectDtos; |
| | | } |
| | | } |