Commit dd15f02e by 水库浪子

去除冗余代码

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