Commit a8b75126 by 墨竹

fix:企微微信授权修改

parent dcb29c38
......@@ -37,4 +37,13 @@ public interface WxEnterpriseMapper {
*/
TabHaobanWxEnterprise getEnterpriseBycorpId(@Param("corpId") String corpId, @Param("statusFlag") Integer statusFlag);
/**
* 获取公司by企业名称
*
* @param corpName 公司名称
* @return {@link TabHaobanWxEnterprise }
* @author mozhu
* @date 2021-12-20 20:09:52
*/
TabHaobanWxEnterprise getEnterpriseByCorpName(@Param("corpName") String corpName);
}
\ No newline at end of file
......@@ -33,12 +33,24 @@ public interface WxEnterpriseService {
int unbind(String wxEnterpriseId);
@Deprecated
TabHaobanWxEnterprise getEnterpriseBycorpIdNoStatus(String corpid);
/**
* 所有企业微信
*
* @return
*/
List<TabHaobanWxEnterprise> listAll();
/**
* 得到企业bycorp名称
*
* @param corpName 公司名称
* @return {@link TabHaobanWxEnterprise }
* @author mozhu
* @date 2021-12-20 20:09:21
*/
TabHaobanWxEnterprise getEnterpriseByCorpName(String corpName);
/**
* 所有企业微信
*
* @return
*/
List<TabHaobanWxEnterprise> listAll();
}
......@@ -76,6 +76,11 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
}
@Override
public TabHaobanWxEnterprise getEnterpriseByCorpName(String corpName) {
return this.mapper.getEnterpriseByCorpName(corpName);
}
@Override
public List<TabHaobanWxEnterprise> listAll() {
return mapper.listAll();
}
......
......@@ -61,6 +61,7 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
log.info("企业微信授权信息:{}", JSON.toJSONString(dto));
String corpid = dto.getCorpid();
String corpName = dto.getCorpName();
String siteId = dto.getSuiteId();
String agentId = dto.getAgentid();
String agentName = dto.getAgentName();
......@@ -70,33 +71,20 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
Integer isCustomizedApp = dto.getIsCustomizedApp();
WxEnterpriseDTO wxDTO = EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, dto);
String wxEnterpriseId = "";
if (isCustomizedApp != null && isCustomizedApp == 1) {
//代开发
String toOpenCorpid = qywxUserApiService.toOpenCorpid(corpid, siteId);
log.info("明文corpid:{},加密后的toOpenCorpid为:{}", corpid, toOpenCorpid);
TabHaobanWxEnterprise enterprise = this.wxEnterpriseService.getEnterpriseBycorpIdNoStatus(toOpenCorpid);
if (enterprise != null) {
wxEnterpriseId = enterprise.getWxEnterpriseId();
}
//获取授权好办小程序
TabHaobanWxEnterprise enterprise = this.wxEnterpriseService.getEnterpriseByCorpName(corpName);
if (enterprise != null) {
wxEnterpriseId = enterprise.getWxEnterpriseId();
wxDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId());
wxDTO.setStatusFlag(1);
wxDTO.setBindFlag(1);
wxEnterpriseService.update(wxDTO);
} else {
//授权好办小程序
//只需要插入更新好办小程序企业,代开发 企业表不插入
TabHaobanWxEnterprise enterprise = this.wxEnterpriseService.getEnterpriseBycorpIdNoStatus(corpid);
if (enterprise != null) {
wxEnterpriseId = enterprise.getWxEnterpriseId();
wxDTO.setWxEnterpriseId(enterprise.getWxEnterpriseId());
wxDTO.setStatusFlag(1);
wxDTO.setBindFlag(1);
wxEnterpriseService.update(wxDTO);
} else {
wxEnterpriseId = wxEnterpriseService.add(wxDTO);
}
wxEnterpriseId = wxEnterpriseService.add(wxDTO);
}
if (StringUtils.isNotBlank(userId)) {
staffApiService.wxGetAdd(userId, wxEnterpriseId);
}
TabHaobanWxApplication tab = wxApplicationService.selectBySiteIdAndWxEnterpriseId(siteId, wxEnterpriseId);
if (tab == null) {
tab = new TabHaobanWxApplication();
......
......@@ -449,4 +449,12 @@
limit 1
</select>
<select id="getEnterpriseByCorpName" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_wx_enterprise
where corp_name = #{corpName}
order by create_time desc limit 1
</select>
</mapper>
\ No newline at end of file
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