Commit 8f0eabe0 by 水库浪子

修改分页标签相关bug

1 parent a67ed39d
...@@ -33,6 +33,8 @@ public class WeCustomerController extends BaseController ...@@ -33,6 +33,8 @@ public class WeCustomerController extends BaseController
@Autowired @Autowired
private IWeCustomerService weCustomerService; private IWeCustomerService weCustomerService;
/** /**
* 查询企业微信客户列表 * 查询企业微信客户列表
*/ */
...@@ -41,6 +43,7 @@ public class WeCustomerController extends BaseController ...@@ -41,6 +43,7 @@ public class WeCustomerController extends BaseController
public TableDataInfo list(WeCustomer weCustomer) public TableDataInfo list(WeCustomer weCustomer)
{ {
startPage(); startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer); List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
return getDataTable(list); return getDataTable(list);
} }
......
...@@ -7,8 +7,11 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -7,8 +7,11 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.utils.Threads;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; 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.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.PutMapping;
...@@ -41,6 +44,19 @@ public class WeTagGroupController extends BaseController ...@@ -41,6 +44,19 @@ public class WeTagGroupController extends BaseController
public TableDataInfo list(WeTagGroup weTagGroup) public TableDataInfo list(WeTagGroup weTagGroup)
{ {
startPage(); startPage();
SecurityContext securityContext = SecurityContextHolder.getContext();
//异步同步一下标签库,解决标签不同步问题
Threads.SINGLE_THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
SecurityContextHolder.setContext(securityContext);
weTagGroupService.synchWeTags();
}
});
return getDataTable( return getDataTable(
weTagGroupService.selectWeTagGroupList(weTagGroup) weTagGroupService.selectWeTagGroupList(weTagGroup)
); );
......
...@@ -156,4 +156,8 @@ public class Constants ...@@ -156,4 +156,8 @@ public class Constants
} }
...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.api.R; ...@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.extension.api.R;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.linkwechat.common.constant.Constants; import com.linkwechat.common.constant.Constants;
import com.linkwechat.common.constant.UserConstants;
import com.linkwechat.common.constant.WeConstans; import com.linkwechat.common.constant.WeConstans;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
...@@ -203,7 +204,6 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr ...@@ -203,7 +204,6 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr
@Transactional @Transactional
public void synchWeTags() { public void synchWeTags() {
WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getAllCorpTagList(); WeCropGroupTagListDto weCropGroupTagListDto = weCropTagClient.getAllCorpTagList();
if(weCropGroupTagListDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)){ if(weCropGroupTagListDto.getErrcode().equals(WeConstans.WE_SUCCESS_CODE)){
...@@ -248,17 +248,43 @@ public class WeTagGroupServiceImpl extends ServiceImpl<WeTagGroupMapper,WeTagGr ...@@ -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(weTagGroups)){
if(CollectionUtil.isNotEmpty(weTags)){
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!