Commit 9afd6d7f by 徐高华

查询企微id信息

parent 37c82534
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
public class WxEnterpriseQwDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String wxEnterpriseId;
// 企业表中的id(正常同第三方)
private String corpid;
// 好办 助手
private String dkCorpid;
// 会员小程序dk
private String memberCorpid;
// 第三方
private String thirdCorpid;
// 自建
private String selfCorpid;
public String getSelfCorpid() {
return selfCorpid;
}
public void setSelfCorpid(String selfCorpid) {
this.selfCorpid = selfCorpid;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public String getCorpid() {
return corpid;
}
public String getDkCorpid() {
return dkCorpid;
}
public String getMemberCorpid() {
return memberCorpid;
}
public String getThirdCorpid() {
return thirdCorpid;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
public void setCorpid(String corpid) {
this.corpid = corpid;
}
public void setDkCorpid(String dkCorpid) {
this.dkCorpid = dkCorpid;
}
public void setMemberCorpid(String memberCorpid) {
this.memberCorpid = memberCorpid;
}
public void setThirdCorpid(String thirdCorpid) {
this.thirdCorpid = thirdCorpid;
}
}
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication; import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
public interface WxApplicationMapper { public interface WxApplicationMapper {
int insertSelective(TabHaobanWxApplication record); int insertSelective(TabHaobanWxApplication record);
...@@ -37,4 +40,6 @@ public interface WxApplicationMapper { ...@@ -37,4 +40,6 @@ public interface WxApplicationMapper {
* @date 2022-06-30 19:19:19 * @date 2022-06-30 19:19:19
*/ */
int updateCorpidById(@Param("wxApplicationId") String wxApplicationId, @Param("corpid") String corpid); int updateCorpidById(@Param("wxApplicationId") String wxApplicationId, @Param("corpid") String corpid);
List<TabHaobanWxApplication> listApplication(@Param("wxEnterpriseId")String wxEnterpriseId) ;
} }
\ No newline at end of file
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.List;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import java.util.List;
public interface WxEnterpriseService { public interface WxEnterpriseService {
String add(WxEnterpriseDTO wxDTO); String add(WxEnterpriseDTO wxDTO);
WxEnterpriseDTO selectById(String wxEnterpriseId); WxEnterpriseDTO selectById(String wxEnterpriseId);
/**
*
* @Title: getQwInfo
* @Description: 获取商户企微信息
* @author xugh
* @param wxEnterpriseId
* @return
* @throws
*/
WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId);
/** /**
* 通过微信企业ID查询好办企业ID * 通过微信企业ID查询好办企业ID
...@@ -18,15 +31,6 @@ public interface WxEnterpriseService { ...@@ -18,15 +31,6 @@ public interface WxEnterpriseService {
*/ */
TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId); TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId);
/**
* 通过微信企业ID查询删除状态好办企业ID
*
* @param corpId
* @return
*/
@Deprecated
TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId);
void update(WxEnterpriseDTO enterpriseDTO); void update(WxEnterpriseDTO enterpriseDTO);
int delete(String wxEnterpriseId); int delete(String wxEnterpriseId);
......
...@@ -17,8 +17,11 @@ import com.gic.commons.util.EntityUtil; ...@@ -17,8 +17,11 @@ import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.DingUtils; import com.gic.haoban.common.utils.DingUtils;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.service.dao.mapper.WxApplicationMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper;
import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.WxEnterpriseRelatedMapper;
import com.gic.haoban.manage.service.entity.TabHaobanWxApplication;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise;
import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated; import com.gic.haoban.manage.service.entity.TabHaobanWxEnterpriseRelated;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
...@@ -31,6 +34,8 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -31,6 +34,8 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
private WxEnterpriseMapper mapper; private WxEnterpriseMapper mapper;
@Autowired @Autowired
private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ; private WxEnterpriseRelatedMapper wxEnterpriseRelatedMapper ;
@Autowired
private WxApplicationMapper wxApplicationMapper ;
@Override @Override
public String add(WxEnterpriseDTO wxDTO) { public String add(WxEnterpriseDTO wxDTO) {
...@@ -53,7 +58,32 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -53,7 +58,32 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
} }
return EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, mapper.selectByPrimaryKey(wxEnterpriseId)); return EntityUtil.changeEntityByJSON(WxEnterpriseDTO.class, mapper.selectByPrimaryKey(wxEnterpriseId));
} }
@Override
public WxEnterpriseQwDTO getQwInfo(String wxEnterpriseId) {
TabHaobanWxEnterprise wxEnterprise = this.mapper.selectByPrimaryKey(wxEnterpriseId) ;
WxEnterpriseQwDTO qw = new WxEnterpriseQwDTO();
qw.setCorpid(wxEnterprise.getCorpid());
qw.setWxEnterpriseId(wxEnterpriseId);
List<TabHaobanWxApplication> applictionList = this.wxApplicationMapper.listApplication(wxEnterpriseId) ;
if(CollectionUtils.isNotEmpty(applictionList)) {
applictionList.forEach(app->{
Integer appType = app.getApplicationType() ;
if(appType==2) {
qw.setThirdCorpid(app.getCorpid());
}else if(appType.equals(3)) {
qw.setDkCorpid(app.getCorpid());
}else if(appType.equals(4)) {
qw.setMemberCorpid(app.getCorpid());
}
});
}
qw.setSelfCorpid(wxEnterprise.getCorpid());
logger.info("企微企业ID={}",JSON.toJSON(qw));
return qw;
}
@Override @Override
public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) { public TabHaobanWxEnterprise getEnterpriseBycorpId(String corpId) {
if (StringUtils.isBlank(corpId)) { if (StringUtils.isBlank(corpId)) {
...@@ -63,11 +93,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService { ...@@ -63,11 +93,6 @@ public class WxEnterpriseServiceImpl implements WxEnterpriseService {
} }
@Override @Override
public TabHaobanWxEnterprise getDelEnterpriseBycorpId(String corpId) {
return mapper.getEnterpriseBycorpId(corpId, 0);
}
@Override
public void update(WxEnterpriseDTO enterpriseDTO) { public void update(WxEnterpriseDTO enterpriseDTO) {
enterpriseDTO.setUpdateTime(new Date()); enterpriseDTO.setUpdateTime(new Date());
mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanWxEnterprise.class, enterpriseDTO)); mapper.updateByPrimaryKeySelective(EntityUtil.changeEntityByJSON(TabHaobanWxEnterprise.class, enterpriseDTO));
......
package com.gic.haoban.manage.service.task; package com.gic.haoban.manage.service.task;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -9,6 +19,7 @@ import com.gic.haoban.manage.api.dto.DealParamMqDTO; ...@@ -9,6 +19,7 @@ import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.DepartmentDTO; import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO; import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum; import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum; import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
...@@ -17,21 +28,16 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -17,21 +28,16 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog; import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask; import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/** /**
* 同步通讯录部门 * 同步通讯录部门
...@@ -167,7 +173,13 @@ public class QywxDeptSyncOperation implements BaseSyncOperation { ...@@ -167,7 +173,13 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
//根级部门 //根级部门
List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(wxEnterpriseDTO.getCorpid(), secretSetting.getSecretVal(), dataId, 1); List<UserDTO> list = this.qywxUserApiService.listSelfDepartmentUser(wxEnterpriseDTO.getCorpid(), secretSetting.getSecretVal(), dataId, 1);
logger.info("第三方的通讯录={}",this.qywxUserApiService.listDepartmentUser(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), dataId, 1)) ; WxEnterpriseQwDTO wxInfo = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
logger.info("第三方的通讯录={}",JSON.toJSONString(wxInfo));
logger.info("第三方的通讯录={}",this.qywxUserApiService.listDepartmentUser(wxEnterpriseDTO.getCorpid(), config.getWxSuiteid(), dataId, 1)) ;
logger.info("第三方的通讯录={}",this.qywxUserApiService.listDepartmentUser(wxInfo.getCorpid(), config.getWxSuiteid(), dataId, 1)) ;
logger.info("第三方的通讯录={}",this.qywxUserApiService.listDepartmentUser(wxInfo.getDkCorpid(), config.getWxSuiteid(), dataId, 1)) ;
logger.info("第三方的通讯录={}",this.qywxUserApiService.listDepartmentUser(wxInfo.getMemberCorpid(), config.getWxSuiteid(), dataId, 1)) ;
if (null == list) { if (null == list) {
logger.info("微信获取部门成员异常:{},{}", taskId, dataId); logger.info("微信获取部门成员异常:{},{}", taskId, dataId);
......
...@@ -57,11 +57,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation { ...@@ -57,11 +57,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
@Autowired @Autowired
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired @Autowired
private WxApplicationMapper wxApplicationMapper;
@Autowired
private Config config; private Config config;
@Autowired
private SecretSettingService secretSettingService;
@Override @Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) { public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
......
...@@ -197,5 +197,10 @@ ...@@ -197,5 +197,10 @@
where wx_application_id = #{wxApplicationId} where wx_application_id = #{wxApplicationId}
and status_flag = 1 and status_flag = 1
</update> </update>
<select id="listApplication" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from
tab_haoban_wx_application where wx_enterprise_id = #{wxEnterpriseId} and status_flag = 1
</select>
</mapper> </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