Commit 5c8b35c5 by 水库浪子 Committed by Gitee

Merge branch 'multi-tenant-lw' of gitee.com:LinkWeChat/link-wechat into back_end_dev

2 parents acc97c65 bd3531b9
...@@ -22,7 +22,6 @@ import org.springframework.scheduling.annotation.EnableAsync; ...@@ -22,7 +22,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
public class LinkWeChatApplication { public class LinkWeChatApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(LinkWeChatApplication.class, args); SpringApplication.run(LinkWeChatApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" + System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" + " .-------. ____ __ \n" +
......
...@@ -13,6 +13,9 @@ import io.swagger.annotations.Api; ...@@ -13,6 +13,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -157,15 +160,20 @@ public class WeUserController extends BaseController { ...@@ -157,15 +160,20 @@ public class WeUserController extends BaseController {
*/ */
// @PreAuthorize("@ss.hasPermi('contacts:organization:sync')") // @PreAuthorize("@ss.hasPermi('contacts:organization:sync')")
@GetMapping({"/synchWeUser"}) @GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser() { public AjaxResult synchWeUser(){
try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weUserService.synchWeUser(); weUserService.synchWeUser();
} catch (Exception e) {
e.printStackTrace();
}
return AjaxResult.success(WeConstans.SYNCH_TIP); return AjaxResult.success(WeConstans.SYNCH_TIP);
} }
/** /**
* 删除用户 * 删除用户
* *
......
...@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -94,7 +95,13 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa ...@@ -94,7 +95,13 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
item.setReceiveWeUser(weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, item.getReceiveId()))); item.setReceiveWeUser(weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, item.getReceiveId())));
} else if (WeConstans.ID_TYPE_EX.equals(item.getIsCustom())) { } else if (WeConstans.ID_TYPE_EX.equals(item.getIsCustom())) {
//获取外部联系人信息 //获取外部联系人信息
item.setReceiveWeCustomer(weCustomerMapper.selectWeCustomerById(item.getReceiveId())); WeCustomer weCustomer = weCustomerMapper.selectWeCustomerById(item.getReceiveId());
if(null == weCustomer){
weCustomer=new WeCustomer();
}
item.setReceiveWeCustomer(
weCustomer
);
} else if (WeConstans.ID_TYPE_MACHINE.equals(item.getIsCustom())) { } else if (WeConstans.ID_TYPE_MACHINE.equals(item.getIsCustom())) {
//拉去机器人信息暂不处理 //拉去机器人信息暂不处理
} }
...@@ -233,7 +240,15 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa ...@@ -233,7 +240,15 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
.eq(WeChatContactMapping::getIsCustom, WeConstans.ID_TYPE_EX); .eq(WeChatContactMapping::getIsCustom, WeConstans.ID_TYPE_EX);
List<WeChatContactMapping> weChatContactMappingList = this.baseMapper.selectList(lambdaQueryWrapper); List<WeChatContactMapping> weChatContactMappingList = this.baseMapper.selectList(lambdaQueryWrapper);
List<WeCustomer> resultList = Optional.ofNullable(weChatContactMappingList).orElseGet(ArrayList::new) List<WeCustomer> resultList = Optional.ofNullable(weChatContactMappingList).orElseGet(ArrayList::new)
.stream().map(item -> weCustomerMapper.selectWeCustomerById(item.getReceiveId())).collect(Collectors.toList()); .stream().map(item ->
weCustomerMapper.selectWeCustomerById(item.getReceiveId())
).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(resultList)){
resultList.removeAll(Collections.singleton(null));
}
PageInfo<WeCustomer> weCustomerPageInfo = new PageInfo<>(resultList); PageInfo<WeCustomer> weCustomerPageInfo = new PageInfo<>(resultList);
weCustomerPageInfo.setTotal(new PageInfo<>(weChatContactMappingList).getTotal()); weCustomerPageInfo.setTotal(new PageInfo<>(weChatContactMappingList).getTotal());
return weCustomerPageInfo; return weCustomerPageInfo;
......
...@@ -10,8 +10,8 @@ import com.linkwechat.wecom.client.WeMessagePushClient; ...@@ -10,8 +10,8 @@ import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.dto.WeMessagePushDto; import com.linkwechat.wecom.domain.dto.WeMessagePushDto;
import com.linkwechat.wecom.domain.dto.message.TextMessageDto; import com.linkwechat.wecom.domain.dto.message.TextMessageDto;
import com.linkwechat.wecom.domain.vo.WeGroupSopVo;
import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo; import com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo;
import com.linkwechat.wecom.domain.vo.WeGroupSopVo;
import com.linkwechat.wecom.domain.vo.WeMaterialVo; import com.linkwechat.wecom.domain.vo.WeMaterialVo;
import com.linkwechat.wecom.mapper.*; import com.linkwechat.wecom.mapper.*;
import com.linkwechat.wecom.service.IWeCorpAccountService; import com.linkwechat.wecom.service.IWeCorpAccountService;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!