| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.api.R; |
| | | import com.dsh.account.dto.BindDto; |
| | | import com.dsh.account.dto.IntroduceUserQuery; |
| | | import com.dsh.account.dto.SelectDto; |
| | | import com.dsh.account.dto.UpdateInfoDto; |
| | | import com.dsh.account.dto.*; |
| | | import com.dsh.account.entity.*; |
| | | import com.dsh.account.feignclient.other.VipClient; |
| | | import com.dsh.account.model.AddAppUserVo; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.checkerframework.checker.guieffect.qual.UI; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | |
| | | |
| | | @Autowired |
| | | private TAppGiftService appGiftService; |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesService userIntegralChangesService; |
| | | |
| | | /** |
| | | * 根据介绍有礼id查询当前活动参与次数 |
| | |
| | | @GetMapping("/base/appUser/getAppUserByPhone/{phone}") |
| | | public TAppUser getAppUserByPhone(@PathVariable("phone") String phone) { |
| | | TAppUser appUser = appUserService.getOne(new QueryWrapper<TAppUser>().eq("phone", phone) |
| | | .eq("state",1)); |
| | | .eq("state", 1)); |
| | | return appUser; |
| | | } |
| | | |
| | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/loginSMSCode") |
| | | @ApiOperation(value = "短信验证码登录", tags = {"APP-登录注册"}) |
| | | |
| | | public ResultUtil<String> loginSMSCode(LoginSMSCodeVo loginSMSCodeVo) { |
| | | try { |
| | | return appUserService.loginSMSCode(loginSMSCodeVo); |
| | |
| | | @ApiImplicitParam(value = "会员卡id", name = "id", dataType = "int", required = true), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil addVipPayment(Integer payType,Integer id) { |
| | | public ResultUtil addVipPayment(Integer payType, Integer id) { |
| | | if (ToolUtil.isEmpty(payType)) { |
| | | return ResultUtil.paranErr("payType"); |
| | | } |
| | |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/appUser/vipPayment") |
| | | @ApiOperation(value = "页面数据展示", tags = {"APP-成为会员"}) |
| | |
| | | VipPaymentVO res = new VipPaymentVO(); |
| | | res.setHeadImg(appUser.getHeadImg()); |
| | | res.setName(appUser.getName()); |
| | | res.setIsVip(appUser.getIsVip()); |
| | | res.setVipEndTime(appUser.getVipEndTime()); |
| | | if (appUser.getVipEndTime() == null) { |
| | | res.setIsVip(0); |
| | | } else if (appUser.getVipEndTime().before(new Date())) { |
| | | res.setIsVip(0); |
| | | } else { |
| | | res.setIsVip(1); |
| | | } |
| | | appUserService.updateById(appUser); |
| | | List<Vip> vips = vipClient.listAll(); |
| | | res.setVipList(vips); |
| | | |
| | | return ResultUtil.success(res); |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | // |
| | | // /** |
| | | // * 购买年度会员支付微信回调V3版本回调 |
| | |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 购买年度会员支付微信回调 |
| | | * |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 根据用户id获取用户信息 |
| | | * |
| | |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/queryAppUserBatch") |
| | | List<TAppUser> queryAppUserBatch(@RequestBody List<Integer> appUserIdList){ |
| | | List<TAppUser> queryAppUserBatch(@RequestBody List<Integer> appUserIdList) { |
| | | return appUserService.listByIds(appUserIdList); |
| | | } |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesService userIntegralChangesService; |
| | | |
| | | /** |
| | | * 修改用户信息 |
| | |
| | | try { |
| | | TAppUser appUser1 = appUserService.getById(appUser.getId()); |
| | | appUserService.updateById(appUser); |
| | | if(appUser.getIntegral().compareTo(appUser1.getIntegral()) != 0){ |
| | | if (appUser.getIntegral().compareTo(appUser1.getIntegral()) != 0) { |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(appUser.getId()); |
| | | userIntegralChanges.setOldIntegral(appUser1.getIntegral()); |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("/base/appUser/updateIntegral") |
| | | public Boolean updateIntegral(@RequestBody UpdateIntegral updateIntegral) { |
| | | TAppUser appUser = appUserService.getById(updateIntegral.getId()); |
| | | Integer integral = appUser.getIntegral(); |
| | | switch (updateIntegral.getChangeType()) { |
| | | case 1: |
| | | integral = integral + updateIntegral.getIntegral(); |
| | | break; |
| | | case 2: |
| | | integral = integral - updateIntegral.getIntegral(); |
| | | break; |
| | | } |
| | | |
| | | UserIntegralChanges userIntegralChanges = new UserIntegralChanges(); |
| | | userIntegralChanges.setAppUserId(updateIntegral.getId()); |
| | | userIntegralChanges.setType(1); |
| | | userIntegralChanges.setOldIntegral(appUser.getIntegral()); |
| | | userIntegralChanges.setNewIntegral(integral); |
| | | userIntegralChanges.setRemark(updateIntegral.getRemark()); |
| | | userIntegralChanges.setInsertTime(new Date()); |
| | | userIntegralChanges.setCategory(updateIntegral.getChangeType()); |
| | | userIntegralChangesService.save(userIntegralChanges); |
| | | appUser.setIntegral(integral); |
| | | appUserService.updateById(appUser); |
| | | return true; |
| | | } |
| | | |
| | | @PostMapping("/base/appUser/queryById") |
| | | public TAppUser queryById(@RequestBody Integer appUserId) { |
| | | try { |
| | |
| | | |
| | | |
| | | @PostMapping("/appUser/queryAppUserByCityCode") |
| | | public List<TAppUser> queryAppUserByCityCode(@RequestBody String cityCode){ |
| | | public List<TAppUser> queryAppUserByCityCode(@RequestBody String cityCode) { |
| | | return appUserService.list(new QueryWrapper<TAppUser>() |
| | | .eq("state", 1) |
| | | .eq("cityCode", cityCode) |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 根据城市code获取用户的id集合 |
| | | * |
| | | * @param cityCode 城市code |
| | | * @return |
| | | */ |
| | | @PostMapping("/appUser/getAppUserIds") |
| | | public List<Integer> getAppUserIds(@RequestBody String cityCode){ |
| | | @GetMapping("/appUser/getAppUserIds/{cityCode}") |
| | | public List<Integer> getAppUserIds(@PathVariable("cityCode") String cityCode) { |
| | | List<TAppUser> list = appUserService.list(new QueryWrapper<TAppUser>().eq("cityCode", cityCode).eq("state", 1)); |
| | | return list.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | } |
| | |
| | | |
| | | /** |
| | | * 根据省市名称所有用户 |
| | | * |
| | | * @param appUserIdsByCityName |
| | | * @return |
| | | */ |
| | | @PostMapping("/appUser/getAppUserIdsByCityName") |
| | | public List<Integer> getAppUserIdsByCityName(@RequestBody AppUserIdsByCityName appUserIdsByCityName){ |
| | | public List<Integer> getAppUserIdsByCityName(@RequestBody AppUserIdsByCityName appUserIdsByCityName) { |
| | | QueryWrapper<TAppUser> queryWrapper = new QueryWrapper<TAppUser>().eq("state", 1); |
| | | if(ToolUtil.isNotEmpty(appUserIdsByCityName.getProvince())){ |
| | | if (ToolUtil.isNotEmpty(appUserIdsByCityName.getProvince())) { |
| | | queryWrapper.like("province", appUserIdsByCityName.getProvince()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(appUserIdsByCityName.getCity())){ |
| | | if (ToolUtil.isNotEmpty(appUserIdsByCityName.getCity())) { |
| | | queryWrapper.like("city", appUserIdsByCityName.getCity()); |
| | | } |
| | | List<TAppUser> list = appUserService.list(queryWrapper); |
| | |
| | | |
| | | @PostMapping("/appUser/queryAppUserByIds") |
| | | @ResponseBody |
| | | public List<TAppUser> queryAppUserByIds(@RequestBody UserDetailsOfSearch search){ |
| | | LambdaQueryWrapper<TAppUser> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(search.getIdCard())){ |
| | | tAppUserLambdaQueryWrapper.eq(TAppUser::getIdCard, search.getIdCard()); |
| | | public List<TStudent> queryAppUserByIds(@RequestBody UserDetailsOfSearch search) { |
| | | LambdaQueryWrapper<TStudent> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if (ToolUtil.isNotEmpty(search.getIdCard())) { |
| | | tAppUserLambdaQueryWrapper.eq(TStudent::getIdCard, search.getIdCard()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(search.getPhone())){ |
| | | tAppUserLambdaQueryWrapper.eq(TAppUser::getPhone, search.getPhone()); |
| | | if (ToolUtil.isNotEmpty(search.getPhone())) { |
| | | tAppUserLambdaQueryWrapper.eq(TStudent::getPhone, search.getPhone()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(search.getName())){ |
| | | tAppUserLambdaQueryWrapper.eq(TAppUser::getName, search.getName()); |
| | | if (ToolUtil.isNotEmpty(search.getName())) { |
| | | tAppUserLambdaQueryWrapper.eq(TStudent::getName, search.getName()); |
| | | } |
| | | tAppUserLambdaQueryWrapper.in(TAppUser::getId,search.getUseIds()); |
| | | return appUserService.list(tAppUserLambdaQueryWrapper); |
| | | tAppUserLambdaQueryWrapper.in(TStudent::getId, search.getUseIds()); |
| | | return studentService.list(tAppUserLambdaQueryWrapper); |
| | | } |
| | | } |