Commit bdb362e5 by 王祖波

好办消息通知

parent 35055d63
package com.gic.haoban.manage.api.dto.notify.dto;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* Created by wangzubo on 2023/3/13.
*/
public class NotifyMessageMQDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 导购id列表
*/
private List<String> clerkIdList;
/**
* 通知类型
*/
private String templateCode;
/**
* 拓展内容
*/
private Map<String, Object> extendContent;
/**
* 结果 1成功0失败
*/
private Integer result;
public List<String> getClerkIdList() {
return clerkIdList;
}
public void setClerkIdList(List<String> clerkIdList) {
this.clerkIdList = clerkIdList;
}
public String getTemplateCode() {
return templateCode;
}
public void setTemplateCode(String templateCode) {
this.templateCode = templateCode;
}
public Map<String, Object> getExtendContent() {
return extendContent;
}
public void setExtendContent(Map<String, Object> extendContent) {
this.extendContent = extendContent;
}
public Integer getResult() {
return result;
}
public void setResult(Integer result) {
this.result = result;
}
}
......@@ -16,6 +16,8 @@ public class NoticeMessageQDTO implements Serializable {
private String optTargetId;
private int messageType;
private String templateCode;
private String title;
private Map<String, String> contentMap;
public NoticeMessageQDTO() {
......@@ -109,6 +111,14 @@ public class NoticeMessageQDTO implements Serializable {
this.templateCode = templateCode;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Map<String, String> getContentMap() {
return contentMap;
}
......
package com.gic.haoban.manage.api.dto.notify.qdto;
import java.util.List;
/**
* Created by wangzubo on 2023/3/13.
*/
public class NotifyMessageBatchQDTO extends NoticeMessageQDTO{
private static final long serialVersionUID = 1L;
private List<String> storeIdList;
public List<String> getStoreIdList() {
return storeIdList;
}
public void setStoreIdList(List<String> storeIdList) {
this.storeIdList = storeIdList;
}
}
......@@ -10,6 +10,7 @@ public enum NoticeMessageCategoryTypeEnum {
CUSTOMER(0, "客户相关"),
TASK(1, "任务相关"),
ACTIVITY(2, "活动相关"),
MATERIAL(4, "素材相关"),
OTHER(3, "其它"),;
private int type;
private String name;
......
......@@ -57,6 +57,10 @@ public enum NoticeMessageTypeEnum {
CUSTOMER_GET_COUPON(4004, "客户领券通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "customer_get_coupon", "/pages/route/index?pageType=", "hbapp_customer_detail"),
CUSTOMER_APPLY_ORDER_REFUND(4005, "客户申请退单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "customer_apply_order_refund", "/pages/route/index?pageType=", "hbapp_customer_order_detail"),
CUSTOMER_SUCCESS_ORDER_REFUND(4006, "客户成功退单通知", NoticeMessageCategoryTypeEnum.CUSTOMER.getType(), "customer_success_order_refund", "/pages/route/index?pageType=", "hbapp_user_bill_detail"),
// todo pageType
MATERIAL_NEW_NOTIFY(5001, "素材上新通知", NoticeMessageCategoryTypeEnum.MATERIAL.getType(), "material_new_notify", "/pages/route/index?pageType=", "hbapp_customer_list"),
;
/**
* 消息类型
......
......@@ -3,6 +3,8 @@ package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
import java.util.List;
/**
* Created by tgs on 2020/2/20.
*/
......
......@@ -4,6 +4,9 @@ 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;
import com.gic.haoban.manage.api.dto.notify.qdto.NotifyMessageBatchQDTO;
import java.util.List;
/**
* Created 2021/12/17.
......@@ -26,6 +29,20 @@ public interface NoticeMessageApiService {
public void run(String json);
/**
* 消息接收 发送消息
* "routerName": "haobanNoticeMessageBatch"
* @param json
*/
void noticeMessageBatchMq(String json);
/**
* 批量发送实现
* @param notifyMessageBatchQDTO
* @return
*/
ServiceResponse<Void> batchSendMessage(NotifyMessageBatchQDTO notifyMessageBatchQDTO);
/**
* 消息分页
*1
* @param enterpriseId
......
package com.gic.haoban.manage.api.service.notify;
import com.gic.api.base.commons.ServiceResponse;
import java.util.List;
public interface NoticeMessageMQApiService {
ServiceResponse<Void> receviceSendMessage(String enterpriseId, List<String> storeIdList);
}
\ No newline at end of file
......@@ -26,6 +26,8 @@ public class NoticeMessageUtil {
private static final String NOTICE_MESSAGE = "haobanNoticeMessage";
private static final String NOTICE_MESSAGE_BATCH = "haobanNoticeMessageBatch";
/**
* 发送消息
*
......
......@@ -20,6 +20,8 @@ public interface NoticeMessageMapper {
*/
int insertSelective(TabNoticeMessage record);
int insertBatch(@Param("records")List<TabNoticeMessage> record);
/**
*/
TabNoticeMessage selectByPrimaryKey(Long noticeMessageId);
......
......@@ -5,6 +5,8 @@ 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;
import java.util.List;
/**
* Created 2021/12/15.
*
......@@ -20,6 +22,8 @@ public interface NoticeMessageService {
*/
public boolean addOrCreateNoticeMessage(NoticeMessageBO messageBO);
void addNoticeMessageBatch(List<NoticeMessageBO> list);
/**
* 分页查询消息
*
......
......@@ -11,6 +11,7 @@ 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.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -43,6 +44,20 @@ public class NoticeMessageServiceImpl implements NoticeMessageService {
}
@Override
public void addNoticeMessageBatch(List<NoticeMessageBO> list) {
if (CollectionUtils.isEmpty(list)) {
return;
}
List<TabNoticeMessage> noticeMessageList = EntityUtil.changeEntityListByJSON(TabNoticeMessage.class, list);
for (TabNoticeMessage noticeMessage : noticeMessageList) {
noticeMessage.setNoticeMessageId(UniqueIdUtils.uniqueLong());
noticeMessage.setCreateTime(new Date());
noticeMessage.setUpdateTime(new Date());
}
noticeMessageMapper.insertBatch(noticeMessageList);
}
@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);
......
......@@ -47,6 +47,21 @@
#{deleteFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertBatch">
insert into tab_haoban_notice_message (notice_message_id, enterprise_id, store_id,
clerk_id, category_type, message_type,
template_code, title, description,
relation_id, message_content, create_time, update_time
)
values
<foreach collection="records" item="record" separator=",">
(#{record.noticeMessageId,jdbcType=BIGINT}, #{record.enterpriseId,jdbcType=VARCHAR}, #{record.storeId,jdbcType=VARCHAR},
#{record.clerkId,jdbcType=VARCHAR}, #{record.categoryType,jdbcType=INTEGER}, #{record.messageType,jdbcType=INTEGER},
#{record.templateCode,jdbcType=VARCHAR}, #{record.title,jdbcType=VARCHAR}, #{record.description,jdbcType=VARCHAR},
#{record.relationId,jdbcType=VARCHAR}, #{record.messageContent,jdbcType=VARCHAR}, #{record.createTime,jdbcType=TIMESTAMP}, #{record.updateTime,jdbcType=TIMESTAMP}
)
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabNoticeMessage">
insert into tab_haoban_notice_message
<trim prefix="(" suffix=")" suffixOverrides=",">
......
......@@ -7,7 +7,6 @@ import com.gic.haoban.manage.api.service.MemberUnionidRelatedApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.TestService;
import com.gic.wechat.api.dto.qywx.DepartmentDTO;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
......@@ -44,9 +43,6 @@ public class DealSyncTest {
private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private TestService testService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
......
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.dto.notify.qdto.NotifyMessageBatchQDTO;
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 com.google.common.collect.Lists;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.slf4j.Logger;
......@@ -62,4 +64,22 @@ public class NotityTest {
qywxTagApiService.checkQywxSync("-1");
}
@Test
public void batchSendMessage() {
NotifyMessageBatchQDTO qdto = new NotifyMessageBatchQDTO();
qdto.setStoreIdList(Lists.newArrayList("ff8080817c2b4c55017c30a4482800d7"));
qdto.setOptTargetId("-1");
Map<String, Object> map1 = new HashMap<>();
map1.put("materialNotifyId", 111);
qdto.setExtendContent(map1);
qdto.setEnterpriseId("ff8080815dacd3a2015dacd3ef5c0000");
qdto.setMessageType(NoticeMessageTypeEnum.MATERIAL_NEW_NOTIFY.getType());
qdto.setTemplateCode(NoticeMessageTypeEnum.MATERIAL_NEW_NOTIFY.getTemplateCode());
qdto.setTitle("素材上新通知");
Map<String, String> map = new HashMap<>();
map.put("content", "有新的素材了,快来看啊!");
qdto.setContentMap(map);
noticeMessageApiService.batchSendMessage(qdto);
}
}
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