发送话术记录表
parent
86647553ed
commit
df720853c2
@ -0,0 +1,62 @@
|
||||
package com.flossom.common.core.mapper;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 发送话术记录Mapper接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-20
|
||||
*/
|
||||
public interface WxUserScriptLogMapper {
|
||||
/**
|
||||
* 查询发送话术记录
|
||||
*
|
||||
* @param id 发送话术记录主键
|
||||
* @return 发送话术记录
|
||||
*/
|
||||
public WxUserScriptLog selectWxUserScriptLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询发送话术记录列表
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 发送话术记录集合
|
||||
*/
|
||||
public List<WxUserScriptLog> selectWxUserScriptLogList(WxUserScriptLog wxUserScriptLog);
|
||||
|
||||
/**
|
||||
* 新增发送话术记录
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxUserScriptLog(WxUserScriptLog wxUserScriptLog);
|
||||
|
||||
/**
|
||||
* 修改发送话术记录
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxUserScriptLog(WxUserScriptLog wxUserScriptLog);
|
||||
|
||||
/**
|
||||
* 删除发送话术记录
|
||||
*
|
||||
* @param id 发送话术记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserScriptLogById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除发送话术记录
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserScriptLogByIds(Long[] ids);
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.flossom.common.core.mapper.WxUserScriptLogMapper">
|
||||
|
||||
<resultMap type="WxUserScriptLog" id="WxUserScriptLogResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="wxUserId" column="wx_user_id" />
|
||||
<result property="isRead" column="is_read" />
|
||||
<result property="isCustom" column="is_custom" />
|
||||
<result property="scriptTemplateId" column="script_template_id" />
|
||||
<result property="scriptName" column="script_name" />
|
||||
<result property="titile" column="titile" />
|
||||
<result property="content" column="content" />
|
||||
<result property="tagType" column="tag_type" />
|
||||
<result property="type" column="type" />
|
||||
<result property="link" column="link" />
|
||||
<result property="linkParams" column="link_params" />
|
||||
<result property="redirectAppid" column="redirect_appid" />
|
||||
<result property="redirectUrl" column="redirect_url" />
|
||||
<result property="videoNo" column="video_no" />
|
||||
<result property="feedId" column="feed_id" />
|
||||
<result property="tagNames" column="tag_names" />
|
||||
<result property="tagIds" column="tag_ids" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectWxUserScriptLogVo">
|
||||
select id, wx_user_id, is_read, is_custom, script_template_id, script_name, titile, content, tag_type, type, link, link_params, redirect_appid, redirect_url, video_no, feed_id, tag_names, tag_ids, status, create_by, create_time from wx_user_script_log
|
||||
</sql>
|
||||
|
||||
<select id="selectWxUserScriptLogList" parameterType="WxUserScriptLog" resultMap="WxUserScriptLogResult">
|
||||
<include refid="selectWxUserScriptLogVo"/>
|
||||
<where>
|
||||
<if test="wxUserId != null "> and wx_user_id = #{wxUserId}</if>
|
||||
<if test="isRead != null "> and is_read = #{isRead}</if>
|
||||
<if test="isCustom != null "> and is_custom = #{isCustom}</if>
|
||||
<if test="scriptTemplateId != null "> and script_template_id = #{scriptTemplateId}</if>
|
||||
<if test="scriptName != null and scriptName != ''"> and script_name like concat('%', #{scriptName}, '%')</if>
|
||||
<if test="titile != null and titile != ''"> and titile = #{titile}</if>
|
||||
<if test="content != null and content != ''"> and content = #{content}</if>
|
||||
<if test="tagType != null "> and tag_type = #{tagType}</if>
|
||||
<if test="type != null "> and type = #{type}</if>
|
||||
<if test="link != null and link != ''"> and link = #{link}</if>
|
||||
<if test="linkParams != null and linkParams != ''"> and link_params = #{linkParams}</if>
|
||||
<if test="redirectAppid != null and redirectAppid != ''"> and redirect_appid = #{redirectAppid}</if>
|
||||
<if test="redirectUrl != null and redirectUrl != ''"> and redirect_url = #{redirectUrl}</if>
|
||||
<if test="videoNo != null and videoNo != ''"> and video_no = #{videoNo}</if>
|
||||
<if test="feedId != null and feedId != ''"> and feed_id = #{feedId}</if>
|
||||
<if test="tagNames != null and tagNames != ''"> and tag_names = #{tagNames}</if>
|
||||
<if test="tagIds != null and tagIds != ''"> and tag_ids = #{tagIds}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWxUserScriptLogById" parameterType="Long" resultMap="WxUserScriptLogResult">
|
||||
<include refid="selectWxUserScriptLogVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertWxUserScriptLog" parameterType="WxUserScriptLog" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into wx_user_script_log
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="wxUserId != null">wx_user_id,</if>
|
||||
<if test="isRead != null">is_read,</if>
|
||||
<if test="isCustom != null">is_custom,</if>
|
||||
<if test="scriptTemplateId != null">script_template_id,</if>
|
||||
<if test="scriptName != null">script_name,</if>
|
||||
<if test="titile != null">titile,</if>
|
||||
<if test="content != null">content,</if>
|
||||
<if test="tagType != null">tag_type,</if>
|
||||
<if test="type != null">type,</if>
|
||||
<if test="link != null">link,</if>
|
||||
<if test="linkParams != null">link_params,</if>
|
||||
<if test="redirectAppid != null">redirect_appid,</if>
|
||||
<if test="redirectUrl != null">redirect_url,</if>
|
||||
<if test="videoNo != null">video_no,</if>
|
||||
<if test="feedId != null">feed_id,</if>
|
||||
<if test="tagNames != null">tag_names,</if>
|
||||
<if test="tagIds != null">tag_ids,</if>
|
||||
<if test="status != null">status,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="wxUserId != null">#{wxUserId},</if>
|
||||
<if test="isRead != null">#{isRead},</if>
|
||||
<if test="isCustom != null">#{isCustom},</if>
|
||||
<if test="scriptTemplateId != null">#{scriptTemplateId},</if>
|
||||
<if test="scriptName != null">#{scriptName},</if>
|
||||
<if test="titile != null">#{titile},</if>
|
||||
<if test="content != null">#{content},</if>
|
||||
<if test="tagType != null">#{tagType},</if>
|
||||
<if test="type != null">#{type},</if>
|
||||
<if test="link != null">#{link},</if>
|
||||
<if test="linkParams != null">#{linkParams},</if>
|
||||
<if test="redirectAppid != null">#{redirectAppid},</if>
|
||||
<if test="redirectUrl != null">#{redirectUrl},</if>
|
||||
<if test="videoNo != null">#{videoNo},</if>
|
||||
<if test="feedId != null">#{feedId},</if>
|
||||
<if test="tagNames != null">#{tagNames},</if>
|
||||
<if test="tagIds != null">#{tagIds},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWxUserScriptLog" parameterType="WxUserScriptLog">
|
||||
update wx_user_script_log
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="wxUserId != null">wx_user_id = #{wxUserId},</if>
|
||||
<if test="isRead != null">is_read = #{isRead},</if>
|
||||
<if test="isCustom != null">is_custom = #{isCustom},</if>
|
||||
<if test="scriptTemplateId != null">script_template_id = #{scriptTemplateId},</if>
|
||||
<if test="scriptName != null">script_name = #{scriptName},</if>
|
||||
<if test="titile != null">titile = #{titile},</if>
|
||||
<if test="content != null">content = #{content},</if>
|
||||
<if test="tagType != null">tag_type = #{tagType},</if>
|
||||
<if test="type != null">type = #{type},</if>
|
||||
<if test="link != null">link = #{link},</if>
|
||||
<if test="linkParams != null">link_params = #{linkParams},</if>
|
||||
<if test="redirectAppid != null">redirect_appid = #{redirectAppid},</if>
|
||||
<if test="redirectUrl != null">redirect_url = #{redirectUrl},</if>
|
||||
<if test="videoNo != null">video_no = #{videoNo},</if>
|
||||
<if test="feedId != null">feed_id = #{feedId},</if>
|
||||
<if test="tagNames != null">tag_names = #{tagNames},</if>
|
||||
<if test="tagIds != null">tag_ids = #{tagIds},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteWxUserScriptLogById" parameterType="Long">
|
||||
delete from wx_user_script_log where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteWxUserScriptLogByIds" parameterType="String">
|
||||
delete from wx_user_script_log where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
@ -0,0 +1,164 @@
|
||||
package com.flossom.system.controller;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.flossom.common.core.domain.R;
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
import com.flossom.common.core.domain.req.WxUserScriptReq;
|
||||
import com.flossom.common.core.exception.ServiceException;
|
||||
import com.flossom.common.core.utils.StringUtils;
|
||||
import com.flossom.common.core.utils.poi.ExcelUtil;
|
||||
import com.flossom.common.core.web.controller.BaseController;
|
||||
import com.flossom.common.core.web.domain.AjaxResult;
|
||||
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 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;
|
||||
|
||||
/**
|
||||
* 发送话术记录Controller
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-20
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/userScriptLog")
|
||||
public class WxUserScriptLogController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IWxUserScriptLogService wxUserScriptLogService;
|
||||
|
||||
/**
|
||||
* 查询发送话术记录列表
|
||||
*/
|
||||
@RequiresPermissions("system:user_script_log:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(WxUserScriptLog wxUserScriptLog) {
|
||||
startPage();
|
||||
List<WxUserScriptLog> list = wxUserScriptLogService.selectWxUserScriptLogList(wxUserScriptLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出发送话术记录列表
|
||||
*/
|
||||
@RequiresPermissions("system:user_script_log:export")
|
||||
@Log(title = "发送话术记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, WxUserScriptLog wxUserScriptLog) {
|
||||
List<WxUserScriptLog> list = wxUserScriptLogService.selectWxUserScriptLogList(wxUserScriptLog);
|
||||
ExcelUtil<WxUserScriptLog> util = new ExcelUtil<WxUserScriptLog>(WxUserScriptLog.class);
|
||||
util.exportExcel(response, list, "发送话术记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取发送话术记录详细信息
|
||||
*/
|
||||
@RequiresPermissions("system:user_script_log:query")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(wxUserScriptLogService.selectWxUserScriptLogById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发送话术记录
|
||||
*/
|
||||
@RequiresPermissions("system:user_script_log:add")
|
||||
@Log(title = "发送话术记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody WxUserScriptLog wxUserScriptLog) {
|
||||
return toAjax(wxUserScriptLogService.insertWxUserScriptLog(wxUserScriptLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发送话术记录
|
||||
*/
|
||||
@RequiresPermissions("system:user_script_log:edit")
|
||||
@Log(title = "发送话术记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody WxUserScriptLog wxUserScriptLog) {
|
||||
return toAjax(wxUserScriptLogService.updateWxUserScriptLog(wxUserScriptLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发送话术记录
|
||||
*/
|
||||
@RequiresPermissions("system:user_script_log:remove")
|
||||
@Log(title = "发送话术记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(wxUserScriptLogService.deleteWxUserScriptLogByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送话术
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/sendScript")
|
||||
public R sendScript(@RequestBody @Validated WxUserScriptReq wxUserScriptReq) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
}
|
||||
wxUserScriptLogService.sendScript(wxUserScriptReq);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
package com.flossom.system.service;
|
||||
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
import com.flossom.common.core.domain.req.WxUserScriptReq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 发送话术记录Service接口
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-20
|
||||
*/
|
||||
public interface IWxUserScriptLogService {
|
||||
/**
|
||||
* 查询发送话术记录
|
||||
*
|
||||
* @param id 发送话术记录主键
|
||||
* @return 发送话术记录
|
||||
*/
|
||||
public WxUserScriptLog selectWxUserScriptLogById(Long id);
|
||||
|
||||
/**
|
||||
* 查询发送话术记录列表
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 发送话术记录集合
|
||||
*/
|
||||
public List<WxUserScriptLog> selectWxUserScriptLogList(WxUserScriptLog wxUserScriptLog);
|
||||
|
||||
/**
|
||||
* 新增发送话术记录
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWxUserScriptLog(WxUserScriptLog wxUserScriptLog);
|
||||
|
||||
/**
|
||||
* 修改发送话术记录
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWxUserScriptLog(WxUserScriptLog wxUserScriptLog);
|
||||
|
||||
/**
|
||||
* 批量删除发送话术记录
|
||||
*
|
||||
* @param ids 需要删除的发送话术记录主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserScriptLogByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除发送话术记录信息
|
||||
*
|
||||
* @param id 发送话术记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWxUserScriptLogById(Long id);
|
||||
|
||||
void sendScript(WxUserScriptReq wxUserScriptReq);
|
||||
}
|
||||
@ -0,0 +1,143 @@
|
||||
package com.flossom.system.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.flossom.common.core.domain.entity.SysTag;
|
||||
import com.flossom.common.core.domain.entity.WxScriptTemplate;
|
||||
import com.flossom.common.core.domain.entity.WxUserScriptLog;
|
||||
import com.flossom.common.core.domain.req.WxUserScriptReq;
|
||||
import com.flossom.common.core.mapper.*;
|
||||
import com.flossom.common.core.utils.DateUtils;
|
||||
import com.flossom.common.core.utils.StringUtils;
|
||||
import com.flossom.common.security.utils.SecurityUtils;
|
||||
import com.flossom.system.service.IWxUserMemberService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.flossom.system.service.IWxUserScriptLogService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 发送话术记录Service业务层处理
|
||||
*
|
||||
* @author flossom
|
||||
* @date 2023-12-20
|
||||
*/
|
||||
@Service
|
||||
public class WxUserScriptLogServiceImpl implements IWxUserScriptLogService {
|
||||
@Autowired
|
||||
private WxUserScriptLogMapper wxUserScriptLogMapper;
|
||||
|
||||
@Autowired
|
||||
private IWxUserMemberService wxUserMemberService;
|
||||
|
||||
@Autowired
|
||||
private WxScriptTemplateMapper wxScriptTemplateMapper;
|
||||
|
||||
/**
|
||||
* 查询发送话术记录
|
||||
*
|
||||
* @param id 发送话术记录主键
|
||||
* @return 发送话术记录
|
||||
*/
|
||||
@Override
|
||||
public WxUserScriptLog selectWxUserScriptLogById(Long id) {
|
||||
return wxUserScriptLogMapper.selectWxUserScriptLogById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询发送话术记录列表
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 发送话术记录
|
||||
*/
|
||||
@Override
|
||||
public List<WxUserScriptLog> selectWxUserScriptLogList(WxUserScriptLog wxUserScriptLog) {
|
||||
return wxUserScriptLogMapper.selectWxUserScriptLogList(wxUserScriptLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增发送话术记录
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWxUserScriptLog(WxUserScriptLog wxUserScriptLog) {
|
||||
wxUserScriptLog.setCreateTime(DateUtils.getNowDate());
|
||||
return wxUserScriptLogMapper.insertWxUserScriptLog(wxUserScriptLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改发送话术记录
|
||||
*
|
||||
* @param wxUserScriptLog 发送话术记录
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWxUserScriptLog(WxUserScriptLog wxUserScriptLog) {
|
||||
return wxUserScriptLogMapper.updateWxUserScriptLog(wxUserScriptLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除发送话术记录
|
||||
*
|
||||
* @param ids 需要删除的发送话术记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxUserScriptLogByIds(Long[] ids) {
|
||||
return wxUserScriptLogMapper.deleteWxUserScriptLogByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除发送话术记录信息
|
||||
*
|
||||
* @param id 发送话术记录主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWxUserScriptLogById(Long id) {
|
||||
return wxUserScriptLogMapper.deleteWxUserScriptLogById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void sendScript(WxUserScriptReq wxUserScriptReq) {
|
||||
List<Long> userIdList = wxUserScriptReq.getUserIdList();
|
||||
// 保存消息
|
||||
for (Long wxUserId : userIdList) {
|
||||
WxUserScriptLog wxUserScriptLog = new WxUserScriptLog();
|
||||
BeanUtils.copyProperties(wxUserScriptReq, wxUserScriptLog);
|
||||
wxUserScriptLog.setWxUserId(wxUserId);
|
||||
wxUserScriptLog.setCreateBy(SecurityUtils.getUsername());
|
||||
wxUserScriptLog.setCreateTime(DateUtils.getNowDate());
|
||||
wxUserScriptLogMapper.insertWxUserScriptLog(wxUserScriptLog);
|
||||
}
|
||||
|
||||
// 保存标签关联
|
||||
if (wxUserScriptReq.getIsCustom() == 0) {
|
||||
// 模板话术
|
||||
Integer scriptTemplateId = wxUserScriptReq.getScriptTemplateId();
|
||||
WxScriptTemplate wxScriptTemplate = wxScriptTemplateMapper.selectWxScriptTemplateById(scriptTemplateId.longValue());
|
||||
if (StringUtils.isNotBlank(wxScriptTemplate.getTagIds())) {
|
||||
List<String> list = Arrays.asList(wxScriptTemplate.getTagIds().split(","));
|
||||
List<Integer> tagList = list.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
List<Integer> collect = userIdList.stream().map(Long::intValue).collect(Collectors.toList());
|
||||
wxUserMemberService.batchAddMiniProgramTag(tagList, collect);
|
||||
}
|
||||
}
|
||||
if (wxUserScriptReq.getIsCustom() == 1) {
|
||||
// 自定义话术
|
||||
if (StringUtils.isNotBlank(wxUserScriptReq.getTagIds())) {
|
||||
List<String> list = Arrays.asList(wxUserScriptReq.getTagIds().split(","));
|
||||
List<Integer> tagList = list.stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||
List<Integer> collect = userIdList.stream().map(Long::intValue).collect(Collectors.toList());
|
||||
wxUserMemberService.batchAddMiniProgramTag(tagList, collect);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue