Commit 816f6f0f by fudahua

消息通知接口以及发送通知接口

parent a5b1f236
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
......@@ -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_message", ""),
ACTIVITY_NEW(1002, "活动上新通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType(), "activity_message", ""),
ACTIVITY_DEL(1003, "活动删除通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType(), "activity_message", ""),
ACTIVITY_OFFLINE(1004, "活动下线通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType(), "activity_message", ""),
ACTIVITY_END(1005, "活动结束通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType(), "activity_message", ""),
ACTIVITY_RANK(1006, "活动排名通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType(), "activity_message", ""),
ACTIVITY_AWARD(1007, "活动奖励通知", NoticeMessageCategoryTypeEnum.ACTIVITY.getType(), "activity_message", "");
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");
/**
* 消息类型
*/
......
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
......@@ -29,10 +29,11 @@ public class NoticeMessageUtil {
* @param enterpriseId 企业id
* @param clerkId 执行人导购
* @param messageType 消息类型 NoticeMessageTypeEnum
* @param optTargetId 操作对象
* @param fieldMap 解析模板的字段
* @param extendField 拓展字段给前端使用 没有可以为null
*/
public static void sendNoticeMessage(String enterpriseId, String clerkId, int messageType, 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("必传参数没传");
}
......@@ -46,6 +47,7 @@ public class NoticeMessageUtil {
noticeMessageQDTO.setMessageType(messageType);
noticeMessageQDTO.setContentMap(fieldMap);
noticeMessageQDTO.setExtendContent(extendField);
noticeMessageQDTO.setOptTargetId(optTargetId);
String ret = JSONObject.toJSONString(noticeMessageQDTO);
logger.info("发送消息:{}", ret);
GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
......
......@@ -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
......@@ -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 {
......@@ -18,66 +17,84 @@ public class TabNoticeMessage implements Serializable {
/**
* 企业id
*
*/
private String enterpriseId;
/**
* 门店id
*
*/
private String storeId;
/**
* 导购id
*
*/
private String clerkId;
/**
* 类别 0客户相关、1任务相关、2活动相关、3其他
*
*/
private Integer categoryType;
/**
* 消息类型
*
*/
private Integer messageType;
/**
* 模板编号
*/
private String templateCode;
/**
* 标题
*
*/
private String title;
/**
* 描述
*
*/
private String description;
/**
* 关联的具体业务消息id
*
*/
private String relationId;
/**
* 消息带的参数信息
*
*/
private String messageContent;
/**
* 0 未读 1已读
*
*/
private Integer readFlag;
/**
* 状态 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
......
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;
}
}
......@@ -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
*
......
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);
}
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;
}
}
package com.gic.haoban.manage.service.service.notify.out;
import com.alibaba.fastjson.JSONObject;
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;
......@@ -77,7 +84,7 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
logger.info("没有模板,无法发送消息:{}", messageQDTO.getTemplateCode());
return;
}
StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getBindByClerkId(messageQDTO.getClerkId(), messageQDTO.getEnterpriseId());
StaffClerkRelationDTO clerkRelationDTO = staffClerkRelationService.getByClerkId(messageQDTO.getClerkId());
if (clerkRelationDTO == null) {
logger.info("没有导购:{}", messageQDTO.getClerkId());
return;
......@@ -89,15 +96,43 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
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);
}
/**
* 获取详情
*
......@@ -116,12 +151,13 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
//替换的内容
for (TemplateContentBO templateContentBO : templateMessage) {
contentMap.forEach((k, v) -> {
templateContentBO.getVal().replaceAll("#{" + k + "}", v);
templateContentBO.setVal(templateContentBO.getVal().replaceAll("\\#\\{" + k + "\\}", v));
});
}
return templateMessage;
}
/**
* 获取详情好办的通知
*
......@@ -129,8 +165,8 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
* @return
*/
private String getHaobanNotice(NoticeMessageQDTO messageQDTO) {
String haobanTemplateMessage = noticeMessageTemplateService.getHaobanTemplateMessage(messageQDTO.getEnterpriseId(), messageQDTO.getTemplateCode());
if (StringUtils.isBlank(haobanTemplateMessage)) {
final String[] haobanTemplateMessage = {noticeMessageTemplateService.getHaobanTemplateMessage(messageQDTO.getEnterpriseId(), messageQDTO.getTemplateCode())};
if (StringUtils.isBlank(haobanTemplateMessage[0])) {
//todo 需要告警
logger.info("不存在好办的通知模板模板");
return null;
......@@ -139,9 +175,9 @@ public class NoticeMessageApiServiceImpl implements NoticeMessageApiService {
Map<String, String> contentMap = messageQDTO.getContentMap();
//替换的内容
contentMap.forEach((k, v) -> {
haobanTemplateMessage.replaceAll("#{" + k + "}", v);
haobanTemplateMessage[0] = haobanTemplateMessage[0].replaceAll("\\#\\{" + k + "\\}", v);
});
return haobanTemplateMessage;
return haobanTemplateMessage[0];
}
/**
......
......@@ -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"/>
......
......@@ -8,6 +8,7 @@
<result column="clerk_id" jdbcType="VARCHAR" property="clerkId"/>
<result column="category_type" jdbcType="INTEGER" property="categoryType"/>
<result column="message_type" jdbcType="INTEGER" property="messageType"/>
<result column="template_code" jdbcType="VARCHAR" property="templateCode"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="description" jdbcType="VARCHAR" property="description"/>
<result column="relation_id" jdbcType="VARCHAR" property="relationId"/>
......@@ -19,8 +20,8 @@
</resultMap>
<sql id="Base_Column_List">
notice_message_id, enterprise_id, store_id, clerk_id, category_type, message_type,
title, description, relation_id, message_content, read_flag, delete_flag, create_time,
update_time
template_code, title, description, relation_id, message_content, read_flag, delete_flag,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
......@@ -35,14 +36,16 @@
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabNoticeMessage">
insert into tab_haoban_notice_message (notice_message_id, enterprise_id, store_id,
clerk_id, category_type, message_type,
title, description, relation_id,
message_content, read_flag, delete_flag,
create_time, update_time)
template_code, title, description,
relation_id, message_content, read_flag,
delete_flag, create_time, update_time
)
values (#{noticeMessageId,jdbcType=BIGINT}, #{enterpriseId,jdbcType=VARCHAR}, #{storeId,jdbcType=VARCHAR},
#{clerkId,jdbcType=VARCHAR}, #{categoryType,jdbcType=INTEGER}, #{messageType,jdbcType=INTEGER},
#{title,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{relationId,jdbcType=VARCHAR},
#{messageContent,jdbcType=VARCHAR}, #{readFlag,jdbcType=INTEGER}, #{deleteFlag,jdbcType=INTEGER},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
#{templateCode,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{relationId,jdbcType=VARCHAR}, #{messageContent,jdbcType=VARCHAR}, #{readFlag,jdbcType=INTEGER},
#{deleteFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabNoticeMessage">
insert into tab_haoban_notice_message
......@@ -65,6 +68,9 @@
<if test="messageType != null">
message_type,
</if>
<if test="templateCode != null">
template_code,
</if>
<if test="title != null">
title,
</if>
......@@ -109,6 +115,9 @@
<if test="messageType != null">
#{messageType,jdbcType=INTEGER},
</if>
<if test="templateCode != null">
#{templateCode,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
......@@ -153,6 +162,9 @@
<if test="messageType != null">
message_type = #{messageType,jdbcType=INTEGER},
</if>
<if test="templateCode != null">
template_code = #{templateCode,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
......@@ -187,6 +199,7 @@
clerk_id = #{clerkId,jdbcType=VARCHAR},
category_type = #{categoryType,jdbcType=INTEGER},
message_type = #{messageType,jdbcType=INTEGER},
template_code = #{templateCode,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
relation_id = #{relationId,jdbcType=VARCHAR},
......@@ -197,4 +210,30 @@
update_time = #{updateTime,jdbcType=TIMESTAMP}
where notice_message_id = #{noticeMessageId,jdbcType=BIGINT}
</update>
<select id="listNoticeMessage" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_notice_message
where enterprise_id = #{enterpriseId}
and store_id = #{storeId}
<if test="clerkId != null">
and clerk_id =#{clerkId}
</if>
<if test="categoryType != -1">
and category_type =#{categoryType}
</if>
order by create_time desc
</select>
<update id="updateNoticeMessageReadFlag">
update tab_haoban_notice_message
set read_flag=1,update_time = now()
WHERE enterprise_id = #{enterpriseId}
and clerk_id = #{clerkId}
and read_flag=0
<if test="categoryType!=-1">
and category_type=#{categoryType}
</if>
</update>
</mapper>
\ No newline at end of file
......@@ -118,10 +118,10 @@
where notice_message_template_id = #{noticeMessageTemplateId,jdbcType=INTEGER}
</update>
<select id="getByCode" parameterType="java.lang.Integer" resultMap="BaseResultMap">
<select id="getByCode" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_notice_message_template
where template_code = #{templateCode} and enterprise_id=#{enterpriseId} and delete_flag=0
where template_code = #{templateCode,jdbcType=VARCHAR} and enterprise_id=#{enterpriseId} and delete_flag=0
</select>
</mapper>
\ No newline at end of file
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");
}
}
......@@ -17,12 +17,10 @@ import org.apache.commons.lang3.time.DateUtils;
public class test {
public static void main(String[] args) {
String content = "请完善完善202005门店指标月份指";
String pattern = ".*([0-1]{6}).*";
Pattern r = Pattern.compile(pattern);
Matcher matcher = r.matcher(content);
String s = matcher.find() ? matcher.group(1) : "";
System.out.println(s);
String content = "测试模板#{test}";
String test = "1test";
String replace = content.replaceAll("\\#\\{" + test + "\\}", "1111");
System.out.println(replace);
// String key = "3.2.1";
......
......@@ -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;
......@@ -1126,4 +1129,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);
}
}
......@@ -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);
}
}
......@@ -53,6 +53,9 @@ public class MobileWebInterceptor extends HandlerInterceptorAdapter {
if (null != ignoreLogin) {
return true;
}
if (true) {
return true;
}
WellDoneLoginDTO wellDoneLoginDTO = (WellDoneLoginDTO) AuthRequestWellDoneUtil.getLoginUser();
if (wellDoneLoginDTO == null) {
this.errorResult(httpServletResponse, HaoBanErrCode.ERR_30009);
......
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;
}
}
......@@ -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>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment