jiangping
2025-06-17 64fa2c33cd645e86d4e2a8c34c7881ea4aa678cf
server/src/main/java/com/doumee/service/business/impl/MemberServiceImpl.java
@@ -29,11 +29,14 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import javax.annotation.Resource;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -47,6 +50,8 @@
@Service
public class MemberServiceImpl implements MemberService {
    @Resource(name="sessionRedisTemplate")
    private RedisTemplate<Object, Serializable> redisTemplate;
    @Autowired
    private SystemDictDataBiz systemDictDataBiz;
    @Autowired
@@ -304,7 +309,7 @@
                        if(StringUtils.isNotBlank(comNames)){
                            comNames += ",";
                        }
                        comNames += c.getNamePath();
                        comNames += StringUtils.defaultString(c.getNamePath(),c.getName());
                    }
                }
                cm.setCompanyList(qycom);
@@ -436,18 +441,18 @@
        }
        String token = systemDictDataBiz.queryByCode(Constants.QYWX,Constants.QYWX_TOKEN).getCode();
        //根据code换区企业微信ID
        QywxBaseResponse<String> qwIdBaseResponse= null;// QywxUtil.getUserInfoByCode(token,dto.getCode());
//        if(Objects.isNull(qwIdBaseResponse)||Objects.isNull(qwIdBaseResponse.getErrcode())){
//            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业微信登录码解析失败,请联系管理员");
//        }
//        if(!Constants.equalsInteger(qwIdBaseResponse.getErrcode(),Constants.ZERO)){
//            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业微信登录失败:"+qwIdBaseResponse.getErrmsg());
//        }
//        if(Objects.isNull(qwIdBaseResponse.getData())){
//            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业微信用户信息解析失败,请联系管理员");
//        }
//        String qwId = qwIdBaseResponse.getData();
        String qwId = dto.getCode();
        QywxBaseResponse<String> qwIdBaseResponse =  QywxUtil.getUserInfoByCode(token,dto.getCode());
        if(Objects.isNull(qwIdBaseResponse)||Objects.isNull(qwIdBaseResponse.getErrcode())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业微信登录码解析失败,请联系管理员");
        }
        if(!Constants.equalsInteger(qwIdBaseResponse.getErrcode(),Constants.ZERO)){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业微信登录失败:"+qwIdBaseResponse.getErrmsg());
        }
        if(Objects.isNull(qwIdBaseResponse.getData())){
            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"企业微信用户信息解析失败,请联系管理员");
        }
        String qwId = qwIdBaseResponse.getData();
//        String qwId = dto.getCode();
        Member member = memberMapper.selectOne(new QueryWrapper<Member>().lambda().eq(Member::getQwId,qwId).eq(Member::getIsdeleted,Constants.ZERO).last(" limit 1 "));
        if(Objects.isNull(member)){
            //根据企业微信ID 查询用户信息