Commit bd3531b9 by 水库浪子

修改返回相关BUG

1 parent a5730b00
......@@ -22,7 +22,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
public class LinkWeChatApplication {
public static void main(String[] args) {
SpringApplication.run(LinkWeChatApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ LinkWeChat启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
......
......@@ -13,6 +13,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.web.bind.annotation.*;
......@@ -157,15 +160,20 @@ public class WeUserController extends BaseController {
*/
// @PreAuthorize("@ss.hasPermi('contacts:organization:sync')")
@GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser() {
public AjaxResult synchWeUser(){
try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weUserService.synchWeUser();
} catch (Exception e) {
e.printStackTrace();
}
return AjaxResult.success(WeConstans.SYNCH_TIP);
}
/**
* 删除用户
*
......
......@@ -255,10 +255,10 @@
<version>1.68</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.github.jsqlparser</groupId>-->
<!-- <artifactId>jsqlparser</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
</dependency>
</dependencies>
......
......@@ -32,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
......@@ -94,7 +95,13 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
item.setReceiveWeUser(weUserMapper.selectOne(new LambdaQueryWrapper<WeUser>().eq(WeUser::getUserId, item.getReceiveId())));
} 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())) {
//拉去机器人信息暂不处理
}
......@@ -233,7 +240,15 @@ public class WeChatContactMappingServiceImpl extends ServiceImpl<WeChatContactMa
.eq(WeChatContactMapping::getIsCustom, WeConstans.ID_TYPE_EX);
List<WeChatContactMapping> weChatContactMappingList = this.baseMapper.selectList(lambdaQueryWrapper);
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);
weCustomerPageInfo.setTotal(new PageInfo<>(weChatContactMappingList).getTotal());
return weCustomerPageInfo;
......
......@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.CommunityTaskType;
import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.StringUtils;
......@@ -9,8 +10,8 @@ import com.linkwechat.wecom.client.WeMessagePushClient;
import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.dto.WeMessagePushDto;
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.WeGroupSopVo;
import com.linkwechat.wecom.domain.vo.WeMaterialVo;
import com.linkwechat.wecom.mapper.*;
import com.linkwechat.wecom.service.IWeCorpAccountService;
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.core.domain.entity.WeCorpAccount;
import com.linkwechat.common.enums.ChatType;
import com.linkwechat.common.enums.MediaType;
import com.linkwechat.common.enums.TaskSendType;
......
......@@ -287,6 +287,12 @@
<version>${nacos.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.jsqlparser/jsqlparser -->
<dependency>
<groupId>com.github.jsqlparser</groupId>
<artifactId>jsqlparser</artifactId>
<version>1.4</version>
</dependency>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!