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 b987f3d4
authored
Jan 07, 2021
by
18356073052
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
聊天侧边栏
1 parent
c6d64a95
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
166 additions
and
10 deletions
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java
linkwe-admin/src/main/resources/application.yml
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeChatSide.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeChatSideVo.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatCollectionMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatItemMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatSideMapper.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatCollectionService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatItemService.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatCollectionServiceImpl.java
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatItemServiceImpl.java
linkwe-wecom/src/main/resources/mapper/wecom/WeChatCollectionMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeChatItemMapper.xml
linkwe-wecom/src/main/resources/mapper/wecom/WeChatSideMapper.xml
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatCollectionController.java
View file @
b987f3d
...
@@ -3,12 +3,16 @@ package com.linkwechat.web.controller.wecom;
...
@@ -3,12 +3,16 @@ package com.linkwechat.web.controller.wecom;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
com.linkwechat.wecom.service.IWeChatCollectionService
;
import
com.linkwechat.wecom.service.IWeChatCollectionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
/**
* 聊天工具 侧边栏栏 素材收藏
* 聊天工具 侧边栏栏 素材收藏
*
*
...
@@ -28,8 +32,8 @@ public class WeChatCollectionController extends BaseController {
...
@@ -28,8 +32,8 @@ public class WeChatCollectionController extends BaseController {
*/
*/
@PreAuthorize
(
"@ss.hasPermi('chat:collection:add')"
)
@PreAuthorize
(
"@ss.hasPermi('chat:collection:add')"
)
@Log
(
title
=
"添加收藏"
,
businessType
=
BusinessType
.
INSERT
)
@Log
(
title
=
"添加收藏"
,
businessType
=
BusinessType
.
INSERT
)
@P
ostMapping
@P
utMapping
(
"addCollection"
)
public
AjaxResult
addCollection
(
@RequestParam
(
value
=
"materialId"
)
Long
materialId
,
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
public
AjaxResult
addCollection
(
@RequestParam
(
value
=
"materialId"
)
Long
materialId
,
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
return
toAjax
(
weChatCollectionService
.
addCollection
(
materialId
,
userId
));
return
toAjax
(
weChatCollectionService
.
addCollection
(
materialId
,
userId
));
}
}
...
@@ -39,9 +43,20 @@ public class WeChatCollectionController extends BaseController {
...
@@ -39,9 +43,20 @@ public class WeChatCollectionController extends BaseController {
*/
*/
@PreAuthorize
(
"@ss.hasPermi('chat:collection:delete')"
)
@PreAuthorize
(
"@ss.hasPermi('chat:collection:delete')"
)
@Log
(
title
=
"取消收藏"
,
businessType
=
BusinessType
.
UPDATE
)
@Log
(
title
=
"取消收藏"
,
businessType
=
BusinessType
.
UPDATE
)
@P
utMapping
@P
ostMapping
(
value
=
"cancleCollection"
)
public
AjaxResult
cancleCollection
(
@RequestParam
(
value
=
"materialId"
)
Long
materialId
,
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
public
AjaxResult
cancleCollection
(
@RequestParam
(
value
=
"materialId"
)
Long
materialId
,
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
return
toAjax
(
weChatCollectionService
.
cancleCollection
(
materialId
,
userId
));
return
toAjax
(
weChatCollectionService
.
cancleCollection
(
materialId
,
userId
));
}
}
/**
* 收藏列表
*/
@PreAuthorize
(
"@ss.hasPermi('chat:collection:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
@RequestParam
(
value
=
"userId"
)
Long
userId
)
{
startPage
();
List
<
WeChatSideVo
>
collections
=
weChatCollectionService
.
collections
(
userId
);
return
getDataTable
(
collections
);
}
}
}
linkwe-admin/src/main/java/com/linkwechat/web/controller/wecom/WeChatItemController.java
View file @
b987f3d
...
@@ -3,15 +3,16 @@ package com.linkwechat.web.controller.wecom;
...
@@ -3,15 +3,16 @@ package com.linkwechat.web.controller.wecom;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.annotation.Log
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.controller.BaseController
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.domain.AjaxResult
;
import
com.linkwechat.common.core.page.TableDataInfo
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.common.enums.BusinessType
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
com.linkwechat.wecom.service.IWeChatItemService
;
import
com.linkwechat.wecom.service.IWeChatItemService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
java.util.List
;
import
org.springframework.web.bind.annotation.RestController
;
/**
/**
* 聊天工具侧边栏
* 聊天工具侧边栏
...
@@ -35,6 +36,15 @@ public class WeChatItemController extends BaseController {
...
@@ -35,6 +36,15 @@ public class WeChatItemController extends BaseController {
return
toAjax
(
weChatItemService
.
checkItems
(
chatItemDto
));
return
toAjax
(
weChatItemService
.
checkItems
(
chatItemDto
));
}
}
/**
* h5素材列表
*/
@PreAuthorize
(
"@ss.hasPermi('chat:item:list')"
)
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
@RequestParam
(
value
=
"sideId"
)
Long
sideId
)
{
startPage
();
List
<
WeChatSideVo
>
weChatSideVos
=
weChatItemService
.
chatItems
(
sideId
);
return
getDataTable
(
weChatSideVos
);
}
}
}
linkwe-admin/src/main/resources/application.yml
View file @
b987f3d
...
@@ -178,6 +178,8 @@ wecome:
...
@@ -178,6 +178,8 @@ wecome:
-
/externalcontact/get_unassigned_list
-
/externalcontact/get_unassigned_list
-
/externalcontact/send_welcome_msg
-
/externalcontact/send_welcome_msg
-
/externalcontact/unionid_to_external_userid
-
/externalcontact/unionid_to_external_userid
-
/externalcontact/add_msg_template
-
/externalcontact/get_group_msg_result
-
/get_jsapi_ticket
-
/get_jsapi_ticket
-
/ticket/get
-
/ticket/get
fileUplodUrl
:
/media/upload,/media/uploadimg
fileUplodUrl
:
/media/upload,/media/uploadimg
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/WeChatSide.java
View file @
b987f3d
...
@@ -18,7 +18,7 @@ public class WeChatSide extends BaseEntity {
...
@@ -18,7 +18,7 @@ public class WeChatSide extends BaseEntity {
/**
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
*/
private
Lo
ng
mediaType
;
private
Stri
ng
mediaType
;
/**
/**
* 聊天工具栏名称
* 聊天工具栏名称
...
...
linkwe-wecom/src/main/java/com/linkwechat/wecom/domain/vo/WeChatSideVo.java
0 → 100644
View file @
b987f3d
package
com
.
linkwechat
.
wecom
.
domain
.
vo
;
import
lombok.Data
;
/**
* 聊天侧边栏
* @author kewen
*/
@Data
public
class
WeChatSideVo
{
/**
* 0 图片(image)、1 语音(voice)、2 视频(video),3 普通文件(file) 4 文本 5 海报
*/
private
String
mediaType
;
/**
* 素材id
*/
private
Long
materialId
;
/**
* 本地资源文件地址
*/
private
String
materialUrl
;
/**
* 文本内容、图片文案
*/
private
String
content
;
/**
* 图片名称
*/
private
String
materialName
;
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatCollectionMapper.java
View file @
b987f3d
...
@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper;
...
@@ -2,8 +2,11 @@ package com.linkwechat.wecom.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
/**
* 聊天工具 侧边栏栏 素材收藏
* 聊天工具 侧边栏栏 素材收藏
*
*
...
@@ -37,4 +40,12 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
...
@@ -37,4 +40,12 @@ public interface WeChatCollectionMapper extends BaseMapper<WeChatCollection> {
*/
*/
public
int
countCollectionByMaterialIdAndUserId
(
@Param
(
"materialId"
)
Long
materialId
,
@Param
(
"userId"
)
Long
userId
);
public
int
countCollectionByMaterialIdAndUserId
(
@Param
(
"materialId"
)
Long
materialId
,
@Param
(
"userId"
)
Long
userId
);
/**
* 收藏列表
*
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public
List
<
WeChatSideVo
>
findCollections
(
Long
userId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatItemMapper.java
View file @
b987f3d
...
@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
...
@@ -3,6 +3,7 @@ package com.linkwechat.wecom.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeChatItem
;
import
com.linkwechat.wecom.domain.WeChatItem
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,4 +28,12 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
...
@@ -27,4 +28,12 @@ public interface WeChatItemMapper extends BaseMapper<WeChatItem> {
*/
*/
public
int
dropItem
(
@Param
(
"sideId"
)
Long
sideId
);
public
int
dropItem
(
@Param
(
"sideId"
)
Long
sideId
);
/**
* h5素材列表
*
* @param sideId 侧边栏id
* @return
*/
public
List
<
WeChatSideVo
>
findChatItems
(
@Param
(
"sideId"
)
Long
sideId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/mapper/WeChatSideMapper.java
View file @
b987f3d
...
@@ -2,6 +2,8 @@ package com.linkwechat.wecom.mapper;
...
@@ -2,6 +2,8 @@ package com.linkwechat.wecom.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.linkwechat.wecom.domain.WeChatSide
;
import
com.linkwechat.wecom.domain.WeChatSide
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.List
;
...
@@ -27,4 +29,6 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> {
...
@@ -27,4 +29,6 @@ public interface WeChatSideMapper extends BaseMapper<WeChatSide> {
*/
*/
public
int
updateWeChatSideById
(
WeChatSide
weChatSide
);
public
int
updateWeChatSideById
(
WeChatSide
weChatSide
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatCollectionService.java
View file @
b987f3d
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service;
...
@@ -2,6 +2,9 @@ package com.linkwechat.wecom.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
java.util.List
;
/**
/**
* 聊天工具 侧边栏栏 素材收藏
* 聊天工具 侧边栏栏 素材收藏
...
@@ -28,4 +31,12 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
...
@@ -28,4 +31,12 @@ public interface IWeChatCollectionService extends IService<WeChatCollection> {
*/
*/
public
int
cancleCollection
(
Long
materialId
,
Long
userId
);
public
int
cancleCollection
(
Long
materialId
,
Long
userId
);
/**
* 收藏列表
*
* @param userId 用户id
* @return {@link WeChatSideVo}s
*/
public
List
<
WeChatSideVo
>
collections
(
Long
userId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/IWeChatItemService.java
View file @
b987f3d
...
@@ -3,6 +3,9 @@ package com.linkwechat.wecom.service;
...
@@ -3,6 +3,9 @@ package com.linkwechat.wecom.service;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.linkwechat.wecom.domain.WeChatItem
;
import
com.linkwechat.wecom.domain.WeChatItem
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
java.util.List
;
/**
/**
* 聊天工具侧边栏
* 聊天工具侧边栏
...
@@ -18,4 +21,12 @@ public interface IWeChatItemService extends IService<WeChatItem> {
...
@@ -18,4 +21,12 @@ public interface IWeChatItemService extends IService<WeChatItem> {
*/
*/
public
int
checkItems
(
WeChatItemDto
chatItemDto
);
public
int
checkItems
(
WeChatItemDto
chatItemDto
);
/**
* h5素材列表
*
* @param sideId 侧边栏id
* @return
*/
public
List
<
WeChatSideVo
>
chatItems
(
Long
sideId
);
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatCollectionServiceImpl.java
View file @
b987f3d
...
@@ -3,11 +3,14 @@ package com.linkwechat.wecom.service.impl;
...
@@ -3,11 +3,14 @@ package com.linkwechat.wecom.service.impl;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.common.utils.SnowFlakeUtil
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.domain.WeChatCollection
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
com.linkwechat.wecom.mapper.WeChatCollectionMapper
;
import
com.linkwechat.wecom.mapper.WeChatCollectionMapper
;
import
com.linkwechat.wecom.service.IWeChatCollectionService
;
import
com.linkwechat.wecom.service.IWeChatCollectionService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
/**
* 聊天工具 侧边栏栏 素材收藏
* 聊天工具 侧边栏栏 素材收藏
*
*
...
@@ -34,4 +37,9 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap
...
@@ -34,4 +37,9 @@ public class WeChatCollectionServiceImpl extends ServiceImpl<WeChatCollectionMap
return
weChatCollectionMapper
.
dropCollection
(
materialId
,
userId
);
return
weChatCollectionMapper
.
dropCollection
(
materialId
,
userId
);
}
}
@Override
public
List
<
WeChatSideVo
>
collections
(
Long
userId
)
{
return
weChatCollectionMapper
.
findCollections
(
userId
);
}
}
}
linkwe-wecom/src/main/java/com/linkwechat/wecom/service/impl/WeChatItemServiceImpl.java
View file @
b987f3d
...
@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeChatItem;
...
@@ -6,6 +6,7 @@ import com.linkwechat.wecom.domain.WeChatItem;
import
com.linkwechat.wecom.domain.WeChatSide
;
import
com.linkwechat.wecom.domain.WeChatSide
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.WeMaterial
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.dto.WeChatItemDto
;
import
com.linkwechat.wecom.domain.vo.WeChatSideVo
;
import
com.linkwechat.wecom.mapper.WeChatItemMapper
;
import
com.linkwechat.wecom.mapper.WeChatItemMapper
;
import
com.linkwechat.wecom.mapper.WeChatSideMapper
;
import
com.linkwechat.wecom.mapper.WeChatSideMapper
;
import
com.linkwechat.wecom.service.IWeChatItemService
;
import
com.linkwechat.wecom.service.IWeChatItemService
;
...
@@ -94,6 +95,11 @@ public class WeChatItemServiceImpl extends ServiceImpl<WeChatItemMapper, WeChatI
...
@@ -94,6 +95,11 @@ public class WeChatItemServiceImpl extends ServiceImpl<WeChatItemMapper, WeChatI
return
1
;
return
1
;
}
}
@Override
public
List
<
WeChatSideVo
>
chatItems
(
Long
sideId
)
{
return
weChatItemMapper
.
findChatItems
(
sideId
);
}
/**
/**
* 更新该次选择的素材数
* 更新该次选择的素材数
*
*
...
...
linkwe-wecom/src/main/resources/mapper/wecom/WeChatCollectionMapper.xml
View file @
b987f3d
...
@@ -23,5 +23,20 @@
...
@@ -23,5 +23,20 @@
material_id=#{materialId} AND user_id=#{userId}
material_id=#{materialId} AND user_id=#{userId}
</where>
</where>
</select>
</select>
<select
id=
"findCollections"
resultType=
"com.linkwechat.wecom.domain.vo.WeChatSideVo"
>
SELECT
wcc.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type
FROM
we_chat_collection wcc
LEFT JOIN we_material wm ON wcc.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wcc.user_id=#{userId}
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeChatItemMapper.xml
View file @
b987f3d
...
@@ -20,4 +20,20 @@
...
@@ -20,4 +20,20 @@
side_id=#{sideId}
side_id=#{sideId}
</where>
</where>
</delete>
</delete>
<select
id=
"findChatItems"
resultType=
"com.linkwechat.wecom.domain.vo.WeChatSideVo"
>
SELECT
wci.material_id,
wm.material_name,
wm.material_url,
wm.content,
wc.media_type
FROM
we_chat_item wci
LEFT JOIN we_material wm ON wci.material_id = wm.id
LEFT JOIN we_category wc ON wm.category_id = wc.id
<where>
wci.side_id=#{sideId}
</where>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ No newline at end of file
linkwe-wecom/src/main/resources/mapper/wecom/WeChatSideMapper.xml
View file @
b987f3d
...
@@ -34,4 +34,5 @@
...
@@ -34,4 +34,5 @@
`using`=0
`using`=0
</where>
</where>
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
\ 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