Commit afd746c7 by 徐高华

自建应用登录

parent 8e80128d
...@@ -108,6 +108,15 @@ public class WxEnterpriseDTO implements Serializable { ...@@ -108,6 +108,15 @@ public class WxEnterpriseDTO implements Serializable {
private Integer wxSecurityType ; private Integer wxSecurityType ;
private String wxCorpid ; private String wxCorpid ;
private String openCorpid ; private String openCorpid ;
private String wxaAppid ;
public String getWxaAppid() {
return wxaAppid;
}
public void setWxaAppid(String wxaAppid) {
this.wxaAppid = wxaAppid;
}
public Integer getWxSecurityType() { public Integer getWxSecurityType() {
return wxSecurityType; return wxSecurityType;
......
...@@ -46,6 +46,8 @@ public interface WxEnterpriseApiService { ...@@ -46,6 +46,8 @@ public interface WxEnterpriseApiService {
*/ */
WxEnterpriseDTO getOne(String wxEnterpriseId); WxEnterpriseDTO getOne(String wxEnterpriseId);
WxEnterpriseDTO selectByWxaAppid(String appid);
WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId); WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
/** /**
......
...@@ -251,6 +251,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -251,6 +251,13 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
} }
@Override @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) { public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) {
return this.wxEnterpriseService.getQwInfo(wxEnterpriseId); return this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
} }
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise from tab_haoban_wx_enterprise
where wxa_appid = #{appid} where wxa_appid = #{appid} and wx_security_type = 5
</select> </select>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise"> <insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise">
......
...@@ -142,9 +142,16 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -142,9 +142,16 @@ public class WxEnterpriseInfoController extends WebBaseController {
public HaobanResponse getInfoByCode(String code , String appid) { public HaobanResponse getInfoByCode(String code , String appid) {
logger.info("code:{}", code); logger.info("code:{}", code);
String userDTOJson = null ; String userDTOJson = null ;
if(null != RedisUtil.getCache("haoban-self-test")) { String wxEnterpriseId = null ;
WxEnterpriseQwDTO qwDTO1 = this.wxEnterpriseApiService.getQwInfo("xxxx") ; if(StringUtils.isNotEmpty(appid)) {
userDTOJson = qywxUserApiService.getUserByCode(qwDTO1.getDkCorpid(), qwDTO1.getSelfSecret(), code); 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 { }else {
userDTOJson = qywxCorpApiService.getCodeSession(config.getWxSuiteid(), code); userDTOJson = qywxCorpApiService.getCodeSession(config.getWxSuiteid(), code);
} }
...@@ -242,7 +249,7 @@ public class WxEnterpriseInfoController extends WebBaseController { ...@@ -242,7 +249,7 @@ public class WxEnterpriseInfoController extends WebBaseController {
staffApiService.activeStaff(staffId); staffApiService.activeStaff(staffId);
} }
String wxEnterpriseId = loginStaff.getWxEnterpriseId(); wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseApiService.getQwInfo(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(qwDTO.getThirdCorpid(), config.getWxSuiteid()); String accesstoken = qywxCorpApiService.getCorpAccessToken(qwDTO.getThirdCorpid(), config.getWxSuiteid());
WellDoneLoginInfoVO wellDoneLoginInfoVo = new WellDoneLoginInfoVO(); 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