| | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.BasePage; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.dto.UpdateMicroWishStateDto; |
| | | import com.ruoyi.system.dto.UpdatePhoneDto; |
| | | import com.ruoyi.system.dto.UpdateUserDto; |
| | | import com.ruoyi.system.model.TAppUser; |
| | | import com.ruoyi.system.model.TAppealServices; |
| | | import com.ruoyi.system.model.TChildcareServices; |
| | |
| | | return R.ok(childcareServicesPage); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心--托育服务记录详情",response = TChildcareServices.class) |
| | | @GetMapping(value = "/getChildcareServicesDetail/{id}") |
| | | public R<TChildcareServices> getChildcareServicesList(@PathVariable String id) { |
| | | public R<TChildcareServices> getChildcareServicesDetail(@PathVariable String id) { |
| | | TChildcareServices childcareServices = tChildcareServicesService.getById(id); |
| | | return R.ok(childcareServices); |
| | | } |
| | |
| | | Page<TAppealServices> appealServicesPage = tAppealServicesService.page(page, Wrappers.<TAppealServices>lambdaQuery().eq(TAppealServices::getAppUserId, userId).eq(TAppealServices::getAppealType,1).eq(Objects.nonNull(query.getStatus()), TAppealServices::getStatus, query.getStatus()).orderByDesc(BaseModel::getCreateTime)); |
| | | return R.ok(appealServicesPage); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心--诉求服务记录/随手拍详情",response = TAppealServices.class) |
| | | @GetMapping(value = "/getAppealServicesDetail/{id}") |
| | |
| | | return R.ok(appealServicesPage); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心--微心愿记录",response = TMicroWish.class) |
| | | @PostMapping(value = "/getMicroWishList") |
| | | public R<Page<TMicroWish>> getMicroWishList(@RequestBody MicroWishStatusQuery query) { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | Page<TMicroWish> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | Page<TMicroWish> microWishPage = tMicroWishService.page(page, Wrappers.<TMicroWish>lambdaQuery().eq(TMicroWish::getAppUserId, userId).eq(Objects.nonNull(query.getStatus()), TMicroWish::getStatus, query.getStatus()).orderByDesc(BaseModel::getCreateTime)); |
| | | Page<TMicroWish> microWishPage = tMicroWishService.page(page, Wrappers.<TMicroWish>lambdaQuery() |
| | | .eq(TMicroWish::getAppUserId, userId) |
| | | .eq(Objects.nonNull(query.getStatus()), TMicroWish::getStatus, query.getStatus()) |
| | | .orderByDesc(BaseModel::getCreateTime)); |
| | | return R.ok(microWishPage); |
| | | } |
| | | |
| | | @ApiOperation(value = "个人中心--微心愿上下架",response = TMicroWish.class) |
| | | @PostMapping(value = "/updateMicroWishState") |
| | | public R<?> updateMicroWishState(@RequestBody UpdateMicroWishStateDto dto) { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TMicroWish microWish = tMicroWishService.getById(dto.getId()); |
| | | if(!userId.equals(microWish.getAppUserId())){ |
| | | return R.fail("无权限操作"); |
| | | } |
| | | microWish.setState(dto.getState()); |
| | | tMicroWishService.updateById(microWish); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心--微心愿详情",response = TMicroWish.class) |
| | | @GetMapping(value = "/getMicroWishDetail/{id}") |
| | |
| | | return R.ok(microWish); |
| | | } |
| | | |
| | | @ApiOperation(value = "个人中心--微心愿删除",response = TMicroWish.class) |
| | | @DeleteMapping(value = "/delMicroWish/{id}") |
| | | public R<TMicroWish> delMicroWish(@PathVariable String id) { |
| | | boolean b = tMicroWishService.removeById(id); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心--修改手机号") |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "个人中心--修改信息") |
| | | @PostMapping(value = "/updateUserInfo") |
| | | public R<?> updateUserInfo(@RequestBody UpdateUserDto dto) { |
| | | String userId = tokenService.getLoginUserApplet().getUserId(); |
| | | TAppUser appUser = tAppUserService.getById(userId); |
| | | |
| | | if(dto.getAvatar()!=null){ |
| | | appUser.setAvatar(dto.getAvatar()); |
| | | } |
| | | |
| | | if(dto.getNickName()!=null){ |
| | | appUser.setNickName(dto.getNickName()); |
| | | } |
| | | |
| | | if(dto.getGender()!=null){ |
| | | appUser.setGender(dto.getGender()); |
| | | } |
| | | |
| | | if(dto.getBirthday()!=null){ |
| | | appUser.setBirthDate(dto.getBirthday()); |
| | | } |
| | | |
| | | if(dto.getName()!=null){ |
| | | appUser.setName(dto.getName()); |
| | | } |
| | | |
| | | |
| | | if(dto.getPhone()!=null){ |
| | | long count = tAppUserService.count(new LambdaQueryWrapper<TAppUser>().eq(TAppUser::getPhoneNumber, dto.getPhone()).ne(TAppUser::getId, userId)); |
| | | if (count > 0) { |
| | | return R.fail("手机号已存在"); |
| | | } |
| | | appUser.setPhoneNumber(dto.getPhone()); |
| | | } |
| | | tAppUserService.updateById(appUser); |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |