mitao
2025-02-24 2986e037923a3646318dbe33c5d3eb703da73334
Merge remote-tracking branch 'origin/master'
2个文件已修改
38 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/TokenVo.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/api/SystemUserController.java
@@ -17,6 +17,7 @@
import com.panzhihua.sangeshenbian.warpper.LoginVo;
import com.panzhihua.sangeshenbian.warpper.SystemUserList;
import com.panzhihua.sangeshenbian.warpper.SystemUserListVo;
import com.panzhihua.sangeshenbian.warpper.TokenVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
@@ -65,7 +66,7 @@
    @PostMapping("/login")
    @ApiOperation(value = "登录", tags = {"三个身边后台-登录"})
    @OperLog(operModul = "三个身边后台",operType = 0,businessType = "登录")
    public R<LoginReturnVO> login(@RequestBody LoginVo vo){
    public R<TokenVo> login(@RequestBody LoginVo vo){
        String key = "login:" + vo.getPhone();
        Integer size = (Integer) redisTemplate.opsForValue().get(key);
        if(null != size && max_err.equals(size)){
@@ -92,7 +93,19 @@
        //创建token
        R<LoginReturnVO> reult = tokenService.loginThreeAround(systemUser.getId());
        redisTemplate.delete(key);
        return reult;
        LoginReturnVO loginReturnVO = reult.getData();
        TokenVo tokenVo = new TokenVo();
        BeanUtils.copyProperties(loginReturnVO, tokenVo);
        List<SystemRoleMenu> list = systemRoleMenuService.list(new LambdaQueryWrapper<SystemRoleMenu>().eq(SystemRoleMenu::getSystemRoleId, systemUser.getSystemRoleId()));
        List<Integer> collect = list.stream().map(SystemRoleMenu::getSystemMenuId).collect(Collectors.toList());
        Set<String> collect1 = new HashSet<>();
        if(collect.size() > 0){
            List<SystemMenu> systemMenus = systemMenuService.listByIds(collect);
            collect1 = systemMenus.stream().map(SystemMenu::getUrl).collect(Collectors.toSet());
        }
        tokenVo.setMenu(collect1);
        tokenVo.setName(systemUser.getName());
        return R.ok(tokenVo);
    }
    
    
springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/warpper/TokenVo.java
@@ -4,6 +4,9 @@
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
import java.util.Set;
/**
 * @author zhibing.pu
 * @Date 2025/2/18 23:32
@@ -11,8 +14,20 @@
@ApiModel
@Data
public class TokenVo {
    @ApiModelProperty("token")
    @ApiModelProperty("接口请求令牌")
    private String token;
    @ApiModelProperty("有效期(毫秒)")
    private Long expireTime;
    @ApiModelProperty("刷新token有效期长")
    private String refreshToken;
    @ApiModelProperty("communityId")
    private Long communityId;
    @ApiModelProperty("openId")
    private String openId;
    @ApiModelProperty("社区经度")
    private String lng;
    @ApiModelProperty("社区维度")
    private String lat;
    @ApiModelProperty("权限集合")
    private Set<String> menu;
    @ApiModelProperty("用户名")
    private String name;
}