Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
仟微科技
Link Wechat
提交
e4d09dc3
Link Wechat
项目概览
仟微科技
/
Link Wechat
通知
48
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Link Wechat
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e4d09dc3
编写于
6月 16, 2021
作者:
孙
孙喜旺
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1、客户,标签 表结构修改
2、客户同步修改 (代码暂时提交)
上级
5378cf13
变更
24
展开全部
隐藏空白更改
内联
并排
Showing
24 changed file
with
562 addition
and
551 deletion
+562
-551
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommonHandler.java
.../com/linkwechat/web/controller/wecom/WeCommonHandler.java
+28
-0
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
...linkwechat/web/controller/wecom/WeCustomerController.java
+23
-51
linkwe-common/src/main/java/com/linkwechat/common/exception/wecom/WeComException.java
...com/linkwechat/common/exception/wecom/WeComException.java
+1
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
...src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
+26
-19
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
...java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
+72
-24
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
...a/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
+20
-10
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/ExternalUserDetail.java
...kwechat/wecom/domain/dto/customer/ExternalUserDetail.java
+14
-14
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/tag/WeFindCropTagParam.java
...m/linkwechat/wecom/domain/dto/tag/WeFindCropTagParam.java
+1
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
...ctory/impl/customer/WeCallBackAddExternalContactImpl.java
+7
-5
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddHalfExternalContactImpl.java
...y/impl/customer/WeCallBackAddHalfExternalContactImpl.java
+4
-2
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/tag/WeCallBackUpdateUserTagImpl.java
...t/wecom/factory/impl/tag/WeCallBackUpdateUserTagImpl.java
+3
-2
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
...in/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
+7
-3
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeFlowerCustomerRelMapper.java
...om/linkwechat/wecom/mapper/WeFlowerCustomerRelMapper.java
+6
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeFlowerCustomerTagRelMapper.java
...linkwechat/wecom/mapper/WeFlowerCustomerTagRelMapper.java
+3
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
...java/com/linkwechat/wecom/service/IWeCustomerService.java
+2
-2
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeFlowerCustomerRelService.java
...linkwechat/wecom/service/IWeFlowerCustomerRelService.java
+7
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeFlowerCustomerTagRelService.java
...kwechat/wecom/service/IWeFlowerCustomerTagRelService.java
+7
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
.../linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
+70
-210
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeFlowerCustomerRelServiceImpl.java
...at/wecom/service/impl/WeFlowerCustomerRelServiceImpl.java
+7
-1
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeFlowerCustomerTagRelServiceImpl.java
...wecom/service/impl/WeFlowerCustomerTagRelServiceImpl.java
+5
-0
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagServiceImpl.java
...a/com/linkwechat/wecom/service/impl/WeTagServiceImpl.java
+6
-2
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
...ecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
+153
-146
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerRelMapper.xml
...main/resources/mapper/wecom/WeFlowerCustomerRelMapper.xml
+80
-58
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
...n/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
+10
-0
未找到文件。
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCommonHandler.java
0 → 100644
浏览文件 @
e4d09dc3
package
com.linkwechat.web.controller.wecom
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.exception.wecom.WeComException
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.RestControllerAdvice
;
/**
* @author danmo
* @description 统一异常处理
* @date 2021/6/4 16:55
**/
@Slf4j
@RestControllerAdvice
(
basePackages
=
"com.linkwechat.web.controller.wecom"
)
public
class
WeCommonHandler
{
@ExceptionHandler
(
WeComException
.
class
)
public
AjaxResult
weComException
(
WeComException
ex
){
return
AjaxResult
.
error
(
ex
.
getCode
(),
ex
.
getMessage
());
}
@ExceptionHandler
(
Exception
.
class
)
public
AjaxResult
runtimeException
(
Exception
ex
){
log
.
error
(
"统一异常拦截 ex:{}"
,
ex
);
return
AjaxResult
.
error
();
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeCustomerController.java
浏览文件 @
e4d09dc3
package
com.linkwechat.web.controller.wecom
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.constant.WeConstans
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.common.utils.StringUtils
;
import
com.linkwechat.common.utils.poi.ExcelUtil
;
import
com.linkwechat.wecom.domain.WeCustomer
;
import
com.linkwechat.wecom.domain.vo.WeMakeCustomerTag
;
...
...
@@ -18,7 +19,6 @@ import org.springframework.security.core.context.SecurityContextHolder;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -29,24 +29,20 @@ import java.util.List;
*/
@RestController
@RequestMapping
(
"/wecom/customer"
)
public
class
WeCustomerController
extends
BaseController
{
public
class
WeCustomerController
extends
BaseController
{
@Autowired
@Lazy
private
IWeCustomerService
weCustomerService
;
/**
* 查询企业微信客户列表
*/
//
@PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
//@PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
WeCustomer
weCustomer
)
{
public
TableDataInfo
<
List
<
WeCustomer
>>
list
(
WeCustomer
weCustomer
)
{
startPage
();
List
<
WeCustomer
>
list
=
weCustomerService
.
selectWeCustomerList
(
weCustomer
);
return
getDataTable
(
list
);
}
...
...
@@ -54,14 +50,13 @@ public class WeCustomerController extends BaseController
/**
* 根据员工ID获取客户
*
* @return
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping
(
"/getCustomersByUserId/{externalUserid}"
)
public
AjaxResult
getCustomersByUserId
(
@PathVariable
String
externalUserid
){
return
AjaxResult
.
success
(
weCustomerService
.
getCustomersByUserId
(
externalUserid
));
@GetMapping
(
"/getCustomersByUserId/{id}"
)
public
AjaxResult
<
List
<
WeCustomer
>>
getCustomersByUserId
(
@PathVariable
(
"id"
)
Long
id
)
{
return
AjaxResult
.
success
(
weCustomerService
.
getCustomersByUserId
(
id
));
}
/**
...
...
@@ -70,8 +65,7 @@ public class WeCustomerController extends BaseController
// @PreAuthorize("@ss.hasPermi('wecom:customer:export')")
@Log
(
title
=
"企业微信客户"
,
businessType
=
BusinessType
.
EXPORT
)
@GetMapping
(
"/export"
)
public
AjaxResult
export
(
WeCustomer
weCustomer
)
{
public
AjaxResult
export
(
WeCustomer
weCustomer
)
{
List
<
WeCustomer
>
list
=
weCustomerService
.
selectWeCustomerList
(
weCustomer
);
ExcelUtil
<
WeCustomer
>
util
=
new
ExcelUtil
<
WeCustomer
>(
WeCustomer
.
class
);
return
util
.
exportExcel
(
list
,
"customer"
);
...
...
@@ -82,21 +76,18 @@ public class WeCustomerController extends BaseController
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:view')")
@GetMapping
(
value
=
"/{externalUserId}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"externalUserId"
)
String
externalUserId
)
{
public
AjaxResult
getInfo
(
@PathVariable
(
"externalUserId"
)
String
externalUserId
)
{
return
AjaxResult
.
success
(
weCustomerService
.
selectWeCustomerById
(
externalUserId
));
}
/**
* 修改企业微信客户
*/
// @PreAuthorize("@ss.hasPermi('wecom:customer:edit')")
@Log
(
title
=
"企业微信客户"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@Validated
@RequestBody
WeCustomer
weCustomer
)
{
public
AjaxResult
edit
(
@Validated
@RequestBody
WeCustomer
weCustomer
)
{
weCustomerService
.
saveOrUpdate
(
weCustomer
);
return
AjaxResult
.
success
();
}
...
...
@@ -104,20 +95,20 @@ public class WeCustomerController extends BaseController
/**
* 客户同步接口
*
* @return
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:sync')")
@Log
(
title
=
"企业微信客户同步接口"
,
businessType
=
BusinessType
.
DELETE
)
@GetMapping
(
"/synchWeCustomer"
)
public
AjaxResult
synchWeCustomer
()
{
try
{
SecurityContext
context
=
SecurityContextHolder
.
getContext
();
SecurityContextHolder
.
setStrategyName
(
SecurityContextHolder
.
MODE_INHERITABLETHREADLOCAL
);
SecurityContextHolder
.
setContext
(
context
);
weCustomerService
.
synchWeCustomer
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
if
(
StringUtils
.
isNotEmpty
(
SecurityUtils
.
getLoginUser
().
getUser
().
getCorpId
())){
return
AjaxResult
.
error
(
"请登陆后重试"
);
}
SecurityContext
context
=
SecurityContextHolder
.
getContext
();
SecurityContextHolder
.
setStrategyName
(
SecurityContextHolder
.
MODE_INHERITABLETHREADLOCAL
);
SecurityContextHolder
.
setContext
(
context
);
weCustomerService
.
synchWeCustomer
();
return
AjaxResult
.
success
(
WeConstans
.
SYNCH_TIP
);
}
...
...
@@ -125,13 +116,14 @@ public class WeCustomerController extends BaseController
/**
* 客户打标签
*
* @param weMakeCustomerTag
* @return
*/
// @PreAuthorize("@ss.hasPermi('customerManage/customer:makeTag')")
@Log
(
title
=
"客户打标签"
,
businessType
=
BusinessType
.
UPDATE
)
@PostMapping
(
"/makeLabel"
)
public
AjaxResult
makeLabel
(
@RequestBody
WeMakeCustomerTag
weMakeCustomerTag
){
public
AjaxResult
makeLabel
(
@RequestBody
WeMakeCustomerTag
weMakeCustomerTag
)
{
weCustomerService
.
makeLabel
(
weMakeCustomerTag
);
...
...
@@ -141,12 +133,13 @@ public class WeCustomerController extends BaseController
/**
* 移除客户标签
*
* @return
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:removeTag')")
@Log
(
title
=
"移除客户标签"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/removeLabel"
)
public
AjaxResult
removeLabel
(
@RequestBody
WeMakeCustomerTag
weMakeCustomerTag
){
public
AjaxResult
removeLabel
(
@RequestBody
WeMakeCustomerTag
weMakeCustomerTag
)
{
weCustomerService
.
removeLabel
(
weMakeCustomerTag
);
...
...
@@ -154,25 +147,4 @@ public class WeCustomerController extends BaseController
}
/**
* 查询企业微信客户列表(六感)
*/
// @PreAuthorize("@ss.hasPermi('customerManage:customer:list')")
@GetMapping
(
"/listConcise"
)
public
TableDataInfo
listConcise
(
WeCustomer
weCustomer
)
{
startPage
();
List
<
WeCustomer
>
list
=
weCustomerService
.
selectWeCustomerList
(
weCustomer
);
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
list
.
stream
().
forEach
(
k
->{
k
.
setWeFlowerCustomerRels
(
new
ArrayList
<>());
});
}
return
getDataTable
(
list
);
}
}
linkwe-common/src/main/java/com/linkwechat/common/exception/wecom/WeComException.java
浏览文件 @
e4d09dc3
...
...
@@ -11,7 +11,7 @@ public class WeComException extends RuntimeException {
protected
String
message
;
private
Integer
code
;
private
Integer
code
=
-
1
;
public
WeComException
(
String
message
)
{
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeCustomer.java
浏览文件 @
e4d09dc3
package
com.linkwechat.wecom.domain
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
...
...
@@ -34,12 +35,21 @@ public class WeCustomer extends BaseEntity {
private
static
final
long
serialVersionUID
=
1L
;
@ApiModelProperty
(
value
=
"主键"
)
@TableId
(
type
=
IdType
.
AUTO
)
@TableField
(
"id"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"企业id"
)
@TableField
(
"corp_id"
)
private
String
corpId
;
/**
* 外部联系人的userid
*/
@TableId
@NotBlank
(
message
=
"外部联系人的id不可为空"
)
@ApiModelProperty
(
"外部联系人的userid"
)
@TableField
(
"external_userid"
)
private
String
externalUserid
;
/**
...
...
@@ -47,12 +57,14 @@ public class WeCustomer extends BaseEntity {
*/
@Excel
(
name
=
"客户"
)
@ApiModelProperty
(
"外部联系人名称"
)
@TableField
(
"name"
)
private
String
name
;
/**
* 外部联系人头像
*/
@ApiModelProperty
(
"外部联系人头像"
)
@TableField
(
"avatar"
)
private
String
avatar
;
/**
...
...
@@ -60,6 +72,7 @@ public class WeCustomer extends BaseEntity {
*/
@ApiModelProperty
(
"外部联系人的类型,1表示该外部联系人是微信用户,2表示该外部联系人是企业微信用户"
)
@Excel
(
name
=
"客户类型"
,
readConverterExp
=
"1=微信,2=企业微信"
)
@TableField
(
"type"
)
private
Integer
type
;
/**
...
...
@@ -67,19 +80,22 @@ public class WeCustomer extends BaseEntity {
*/
@ApiModelProperty
(
"外部联系人性别 0-未知 1-男性 2-女性"
)
@Excel
(
name
=
"性别"
,
readConverterExp
=
"0=未知,1=男性,2=女性"
)
@TableField
(
"gender"
)
private
Integer
gender
;
/**
* 外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来。
*/
@ApiModelProperty
(
"外部联系人在微信开放平台的唯一身份标识,通过此字段企业可将外部联系人与公众号/小程序用户关联起来"
)
@TableField
(
"unionid"
)
private
String
unionid
;
/**
* 生日
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
"生日"
)
@TableField
(
"birthday"
)
private
Date
birthday
;
...
...
@@ -88,26 +104,34 @@ public class WeCustomer extends BaseEntity {
*/
@ApiModelProperty
(
"客户企业简称"
)
@Excel
(
name
=
"公司名称"
)
@TableField
(
"corp_name"
)
private
String
corpName
;
/**
* 客户企业全称
*/
@ApiModelProperty
(
"客户企业全称"
)
@TableField
(
"corp_full_name"
)
private
String
corpFullName
;
/**
* 职位
*/
@ApiModelProperty
(
"职位"
)
@TableField
(
"position"
)
private
String
position
;
/**
* 是否开启会话存档 0:关闭 1:开启
*/
@ApiModelProperty
(
"是否开启会话存档 0:关闭 1:开启"
)
@TableField
(
"is_open_chat"
)
private
Integer
isOpenChat
;
@ApiModelProperty
(
"删除标识 0 正常 1 无效"
)
@TableField
(
value
=
"del_flag"
)
private
Integer
delFlag
;
/**
* 添加人员
*/
...
...
@@ -126,9 +150,6 @@ public class WeCustomer extends BaseEntity {
@TableField
(
exist
=
false
)
private
String
tagIds
;
@TableField
(
exist
=
false
)
@JSONField
(
defaultValue
=
"0"
)
private
Integer
status
;
/**
* 部门
...
...
@@ -148,18 +169,4 @@ public class WeCustomer extends BaseEntity {
@TableField
(
exist
=
false
)
private
String
userId
;
/**
* 创建者
*/
@ApiModelProperty
(
hidden
=
true
)
@TableField
(
exist
=
false
)
private
String
createBy
;
/**
* 更新者
*/
@ApiModelProperty
(
hidden
=
true
)
@TableField
(
exist
=
false
)
private
String
updateBy
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerRel.java
浏览文件 @
e4d09dc3
package
com.linkwechat.wecom.domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
...
...
@@ -22,6 +25,7 @@ import java.util.List;
*/
@Data
@Builder
@ApiModel
@AllArgsConstructor
@NoArgsConstructor
@TableName
(
"we_flower_customer_rel"
)
...
...
@@ -29,54 +33,98 @@ public class WeFlowerCustomerRel
{
private
static
final
long
serialVersionUID
=
1L
;
@TableId
private
Long
id
=
SnowFlakeUtil
.
nextId
();
@ApiModelProperty
(
value
=
"主键"
)
@TableId
(
type
=
IdType
.
AUTO
)
@TableField
(
"id"
)
private
Long
id
;
@ApiModelProperty
(
value
=
"企业id"
)
@TableField
(
"corp_id"
)
private
String
corpId
;
/** 添加了此外部联系人的企业成员userid */
/**
* 添加了此外部联系人的企业成员userid
*/
@ApiModelProperty
(
value
=
"添加了此外部联系人的企业成员userid"
)
@TableField
(
"user_id"
)
private
String
userId
;
/** 外部联系人名称 */
/**
* 成员名称
*/
@ApiModelProperty
(
value
=
"成员名称"
)
@TableField
(
exist
=
false
)
private
String
userName
;
/** 该成员对此外部联系人的描述 */
/**
* 该成员对此外部联系人的描述
*/
@ApiModelProperty
(
value
=
"该成员对此外部联系人的描述"
)
@TableField
(
"description"
)
private
String
description
;
/** 该成员对此客户备注的企业名称 */
private
String
remarkCorpName
;
/** 该成员对此客户备注的手机号码 */
/**
* 该成员对此客户备注的企业名称
*/
@ApiModelProperty
(
value
=
"该成员对此客户备注的企业名称"
)
@TableField
(
"remark_corp_name"
)
private
String
remarkCorpName
;
/**
* 该成员对此客户备注的手机号码
*/
@ApiModelProperty
(
value
=
"该成员对此客户备注的手机号码"
)
@TableField
(
"remark_mobiles"
)
private
String
remarkMobiles
;
/** 发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid */
private
String
operUserid
;
/** 该成员添加此客户的来源, */
/**
* 发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid
*/
@ApiModelProperty
(
value
=
"发起添加的userid"
)
@TableField
(
"oper_userid"
)
private
String
operUserId
;
/**
* 该成员添加此客户的来源,
*/
@ApiModelProperty
(
value
=
"该成员添加此客户的来源"
)
@TableField
(
"add_way"
)
private
Integer
addWay
;
/** 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定 */
/**
* 企业自定义的state参数,用于区分客户具体是通过哪个「联系我」添加,由企业通过创建「联系我」方式指定
*/
@ApiModelProperty
(
value
=
"企业自定义的state参数"
)
@TableField
(
"state"
)
private
String
state
;
/** 客户id */
/**
* 客户id
*/
@ApiModelProperty
(
value
=
"客户id"
)
@TableField
(
"external_userid"
)
private
String
externalUserid
;
/** 状态(0正常 1删除) */
private
String
status
;
/** 创建时间 */
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
)
private
Date
createTime
;
/**
* 状态(0正常 1删除)
*/
@ApiModelProperty
(
value
=
"状态(0正常 1删除)"
)
@TableField
(
"del_flag"
)
private
Integer
delFlag
;
/**
* 该成员添加此外部联系人的时间
*/
@ApiModelProperty
(
value
=
"该成员添加此外部联系人的时间"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
addTime
;
/** 微信用户添加的标签 */
@TableField
(
exist
=
false
)
private
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
;
@ApiModelProperty
(
value
=
"部门"
)
@TableField
(
exist
=
false
)
private
String
department
;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeFlowerCustomerTagRel.java
浏览文件 @
e4d09dc3
package
com.linkwechat.wecom.domain
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
...
...
@@ -25,24 +27,32 @@ import java.util.Date;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
WeFlowerCustomerTagRel
public
class
WeFlowerCustomerTagRel
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
@TableId
@ApiModelProperty
(
value
=
"主键"
)
@TableId
(
type
=
IdType
.
AUTO
)
@TableField
(
"id"
)
private
Long
id
;
/** 添加客户的企业微信用户 */
private
Long
flowerCustomerRelId
;
@ApiModelProperty
(
value
=
"企业id"
)
@TableField
(
"corp_id"
)
private
String
corpId
;
/** 标签id */
@ApiModelProperty
(
value
=
"企微成员id"
)
@TableField
(
"user_id"
)
private
String
userId
;
@ApiModelProperty
(
value
=
"客户id"
)
@TableField
(
"external_userid"
)
private
String
externalUserid
;
@ApiModelProperty
(
value
=
"标签id"
)
@TableField
(
"tag_id"
)
private
String
tagId
;
/** 标签名 */
@ApiModelProperty
(
value
=
"标签名"
)
@TableField
(
exist
=
false
)
private
String
tagName
;
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/customer/ExternalUserDetail.java
浏览文件 @
e4d09dc3
...
...
@@ -15,15 +15,15 @@ import java.util.List;
public
class
ExternalUserDetail
extends
WeResultDto
{
/** 客户详情 */
private
ExternalContact
external
_c
ontact
;
private
ExternalContact
external
C
ontact
;
/** 客户联系人 */
private
List
<
FollowUser
>
follow
_u
ser
;
private
List
<
FollowUser
>
follow
U
ser
;
private
FollowInfo
follow
_i
nfo
;
private
FollowInfo
follow
I
nfo
;
private
String
external
_useri
d
;
private
String
external
UserI
d
;
@Data
...
...
@@ -50,7 +50,7 @@ public class ExternalUserDetail extends WeResultDto {
@Data
public
class
FollowUser
{
public
static
class
FollowUser
{
/**添加了此外部联系人的企业成员userid*/
private
String
userid
;
/**该成员对此外部联系人的备注*/
...
...
@@ -58,11 +58,11 @@ public class ExternalUserDetail extends WeResultDto {
/**该成员对此外部联系人的描述*/
private
String
description
;
/**该成员添加此外部联系人的时间*/
private
long
create
t
ime
;
private
long
create
T
ime
;
/**该成员对此客户备注的企业名称*/
private
String
remarkCorpName
;
/**该成员对此客户备注的手机号码*/
private
String
[]
remarkMobiles
;
private
List
<
String
>
remarkMobiles
;
/**该成员添加此客户的来源*/
private
Integer
addWay
;
/**发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid*/
...
...
@@ -74,23 +74,23 @@ public class ExternalUserDetail extends WeResultDto {
}
@Data
public
class
FollowInfo
{
public
static
class
FollowInfo
{
/**该成员对此外部联系人的备注*/
private
String
remark
;
/**该成员对此外部联系人的描述*/
private
String
description
;
/**该成员添加此外部联系人的时间*/
private
long
create
t
ime
;
private
long
create
T
ime
;
/**该成员对此客户备注的企业名称*/
private
String
remark
_c
ompany
;
private
String
remark
C
ompany
;
/**该成员对此客户备注的手机号码*/
private
String
[]
remark_m
obiles
;
private
List
<
String
>
remarkM
obiles
;
/**该成员添加此客户的来源*/
private
Integer
add
_w
ay
;
private
Integer
add
W
ay
;
/**发起添加的userid,如果成员主动添加,为成员的userid;如果是客户主动添加,则为客户的外部联系人userid;如果是内部成员共享/管理员分配,则为对应的成员/管理员userid*/
private
String
oper
_useri
d
;
private
String
oper
UserI
d
;
/**标签**/
private
String
[]
tag_i
d
;
private
List
<
String
>
tagI
d
;
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/tag/WeFindCropTagParam.java
浏览文件 @
e4d09dc3
...
...
@@ -13,6 +13,6 @@ import java.util.List;
@Data
@Builder
public
class
WeFindCropTagParam
{
private
String
[]
tag_id
;
private
List
<
String
>
tag_id
;
private
List
<
String
>
group_id
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddExternalContactImpl.java
浏览文件 @
e4d09dc3
...
...
@@ -69,7 +69,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
if
(
isFission
(
message
.
getState
()))
{
taskFissionRecordHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
}
else
{
empleCodeHandle
(
message
.
getState
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
empleCodeHandle
(
message
.
getState
(),
message
.
getToUserName
(),
message
.
getWelcomeCode
(),
message
.
getUserId
(),
message
.
getExternalUserId
());
}
}
}
...
...
@@ -125,7 +125,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
* @param userId 成员id
* @param externalUserId 客户id
*/
private
void
empleCodeHandle
(
String
state
,
String
wecomCode
,
String
userId
,
String
externalUserId
)
{
private
void
empleCodeHandle
(
String
state
,
String
corpId
,
String
wecomCode
,
String
userId
,
String
externalUserId
)
{
try
{
log
.
info
(
"执行发送欢迎语>>>>>>>>>>>>>>>"
);
WeWelcomeMsg
.
WeWelcomeMsgBuilder
weWelcomeMsgBuilder
=
WeWelcomeMsg
.
builder
().
welcome_code
(
wecomCode
);
...
...
@@ -139,6 +139,7 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
//查询外部联系人与通讯录关系数据
WeFlowerCustomerRel
weFlowerCustomerRel
=
weFlowerCustomerRelService
.
getOne
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getCorpId
,
corpId
)
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
userId
)
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
externalUserId
));
//为外部联系人添加员工活码标签
...
...
@@ -147,13 +148,14 @@ public class WeCallBackAddExternalContactImpl extends WeEventStrategy {
Optional
.
ofNullable
(
tagList
).
orElseGet
(
ArrayList:
:
new
).
forEach
(
tag
->
{
weFlowerCustomerTagRels
.
add
(
WeFlowerCustomerTagRel
.
builder
()
.
flowerCustomerRelId
(
weFlowerCustomerRel
.
getId
())
.
corpId
(
corpId
)
.
userId
(
userId
)
.
externalUserid
(
externalUserId
)
.
tagId
(
tag
.
getTagId
())
.
createTime
(
new
Date
())
.
build
()
);
});
weFlowerCustomerTagRelService
.
save
OrUpdate
Batch
(
weFlowerCustomerTagRels
);
weFlowerCustomerTagRelService
.
saveBatch
(
weFlowerCustomerTagRels
);
});
// 发送欢迎语
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/customer/WeCallBackAddHalfExternalContactImpl.java
浏览文件 @
e4d09dc3
...
...
@@ -61,6 +61,7 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
.
eq
(
WeEmpleCodeTag:
:
getEmpleCodeId
,
empleCodeId
));
//查询外部联系人与通讯录关系数据
WeFlowerCustomerRel
weFlowerCustomerRel
=
weFlowerCustomerRelService
.
getOne
(
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getCorpId
,
message
.
getToUserName
())
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
message
.
getUserId
())
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
message
.
getExternalUserId
()));
//为外部联系人添加员工活码标签
...
...
@@ -69,9 +70,10 @@ public class WeCallBackAddHalfExternalContactImpl extends WeEventStrategy {
Optional
.
ofNullable
(
tagList
).
orElseGet
(
ArrayList:
:
new
).
forEach
(
tag
->{
weFlowerCustomerTagRels
.
add
(
WeFlowerCustomerTagRel
.
builder
()
.
flowerCustomerRelId
(
weFlowerCustomerRel
.
getId
())
.
corpId
(
message
.
getToUserName
())
.
externalUserid
(
message
.
getExternalUserId
())
.
userId
(
message
.
getUserId
())
.
tagId
(
tag
.
getTagId
())
.
createTime
(
new
Date
())
.
build
()
);
});
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/factory/impl/tag/WeCallBackUpdateUserTagImpl.java
浏览文件 @
e4d09dc3
...
...
@@ -33,7 +33,8 @@ public class WeCallBackUpdateUserTagImpl extends WeEventStrategy {
@Override
public
void
eventHandle
(
WxCpXmlMessageVO
message
)
{
try
{
String
tagId
=
message
.
getTagId
();
return
;
/*String tagId = message.getTagId();
//标签中新增的成员userid列表,用逗号分隔
List<String> addUserItemsList = Arrays.stream(Optional.ofNullable(message.getAddUserItems())
.orElse("").split(",")).collect(Collectors.toList());
...
...
@@ -74,7 +75,7 @@ public class WeCallBackUpdateUserTagImpl extends WeEventStrategy {
LambdaQueryWrapper<WeFlowerCustomerTagRel> tagRelQueryWrapper = new LambdaQueryWrapper<>();
tagRelQueryWrapper.in(WeFlowerCustomerTagRel::getFlowerCustomerRelId, relIdList);
weFlowerCustomerTagRelService.remove(tagRelQueryWrapper);
}
}
*/
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
e
.
getMessage
());
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeCustomerMapper.java
浏览文件 @
e4d09dc3
...
...
@@ -68,10 +68,10 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
/**
* 根据员工ID获取客户
* @param
externalUser
id
* @param id
* @return
*/
public
List
<
We
User
>
getCustomersByUserId
(
@Param
(
"externalUserid"
)
String
externalUser
id
,
@Param
(
"userId"
)
String
userId
);
public
List
<
We
Customer
>
getCustomersByUserId
(
@Param
(
"id"
)
Long
id
,
@Param
(
"userId"
)
String
userId
);
/**
* 通过标签查询客户列表
...
...
@@ -98,5 +98,9 @@ public interface WeCustomerMapper extends BaseMapper<WeCustomer>
*/
WeCustomerSocialConn
countSocialConn
(
@Param
(
"externalUserid"
)
String
externalUserid
,
@Param
(
"userid"
)
String
userid
);
/**
* 批量新增
* @param customerList
*/
void
saveBatch
(
List
<
WeCustomer
>
customerList
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeFlowerCustomerRelMapper.java
浏览文件 @
e4d09dc3
...
...
@@ -86,4 +86,10 @@ public interface WeFlowerCustomerRelMapper extends BaseMapper<WeFlowerCustomerRe
* @return
*/
public
List
<
Map
<
String
,
Object
>>
getUserAddCustomerStat
(
WeFlowerCustomerRel
weFlowerCustomerRel
);
/**
* 批量新增
* @param customerRelList
*/
void
saveBatch
(
@Param
(
"customerRelList"
)
List
<
WeFlowerCustomerRel
>
customerRelList
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeFlowerCustomerTagRelMapper.java
浏览文件 @
e4d09dc3
...
...
@@ -4,6 +4,7 @@ import java.util.List;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerTagRel
;
import
org.apache.ibatis.annotations.Param
;
/**
* 客户标签关系Mapper接口
...
...
@@ -68,4 +69,6 @@ public interface WeFlowerCustomerTagRelMapper extends BaseMapper<WeFlowerCustom
* @return
*/
public
int
batchInsetWeFlowerCustomerTagRel
(
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
);
public
void
saveBatch
(
@Param
(
"weFlowerCustomerTagRels"
)
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeCustomerService.java
浏览文件 @
e4d09dc3
...
...
@@ -74,10 +74,10 @@ public interface IWeCustomerService extends IService<WeCustomer>
/**
* 根据员工ID获取客户
* @param
externalUser
id
* @param id
* @return
*/
public
List
<
We
User
>
getCustomersByUserId
(
String
externalUser
id
);
public
List
<
We
Customer
>
getCustomersByUserId
(
Long
id
);
/**
* 获取客户详情并同步客户数据
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeFlowerCustomerRelService.java
浏览文件 @
e4d09dc3
...
...
@@ -14,6 +14,13 @@ import com.linkwechat.wecom.domain.WeFlowerCustomerRel;
*/
public
interface
IWeFlowerCustomerRelService
extends
IService
<
WeFlowerCustomerRel
>
{
/**
* 批量新增
* @param customerRelList
*/
public
void
saveBatch
(
List
<
WeFlowerCustomerRel
>
customerRelList
);
/**
* 删除服务跟进人
* @param userId 企业成员id
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeFlowerCustomerTagRelService.java
浏览文件 @
e4d09dc3
...
...
@@ -70,4 +70,11 @@ public interface IWeFlowerCustomerTagRelService extends IService<WeFlowerCustome
* @return
*/
public
int
batchInsetWeFlowerCustomerTagRel
(
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
);
/**
* 批量插入
* @param weFlowerCustomerTagRels
* @return
*/
public
void
saveBatch
(
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
浏览文件 @
e4d09dc3
此差异已折叠。
点击以展开。
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeFlowerCustomerRelServiceImpl.java
浏览文件 @
e4d09dc3
...
...
@@ -3,6 +3,7 @@ package com.linkwechat.wecom.service.impl;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.common.utils.SecurityUtils
;
import
com.linkwechat.wecom.domain.WeFlowerCustomerRel
;
import
com.linkwechat.wecom.mapper.WeFlowerCustomerRelMapper
;
import
com.linkwechat.wecom.service.IWeFlowerCustomerRelService
;
...
...
@@ -23,10 +24,15 @@ import java.util.stream.Collectors;
public
class
WeFlowerCustomerRelServiceImpl
extends
ServiceImpl
<
WeFlowerCustomerRelMapper
,
WeFlowerCustomerRel
>
implements
IWeFlowerCustomerRelService
{
@Override
public
void
saveBatch
(
List
<
WeFlowerCustomerRel
>
customerRelList
)
{
this
.
baseMapper
.
saveBatch
(
customerRelList
);
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
deleteFollowUser
(
String
userId
,
String
externalUserid
)
{
return
this
.
update
(
WeFlowerCustomerRel
.
builder
().
status
(
"1"
).
build
()
return
this
.
update
(
WeFlowerCustomerRel
.
builder
().
delFlag
(
1
).
build
()
,
new
LambdaQueryWrapper
<
WeFlowerCustomerRel
>()
.
eq
(
WeFlowerCustomerRel:
:
getUserId
,
userId
)
.
eq
(
WeFlowerCustomerRel:
:
getExternalUserid
,
externalUserid
));
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeFlowerCustomerTagRelServiceImpl.java
浏览文件 @
e4d09dc3
...
...
@@ -105,4 +105,9 @@ public class WeFlowerCustomerTagRelServiceImpl extends ServiceImpl<WeFlowerCusto
public
int
batchInsetWeFlowerCustomerTagRel
(
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
)
{
return
weFlowerCustomerTagRelMapper
.
batchInsetWeFlowerCustomerTagRel
(
weFlowerCustomerTagRels
);
}
@Override
public
void
saveBatch
(
List
<
WeFlowerCustomerTagRel
>
weFlowerCustomerTagRels
)
{
weFlowerCustomerTagRelMapper
.
saveBatch
(
weFlowerCustomerTagRels
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagServiceImpl.java
浏览文件 @
e4d09dc3
package
com.linkwechat.wecom.service.impl
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -135,7 +137,8 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
@Override
public
void
creatTag
(
String
tagId
)
{
if
(
StringUtils
.
isNotEmpty
(
tagId
)){
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getCorpTagListByTagIds
(
WeFindCropTagParam
.
builder
().
tag_id
(
tagId
.
split
(
","
)).
build
());
List
<
String
>
tagList
=
Arrays
.
stream
(
tagId
.
split
(
","
)).
collect
(
Collectors
.
toList
());
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getCorpTagListByTagIds
(
WeFindCropTagParam
.
builder
().
tag_id
(
tagList
).
build
());
List
<
WeCropGroupTagDto
>
tag_group
=
weCropGroupTagListDto
.
getTag_group
();
if
(
CollectionUtil
.
isNotEmpty
(
tag_group
))
{
tag_group
.
stream
().
forEach
(
k
->
{
...
...
@@ -169,7 +172,8 @@ public class WeTagServiceImpl extends ServiceImpl<WeTagMapper,WeTag> implements
@Override
public
void
updateTag
(
String
tagId
)
{
if
(
StringUtils
.
isNotEmpty
(
tagId
)){
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getCorpTagListByTagIds
(
WeFindCropTagParam
.
builder
().
tag_id
(
tagId
.
split
(
","
)).
build
());
List
<
String
>
tagList
=
Arrays
.
stream
(
tagId
.
split
(
","
)).
collect
(
Collectors
.
toList
());
WeCropGroupTagListDto
weCropGroupTagListDto
=
weCropTagClient
.
getCorpTagListByTagIds
(
WeFindCropTagParam
.
builder
().
tag_id
(
tagList
).
build
());
List
<
WeCropGroupTagDto
>
tag_group
=
weCropGroupTagListDto
.
getTag_group
();
if
(
CollectionUtil
.
isNotEmpty
(
tag_group
))
{
tag_group
.
stream
().
forEach
(
k
->
{
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeCustomerMapper.xml
浏览文件 @
e4d09dc3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeCustomerMapper"
>
<resultMap
type=
"com.linkwechat.wecom.domain.WeCustomer"
id=
"WeCustomerResult"
>
<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"
/>
<id
property=
"id"
column=
"id"
/>
<result
property=
"corpId"
column=
"corp_id"
/>
<result
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"
/>
<collection
property=
"weFlowerCustomerRels"
ofType=
"com.linkwechat.wecom.domain.WeFlowerCustomerRel"
>
<result
property=
"id"
column=
"wfcrId"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"remarkCorpName"
column=
"remark_corp_name"
/>
<result
property=
"operUserid"
column=
"oper_userid"
/>
<result
property=
"addWay"
column=
"add_way"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"id"
column=
"wfcrId"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"addTime"
column=
"add_time"
/>
<result
property=
"remarkCorpName"
column=
"remark_corp_name"
/>
<result
property=
"remarkMobiles"
column=
"remark_mobiles"
/>
<result
property=
"operUserId"
column=
"oper_userid"
/>
<result
property=
"addWay"
column=
"add_way"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"delFlag"
column=
"del_flag"
/>
<result
property=
"userName"
column=
"user_name"
/>
<result
property=
"department"
column=
"department"
/>
<collection
property=
"weFlowerCustomerTagRels"
javaType=
"ArrayList"
...
...
@@ -38,13 +41,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<resultMap
id=
"weFlowerCustomerRelsMapper"
type=
"com.linkwechat.wecom.domain.WeFlowerCustomerTagRel"
>
<result
property=
"flowerCustomerRelId"
column=
"flower_customer_rel_id"
/>
<result
property=
"tagId"
column=
"tag_id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"flowerCustomerRelId"
column=
"flower_customer_rel_id"
/>
<result
property=
"tagId"
column=
"tag_id"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"tagName"
column=
"tagName"
/>
</resultMap>
...
...
@@ -69,8 +69,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from
we_customer wc
left join we_flower_customer_rel wfcr on
wc.external_userid = wfcr.external_userid
and wfcr.
status
= 0
wc.
corp_id = wfcr.corp_id and wc.
external_userid = wfcr.external_userid
and wfcr.
del_flag
= 0
left join we_flower_customer_tag_rel wfctr on
wfctr.flower_customer_rel_id = wfcr.id
right join we_tag wt on
...
...
@@ -80,93 +80,86 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"selectWeCustomerList"
parameterType=
"WeCustomer"
resultMap=
"WeCustomerResult"
>
SELECT
*
FROM
(
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
SELECT
*
FROM
(
SELECT
DISTINCT
wc.id,
wc.corp_id,
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.remark_mobiles,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wfcr.del_flag,
wu.user_name,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE FIND_IN_SET(wd.dept_id,wu.department)) as department
FROM
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.corp_id = wfcr.corp_id and wc.external_userid = wfcr.external_userid
LEFT JOIN we_user wu ON wu.corp_id = wfcr.corp_id and 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}, '%')
AND wc.name like concat('%', #{name}, '%')
</if>
<if
test=
"userIds != null and userIds !=''"
>
<if
test=
"userIds.indexOf(',') != -1"
>
AND
wfcr.user_id in
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}
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')
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=
")"
>
<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=
"
department
Ids.indexOf(',') == -1"
>
OR wu.department=#{department
Ids}
<if
test=
"
tag
Ids.indexOf(',') == -1"
>
AND wt.tag_id=#{tag
Ids}
</if>
</if>
<if
test=
"status !=null and status
!=''"
>
AND wfcr.status=#{status
}
</if>
<if
test=
"delFlag !=null and delFlag
!=''"
>
AND wfcr.del_flag=#{delFlag
}
</if>
<if
test=
"isOpenChat !=null "
>
AND wc.is_open_chat=#{isOpenChat}
</if>
</where>
ORDER BY wfcr.create_time ASC
) aa GROUP BY aa.external_userid
) aa GROUP BY
aa.corp_id,
aa.external_userid
</select>
...
...
@@ -182,26 +175,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select
id=
"selectWeCustomerById"
parameterType=
"String"
resultType=
"WeCustomer"
>
<include
refid=
"selectWeCustomerVo"
/>
where external_userid = #{externalUserId}
</select>
<insert
id=
"insertWeCustomer"
parameterType=
"WeCustomer"
>
insert into we_customer
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"corpId != null"
>
corp_id,
</if>
<if
test=
"externalUserid != null"
>
external_userid,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"avatar != null"
>
avatar,
</if>
...
...
@@ -212,9 +194,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"corpName != null"
>
corp_name,
</if>
<if
test=
"corpFullName != null"
>
corp_full_name,
</if>
<if
test=
"position != null"
>
position,
</if>
<if
test=
"isOpenChat != null"
>
is_open_chat
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"corpId != null"
>
#{corpId},
</if>
<if
test=
"externalUserid != null"
>
#{externalUserid},
</if>
<if
test=
"name != null"
>
#{name},
</if>
<if
test=
"avatar != null"
>
#{avatar},
</if>
...
...
@@ -225,8 +207,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"corpName != null"
>
#{corpName},
</if>
<if
test=
"corpFullName != null"
>
#{corpFullName},
</if>
<if
test=
"position != null"
>
#{position},
</if>
<if
test=
"isOpenChat != null"
>
#{isOpenChat}
</if>
</trim>
</trim>
on duplicate key update corp_id = values(corp_id), external_userid= values(external_userid),
`name`= values(`name`),avatar= values(avatar),
`type`= values(`type`),gender= values(gender),
unionid= values(unionid),birthday= values(birthday),
corp_name= values(corp_name),corp_full_name= values(corp_full_name),
position= values(position)
</insert>
<update
id=
"updateWeCustomer"
parameterType=
"WeCustomer"
>
...
...
@@ -260,42 +247,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select
id=
"getCustomersByUserId"
resultMap=
"WeCustomerResult"
>
SELECT
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,
wu.user_name,
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE wd.id=wu.department) as department
SELECT
wc.id,
wc.corp_id,
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.add_time,
wfcr.remark_corp_name,
wfcr.remark_mobiles,
wfcr.oper_userid,
wfcr.add_way,
wfcr.state,
wu.user_name,
wfcrf.flower_customer_rel_id,
wt.tag_id,
wt.create_time,
wt.`name` as tagName,
(SELECT GROUP_CONCAT(wd.`name`) FROM we_department wd WHERE FIND_IN_SET(wd.dept_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
we_customer wc
LEFT JOIN we_flower_customer_rel wfcr ON wc.
corp_id = wfcr.corp_id and wc.external_userid =
wfcr.external_userid
LEFT JOIN we_user wu ON wu.
corp_id = wfcr.corp_id and 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 wc.
external_userid=#{externalUser
id}
WHERE wc.
id=#{
id}
<if
test=
"userId != null and userId !=''"
>
AND wfcr.user_id=#{userId}
AND wfcr.user_id=#{userId}
</if>
</select>
...
...
@@ -309,8 +299,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</where>
</select>
<select
id=
"findCustomerByOperUseridAndCustomerId"
resultType=
"com.linkwechat.wecom.domain.WeCustomerPortrait"
>
SELECT
wc.`name`,
...
...
@@ -363,6 +353,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert
id=
"saveBatch"
>
insert into we_customer
(corp_id, external_userid, `name`, avatar, `type`, gender, unionid, birthday, corp_name, corp_full_name,
position)
<foreach
collection=
"weCustomerList"
item=
"weCustomer"
index=
"index"
separator=
","
>
(
#{weCustomer.corpId},#{weCustomer.externalUserid},#{weCustomer.name},#{weCustomer.avatar},
#{weCustomer.type},#{weCustomer.gender},#{weCustomer.unionid},#{weCustomer.birthday},
#{weCustomer.corp_name},#{weCustomer.corp_full_name},#{weCustomer.position}
)
</foreach>
on duplicate key update corp_id = values(corp_id), external_userid= values(external_userid),
`name`= values(`name`),avatar= values(avatar),
`type`= values(`type`),gender= values(gender),
unionid= values(unionid),birthday= values(birthday),
corp_name= values(corp_name),corp_full_name= values(corp_full_name),
position= values(position)
</insert>
</mapper>
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerRelMapper.xml
浏览文件 @
e4d09dc3
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.linkwechat.wecom.mapper.WeFlowerCustomerRelMapper"
>
<resultMap
type=
"WeFlowerCustomerRel"
id=
"WeFlowerCustomerRelResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"remarkCorpName"
column=
"remark_corp_name"
/>
<!-- <result property="remarkMobiles" column="remark_mobiles" />-->
<result
property=
"operUserid"
column=
"oper_userid"
/>
<result
property=
"addWay"
column=
"add_way"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"customerId"
column=
"customer_id"
/>
<result
property=
"id"
column=
"id"
/>
<result
property=
"corp_id"
column=
"corp_id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"remark"
column=
"remark"
/>
<result
property=
"description"
column=
"description"
/>
<result
property=
"addTime"
column=
"add_time"
/>
<result
property=
"remarkCorpName"
column=
"remark_corp_name"
/>
<result
property=
"remarkMobiles"
column=
"remark_mobiles"
/>
<result
property=
"operUserid"
column=
"oper_userid"
/>
<result
property=
"addWay"
column=
"add_way"
/>
<result
property=
"state"
column=
"state"
/>
<result
property=
"externalUserid"
column=
"external_userid"
/>
</resultMap>
<sql
id=
"selectWeFlowerCustomerRelVo"
>
select id,
user_id, remark, description, create_time, remark_corp_name, remark_mobiles, oper_userid, add_way, state, customer_
id from we_flower_customer_rel
select id,
corp_id, user_id, remark, description, add_time, remark_corp_name, remark_mobiles, oper_userid, add_way, state, external_user
id from we_flower_customer_rel
</sql>
<select
id=
"selectWeFlowerCustomerRelList"
parameterType=
"WeFlowerCustomerRel"
resultMap=
"WeFlowerCustomerRelResult"
>
<select
id=
"selectWeFlowerCustomerRelList"
parameterType=
"WeFlowerCustomerRel"
resultMap=
"WeFlowerCustomerRelResult"
>
<include
refid=
"selectWeFlowerCustomerRelVo"
/>
<where>
<if
test=
"userId != null and userId != ''"
>
and user_id = #{userId}
</if>
<if
test=
"description != null and description != ''"
>
and description = #{description}
</if>
<if
test=
"remarkCorpName != null and remarkCorpName != ''"
>
and remark_corp_name like concat('%', #{remarkCorpName}, '%')
</if>
<if
test=
"remarkMobiles != null and remarkMobiles != ''"
>
and remark_mobiles = #{remarkMobiles}
</if>
<if
test=
"operUserid != null and operUserid != ''"
>
and oper_userid = #{operUserid}
</if>
<if
test=
"addWay != null and addWay != ''"
>
and add_way = #{addWay}
</if>
<if
test=
"state != null and state != ''"
>
and state = #{state}
</if>
<if
test=
"customerId != null "
>
and customer_id = #{customerId}
</if>
<where>
<if
test=
"userId != null and userId != ''"
>
and user_id = #{userId}
</if>
<if
test=
"description != null and description != ''"
>
and description = #{description}
</if>
<if
test=
"remarkCorpName != null and remarkCorpName != ''"
>
and remark_corp_name like concat('%',
#{remarkCorpName}, '%')
</if>
<if
test=
"remarkMobiles != null and remarkMobiles != ''"
>
and remark_mobiles = #{remarkMobiles}
</if>
<if
test=
"operUserid != null and operUserid != ''"
>
and oper_userid = #{operUserid}
</if>
<if
test=
"addWay != null and addWay != ''"
>
and add_way = #{addWay}
</if>
<if
test=
"state != null and state != ''"
>
and state = #{state}
</if>
<if
test=
"externalUserid != null "
>
and external_userid = #{externalUserid}
</if>
</where>
</select>
<select
id=
"selectWeFlowerCustomerRelById"
parameterType=
"Long"
resultMap=
"WeFlowerCustomerRelResult"
>
<include
refid=
"selectWeFlowerCustomerRelVo"
/>
where id = #{id}
</select>
<insert
id=
"insertWeFlowerCustomerRel"
parameterType=
"WeFlowerCustomerRel"
>
insert into we_flower_customer_rel
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
...
...
@@ -50,12 +54,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"description != null"
>
description,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"remarkCorpName != null"
>
remark_corp_name,
</if>
<!-- <if test="remarkMobiles != null">remark_mobiles,</if>-->
<!-- <if test="remarkMobiles != null">remark_mobiles,</if>-->
<if
test=
"operUserid != null"
>
oper_userid,
</if>
<if
test=
"addWay != null"
>
add_way,
</if>
<if
test=
"state != null"
>
state,
</if>
<if
test=
"customerId != null"
>
customer_id,
</if>
</trim>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"userId != null"
>
#{userId},
</if>
...
...
@@ -63,12 +67,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"description != null"
>
#{description},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"remarkCorpName != null"
>
#{remarkCorpName},
</if>
<!-- <if test="remarkMobiles != null">#{remarkMobiles},</if>-->
<!-- <if test="remarkMobiles != null">#{remarkMobiles},</if>-->
<if
test=
"operUserid != null"
>
#{operUserid},
</if>
<if
test=
"addWay != null"
>
#{addWay},
</if>
<if
test=
"state != null"
>
#{state},
</if>
<if
test=
"customerId != null"
>
#{customerId},
</if>
</trim>
</trim>
</insert>
<update
id=
"updateWeFlowerCustomerRel"
parameterType=
"WeFlowerCustomerRel"
>
...
...
@@ -79,7 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"description != null"
>
description = #{description},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"remarkCorpName != null"
>
remark_corp_name = #{remarkCorpName},
</if>
<!-- <if test="remarkMobiles != null">remark_mobiles = #{remarkMobiles},</if>-->
<!-- <if test="remarkMobiles != null">remark_mobiles = #{remarkMobiles},</if>-->
<if
test=
"operUserid != null"
>
oper_userid = #{operUserid},
</if>
<if
test=
"addWay != null"
>
add_way = #{addWay},
</if>
<if
test=
"state != null"
>
state = #{state},
</if>
...
...
@@ -93,16 +97,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete
id=
"deleteWeFlowerCustomerRelByIds"
parameterType=
"String"
>
delete from we_flower_customer_rel where id in
delete from we_flower_customer_rel where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<insert
id=
"batchInsetWeFlowerCustomerRel"
>
insert into we_flower_customer_rel (id, user_id, remark, description, create_time, remark_corp_name,
remark_mobiles, oper_userid, add_way, state, customer_id)
<insert
id=
"batchInsetWeFlowerCustomerRel"
>
insert into we_flower_customer_rel (id, corp_id, user_id, remark, description, create_time, remark_corp_name,
remark_mobiles, oper_userid, add_way, state, customer_id)
values
<foreach
collection=
"weFlowerCustomerRels"
item=
"tag"
index=
"index"
separator=
","
>
(#{tag.id},#{tag.userId},#{tag.remark},#{tag.description},#{tag.createTime},#{tag.remarkCorpName},#{tag.remarkMobiles},#{tag.operUserid},#{tag.addWay},#{tag.state},#{tag.customerId})
...
...
@@ -110,30 +114,48 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert>
<update
id=
"batchLogicDeleteByIds"
parameterType=
"String"
>
update we_flower_customer_rel set del_flag=2
where id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</update>
<update
id=
"batchLogicDeleteByIds"
parameterType=
"String"
>
update we_flower_customer_rel set del_flag=2
where id in
<foreach
item=
"id"
collection=
"ids"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</update>
<select
id=
"getUserAddCustomerStat"
parameterType=
"WeFlowerCustomerRel"
resultType=
"java.util.HashMap"
>
select
left(wfcr.create_time,10) as createTime , count(1) as total
from
we_flower_customer_rel wfcr
<where>
<if
test=
"userId != null and userId != ''"
>
and wfcr.user_id = #{userId}
</if>
<if
test=
"addWay != null and addWay != ''"
>
and wfcr.add_way = #{addWay}
</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>
</where>
group by
left(wfcr.create_time,10)
left(wfcr.create_time,10) as createTime , count(1) as total
from
we_flower_customer_rel wfcr
<where>
<if
test=
"userId != null and userId != ''"
>
and wfcr.user_id = #{userId}
</if>
<if
test=
"addWay != null and addWay != ''"
>
and wfcr.add_way = #{addWay}
</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>
</where>
group by
left(wfcr.create_time,10)
</select>
<insert
id=
"saveBatch"
>
insert into we_flower_customer_rel (corp_id, user_id, external_userid, remark, description, add_time, remark_corp_name,
remark_mobiles, oper_userid, add_way, `state`,)
values
<foreach
collection=
"customerRelList"
item=
"item"
index=
"index"
separator=
","
>
(#{item.corpId},#{item.userId},#{item.externalUserid},#{item.remark},#{item.description},#{item.addTime}
#{item.remarkCorpName},#{item.remarkMobiles},#{item.operUserId},#{item.addWay}
,#{item.state})
</foreach>
on duplicate key update corp_id = values(corp_id), user_id= values(user_id),
external_userid= values(external_userid),remark= values(remark),
description= values(description),add_time= values(add_time),
add_time= values(add_time),remark_corp_name= values(remark_corp_name),
remark_mobiles= values(remark_mobiles),oper_userid= values(oper_userid),
add_way= values(add_way),`state`= values(`state`),
</insert>
</mapper>
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeFlowerCustomerTagRelMapper.xml
浏览文件 @
e4d09dc3
...
...
@@ -73,5 +73,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(#{tag.id},#{tag.flowerCustomerRelId},#{tag.tagId},#{tag.createTime})
</foreach>
</insert>
<insert
id=
"saveBatch"
>
insert into we_flower_customer_tag_rel (corp_id, external_userid, user_id, tag_id)
values
<foreach
collection=
"weFlowerCustomerTagRels"
item=
"item"
index=
"index"
separator=
","
>
(#{item.corpId},#{item.externalUserid},#{item.userId},#{item.tagId})
</foreach>
on duplicate key update corp_id = values(corp_id), external_userid= values(external_userid),
user_id = values(user_id), tag_id= values(tag_id)
</insert>
</mapper>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录