发送话术记录表

master
382696293@qq.com 2 years ago
parent 86647553ed
commit df720853c2

@ -0,0 +1,262 @@
package com.flossom.common.core.domain.entity;
import com.flossom.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
/**
* wx_user_script_log
*
* @author flossom
* @date 2023-12-20
*/
public class WxUserScriptLog extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* $column.columnComment
*/
private Long id;
/**
*
*/
private Long wxUserId;
/**
* 01
*/
private Integer isRead;
/**
* 01
*/
private Integer isCustom;
/**
* is_custom = 0
*/
private Integer scriptTemplateId;
/**
*
*/
private String scriptName;
/**
*
*/
private String titile;
/**
*
*/
private String content;
/**
* 1 2
*/
private Integer tagType;
/**
* 013456
*/
private Integer type;
/**
*
*/
private String link;
/**
*
*/
private String linkParams;
/**
* appid
*/
private String redirectAppid;
/**
* url
*/
private String redirectUrl;
/**
*
*/
private String videoNo;
/**
* feedId
*/
private String feedId;
/**
* (xxx,xxx,xxx)
*/
private String tagNames;
/**
* ID(xxxx,xxxx,xxx)
*/
private String tagIds;
/**
* 0 1
*/
private Integer status;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getWxUserId() {
return wxUserId;
}
public void setWxUserId(Long wxUserId) {
this.wxUserId = wxUserId;
}
public Integer getIsRead() {
return isRead;
}
public void setIsRead(Integer isRead) {
this.isRead = isRead;
}
public Integer getIsCustom() {
return isCustom;
}
public void setIsCustom(Integer isCustom) {
this.isCustom = isCustom;
}
public Integer getScriptTemplateId() {
return scriptTemplateId;
}
public void setScriptTemplateId(Integer scriptTemplateId) {
this.scriptTemplateId = scriptTemplateId;
}
public String getScriptName() {
return scriptName;
}
public void setScriptName(String scriptName) {
this.scriptName = scriptName;
}
public String getTitile() {
return titile;
}
public void setTitile(String titile) {
this.titile = titile;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getTagType() {
return tagType;
}
public void setTagType(Integer tagType) {
this.tagType = tagType;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getLinkParams() {
return linkParams;
}
public void setLinkParams(String linkParams) {
this.linkParams = linkParams;
}
public String getRedirectAppid() {
return redirectAppid;
}
public void setRedirectAppid(String redirectAppid) {
this.redirectAppid = redirectAppid;
}
public String getRedirectUrl() {
return redirectUrl;
}
public void setRedirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
}
public String getVideoNo() {
return videoNo;
}
public void setVideoNo(String videoNo) {
this.videoNo = videoNo;
}
public String getFeedId() {
return feedId;
}
public void setFeedId(String feedId) {
this.feedId = feedId;
}
public String getTagNames() {
return tagNames;
}
public void setTagNames(String tagNames) {
this.tagNames = tagNames;
}
public String getTagIds() {
return tagIds;
}
public void setTagIds(String tagIds) {
this.tagIds = tagIds;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
}

@ -0,0 +1,234 @@
package com.flossom.common.core.domain.req;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.validator.constraints.Range;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
*
*
* @author flossom
* @date 2023-12-20
*/
public class WxUserScriptReq {
/**
* id
*/
@NotNull(message = "用户列表不能为空")
List<Long> userIdList;
/**
* 01
*/
@NotNull(message = "请选择是否自定义话术")
@Range(min = 0, max = 1)
private Integer isCustom;
/**
* is_custom = 0
*/
private Integer scriptTemplateId;
/**
*
*/
private String scriptName;
/**
*
*/
private String titile;
/**
*
*/
private String content;
/**
* 1 2
*/
private Integer tagType;
/**
* 013456
*/
@NotNull(message = "请选择跳转类型")
@Range(min = 0, max = 6)
private Integer type;
/**
*
*/
private String link;
/**
*
*/
private String linkParams;
/**
* appid
*/
private String redirectAppid;
/**
* url
*/
private String redirectUrl;
/**
*
*/
private String videoNo;
/**
* feedId
*/
private String feedId;
/**
* (xxx,xxx,xxx)
*/
private String tagNames;
/**
* ID(xxxx,xxxx,xxx)
*/
private String tagIds;
public List<Long> getUserIdList() {
return userIdList;
}
public void setUserIdList(List<Long> userIdList) {
this.userIdList = userIdList;
}
public Integer getIsCustom() {
return isCustom;
}
public void setIsCustom(Integer isCustom) {
this.isCustom = isCustom;
}
public Integer getScriptTemplateId() {
return scriptTemplateId;
}
public void setScriptTemplateId(Integer scriptTemplateId) {
this.scriptTemplateId = scriptTemplateId;
}
public String getScriptName() {
return scriptName;
}
public void setScriptName(String scriptName) {
this.scriptName = scriptName;
}
public String getTitile() {
return titile;
}
public void setTitile(String titile) {
this.titile = titile;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getTagType() {
return tagType;
}
public void setTagType(Integer tagType) {
this.tagType = tagType;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getLinkParams() {
return linkParams;
}
public void setLinkParams(String linkParams) {
this.linkParams = linkParams;
}
public String getRedirectAppid() {
return redirectAppid;
}
public void setRedirectAppid(String redirectAppid) {
this.redirectAppid = redirectAppid;
}
public String getRedirectUrl() {
return redirectUrl;
}
public void setRedirectUrl(String redirectUrl) {
this.redirectUrl = redirectUrl;
}
public String getVideoNo() {
return videoNo;
}
public void setVideoNo(String videoNo) {
this.videoNo = videoNo;
}
public String getFeedId() {
return feedId;
}
public void setFeedId(String feedId) {
this.feedId = feedId;
}
public String getTagNames() {
return tagNames;
}
public void setTagNames(String tagNames) {
this.tagNames = tagNames;
}
public String getTagIds() {
return tagIds;
}
public void setTagIds(String tagIds) {
this.tagIds = tagIds;
}
}

@ -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…
Cancel
Save