|
|
@@ -1,14 +1,18 @@
|
|
|
package com.linkwechat.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.linkwechat.common.core.domain.AjaxResult;
|
|
|
+import com.linkwechat.common.core.domain.entity.SysUser;
|
|
|
import com.linkwechat.common.core.domain.model.LoginUser;
|
|
|
import com.linkwechat.common.core.page.TableDataInfo;
|
|
|
+import com.linkwechat.common.enums.WeErrorCodeEnum;
|
|
|
import com.linkwechat.common.exception.CustomException;
|
|
|
import com.linkwechat.common.utils.WxMiniProgramSchemeUtil;
|
|
|
+import com.linkwechat.domain.groupchat.vo.LinkGroupChatListVo;
|
|
|
import com.linkwechat.domain.weGroupFission.bdsh.LocalMerchantInfo;
|
|
|
import com.linkwechat.domain.weGroupFission.bdsh.LocalRightsInfo;
|
|
|
import com.linkwechat.domain.weGroupFission.bdsh.LotteryActivity;
|
|
|
@@ -19,6 +23,15 @@ import com.linkwechat.domain.weGroupFission.entity.WeGroupFission;
|
|
|
import com.linkwechat.domain.weGroupFission.entity.WeGroupFissionExtraRecord;
|
|
|
import com.linkwechat.domain.weGroupFission.entity.WeGroupFissionStepRecord;
|
|
|
import com.linkwechat.domain.weGroupFission.vo.*;
|
|
|
+import com.linkwechat.domain.wecom.query.WeBaseQuery;
|
|
|
+import com.linkwechat.domain.wecom.query.customer.WeCustomerQuery;
|
|
|
+import com.linkwechat.domain.wecom.query.customer.groupchat.WeGroupChatDetailQuery;
|
|
|
+import com.linkwechat.domain.wecom.query.customer.groupchat.WeGroupChatListQuery;
|
|
|
+import com.linkwechat.domain.wecom.vo.customer.WeCustomerDetailVo;
|
|
|
+import com.linkwechat.domain.wecom.vo.customer.WeFollowUserListVo;
|
|
|
+import com.linkwechat.domain.wecom.vo.customer.groupchat.WeGroupChatDetailVo;
|
|
|
+import com.linkwechat.domain.wecom.vo.customer.groupchat.WeGroupChatListVo;
|
|
|
+import com.linkwechat.fegin.QwCustomerClient;
|
|
|
import com.linkwechat.framework.service.TokenService;
|
|
|
import com.linkwechat.mapper.WeGroupFissionMapper;
|
|
|
import com.linkwechat.service.*;
|
|
|
@@ -64,6 +77,12 @@ public class WeGroupFissionServiceImpl extends ServiceImpl<WeGroupFissionMapper,
|
|
|
@Autowired
|
|
|
private LocalRightsInfoService localRightsInfoService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IWeGroupService weGroupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private QwCustomerClient qwCustomerClient;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @version
|
|
|
@@ -411,34 +430,23 @@ public class WeGroupFissionServiceImpl extends ServiceImpl<WeGroupFissionMapper,
|
|
|
@Override
|
|
|
public List<DistDto> getWecomGroupList() {
|
|
|
List<DistDto> list = new ArrayList<>();
|
|
|
- DistDto dto = new DistDto();
|
|
|
- dto.setVal("1");
|
|
|
- dto.setName("企业微信群1");
|
|
|
- DistDto dto2 = new DistDto();
|
|
|
- dto2.setVal("2");
|
|
|
- dto2.setName("企业微信群2");
|
|
|
- list.add(dto2);
|
|
|
- try {
|
|
|
- /* WxCpExternalContactService externalContactService = wxCpService.getExternalContactService();
|
|
|
- WxCpUserExternalGroupChatList wxCpUserExternalGroupChatList = externalContactService.listGroupChat(0, 1000, 0, null,null);
|
|
|
- // 3. 处理返回结果(打印群信息)
|
|
|
- if (wxCpUserExternalGroupChatList != null ) {
|
|
|
- List<WxCpUserExternalGroupChatList.ChatStatus> groupChatList = wxCpUserExternalGroupChatList.getGroupChatList();
|
|
|
- System.out.println("查询成功!获取到 " + groupChatList.size() + " 个企业群");
|
|
|
- for (WxCpUserExternalGroupChatList.ChatStatus groupChat : groupChatList) {
|
|
|
- DistDto dto =new DistDto();
|
|
|
- dto.setVal(groupChat.getChatId());
|
|
|
- dto.setName(groupChat.getChatId());
|
|
|
- System.out.println("------------------------");
|
|
|
- System.out.println("群 ID:" + groupChat.getChatId());
|
|
|
- System.out.println("群状态:" + groupChat.getStatus());
|
|
|
- }
|
|
|
- } else {
|
|
|
- System.out.println("查询成功,但未获取到任何企业群(可能无群或权限不足)");
|
|
|
- }*/
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println("查询企业群列表失败,异常信息:" + e.getMessage());
|
|
|
- e.printStackTrace(); // 打印详细堆栈,方便排查问题
|
|
|
+ List<WeGroupChatListVo.GroupChat> groupChatList=new ArrayList<>();
|
|
|
+ WeGroupChatListQuery chatListQuery =new WeGroupChatListQuery(0, null, null, 1000) ;
|
|
|
+ WeGroupChatListVo groupChatListVo = qwCustomerClient.getGroupChatList(chatListQuery).getData();
|
|
|
+ if (groupChatListVo.getErrCode().equals(WeErrorCodeEnum.ERROR_CODE_0.getErrorCode())
|
|
|
+ && CollectionUtil.isNotEmpty(groupChatListVo.getGroupChatList())) {
|
|
|
+ groupChatList.addAll(groupChatListVo.getGroupChatList());
|
|
|
+ }
|
|
|
+ if(groupChatList!=null && !groupChatList.isEmpty()){
|
|
|
+ for (WeGroupChatListVo.GroupChat groupChat : groupChatList) {
|
|
|
+ WeGroupChatDetailQuery weGroupChatDetailQuery =new WeGroupChatDetailQuery();
|
|
|
+ weGroupChatDetailQuery.setChat_id("wwfe67d19509d43ec5");
|
|
|
+ AjaxResult<WeGroupChatDetailVo> groupChatDetail = qwCustomerClient.getGroupChatDetail(weGroupChatDetailQuery);
|
|
|
+ DistDto dto = new DistDto();
|
|
|
+ dto.setVal(groupChat.getChatId());
|
|
|
+ dto.setName(groupChatDetail.getData().getGroupChat().getName());
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
}
|
|
|
return list;
|
|
|
}
|
|
|
@@ -450,7 +458,43 @@ public class WeGroupFissionServiceImpl extends ServiceImpl<WeGroupFissionMapper,
|
|
|
*/
|
|
|
@Override
|
|
|
public List<DistDto> getWecomEmployeeList() {
|
|
|
- return getWecomGroupList();
|
|
|
+ List<DistDto> list = new ArrayList<>();
|
|
|
+ WeBaseQuery query = new WeBaseQuery();
|
|
|
+ query.setCorpid("wwfe67d19509d43ec5");
|
|
|
+ AjaxResult<WeFollowUserListVo> result = qwCustomerClient.getFollowUserList(query);
|
|
|
+ if(result!=null ){
|
|
|
+ for (String followUserId : result.getData().getFollowUser()) {
|
|
|
+ WeCustomerQuery weCustomerQuery = new WeCustomerQuery();
|
|
|
+ weCustomerQuery.setExternal_userid(followUserId);
|
|
|
+ weCustomerQuery.setCorpid("wwfe67d19509d43ec5");
|
|
|
+ WeCustomerDetailVo customerDetail = qwCustomerClient.getCustomerDetail(weCustomerQuery).getData();
|
|
|
+ DistDto dto = new DistDto();
|
|
|
+ dto.setVal(customerDetail.getExternalContact().getExternalUserId());
|
|
|
+ dto.setName(customerDetail.getExternalContact().getName());
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @version
|
|
|
+ * @author: hxl
|
|
|
+ * @Date: 2026/2/2 11:10
|
|
|
+ * @Description: 获取用户列表
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<DistDto> getUserDictDtos() {
|
|
|
+ List<DistDto> list = new ArrayList<>();
|
|
|
+ List<SysUser> userList = this.getBaseMapper().getUserDictList();
|
|
|
+ if(userList != null && userList.size() > 0){
|
|
|
+ for(SysUser sysUser : userList){
|
|
|
+ DistDto dto = new DistDto();
|
|
|
+ dto.setVal(sysUser.getUserId()+"");
|
|
|
+ dto.setName(sysUser.getUserName());
|
|
|
+ list.add(dto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return list;
|
|
|
}
|
|
|
/**
|
|
|
* @version
|