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 01ca497c
authored
Jan 28, 2021
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Plain Diff
Merge remote-tracking branch 'origin/back_end_dev' into back_end_dev
2 parents
7d4ebf82
558e6ff0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
30 deletions
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeExternalContactClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeTaskFissionRecord.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeTaskFissionPosterDTO.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeTaskFissionRecordMapper.xml
sql/link-wechat.sql
linkwe-common/src/main/java/com/linkwechat/common/constant/WeConstans.java
View file @
01ca497
...
...
@@ -20,7 +20,7 @@ public class WeConstans {
/**
* 自建应用token
*/
public
static
final
String
WE_THIRD_APP_TOKEN
=
"we_third_app_token"
;
public
static
final
String
WE_THIRD_APP_TOKEN
=
"we_third_app_token"
;
/**
...
...
@@ -250,6 +250,11 @@ public class WeConstans {
*/
public
static
final
Integer
SENSITIVE_USER_PIECE
=
50
;
/**
* 任务裂变用户活码state前缀
*/
public
static
final
String
FISSION_PREFIX
=
"fis-"
;
public
static
final
String
AppTicketKey
=
"ticket:AppGet"
;
public
static
final
String
AgentTicketKey
=
"ticket:AgentGet"
;
...
...
@@ -322,9 +327,9 @@ public class WeConstans {
public
static
enum
sendMessageStatusEnum
{
NOT_SEND
(
"0"
,
"未发送"
),
SEND
(
"1"
,
"已发送"
),
NOT_FRIEND_SEND
(
"2"
,
"因客户不是好友导致发送失败"
),
RECEIVE_OTHER_MESSAGE
(
"3"
,
"-因客户已经收到其他群发消息导致发送失败"
),
SEND
(
"1"
,
"已发送"
),
NOT_FRIEND_SEND
(
"2"
,
"因客户不是好友导致发送失败"
),
RECEIVE_OTHER_MESSAGE
(
"3"
,
"-因客户已经收到其他群发消息导致发送失败"
),
;
private
String
status
;
...
...
@@ -360,7 +365,6 @@ public class WeConstans {
}
public
static
final
String
WECOM_FINANCE_INDEX
=
"finance"
;
public
static
final
String
WECOM_SENSITIVE_HIT_INDEX
=
"sensitive"
;
...
...
@@ -374,5 +378,5 @@ public class WeConstans {
/**
* 第三方应用ID,参数标实
*/
public
static
final
String
THIRD_APP_PARAM_TIP
=
"agentId"
;
public
static
final
String
THIRD_APP_PARAM_TIP
=
"agentId"
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeExternalContactClient.java
View file @
01ca497
...
...
@@ -12,14 +12,17 @@ import com.linkwechat.wecom.domain.dto.WeExternalContactDto;
**/
public
interface
WeExternalContactClient
{
@Request
(
url
=
"/externalcontact/add_contact_way"
,
@Request
(
url
=
"/externalcontact/add_contact_way"
,
type
=
"POST"
)
WeExternalContactDto
addContactWay
(
@DataObject
WeExternalContactDto
.
WeContactWay
weContactWay
);
@Request
(
url
=
"/externalcontact/update_contact_way"
,
type
=
"POST"
)
@Request
(
url
=
"/externalcontact/update_contact_way"
,
type
=
"POST"
)
WeExternalContactDto
updateContactWay
(
@DataObject
WeExternalContactDto
.
WeContactWay
weContactWay
);
@Request
(
url
=
"/externalcontact/del_contact_way"
,
type
=
"POST"
)
WeExternalContactDto
delContactWay
(
@Query
(
"configId"
)
String
configId
);
@Request
(
url
=
"/externalcontact/get_contact_way"
,
type
=
"POST"
)
WeExternalContactDto
getContactWay
(
@Query
(
"configId"
)
String
configId
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeTaskFissionRecord.java
View file @
01ca497
...
...
@@ -50,6 +50,8 @@ public class WeTaskFissionRecord extends BaseEntity {
@Excel
(
name
=
"裂变客户数量"
)
private
Long
fissNum
;
private
String
configId
;
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
...
...
@@ -58,6 +60,7 @@ public class WeTaskFissionRecord extends BaseEntity {
.
append
(
"customerId"
,
getCustomerId
())
.
append
(
"customerName"
,
getCustomerName
())
.
append
(
"fissNum"
,
getFissNum
())
.
append
(
"configId"
,
getConfigId
())
.
toString
();
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeTaskFissionPosterDTO.java
View file @
01ca497
...
...
@@ -12,4 +12,5 @@ public class WeTaskFissionPosterDTO {
private
String
userId
;
private
Long
taskFissionId
;
private
String
fissStaffId
;
private
Long
posterId
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
View file @
01ca497
...
...
@@ -6,10 +6,10 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.
wecom.domain.WeTaskFission
;
import
com.linkwechat.wecom.
domain.WeTaskFissionRecord
;
import
com.linkwechat.wecom.domain.
WeTaskFissionStaff
;
import
com.linkwechat.wecom.domain.
WeUser
;
import
com.linkwechat.
common.utils.StringUtils
;
import
com.linkwechat.wecom.
client.WeExternalContactClient
;
import
com.linkwechat.wecom.domain.
*
;
import
com.linkwechat.wecom.domain.
dto.WeExternalContactDto
;
import
com.linkwechat.wecom.domain.dto.WeTaskFissionPosterDTO
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.dto.message.LinkMessageDto
;
...
...
@@ -22,6 +22,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -45,6 +46,10 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
private
IWeTaskFissionRecordService
weTaskFissionRecordService
;
@Autowired
private
IWeUserService
weUserService
;
@Autowired
private
WeExternalContactClient
weExternalContactClient
;
@Autowired
private
IWePosterService
wePosterService
;
/**
* 查询任务宝
...
...
@@ -176,28 +181,67 @@ public class WeTaskFissionServiceImpl implements IWeTaskFissionService {
}
@Override
@Transactional
public
String
fissionPosterGenerate
(
WeTaskFissionPosterDTO
weTaskFissionPosterDTO
)
{
WeUser
user
=
weUserService
.
selectWeUserById
(
weTaskFissionPosterDTO
.
getUserId
());
if
(
user
!=
null
)
{
WeTaskFissionRecord
record
=
WeTaskFissionRecord
.
builder
()
.
taskFissionId
(
weTaskFissionPosterDTO
.
getTaskFissionId
())
.
customerId
(
user
.
getUserId
())
.
customerName
(
user
.
getName
()).
build
();
List
<
WeTaskFissionRecord
>
searchExists
=
weTaskFissionRecordService
.
selectWeTaskFissionRecordList
(
record
);
Long
recordId
;
if
(
CollectionUtils
.
isNotEmpty
(
searchExists
))
{
recordId
=
searchExists
.
get
(
0
).
getId
();
}
else
{
int
insertRows
=
weTaskFissionRecordService
.
insertWeTaskFissionRecord
(
record
);
if
(
insertRows
>
0
)
{
recordId
=
record
.
getId
();
}
else
{
throw
new
RuntimeException
(
"生成海报异常:插入裂变记录失败"
);
}
}
return
""
;
WeTaskFissionRecord
record
=
getTaskFissionRecordId
(
weTaskFissionPosterDTO
.
getTaskFissionId
(),
user
.
getUserId
(),
user
.
getName
());
String
qrcode
=
getPosterQRCode
(
weTaskFissionPosterDTO
.
getFissStaffId
(),
record
);
WePoster
poster
=
wePosterService
.
selectOne
(
weTaskFissionPosterDTO
.
getPosterId
());
poster
.
getPosterSubassemblyList
().
stream
().
filter
(
Objects:
:
nonNull
)
.
filter
(
wePosterSubassembly
->
wePosterSubassembly
.
getType
()
==
3
).
forEach
(
wePosterSubassembly
->
{
wePosterSubassembly
.
setImgPath
(
qrcode
);
});
return
wePosterService
.
generateSimpleImg
(
poster
);
}
else
{
throw
new
RuntimeException
(
"客户信息不存在"
);
}
}
private
String
getPosterQRCode
(
String
fissStaffId
,
WeTaskFissionRecord
record
)
{
WeExternalContactDto
dto
=
null
;
if
(
StringUtils
.
isNotBlank
(
record
.
getConfigId
()))
{
dto
=
weExternalContactClient
.
getContactWay
(
record
.
getConfigId
());
}
if
(
dto
==
null
)
{
//获取二维码
WeExternalContactDto
.
WeContactWay
contactWay
=
posterContactWay
(
fissStaffId
,
record
.
getId
());
dto
=
weExternalContactClient
.
addContactWay
(
contactWay
);
record
.
setConfigId
(
dto
.
getConfig_id
());
int
updateResult
=
weTaskFissionRecordService
.
updateWeTaskFissionRecord
(
record
);
if
(
updateResult
<=
0
)
{
throw
new
RuntimeException
(
"生成海报异常:更新裂变记录失败"
);
}
}
return
dto
.
getQr_code
();
}
private
WeExternalContactDto
.
WeContactWay
posterContactWay
(
String
fissUserId
,
Long
recordId
)
{
WeExternalContactDto
.
WeContactWay
wcw
=
new
WeExternalContactDto
.
WeContactWay
();
wcw
.
setScene
(
2
);
wcw
.
setType
(
1
);
wcw
.
setUser
(
new
String
[]{
fissUserId
});
wcw
.
setState
(
WeConstans
.
FISSION_PREFIX
+
recordId
);
return
wcw
;
}
private
WeTaskFissionRecord
getTaskFissionRecordId
(
Long
taskFissionId
,
String
customerId
,
String
customerName
)
{
WeTaskFissionRecord
record
=
WeTaskFissionRecord
.
builder
()
.
taskFissionId
(
taskFissionId
)
.
customerId
(
customerId
)
.
customerName
(
customerName
).
build
();
List
<
WeTaskFissionRecord
>
searchExists
=
weTaskFissionRecordService
.
selectWeTaskFissionRecordList
(
record
);
WeTaskFissionRecord
recordInfo
;
if
(
CollectionUtils
.
isNotEmpty
(
searchExists
))
{
recordInfo
=
searchExists
.
get
(
0
);
}
else
{
int
insertRows
=
weTaskFissionRecordService
.
insertWeTaskFissionRecord
(
record
);
if
(
insertRows
>
0
)
{
recordInfo
=
record
;
}
else
{
throw
new
RuntimeException
(
"生成海报异常:插入裂变记录失败"
);
}
}
return
recordInfo
;
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeTaskFissionRecordMapper.xml
View file @
01ca497
...
...
@@ -10,10 +10,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"customerId"
column=
"customer_id"
/>
<result
property=
"customerName"
column=
"customer_name"
/>
<result
property=
"fissNum"
column=
"fiss_num"
/>
<result
property=
"configId"
column=
"config_id"
/>
</resultMap>
<sql
id=
"selectWeTaskFissionRecordVo"
>
select id, task_fission_id, customer_id, customer_name, fiss_num from we_task_fission_record
select id, task_fission_id, customer_id, customer_name, fiss_num
, config_id
from we_task_fission_record
</sql>
<select
id=
"selectWeTaskFissionRecordList"
parameterType=
"WeTaskFissionRecord"
resultMap=
"WeTaskFissionRecordResult"
>
...
...
@@ -38,12 +39,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"customerId != null and customerId != ''"
>
customer_id,
</if>
<if
test=
"customerName != null"
>
customer_name,
</if>
<if
test=
"fissNum != null"
>
fiss_num,
</if>
<if
test=
"configId != null and configId != ''"
>
config_id,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"taskFissionId != null"
>
#{taskFissionId},
</if>
<if
test=
"customerId != null and customerId != ''"
>
#{customerId},
</if>
<if
test=
"customerName != null"
>
#{customerName},
</if>
<if
test=
"fissNum != null"
>
#{fissNum},
</if>
<if
test=
"configId != null and configId != ''"
>
#{configId},
</if>
</trim>
</insert>
...
...
@@ -54,6 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"customerId != null and customerId != ''"
>
customer_id = #{customerId},
</if>
<if
test=
"customerName != null"
>
customer_name = #{customerName},
</if>
<if
test=
"fissNum != null"
>
fiss_num = #{fissNum},
</if>
<if
test=
"configId != null"
>
config_id = #{configId},
</if>
</trim>
where id = #{id}
</update>
...
...
sql/link-wechat.sql
View file @
01ca497
...
...
@@ -6448,6 +6448,7 @@ CREATE TABLE `we_task_fission_record` (
`customer_id`
VARCHAR
(
64
)
NOT
NULL
DEFAULT
'NULL'
COMMENT
'裂变任务客户id'
,
`customer_name`
VARCHAR
(
100
)
NULL
DEFAULT
NULL
COMMENT
'裂变任务客户姓名'
,
`fiss_num`
INTEGER
NOT
NULL
DEFAULT
0
COMMENT
'裂变客户数量'
,
`config_id`
VARCHAR
(
64
)
NOT
NULL
DEFAULT
'NULL'
COMMENT
'生成二维码配置id'
,
CONSTRAINT
we_task_fission_record_pk
PRIMARY
KEY
(
`id`
)
)
ENGINE
=
InnoDB
DEFAULT
CHARSET
=
utf8mb4
ROW_FORMAT
=
DYNAMIC
COMMENT
'裂变任务记录'
;
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