101captain
2022-01-14 2bc69b919ef626e6093d598d7eae07c8f9e3e0e4
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java
@@ -2,6 +2,8 @@
import javax.servlet.http.HttpServletRequest;
import com.panzhihua.common.model.vos.community.ComActVO;
import com.panzhihua.common.utlis.StringUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@@ -89,11 +91,39 @@
    public Long getAreaId() {
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        Long areaId = loginUserInfo.getAreaId();
        if (null == areaId || 0 == areaId) {
            throw new ServiceException("用户未绑定社区");
        if (null == areaId) {
            throw new ServiceException("用户未绑定小区");
        }
        return areaId;
    }
    /**
     * 获取登录对象所在区域编码
     *
     * @return
     */
    public String getAreaCode() {
        String appid = this.getRequest().getHeader("appid");
        if(StringUtils.isNotEmpty(appid)){
            if(appid.equals("wx08932ba29546ff82")){
                return "510411";
            }
            else if(appid.equals("wx50d8c395af50481b")){
                return "510402";
            }
            else {
                return "510423";
            }
        }
        else {
            LoginUserInfoVO loginUserInfoVO=this.getLoginUserInfo();
            ComActVO comActVO=loginUserInfoVO.getComActVO();
            if(comActVO!=null){
                return comActVO.getAreaCode();
            }
            return "510423";
        }
    }
    /**
     * 获取登录token
@@ -106,6 +136,15 @@
        return header;
    }
    public String getAppId(){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        return loginUserInfo.getAppId();
    }
    public String getAppSecret(){
        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
        return loginUserInfo.getAppSecret();
    }
    /**
     * 获取登录对象所有信息
     *