Commit cc4f54bb by 水库浪子

修改分页标签相关bug

1 parent 272e0a20
......@@ -33,6 +33,8 @@ public class WeCustomerController extends BaseController
@Autowired
private IWeCustomerService weCustomerService;
/**
* 查询企业微信客户列表
*/
......@@ -41,6 +43,7 @@ public class WeCustomerController extends BaseController
public TableDataInfo list(WeCustomer weCustomer)
{
startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
return getDataTable(list);
}
......
......@@ -7,8 +7,11 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.Threads;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
......@@ -41,6 +44,19 @@ public class WeTagGroupController extends BaseController
public TableDataInfo list(WeTagGroup weTagGroup)
{
startPage();
SecurityContext securityContext = SecurityContextHolder.getContext();
//异步同步一下标签库,解决标签不同步问题
Threads.SINGLE_THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
SecurityContextHolder.setContext(securityContext);
weTagGroupService.synchWeTags();
}
});
return getDataTable(
weTagGroupService.selectWeTagGroupList(weTagGroup)
);
......
......@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.UserConstants;
import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils;
......@@ -203,7 +204,6 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
@Transactional
public void synchWeTags() {
WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getAllCorpTagList();
if(weCropGroupTagListDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)){
......@@ -248,17 +248,43 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
}
this.saveOrUpdateBatch(weTagGroups);
List<WeTag> weTags =
weTagGroups.stream().map(WeTagGroup::getWeTags).collect(ArrayList::new, ArrayList::addAll, ArrayList::addAll);
if(CollectionUtil.isNotEmpty(weTags)){
//先逻辑删除不存在得组
if(CollectionUtil.isNotEmpty(weTagGroups)){
List<WeTagGroup> noExist
= this.list(new LambdaQueryWrapper<WeTagGroup>().notIn(WeTagGroup::getGroupId, weTagGroups.stream().map(WeTagGroup::getGroupId).collect(Collectors.toList())));
//企业微信端删除得标签
if(CollectionUtil.isNotEmpty(noExist)){
noExist.stream().forEach(k->k.setStatus(Constants.DELETE_CODE));
this.updateBatchById(noExist);
}
this.saveOrUpdateBatch(weTagGroups);
List<WeTag> weTags =
weTagGroups.stream().map(WeTagGroup::getWeTags).collect(ArrayList::new, ArrayList::addAll, ArrayList::addAll);
if(CollectionUtil.isNotEmpty(weTags)){
List<WeTag> noExistWeTags
= iWeTagService.list(new LambdaQueryWrapper<WeTag>().notIn(WeTag::getTagId, weTags.stream().map(WeTag::getTagId).collect(Collectors.toList())));
if(CollectionUtil.isNotEmpty(noExistWeTags)){
noExistWeTags.stream().forEach(k->k.setStatus(Constants.DELETE_CODE));
iWeTagService.updateBatchById(noExistWeTags);
}
iWeTagService.saveOrUpdateBatch(weTags);
}
iWeTagService.saveOrUpdateBatch(weTags);
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!