Commit dd15f02e by 水库浪子

去除冗余代码

1 parent aeab9b94
......@@ -13,8 +13,6 @@ import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.service.IWeCustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
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.*;
......@@ -46,7 +44,6 @@ public class WeCustomerController extends BaseController
public TableDataInfo list(WeCustomer weCustomer)
{
startPage();
List<WeCustomer> list = weCustomerService.selectWeCustomerList(weCustomer);
return getDataTable(list);
}
......@@ -111,9 +108,6 @@ public class WeCustomerController extends BaseController
@GetMapping("/synchWeCustomer")
public AjaxResult synchWeCustomer() {
try {
SecurityContext context = SecurityContextHolder.getContext();
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
SecurityContextHolder.setContext(context);
weCustomerService.synchWeCustomer();
} catch (Exception e) {
e.printStackTrace();
......
......@@ -164,9 +164,6 @@ public class WeUserController extends BaseController {
@GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser(){
try {
// SecurityContext context = SecurityContextHolder.getContext();
// SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_INHERITABLETHREADLOCAL);
// SecurityContextHolder.setContext(context);
weUserService.synchWeUser();
} catch (Exception e) {
e.printStackTrace();
......
......@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.linkwechat.common.annotation.Excel;
import com.linkwechat.common.core.domain.BaseEntity;
import com.linkwechat.common.utils.SnowFlakeUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -34,6 +35,7 @@ public class WeCustomer extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 外部联系人的userid
*/
......
......@@ -36,6 +36,10 @@ public class WeFlowerCustomerTagRel
/** 添加客户的企业微信用户 */
private Long flowerCustomerRelId;
/**外部联系人id(客户id) */
private String externalUserid;
/** 标签id */
private String tagId;
......
......@@ -142,11 +142,9 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
FollowUserList followUserList = weCustomerClient.getFollowUserList();
if (WeConstans.WE_SUCCESS_CODE.equals(followUserList.getErrcode())
&& ArrayUtil.isNotEmpty(followUserList.getFollow_user())) {
SecurityContext securityContext = SecurityContextHolder.getContext();
Arrays.asList(followUserList.getFollow_user())
.parallelStream().forEach(k -> {
try {
SecurityContextHolder.setContext(securityContext);
weFlowerCustomerHandle(k);
} catch (Exception e) {
e.printStackTrace();
......@@ -203,7 +201,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
WeTagGroup.builder()
.groupId(tagGroup.getGroup_id())
.gourpName(tagGroup.getGroup_name())
.createBy(SecurityUtils.getUsername())
// .createBy(SecurityUtils.getUsername())
.build()
);
......@@ -222,6 +220,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weFlowerCustomerTagRels.add(
WeFlowerCustomerTagRel.builder()
.externalUserid(weCustomer.getExternalUserid())
.flowerCustomerRelId(weFlowerCustomerRelId)
.tagId(tag)
.createTime(new Date())
......@@ -392,6 +391,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
tagRels.add(
WeFlowerCustomerTagRel.builder()
.flowerCustomerRelId(customer.getId())
.externalUserid(customer.getExternalUserid())
.tagId(tag.getTagId())
.createTime(new Date())
.build()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!