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 3c532b67
authored
Jul 16, 2021
by
水库浪子
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修改群发,任务宝图片上传等BUG;
1 parent
04e3839d
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
242 additions
and
23 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerMessagePushController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/CustomerMessagePushDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerMessagePushService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerMessagePushController.java
View file @
3c532b6
...
@@ -36,7 +36,6 @@ public class WeCustomerMessagePushController extends BaseController {
...
@@ -36,7 +36,6 @@ public class WeCustomerMessagePushController extends BaseController {
@Autowired
@Autowired
@Lazy
private
IWeCustomerMessagePushService
weCustomerMessagePushService
;
private
IWeCustomerMessagePushService
weCustomerMessagePushService
;
@Autowired
@Autowired
...
@@ -59,7 +58,7 @@ public class WeCustomerMessagePushController extends BaseController {
...
@@ -59,7 +58,7 @@ public class WeCustomerMessagePushController extends BaseController {
SecurityContextHolder
.
setContext
(
context
);
SecurityContextHolder
.
setContext
(
context
);
weCustomerMessagePushService
.
addWeCustomerMessagePush
(
customerMessagePushDto
);
weCustomerMessagePushService
.
addWeCustomerMessagePush
(
customerMessagePushDto
);
}
catch
(
JsonProcessingException
|
ParseException
e
)
{
}
catch
(
JsonProcessingException
|
ParseException
|
CloneNotSupportedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
return
AjaxResult
.
error
(
"群发失败"
);
return
AjaxResult
.
error
(
"群发失败"
);
}
}
...
...
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTaskFissionController.java
View file @
3c532b6
...
@@ -18,6 +18,8 @@ import com.linkwechat.common.utils.DateUtils;
...
@@ -18,6 +18,8 @@ import com.linkwechat.common.utils.DateUtils;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.file.FileUploadUtils
;
import
com.linkwechat.common.utils.file.FileUploadUtils
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.framework.web.domain.server.SysFile
;
import
com.linkwechat.framework.web.service.FileService
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeTaskFission
;
import
com.linkwechat.wecom.domain.WeTaskFission
;
import
com.linkwechat.wecom.domain.dto.WeChatUserDTO
;
import
com.linkwechat.wecom.domain.dto.WeChatUserDTO
;
...
@@ -55,9 +57,13 @@ import java.util.Objects;
...
@@ -55,9 +57,13 @@ import java.util.Objects;
public
class
WeTaskFissionController
extends
BaseController
{
public
class
WeTaskFissionController
extends
BaseController
{
@Autowired
@Autowired
private
IWeTaskFissionService
weTaskFissionService
;
private
IWeTaskFissionService
weTaskFissionService
;
@Autowired
@Autowired
private
CosConfig
cosConfig
;
private
CosConfig
cosConfig
;
@Autowired
private
FileService
fileService
;
/**
/**
* 查询任务宝列表
* 查询任务宝列表
*/
*/
...
@@ -226,10 +232,13 @@ public class WeTaskFissionController extends BaseController {
...
@@ -226,10 +232,13 @@ public class WeTaskFissionController extends BaseController {
@Log
(
title
=
"上传兑奖图片"
,
businessType
=
BusinessType
.
OTHER
)
@Log
(
title
=
"上传兑奖图片"
,
businessType
=
BusinessType
.
OTHER
)
@PostMapping
(
"/upload"
)
@PostMapping
(
"/upload"
)
@ApiOperation
(
value
=
"上传兑奖图片"
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"上传兑奖图片"
,
httpMethod
=
"POST"
)
public
AjaxResult
<
JSONObject
>
upload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
)
throws
IOException
{
public
AjaxResult
<
JSONObject
>
upload
(
@RequestParam
(
value
=
"file"
)
MultipartFile
file
)
throws
Exception
{
String
url
=
FileUploadUtils
.
upload2Cos
(
file
,
cosConfig
);
SysFile
sysFile
=
fileService
.
upload
(
file
);
// String url = FileUploadUtils.upload2Cos(file, cosConfig);
JSONObject
json
=
new
JSONObject
();
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"rewardImageUrl"
,
cosConfig
.
getCosImgUrlPrefix
()+
url
);
json
.
put
(
"rewardImageUrl"
,
sysFile
.
getImgUrlPrefix
()+
sysFile
.
getFileName
()
);
return
AjaxResult
.
success
(
json
);
return
AjaxResult
.
success
(
json
);
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/message/CustomerMessagePushDto.java
View file @
3c532b6
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto.message;
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.domain.dto.message;
import
lombok.Data
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -9,7 +10,7 @@ import java.util.List;
...
@@ -9,7 +10,7 @@ import java.util.List;
*/
*/
@SuppressWarnings
(
"all"
)
@SuppressWarnings
(
"all"
)
@Data
@Data
public
class
CustomerMessagePushDto
{
public
class
CustomerMessagePushDto
implements
Cloneable
{
/**
/**
* 群发类型 0 发给客户 1 发给客户群
* 群发类型 0 发给客户 1 发给客户群
...
@@ -108,4 +109,25 @@ public class CustomerMessagePushDto {
...
@@ -108,4 +109,25 @@ public class CustomerMessagePushDto {
}
}
@Override
public
CustomerMessagePushDto
clone
()
throws
CloneNotSupportedException
{
return
(
CustomerMessagePushDto
)
super
.
clone
();
}
public
List
<
CustomerMessagePushDto
>
handleImageAndText
()
throws
CloneNotSupportedException
{
List
<
CustomerMessagePushDto
>
customerMessagePushDtos
=
new
ArrayList
<>();
CustomerMessagePushDto
cloneOne
=
this
.
clone
();
cloneOne
.
setMessageType
(
"0"
);
customerMessagePushDtos
.
add
(
cloneOne
);
CustomerMessagePushDto
cloneTwo
=
this
.
clone
();
cloneTwo
.
setMessageType
(
"1"
);
customerMessagePushDtos
.
add
(
cloneTwo
);
return
customerMessagePushDtos
;
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
View file @
3c532b6
...
@@ -99,4 +99,14 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
...
@@ -99,4 +99,14 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
WeCustomerSocialConn
countSocialConn
(
@Param
(
"externalUserid"
)
String
externalUserid
,
@Param
(
"userid"
)
String
userid
);
WeCustomerSocialConn
countSocialConn
(
@Param
(
"externalUserid"
)
String
externalUserid
,
@Param
(
"userid"
)
String
userid
);
/**
* 查询企业微信客户列表,不查询一对多关系相关数据
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
public
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerMessagePushService.java
View file @
3c532b6
...
@@ -18,9 +18,9 @@ public interface IWeCustomerMessagePushService {
...
@@ -18,9 +18,9 @@ public interface IWeCustomerMessagePushService {
/**
/**
* 新增群发消息发送
* 新增群发消息发送
*
*
*@param customerMessagePush
Dto
原始数据信息
*@param customerMessagePush 原始数据信息
*/
*/
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePush
Dto
)
throws
JsonProcessingException
,
Parse
Exception
;
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePush
)
throws
JsonProcessingException
,
ParseException
,
CloneNotSupported
Exception
;
/**
/**
* 群发消息列表
* 群发消息列表
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
View file @
3c532b6
...
@@ -135,4 +135,16 @@ public interface IWeCustomerService extends IService<WeCustomer>
...
@@ -135,4 +135,16 @@ public interface IWeCustomerService extends IService<WeCustomer>
*/
*/
public
List
<
WeCustomer
>
selectWeCustomerAllList
(
WeCustomer
weCustomer
);
public
List
<
WeCustomer
>
selectWeCustomerAllList
(
WeCustomer
weCustomer
);
/**
* 查询企业微信客户列表,不查询一对多关系相关数据
*
* @param weCustomer 企业微信客户
* @return 企业微信客户集合
*/
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerMessagePushServiceImpl.java
View file @
3c532b6
...
@@ -2,11 +2,13 @@ package com.linkwechat.wecom.service.impl;
...
@@ -2,11 +2,13 @@ package com.linkwechat.wecom.service.impl;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.core.redis.RedisCache
;
import
com.linkwechat.common.enums.MediaType
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
...
@@ -14,7 +16,9 @@ import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
...
@@ -14,7 +16,9 @@ import com.linkwechat.wecom.client.WeCustomerMessagePushClient;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.WeCustomerMessageTimeTask
;
import
com.linkwechat.wecom.domain.WeCustomerMessageTimeTask
;
import
com.linkwechat.wecom.domain.WeGroup
;
import
com.linkwechat.wecom.domain.WeGroup
;
import
com.linkwechat.wecom.domain.dto.WeMediaDto
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.dto.message.CustomerMessagePushDto
;
import
com.linkwechat.wecom.domain.dto.message.ImageMessageDto
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.domain.vo.CustomerMessagePushVo
;
import
com.linkwechat.wecom.mapper.WeCustomerMessageTimeTaskMapper
;
import
com.linkwechat.wecom.mapper.WeCustomerMessageTimeTaskMapper
;
import
com.linkwechat.wecom.service.*
;
import
com.linkwechat.wecom.service.*
;
...
@@ -71,27 +75,50 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -71,27 +75,50 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
@Autowired
@Autowired
private
WeCustomerMessageTimeTaskMapper
customerMessageTimeTaskMapper
;
private
WeCustomerMessageTimeTaskMapper
customerMessageTimeTaskMapper
;
@Autowired
private
IWeMaterialService
materialService
;
@Override
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Async
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePush
)
throws
JsonProcessingException
,
ParseException
,
CloneNotSupportedException
{
public
void
addWeCustomerMessagePush
(
CustomerMessagePushDto
customerMessagePushDto
)
throws
JsonProcessingException
,
ParseException
{
// if ((null != customerMessagePushDto.getSettingTime() && !"".equals(customerMessagePushDto.getSettingTime()))
if
(
StrUtil
.
isNotBlank
(
customerMessagePush
.
getSettingTime
())){
// && DateUtils.diffTime(new Date(), DateUtil.parse(customerMessagePushDto.getSettingTime(), "yyyy-MM-dd HH:mm")) > 0) {
if
(
DateUtils
.
diffTime
(
new
Date
(),
DateUtil
.
parse
(
customerMessagePush
.
getSettingTime
(),
"yyyy-MM-dd HH:mm"
))
>
0
){
// throw new WeComException("发送时间不能小于当前时间");
// }
if
(
StrUtil
.
isNotBlank
(
customerMessagePushDto
.
getSettingTime
())){
if
(
DateUtils
.
diffTime
(
new
Date
(),
DateUtil
.
parse
(
customerMessagePushDto
.
getSettingTime
(),
"yyyy-MM-dd HH:mm"
))
>
0
){
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
throw
new
WeComException
(
"发送时间不能小于当前时间"
);
}
}
}
}
/*if(StrUtil.isBlank(customerMessagePushDto.getSettingTime())){
List
<
CustomerMessagePushDto
>
customerMessagePushDtos
=
new
ArrayList
<>();
throw new WeComException("发送时间不能为空");
}*/
if
(
customerMessagePush
.
getMessageType
().
equals
(
"4"
)){
customerMessagePushDtos
=
customerMessagePush
.
handleImageAndText
();
}
else
{
customerMessagePushDtos
.
add
(
customerMessagePush
);
}
for
(
CustomerMessagePushDto
customerMessagePushDto:
customerMessagePushDtos
){
if
(
customerMessagePush
.
getMessageType
().
equals
(
"1"
)){
//等于图片或者图文,根据图片URL,获取新的media_id
ImageMessageDto
imageMessage
=
customerMessagePushDto
.
getImageMessage
();
if
(
null
!=
imageMessage
&&
StrUtil
.
isNotBlank
(
imageMessage
.
getPic_url
())){
WeMediaDto
weMediaDto
=
materialService
.
uploadTemporaryMaterial
(
imageMessage
.
getPic_url
(),
MediaType
.
IMAGE
.
getMediaType
()
,
imageMessage
.
getPic_url
());
if
(
StrUtil
.
isNotBlank
(
weMediaDto
.
getMedia_id
())){
imageMessage
.
setMedia_id
(
weMediaDto
.
getMedia_id
());
}
}
}
List
<
WeCustomer
>
customers
=
Lists
.
newArrayList
();
List
<
WeCustomer
>
customers
=
Lists
.
newArrayList
();
...
@@ -105,6 +132,8 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -105,6 +132,8 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
customers
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
customers
=
externalUserIds
(
customerMessagePushDto
.
getPushRange
(),
customerMessagePushDto
.
getStaffId
()
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
,
customerMessagePushDto
.
getDepartment
(),
customerMessagePushDto
.
getTag
());
}
}
if
(
CollectionUtils
.
isEmpty
(
customers
))
{
if
(
CollectionUtils
.
isEmpty
(
customers
))
{
throw
new
WeComException
(
"没有外部联系人"
);
throw
new
WeComException
(
"没有外部联系人"
);
}
}
...
@@ -137,6 +166,19 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -137,6 +166,19 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
//保存分类消息信息
//保存分类消息信息
weCustomerSeedMessageService
.
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
weCustomerSeedMessageService
.
saveSeedMessage
(
customerMessagePushDto
,
messageId
);
this
.
sendMessage
(
customerMessagePushDto
,
messageId
,
customers
,
groups
);
}
}
private
void
sendMessage
(
CustomerMessagePushDto
customerMessagePushDto
,
long
messageId
,
List
<
WeCustomer
>
customers
,
List
<
WeGroup
>
groups
)
throws
ParseException
,
JsonProcessingException
{
//发送群发消息
//发送群发消息
//调用微信api发送消息
//调用微信api发送消息
if
(
null
==
customerMessagePushDto
.
getSettingTime
()
||
customerMessagePushDto
.
getSettingTime
().
equals
(
""
))
{
if
(
null
==
customerMessagePushDto
.
getSettingTime
()
||
customerMessagePushDto
.
getSettingTime
().
equals
(
""
))
{
...
@@ -146,6 +188,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -146,6 +188,9 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
,
DateUtils
.
getMillionSceondsBydate
(
customerMessagePushDto
.
getSettingTime
()));
,
DateUtils
.
getMillionSceondsBydate
(
customerMessagePushDto
.
getSettingTime
()));
customerMessageTimeTaskMapper
.
saveWeCustomerMessageTimeTask
(
timeTask
);
customerMessageTimeTaskMapper
.
saveWeCustomerMessageTimeTask
(
timeTask
);
}
}
}
}
@Override
@Override
...
@@ -173,8 +218,14 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -173,8 +218,14 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
customers
=
weCustomerService
.
selectWeCustomerAllList
(
weCustomer
);
customers
=
weCustomerService
.
selectWeCustomerAllList
(
weCustomer
);
redisCache
.
setCacheList
(
WeConstans
.
WECUSTOMERS_KEY
,
customers
);
redisCache
.
setCacheList
(
WeConstans
.
WECUSTOMERS_KEY
,
customers
);
redisCache
.
expire
(
WeConstans
.
WECUSTOMERS_KEY
,
2
*
60L
);
redisCache
.
expire
(
WeConstans
.
WECUSTOMERS_KEY
,
2
*
60L
);
}
}
else
{
return
customers
;
return
customers
;
}
WeCustomer
weCustomer
=
new
WeCustomer
();
weCustomer
.
setUserIds
(
staffId
);
weCustomer
.
setDepartmentIds
(
department
);
return
weCustomerService
.
selectWeCustomerListNoRel
(
weCustomer
);
}
else
{
}
else
{
//按条件查询客户
//按条件查询客户
//通过部门id查询所有的员工
//通过部门id查询所有的员工
...
@@ -183,7 +234,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
...
@@ -183,7 +234,7 @@ public class WeCustomerMessagePushServiceImpl implements IWeCustomerMessagePushS
weCustomer
.
setUserIds
(
staffId
);
weCustomer
.
setUserIds
(
staffId
);
weCustomer
.
setTagIds
(
tag
);
weCustomer
.
setTagIds
(
tag
);
weCustomer
.
setDepartmentIds
(
department
);
weCustomer
.
setDepartmentIds
(
department
);
return
weCustomerService
.
selectWeCustomer
AllList
(
weCustomer
);
return
weCustomerService
.
selectWeCustomer
ListNoRel
(
weCustomer
);
}
}
}
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
3c532b6
...
@@ -712,5 +712,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
...
@@ -712,5 +712,10 @@ public class WeCustomerServiceImpl extends ServiceImpl<WeCustomerMapper, WeCusto
return
weCustomerMapper
.
selectWeCustomerList
(
weCustomer
);
return
weCustomerMapper
.
selectWeCustomerList
(
weCustomer
);
}
}
@Override
public
List
<
WeCustomer
>
selectWeCustomerListNoRel
(
WeCustomer
weCustomer
)
{
return
weCustomerMapper
.
selectWeCustomerListNoRel
(
weCustomer
);
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTaskFissionServiceImpl.java
View file @
3c532b6
...
@@ -246,7 +246,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
...
@@ -246,7 +246,7 @@ public class WeTaskFissionServiceImpl extends ServiceImpl<WeTaskFissionMapper, W
SecurityContextHolder
.
setStrategyName
(
SecurityContextHolder
.
MODE_INHERITABLETHREADLOCAL
);
SecurityContextHolder
.
setStrategyName
(
SecurityContextHolder
.
MODE_INHERITABLETHREADLOCAL
);
SecurityContextHolder
.
setContext
(
context
);
SecurityContextHolder
.
setContext
(
context
);
weCustomerMessagePushService
.
addWeCustomerMessagePush
(
customerMessagePushDto
);
weCustomerMessagePushService
.
addWeCustomerMessagePush
(
customerMessagePushDto
);
}
catch
(
JsonProcessingException
|
ParseException
e
)
{
}
catch
(
JsonProcessingException
|
ParseException
|
CloneNotSupportedException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
log
.
error
(
"发送任务失败》》》》》》》》》》》params:{},ex:{}"
,
JSONObject
.
toJSONString
(
customerMessagePushDto
),
e
);
log
.
error
(
"发送任务失败》》》》》》》》》》》params:{},ex:{}"
,
JSONObject
.
toJSONString
(
customerMessagePushDto
),
e
);
}
}
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
View file @
3c532b6
...
@@ -4,6 +4,117 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
...
@@ -4,6 +4,117 @@ 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.WeCustomerMapper"
>
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeCustomerMapper"
>
<resultMap
type=
"com.linkwechat.wecom.domain.WeCustomer"
id=
"WeCustomerResultNoRel"
>
<id
property=
"externalUserid"
column=
"external_userid"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"avatar"
column=
"avatar"
/>
<result
property=
"type"
column=
"type"
/>
<result
property=
"gender"
column=
"gender"
/>
<result
property=
"unionid"
column=
"unionid"
/>
<result
property=
"birthday"
column=
"birthday"
/>
<result
property=
"corpName"
column=
"corp_name"
/>
<result
property=
"corpFullName"
column=
"corp_full_name"
/>
<result
property=
"position"
column=
"position"
/>
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"isOpenChat"
column=
"is_open_chat"
jdbcType=
"INTEGER"
/>
</resultMap>
<select
id=
"selectWeCustomerListNoRel"
parameterType=
"WeCustomer"
resultMap=
"WeCustomerResultNoRel"
>
SELECT
DISTINCT wc.external_userid,
wc.`name`,
wc.avatar,
wc.type,
wc.gender,
wc.unionid,
wc.birthday,
wc.corp_name,
wc.corp_full_name,
wc.position,
wc.is_open_chat,
wfcr.id as wfcrId,
wfcr.user_id,
wfcr.remark,
wfcr.description,
wfcr.create_time,
wfcr.remark_corp_name,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wfcr.status,
wu.user_name,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.external_userid=wfcr.external_userid
LEFT JOIN we_user wu ON wu.user_id=wfcr.user_id
LEFT JOIN we_flower_customer_tag_rel wfcrf ON wfcrf.flower_customer_rel_id = wfcr.id
LEFT JOIN we_tag wt ON wt.tag_id = wfcrf.tag_id
<where>
<if
test=
"name != null and name !=''"
>
AND wc.name like concat('%', #{name}, '%')
</if>
<if
test=
"userIds != null and userIds !=''"
>
<if
test=
"userIds.indexOf(',') != -1"
>
AND wfcr.user_id in
<foreach
item=
"item"
index=
"index"
collection=
"userIds.split(',')"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"userIds.indexOf(',') == -1"
>
AND wfcr.user_id=#{userIds}
</if>
</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<!-- 开始时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d')
>
= date_format(#{beginTime},'%y%m%d')
</if>
<if
test=
"endTime != null and endTime != ''"
>
<!-- 结束时间检索 -->
AND date_format(wfcr.create_time,'%y%m%d')
<
= date_format(#{endTime},'%y%m%d')
</if>
<if
test=
"tagIds != null and tagIds !=''"
>
<if
test=
"tagIds.indexOf(',') != -1"
>
AND wt.tag_id in
<foreach
item=
"item"
index=
"index"
collection=
"tagIds.split(',')"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"tagIds.indexOf(',') == -1"
>
AND wt.tag_id=#{tagIds}
</if>
</if>
<if
test=
"departmentIds != null and departmentIds !=''"
>
<if
test=
"departmentIds.indexOf(',') != -1"
>
OR wu.department in
<foreach
item=
"item"
index=
"index"
collection=
"departmentIds.split(',')"
open=
"("
separator=
","
close=
")"
>
#{item}
</foreach>
</if>
<if
test=
"departmentIds.indexOf(',') == -1"
>
OR wu.department=#{departmentIds}
</if>
</if>
<if
test=
"status !=null and status !=''"
>
AND wfcr.status=#{status}
</if>
<if
test=
"isOpenChat !=null "
>
AND wc.is_open_chat=#{isOpenChat}
</if>
</where>
ORDER BY wfcr.create_time DESC
</select>
<resultMap
type=
"com.linkwechat.wecom.domain.WeCustomer"
id=
"WeCustomerResult"
>
<resultMap
type=
"com.linkwechat.wecom.domain.WeCustomer"
id=
"WeCustomerResult"
>
<id
property=
"externalUserid"
column=
"external_userid"
/>
<id
property=
"externalUserid"
column=
"external_userid"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"name"
column=
"name"
/>
...
...
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