Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit a20ab7a9
authored
Sep 17, 2020
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加客户来源
1 parent
36913558
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
172 additions
and
158 deletions
linkwe-common/src/main/java/com/linkwechat/common/enums/CustomerSource.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeCustomerDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeFollowUserDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeUserDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-common/src/main/java/com/linkwechat/common/enums/CustomerSource.java
0 → 100644
View file @
a20ab7a
package
com
.
linkwechat
.
common
.
enums
;
public
enum
CustomerSource
{
// CUSTOMER_SOURCE_WZLY(0,""),
// CUSTOMER_SOURCE_SMEWM(0,),
// CUSTOMER_SOURCE_SSSJH(0,),
// CUSTOMER_SOURCE_MPFX(0,),
// CUSTOMER_SOURCE_QL(0,),
// CUSTOMER_SOURCE_SJTXL(0,),
// CUSTOMER_SOURCE_WXLXR(0,),
// CUSTOMER_SOURCE_TJHYSQ(0,),
// CUSTOMER_SOURCE_DSFRJTJ(0,),
// CUSTOMER_SOURCE_YXSS(0,),
// CUSTOMER_SOURCE_NBCYGX(0,),
// CUSTOMER_SOURCE_GLRYFP(0,)
// ;
//
// private Integer code;
//
// private String label;
//
// private CustomerSource(Integer code, String label){
// this.code = code;
// this.label = label;
// }
//
// public Integer getCode() {
// return code;
// }
//
// public OrderType setCode(Integer code) {
// this.code = code;
// return this;
// }
//
// public String getLabel() {
// return label;
// }
//
// public OrderType setLabel(String label) {
// this.label = label;
// return this;
// }
//
// public OrderType getOrderTypeByCode(Integer code){
// OrderType[] orderTypes = OrderType.values();
// for(OrderType orderType:orderTypes){
// if(orderType.getCode().equals(code)){
// return orderType;
// }
// }
// throw new RuntimeException("未知的订单类型");
// }
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
View file @
a20ab7a
...
...
@@ -3,6 +3,11 @@ package com.linkwechat.wecom.domain;
import
java.util.Date
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
...
@@ -12,12 +17,16 @@ import org.apache.commons.lang3.builder.ToStringStyle;
* @author ruoyi
* @date 2020-09-13
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
WeCustomer
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
private
Long
id
;
private
Long
id
=
SnowFlakeUtil
.
nextId
();
;
/** 外部联系人的userid */
private
String
externalUserid
;
...
...
@@ -29,10 +38,10 @@ public class WeCustomer extends BaseEntity
private
String
avatar
;
/** 外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户 */
private
Long
type
;
private
Integer
type
;
/** 外部联系人性别 0-未知 1-男性 2-女性 */
private
Long
gender
;
private
Integer
gender
;
/** 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。 */
private
String
unionid
;
...
...
@@ -56,154 +65,20 @@ public class WeCustomer extends BaseEntity
/** 客户备注的手机号码 */
private
String
remarkMobiles
;
/** 客户备注的企业名称 */
private
String
remarkCorpName
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
void
setExternalUserid
(
String
externalUserid
)
{
this
.
externalUserid
=
externalUserid
;
}
public
String
getExternalUserid
()
{
return
externalUserid
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getName
()
{
return
name
;
}
public
void
setAvatar
(
String
avatar
)
{
this
.
avatar
=
avatar
;
}
public
String
getAvatar
()
{
return
avatar
;
}
public
void
setType
(
Long
type
)
{
this
.
type
=
type
;
}
public
Long
getType
()
{
return
type
;
}
public
void
setGender
(
Long
gender
)
{
this
.
gender
=
gender
;
}
public
Long
getGender
()
{
return
gender
;
}
public
void
setUnionid
(
String
unionid
)
{
this
.
unionid
=
unionid
;
}
public
String
getUnionid
()
{
return
unionid
;
}
public
void
setBirthday
(
Date
birthday
)
{
this
.
birthday
=
birthday
;
}
public
Date
getBirthday
()
{
return
birthday
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getUserName
()
{
return
userName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setRemarkMobiles
(
String
remarkMobiles
)
{
this
.
remarkMobiles
=
remarkMobiles
;
}
public
String
getRemarkMobiles
()
{
return
remarkMobiles
;
}
public
void
setRemarkCorpName
(
String
remarkCorpName
)
{
this
.
remarkCorpName
=
remarkCorpName
;
}
public
String
getRemarkCorpName
()
{
return
remarkCorpName
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"externalUserid"
,
getExternalUserid
())
.
append
(
"name"
,
getName
())
.
append
(
"avatar"
,
getAvatar
())
.
append
(
"type"
,
getType
())
.
append
(
"gender"
,
getGender
())
.
append
(
"unionid"
,
getUnionid
())
.
append
(
"birthday"
,
getBirthday
())
.
append
(
"userId"
,
getUserId
())
.
append
(
"userName"
,
getUserName
())
.
append
(
"createTime"
,
getCreateTime
())
.
append
(
"departmentName"
,
getDepartmentName
())
.
append
(
"description"
,
getDescription
())
.
append
(
"remarkMobiles"
,
getRemarkMobiles
())
.
append
(
"remarkCorpName"
,
getRemarkCorpName
())
.
toString
();
}
/** 客户企业简称 */
private
String
corpName
;
/** 客户企业全称 */
private
String
corpFullName
;
/** 职位 */
private
String
position
;
/** 客户来源 */
private
String
addWay
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeCustomerDto.java
View file @
a20ab7a
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.bean.BeanUtils
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
lombok.Data
;
import
java.util.List
;
...
...
@@ -24,7 +28,7 @@ public class WeCustomerDto extends WeResultDto{
@Data
class
ExternalContact
{
public
class
ExternalContact
{
/** 外部联系人userId */
private
String
external_userid
;
/** 外部联系人名称 */
...
...
@@ -58,4 +62,36 @@ public class WeCustomerDto extends WeResultDto{
}
public
WeCustomer
transformWeCustomer
(){
WeCustomer
weCustomer
=
new
WeCustomer
();
if
(
null
!=
external_contact
){
BeanUtils
.
copyPropertiesignoreOther
(
external_contact
,
weCustomer
);
}
if
(
CollectionUtil
.
isNotEmpty
(
follow_user
)){
WeFollowUserDto
weFollowUserDto
=
follow_user
.
get
(
0
);
weCustomer
.
setUserId
(
weFollowUserDto
.
getUserid
());
weCustomer
.
setDescription
(
weFollowUserDto
.
getDescription
());
weCustomer
.
setRemarkMobiles
(
StringUtils
.
join
(
weFollowUserDto
.
getRemark_mobiles
(),
","
));
// weCustomer.setAddWay();
//
// weFollowUserDto.getAdd_way();
// followUser.getUserid();
// followUser.getDescription();
// followUser.getRemark_mobiles();
// followUser.getAdd_way();
}
return
weCustomer
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeFollowUserDto.java
View file @
a20ab7a
...
...
@@ -33,7 +33,7 @@ public class WeFollowUserDto extends WeResultDto{
private
String
remark_corp_name
;
/** 客户备注的手机号码 */
private
String
remark_mobiles
;
private
String
[]
remark_mobiles
;
/** 该成员添加此客户的来源 */
private
Integer
add_way
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeUserDto.java
View file @
a20ab7a
...
...
@@ -8,7 +8,7 @@ import lombok.Data;
* @create: 2020-08-28 10:45
**/
@Data
public
class
WeUserDto
{
public
class
WeUserDto
extends
WeResultDto
{
//成员头像的mediaid,通过素材管理接口上传图片获得的mediaid
private
String
avatar_mediaid
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
a20ab7a
...
...
@@ -8,8 +8,10 @@ import cn.hutool.core.util.ArrayUtil;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.domain.dto.WeCustomerDto
;
import
com.linkwechat.wecom.domain.dto.WeFollowUserDto
;
import
com.linkwechat.wecom.domain.dto.WeUserDto
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.linkwechat.wecom.mapper.WeCustomerMapper
;
...
...
@@ -32,6 +34,10 @@ public class WeCustomerServiceImpl implements IWeCustomerService
@Autowired
private
WeCustomerClient
weFollowUserClient
;
@Autowired
private
WeUserClient
weUserClient
;
/**
* 查询企业微信客户
*
...
...
@@ -132,10 +138,53 @@ public class WeCustomerServiceImpl implements IWeCustomerService
//获取指定客户的详情
WeCustomerDto
externalContact
=
weFollowUserClient
.
get
(
v
);
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
externalContact
.
getErrcode
())
&&
null
!=
externalContact
.
getExternal_contact
()){
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
externalContact
.
getErrcode
())){
//分装成需要入库的数据格式
WeCustomerDto
.
ExternalContact
weExternalContact
=
externalContact
.
getExternal_contact
();
if
(
null
!=
weExternalContact
){
WeCustomer
.
builder
()
.
externalUserid
(
weExternalContact
.
getExternal_userid
())
.
name
(
weExternalContact
.
getName
())
.
avatar
(
weExternalContact
.
getAvatar
())
.
type
(
weExternalContact
.
getType
())
.
gender
(
weExternalContact
.
getGender
())
.
unionid
(
weExternalContact
.
getUnionid
())
// 自定义 .birthday()
// 添加人的id .userId(weExternalContact.getExternal_userid())
// 添加人的名称 .userName()
// 添加人所在部门 .departmentName()
// 添加人员描述 .description()
// 备注号码 .remarkMobiles()
.
corpName
(
weExternalContact
.
getCorp_name
())
.
corpFullName
(
weExternalContact
.
getCorp_full_name
())
.
position
(
weExternalContact
.
getPosition
());
// 客户来源 .addWay()
List
<
WeFollowUserDto
>
followUsers
=
externalContact
.
getFollow_user
();
if
(
CollectionUtil
.
isNotEmpty
(
followUsers
)){
WeFollowUserDto
followUser
=
followUsers
.
get
(
0
);
followUser
.
getUserid
();
followUser
.
getDescription
();
followUser
.
getRemark_mobiles
();
followUser
.
getAdd_way
();
WeUserDto
weUserDto
=
weUserClient
.
getUserByUserId
(
followUser
.
getUserid
());
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
weUserDto
.
getErrcode
())){
weUserDto
.
getName
();
}
}
}
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment