Commit e6bc1bff by 徐高华

消息发送

parent 09d555b2
...@@ -38,6 +38,8 @@ public enum AppPageType { ...@@ -38,6 +38,8 @@ public enum AppPageType {
MARKET_CLUE_TASK(16, "hbapp_marketing_task_list"), MARKET_CLUE_TASK(16, "hbapp_marketing_task_list"),
//话务任务 //话务任务
TEL_WITHIN_TIME_LIMIT(17, "hbapp_marketing_task_list"), TEL_WITHIN_TIME_LIMIT(17, "hbapp_marketing_task_list"),
// 客户预约
hbapp_appointment_list(18 , "hbapp_appointment_list")
; ;
......
...@@ -44,6 +44,7 @@ public enum NoticeMessageTypeEnum { ...@@ -44,6 +44,7 @@ public enum NoticeMessageTypeEnum {
CASH_OUT_REFUSE(3040, "提现通知", NoticeMessageCategoryTypeEnum.OTHER.getType(), "cash_out_refuse", "/pages/route/index?pageType=", "hbapp_withdraw_list"), CASH_OUT_REFUSE(3040, "提现通知", NoticeMessageCategoryTypeEnum.OTHER.getType(), "cash_out_refuse", "/pages/route/index?pageType=", "hbapp_withdraw_list"),
OFFLINE_PRE(3041, "预约提醒", NoticeMessageCategoryTypeEnum.OTHER.getType(), "task_overdue", "/pages/route/index?pageType=", "hbapp_appointment_list"),
CUSTOMER_MOVE(3052, "客户变动通知", NoticeMessageCategoryTypeEnum.OTHER.getType(), "customer_move", "/pages/route/index?pageType=", "hbapp_customer_list"), CUSTOMER_MOVE(3052, "客户变动通知", NoticeMessageCategoryTypeEnum.OTHER.getType(), "customer_move", "/pages/route/index?pageType=", "hbapp_customer_list"),
......
package com.gic.haoban.manage.api.service; package com.gic.haoban.manage.api.service;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.dto.QywxCallBackDTO; import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
/** /**
...@@ -67,4 +68,17 @@ public interface MessageApiService { ...@@ -67,4 +68,17 @@ public interface MessageApiService {
*/ */
String getNewWxUserIdByStaffId(String wxEnterpriseId, String staffId); String getNewWxUserIdByStaffId(String wxEnterpriseId, String staffId);
/**
*
* @Title: sendPreMessage
* @Description: 发送线下预约消息
* @author xugh
* @param enterpriseId
* @param storeId
* @param message
* @return
* @throws
*/
ServiceResponse<Void> sendPreMessage(String enterpriseId ,String storeId , String message) ;
} }
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -18,6 +19,7 @@ import org.springframework.stereotype.Service; ...@@ -18,6 +19,7 @@ import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.dto.ClerkQwDTO; import com.gic.clerk.api.dto.ClerkQwDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
...@@ -620,4 +622,48 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -620,4 +622,48 @@ public class MessageApiServiceImpl implements MessageApiService {
return qwDTO.needOpenUserId3th() ? tabHaobanStaff.getWxOpenUseId() : tabHaobanStaff.getWxUserId(); return qwDTO.needOpenUserId3th() ? tabHaobanStaff.getWxOpenUseId() : tabHaobanStaff.getWxUserId();
} }
@Override
public com.gic.api.base.commons.ServiceResponse<Void> sendPreMessage(String enterpriseId ,String storeId, String message) {
log.info("线下预约通知,storeId={}",storeId);
ClerkDTO clerkDTO = this.clerkService.getClerkLeaderByStoreId(storeId) ;
if(null == clerkDTO) {
log.info("店长查不到");
return com.gic.api.base.commons.ServiceResponse.success() ;
}
String clerkId = clerkDTO.getClerkId() ;
StaffClerkRelationDTO dto = this.staffClerkRelationApiService.getOneByClerkId(clerkId) ;
if(null == dto) {
log.info("导购成员未关联");
return com.gic.api.base.commons.ServiceResponse.success() ;
}
String eid = dto.getEnterpriseId() ;
if(!enterpriseId.equals(eid)) {
log.info("导购成员关联多个");
return com.gic.api.base.commons.ServiceResponse.success() ;
}
String wxEnterpriseId = dto.getWxEnterpriseId() ;
String staffId = dto.getStaffId() ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO == null) {
log.info("企业为空");
return com.gic.api.base.commons.ServiceResponse.success() ;
}
StaffDTO staff = this.staffApiService.selectById(staffId) ;
QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
String wxUserId = staff.getWxUserId() ;
if(qwDTO.needOpenUserId3th()) {
wxUserId = staff.getWxOpenUseId() ;
}
messageDTO.setAppid(config.getAppid());
messageDTO.setUserIds(Arrays.asList(wxUserId));
messageDTO.setPage(NoticeMessageTypeEnum.OFFLINE_PRE.getPageUrl());
messageDTO.setTitle(NoticeMessageTypeEnum.OFFLINE_PRE.getName());
Map<String, String> map = new HashMap<>();
map.put("事件", "完成预约");
List<ItemDTO> items = getItemsList(map);
messageDTO.setItems(items);
qywxSuiteApiService.sendMessage(qwDTO.getThirdCorpid(), config.getWxSuiteid(), messageDTO);
return com.gic.api.base.commons.ServiceResponse.success() ;
}
} }
...@@ -438,10 +438,9 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -438,10 +438,9 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
messageDTO.setTitle(title); messageDTO.setTitle(title);
messageDTO.setItems(items); messageDTO.setItems(items);
logger.info("发送参数为corpId============:{},suitId============:{},messageDTO============:{},", corpId, config.getWxSuiteid(), JSONObject.toJSONString(messageDTO)); logger.info("发送消息参数为corpId={},messageDTO={},", corpId, JSONObject.toJSONString(messageDTO));
boolean b = qywxSuiteApiService.sendMessage(corpId, config.getWxSuiteid(), messageDTO); boolean b = qywxSuiteApiService.sendMessage(corpId, config.getWxSuiteid(), messageDTO);
logger.info("发送===============》{}", b); logger.info("发送消息返回={}", b);
return b; return b;
} }
......
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