Commit 8a41f9b7 by 徐高华

Merge branch 'feature/xgh/代开发调整25年' into 'developer'

企微自建转代开发调整

See merge request !2418
parents 02be49b4 6c98cb1f
......@@ -8,6 +8,7 @@ import java.util.List;
import java.util.Map;
import cn.hutool.core.collection.CollUtil;
import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
......@@ -52,6 +53,16 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
@Override
public String add(WxEnterpriseDTO wxDTO) {
String wxCorpid = wxDTO.getWxCorpid() ;
if(StringUtils.isBlank(wxCorpid)) {
wxCorpid = wxDTO.getOpenCorpid() ;
}
String key = "wxEnterpriseId:"+wxCorpid ;
RedisUtil.lock(key,3L);
TabHaobanWxEnterprise en = this.getEnterpriseBycorpId(wxCorpid);
if(null != en) {
return en.getWxEnterpriseId() ;
}
logger.info("新增wx_enterprise,dto={}",JSON.toJSONString(wxDTO));
Date now = new Date();
wxDTO.setWxEnterpriseId(StringUtil.randomUUID());
......@@ -61,6 +72,7 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
tabHaobanWxEnterprise.setStatusFlag(1);
tabHaobanWxEnterprise.setBindFlag(1);
mapper.insertSelective(tabHaobanWxEnterprise);
RedisUtil.unlock(key);
return wxDTO.getWxEnterpriseId();
}
......@@ -129,10 +141,11 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
qw.setMemberCorpid(wxEnterprise.getWxCorpid());
TabSecretSetting secret = secretSettingMapper.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CUSTOMIZED_APP.getVal(), null);
qw.setSelfSecret(secret.getSecretVal());
qw.setAgentId(secret.getAgentId());
qw.setAgentName(secret.getAgentName());
qw.setSelf3thSecret(secret.getSecretVal());
qw.setSelfAppid(wxEnterprise.getWxaAppid());
TabHaobanWxApplication app = this.wxApplicationMapper.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId,3) ;
qw.setAgentId(app.getAgentId());
qw.setAgentName(app.getAgentName());
}
logger.info("企微所有corpid信息={}",JSON.toJSON(qw));
return qw;
......
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