| | |
| | | package com.dsh.account.controller; |
| | | |
| | | import com.alibaba.nacos.common.utils.Md5Utils; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.dto.BindDto; |
| | | import com.dsh.account.dto.SelectDto; |
| | | import com.dsh.account.dto.UpdateInfoDto; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.model.*; |
| | | import com.dsh.account.service.IVipPaymentService; |
| | | import com.dsh.account.service.TAppUserService; |
| | | import com.dsh.account.model.query.appUserQuery.QueryAppUser; |
| | | import com.dsh.account.model.vo.QueryAppUserVO; |
| | | import com.dsh.account.service.*; |
| | | 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.ArrayList; |
| | | import java.util.*; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @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; |
| | | } |
| | | }else { |
| | | TAppUser phone = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", query.getPhone())); |
| | | if (null != phone){ |
| | | return 5001; |
| | | } |
| | | } |
| | | query.setIsVip(0); |
| | | query.setInsertTime(new Date()); |
| | | return appUserService.saveOrUpdate(query); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户信息列表数据 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/base/appUser/listAll") |
| | | public List<QueryAppUserVO> listAll(@RequestBody QueryAppUser query){ |
| | | List<QueryAppUserVO> queryAppUserVOS = appUserService.listAll(query); |
| | | ArrayList<QueryAppUserVO> res = new ArrayList<>(); |
| | | |
| | | if (query.getUserIds()!=null && query.getUserIds().size()!=0){ |
| | | List<QueryAppUserVO> queryAppUserVOS1 = appUserService.listAll1(query); |
| | | queryAppUserVOS.addAll(queryAppUserVOS1); |
| | | } |
| | | List<QueryAppUserVO> collect = queryAppUserVOS.stream().distinct().collect(Collectors.toList()); |
| | | for (QueryAppUserVO vo : collect) { |
| | | // 会员到期时间小于当前时间或者会员到期时间为null 则会员过期 |
| | | if (vo.getVipEndTime()!=null && vo.getVipEndTime().after(new Date())){ |
| | | vo.setIsVip(1); |
| | | }else{ |
| | | vo.setIsVip(0); |
| | | } |
| | | if (query.getIsVip() != null && (!query.getIsVip().equals("")) ){ |
| | | if (vo.getIsVip() == query.getIsVip()){ |
| | | res.add(vo); |
| | | } |
| | | }else{ |
| | | res.add(vo); |
| | | } |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | /** |
| | | * 根据用户手机号获取用户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") |
| | |
| | | try { |
| | | ResultUtil smsCode = appUserService.getSMSCode(type, phone); |
| | | return smsCode; |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private TStudentService studentService; |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/logOff") |
| | | @ApiOperation(value = "注销", tags = {"注销"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "账号id", name = "appId", dataType = "int", required = true) |
| | | }) |
| | | public ResultUtil<String> logOff(Integer appId){ |
| | | try { |
| | | |
| | | appUserService.removeById(appId); |
| | | studentService.remove(new QueryWrapper<TStudent>().eq("appUserId",appId)); |
| | | |
| | | return ResultUtil.success("注销成功"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/bind") |
| | | @ApiOperation(value = "微信登录绑定手机号", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil bind(BindDto dto){ |
| | | try { |
| | | return appUserService.bind(dto); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/updateInfo") |
| | | @ApiOperation(value = "修改个人信息", tags = {"APP-登录注册"}) |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResultUtil<String> updateInfo(UpdateInfoDto dto){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | return appUserService.updateInfo(dto,uid); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<JoinPlayPaiVo> queryJoinPlayPai(String lon, String lat){ |
| | | |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesService userIntegralChangesService; |
| | | /** |
| | | * 修改用户信息 |
| | | * @param appUser |
| | |
| | | public void updateAppUser(@RequestBody TAppUser appUser){ |
| | | try { |
| | | appUserService.updateById(appUser); |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(appUser.getId()); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()+appUser.getPoints()); |
| | | userIntegralChanges.setType(5); |
| | | userIntegralChanges.setNewIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | userIntegralChanges.setCategory(2); |
| | | userIntegralChangesService.save(userIntegralChanges); |
| | | |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/appUser/queryByNamePhone") |
| | | List<TAppUser> queryByNamePhone(@RequestBody QueryByNamePhone queryByNamePhone){ |
| | | public List<TAppUser> queryByNamePhone(@RequestBody QueryByNamePhone queryByNamePhone){ |
| | | try { |
| | | LambdaQueryWrapper<TAppUser> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(queryByNamePhone.getName())){ |
| | |
| | | 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; |
| | | } |
| | | } |