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 1c89a36d
authored
Oct 01, 2021
by
ext.shengxiyong1
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
重构客户列表
1 parent
b382664f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
154 additions
and
10 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
linkwe-common/src/main/java/com/tencent/wework/Finance.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeExternalContactDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCallBackController.java
View file @
1c89a36
...
@@ -7,6 +7,7 @@ import com.linkwechat.web.controller.common.CommonController;
...
@@ -7,6 +7,7 @@ import com.linkwechat.web.controller.common.CommonController;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.domain.vo.WxCpXmlMessageVO
;
import
com.linkwechat.wecom.factory.WeCallBackEventFactory
;
import
com.linkwechat.wecom.factory.WeCallBackEventFactory
;
import
com.linkwechat.wecom.factory.WeEventHandle
;
import
com.linkwechat.wecom.factory.WeEventHandle
;
import
com.linkwechat.wecom.factory.impl.customer.WeCallBackAddExternalContactImpl
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.security.AnyTypePermission
;
import
com.thoughtworks.xstream.security.AnyTypePermission
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -18,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
/**
/**
...
@@ -40,6 +42,9 @@ public class WeCallBackController extends CommonController {
...
@@ -40,6 +42,9 @@ public class WeCallBackController extends CommonController {
@Value
(
"${wecome.callBack.encodingAesKey}"
)
@Value
(
"${wecome.callBack.encodingAesKey}"
)
private
String
encodingAesKey
;
private
String
encodingAesKey
;
@ApiModelProperty
(
"post数据接收"
)
@ApiModelProperty
(
"post数据接收"
)
@PostMapping
(
value
=
"/recive"
)
@PostMapping
(
value
=
"/recive"
)
public
String
recive
(
@RequestBody
String
msg
,
@RequestParam
(
name
=
"msg_signature"
)
String
signature
,
public
String
recive
(
@RequestBody
String
msg
,
@RequestParam
(
name
=
"msg_signature"
)
String
signature
,
...
@@ -50,6 +55,7 @@ public class WeCallBackController extends CommonController {
...
@@ -50,6 +55,7 @@ public class WeCallBackController extends CommonController {
WxCpXmlMessageVO
wxCpXmlMessage
=
StrXmlToBean
(
decrypt
);
WxCpXmlMessageVO
wxCpXmlMessage
=
StrXmlToBean
(
decrypt
);
log
.
info
(
"企微回调通知接口 wxCpXmlMessage:{}"
,
JSONObject
.
toJSONString
(
wxCpXmlMessage
));
log
.
info
(
"企微回调通知接口 wxCpXmlMessage:{}"
,
JSONObject
.
toJSONString
(
wxCpXmlMessage
));
try
{
try
{
// ;
WeCallBackEventFactory
factory
=
weEventHandle
.
factory
(
wxCpXmlMessage
.
getEvent
());
WeCallBackEventFactory
factory
=
weEventHandle
.
factory
(
wxCpXmlMessage
.
getEvent
());
if
(
factory
!=
null
){
if
(
factory
!=
null
){
Threads
.
SINGLE_THREAD_POOL
.
submit
(()
->
factory
.
eventHandle
(
wxCpXmlMessage
));
Threads
.
SINGLE_THREAD_POOL
.
submit
(()
->
factory
.
eventHandle
(
wxCpXmlMessage
));
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
View file @
1c89a36
...
@@ -9,8 +9,10 @@ import com.linkwechat.common.core.page.TableDataInfo;
...
@@ -9,8 +9,10 @@ import com.linkwechat.common.core.page.TableDataInfo;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomerList
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
io.swagger.annotations.ApiOperation
;
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.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
...
@@ -61,6 +63,21 @@ public class WeCustomerController extends BaseController
...
@@ -61,6 +63,21 @@ public class WeCustomerController extends BaseController
return
AjaxResult
.
success
(
weCustomerService
.
getCustomersByUserId
(
externalUserid
));
return
AjaxResult
.
success
(
weCustomerService
.
getCustomersByUserId
(
externalUserid
));
}
}
/**
* 查询企业微信客户列表(重构版)
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping
(
"/findWeCustomerList"
)
@ApiOperation
(
"查询企业微信客户列表(重构版)"
)
public
TableDataInfo
findWeCustomerList
(
WeCustomerList
weCustomerList
)
{
startPage
();
List
<
WeCustomerList
>
list
=
weCustomerService
.
findWeCustomerList
(
weCustomerList
);
return
getDataTable
(
list
);
}
/**
/**
* 导出企业微信客户列表
* 导出企业微信客户列表
*/
*/
...
...
linkwe-common/src/main/java/com/tencent/wework/Finance.java
View file @
1c89a36
...
@@ -120,7 +120,7 @@ public class Finance {
...
@@ -120,7 +120,7 @@ public class Finance {
System
.
loadLibrary
(
"libcurl"
);
System
.
loadLibrary
(
"libcurl"
);
System
.
loadLibrary
(
"WeWorkFinanceSdk"
);
System
.
loadLibrary
(
"WeWorkFinanceSdk"
);
}
else
{
}
else
{
System
.
load
(
"/
app/projects
/libWeWorkFinanceSdk_Java.so"
);
System
.
load
(
"/
Users/robin/work/sr_project/sdk
/libWeWorkFinanceSdk_Java.so"
);
}
}
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
View file @
1c89a36
...
@@ -164,4 +164,16 @@ public class WeCustomer extends BaseEntity {
...
@@ -164,4 +164,16 @@ public class WeCustomer extends BaseEntity {
@ApiModelProperty
(
hidden
=
true
)
@ApiModelProperty
(
hidden
=
true
)
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
updateBy
;
private
String
updateBy
;
/**
* 首位添加人
*/
private
String
firstUserId
;
/**
* 首位添加时间
*/
private
Date
firstAddTime
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomerList.java
0 → 100644
View file @
1c89a36
package
com
.
linkwechat
.
wecom
.
domain
;
import
lombok.Data
;
import
java.util.Date
;
@Data
public
class
WeCustomerList
{
//客户唯一id
private
String
externalUserid
;
//首位添加人id
private
String
firstUserId
;
//客户名称
private
String
customerName
;
//首位添加人姓名
private
String
userName
;
//跟踪状态
private
Integer
trackState
;
//首位添加人时间
private
Date
firstAddTime
;
//标签名称,使用逗号隔开
private
String
tagNames
;
//查询条件客户姓名
private
String
name
;
//查询条件
private
String
userIds
;
//查询开始时间
private
String
beginTime
;
//查询结束时间
private
String
endTime
;
//查询标签id
private
String
tagIds
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
View file @
1c89a36
...
@@ -107,7 +107,4 @@ public class WeFlowerCustomerRel
...
@@ -107,7 +107,4 @@ public class WeFlowerCustomerRel
private
String
address
;
private
String
address
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
View file @
1c89a36
...
@@ -47,6 +47,11 @@ public class WeFlowerCustomerTagRel
...
@@ -47,6 +47,11 @@ public class WeFlowerCustomerTagRel
@TableField
(
exist
=
false
)
@TableField
(
exist
=
false
)
private
String
tagName
;
private
String
tagName
;
/**0:移动端打的标签;1:pc端打的标签**/
private
Integer
relTagType
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
private
Date
createTime
;
private
String
userId
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeExternalContactDto.java
View file @
1c89a36
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
package
com
.
linkwechat
.
wecom
.
domain
.
dto
;
import
lombok.experimental.SuperBuilder
;
import
lombok.Data
;
import
lombok.Data
;
/**
/**
...
@@ -46,6 +45,9 @@ public class WeExternalContactDto extends WeResultDto {
...
@@ -46,6 +45,9 @@ public class WeExternalContactDto extends WeResultDto {
//样式
//样式
private
Integer
style
=
1
;
private
Integer
style
=
1
;
public
WeContactWay
()
{
public
WeContactWay
()
{
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
View file @
1c89a36
...
@@ -49,6 +49,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
...
@@ -49,6 +49,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
private
IWeTaskFissionRewardService
weTaskFissionRewardService
;
private
IWeTaskFissionRewardService
weTaskFissionRewardService
;
@Autowired
@Autowired
private
IWeTaskFissionService
weTaskFissionService
;
private
IWeTaskFissionService
weTaskFissionService
;
private
ThreadLocal
<
WeFlowerCustomerRel
>
weFlowerCustomerRelThreadLocal
=
new
ThreadLocal
<>();
private
ThreadLocal
<
WeFlowerCustomerRel
>
weFlowerCustomerRelThreadLocal
=
new
ThreadLocal
<>();
@Autowired
@Autowired
...
@@ -66,6 +67,20 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
...
@@ -66,6 +67,20 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
weFlowerCustomerRelThreadLocal
.
set
(
weFlowerCustomerRel
);
weFlowerCustomerRelThreadLocal
.
set
(
weFlowerCustomerRel
);
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
message
.
getExternalUserId
());
weCustomerService
.
getCustomersInfoAndSynchWeCustomer
(
message
.
getExternalUserId
());
}
}
// WeEmpleCode weEmpleCode
// = weEmpleCodeService.getById(message.getState());
// if(message.getState() != null){
//
// if(weEmpleCode != null){
// if (isFission(message.getState())) {
// taskFissionRecordHandle(message.getState(), message.getWelcomeCode(), message.getUserId(), message.getExternalUserId());
// } else {
// empleCodeHandle(message.getState(), weEmpleCode.getWelcomeMsg(), message.getUserId(), message.getExternalUserId());
// }
// }
// }
if
(
message
.
getState
()
!=
null
&&
message
.
getWelcomeCode
()
!=
null
)
{
if
(
message
.
getState
()
!=
null
&&
message
.
getWelcomeCode
()
!=
null
)
{
if
(
isFission
(
message
.
getState
()))
{
if
(
isFission
(
message
.
getState
()))
{
taskFissionRecordHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
taskFissionRecordHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
...
@@ -73,6 +88,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
...
@@ -73,6 +88,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
empleCodeHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
empleCodeHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
}
}
}
}
}
}
//裂变任务处理
//裂变任务处理
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
View file @
1c89a36
...
@@ -3,10 +3,7 @@ package com.linkwechat.wecom.mapper;
...
@@ -3,10 +3,7 @@ package com.linkwechat.wecom.mapper;
import
java.util.List
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.*
;
import
com.linkwechat.wecom.domain.WeCustomerPortrait
;
import
com.linkwechat.wecom.domain.WeCustomerSocialConn
;
import
com.linkwechat.wecom.domain.WeUser
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
/**
/**
...
@@ -109,4 +106,13 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
...
@@ -109,4 +106,13 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
public
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
);
public
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
);
/**
* 重构版客户列表接口
* @param weCustomerList
* @return
*/
List
<
WeCustomerList
>
findWeCustomerList
(
WeCustomerList
weCustomerList
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
View file @
1c89a36
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomerList
;
import
com.linkwechat.wecom.domain.WeCustomerPortrait
;
import
com.linkwechat.wecom.domain.WeCustomerPortrait
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.WeWelcomeMsg
;
import
com.linkwechat.wecom.domain.dto.WeWelcomeMsg
;
...
@@ -144,6 +145,14 @@ public interface IWeCustomerService extends IService<WeCustomer>
...
@@ -144,6 +145,14 @@ public interface IWeCustomerService extends IService<WeCustomer>
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
);
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
);
/**
* 重构版客户列表
* @param weCustomerList
* @return
*/
List
<
WeCustomerList
>
findWeCustomerList
(
WeCustomerList
weCustomerList
);
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
1c89a36
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
1c89a36
...
@@ -280,7 +280,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -280,7 +280,47 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM
FROM
we_flower_customer_tag_rel wfcrf
we_flower_customer_tag_rel wfcrf
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
where wt.status=0 and wfcrf.flower_customer_rel_id=#{id}
where wt.status=0 and wfcrf.rel_tag_type=1 and wfcrf.flower_customer_rel_id=#{id}
</select>
<select
id=
"findWeCustomerList"
resultType=
"com.linkwechat.wecom.domain.WeCustomerList"
>
SELECT
wc.external_userid,
wc.`name` as customerName,
wc.first_user_id,
wu.user_name,
wc.first_add_time,
GROUP_CONCAT(wt.`name`) as tagNames,
GROUP_CONCAT(wt.`tag_id`) as tagIds
FROM
we_customer wc
LEFT JOIN we_user wu ON wc.first_user_id=wu.user_id
LEFT JOIN we_flower_customer_tag_rel wfctr ON wfctr.external_userid=wc.external_userid AND wfctr.rel_tag_type=1
LEFT JOIN we_tag wt ON wt.tag_id=wfctr.tag_id
<where>
<if
test=
"name != null and name !=''"
>
AND wc.`name` like concat('%',#{name,jdbcType=VARCHAR},'%')
</if>
<if
test=
"userIds !=null and userIds !=''"
>
AND wc.first_user_id in
<foreach
collection=
"userIds.split(',')"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
<if
test=
"tagIds !=null and tagIds !=''"
>
AND wt.tag_id in
<foreach
collection=
"tagIds.split(',')"
item=
"item"
index=
"index"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
<if
test=
"beginTime !=null and beginTime != '' and endTime !='' and endTime != null"
>
AND date_format(wc.first_add_time,'%Y-%m-%d') BETWEEN #{beginTime} AND #{endTime}
</if>
</where>
GROUP BY wc.external_userid
</select>
</select>
...
...
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