|
|
|
|
@ -3,7 +3,9 @@ package com.flossom.system.controller;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import com.flossom.common.core.domain.R;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxUserMember;
|
|
|
|
|
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
|
|
|
|
import com.flossom.common.core.domain.req.WxUserMemberVm;
|
|
|
|
|
import com.flossom.common.core.domain.req.WxUserScriptReq;
|
|
|
|
|
import com.flossom.common.core.exception.ServiceException;
|
|
|
|
|
import com.flossom.common.core.utils.StringUtils;
|
|
|
|
|
@ -14,12 +16,14 @@ import com.flossom.common.core.web.page.TableDataInfo;
|
|
|
|
|
import com.flossom.common.log.annotation.Log;
|
|
|
|
|
import com.flossom.common.log.enums.BusinessType;
|
|
|
|
|
import com.flossom.common.security.annotation.RequiresPermissions;
|
|
|
|
|
import com.flossom.system.service.IWxUserMemberService;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import com.flossom.system.service.IWxUserScriptLogService;
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发送话术记录Controller
|
|
|
|
|
@ -34,6 +38,9 @@ public class WxUserScriptLogController extends BaseController {
|
|
|
|
|
@Autowired
|
|
|
|
|
private IWxUserScriptLogService wxUserScriptLogService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IWxUserMemberService wxUserMemberService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询发送话术记录列表
|
|
|
|
|
*/
|
|
|
|
|
@ -101,8 +108,11 @@ public class WxUserScriptLogController extends BaseController {
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/sendScript")
|
|
|
|
|
public R sendScript(@RequestBody @Validated WxUserScriptReq wxUserScriptReq) {
|
|
|
|
|
@PostMapping("/batchSendScript")
|
|
|
|
|
public R batchSendScript(@RequestBody @Validated WxUserScriptReq wxUserScriptReq) {
|
|
|
|
|
if (wxUserScriptReq.getUserIdList() == null || wxUserScriptReq.getUserIdList().size() == 0) {
|
|
|
|
|
return R.fail("请选择话术接收人");
|
|
|
|
|
}
|
|
|
|
|
if (wxUserScriptReq.getIsCustom() == 0) {
|
|
|
|
|
// 模板话术
|
|
|
|
|
if (wxUserScriptReq.getScriptTemplateId() == null || wxUserScriptReq.getScriptTemplateId() == 0) {
|
|
|
|
|
@ -110,10 +120,10 @@ public class WxUserScriptLogController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
} else if (wxUserScriptReq.getIsCustom() == 1) {
|
|
|
|
|
// 自定义话术
|
|
|
|
|
if(StringUtils.isBlank(wxUserScriptReq.getTitile())){
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getTitile())) {
|
|
|
|
|
return R.fail("请输入话术标题");
|
|
|
|
|
}
|
|
|
|
|
if(StringUtils.isBlank(wxUserScriptReq.getContent())){
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getContent())) {
|
|
|
|
|
return R.fail("请输入话术内容");
|
|
|
|
|
}
|
|
|
|
|
// 跳转类型
|
|
|
|
|
@ -161,4 +171,75 @@ public class WxUserScriptLogController extends BaseController {
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 发送话术
|
|
|
|
|
*
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
@PostMapping("/allSendScript")
|
|
|
|
|
public R allSendScript(@RequestBody @Validated WxUserScriptReq wxUserScriptReq, WxUserMemberVm wxUserMemberVm) {
|
|
|
|
|
if (wxUserScriptReq.getIsCustom() == 0) {
|
|
|
|
|
// 模板话术
|
|
|
|
|
if (wxUserScriptReq.getScriptTemplateId() == null || wxUserScriptReq.getScriptTemplateId() == 0) {
|
|
|
|
|
return R.fail("请选择话术模板");
|
|
|
|
|
}
|
|
|
|
|
} else if (wxUserScriptReq.getIsCustom() == 1) {
|
|
|
|
|
// 自定义话术
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getTitile())) {
|
|
|
|
|
return R.fail("请输入话术标题");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getContent())) {
|
|
|
|
|
return R.fail("请输入话术内容");
|
|
|
|
|
}
|
|
|
|
|
// 跳转类型
|
|
|
|
|
if (wxUserScriptReq.getType() == 1) {
|
|
|
|
|
// 1跳转内部链接
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getLink())) {
|
|
|
|
|
return R.fail("请输入内部链接");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getLinkParams())) {
|
|
|
|
|
return R.fail("请输入跳转参数");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (wxUserScriptReq.getType() == 3) {
|
|
|
|
|
// 03跳转外部链接
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getLink())) {
|
|
|
|
|
return R.fail("请输入外部链接地址");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (wxUserScriptReq.getType() == 4) {
|
|
|
|
|
// 4跳转小程序
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getRedirectAppid())) {
|
|
|
|
|
return R.fail("请输入小程序appid");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getRedirectUrl())) {
|
|
|
|
|
return R.fail("请输入小程序页面地址");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (wxUserScriptReq.getType() == 5) {
|
|
|
|
|
// 5导向视频号
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getVideoNo())) {
|
|
|
|
|
return R.fail("请输入视频号id");
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getFeedId())) {
|
|
|
|
|
return R.fail("请输入视频号feedid");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (wxUserScriptReq.getType() == 6) {
|
|
|
|
|
// 6导向视频号直播间
|
|
|
|
|
if (StringUtils.isBlank(wxUserScriptReq.getVideoNo())) {
|
|
|
|
|
return R.fail("请输入视频号id");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<WxUserMember> list = wxUserMemberService.selectWxUserMemberList(wxUserMemberVm);
|
|
|
|
|
if (list != null && list.size() > 0) {
|
|
|
|
|
List<Long> collect = list.stream().map(wxUserMember -> wxUserMember.getId()).collect(Collectors.toList());
|
|
|
|
|
wxUserScriptReq.setUserIdList(collect);
|
|
|
|
|
wxUserScriptLogService.sendScript(wxUserScriptReq);
|
|
|
|
|
}
|
|
|
|
|
return R.ok();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|