| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | import com.panzhihua.common.exceptions.ServiceException; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.redis.RedisUtils; |
| | | import com.panzhihua.sangeshenbian.model.dto.UserIdentityDTO; |
| | | import com.panzhihua.sangeshenbian.model.entity.Banner; |
| | | import com.panzhihua.sangeshenbian.model.entity.PartyMember; |
| | | import com.panzhihua.sangeshenbian.model.entity.SystemUser; |
| | |
| | | import com.panzhihua.sangeshenbian.warpper.IdentityInformation; |
| | | import com.panzhihua.sangeshenbian.warpper.IdentityInformationVO; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.BeanUtils; |
| | |
| | | */ |
| | | @GetMapping("/change-identity") |
| | | @ApiOperation("切换身份") |
| | | public R<?> changeIdentity(Integer identity) { |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "identity", value = "身份 1:党员 2:管理员", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "levelId", value = "身份层级id,党员身份不传,管理员必传", required = true, dataType = "Integer") |
| | | }) |
| | | public R<?> changeIdentity(@RequestParam(value = "identity", required = true) Integer identity, |
| | | @RequestParam(value = "levelId", required = false) Integer levelId) { |
| | | LoginUserInfoVO loginUserInfo = getLoginUserInfo(); |
| | | redisUtils.set("identity:" + loginUserInfo.getPhone(), identity); |
| | | if (identity.equals(2) && Objects.isNull(levelId)) { |
| | | throw new ServiceException("管理员所属层级id不能为空"); |
| | | } |
| | | // 存储到Redis |
| | | redisUtils.set("identity:" + loginUserInfo.getPhone(), UserIdentityDTO.builder() |
| | | .identity(identity) |
| | | .levelId(levelId) |
| | | .build()); |
| | | return R.ok(); |
| | | } |
| | | |