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 9ace5515
authored
Sep 18, 2020
by
HaoN
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
整合标签分组与标签接口
1 parent
a20ab7a9
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
87 additions
and
207 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTagController.java
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
linkwe-common/src/main/java/com/linkwechat/common/enums/CustomerSource.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeTag.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeTagGroup.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeCustomerDto.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeTagMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeTagMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeTagController.java
deleted
100644 → 0
View file @
a20ab7a
package
com
.
linkwechat
.
web
.
controller
.
wecom
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.domain.WeTag
;
import
com.linkwechat.wecom.service.IWeTagService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
/**
* 企业微信标签Controller
*
* @author ruoyi
* @date 2020-09-07
*/
@RestController
@RequestMapping
(
"/wecom/tag"
)
public
class
WeTagController
extends
BaseController
{
@Autowired
private
IWeTagService
weTagService
;
/**
* 查询企业微信标签列表
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tag:list')"
)
@GetMapping
(
"/list"
)
public
AjaxResult
list
()
{
return
AjaxResult
.
success
(
weTagService
.
selectWeTagList
(
new
WeTag
())
);
}
/**
* 新增企业微信标签
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tag:add')"
)
@Log
(
title
=
"企业微信标签"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
WeTag
weTag
)
{
return
toAjax
(
weTagService
.
insertWeTag
(
weTag
));
}
/**
* 修改企业微信标签
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tag:edit')"
)
@Log
(
title
=
"企业微信标签"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
WeTag
weTag
)
{
return
toAjax
(
weTagService
.
updateWeTag
(
weTag
));
}
/**
* 删除企业微信标签
*/
@PreAuthorize
(
"@ss.hasPermi('wecom:tag:remove')"
)
@Log
(
title
=
"企业微信标签"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
weTagService
.
deleteWeTagByIds
(
ids
));
}
}
linkwe-common/src/main/java/com/linkwechat/common/core/domain/BaseEntity.java
View file @
9ace551
...
...
@@ -6,6 +6,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.linkwechat.common.utils.DateUtils
;
import
springfox.documentation.annotations.ApiIgnore
;
/**
...
...
@@ -75,7 +76,12 @@ public class BaseEntity implements Serializable
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
if
(
createTime
==
null
){
this
.
createTime
=
DateUtils
.
getNowDate
();
}
else
{
this
.
createTime
=
createTime
;
}
}
public
String
getUpdateBy
()
...
...
linkwe-common/src/main/java/com/linkwechat/common/enums/CustomerSource.java
View file @
9ace551
...
...
@@ -2,17 +2,17 @@ package com.linkwechat.common.enums;
public
enum
CustomerSource
{
// CUSTOMER_SOURCE_WZLY(0,""),
// CUSTOMER_SOURCE_SMEWM(
0
,),
// CUSTOMER_SOURCE_SSSJH(
0
,),
// CUSTOMER_SOURCE_MPFX(
0
,),
// CUSTOMER_SOURCE_QL(
0
,),
// CUSTOMER_SOURCE_SJTXL(
0
,),
// CUSTOMER_SOURCE_WXLXR(
0
,),
// CUSTOMER_SOURCE_TJHYSQ(
0
,),
// CUSTOMER_SOURCE_DSFRJTJ(
0
,),
// CUSTOMER_SOURCE_YXSS(
0
,),
// CUSTOMER_SOURCE_NBCYGX(
0
,),
// CUSTOMER_SOURCE_GLRYFP(
0
,)
// CUSTOMER_SOURCE_SMEWM(
1
,),
// CUSTOMER_SOURCE_SSSJH(
2
,),
// CUSTOMER_SOURCE_MPFX(
3
,),
// CUSTOMER_SOURCE_QL(
4
,),
// CUSTOMER_SOURCE_SJTXL(
5
,),
// CUSTOMER_SOURCE_WXLXR(
6
,),
// CUSTOMER_SOURCE_TJHYSQ(
7
,),
// CUSTOMER_SOURCE_DSFRJTJ(
8
,),
// CUSTOMER_SOURCE_YXSS(
9
,),
// CUSTOMER_SOURCE_NBCYGX(
201
,),
// CUSTOMER_SOURCE_GLRYFP(
202
,)
// ;
//
// private Integer code;
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeTag.java
View file @
9ace551
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
/**
* 企业微信标签对象 we_tag
...
...
@@ -18,15 +16,16 @@ public class WeTag extends BaseEntity
private
static
final
long
serialVersionUID
=
1L
;
private
Long
id
=
SnowFlakeUtil
.
nextId
();
/** 标签组id */
@Excel
(
name
=
"标签组id"
)
private
String
groupId
;
private
Long
groupId
;
/** 标签名 */
@Excel
(
name
=
"标签名"
)
private
String
name
;
/** 帐号状态(0正常 1删除) */
private
String
status
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeTagGroup.java
View file @
9ace551
package
com
.
linkwechat
.
wecom
.
domain
;
import
com.linkwechat.common.annotation.Excel
;
import
com.linkwechat.common.core.domain.BaseEntity
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
lombok.Data
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.List
;
/**
* 标签组对象 we_tag_group
...
...
@@ -17,49 +17,14 @@ public class WeTagGroup extends BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** $column.columnComment */
@Excel
(
name
=
"${comment}"
,
readConverterExp
=
"$column.readConverterExp()"
)
private
Long
id
=
SnowFlakeUtil
.
nextId
();
/** 分组名称 */
private
String
gourpName
;
// /** 标签组排序的次序值,order值大的排序靠前 */
// @Excel(name = "标签组排序的次序值,order值大的排序靠前")
// private Long order;
/** 标签 */
private
List
<
WeTag
>
weTags
;
// public void setId(Long id)
// {
// this.id = id;
// }
//
// public Long getId()
// {
// return id;
// }
// public void setGourpName(String gourpName)
// {
// this.gourpName = gourpName;
// }
//
// public String getGourpName()
// {
// return gourpName;
// }
// public void setOrder(Long order)
// {
// this.order = order;
// }
//
// public Long getOrder()
// {
// return order;
// }
//
// @Override
// public String toString() {
// return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
// .append("id", getId())
// .append("gourpName", getGourpName())
// .append("createTime", getCreateTime())
// .append("order", getOrder())
// .toString();
// }
/** 帐号状态(0正常 1删除) */
private
String
status
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/dto/WeCustomerDto.java
View file @
9ace551
...
...
@@ -72,17 +72,11 @@ public class WeCustomerDto extends WeResultDto{
if
(
CollectionUtil
.
isNotEmpty
(
follow_user
)){
WeFollowUserDto
weFollowUserDto
=
follow_user
.
get
(
0
);
weCustomer
.
setUserId
(
weFollowUserDto
.
getUserid
());
weCustomer
.
setDescription
(
weFollowUserDto
.
getDescription
());
weCustomer
.
setRemarkMobiles
(
StringUtils
.
join
(
weFollowUserDto
.
getRemark_mobiles
(),
","
));
// weCustomer.setAddWay();
//
// weFollowUserDto.getAdd_way();
// followUser.getUserid();
// followUser.getDescription();
// followUser.getRemark_mobiles();
// followUser.getAdd_way();
weCustomer
.
setUserId
(
weFollowUserDto
.
getUserid
());
weCustomer
.
setDescription
(
weFollowUserDto
.
getDescription
());
weCustomer
.
setRemarkMobiles
(
StringUtils
.
join
(
weFollowUserDto
.
getRemark_mobiles
(),
","
));
// weCustomer.setAddWay();
}
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeTagMapper.java
View file @
9ace551
...
...
@@ -2,6 +2,7 @@ package com.linkwechat.wecom.mapper;
import
java.util.List
;
import
com.linkwechat.wecom.domain.WeTag
;
import
org.apache.ibatis.annotations.Param
;
/**
* 企业微信标签Mapper接口
...
...
@@ -58,4 +59,12 @@ public interface WeTagMapper
* @return 结果
*/
public
int
deleteWeTagByIds
(
Long
[]
ids
);
/**
* 批量插入标签
* @param weTags
* @return
*/
public
int
batchInsetWeTag
(
@Param
(
"weTags"
)
List
<
WeTag
>
weTags
);
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeCustomerServiceImpl.java
View file @
9ace551
...
...
@@ -140,55 +140,16 @@ public class WeCustomerServiceImpl implements IWeCustomerService
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
externalContact
.
getErrcode
())){
//分装成需要入库的数据格式
WeCustomerDto
.
ExternalContact
weExternalContact
=
externalContact
.
getExternal_contact
();
if
(
null
!=
weExternalContact
){
WeCustomer
.
builder
()
.
externalUserid
(
weExternalContact
.
getExternal_userid
())
.
name
(
weExternalContact
.
getName
())
.
avatar
(
weExternalContact
.
getAvatar
())
.
type
(
weExternalContact
.
getType
())
.
gender
(
weExternalContact
.
getGender
())
.
unionid
(
weExternalContact
.
getUnionid
())
// 自定义 .birthday()
// 添加人的id .userId(weExternalContact.getExternal_userid())
// 添加人的名称 .userName()
// 添加人所在部门 .departmentName()
// 添加人员描述 .description()
// 备注号码 .remarkMobiles()
.
corpName
(
weExternalContact
.
getCorp_name
())
.
corpFullName
(
weExternalContact
.
getCorp_full_name
())
.
position
(
weExternalContact
.
getPosition
());
// 客户来源 .addWay()
List
<
WeFollowUserDto
>
followUsers
=
externalContact
.
getFollow_user
();
if
(
CollectionUtil
.
isNotEmpty
(
followUsers
)){
WeFollowUserDto
followUser
=
followUsers
.
get
(
0
);
followUser
.
getUserid
();
followUser
.
getDescription
();
followUser
.
getRemark_mobiles
();
followUser
.
getAdd_way
();
WeUserDto
weUserDto
=
weUserClient
.
getUserByUserId
(
followUser
.
getUserid
());
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
weUserDto
.
getErrcode
())){
weUserDto
.
getName
();
}
}
WeCustomer
weCustomer
=
externalContact
.
transformWeCustomer
();
WeUserDto
weUserDto
=
weUserClient
.
getUserByUserId
(
weCustomer
.
getUserId
());
if
(
WeConstans
.
WE_SUCCESS_CODE
.
equals
(
weUserDto
.
getErrcode
())){
weCustomer
.
setName
(
weUserDto
.
getName
());
}
}
});
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeTagGroupServiceImpl.java
View file @
9ace551
package
com
.
linkwechat
.
wecom
.
service
.
impl
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.linkwechat.common.utils.DateUtils
;
import
com.linkwechat.wecom.domain.WeTag
;
import
com.linkwechat.wecom.mapper.WeTagMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.linkwechat.wecom.mapper.WeTagGroupMapper
;
import
com.linkwechat.wecom.domain.WeTagGroup
;
import
com.linkwechat.wecom.service.IWeTagGroupService
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* 标签组Service业务层处理
...
...
@@ -21,6 +26,9 @@ public class WeTagGroupServiceImpl implements IWeTagGroupService
@Autowired
private
WeTagGroupMapper
weTagGroupMapper
;
@Autowired
private
WeTagMapper
weTagMapper
;
/**
* 查询标签组
*
...
...
@@ -52,10 +60,20 @@ public class WeTagGroupServiceImpl implements IWeTagGroupService
* @return 结果
*/
@Override
@Transactional
public
int
insertWeTagGroup
(
WeTagGroup
weTagGroup
)
{
weTagGroup
.
setCreateTime
(
DateUtils
.
getNowDate
());
return
weTagGroupMapper
.
insertWeTagGroup
(
weTagGroup
);
int
returnCode
=
weTagGroupMapper
.
insertWeTagGroup
(
weTagGroup
);
if
(
returnCode
>
0
){
List
<
WeTag
>
weTags
=
weTagGroup
.
getWeTags
();
if
(
CollectionUtil
.
isNotEmpty
(
weTags
)){
weTags
.
stream
().
forEach
(
k
->
k
.
setGroupId
(
weTagGroup
.
getId
()));
weTagMapper
.
batchInsetWeTag
(
weTags
);
}
}
return
returnCode
;
}
/**
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeTagGroupMapper.xml
View file @
9ace551
...
...
@@ -8,24 +8,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"id"
column=
"id"
/>
<result
property=
"gourpName"
column=
"gourp_name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"order"
column=
"order"
/>
</resultMap>
<sql
id=
"selectWeTagGroupVo"
>
select id, gourp_name, create_time
, order
from we_tag_group
select id, gourp_name, create_time from we_tag_group
</sql>
<select
id=
"selectWeTagGroupList"
parameterType=
"WeTagGroup"
resultMap=
"WeTagGroupResult"
>
<include
refid=
"selectWeTagGroupVo"
/>
<where>
<if
test=
"gourpName != null and gourpName != ''"
>
and gourp_name like concat('%', #{gourpName}, '%')
</if>
<if
test=
"order != null "
>
and order = #{order}
</if>
</where>
</select>
<select
id=
"selectWeTagGroupById"
parameterType=
"Long"
resultMap=
"WeTagGroupResult"
>
<include
refid=
"selectWeTagGroupVo"
/>
where id = #{id}
where id = #{id}
and status=0
</select>
<insert
id=
"insertWeTagGroup"
parameterType=
"WeTagGroup"
>
...
...
@@ -34,13 +32,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"id != null"
>
id,
</if>
<if
test=
"gourpName != null"
>
gourp_name,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"order != null"
>
order,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"gourpName != null"
>
#{gourpName},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"order != null"
>
#{order},
</if>
</trim>
</insert>
...
...
@@ -49,7 +45,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"gourpName != null"
>
gourp_name = #{gourpName},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"order != null"
>
order = #{order},
</if>
</trim>
where id = #{id}
</update>
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeTagMapper.xml
View file @
9ace551
...
...
@@ -9,11 +9,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"groupId"
column=
"group_id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"order"
column=
"order"
/>
</resultMap>
<sql
id=
"selectWeTagVo"
>
select id, group_id, name, create_time
, order
from we_tag
select id, group_id, name, create_time from we_tag
</sql>
<select
id=
"selectWeTagList"
parameterType=
"WeTag"
resultMap=
"WeTagResult"
>
...
...
@@ -21,13 +20,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if
test=
"groupId != null "
>
and group_id = #{groupId}
</if>
<if
test=
"name != null and name != ''"
>
and name like concat('%', #{name}, '%')
</if>
<if
test=
"order != null "
>
and order = #{order}
</if>
</where>
</select>
<select
id=
"selectWeTagById"
parameterType=
"Long"
resultMap=
"WeTagResult"
>
<include
refid=
"selectWeTagVo"
/>
where id = #{id}
where id = #{id}
and status=0
</select>
<insert
id=
"insertWeTag"
parameterType=
"WeTag"
>
...
...
@@ -37,14 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"groupId != null"
>
group_id,
</if>
<if
test=
"name != null"
>
name,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"order != null"
>
order,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id},
</if>
<if
test=
"groupId != null"
>
#{groupId},
</if>
<if
test=
"name != null"
>
#{name},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"order != null"
>
#{order},
</if>
</trim>
</insert>
...
...
@@ -54,7 +50,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"groupId != null"
>
group_id = #{groupId},
</if>
<if
test=
"name != null"
>
name = #{name},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"order != null"
>
order = #{order},
</if>
</trim>
where id = #{id}
</update>
...
...
@@ -69,5 +64,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<insert
id=
"batchInsetWeTag"
>
insert into person (id, group_id, name, create_time)
values
<foreach
collection=
"tags"
item=
"tag"
index=
"index"
separator=
","
>
(#{tag.id},#{tag.groupId},#{tag.name},#{tag.createTime})
</foreach>
</insert>
</mapper>
\ No newline at end of file
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