Commit d82a698c by 徐高华

内容中台-分享(群发朋友圈)

parent 10b28870
...@@ -59,7 +59,6 @@ public interface ExternalClerkRelatedApiService { ...@@ -59,7 +59,6 @@ public interface ExternalClerkRelatedApiService {
@Deprecated @Deprecated
List<ExternalClerkRelatedDTO> listByEnterpriseIdAndDate(String enterpriseId, Date date); List<ExternalClerkRelatedDTO> listByEnterpriseIdAndDate(String enterpriseId, Date date);
@Deprecated
Page<ExternalClerkRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds, Page<ExternalClerkRelatedDTO> pageMemberUnionByParams(List<String> userIdList, List<String> sendMemberIds,
String enterpriseId, BasePageInfo pageInfo); String enterpriseId, BasePageInfo pageInfo);
......
...@@ -69,6 +69,19 @@ public interface MemberUnionidRelatedApiService { ...@@ -69,6 +69,19 @@ public interface MemberUnionidRelatedApiService {
* @return : 返回群发执行结果 * @return : 返回群发执行结果
*/ */
JSONResponse sendMessage(String wxEnterpriseId, String staffId, List<String> extendUserList, List<String> materialIdList , String planId); JSONResponse sendMessage(String wxEnterpriseId, String staffId, List<String> extendUserList, List<String> materialIdList , String planId);
JSONResponse sendMessageShare(String wxEnterpriseId, String staffId, List<String> extendUserList, String message ,List<ContentMaterialDTO> imgList);
/**
* 创建企业群发, 支出素材批量发送
*
* @param wxEnterpriseId : 微信企业id
* @param staffId : 用户id
* @param extendUserList : 发送的用户id
* @param materialIdList : 素材id列表
* @return : 返回群发执行结果
*/
JSONResponse share(String wxEnterpriseId, List<String> clerkIdList, String message , List<ContentMaterialDTO> imgList);
/** /**
* 获取群发成员发送任务列表 * 获取群发成员发送任务列表
......
...@@ -46,6 +46,7 @@ import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum; ...@@ -46,6 +46,7 @@ import com.gic.haoban.app.customer.enums.QywxSyncTaskTypeEnum;
import com.gic.haoban.app.customer.service.api.service.CustomerApiService; import com.gic.haoban.app.customer.service.api.service.CustomerApiService;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.constants.Manage3Constants; import com.gic.haoban.manage.api.constants.Manage3Constants;
import com.gic.haoban.manage.api.dto.ContentMaterialDTO;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO; import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.ExternalUserDTO; import com.gic.haoban.manage.api.dto.ExternalUserDTO;
import com.gic.haoban.manage.api.dto.FriendStoreInfoDTO; import com.gic.haoban.manage.api.dto.FriendStoreInfoDTO;
...@@ -1230,6 +1231,24 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -1230,6 +1231,24 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
@Override @Override
public JSONResponse sendMessage(String wxEnterpriseId, String staffId, List<String> extendUserList, List<String> materialIdList, String planId) { public JSONResponse sendMessage(String wxEnterpriseId, String staffId, List<String> extendUserList, List<String> materialIdList, String planId) {
com.gic.api.base.commons.ServiceResponse<String> resp = this.qywxSendService.sendMessage(wxEnterpriseId, staffId, extendUserList, materialIdList) ; com.gic.api.base.commons.ServiceResponse<String> resp = this.qywxSendService.sendMessage(wxEnterpriseId, staffId, extendUserList, materialIdList) ;
return this.retJson(resp) ;
}
@Override
public JSONResponse sendMessageShare(String wxEnterpriseId, String staffId, List<String> extendUserList, String message,
List<ContentMaterialDTO> imgList) {
com.gic.api.base.commons.ServiceResponse<String> resp = this.qywxSendService.sendMessage(wxEnterpriseId, staffId, extendUserList, imgList, message) ;
return this.retJson(resp) ;
}
@Override
public JSONResponse share(String wxEnterpriseId, List<String> clerkIdList, String message,
List<ContentMaterialDTO> imgList) {
com.gic.api.base.commons.ServiceResponse<String> resp = this.qywxSendService.share(wxEnterpriseId, clerkIdList, message, imgList) ;
return this.retJson(resp) ;
}
private JSONResponse retJson(com.gic.api.base.commons.ServiceResponse<String> resp) {
JSONResponse json = new JSONResponse(); JSONResponse json = new JSONResponse();
if(resp.isSuccess()) { if(resp.isSuccess()) {
json.setErrorCode(-1); json.setErrorCode(-1);
...@@ -1242,7 +1261,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -1242,7 +1261,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
} }
return json ; return json ;
} }
/** /**
* 获取群发成员发送任务列表 * 获取群发成员发送任务列表
* *
......
package com.gic.haoban.manage.web.controller.content;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.app.customer.dto.CustomerDTO;
import com.gic.haoban.app.customer.dto.MemberInfoListParamsDTO;
import com.gic.haoban.app.customer.service.api.service.DistributeApiService;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.web.controller.WebBaseController;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.CustomerQO;
import com.gic.haoban.manage.web.utils.ClerkUtils;
@RestController
public class QwMessageController extends WebBaseController {
private final Logger logger = LogManager.getLogger(QwMessageController.class);
@Autowired
private DistributeApiService distributeApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private ClerkService clerkService;
/**
* 群发-分享
*/
@RequestMapping("/message-send")
public HaobanResponse messageSend(CustomerQO qo, String imgJson, String selectedStoreId) {
CustomerDTO params = EntityUtil.changeEntityByJSON(CustomerDTO.class, qo);
String clerkId = qo.getClerkId();
String wxEnterpriseId = qo.getWxEnterpriseId();
String enterpriseId = qo.getEnterpriseId();
String searchParams = qo.getSearchParams();
String staffId = qo.getStaffId();
List<String> memberIdList = qo.getMemberIdList();
ClerkDTO clerk = this.clerkService.getclerkById(clerkId);
String storeId = ClerkUtils.getClerkStore(clerk, clerkId, selectedStoreId);
// 店长参数
params.setStoreId(storeId);
params.setEnterpriseId(enterpriseId);
params.setClerkId(clerkId);
MemberInfoListParamsDTO memberInfoListParamsDTO = com.gic.haoban.common.utils.StringUtil.getBean(searchParams,
MemberInfoListParamsDTO.class);
params.setQwFriendFlag(true);
List<String> sendMemberIds = distributeApiService.getMemberIds(params, memberIdList, memberInfoListParamsDTO);
if (CollectionUtils.isEmpty(sendMemberIds)) {
return this.fail("无会员数据");
}
List<String> userIdList = new ArrayList<>();
if (clerk.getClerkType() > 0) {
userIdList = staffApiService.listBindStaffId(storeId);
} else {
userIdList.add(clerkId);
}
JSONObject json = new JSONObject();
json.put("userIdList", userIdList);
json.put("sendMemberIds", sendMemberIds);
json.put("enterpriseId", enterpriseId);
json.put("imgJson", imgJson);
json.put("storeId", storeId);
json.put("staffId", staffId);
// 群发-分享
json.put("sendType", 2);
json.put("wxEnterpriseId", wxEnterpriseId);
String ret = json.toJSONString();
try {
GICMQClientUtil.getClientInstance().sendCommonMessage("haobanCommonRouter", ret,
"com.gic.haoban.app.customer.service.api.service.MessageLogApiService", "callBackSendMessage");
} catch (Exception e) {
logger.info(e.getMessage(), e);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
// 朋友圈任务
@RequestMapping("/add_moment_task")
public HaobanResponse share(CustomerQO qo, String imgJson) {
String clerkId = qo.getClerkId();
String wxEnterpriseId = qo.getWxEnterpriseId();
String enterpriseId = qo.getEnterpriseId();
String staffId = qo.getStaffId();
List<String> clerkIdList = qo.getClerkIdList() ;
ClerkDTO clerk = this.clerkService.getclerkById(clerkId);
// 查询所有门店-导购
if(StringUtils.isNotBlank(qo.getChooseAll()) && "1".equals(qo.getChooseAll())) {
if (clerk.getClerkType() > 0) {
String storeId = clerk.getStoreId() ;
clerkIdList = staffApiService.listBindStaffId(storeId);
} else {
clerkIdList.add(clerkId);
}
}
JSONObject json = new JSONObject();
json.put("clerkIdList", clerkIdList);
json.put("enterpriseId", enterpriseId);
json.put("imgJson", imgJson);
json.put("staffId", staffId);
// 朋友圈-分享
json.put("sendType", 3);
json.put("wxEnterpriseId", wxEnterpriseId);
String ret = json.toJSONString();
try {
GICMQClientUtil.getClientInstance().sendCommonMessage("commonRouter", ret,
"com.gic.haoban.app.customer.service.api.service.MessageLogApiService", "callBackSendMessage");
} catch (Exception e) {
logger.info(e.getMessage(), e);
}
return resultResponse(HaoBanErrCode.ERR_1);
}
}
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