Commit afd746c7 by 徐高华

自建应用登录

parent 8e80128d
......@@ -108,6 +108,15 @@ public class WxEnterpriseDTO implements Serializable {
private Integer wxSecurityType ;
private String wxCorpid ;
private String openCorpid ;
private String wxaAppid ;
public String getWxaAppid() {
return wxaAppid;
}
public void setWxaAppid(String wxaAppid) {
this.wxaAppid = wxaAppid;
}
public Integer getWxSecurityType() {
return wxSecurityType;
......
......@@ -46,6 +46,8 @@ public interface WxEnterpriseApiService {
*/
WxEnterpriseDTO getOne(String wxEnterpriseId);
WxEnterpriseDTO selectByWxaAppid(String appid);
WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
/**
......
......@@ -251,6 +251,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
}
@Override
public WxEnterpriseDTO selectByWxaAppid(String appid) {
TabHaobanWxEnterprise tab = wxEnterpriseMapper.selectByWxaAppid(appid);
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, tab);
return wxDTO;
}
@Override
public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) {
return this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
}
......
......@@ -64,7 +64,7 @@
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise
where wxa_appid = #{appid}
where wxa_appid = #{appid} and wx_security_type = 5
</select>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise">
......
......@@ -142,9 +142,16 @@ public class WxEnterpriseInfoController extends WebBaseController {
public HaobanResponse getInfoByCode(String code , String appid) {
logger.info("code:{}", code);
String userDTOJson = null ;
if(null != RedisUtil.getCache("haoban-self-test")) {
WxEnterpriseQwDTO qwDTO1 = this.wxEnterpriseApiService.getQwInfo("xxxx") ;
userDTOJson = qywxUserApiService.getUserByCode(qwDTO1.getDkCorpid(), qwDTO1.getSelfSecret(), code);
String wxEnterpriseId = null ;
if(StringUtils.isNotEmpty(appid)) {
WxEnterpriseDTO wxEnterprise = this.wxEnterpriseApiService.selectByWxaAppid(appid) ;
if(null != wxEnterprise) {
wxEnterpriseId = wxEnterprise.getWxEnterpriseId() ;
}
}
if(null != wxEnterpriseId) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId) ;
userDTOJson = qywxUserApiService.getUserByCode(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(), code);
}else {
userDTOJson = qywxCorpApiService.getCodeSession(config.getWxSuiteid(), code);
}
......@@ -242,7 +249,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
staffApiService.activeStaff(staffId);
}
String wxEnterpriseId = loginStaff.getWxEnterpriseId();
wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(qwDTO.getThirdCorpid(), config.getWxSuiteid());
WellDoneLoginInfoVO wellDoneLoginInfoVo = new WellDoneLoginInfoVO();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment