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 be7e45e0
authored
Dec 27, 2021
by
linkwechat8856@163.com
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复离职继承等相关bug
1 parent
1988de28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
446 additions
and
177 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityPresTagGroupController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterController.java
linkwe-common/src/main/java/com/linkwechat/common/constant/Constants.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeAllocateCustomer.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeAllocateGroup.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/AllocateWeCustomerDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/CustomerGroupDetail.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/CustomerGroupList.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeAllocateCustomersVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeAllocateCustomerMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeAllocateGroupMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WePosterMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeAllocateCustomerService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeAllocateGroupService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWePosterService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWePresTagGroupTaskService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeUserService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeAllocateCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeAllocateGroupServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMsgTlpServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePosterServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePresTagGroupTaskServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeAllocateCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeAllocateGroupMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WePresTagGroupTaskMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeposterMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommunityPresTagGroupController.java
View file @
be7e45e
...
@@ -86,13 +86,18 @@ public class WeCommunityPresTagGroupController extends BaseController {
...
@@ -86,13 +86,18 @@ public class WeCommunityPresTagGroupController extends BaseController {
@PutMapping
(
path
=
"/{id}"
)
@PutMapping
(
path
=
"/{id}"
)
@ApiOperation
(
value
=
"更新任务信息"
,
httpMethod
=
"PUT"
)
@ApiOperation
(
value
=
"更新任务信息"
,
httpMethod
=
"PUT"
)
public
AjaxResult
update
(
@PathVariable
(
"id"
)
Long
id
,
@RequestBody
@Validated
WePresTagGroupTask
task
)
{
public
AjaxResult
update
(
@PathVariable
(
"id"
)
Long
id
,
@RequestBody
@Validated
WePresTagGroupTask
task
)
{
// 保存新任务
task
.
setTaskId
(
id
);
try
{
task
.
setUpdateBy
(
SecurityUtils
.
getUsername
());
// 保存新任务
task
.
setUpdateTime
(
new
Date
());
task
.
setTaskId
(
id
);
int
rows
=
taskService
.
updateTask
(
task
);
task
.
setUpdateBy
(
SecurityUtils
.
getUsername
());
if
(
rows
>
0
)
taskService
.
sendMessage
(
task
);
task
.
setUpdateTime
(
new
Date
());
return
toAjax
(
rows
);
taskService
.
updateTaskAndSendMsg
(
task
);
}
catch
(
Exception
e
){
return
AjaxResult
.
error
(
e
.
getMessage
());
}
return
AjaxResult
.
success
();
}
}
/**
/**
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeMaterialController.java
View file @
be7e45e
...
@@ -50,11 +50,11 @@ public class WeMaterialController extends BaseController {
...
@@ -50,11 +50,11 @@ public class WeMaterialController extends BaseController {
@GetMapping
(
"/list"
)
@GetMapping
(
"/list"
)
@ApiOperation
(
"查询素材列表"
)
@ApiOperation
(
"查询素材列表"
)
public
TableDataInfo
list
(
@RequestParam
(
value
=
"categoryId"
,
required
=
false
)
String
categoryId
public
TableDataInfo
list
(
@RequestParam
(
value
=
"categoryId"
,
required
=
false
)
String
categoryId
,
@RequestParam
(
value
=
"search"
,
required
=
false
)
String
search
,
@RequestParam
(
value
=
"mediaType"
)
String
mediaType
)
{
,
@RequestParam
(
value
=
"search"
,
required
=
false
)
String
search
,
@RequestParam
(
value
=
"mediaType"
)
String
mediaType
,
Integer
status
)
{
startPage
();
startPage
();
return
getDataTable
(
return
getDataTable
(
StringUtils
.
isNotBlank
(
mediaType
)
&&
mediaType
.
equals
(
MediaType
.
POSTER
.
getType
())?
StringUtils
.
isNotBlank
(
mediaType
)
&&
mediaType
.
equals
(
MediaType
.
POSTER
.
getType
())?
wePosterService
.
findWePosterToWeMaterial
(
categoryId
,
search
):
wePosterService
.
findWePosterToWeMaterial
(
categoryId
,
search
,
status
):
materialService
.
findWeMaterials
(
categoryId
,
search
,
mediaType
)
materialService
.
findWeMaterials
(
categoryId
,
search
,
mediaType
)
);
);
}
}
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WePosterController.java
View file @
be7e45e
...
@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
...
@@ -2,6 +2,7 @@ package com.linkwechat.web.controller.wecom;
import
cn.hutool.core.collection.CollectionUtil
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.enums.MediaType
;
...
...
linkwe-common/src/main/java/com/linkwechat/common/constant/Constants.java
View file @
be7e45e
...
@@ -167,6 +167,18 @@ public class Constants
...
@@ -167,6 +167,18 @@ public class Constants
/**
* 正常状态(未删除)
*/
public
static
final
Integer
COMMON_STATE
=
0
;
/**
* 删除移除状态
*/
public
static
final
Integer
DELETE_STATE
=
1
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/client/WeUserClient.java
View file @
be7e45e
...
@@ -126,4 +126,13 @@ public interface WeUserClient {
...
@@ -126,4 +126,13 @@ public interface WeUserClient {
*/
*/
@Request
(
url
=
"/user/getuserinfo"
,
interceptor
=
WeAppAccessTokenInterceptor
.
class
)
@Request
(
url
=
"/user/getuserinfo"
,
interceptor
=
WeAppAccessTokenInterceptor
.
class
)
WeUserInfoDto
getUserInfo
(
@Query
(
"code"
)
String
code
,
@Header
(
"agentId"
)
String
agentId
);
WeUserInfoDto
getUserInfo
(
@Query
(
"code"
)
String
code
,
@Header
(
"agentId"
)
String
agentId
);
/**
* 获取离职成员待分配客户
* @param checkParm
* @return
*/
@Post
(
url
=
"/externalcontact/get_unassigned_list"
,
interceptor
=
WeAccessTokenInterceptor
.
class
)
AllocateWeCustomerDto
getUnassignedList
(
@JSONBody
AllocateWeCustomerDto
.
CheckParm
checkParm
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeAllocateCustomer.java
View file @
be7e45e
package
com
.
linkwechat
.
wecom
.
domain
;
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -24,8 +25,6 @@ public class WeAllocateCustomer
...
@@ -24,8 +25,6 @@ public class WeAllocateCustomer
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
private
Long
id
;
/** 接替成员的userid */
/** 接替成员的userid */
private
String
takeoverUserid
;
private
String
takeoverUserid
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeAllocateGroup.java
View file @
be7e45e
...
@@ -25,8 +25,6 @@ public class WeAllocateGroup
...
@@ -25,8 +25,6 @@ public class WeAllocateGroup
{
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
private
Long
id
=
SnowFlakeUtil
.
nextId
();
/** 分配的群id */
/** 分配的群id */
private
String
chatId
;
private
String
chatId
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/AllocateWeCustomerDto.java
View file @
be7e45e
...
@@ -6,6 +6,8 @@ import lombok.experimental.SuperBuilder;
...
@@ -6,6 +6,8 @@ import lombok.experimental.SuperBuilder;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
/**
* @description: 分配客户
* @description: 分配客户
* @author: HaoN
* @author: HaoN
...
@@ -15,7 +17,7 @@ import lombok.NoArgsConstructor;
...
@@ -15,7 +17,7 @@ import lombok.NoArgsConstructor;
@SuperBuilder
@SuperBuilder
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
public
class
AllocateWeCustomerDto
{
public
class
AllocateWeCustomerDto
extends
WeResultDto
{
/**外部联系人的userid,注意不是企业成员的帐号*/
/**外部联系人的userid,注意不是企业成员的帐号*/
private
String
handover_userid
;
private
String
handover_userid
;
...
@@ -31,4 +33,38 @@ public class AllocateWeCustomerDto{
...
@@ -31,4 +33,38 @@ public class AllocateWeCustomerDto{
private
List
<
Info
>
info
;
//是否是最后一条记录
private
Boolean
is_last
;
private
String
next_cursor
;
@Data
@Builder
public
static
class
CheckParm
{
private
Integer
page_id
;
private
Integer
page_size
;
private
String
cursor
;
}
@Data
public
static
class
Info
{
//离职成员的userid
private
String
handover_userid
;
//外部联系人userid
private
String
external_userid
;
//成员离职时间
private
Long
dimission_time
;
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/CustomerGroupDetail.java
View file @
be7e45e
...
@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON;
...
@@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -53,11 +55,13 @@ public class CustomerGroupDetail extends WeResultDto {
...
@@ -53,11 +55,13 @@ public class CustomerGroupDetail extends WeResultDto {
*/
*/
@AllArgsConstructor
@AllArgsConstructor
@Data
@Data
public
class
Params
{
@Builder
@NoArgsConstructor
public
static
class
Params
{
private
String
chat_id
;
private
String
chat_id
;
//是否需要返回群成员的名字group_chat.member_list.name。0-不返回;1-返回。默认不返回
private
Integer
need_name
;
private
Integer
need_name
;
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/CustomerGroupList.java
View file @
be7e45e
package
com
.
linkwechat
.
wecom
.
domain
.
dto
.
customer
;
package
com
.
linkwechat
.
wecom
.
domain
.
dto
.
customer
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
com.linkwechat.wecom.domain.dto.WeResultDto
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
...
@@ -19,12 +22,17 @@ public class CustomerGroupList extends WeResultDto {
...
@@ -19,12 +22,17 @@ public class CustomerGroupList extends WeResultDto {
*/
*/
private
List
<
GroupChat
>
groupChatList
;
private
List
<
GroupChat
>
groupChatList
;
private
String
next_cursor
;
/**
/**
* 请求参数
* 请求参数
*/
*/
@Data
@Data
public
class
Params
{
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
static
class
Params
{
/**群状态过滤: 0 - 所有列表;1 - 离职待继承;2 - 离职继承中;3 - 离职继承完成; */
/**群状态过滤: 0 - 所有列表;1 - 离职待继承;2 - 离职继承中;3 - 离职继承完成; */
...
@@ -36,6 +44,10 @@ public class CustomerGroupList extends WeResultDto {
...
@@ -36,6 +44,10 @@ public class CustomerGroupList extends WeResultDto {
/**分页,预期请求的数据量,取值范围 1 ~ 1000 */
/**分页,预期请求的数据量,取值范围 1 ~ 1000 */
private
Integer
limit
=
new
Integer
(
1000
);
private
Integer
limit
=
new
Integer
(
1000
);
private
String
cursor
;
private
String
owner_filter
;
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeAllocateCustomersVo.java
View file @
be7e45e
...
@@ -28,4 +28,9 @@ public class WeAllocateCustomersVo extends BaseEntity {
...
@@ -28,4 +28,9 @@ public class WeAllocateCustomersVo extends BaseEntity {
/**原拥有着*/
/**原拥有着*/
private
String
handoverUserId
;
private
String
handoverUserId
;
private
String
externalUserid
;
private
String
userId
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeAllocateCustomerMapper.java
View file @
be7e45e
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.mapper;
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeAllocateCustomer
;
import
com.linkwechat.wecom.domain.WeAllocateCustomer
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 离职分配的客户列Mapper接口
* 离职分配的客户列Mapper接口
...
@@ -12,4 +15,5 @@ import com.linkwechat.wecom.domain.WeAllocateCustomer;
...
@@ -12,4 +15,5 @@ import com.linkwechat.wecom.domain.WeAllocateCustomer;
public
interface
WeAllocateCustomerMapper
extends
BaseMapper
<
WeAllocateCustomer
>
public
interface
WeAllocateCustomerMapper
extends
BaseMapper
<
WeAllocateCustomer
>
{
{
void
batchAddOrUpdate
(
@Param
(
"weAllocateCustomers"
)
List
<
WeAllocateCustomer
>
weAllocateCustomer
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeAllocateGroupMapper.java
View file @
be7e45e
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.mapper;
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeAllocateGroup
;
import
com.linkwechat.wecom.domain.WeAllocateGroup
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 分配的群租Mapper接口
* 分配的群租Mapper接口
...
@@ -11,5 +14,5 @@ import com.linkwechat.wecom.domain.WeAllocateGroup;
...
@@ -11,5 +14,5 @@ import com.linkwechat.wecom.domain.WeAllocateGroup;
*/
*/
public
interface
WeAllocateGroupMapper
extends
BaseMapper
<
WeAllocateGroup
>
public
interface
WeAllocateGroupMapper
extends
BaseMapper
<
WeAllocateGroup
>
{
{
void
batchAddOrUpdate
(
@Param
(
"weAllocateGroupList"
)
List
<
WeAllocateGroup
>
weAllocateGroupList
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WePosterMapper.java
View file @
be7e45e
...
@@ -13,5 +13,5 @@ import java.util.List;
...
@@ -13,5 +13,5 @@ import java.util.List;
* @author ws
* @author ws
*/
*/
public
interface
WePosterMapper
extends
BaseMapper
<
WePoster
>
{
public
interface
WePosterMapper
extends
BaseMapper
<
WePoster
>
{
List
<
WeMaterial
>
findWePosterToWeMaterial
(
@Param
(
"categoryId"
)
String
categoryId
,
@Param
(
"name"
)
String
name
);
List
<
WeMaterial
>
findWePosterToWeMaterial
(
@Param
(
"categoryId"
)
String
categoryId
,
@Param
(
"name"
)
String
name
,
@Param
(
"status"
)
Integer
status
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeAllocateCustomerService.java
View file @
be7e45e
...
@@ -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.WeAllocateCustomer
;
import
com.linkwechat.wecom.domain.WeAllocateCustomer
;
import
java.util.List
;
/**
/**
* 离职分配的客户列Service接口
* 离职分配的客户列Service接口
...
@@ -11,5 +12,5 @@ import com.linkwechat.wecom.domain.WeAllocateCustomer;
...
@@ -11,5 +12,5 @@ import com.linkwechat.wecom.domain.WeAllocateCustomer;
*/
*/
public
interface
IWeAllocateCustomerService
extends
IService
<
WeAllocateCustomer
>
public
interface
IWeAllocateCustomerService
extends
IService
<
WeAllocateCustomer
>
{
{
void
batchAddOrUpdate
(
List
<
WeAllocateCustomer
>
weAllocateCustomer
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeAllocateGroupService.java
View file @
be7e45e
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service;
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeAllocateGroup
;
import
com.linkwechat.wecom.domain.WeAllocateGroup
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 分配的群租Service接口
* 分配的群租Service接口
...
@@ -11,5 +14,5 @@ import com.linkwechat.wecom.domain.WeAllocateGroup;
...
@@ -11,5 +14,5 @@ import com.linkwechat.wecom.domain.WeAllocateGroup;
*/
*/
public
interface
IWeAllocateGroupService
extends
IService
<
WeAllocateGroup
>
public
interface
IWeAllocateGroupService
extends
IService
<
WeAllocateGroup
>
{
{
void
batchAddOrUpdate
(
List
<
WeAllocateGroup
>
weAllocateGroupList
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWePosterService.java
View file @
be7e45e
...
@@ -37,6 +37,6 @@ public interface IWePosterService extends IService<WePoster> {
...
@@ -37,6 +37,6 @@ public interface IWePosterService extends IService<WePoster> {
public
String
generateSimpleImg
(
WePoster
poster
);
public
String
generateSimpleImg
(
WePoster
poster
);
List
<
WeMaterial
>
findWePosterToWeMaterial
(
String
categoryId
,
String
name
);
List
<
WeMaterial
>
findWePosterToWeMaterial
(
String
categoryId
,
String
name
,
Integer
status
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWePresTagGroupTaskService.java
View file @
be7e45e
package
com
.
linkwechat
.
wecom
.
service
;
package
com
.
linkwechat
.
wecom
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.wecom.domain.WePresTagGroupTask
;
import
com.linkwechat.wecom.domain.WePresTagGroupTask
;
import
com.linkwechat.wecom.domain.WePresTagGroupTaskStat
;
import
com.linkwechat.wecom.domain.WePresTagGroupTaskStat
;
import
com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo
;
import
com.linkwechat.wecom.domain.vo.WeCommunityTaskEmplVo
;
...
@@ -58,6 +59,10 @@ public interface IWePresTagGroupTaskService extends IService<WePresTagGroupTask>
...
@@ -58,6 +59,10 @@ public interface IWePresTagGroupTaskService extends IService<WePresTagGroupTask>
*/
*/
int
updateTask
(
WePresTagGroupTask
task
);
int
updateTask
(
WePresTagGroupTask
task
);
void
updateTaskAndSendMsg
(
WePresTagGroupTask
task
)
throws
WeComException
;
/**
/**
* 根据查询条件获取任务的统计结果
* 根据查询条件获取任务的统计结果
*
*
...
@@ -101,7 +106,7 @@ public interface IWePresTagGroupTaskService extends IService<WePresTagGroupTask>
...
@@ -101,7 +106,7 @@ public interface IWePresTagGroupTaskService extends IService<WePresTagGroupTask>
*
*
* @param task 标签建群任务id
* @param task 标签建群任务id
*/
*/
void
sendMessage
(
WePresTagGroupTask
task
);
void
sendMessage
(
WePresTagGroupTask
task
)
throws
WeComException
;
/**
/**
* 任务名是否已占用
* 任务名是否已占用
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeUserService.java
View file @
be7e45e
...
@@ -150,4 +150,8 @@ public interface IWeUserService extends IService<WeUser>
...
@@ -150,4 +150,8 @@ public interface IWeUserService extends IService<WeUser>
List
<
WeCustomerAddUser
>
findWeUserByCustomerId
(
String
externalUserid
);
List
<
WeCustomerAddUser
>
findWeUserByCustomerId
(
String
externalUserid
);
void
synchLeaveUserData
();
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeAllocateCustomerServiceImpl.java
View file @
be7e45e
...
@@ -6,6 +6,8 @@ import com.linkwechat.wecom.mapper.WeAllocateCustomerMapper;
...
@@ -6,6 +6,8 @@ import com.linkwechat.wecom.mapper.WeAllocateCustomerMapper;
import
com.linkwechat.wecom.service.IWeAllocateCustomerService
;
import
com.linkwechat.wecom.service.IWeAllocateCustomerService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* 离职分配的客户列Service业务层处理
* 离职分配的客户列Service业务层处理
*
*
...
@@ -16,4 +18,8 @@ import org.springframework.stereotype.Service;
...
@@ -16,4 +18,8 @@ import org.springframework.stereotype.Service;
public
class
WeAllocateCustomerServiceImpl
extends
ServiceImpl
<
WeAllocateCustomerMapper
,
WeAllocateCustomer
>
implements
IWeAllocateCustomerService
public
class
WeAllocateCustomerServiceImpl
extends
ServiceImpl
<
WeAllocateCustomerMapper
,
WeAllocateCustomer
>
implements
IWeAllocateCustomerService
{
{
@Override
public
void
batchAddOrUpdate
(
List
<
WeAllocateCustomer
>
weAllocateCustomer
)
{
this
.
baseMapper
.
batchAddOrUpdate
(
weAllocateCustomer
);
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeAllocateGroupServiceImpl.java
View file @
be7e45e
...
@@ -6,6 +6,8 @@ import com.linkwechat.wecom.mapper.WeAllocateGroupMapper;
...
@@ -6,6 +6,8 @@ import com.linkwechat.wecom.mapper.WeAllocateGroupMapper;
import
com.linkwechat.wecom.service.IWeAllocateGroupService
;
import
com.linkwechat.wecom.service.IWeAllocateGroupService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* 分配的群租Service业务层处理
* 分配的群租Service业务层处理
*
*
...
@@ -16,4 +18,8 @@ import org.springframework.stereotype.Service;
...
@@ -16,4 +18,8 @@ import org.springframework.stereotype.Service;
public
class
WeAllocateGroupServiceImpl
extends
ServiceImpl
<
WeAllocateGroupMapper
,
WeAllocateGroup
>
implements
IWeAllocateGroupService
public
class
WeAllocateGroupServiceImpl
extends
ServiceImpl
<
WeAllocateGroupMapper
,
WeAllocateGroup
>
implements
IWeAllocateGroupService
{
{
@Override
public
void
batchAddOrUpdate
(
List
<
WeAllocateGroup
>
weAllocateGroupList
)
{
this
.
baseMapper
.
batchAddOrUpdate
(
weAllocateGroupList
);
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
be7e45e
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ArrayUtil;
...
@@ -6,6 +6,7 @@ import cn.hutool.core.util.ArrayUtil;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.linkwechat.common.constant.Constants
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.enums.*
;
import
com.linkwechat.common.enums.*
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
...
@@ -123,7 +124,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -123,7 +124,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
if
(
CollectionUtil
.
isNotEmpty
(
externalUserDetails
))
{
if
(
CollectionUtil
.
isNotEmpty
(
externalUserDetails
))
{
weFlowerCustomerHandle
(
weFlowerCustomerHandle
(
externalUserDetails
externalUserDetails
,
true
);
);
}
}
}
}
...
@@ -138,7 +139,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -138,7 +139,7 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
/**
/**
* 客户同步业务处理
* 客户同步业务处理
*/
*/
private
void
weFlowerCustomerHandle
(
List
<
ExternalUserDetail
>
list
)
{
private
void
weFlowerCustomerHandle
(
List
<
ExternalUserDetail
>
list
,
boolean
isSynchCustomerTagRel
)
{
List
<
WeCustomer
>
weCustomerList
=
new
ArrayList
<>();
List
<
WeCustomer
>
weCustomerList
=
new
ArrayList
<>();
...
@@ -160,22 +161,27 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -160,22 +161,27 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
weCustomer
.
setFirstAddTime
(
new
Date
(
followInfo
.
getCreatetime
()
*
1000L
));
weCustomer
.
setFirstAddTime
(
new
Date
(
followInfo
.
getCreatetime
()
*
1000L
));
weCustomer
.
setAddMethod
(
followInfo
.
getAdd_way
());
weCustomer
.
setAddMethod
(
followInfo
.
getAdd_way
());
weCustomerList
.
add
(
weCustomer
);
weCustomerList
.
add
(
weCustomer
);
List
<
String
>
tags
=
Stream
.
of
(
followInfo
.
getTag_id
()).
collect
(
Collectors
.
toList
());
if
(
isSynchCustomerTagRel
){
if
(
CollectionUtil
.
isNotEmpty
(
tags
))
{
List
<
String
>
tags
=
Stream
.
of
(
followInfo
.
getTag_id
()).
collect
(
Collectors
.
toList
());
tags
.
stream
().
forEach
(
tag
->
{
if
(
CollectionUtil
.
isNotEmpty
(
tags
))
{
tags
.
stream
().
forEach
(
tag
->
{
weFlowerCustomerTagRels
.
add
(
WeFlowerCustomerTagRel
.
builder
()
weFlowerCustomerTagRels
.
add
(
.
userId
(
followInfo
.
getUserid
())
WeFlowerCustomerTagRel
.
builder
()
.
externalUserid
(
weCustomer
.
getExternalUserid
())
.
userId
(
followInfo
.
getUserid
())
.
tagId
(
tag
)
.
externalUserid
(
weCustomer
.
getExternalUserid
())
.
delFlag
(
new
Integer
(
0
))
.
tagId
(
tag
)
.
isCompanyTag
(
true
)
.
delFlag
(
new
Integer
(
0
))
.
build
()
.
isCompanyTag
(
true
)
);
.
build
()
});
);
});
}
}
}
});
});
});
});
...
@@ -230,63 +236,55 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -230,63 +236,55 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
allocateWeCustomer
(
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
)
{
public
void
allocateWeCustomer
(
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
)
{
//所需分配的客户
List
<
WeAllocateCustomer
>
weAllocateCustomerList
=
iWeAllocateCustomerService
.
list
(
new
LambdaQueryWrapper
<
WeAllocateCustomer
>()
List
<
WeCustomer
>
allocateWeCustomers
=
this
.
list
(
new
LambdaQueryWrapper
<
WeCustomer
>()
.
eq
(
WeAllocateCustomer:
:
getHandoverUserid
,
weLeaveUserInfoAllocateVo
.
getHandoverUserid
()));
.
eq
(
WeCustomer:
:
getFirstUserId
,
weLeaveUserInfoAllocateVo
.
getHandoverUserid
()));
if
(
CollectionUtil
.
isNotEmpty
(
allocateWeCustomers
))
{
//设置客户的接手人
if
(
CollectionUtil
.
isNotEmpty
(
weAllocateCustomerList
)){
allocateWeCustomers
.
stream
().
forEach
(
k
->{
k
.
setTakeoverUserId
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
());
});
//所需分配的客户
List
<
WeCustomer
>
allocateWeCustomers
=
this
.
list
(
new
LambdaQueryWrapper
<
WeCustomer
>()
.
in
(
WeCustomer:
:
getExternalUserid
,
weAllocateCustomerList
.
stream
().
map
(
WeAllocateCustomer:
:
getExternalUserid
).
collect
(
Collectors
.
toList
()))
.
eq
(
WeCustomer:
:
getFirstUserId
,
weLeaveUserInfoAllocateVo
.
getHandoverUserid
()));
// JobExtendsCustomer jobExtendsCustomer = weUserClient.transferCustomer(
if
(
CollectionUtil
.
isNotEmpty
(
allocateWeCustomers
))
{
// AllocateWeCustomerDto.builder()
// .external_userid(
// allocateWeCustomers.stream().map(WeCustomer::getExternalUserid).collect(Collectors.toList()).stream().toArray(String[]::new)
// )
// .handover_userid(weLeaveUserInfoAllocateVo.getHandoverUserid())
// .takeover_userid(weLeaveUserInfoAllocateVo.getTakeoverUserid())
// .build()
// );
WeResultDto
weResultDto
=
weUserClient
.
allocateCustomer
(
//设置客户的接手人和状态设置为删除
AllocateWeCustomerDto
.
builder
()
allocateWeCustomers
.
stream
().
forEach
(
k
->
{
.
external_userid
(
k
.
setTakeoverUserId
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
());
allocateWeCustomers
.
stream
().
map
(
WeCustomer:
:
getExternalUserid
).
collect
(
Collectors
.
toList
()).
stream
().
toArray
(
String
[]::
new
)
k
.
setDelFlag
(
Constants
.
DELETE_STATE
);
)
});
.
handover_userid
(
weLeaveUserInfoAllocateVo
.
getHandoverUserid
())
.
takeover_userid
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
())
.
build
()
);
if
(
weResultDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
this
.
baseMapper
.
batchAddOrUpdate
(
allocateWeCustomers
);
List
<
WeAllocateCustomer
>
weAllocateCustomers
=
new
ArrayList
<>();
allocateWeCustomers
.
stream
().
forEach
(
k
->{
weAllocateCustomers
.
add
(
WeAllocateCustomer
.
builder
()
.
allocateTime
(
new
Date
())
.
extentType
(
new
Integer
(
1
))
.
externalUserid
(
k
.
getExternalUserid
())
.
handoverUserid
(
weLeaveUserInfoAllocateVo
.
getHandoverUserid
())
.
takeoverUserid
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
())
.
failReason
(
"离职继承"
)
.
build
()
);
WeResultDto
weResultDto
=
weUserClient
.
allocateCustomer
(
AllocateWeCustomerDto
.
builder
()
.
external_userid
(
allocateWeCustomers
.
stream
().
map
(
WeCustomer:
:
getExternalUserid
).
collect
(
Collectors
.
toList
()).
stream
().
toArray
(
String
[]::
new
)
)
.
handover_userid
(
weLeaveUserInfoAllocateVo
.
getHandoverUserid
())
.
takeover_userid
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
())
.
build
()
);
iWeAllocateCustomerService
.
saveBatch
(
weAllocateCustomers
);
if
(
weResultDto
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)){
this
.
baseMapper
.
batchAddOrUpdate
(
allocateWeCustomers
);
weAllocateCustomerList
.
stream
().
forEach
(
k
->{
k
.
setAllocateTime
(
new
Date
());
k
.
setTakeoverUserid
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
());
});
iWeAllocateCustomerService
.
batchAddOrUpdate
(
weAllocateCustomerList
);
}
});
}
}
}
}
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeGroupServiceImpl.java
View file @
be7e45e
...
@@ -82,32 +82,32 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -82,32 +82,32 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
@Override
@Override
@Transactional
@Transactional
public
void
allocateWeGroup
(
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
)
{
public
void
allocateWeGroup
(
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
)
{
List
<
WeGroup
>
weGroups
=
this
.
list
(
new
LambdaQueryWrapper
<
WeGroup
>().
eq
(
WeGroup:
:
getOwner
,
weLeaveUserInfoAllocateVo
.
getHandoverUserid
()));
List
<
WeAllocateGroup
>
weAllocateGroupList
=
iWeAllocateGroupService
.
list
(
new
LambdaQueryWrapper
<
WeAllocateGroup
>()
.
eq
(
WeAllocateGroup:
:
getOldOwner
,
weLeaveUserInfoAllocateVo
.
getHandoverUserid
()));
if
(
CollectionUtil
.
isNotEmpty
(
weGroups
)){
if
(
CollectionUtil
.
isNotEmpty
(
weAllocateGroupList
)){
//同步企业微信端
List
<
WeGroup
>
weGroups
AllocateGroupDto
allocateGroup
=
weUserClient
.
allocateGroup
(
=
this
.
list
(
new
LambdaQueryWrapper
<
WeGroup
>().
in
(
WeGroup:
:
getChatId
,
AllocateWeGroupDto
.
builder
()
weAllocateGroupList
.
stream
().
map
(
WeAllocateGroup:
:
getChatId
).
collect
(
Collectors
.
toList
())));
.
chat_id_list
(
ArrayUtil
.
toArray
(
weGroups
.
stream
().
map
(
WeGroup:
:
getChatId
).
collect
(
Collectors
.
toList
()),
String
.
class
))
.
new_owner
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
())
if
(
CollectionUtil
.
isNotEmpty
(
weGroups
)){
.
build
()
);
//同步企业微信端
AllocateGroupDto
allocateGroup
=
weUserClient
.
allocateGroup
(
//构建分配记录
AllocateWeGroupDto
.
builder
()
List
<
WeAllocateGroup
>
weAllocateGroups
=
new
ArrayList
<>();
.
chat_id_list
(
ArrayUtil
.
toArray
(
weGroups
.
stream
().
map
(
WeGroup:
:
getChatId
).
collect
(
Collectors
.
toList
()),
String
.
class
))
//更改本地群主
.
new_owner
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
())
weGroups
.
stream
().
forEach
(
k
->
{
.
build
()
k
.
setOwner
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
()
);
);
weAllocateGroups
.
add
(
WeAllocateGroup
.
builder
()
.
allocateTime
(
new
Date
())
//更改本地群主
.
chatId
(
k
.
getChatId
())
weAllocateGroupList
.
stream
().
forEach
(
kk
->{
.
status
(
AllocateGroupStatus
.
ALLOCATE_GROUP_STATUS_BJTCG
.
getKey
())
.
newOwner
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
())
kk
.
setAllocateTime
(
new
Date
());
.
oldOwner
(
weLeaveUserInfoAllocateVo
.
getHandoverUserid
())
kk
.
setNewOwner
(
weLeaveUserInfoAllocateVo
.
getTakeoverUserid
());
.
build
()
);
}
);
});
//处理接替失败的群
//处理接替失败的群
...
@@ -121,7 +121,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -121,7 +121,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
.
setOwner
(
weLeaveUserInfoAllocateVo
.
getHandoverUserid
());
.
setOwner
(
weLeaveUserInfoAllocateVo
.
getHandoverUserid
());
WeAllocateGroup
weAllocateGroup
WeAllocateGroup
weAllocateGroup
=
weAllocateGroup
s
.
stream
().
filter
(
kk
->
kk
.
getChatId
().
equals
(
k
.
getChat_id
())).
findFirst
().
get
();
=
weAllocateGroup
List
.
stream
().
filter
(
kk
->
kk
.
getChatId
().
equals
(
k
.
getChat_id
())).
findFirst
().
get
();
if
(
null
!=
weAllocateGroup
){
if
(
null
!=
weAllocateGroup
){
weAllocateGroup
.
setStatus
(
AllocateGroupStatus
.
ALLOCATE_GROUP_STATUS_JTSB
.
getKey
());
weAllocateGroup
.
setStatus
(
AllocateGroupStatus
.
ALLOCATE_GROUP_STATUS_JTSB
.
getKey
());
weAllocateGroup
.
setErrMsg
(
weAllocateGroup
.
getErrMsg
());
weAllocateGroup
.
setErrMsg
(
weAllocateGroup
.
getErrMsg
());
...
@@ -130,12 +130,19 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -130,12 +130,19 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
});
});
}
}
if
(
this
.
saveOrUpdateBatch
(
weGroups
)){
if
(
this
.
saveOrUpdateBatch
(
weGroups
)){
iWeAllocateGroupService
iWeAllocateGroupService
.
saveOrUpdateBatch
(
weAllocateGroups
);
.
batchAddOrUpdate
(
weAllocateGroupList
);
}
}
}
}
}
}
}
...
@@ -156,7 +163,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -156,7 +163,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
SecurityContextHolder
.
setContext
(
securityContext
);
SecurityContextHolder
.
setContext
(
securityContext
);
CustomerGroupList
customerGroupList
=
CustomerGroupList
customerGroupList
=
weCustomerGroupClient
.
groupChatLists
(
new
CustomerGroupList
().
new
Params
());
weCustomerGroupClient
.
groupChatLists
(
CustomerGroupList
.
Params
.
builder
().
build
());
if
(
customerGroupList
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)
if
(
customerGroupList
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)
&&
CollectionUtil
.
isNotEmpty
(
customerGroupList
.
getGroupChatList
()))
{
&&
CollectionUtil
.
isNotEmpty
(
customerGroupList
.
getGroupChatList
()))
{
...
@@ -164,7 +171,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -164,7 +171,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
List
<
WeGroupMember
>
weGroupMembers
=
new
ArrayList
<>();
List
<
WeGroupMember
>
weGroupMembers
=
new
ArrayList
<>();
customerGroupList
.
getGroupChatList
().
stream
().
forEach
(
k
->
{
customerGroupList
.
getGroupChatList
().
stream
().
forEach
(
k
->
{
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
new
CustomerGroupDetail
().
new
Params
(
k
.
getChatId
(),
1
)
CustomerGroupDetail
.
Params
.
builder
().
chat_id
(
k
.
getChatId
()).
need_name
(
1
).
build
(
)
);
);
if
(
customerGroupDetail
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)
if
(
customerGroupDetail
.
getErrcode
().
equals
(
WeConstans
.
WE_SUCCESS_CODE
)
...
@@ -227,7 +234,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -227,7 +234,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
List
<
WeGroup
>
weGroups
=
new
ArrayList
<>();
List
<
WeGroup
>
weGroups
=
new
ArrayList
<>();
List
<
WeGroupMember
>
weGroupMembers
=
new
ArrayList
<>();
List
<
WeGroupMember
>
weGroupMembers
=
new
ArrayList
<>();
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
new
CustomerGroupDetail
().
new
Params
(
chatId
,
1
)
CustomerGroupDetail
.
Params
.
builder
().
chat_id
(
chatId
).
need_name
(
1
).
build
(
)
);
);
if
(
CollectionUtil
.
isNotEmpty
(
customerGroupDetail
.
getGroupChat
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
customerGroupDetail
.
getGroupChat
()))
{
customerGroupDetail
.
getGroupChat
().
stream
().
forEach
(
kk
->
{
customerGroupDetail
.
getGroupChat
().
stream
().
forEach
(
kk
->
{
...
@@ -272,7 +279,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -272,7 +279,7 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
List
<
WeGroup
>
weGroups
=
new
ArrayList
<>();
List
<
WeGroup
>
weGroups
=
new
ArrayList
<>();
List
<
WeGroupMember
>
weGroupMembers
=
new
ArrayList
<>();
List
<
WeGroupMember
>
weGroupMembers
=
new
ArrayList
<>();
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
new
CustomerGroupDetail
().
new
Params
(
chatId
,
1
)
CustomerGroupDetail
.
Params
.
builder
().
chat_id
(
chatId
).
need_name
(
1
).
build
(
)
);
);
if
(
CollectionUtil
.
isNotEmpty
(
customerGroupDetail
.
getGroupChat
()))
{
if
(
CollectionUtil
.
isNotEmpty
(
customerGroupDetail
.
getGroupChat
()))
{
customerGroupDetail
.
getGroupChat
().
stream
().
forEach
(
kk
->
{
customerGroupDetail
.
getGroupChat
().
stream
().
forEach
(
kk
->
{
...
@@ -323,8 +330,6 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -323,8 +330,6 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
List
<
List
<
WeGroup
>>
lists
=
Lists
.
partition
(
weGroups
,
500
);
List
<
List
<
WeGroup
>>
lists
=
Lists
.
partition
(
weGroups
,
500
);
for
(
List
<
WeGroup
>
groupList
:
lists
)
{
for
(
List
<
WeGroup
>
groupList
:
lists
)
{
this
.
baseMapper
.
insertBatch
(
groupList
);
this
.
baseMapper
.
insertBatch
(
groupList
);
// this.remove(new LambdaQueryWrapper<WeGroup>()
// .notIn(WeGroup::getChatId, groupList.stream().map(WeGroup::getChatId).collect(Collectors.toList())));
}
}
}
else
{
}
else
{
List
<
WeGroup
>
oldWeGroups
=
this
.
list
();
List
<
WeGroup
>
oldWeGroups
=
this
.
list
();
...
@@ -351,12 +356,6 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
...
@@ -351,12 +356,6 @@ public class WeGroupServiceImpl extends ServiceImpl<WeGroupMapper, WeGroup> impl
iWeGroupMemberService
.
insertBatch
(
groupMemberList
);
iWeGroupMemberService
.
insertBatch
(
groupMemberList
);
// iWeGroupMemberService.remove(
// new LambdaQueryWrapper<WeGroupMember>()
// .notIn(WeGroupMember::getUserId,groupMemberList.stream().map(WeGroupMember::getUserId).collect(Collectors.toList()))
//
// );
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeMsgTlpServiceImpl.java
View file @
be7e45e
This diff is collapsed.
Click to expand it.
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePosterServiceImpl.java
View file @
be7e45e
...
@@ -207,7 +207,7 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
...
@@ -207,7 +207,7 @@ public class WePosterServiceImpl extends ServiceImpl<WePosterMapper, WePoster> i
}
}
@Override
@Override
public
List
<
WeMaterial
>
findWePosterToWeMaterial
(
String
categoryId
,
String
name
)
{
public
List
<
WeMaterial
>
findWePosterToWeMaterial
(
String
categoryId
,
String
name
,
Integer
status
)
{
return
this
.
baseMapper
.
findWePosterToWeMaterial
(
categoryId
,
name
);
return
this
.
baseMapper
.
findWePosterToWeMaterial
(
categoryId
,
name
,
status
);
}
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WePresTagGroupTaskServiceImpl.java
View file @
be7e45e
...
@@ -199,6 +199,23 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
...
@@ -199,6 +199,23 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
return
rows
;
return
rows
;
}
}
/**
* 更新任务同时推送消息
* @param task
*/
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateTaskAndSendMsg
(
WePresTagGroupTask
task
)
throws
WeComException
{
try
{
this
.
updateTask
(
task
);
this
.
sendMessage
(
task
);
}
catch
(
WeComException
e
){
throw
e
;
}
}
@Override
@Override
public
List
<
WePresTagGroupTaskStat
>
getTaskStat
(
Long
id
,
String
customerName
,
Integer
isInGroup
,
Integer
isSent
,
Integer
sendType
)
{
public
List
<
WePresTagGroupTaskStat
>
getTaskStat
(
Long
id
,
String
customerName
,
Integer
isInGroup
,
Integer
isSent
,
Integer
sendType
)
{
...
@@ -245,8 +262,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
...
@@ -245,8 +262,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
}
}
@Override
@Override
@Async
public
void
sendMessage
(
WePresTagGroupTask
task
)
throws
WeComException
{
public
void
sendMessage
(
WePresTagGroupTask
task
)
{
Integer
sendType
=
task
.
getSendType
();
Integer
sendType
=
task
.
getSendType
();
try
{
try
{
// 企业群发逻辑
// 企业群发逻辑
...
@@ -334,6 +350,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
...
@@ -334,6 +350,7 @@ public class WePresTagGroupTaskServiceImpl extends ServiceImpl<WePresTagGroupTas
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"============> 老客标签建群任务发送失败, 任务明细: {}"
,
task
);
log
.
error
(
"============> 老客标签建群任务发送失败, 任务明细: {}"
,
task
);
log
.
error
(
"错误信息: {}"
,
e
.
getMessage
());
log
.
error
(
"错误信息: {}"
,
e
.
getMessage
());
throw
new
WeComException
(
e
.
getMessage
());
}
}
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeUserServiceImpl.java
View file @
be7e45e
...
@@ -18,20 +18,23 @@ import com.linkwechat.common.utils.Threads;
...
@@ -18,20 +18,23 @@ import com.linkwechat.common.utils.Threads;
import
com.linkwechat.common.utils.spring.SpringUtils
;
import
com.linkwechat.common.utils.spring.SpringUtils
;
import
com.linkwechat.wecom.annotation.SynchRecord
;
import
com.linkwechat.wecom.annotation.SynchRecord
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.client.WeCustomerClient
;
import
com.linkwechat.wecom.client.WeCustomerGroupClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.client.WeUserClient
;
import
com.linkwechat.wecom.constants.SynchRecordConstants
;
import
com.linkwechat.wecom.constants.SynchRecordConstants
;
import
com.linkwechat.wecom.domain.WeAllocateCustomer
;
import
com.linkwechat.wecom.domain.WeAllocateGroup
;
import
com.linkwechat.wecom.domain.WeCustomerAddUser
;
import
com.linkwechat.wecom.domain.WeCustomerAddUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.WeUser
;
import
com.linkwechat.wecom.domain.dto.AllocateWeCustomerDto
;
import
com.linkwechat.wecom.domain.dto.WeUserInfoDto
;
import
com.linkwechat.wecom.domain.dto.WeUserInfoDto
;
import
com.linkwechat.wecom.domain.dto.customer.CustomerGroupDetail
;
import
com.linkwechat.wecom.domain.dto.customer.CustomerGroupList
;
import
com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail
;
import
com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail
;
import
com.linkwechat.wecom.domain.dto.customer.FollowUserList
;
import
com.linkwechat.wecom.domain.dto.customer.FollowUserList
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
import
com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto
;
import
com.linkwechat.wecom.domain.vo.*
;
import
com.linkwechat.wecom.domain.vo.*
;
import
com.linkwechat.wecom.mapper.WeUserMapper
;
import
com.linkwechat.wecom.mapper.WeUserMapper
;
import
com.linkwechat.wecom.service.IWeCustomerService
;
import
com.linkwechat.wecom.service.*
;
import
com.linkwechat.wecom.service.IWeDepartmentService
;
import
com.linkwechat.wecom.service.IWeGroupService
;
import
com.linkwechat.wecom.service.IWeUserService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.security.core.context.SecurityContext
;
import
org.springframework.security.core.context.SecurityContext
;
...
@@ -70,7 +73,17 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -70,7 +73,17 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
@Autowired
@Autowired
private
WeCustomerClient
weCustomerClient
;
private
WeCustomerClient
weCustomerClient
;
@Autowired
private
IWeAllocateCustomerService
iWeAllocateCustomerService
;
@Autowired
private
WeCustomerGroupClient
weCustomerGroupClient
;
@Autowired
private
IWeAllocateGroupService
iWeAllocateGroupService
;
@Autowired
private
IWeGroupService
iWeGroupService
;
@Override
@Override
public
WeUser
getById
(
Long
id
)
{
public
WeUser
getById
(
Long
id
)
{
...
@@ -196,7 +209,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -196,7 +209,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
public
void
allocateLeaveUserAboutData
(
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
)
{
public
void
allocateLeaveUserAboutData
(
WeLeaveUserInfoAllocateVo
weLeaveUserInfoAllocateVo
)
{
try
{
try
{
//分配客户
//分配客户
SpringUtils
.
getBean
(
IWeCustomerService
.
class
).
allocateWeCustomer
(
weLeaveUserInfoAllocateVo
);
//
SpringUtils.getBean(IWeCustomerService.class).allocateWeCustomer(weLeaveUserInfoAllocateVo);
//分配群组
//分配群组
SpringUtils
.
getBean
(
IWeGroupService
.
class
).
allocateWeGroup
(
weLeaveUserInfoAllocateVo
);
SpringUtils
.
getBean
(
IWeGroupService
.
class
).
allocateWeGroup
(
weLeaveUserInfoAllocateVo
);
//更新员工状态为已分配
//更新员工状态为已分配
...
@@ -282,6 +295,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -282,6 +295,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
*/
*/
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Async
public
void
deleteUser
(
String
[]
userIds
)
{
public
void
deleteUser
(
String
[]
userIds
)
{
List
<
WeUser
>
weUsers
=
new
ArrayList
<>();
List
<
WeUser
>
weUsers
=
new
ArrayList
<>();
CollectionUtil
.
newArrayList
(
userIds
).
forEach
(
userId
->
{
CollectionUtil
.
newArrayList
(
userIds
).
forEach
(
userId
->
{
...
@@ -307,6 +321,8 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -307,6 +321,8 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
);
);
if
(
this
.
updateBatchById
(
weUsers
)){
if
(
this
.
updateBatchById
(
weUsers
)){
weUsers
.
forEach
(
k
->
weUserClient
.
deleteUserByUserId
(
k
.
getUserId
()));
weUsers
.
forEach
(
k
->
weUserClient
.
deleteUserByUserId
(
k
.
getUserId
()));
//同步离职成员相关信息分配
this
.
synchLeaveUserData
();
}
}
}
}
...
@@ -365,4 +381,104 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
...
@@ -365,4 +381,104 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
}
}
/**
* 同步离职成员的相关数据(待分配客户,待分配群)。
*/
@Override
@Async
public
void
synchLeaveUserData
()
{
//同步所需要分配的客户
List
<
AllocateWeCustomerDto
.
Info
>
infos
=
new
ArrayList
<>();
getLeaveUserCustomer
(
null
,
infos
);
if
(
CollectionUtil
.
isNotEmpty
(
infos
)){
//过滤掉不存在的外部联系人
List
<
WeAllocateCustomer
>
allocateCustomers
=
new
ArrayList
<>();
infos
.
stream
().
forEach
(
kk
->{
allocateCustomers
.
add
(
WeAllocateCustomer
.
builder
()
.
allocateTime
(
new
Date
())
.
extentType
(
new
Integer
(
1
))
.
externalUserid
(
kk
.
getExternal_userid
())
.
handoverUserid
(
kk
.
getHandover_userid
())
.
status
(
new
Integer
(
2
))
.
failReason
(
"离职继承"
)
.
build
()
);
});
iWeAllocateCustomerService
.
batchAddOrUpdate
(
allocateCustomers
);
}
//同步所需分配的客户群
List
<
CustomerGroupList
.
GroupChat
>
groupChats
=
new
ArrayList
<>();
getLeaveUserGroup
(
null
,
groupChats
);
if
(
CollectionUtil
.
isNotEmpty
(
groupChats
)){
List
<
WeAllocateGroup
>
weAllocateGroups
=
new
ArrayList
<>();
groupChats
.
stream
().
forEach
(
k
->{
CustomerGroupDetail
customerGroupDetail
=
weCustomerGroupClient
.
groupChatDetail
(
CustomerGroupDetail
.
Params
.
builder
()
.
chat_id
(
k
.
getChatId
())
.
need_name
(
new
Integer
(
0
))
.
build
());
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
customerGroupDetail
.
getErrcode
())
&&
ArrayUtil
.
isNotEmpty
(
customerGroupDetail
.
getGroupChat
())){
weAllocateGroups
.
add
(
WeAllocateGroup
.
builder
()
.
chatId
(
k
.
getChatId
())
.
oldOwner
(
customerGroupDetail
.
getGroupChat
().
stream
().
findFirst
().
get
().
getOwner
())
.
status
(
new
Integer
(
3
))
.
build
());
}
});
iWeAllocateGroupService
.
batchAddOrUpdate
(
weAllocateGroups
);
}
}
private
void
getLeaveUserCustomer
(
String
nextCursor
,
List
<
AllocateWeCustomerDto
.
Info
>
list
){
AllocateWeCustomerDto
unassignedList
=
weUserClient
.
getUnassignedList
(
AllocateWeCustomerDto
.
CheckParm
.
builder
()
.
cursor
(
nextCursor
)
.
build
());
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
unassignedList
.
getErrcode
())
&&
ArrayUtil
.
isNotEmpty
(
unassignedList
.
getInfo
()))
{
list
.
addAll
(
unassignedList
.
getInfo
());
if
(
StringUtils
.
isNotEmpty
(
unassignedList
.
getNext_cursor
()))
{
getLeaveUserCustomer
(
unassignedList
.
getNext_cursor
(),
list
);
}
}
}
private
void
getLeaveUserGroup
(
String
nextCursor
,
List
<
CustomerGroupList
.
GroupChat
>
groupChats
){
CustomerGroupList
customerGroupList
=
weCustomerGroupClient
.
groupChatLists
(
CustomerGroupList
.
Params
.
builder
()
.
status_filter
(
new
Integer
(
1
))
.
cursor
(
nextCursor
)
.
limit
(
new
Integer
(
1000
))
.
build
());
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
customerGroupList
.
getErrcode
())
&&
ArrayUtil
.
isNotEmpty
(
customerGroupList
.
getGroupChatList
()))
{
groupChats
.
addAll
(
customerGroupList
.
getGroupChatList
());
if
(
StringUtils
.
isNotEmpty
(
customerGroupList
.
getNext_cursor
()))
{
getLeaveUserGroup
(
customerGroupList
.
getNext_cursor
(),
groupChats
);
}
}
}
}
}
linkwe-wecom/src/main/resources/mapper/wecom/WeAllocateCustomerMapper.xml
View file @
be7e45e
...
@@ -5,22 +5,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -5,22 +5,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeAllocateCustomerMapper"
>
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeAllocateCustomerMapper"
>
<!-- <select id="getAllocateCustomers" resultType="com.linkwechat.wecom.domain.vo.WeAllocateCustomer">-->
<insert
id=
"batchAddOrUpdate"
>
<!-- -->
INSERT INTO we_allocate_customer(
<!-- SELECT-->
takeover_userid,
<!-- wc.`name` as customerName,-->
external_userid,
<!-- wu.user_name as userName,-->
allocate_time,
<!-- (SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,-->
handover_userid,
<!-- wac.allocate_time-->
status,
<!-- FROM-->
takeover_time,
<!-- we_allocate_customer wac-->
fail_reason
<!-- INNER JOIN we_customer wc ON wc.external_userid=wac.external_userid-->
) values
<!-- INNER JOIN we_user wu ON wu.user_id=wac.takeover_userid-->
<foreach
collection=
"weAllocateCustomers"
item=
"item"
index=
"index"
separator=
","
>
<!-- WHERE wac.handover_userid=1232-->
(#{item.takeoverUserid},#{item.externalUserid},#{item.allocateTime},#{item.handoverUserid},#{item.status},#{item.takeoverTime},#{item.failReason})
<!-- AND -->
</foreach>
ON DUPLICATE KEY UPDATE
<!-- -->
takeover_userid=IF(TRIM(VALUES(takeover_userid)) != '',VALUES(takeover_userid),we_allocate_customer.takeover_userid),
<!-- </select>-->
allocate_time=IF(VALUES(allocate_time), VALUES(allocate_time), we_allocate_customer.allocate_time),
takeover_time=IF(VALUES(takeover_time), VALUES(takeover_time), we_allocate_customer.takeover_time),
status=IF(VALUES(status), VALUES(status),we_allocate_customer.status),
fail_reason=IF(TRIM(VALUES(fail_reason)) !='',VALUES(fail_reason),we_allocate_customer.fail_reason);
</insert>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeAllocateGroupMapper.xml
View file @
be7e45e
...
@@ -3,7 +3,23 @@
...
@@ -3,7 +3,23 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeAllocateGroupMapper"
>
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeAllocateGroupMapper"
>
<insert
id=
"batchAddOrUpdate"
>
INSERT INTO we_allocate_group(
chat_id,
new_owner,
err_msg,
status,
old_owner,
allocate_time
) values
<foreach
collection=
"weAllocateGroupList"
item=
"item"
index=
"index"
separator=
","
>
(#{item.chatId},#{item.newOwner},#{item.errMsg},#{item.status},#{item.oldOwner},#{item.allocateTime})
</foreach>
ON DUPLICATE KEY UPDATE
new_owner=IF(TRIM(VALUES(new_owner)) != '',VALUES(new_owner), we_allocate_group.new_owner),
allocate_time=IF(VALUES(allocate_time),VALUES(allocate_time),we_allocate_group.allocate_time),
status=IF(VALUES(status), VALUES(status), we_allocate_group.status);
</insert>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
be7e45e
...
@@ -220,24 +220,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -220,24 +220,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
)
)
</foreach>
</foreach>
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
NAME=IF(
we_customer.NAME != null,we_customer.NAME, VALUES(NAME)
),
NAME=IF(
TRIM(VALUES(NAME)) !='',VALUES(NAME),we_customer.NAME
),
avatar=IF(
we_customer.avatar != null
, VALUES(avatar), we_customer.avatar),
avatar=IF(
TRIM(VALUES(avatar)) !=''
, VALUES(avatar), we_customer.avatar),
customer_type=IF(
we_customer.customer_type != null, we_customer.customer_type,VALUES(customer_type)
),
customer_type=IF(
VALUES(customer_type),VALUES(customer_type),we_customer.customer_type
),
gender=IF(
we_customer.gender != null
, VALUES(gender), we_customer.gender),
gender=IF(
VALUES(gender)
, VALUES(gender), we_customer.gender),
unionid=IF(
we_customer.unionid != null
, VALUES(unionid), we_customer.unionid),
unionid=IF(
TRIM(VALUES(unionid)) !=''
, VALUES(unionid), we_customer.unionid),
birthday=IF(
we_customer.birthday != null
,VALUES(birthday), we_customer.birthday),
birthday=IF(
VALUES(birthday)
,VALUES(birthday), we_customer.birthday),
corp_name=IF(
we_customer.corp_name != null
, VALUES(corp_name), we_customer.corp_name),
corp_name=IF(
TRIM(VALUES(corp_name)) !=''
, VALUES(corp_name), we_customer.corp_name),
position=IF(
we_customer.position != null, VALUES(position)
, we_customer.position),
position=IF(
TRIM(VALUES(position)) != '',VALUES(position)
, we_customer.position),
is_open_chat=IF(
we_customer.is_open_chat != null
, VALUES(is_open_chat), we_customer.is_open_chat),
is_open_chat=IF(
VALUES(is_open_chat)
, VALUES(is_open_chat), we_customer.is_open_chat),
first_user_id=IF(
we_customer.first_user_id != null
, VALUES(first_user_id), we_customer.first_user_id),
first_user_id=IF(
TRIM(VALUES(first_user_id)) !=''
, VALUES(first_user_id), we_customer.first_user_id),
first_add_time=IF(
we_customer.first_add_time != null
, VALUES(first_add_time), we_customer.first_add_time),
first_add_time=IF(
VALUES(first_add_time)
, VALUES(first_add_time), we_customer.first_add_time),
qq=IF(
we_customer.qq != null
, VALUES(qq), we_customer.qq),
qq=IF(
TRIM(VALUES(qq)) !=''
, VALUES(qq), we_customer.qq),
email=IF(
we_customer.email != null
, VALUES(email), we_customer.email),
email=IF(
TRIM(VALUES(email)) != ''
, VALUES(email), we_customer.email),
address=IF(
we_customer.address != null
, VALUES(address), we_customer.address),
address=IF(
TRIM(VALUES(address)) != ''
, VALUES(address), we_customer.address),
phone=IF(
we_customer.phone != null
, VALUES(phone), we_customer.phone),
phone=IF(
TRIM(VALUES(phone)) != ''
, VALUES(phone), we_customer.phone),
add_method=IF(
we_customer.add_method != null, we_customer.add_method, VALUES(add_method)
),
add_method=IF(
VALUES(add_method), VALUES(add_method), we_customer.add_method
),
del_flag=IF(
we_customer.del_flag != null, we_customer.del_flag, VALUES(del_flag)
),
del_flag=IF(
VALUES(del_flag),VALUES(del_flag),we_customer.del_flag
),
state=IF(
we_customer.state != null and we_customer.state !='',we_customer.state, VALUES(state)
);
state=IF(
TRIM(VALUES(state)) != '',VALUES(state),we_customer.state
);
</insert>
</insert>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
View file @
be7e45e
...
@@ -85,10 +85,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -85,10 +85,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{item.userId},#{item.externalUserid},#{item.tagId},NOW(),#{item.isCompanyTag},#{item.delFlag})
(#{item.userId},#{item.externalUserid},#{item.tagId},NOW(),#{item.isCompanyTag},#{item.delFlag})
</foreach>
</foreach>
ON DUPLICATE KEY UPDATE
ON DUPLICATE KEY UPDATE
user_id=IF(
we_flower_customer_tag_rel.user_id != null
, VALUES(user_id), we_flower_customer_tag_rel.user_id),
user_id=IF(
TRIM(VALUES(user_id)) !=''
, VALUES(user_id), we_flower_customer_tag_rel.user_id),
external_userid=IF(
we_flower_customer_tag_rel.external_userid != null
, VALUES(external_userid), we_flower_customer_tag_rel.external_userid),
external_userid=IF(
TRIM(VALUES(external_userid)) !=''
, VALUES(external_userid), we_flower_customer_tag_rel.external_userid),
tag_id=IF(
we_flower_customer_tag_rel.tag_id != null
, VALUES(tag_id), we_flower_customer_tag_rel.tag_id),
tag_id=IF(
TRIM(VALUES(tag_id)) !=''
, VALUES(tag_id), we_flower_customer_tag_rel.tag_id),
del_flag=IF(
we_flower_customer_tag_rel.del_flag != null, we_flower_customer_tag_rel.del_flag, VALUES(del_flag)
);
del_flag=IF(
VALUES(del_flag), VALUES(del_flag),we_flower_customer_tag_rel.del_flag
);
</insert>
</insert>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WePresTagGroupTaskMapper.xml
View file @
be7e45e
...
@@ -304,12 +304,12 @@
...
@@ -304,12 +304,12 @@
END
END
AND CASE
AND CASE
WHEN ( SELECT cus_begin_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId} )
WHEN ( SELECT cus_begin_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId} )
THEN cu.first_add_time
>
= ( SELECT t.cus_begin_time FROM we_pres_tag_group t WHERE t.task_id = #{taskId} )
THEN cu.first_add_time
>
= ( SELECT t.cus_begin_time
FROM we_pres_tag_group t WHERE t.task_id = #{taskId} )
ELSE 1 = 1
ELSE 1 = 1
END
END
AND CASE
AND CASE
WHEN ( SELECT cus_end_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId} )
WHEN ( SELECT cus_end_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId} )
THEN cu.first_add_time
<
= (SELECT t.cus_
end
_time FROM we_pres_tag_group t WHERE t.task_id = #{taskId} )
THEN cu.first_add_time
<
= (SELECT t.cus_
begin
_time FROM we_pres_tag_group t WHERE t.task_id = #{taskId} )
WHEN (SELECT update_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId})
WHEN (SELECT update_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId})
THEN cu.first_add_time
<
= ( SELECT t.update_time FROM we_pres_tag_group t WHERE t.task_id = #{taskId} )
THEN cu.first_add_time
<
= ( SELECT t.update_time FROM we_pres_tag_group t WHERE t.task_id = #{taskId} )
WHEN (SELECT create_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId})
WHEN (SELECT create_time is not null FROM we_pres_tag_group WHERE task_id = #{taskId})
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeUserMapper.xml
View file @
be7e45e
...
@@ -108,8 +108,10 @@
...
@@ -108,8 +108,10 @@
wu.user_name,
wu.user_name,
wu.dimission_time,
wu.dimission_time,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,
(SELECT COUNT(*) FROM we_customer wc WHERE wc.first_user_id=wu.user_id) as allocateCustomerNum,
(SELECT count(*) FROM we_allocate_customer wac
(SELECT COUNT(*) FROM we_group wg WHERE wg.`owner`=wu.user_id) as allocateGroupNum
INNER JOIN we_customer wc ON wac.external_userid=wc.external_userid
and wac.handover_userid=wc.first_user_id WHERE wac.handover_userid=wu.user_id) as allocateCustomerNum,
(SELECT COUNT(*) FROM we_allocate_group wg WHERE wg.old_owner=wu.user_id) as allocateGroupNum
FROM
FROM
we_user wu
we_user wu
<where>
<where>
...
@@ -156,6 +158,8 @@
...
@@ -156,6 +158,8 @@
wc.`name` as customerName,
wc.`name` as customerName,
wu.user_name as takeUserName,
wu.user_name as takeUserName,
wac.allocate_time,
wac.allocate_time,
wc.external_userid as externalUserid,
wc.first_user_id as userId,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
FROM
we_allocate_customer wac
we_allocate_customer wac
...
@@ -175,7 +179,7 @@
...
@@ -175,7 +179,7 @@
SELECT
SELECT
wu.user_name as newOwnerName,
wu.user_name as newOwnerName,
wg.chat_id,
wg.chat_id,
wg.
group_name,
IF(wg.group_name,wg.group_name,"群聊") as
group_name,
(SELECT count(*) FROM we_group_member wgm WHERE wgm.chat_id=wg.chat_id) as memberNum,
(SELECT count(*) FROM we_group_member wgm WHERE wgm.chat_id=wg.chat_id) as memberNum,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department,
wag.allocate_time
wag.allocate_time
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeposterMapper.xml
View file @
be7e45e
...
@@ -18,7 +18,9 @@
...
@@ -18,7 +18,9 @@
<if
test=
"name !=null and name !=''"
>
<if
test=
"name !=null and name !=''"
>
AND title like concat('%',#{name,jdbcType=VARCHAR},'%')
AND title like concat('%',#{name,jdbcType=VARCHAR},'%')
</if>
</if>
and status = 0
<if
test=
"status !=null"
>
AND status = #{status}
</if>
and del_flag=0
and del_flag=0
ORDER BY create_time DESC
ORDER BY create_time DESC
</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