Commit 755cba93 by 徐高华

未配置查询pendingid的不创建会员

parent 67f503bb
package com.gic.haoban.manage.service.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.EntityUtil;
import com.gic.enterprise.api.dto.EnterpriseSettingDTO;
import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import org.apache.commons.collections.CollectionUtils;
......@@ -32,6 +36,8 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
@Autowired
private WxEnterpriseMapper wxEnterpriseMapper;
@Autowired
private EnterpriseService enterpriseService ;
@Override
public TabHaobanWxEnterpriseRelated getByGicEnterpriseIdByEnterpriseRelatedId(String wxEnterpriseRelatedId) {
......@@ -100,9 +106,20 @@ public class WxEnterpriseRelatedServiceImpl implements WxEnterpriseRelatedServic
if(StringUtils.isNotBlank(unionid) && openCardFlag==0) {
return false ;
}
if(openCardFlag != 0 || wxEnterpriseType !=0) {
String enterpriseId = wxEnterpriseRelated.getEnterpriseId() ;
EnterpriseSettingDTO setting = this.enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId) ;
String customSetting = setting.getCustomSetting() ;
boolean settFlag = true ;
if(StringUtils.isNotBlank(customSetting)) {
JSONObject json = JSON.parseObject(customSetting) ;
String pendingidFlag = json.getString("qwPendingidFlag") ;
if(StringUtils.isBlank(pendingidFlag) || "0".equals(pendingidFlag)) {
settFlag = false ;
}
}
if(openCardFlag == 0 && wxEnterpriseType ==0 && settFlag) {
return true ;
}
return false ;
return true ;
}
}
......@@ -68,13 +68,12 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
String openid = dto.getOpenId() ;
String wxaUnionid = dto.getUnionId() ;
String wxaOpenid = dto.getWxaOpenId() ;
return this.pendingIdCheck(enterpriseId, unionid, openid, wxaUnionid, wxaOpenid);
return this.pendingIdCheck(enterpriseId, unionid, openid, wxaUnionid, wxaOpenid,false);
}
@Override
public ServiceResponse<Map<String, String>> pendingIdCheck(String enterpriseId, String unionid, String openid,
String wxaUnionid, String wxaOpenid) {
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId);
String wxaUnionid, String wxaOpenid , boolean setCheckFlag) {
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,setCheckFlag);
if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
}
......@@ -116,10 +115,16 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
retMap.put("wxaCode", wxaCode);
return ServiceResponse.success(retMap);
}
@Override
public ServiceResponse<Map<String, String>> pendingIdCheck(String enterpriseId, String unionid, String openid,
String wxaUnionid, String wxaOpenid) {
return this.pendingIdCheck(enterpriseId, unionid, openid, wxaUnionid, wxaOpenid, true) ;
}
@Override
public ServiceResponse<QwPendingIdDTO> getPendingIdByUnionid(String enterpriseId, String unionid, String openid) {
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId);
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,true);
if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
}
......@@ -148,7 +153,7 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
@Override
public ServiceResponse<QwPendingIdDTO> getPendingIdByExternalid(String enterpriseId, String externalUserId) {
String suiteid = config.getWxSuiteid();
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId);
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,true);
if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
}
......@@ -177,7 +182,7 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
return ServiceResponse.failure("9999", "外部联系人不能为空且每次最多1000条");
}
String suiteid = config.getWxSuiteid();
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId);
ServiceResponse<WxEnterpriseQwDTO> corpidResp = this.checkAndGetCorpid(enterpriseId,true);
if (!corpidResp.isSuccess()) {
return ServiceResponse.failure(corpidResp.getCode(), corpidResp.getMessage());
}
......@@ -205,20 +210,22 @@ public class QwFriendApiServiceImpl implements QwFriendApiService {
// 2010 不需要处理的
// 判断企业是否能用企微
private ServiceResponse<WxEnterpriseQwDTO> checkAndGetCorpid(String enterpriseId) {
private ServiceResponse<WxEnterpriseQwDTO> checkAndGetCorpid(String enterpriseId,boolean setCheckFlag) {
WxEnterpriseRelationBO enterpriseRelation = this.wxEnterpriseRelatedService.getHeadEnterprise(enterpriseId);
if (null == enterpriseRelation) {
// 非总部或不存在
return ServiceResponse.failure(HaoBanErrCode.ERR_2010.getCode(), "请确认商户是否有效且是总部");
}
EnterpriseSettingDTO setting = this.enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId) ;
String customSetting = setting.getCustomSetting() ;
if(StringUtils.isNotBlank(customSetting)) {
JSONObject json = JSON.parseObject(customSetting) ;
String pendingidFlag = json.getString("qwPendingidFlag") ;
if(StringUtils.isBlank(pendingidFlag) || "0".equals(pendingidFlag)) {
log.info("未配置unionid查询企微外部联系人接口调用");
return ServiceResponse.failure(HaoBanErrCode.ERR_2010.getCode(), "未配置unionid查询企微外部联系人接口调用");
if(setCheckFlag) {
EnterpriseSettingDTO setting = this.enterpriseService.getEnterpriseSettingByEnterpriseId(enterpriseId) ;
String customSetting = setting.getCustomSetting() ;
if(StringUtils.isNotBlank(customSetting)) {
JSONObject json = JSON.parseObject(customSetting) ;
String pendingidFlag = json.getString("qwPendingidFlag") ;
if(StringUtils.isBlank(pendingidFlag) || "0".equals(pendingidFlag)) {
log.info("未配置unionid查询企微外部联系人接口调用");
return ServiceResponse.failure(HaoBanErrCode.ERR_2010.getCode(), "未配置unionid查询企微外部联系人接口调用");
}
}
}
Integer code = this.enterpriseUseForbidService.selectPermissionStatus(enterpriseId,
......
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