jiaosong
2023-08-25 8f918cb6db02c39e67ce7b0d77cc1be5ed26edaf
server/src/main/java/doumeemes/service/system/impl/WxLoginServiceImpl.java
@@ -11,6 +11,7 @@
import doumeemes.core.utils.Constants;
import doumeemes.core.utils.HttpsUtil;
import doumeemes.core.utils.Utils;
import doumeemes.dao.business.model.Company;
import doumeemes.dao.business.model.CompanyUser;
import doumeemes.dao.business.model.Department;
import doumeemes.dao.ext.CompanyExtMapper;
@@ -18,6 +19,7 @@
import doumeemes.dao.ext.DepartmentExtMapper;
import doumeemes.dao.ext.dto.QueryCompanyUserExtDTO;
import doumeemes.dao.ext.dto.WxLoginDTO;
import doumeemes.dao.ext.dto.WxLoginOutDTO;
import doumeemes.dao.ext.vo.CompanyUserExtListVO;
import doumeemes.dao.ext.vo.WxLoginVO;
import doumeemes.dao.system.SystemUserMapper;
@@ -69,6 +71,8 @@
    @Autowired
    private SystemLoginLogService systemLoginLogService;
    @Autowired
    private CompanyExtMapper companyExtMapper;
    /**
@@ -107,6 +111,11 @@
        if(Objects.isNull(department)){
            throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到绑定部门信息");
        }
        Company company = companyExtMapper.selectById(department.getCompanyId());
        if(Objects.isNull(company)||company.getStatus().equals(Constants.ZERO)){
            wxLoginVO.setLoginStatus(Constants.ONE);
            return wxLoginVO;
        }
        SystemUser systemUser = systemUserMapper.selectById(companyUser.getUserId());
        //查询用户数据
        LoginDTO dto = new LoginDTO();
@@ -136,6 +145,9 @@
            String session = (String)subject.getSession().getId();
            wxLoginVO.setLoginStatus(Constants.ZERO);
            wxLoginVO.setSession(session);
            return wxLoginVO;
        }catch (BusinessException e) {
            wxLoginVO.setLoginStatus(Constants.ONE);
            return wxLoginVO;
        }catch (AuthenticationException e) {
            BusinessException ee = null;
@@ -212,4 +224,14 @@
        }
    }
    @Override
    public void wxLoginOut(WxLoginOutDTO wxLoginOutDTO) {
        if(!Objects.isNull(wxLoginOutDTO)&&!Objects.isNull(wxLoginOutDTO.getCompanyUserId())){
            companyUserExtMapper.update(null,new UpdateWrapper<CompanyUser>()
                    .set("UNIONID","").set("OPENID","")
                    .eq("id",wxLoginOutDTO.getCompanyUserId())
            );
        }
    }
}