From ef01587e55b5ef5dd1951a0e24246722870c8fd7 Mon Sep 17 00:00:00 2001 From: elliott <382696293@qq.com> Date: Mon, 8 Jan 2024 17:18:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A0=87=E7=AD=BE=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WxScriptTagServiceImpl.java | 54 +++++++++++++++++++ .../src/views/system/scriptMessage/index.vue | 4 +- .../src/views/system/scriptTag/index.vue | 6 +-- .../views/system/siteCarouselInfo/index.vue | 8 +-- .../src/views/system/siteInfo/index.vue | 4 +- 5 files changed, 65 insertions(+), 11 deletions(-) diff --git a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxScriptTagServiceImpl.java b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxScriptTagServiceImpl.java index 838a343..a5fb7da 100644 --- a/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxScriptTagServiceImpl.java +++ b/flossom-modules/flossom-system/src/main/java/com/flossom/system/service/impl/WxScriptTagServiceImpl.java @@ -1,13 +1,22 @@ package com.flossom.system.service.impl; import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; +import com.flossom.common.core.domain.entity.SysTag; import com.flossom.common.core.domain.entity.WxScriptTag; +import com.flossom.common.core.domain.entity.WxScriptTemplate; +import com.flossom.common.core.mapper.SysTagMapper; import com.flossom.common.core.mapper.WxScriptTagMapper; +import com.flossom.common.core.mapper.WxScriptTemplateMapper; import com.flossom.common.core.utils.DateUtils; +import com.flossom.common.core.utils.StringUtils; +import org.apache.commons.compress.utils.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.flossom.system.service.IWxScriptTagService; +import org.springframework.util.CollectionUtils; /** * 话术模板与标签关联Service业务层处理 @@ -20,6 +29,10 @@ public class WxScriptTagServiceImpl implements IWxScriptTagService { @Autowired private WxScriptTagMapper wxScriptTagMapper; + @Autowired + private WxScriptTemplateMapper wxScriptTemplateMapper; + @Autowired + private SysTagMapper sysTagMapper; /** * 查询话术模板与标签关联 @@ -97,6 +110,47 @@ public class WxScriptTagServiceImpl implements IWxScriptTagService @Override public int deleteWxScriptTagByTagId(Long tagId) { + // 先找出来,符合的所有标签 + WxScriptTag tag = new WxScriptTag(); + tag.setTagId(tagId); + List wxScriptTags = wxScriptTagMapper.selectWxScriptTagList(tag); + // 开始组装新的数据以及更新源数据 + if (!CollectionUtils.isEmpty(wxScriptTags)) { + for (WxScriptTag wxScriptTag: wxScriptTags) { + Long scriptId = wxScriptTag.getScriptId(); + // 话术模板 + WxScriptTemplate wxScriptTemplate = wxScriptTemplateMapper.selectWxScriptTemplateById(scriptId); + if (Objects.nonNull(wxScriptTemplate)) { + WxScriptTag tagsVO = new WxScriptTag(); + tagsVO.setScriptId(scriptId); + // 反查得到所有的标签 + List wxScriptTotalTags = wxScriptTagMapper.selectWxScriptTagList(tagsVO); + // 过滤删除的标签 + if (!CollectionUtils.isEmpty(wxScriptTotalTags)) { + // 获取过滤后的标签的信息 + List collectList = wxScriptTotalTags.stream().filter(x -> !String.valueOf(x.getTagId()).equals(String.valueOf(tagId))).collect(Collectors.toList()); + List createSysTagList = Lists.newArrayList(); + if (!CollectionUtils.isEmpty(collectList)) { + for (WxScriptTag scriptTag : collectList) { + SysTag sysTag = sysTagMapper.selectDeptById(scriptTag.getTagId()); + if (Objects.nonNull(sysTag)) { + createSysTagList.add(sysTag); + } + } + } + if (!CollectionUtils.isEmpty(createSysTagList)) { + String tagNames = createSysTagList.stream().map(SysTag::getTagName).collect(Collectors.joining(",")); + wxScriptTemplate.setTagNames(tagNames); + List resultList = createSysTagList.stream().map(SysTag::getId).collect(Collectors.toList()); + String ids = StringUtils.join(resultList, ","); + wxScriptTemplate.setTagIds(ids); + wxScriptTemplateMapper.updateWxScriptTemplate(wxScriptTemplate); + } + } + } + } + } + return wxScriptTagMapper.deleteWxScriptTagByTagId(tagId); } } diff --git a/flossom-ui/src/views/system/scriptMessage/index.vue b/flossom-ui/src/views/system/scriptMessage/index.vue index 908ad77..38326a1 100644 --- a/flossom-ui/src/views/system/scriptMessage/index.vue +++ b/flossom-ui/src/views/system/scriptMessage/index.vue @@ -290,7 +290,7 @@ @@ -369,7 +369,7 @@ export default { { required: true, message: "跳转参数不能为空", trigger: "blur" } ], redirectUrl: [ - { required: true, message: "页面链接不能为空", trigger: "blur" } + { required: true, message: "小程序页面不能为空", trigger: "blur" } ], videoNo: [ { required: true, message: "视频号ID不能为空", trigger: "blur" } diff --git a/flossom-ui/src/views/system/scriptTag/index.vue b/flossom-ui/src/views/system/scriptTag/index.vue index 1ecdf3b..9f59b02 100644 --- a/flossom-ui/src/views/system/scriptTag/index.vue +++ b/flossom-ui/src/views/system/scriptTag/index.vue @@ -175,8 +175,8 @@ - - + + @@ -265,7 +265,7 @@ export default { { required: true, message: "小程序appid不能为空", trigger: "blur" } ], redirectUrl: [ - { required: true, message: "跳转URL不能为空", trigger: "blur" } + { required: true, message: "小程序页面不能为空", trigger: "blur" } ], videoNo: [ { required: true, message: "视频号ID不能为空", trigger: "blur" } diff --git a/flossom-ui/src/views/system/siteCarouselInfo/index.vue b/flossom-ui/src/views/system/siteCarouselInfo/index.vue index 58c08b5..c616234 100644 --- a/flossom-ui/src/views/system/siteCarouselInfo/index.vue +++ b/flossom-ui/src/views/system/siteCarouselInfo/index.vue @@ -398,7 +398,7 @@ @@ -615,10 +615,10 @@ export default { channelId: null, machineName: null, machineId: null, - userType: null, + userType: 2, operate: null, signNumber: null, - orderNumber: null, + orderNumber: 1000, type: null, link: null, linkParams: null, @@ -653,7 +653,7 @@ export default { handleAdd() { this.reset(); this.open = true; - this.title = "添加站点管理"; + this.title = "添加轮播图"; this.form.orderNumber = 1000; this.form.userType = 2; }, diff --git a/flossom-ui/src/views/system/siteInfo/index.vue b/flossom-ui/src/views/system/siteInfo/index.vue index cfe21f3..b42bf2a 100644 --- a/flossom-ui/src/views/system/siteInfo/index.vue +++ b/flossom-ui/src/views/system/siteInfo/index.vue @@ -398,7 +398,7 @@ @@ -611,7 +611,7 @@ export default { userType: null, operate: null, signNumber: null, - orderNumber: null, + orderNumber: 1000, type: null, link: null, linkParams: null,