Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
8ce9fece
Commit
8ce9fece
authored
Dec 20, 2021
by
墨竹
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
875242b7
ab647d5d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
1278 additions
and
32 deletions
+1278
-32
NoticeMessageInfoDTO.java
...aoban/manage/api/dto/notify/dto/NoticeMessageInfoDTO.java
+176
-0
NoticeMessageTypeEnum.java
...om/gic/haoban/manage/api/enums/NoticeMessageTypeEnum.java
+36
-8
NoticeMessageApiService.java
...an/manage/api/service/notify/NoticeMessageApiService.java
+42
-1
NoticeMessageUtil.java
.../gic/haoban/manage/api/util/notify/NoticeMessageUtil.java
+12
-3
NoticeMessageMapper.java
...haoban/manage/service/dao/mapper/NoticeMessageMapper.java
+26
-0
NoticeMessageTemplateMapper.java
...anage/service/dao/mapper/NoticeMessageTemplateMapper.java
+38
-0
TabNoticeMessage.java
...om/gic/haoban/manage/service/entity/TabNoticeMessage.java
+49
-14
TabNoticeMessageTemplate.java
...aoban/manage/service/entity/TabNoticeMessageTemplate.java
+188
-0
HaoBanErrCode.java
...om/gic/haoban/manage/service/errorcode/HaoBanErrCode.java
+42
-0
NoticeMessageBO.java
...om/gic/haoban/manage/service/pojo/bo/NoticeMessageBO.java
+10
-0
TemplateContentBO.java
.../gic/haoban/manage/service/pojo/bo/TemplateContentBO.java
+29
-0
NoticeMessageService.java
...n/manage/service/service/notify/NoticeMessageService.java
+24
-0
NoticeMessageTemplateService.java
.../service/service/notify/NoticeMessageTemplateService.java
+30
-0
NoticeMessageServiceImpl.java
...service/service/notify/impl/NoticeMessageServiceImpl.java
+19
-0
NoticeMessageTemplateServiceImpl.java
...service/notify/impl/NoticeMessageTemplateServiceImpl.java
+80
-0
NoticeMessageApiServiceImpl.java
...rvice/service/notify/out/NoticeMessageApiServiceImpl.java
+174
-3
CommonUtil.java
...n/java/com/gic/haoban/manage/service/util/CommonUtil.java
+1
-0
dubbo-haoban-manage-service.xml
...ervice/src/main/resources/dubbo-haoban-manage-service.xml
+4
-0
NoticeMessageMapper.xml
...service/src/main/resources/mapper/NoticeMessageMapper.xml
+0
-0
NoticeMessageTemplateMapper.xml
...src/main/resources/mapper/NoticeMessageTemplateMapper.xml
+128
-0
NotityTest.java
haoban-manage3-service/src/test/java/NotityTest.java
+64
-0
test.java
haoban-manage3-service/src/test/java/test.java
+7
-3
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+15
-0
NotifyController.java
...om/gic/haoban/manage/web/controller/NotifyController.java
+60
-0
MessageListQO.java
...va/com/gic/haoban/manage/web/qo/notify/MessageListQO.java
+20
-0
dubbo-haoban-manage-wx.xml
...ge3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
+4
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/dto/notify/dto/NoticeMessageInfoDTO.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
api
.
dto
.
notify
.
dto
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 好办消息通知
*
* @author fdh
*/
public
class
NoticeMessageInfoDTO
implements
Serializable
{
/**
*
*/
private
Long
noticeMessageId
;
/**
* 企业id
*/
private
String
enterpriseId
;
/**
* 门店id
*/
private
String
storeId
;
/**
* 导购id
*/
private
String
clerkId
;
/**
* 类别 0客户相关、1任务相关、2活动相关、3其他
*/
private
Integer
categoryType
;
/**
* 消息类型
*/
private
Integer
messageType
;
/**
* 标题
*/
private
String
title
;
/**
* 描述
*/
private
String
description
;
/**
* 消息带的参数信息
*/
private
String
messageContent
;
/**
* 0 未读 1已读
*/
private
Integer
readFlag
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
*/
private
static
final
long
serialVersionUID
=
1L
;
public
Long
getNoticeMessageId
()
{
return
noticeMessageId
;
}
public
void
setNoticeMessageId
(
Long
noticeMessageId
)
{
this
.
noticeMessageId
=
noticeMessageId
;
}
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
public
String
getStoreId
()
{
return
storeId
;
}
public
void
setStoreId
(
String
storeId
)
{
this
.
storeId
=
storeId
;
}
public
String
getClerkId
()
{
return
clerkId
;
}
public
void
setClerkId
(
String
clerkId
)
{
this
.
clerkId
=
clerkId
;
}
public
Integer
getCategoryType
()
{
return
categoryType
;
}
public
void
setCategoryType
(
Integer
categoryType
)
{
this
.
categoryType
=
categoryType
;
}
public
Integer
getMessageType
()
{
return
messageType
;
}
public
void
setMessageType
(
Integer
messageType
)
{
this
.
messageType
=
messageType
;
}
public
String
getTitle
()
{
return
title
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
String
getDescription
()
{
return
description
;
}
public
void
setDescription
(
String
description
)
{
this
.
description
=
description
;
}
public
String
getMessageContent
()
{
return
messageContent
;
}
public
void
setMessageContent
(
String
messageContent
)
{
this
.
messageContent
=
messageContent
;
}
public
Integer
getReadFlag
()
{
return
readFlag
;
}
public
void
setReadFlag
(
Integer
readFlag
)
{
this
.
readFlag
=
readFlag
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
Date
getUpdateTime
()
{
return
updateTime
;
}
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/enums/NoticeMessageTypeEnum.java
View file @
8ce9fece
...
...
@@ -4,13 +4,14 @@ package com.gic.haoban.manage.api.enums;
* Created by hua on 2021/12/17.
*/
public
enum
NoticeMessageTypeEnum
{
ACTIVITY_START
(
1001
,
"活动开始通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
()),
ACTIVITY_NEW
(
1002
,
"活动上新通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
()),
ACTIVITY_DEL
(
1003
,
"活动删除通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
()),
ACTIVITY_OFFLINE
(
1004
,
"活动下线通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
()),
ACTIVITY_END
(
1005
,
"活动结束通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
()),
ACTIVITY_RANK
(
1006
,
"活动排名通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
()),
ACTIVITY_AWARD
(
1007
,
"活动奖励通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
());
ACTIVITY_START
(
1001
,
"活动开始通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
),
ACTIVITY_NEW
(
1002
,
"活动上新通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
),
ACTIVITY_DEL
(
1003
,
"活动删除通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
),
ACTIVITY_OFFLINE
(
1004
,
"活动下线通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
),
ACTIVITY_END
(
1005
,
"活动结束通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
),
ACTIVITY_RANK
(
1006
,
"活动排名通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
),
ACTIVITY_AWARD
(
1007
,
"活动奖励通知"
,
NoticeMessageCategoryTypeEnum
.
ACTIVITY
.
getType
(),
"activity_message"
,
"/pages/route/index"
);
/**
* 消息类型
*/
...
...
@@ -23,11 +24,30 @@ public enum NoticeMessageTypeEnum {
* 大类
*/
private
int
category
;
/**
* 模板类型
*/
private
String
templateCode
;
NoticeMessageTypeEnum
(
int
type
,
String
name
,
int
category
)
{
/**
* 活动页面
*/
private
String
pageUrl
;
NoticeMessageTypeEnum
(
int
type
,
String
name
,
int
category
,
String
templateCode
,
String
pageUrl
)
{
this
.
type
=
type
;
this
.
name
=
name
;
this
.
category
=
category
;
this
.
templateCode
=
templateCode
;
this
.
pageUrl
=
pageUrl
;
}
public
String
getTemplateCode
()
{
return
templateCode
;
}
public
void
setTemplateCode
(
String
templateCode
)
{
this
.
templateCode
=
templateCode
;
}
public
int
getType
()
{
...
...
@@ -54,6 +74,14 @@ public enum NoticeMessageTypeEnum {
this
.
category
=
category
;
}
public
String
getPageUrl
()
{
return
pageUrl
;
}
public
void
setPageUrl
(
String
pageUrl
)
{
this
.
pageUrl
=
pageUrl
;
}
public
static
NoticeMessageTypeEnum
getByType
(
int
type
)
{
for
(
NoticeMessageTypeEnum
messageTypeEnum
:
values
())
{
if
(
messageTypeEnum
.
getType
()
==
type
)
{
...
...
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/notify/NoticeMessageApiService.java
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
api
.
service
.
notify
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.notify.dto.NoticeMessageInfoDTO
;
/**
* Created 2021/12/17.
*
* @author hua
*/
public
interface
NoticeMessageApiService
{
/**
* 消息接收 发送消息
*
* @param json
*/
public
void
noticeMessageMq
(
String
json
);
/**
* 消息分页
*
* @param enterpriseId
* @param storeId
* @param clerkId 可以空 标识查询门店级别消息
* @param categoryType
* @param pageInfo
* @return
*/
public
ServiceResponse
<
Page
<
NoticeMessageInfoDTO
>>
pageNoticeMessage
(
String
enterpriseId
,
String
storeId
,
String
clerkId
,
int
categoryType
,
BasePageInfo
pageInfo
);
/**
* 更新已读状态
*
* @param id
* @return
*/
public
ServiceResponse
<
Boolean
>
updateReadFlagById
(
Long
id
);
/**
* 更新某人的所有已读状态
*
* @param enterpriseId
* @param clerkId
* @param categoryType
* @return
*/
public
ServiceResponse
<
Boolean
>
updateWriteFlagByClerkId
(
String
enterpriseId
,
String
clerkId
,
int
categoryType
);
}
\ No newline at end of file
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/util/notify/NoticeMessageUtil.java
View file @
8ce9fece
...
...
@@ -3,7 +3,9 @@ package com.gic.haoban.manage.api.util.notify;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.mq.sdk.GicMQClient
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
java.util.Map
;
...
...
@@ -27,18 +29,25 @@ public class NoticeMessageUtil {
* @param enterpriseId 企业id
* @param clerkId 执行人导购
* @param messageType 消息类型 NoticeMessageTypeEnum
* @param
templateCode 模板code
* @param
optTargetId 操作对象
* @param fieldMap 解析模板的字段
* @param extendField 拓展字段给前端使用 没有可以为null
*/
public
static
void
sendNoticeMessage
(
String
enterpriseId
,
String
clerkId
,
int
messageType
,
String
templateCode
,
Map
<
String
,
String
>
fieldMap
,
Map
<
String
,
Object
>
extendField
)
{
public
static
void
sendNoticeMessage
(
String
enterpriseId
,
String
clerkId
,
int
messageType
,
String
optTargetId
,
Map
<
String
,
String
>
fieldMap
,
Map
<
String
,
Object
>
extendField
)
{
if
(
StringUtils
.
isAnyBlank
(
enterpriseId
,
clerkId
))
{
throw
new
RuntimeException
(
"必传参数没传"
);
}
NoticeMessageTypeEnum
messageTypeEnum
=
NoticeMessageTypeEnum
.
getByType
(
messageType
);
if
(
messageTypeEnum
==
null
)
{
throw
new
RuntimeException
(
"消息类型不存在"
);
}
NoticeMessageQDTO
noticeMessageQDTO
=
new
NoticeMessageQDTO
();
noticeMessageQDTO
.
setEnterpriseId
(
enterpriseId
);
noticeMessageQDTO
.
setClerkId
(
clerkId
);
noticeMessageQDTO
.
setMessageType
(
messageType
);
noticeMessageQDTO
.
setTemplateCode
(
templateCode
);
noticeMessageQDTO
.
setContentMap
(
fieldMap
);
noticeMessageQDTO
.
setExtendContent
(
extendField
);
noticeMessageQDTO
.
setOptTargetId
(
optTargetId
);
String
ret
=
JSONObject
.
toJSONString
(
noticeMessageQDTO
);
logger
.
info
(
"发送消息:{}"
,
ret
);
GicMQClient
clientInstance
=
GICMQClientUtil
.
getClientInstance
();
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/NoticeMessageMapper.java
View file @
8ce9fece
...
...
@@ -2,6 +2,9 @@ package com.gic.haoban.manage.service.dao.mapper;
import
com.gic.haoban.manage.service.entity.TabNoticeMessage
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
@Mapper
public
interface
NoticeMessageMapper
{
...
...
@@ -28,4 +31,26 @@ public interface NoticeMessageMapper {
/**
*/
int
updateByPrimaryKey
(
TabNoticeMessage
record
);
/**
* 查询列表 根据导购
*
* @param enterpriseId
* @param storeId
* @param clerkId
* @param categoryType
* @return
*/
List
<
TabNoticeMessage
>
listNoticeMessage
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"storeId"
)
String
storeId
,
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"categoryType"
)
int
categoryType
);
/**
*/
int
updateNoticeMessageReadFlag
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"clerkId"
)
String
clerkId
,
@Param
(
"categoryType"
)
int
categoryType
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/NoticeMessageTemplateMapper.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
dao
.
mapper
;
import
com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
@Mapper
public
interface
NoticeMessageTemplateMapper
{
/**
*/
int
deleteByPrimaryKey
(
Integer
noticeMessageTemplateId
);
/**
*/
int
insert
(
TabNoticeMessageTemplate
record
);
/**
*/
int
insertSelective
(
TabNoticeMessageTemplate
record
);
/**
*/
TabNoticeMessageTemplate
selectByPrimaryKey
(
Integer
noticeMessageTemplateId
);
/**
*/
int
updateByPrimaryKeySelective
(
TabNoticeMessageTemplate
record
);
/**
*/
int
updateByPrimaryKey
(
TabNoticeMessageTemplate
record
);
/**
* 模板
*/
TabNoticeMessageTemplate
getByCode
(
@Param
(
"enterpriseId"
)
String
enterpriseId
,
@Param
(
"templateCode"
)
String
templateCode
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabNoticeMessage.java
View file @
8ce9fece
...
...
@@ -7,7 +7,6 @@ import java.util.Date;
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 好办消息通知
*
* @author fdh
*/
public
class
TabNoticeMessage
implements
Serializable
{
...
...
@@ -17,67 +16,85 @@ public class TabNoticeMessage implements Serializable {
private
Long
noticeMessageId
;
/**
* 企业id
* 企业id
*
*/
private
String
enterpriseId
;
/**
* 门店id
* 门店id
*
*/
private
String
storeId
;
/**
* 导购id
* 导购id
*
*/
private
String
clerkId
;
/**
* 类别 0客户相关、1任务相关、2活动相关、3其他
* 类别 0客户相关、1任务相关、2活动相关、3其他
*
*/
private
Integer
categoryType
;
/**
* 消息类型
* 消息类型
*
*/
private
Integer
messageType
;
/**
* 标题
* 模板编号
*/
private
String
templateCode
;
/**
* 标题
*
*/
private
String
title
;
/**
* 描述
* 描述
*
*/
private
String
description
;
/**
* 关联的具体业务消息id
* 关联的具体业务消息id
*
*/
private
String
relationId
;
/**
* 消息带的参数信息
* 消息带的参数信息
*
*/
private
String
messageContent
;
/**
* 0 未读 1已读
* 0 未读 1已读
*
*/
private
Integer
readFlag
;
/**
* 状态 0删除 1正常
* 状态 0删除 1正常
*
*/
private
Integer
deleteFlag
;
/**
* 创建时间
* 创建时间
*
*/
private
Date
createTime
;
/**
* 更新时间
* 更新时间
*
*/
private
Date
updateTime
;
...
...
@@ -194,6 +211,24 @@ public class TabNoticeMessage implements Serializable {
}
/**
* This method returns the value of the database column tab_haoban_notice_message.template_code
*
* @return the value of tab_haoban_notice_message.template_code
*/
public
String
getTemplateCode
()
{
return
templateCode
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message.template_code
*
* @param templateCode the value for tab_haoban_notice_message.template_code
*/
public
void
setTemplateCode
(
String
templateCode
)
{
this
.
templateCode
=
templateCode
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message.title
*
* @return the value of tab_haoban_notice_message.title
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/entity/TabNoticeMessageTemplate.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
*
* @author fdh
*/
public
class
TabNoticeMessageTemplate
implements
Serializable
{
/**
*
*/
private
Integer
noticeMessageTemplateId
;
/**
* 企业id
*/
private
String
enterpriseId
;
/**
* 模板编号
*/
private
String
templateCode
;
/**
* 模板内容
*/
private
String
content
;
private
String
noticeContent
;
/**
* 是否删除
*/
private
Integer
deleteFlag
;
/**
*
*/
private
Date
createTime
;
/**
*
*/
private
Date
updateTime
;
/**
*/
private
static
final
long
serialVersionUID
=
1L
;
public
String
getNoticeContent
()
{
return
noticeContent
;
}
public
void
setNoticeContent
(
String
noticeContent
)
{
this
.
noticeContent
=
noticeContent
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.notice_message_template_id
*
* @return the value of tab_haoban_notice_message_template.notice_message_template_id
*/
public
Integer
getNoticeMessageTemplateId
()
{
return
noticeMessageTemplateId
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.notice_message_template_id
*
* @param noticeMessageTemplateId the value for tab_haoban_notice_message_template.notice_message_template_id
*/
public
void
setNoticeMessageTemplateId
(
Integer
noticeMessageTemplateId
)
{
this
.
noticeMessageTemplateId
=
noticeMessageTemplateId
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.enterprise_id
*
* @return the value of tab_haoban_notice_message_template.enterprise_id
*/
public
String
getEnterpriseId
()
{
return
enterpriseId
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.enterprise_id
*
* @param enterpriseId the value for tab_haoban_notice_message_template.enterprise_id
*/
public
void
setEnterpriseId
(
String
enterpriseId
)
{
this
.
enterpriseId
=
enterpriseId
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.template_code
*
* @return the value of tab_haoban_notice_message_template.template_code
*/
public
String
getTemplateCode
()
{
return
templateCode
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.template_code
*
* @param templateCode the value for tab_haoban_notice_message_template.template_code
*/
public
void
setTemplateCode
(
String
templateCode
)
{
this
.
templateCode
=
templateCode
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.content
*
* @return the value of tab_haoban_notice_message_template.content
*/
public
String
getContent
()
{
return
content
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.content
*
* @param content the value for tab_haoban_notice_message_template.content
*/
public
void
setContent
(
String
content
)
{
this
.
content
=
content
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.delete_flag
*
* @return the value of tab_haoban_notice_message_template.delete_flag
*/
public
Integer
getDeleteFlag
()
{
return
deleteFlag
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.delete_flag
*
* @param deleteFlag the value for tab_haoban_notice_message_template.delete_flag
*/
public
void
setDeleteFlag
(
Integer
deleteFlag
)
{
this
.
deleteFlag
=
deleteFlag
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.create_time
*
* @return the value of tab_haoban_notice_message_template.create_time
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.create_time
*
* @param createTime the value for tab_haoban_notice_message_template.create_time
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message_template.update_time
*
* @return the value of tab_haoban_notice_message_template.update_time
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
/**
* This method sets the value of the database column tab_haoban_notice_message_template.update_time
*
* @param updateTime the value for tab_haoban_notice_message_template.update_time
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/errorcode/HaoBanErrCode.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
errorcode
;
/**
* Created by fudh on 2018/3/4.
*/
public
enum
HaoBanErrCode
{
ERR_0001
(
"10100001"
,
"参数没有传"
),;
private
String
code
;
private
String
msg
;
HaoBanErrCode
(
String
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
static
HaoBanErrCode
getValue
(
String
code
)
{
for
(
HaoBanErrCode
sec
:
HaoBanErrCode
.
values
())
{
if
(
code
==
sec
.
getCode
())
{
return
sec
;
}
}
return
null
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMsg
()
{
return
msg
;
}
public
void
setMsg
(
String
msg
)
{
this
.
msg
=
msg
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/bo/NoticeMessageBO.java
View file @
8ce9fece
...
...
@@ -41,6 +41,8 @@ public class NoticeMessageBO implements Serializable {
*/
private
Integer
messageType
;
private
String
templateCode
;
/**
* 标题
*/
...
...
@@ -85,6 +87,14 @@ public class NoticeMessageBO implements Serializable {
*/
private
static
final
long
serialVersionUID
=
1L
;
public
String
getTemplateCode
()
{
return
templateCode
;
}
public
void
setTemplateCode
(
String
templateCode
)
{
this
.
templateCode
=
templateCode
;
}
/**
* This method returns the value of the database column tab_haoban_notice_message.notice_message_id
*
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/pojo/bo/TemplateContentBO.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
pojo
.
bo
;
import
java.io.Serializable
;
/**
* Created 2021/12/17.
*
* @author hua
*/
public
class
TemplateContentBO
implements
Serializable
{
private
String
key
;
private
String
val
;
public
String
getKey
()
{
return
key
;
}
public
void
setKey
(
String
key
)
{
this
.
key
=
key
;
}
public
String
getVal
()
{
return
val
;
}
public
void
setVal
(
String
val
)
{
this
.
val
=
val
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/NoticeMessageService.java
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO
;
import
com.gic.haoban.manage.service.pojo.bo.PendingTaskBO
;
...
...
@@ -18,5 +20,27 @@ public interface NoticeMessageService {
*/
public
boolean
addOrCreateNoticeMessage
(
NoticeMessageBO
messageBO
);
/**
* 分页查询消息
*
* @param enterpriseId
* @param storeId 门店id
* @param clerkId
* @param categoryType
* @param pageInfo
* @return
*/
public
Page
<
NoticeMessageBO
>
pageNoticeMessage
(
String
enterpriseId
,
String
storeId
,
String
clerkId
,
int
categoryType
,
BasePageInfo
pageInfo
);
/**
* 更新导购的已读转态
*
* @param enterpriseId
* @param clerkId
* @param categoryType
* @return
*/
public
boolean
updateNoticeMessageReadFlag
(
String
enterpriseId
,
String
clerkId
,
int
categoryType
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/NoticeMessageTemplateService.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
;
import
com.gic.haoban.manage.service.pojo.bo.TemplateContentBO
;
import
java.util.List
;
/**
* Created 2021/12/17.
*
* @author hua
*/
public
interface
NoticeMessageTemplateService
{
/**
* 获取模板消息 企业微信
*
* @param enterpriseId
* @param templateCode
* @return
*/
public
List
<
TemplateContentBO
>
getQywxTemplateMessage
(
String
enterpriseId
,
String
templateCode
);
/**
* 获取模板消息 好办内部
*
* @param enterpriseId
* @param templateCode
* @return
*/
public
String
getHaobanTemplateMessage
(
String
enterpriseId
,
String
templateCode
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/impl/NoticeMessageServiceImpl.java
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
.
impl
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.commons.util.UniqueIdUtils
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.manage.service.dao.mapper.NoticeMessageMapper
;
...
...
@@ -7,10 +10,12 @@ import com.gic.haoban.manage.service.entity.TabNoticeMessage;
import
com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO
;
import
com.gic.haoban.manage.service.pojo.bo.PendingTaskBO
;
import
com.gic.haoban.manage.service.service.notify.NoticeMessageService
;
import
com.github.pagehelper.PageHelper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created 2021/12/17.
...
...
@@ -36,4 +41,18 @@ public class NoticeMessageServiceImpl implements NoticeMessageService {
noticeMessageMapper
.
updateByPrimaryKeySelective
(
tabNoticeMessage
);
return
true
;
}
@Override
public
Page
<
NoticeMessageBO
>
pageNoticeMessage
(
String
enterpriseId
,
String
storeId
,
String
clerkId
,
int
categoryType
,
BasePageInfo
pageInfo
)
{
PageHelper
.
startPage
(
pageInfo
);
List
<
TabNoticeMessage
>
list
=
noticeMessageMapper
.
listNoticeMessage
(
enterpriseId
,
storeId
,
clerkId
,
categoryType
);
Page
<
NoticeMessageBO
>
retPage
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
list
,
NoticeMessageBO
.
class
);
return
retPage
;
}
@Override
public
boolean
updateNoticeMessageReadFlag
(
String
enterpriseId
,
String
clerkId
,
int
categoryType
)
{
noticeMessageMapper
.
updateNoticeMessageReadFlag
(
enterpriseId
,
clerkId
,
categoryType
);
return
true
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/impl/NoticeMessageTemplateServiceImpl.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.service.dao.mapper.NoticeMessageTemplateMapper
;
import
com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate
;
import
com.gic.haoban.manage.service.pojo.bo.TemplateContentBO
;
import
com.gic.haoban.manage.service.service.notify.NoticeMessageTemplateService
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* Created 2021/12/17.
*
* @author hua
*/
@Service
public
class
NoticeMessageTemplateServiceImpl
implements
NoticeMessageTemplateService
{
private
static
final
String
QYWX_TEMPLATE_KEY
=
"qywx-notice-message-template:"
;
private
static
final
String
HAOBAN_TEMPLATE_KEY
=
"haoban-notice-message-template:"
;
private
static
final
Long
TIME_OUT
=
24
*
60
*
60L
;
@Autowired
private
NoticeMessageTemplateMapper
noticeMessageTemplateMapper
;
@Override
public
List
<
TemplateContentBO
>
getQywxTemplateMessage
(
String
enterpriseId
,
String
templateCode
)
{
String
key
=
QYWX_TEMPLATE_KEY
+
templateCode
+
":"
+
enterpriseId
;
String
content
=
(
String
)
RedisUtil
.
getCache
(
key
);
if
(
StringUtils
.
isNotBlank
(
content
))
{
return
JSONArray
.
parseArray
(
content
,
TemplateContentBO
.
class
);
}
String
lockKey
=
QYWX_TEMPLATE_KEY
+
templateCode
+
":"
+
enterpriseId
+
";lock"
;
RedisUtil
.
lock
(
lockKey
,
2L
);
TabNoticeMessageTemplate
messageTemplate
=
noticeMessageTemplateMapper
.
getByCode
(
enterpriseId
,
templateCode
);
if
(
messageTemplate
==
null
)
{
messageTemplate
=
noticeMessageTemplateMapper
.
getByCode
(
"-1"
,
templateCode
);
}
if
(
messageTemplate
==
null
)
{
RedisUtil
.
unlock
(
lockKey
);
return
null
;
}
content
=
messageTemplate
.
getContent
();
RedisUtil
.
setCache
(
key
,
content
,
TIME_OUT
);
RedisUtil
.
unlock
(
lockKey
);
return
JSONArray
.
parseArray
(
content
,
TemplateContentBO
.
class
);
}
@Override
public
String
getHaobanTemplateMessage
(
String
enterpriseId
,
String
templateCode
)
{
String
key
=
HAOBAN_TEMPLATE_KEY
+
templateCode
+
":"
+
enterpriseId
;
String
content
=
(
String
)
RedisUtil
.
getCache
(
key
);
if
(
StringUtils
.
isNotBlank
(
content
))
{
return
content
;
}
String
lockKey
=
HAOBAN_TEMPLATE_KEY
+
templateCode
+
":"
+
enterpriseId
+
";lock"
;
RedisUtil
.
lock
(
lockKey
,
2L
);
TabNoticeMessageTemplate
messageTemplate
=
noticeMessageTemplateMapper
.
getByCode
(
enterpriseId
,
templateCode
);
if
(
messageTemplate
==
null
)
{
messageTemplate
=
noticeMessageTemplateMapper
.
getByCode
(
"-1"
,
templateCode
);
}
if
(
messageTemplate
==
null
)
{
RedisUtil
.
unlock
(
lockKey
);
return
null
;
}
content
=
messageTemplate
.
getNoticeContent
();
RedisUtil
.
setCache
(
key
,
content
,
TIME_OUT
);
RedisUtil
.
unlock
(
lockKey
);
return
content
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/notify/out/NoticeMessageApiServiceImpl.java
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
notify
.
out
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.api.base.commons.BasePageInfo
;
import
com.gic.api.base.commons.Constant
;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.api.dto.WxEnterpriseDTO
;
import
com.gic.haoban.manage.api.dto.notify.dto.NoticeMessageInfoDTO
;
import
com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.errorcode.HaoBanErrCode
;
import
com.gic.haoban.manage.service.pojo.bo.NoticeMessageBO
;
import
com.gic.haoban.manage.service.pojo.bo.TemplateContentBO
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.manage.service.service.WxEnterpriseService
;
import
com.gic.haoban.manage.service.service.notify.NoticeMessageService
;
import
com.gic.haoban.manage.service.service.notify.NoticeMessageTemplateService
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
/**
...
...
@@ -26,15 +51,161 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
NoticeMessageTemplateService
noticeMessageTemplateService
;
@Autowired
private
Config
config
;
@Autowired
private
StaffClerkRelationService
staffClerkRelationService
;
@Autowired
private
NoticeMessageService
noticeMessageService
;
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
WxEnterpriseService
wxEnterpriseService
;
@Override
public
void
noticeMessageMq
(
String
json
)
{
logger
.
info
(
"通知消息:{}"
,
json
);
NoticeMessageQDTO
messageQDTO
=
JSONObject
.
parseObject
(
json
,
NoticeMessageQDTO
.
class
);
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
messageQDTO
.
getClerkId
());
NoticeMessageTypeEnum
messageTypeEnum
=
NoticeMessageTypeEnum
.
getByType
(
messageQDTO
.
getMessageType
());
messageQDTO
.
setTemplateCode
(
messageTypeEnum
.
getTemplateCode
());
//企业微信模板
List
<
TemplateContentBO
>
contentList
=
getDescriotion
(
messageQDTO
);
//好办模板
String
haobanNotice
=
getHaobanNotice
(
messageQDTO
);
//模板不存在
if
(
CollectionUtils
.
isEmpty
(
contentList
)
||
StringUtils
.
isBlank
(
haobanNotice
))
{
logger
.
info
(
"没有模板,无法发送消息:{}"
,
messageQDTO
.
getTemplateCode
());
return
;
}
StaffClerkRelationDTO
clerkRelationDTO
=
staffClerkRelationService
.
getByClerkId
(
messageQDTO
.
getClerkId
());
if
(
clerkRelationDTO
==
null
)
{
logger
.
info
(
"没有导购:{}"
,
messageQDTO
.
getClerkId
());
return
;
}
//消息组装 新增消息
NoticeMessageBO
noticeMessageBO
=
new
NoticeMessageBO
();
noticeMessageBO
.
setCategoryType
(
NoticeMessageTypeEnum
.
getByType
(
messageQDTO
.
getMessageType
())
.
getType
());
noticeMessageBO
.
setCategoryType
(
messageTypeEnum
.
getType
());
noticeMessageBO
.
setMessageType
(
messageQDTO
.
getMessageType
());
noticeMessageBO
.
setClerkId
(
messageQDTO
.
getClerkId
());
noticeMessageBO
.
setStoreId
(
clerkRelationDTO
.
getStoreId
());
noticeMessageBO
.
setTitle
(
messageTypeEnum
.
getName
());
noticeMessageBO
.
setTemplateCode
(
messageTypeEnum
.
getTemplateCode
());
noticeMessageBO
.
setDescription
(
haobanNotice
);
noticeMessageBO
.
setEnterpriseId
(
messageQDTO
.
getEnterpriseId
());
noticeMessageBO
.
setRelationId
(
messageQDTO
.
getOptTargetId
());
noticeMessageBO
.
setMessageContent
(
messageQDTO
.
getExtendContent
()
!=
null
?
JSONObject
.
toJSONString
(
messageQDTO
.
getExtendContent
())
:
null
);
noticeMessageService
.
addOrCreateNoticeMessage
(
noticeMessageBO
);
//发送企业微信
sendMessage
(
contentList
,
clerkRelationDTO
.
getWxEnterpriseId
(),
clerkRelationDTO
.
getWxUserId
(),
messageTypeEnum
);
}
@Override
public
ServiceResponse
<
Page
<
NoticeMessageInfoDTO
>>
pageNoticeMessage
(
String
enterpriseId
,
String
storeId
,
String
clerkId
,
int
categoryType
,
BasePageInfo
pageInfo
)
{
if
(
StringUtils
.
isAnyBlank
(
enterpriseId
,
storeId
))
{
ServiceResponse
.
failure
(
HaoBanErrCode
.
ERR_0001
.
getCode
(),
HaoBanErrCode
.
ERR_0001
.
getMsg
());
}
Page
<
NoticeMessageBO
>
retPage
=
noticeMessageService
.
pageNoticeMessage
(
enterpriseId
,
storeId
,
clerkId
,
categoryType
,
pageInfo
);
Page
<
NoticeMessageInfoDTO
>
tPage
=
PageHelperUtils
.
changePageToCurrentPage
(
retPage
,
NoticeMessageInfoDTO
.
class
);
return
ServiceResponse
.
success
(
tPage
);
}
@Override
public
ServiceResponse
<
Boolean
>
updateReadFlagById
(
Long
id
)
{
NoticeMessageBO
noticeMessageBO
=
new
NoticeMessageBO
();
noticeMessageBO
.
setNoticeMessageId
(
id
);
noticeMessageBO
.
setReadFlag
(
Constant
.
NUMBER_1
);
noticeMessageService
.
addOrCreateNoticeMessage
(
noticeMessageBO
);
return
ServiceResponse
.
success
(
true
);
}
@Override
public
ServiceResponse
<
Boolean
>
updateWriteFlagByClerkId
(
String
enterpriseId
,
String
clerkId
,
int
categoryType
)
{
noticeMessageService
.
updateNoticeMessageReadFlag
(
enterpriseId
,
clerkId
,
categoryType
);
return
ServiceResponse
.
success
(
true
);
}
/**
* 获取详情
*
* @param messageQDTO
* @return
*/
private
List
<
TemplateContentBO
>
getDescriotion
(
NoticeMessageQDTO
messageQDTO
)
{
List
<
TemplateContentBO
>
templateMessage
=
noticeMessageTemplateService
.
getQywxTemplateMessage
(
messageQDTO
.
getEnterpriseId
(),
messageQDTO
.
getTemplateCode
());
if
(
CollectionUtils
.
isEmpty
(
templateMessage
))
{
//todo 需要告警
logger
.
info
(
"不存在模板"
);
return
null
;
}
//需要替换的数据
Map
<
String
,
String
>
contentMap
=
messageQDTO
.
getContentMap
();
//替换的内容
for
(
TemplateContentBO
templateContentBO
:
templateMessage
)
{
contentMap
.
forEach
((
k
,
v
)
->
{
templateContentBO
.
setVal
(
templateContentBO
.
getVal
().
replaceAll
(
"\\#\\{"
+
k
+
"\\}"
,
v
));
});
}
return
templateMessage
;
}
/**
* 获取详情好办的通知
*
* @param messageQDTO
* @return
*/
private
String
getHaobanNotice
(
NoticeMessageQDTO
messageQDTO
)
{
final
String
[]
haobanTemplateMessage
=
{
noticeMessageTemplateService
.
getHaobanTemplateMessage
(
messageQDTO
.
getEnterpriseId
(),
messageQDTO
.
getTemplateCode
())};
if
(
StringUtils
.
isBlank
(
haobanTemplateMessage
[
0
]))
{
//todo 需要告警
logger
.
info
(
"不存在好办的通知模板模板"
);
return
null
;
}
//需要替换的数据
Map
<
String
,
String
>
contentMap
=
messageQDTO
.
getContentMap
();
//替换的内容
contentMap
.
forEach
((
k
,
v
)
->
{
haobanTemplateMessage
[
0
]
=
haobanTemplateMessage
[
0
].
replaceAll
(
"\\#\\{"
+
k
+
"\\}"
,
v
);
});
return
haobanTemplateMessage
[
0
];
}
/**
* 发送消息
*
* @param contentList
* @param wxUserId
* @param messageTypeEnum
*/
private
void
sendMessage
(
List
<
TemplateContentBO
>
contentList
,
String
wxEnterpriseId
,
String
wxUserId
,
NoticeMessageTypeEnum
messageTypeEnum
)
{
WxEnterpriseDTO
wxEnterpriseDTO
=
wxEnterpriseService
.
selectById
(
wxEnterpriseId
);
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
//后续map加判断可加参数
Map
<
String
,
String
>
map
=
new
HashMap
<>();
List
<
ItemDTO
>
items
=
contentList
.
stream
().
map
(
bo
->
{
ItemDTO
item
=
new
ItemDTO
();
item
.
setKey
(
bo
.
getKey
());
item
.
setValue
(
bo
.
getVal
());
return
item
;
}).
collect
(
Collectors
.
toList
());
List
<
String
>
userList
=
new
ArrayList
<>();
userList
.
add
(
wxUserId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
userList
);
messageDTO
.
setPage
(
messageTypeEnum
.
getPageUrl
());
messageDTO
.
setTitle
(
messageTypeEnum
.
getName
());
messageDTO
.
setItems
(
items
);
qywxSuiteApiService
.
sendMessage
(
wxEnterpriseDTO
.
getCorpid
(),
config
.
getWxSuiteid
(),
messageDTO
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/util/CommonUtil.java
View file @
8ce9fece
...
...
@@ -33,4 +33,5 @@ public class CommonUtil {
}
return
null
;
}
}
haoban-manage3-service/src/main/resources/dubbo-haoban-manage-service.xml
View file @
8ce9fece
...
...
@@ -63,6 +63,10 @@
ref=
"pendingTaskApiServiceImpl"
timeout=
"10000"
/>
<dubbo:service
interface=
"com.gic.haoban.manage.api.service.notify.NoticeMessageApiService"
ref=
"noticeMessageApiServiceImpl"
timeout=
"10000"
/>
<dubbo:reference
interface=
"com.gic.enterprise.api.service.DepartmentService"
id=
"gicDepartmentService"
/>
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxDepartmentApiService"
id=
"qywxDepartmentApiService"
/>
<dubbo:reference
interface=
"com.gic.wechat.api.service.qywx.QywxSuiteApiService"
id=
"qywxSuiteApiService"
/>
...
...
haoban-manage3-service/src/main/resources/mapper/NoticeMessageMapper.xml
View file @
8ce9fece
This diff is collapsed.
Click to expand it.
haoban-manage3-service/src/main/resources/mapper/NoticeMessageTemplateMapper.xml
0 → 100644
View file @
8ce9fece
<?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">
<mapper
namespace=
"com.gic.haoban.manage.service.dao.mapper.NoticeMessageTemplateMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate"
>
<id
column=
"notice_message_template_id"
jdbcType=
"INTEGER"
property=
"noticeMessageTemplateId"
/>
<result
column=
"enterprise_id"
jdbcType=
"VARCHAR"
property=
"enterpriseId"
/>
<result
column=
"template_code"
jdbcType=
"VARCHAR"
property=
"templateCode"
/>
<result
column=
"content"
jdbcType=
"VARCHAR"
property=
"content"
/>
<result
column=
"notice_content"
jdbcType=
"VARCHAR"
property=
"noticeContent"
/>
<result
column=
"delete_flag"
jdbcType=
"INTEGER"
property=
"deleteFlag"
/>
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
notice_message_template_id, enterprise_id, template_code, content,notice_content, delete_flag, create_time,
update_time
</sql>
<select
id=
"selectByPrimaryKey"
parameterType=
"java.lang.Integer"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_notice_message_template
where notice_message_template_id = #{noticeMessageTemplateId,jdbcType=INTEGER}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.Integer"
>
delete from tab_haoban_notice_message_template
where notice_message_template_id = #{noticeMessageTemplateId,jdbcType=INTEGER}
</delete>
<insert
id=
"insert"
parameterType=
"com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate"
>
insert into tab_haoban_notice_message_template (notice_message_template_id, enterprise_id,
template_code, content, delete_flag,
create_time, update_time)
values (#{noticeMessageTemplateId,jdbcType=INTEGER}, #{enterpriseId,jdbcType=VARCHAR},
#{templateCode,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{deleteFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate"
>
insert into tab_haoban_notice_message_template
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"noticeMessageTemplateId != null"
>
notice_message_template_id,
</if>
<if
test=
"enterpriseId != null"
>
enterprise_id,
</if>
<if
test=
"templateCode != null"
>
template_code,
</if>
<if
test=
"content != null"
>
content,
</if>
<if
test=
"deleteFlag != null"
>
delete_flag,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"noticeMessageTemplateId != null"
>
#{noticeMessageTemplateId,jdbcType=INTEGER},
</if>
<if
test=
"enterpriseId != null"
>
#{enterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"templateCode != null"
>
#{templateCode,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
#{content,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
#{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate"
>
update tab_haoban_notice_message_template
<set>
<if
test=
"enterpriseId != null"
>
enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
</if>
<if
test=
"templateCode != null"
>
template_code = #{templateCode,jdbcType=VARCHAR},
</if>
<if
test=
"content != null"
>
content = #{content,jdbcType=VARCHAR},
</if>
<if
test=
"deleteFlag != null"
>
delete_flag = #{deleteFlag,jdbcType=INTEGER},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
</set>
where notice_message_template_id = #{noticeMessageTemplateId,jdbcType=INTEGER}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.gic.haoban.manage.service.entity.TabNoticeMessageTemplate"
>
update tab_haoban_notice_message_template
set enterprise_id = #{enterpriseId,jdbcType=VARCHAR},
template_code = #{templateCode,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
delete_flag = #{deleteFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where notice_message_template_id = #{noticeMessageTemplateId,jdbcType=INTEGER}
</update>
<select
id=
"getByCode"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_notice_message_template
where template_code = #{templateCode,jdbcType=VARCHAR} and enterprise_id=#{enterpriseId} and delete_flag=0
</select>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/test/java/NotityTest.java
0 → 100644
View file @
8ce9fece
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.haoban.manage.api.dto.AlertMessageDTO
;
import
com.gic.haoban.manage.api.dto.notify.qdto.NoticeMessageQDTO
;
import
com.gic.haoban.manage.api.enums.AlertTypeEnum
;
import
com.gic.haoban.manage.api.enums.NoticeMessageTypeEnum
;
import
com.gic.haoban.manage.api.service.CheckQywxSettingApiService
;
import
com.gic.haoban.manage.api.service.QywxTagApiService
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.test.context.ContextConfiguration
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
java.util.HashMap
;
import
java.util.Map
;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@ContextConfiguration
(
locations
=
{
"classpath:applicationContext-conf.xml"
})
public
class
NotityTest
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
NotityTest
.
class
);
@Autowired
private
QywxTagApiService
qywxTagApiService
;
@Autowired
private
NoticeMessageApiService
noticeMessageApiService
;
@Test
public
void
test
()
{
Map
<
String
,
String
>
contentMap
=
new
HashMap
<
String
,
String
>();
contentMap
.
put
(
"test"
,
"test"
);
Map
<
String
,
Object
>
extMap
=
new
HashMap
<
String
,
Object
>();
extMap
.
put
(
"test111"
,
"tes111t"
);
NoticeMessageQDTO
noticeMessageQDTO
=
new
NoticeMessageQDTO
();
noticeMessageQDTO
.
setEnterpriseId
(
"ff8080815dacd3a2015dacd3ef5c0000"
);
noticeMessageQDTO
.
setMessageType
(
NoticeMessageTypeEnum
.
ACTIVITY_AWARD
.
getType
());
noticeMessageQDTO
.
setContentMap
(
contentMap
);
noticeMessageQDTO
.
setClerkId
(
"70eb25bfb94b4ffb998d4bd817fbd7e2"
);
noticeMessageQDTO
.
setOptTargetId
(
"testtatget"
);
noticeMessageQDTO
.
setExtendContent
(
extMap
);
noticeMessageApiService
.
noticeMessageMq
(
JSONObject
.
toJSONString
(
noticeMessageQDTO
));
}
@Test
public
void
test2
()
{
}
@Test
public
void
test3
()
{
qywxTagApiService
.
checkQywxSync
(
"-1"
);
}
}
haoban-manage3-service/src/test/java/test.java
View file @
8ce9fece
...
...
@@ -3,6 +3,8 @@ import java.time.LocalDateTime;
import
java.time.ZoneOffset
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateUtil
;
...
...
@@ -15,10 +17,12 @@ import org.apache.commons.lang3.time.DateUtils;
public
class
test
{
public
static
void
main
(
String
[]
args
)
{
String
content
=
"测试模板#{test}"
;
String
test
=
"1test"
;
String
replace
=
content
.
replaceAll
(
"\\#\\{"
+
test
+
"\\}"
,
"1111"
);
System
.
out
.
println
(
replace
);
DateTime
parse
=
DateUtil
.
parse
(
"2021-10-11"
);
int
i
=
DateUtil
.
weekOfYear
(
parse
);
System
.
out
.
println
(
i
);
// String key = "3.2.1";
// String[] split = key.split(".");
//
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
8ce9fece
...
...
@@ -27,6 +27,7 @@ import com.gic.haoban.manage.api.dto.*;
import
com.gic.haoban.manage.api.enums.*
;
import
com.gic.haoban.manage.api.service.*
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.CommonQO
;
import
com.gic.haoban.manage.web.vo.*
;
import
com.gic.redis.data.util.RedisUtil
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -34,10 +35,12 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -1129,4 +1132,16 @@ public class ClerkController extends WebBaseController {
externalClerkRelatedApiService
.
pushExternalByRelationKey
(
relationKey
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 我的-好友会员数
*
* @return
*/
@RequestMapping
(
"customer-info"
)
@IgnoreLogin
public
HaobanResponse
customerInfo
(
@RequestBody
@Valid
CommonQO
qo
)
{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/NotifyController.java
View file @
8ce9fece
...
...
@@ -2,17 +2,22 @@ package com.gic.haoban.manage.web.controller;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.web.qo.PageQo
;
import
com.gic.haoban.base.api.common.PageResult2
;
import
com.gic.haoban.common.utils.EntityUtil
;
import
com.gic.haoban.common.utils.HaobanResponse
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.manage.api.dto.notify.dto.NoticeMessageInfoDTO
;
import
com.gic.haoban.manage.api.dto.notify.dto.PendingTaskDetailDTO
;
import
com.gic.haoban.manage.api.dto.notify.qdto.PendingListQDTO
;
import
com.gic.haoban.manage.api.enums.NoticeMessageCategoryTypeEnum
;
import
com.gic.haoban.manage.api.enums.PendingTaskTypeEnum
;
import
com.gic.haoban.manage.api.service.notify.NoticeMessageApiService
;
import
com.gic.haoban.manage.api.service.notify.PendingTaskApiService
;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.CommonQO
;
import
com.gic.haoban.manage.web.qo.PendingListQO
;
import
com.gic.haoban.manage.web.qo.notify.MessageListQO
;
import
com.gic.haoban.manage.web.vo.notify.PairValVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -36,6 +41,9 @@ public class NotifyController extends WebBaseController {
@Autowired
private
PendingTaskApiService
pendingTaskApiService
;
@Autowired
private
NoticeMessageApiService
noticeMessageService
;
/**
* 待办列表
*
...
...
@@ -105,4 +113,56 @@ public class NotifyController extends WebBaseController {
}
/**
* 今日待办列表 最多20条
*
* @return
*/
@RequestMapping
(
"/message/list"
)
public
HaobanResponse
list
(
@RequestBody
@Valid
MessageListQO
qo
,
PageQo
pageQo
)
{
ServiceResponse
<
Page
<
NoticeMessageInfoDTO
>>
retPage
=
noticeMessageService
.
pageNoticeMessage
(
qo
.
getEnterpriseId
(),
qo
.
getStoreId
(),
qo
.
getClerkId
(),
qo
.
getCategoryType
(),
pageQo
.
getBasePageInfo
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
PageUtil
.
getPageInfo
(
retPage
.
getResult
()));
}
/**
* 设置单条已读
*
* @return
*/
@RequestMapping
(
"/message/read"
)
public
HaobanResponse
readSingle
(
Long
noticeMessageId
)
{
noticeMessageService
.
updateReadFlagById
(
noticeMessageId
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 批量设置已读
*
* @return
*/
@RequestMapping
(
"/message/all-read"
)
public
HaobanResponse
readAll
(
@RequestBody
@Valid
MessageListQO
qo
)
{
noticeMessageService
.
updateWriteFlagByClerkId
(
qo
.
getEnterpriseId
(),
qo
.
getClerkId
(),
qo
.
getCategoryType
());
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
/**
* 消息类别
*
* @return
*/
@RequestMapping
(
"/message/category"
)
public
HaobanResponse
category
(
@RequestBody
@Valid
MessageListQO
qo
)
{
List
<
PairValVO
>
ret
=
new
ArrayList
<
PairValVO
>();
NoticeMessageCategoryTypeEnum
[]
values
=
NoticeMessageCategoryTypeEnum
.
values
();
for
(
NoticeMessageCategoryTypeEnum
val
:
values
)
{
PairValVO
vo
=
new
PairValVO
();
vo
.
setKey
(
String
.
valueOf
(
val
.
getType
()));
vo
.
setName
(
val
.
getName
());
ret
.
add
(
vo
);
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
ret
);
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/qo/notify/MessageListQO.java
0 → 100644
View file @
8ce9fece
package
com
.
gic
.
haoban
.
manage
.
web
.
qo
.
notify
;
import
com.gic.haoban.manage.web.qo.CommonQO
;
/**
* Created 2021/12/20.
*
* @author hua
*/
public
class
MessageListQO
extends
CommonQO
{
private
Integer
categoryType
=
-
1
;
public
Integer
getCategoryType
()
{
return
categoryType
;
}
public
void
setCategoryType
(
Integer
categoryType
)
{
this
.
categoryType
=
categoryType
;
}
}
haoban-manage3-wx/src/main/webapp/WEB-INF/dubbo-haoban-manage-wx.xml
View file @
8ce9fece
...
...
@@ -78,4 +78,8 @@
interface=
"com.gic.haoban.manage.api.service.notify.PendingTaskApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
<dubbo:reference
id=
"noticeMessageApiService"
interface=
"com.gic.haoban.manage.api.service.notify.NoticeMessageApiService"
timeout=
"10000"
retries=
"0"
check=
"false"
/>
</beans>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment