From 48be807c4ebb7b0a86bec80ef6886f1ecc64d914 Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Tue, 7 May 2024 11:11:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=B8=A0=E9=81=93=E5=AF=B9?= =?UTF-8?q?=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcPublishingChannelsController.java | 36 +++++++++++++++++-- .../business/domain/DcPublishingChannels.java | 25 +++++++++++-- .../mapper/DcPublishingChannelsMapper.java | 9 +++++ .../service/IDcPublishingChannelsService.java | 6 ++++ .../impl/DcPublishingChannelsServiceImpl.java | 17 +++++++++ .../mapper/business/DcPublishManageMapper.xml | 2 +- .../business/DcPublishingChannelsMapper.xml | 16 +++++++++ 7 files changed, 106 insertions(+), 5 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java b/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java index c7ccae60..a6983e17 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java @@ -1,7 +1,11 @@ package com.zc.business.controller; +import java.util.HashMap; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import com.ruoyi.common.utils.DateUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -38,8 +42,8 @@ public class DcPublishingChannelsController extends BaseController * 查询发布渠道列表 */ @PreAuthorize("@ss.hasPermi('business:channels:list')") - @GetMapping("/list") - public TableDataInfo list(DcPublishingChannels dcPublishingChannels) + @PostMapping("/list") + public TableDataInfo list(@RequestBody DcPublishingChannels dcPublishingChannels) { startPage(); List list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels); @@ -114,4 +118,32 @@ public class DcPublishingChannelsController extends BaseController { return toAjax(dcPublishingChannelsService.deleteDcPublishingChannelsByIds(ids)); } + /** + * 修改启用停用 + */ + @PostMapping("/updateEnabled") + public AjaxResult updateEnabled(@RequestBody DcPublishingChannels dcPublishingChannels) + { + Integer enabled = dcPublishingChannels.getEnabled();//状态 + if (enabled==null){ + return AjaxResult.error("参数错误"); + } + if (enabled==2){ //启用状态,修改启用时间 + dcPublishingChannels.setEnableDate(DateUtils.getNowDate()); + } + return toAjax(dcPublishingChannelsService.updateEnabled(dcPublishingChannels)); + } + //事件调度处置事件推送发布渠道 + @PostMapping("/eventPublishChannels") + public AjaxResult eventPublishChannels(@RequestBody HashMap map) + { + if (map==null||map.size()==0){ + return AjaxResult.error("参数错误"); + } + String eventId = map.get("eventId").toString(); + if (StringUtils.isBlank(eventId)){ + return AjaxResult.error("参数错误"); + } + return AjaxResult.success(dcPublishingChannelsService.eventPublishChannels(eventId)); + } } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java b/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java index adb0a72f..d3e8a928 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java @@ -43,13 +43,34 @@ public class DcPublishingChannels extends BaseEntity @Excel(name = "启用日期", readConverterExp = "$column.readConverterExp()") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") private Date enableDate; - + //查询参数 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date startDate; + //查询参数 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date endDate; public void setId(Long id) { this.id = id; } - public Long getId() + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public Long getId() { return id; } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java index d08e2fe4..96557b9c 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java @@ -1,7 +1,9 @@ package com.zc.business.mapper; +import java.util.HashMap; import java.util.List; import com.zc.business.domain.DcPublishingChannels; +import org.apache.ibatis.annotations.Param; /** * 发布渠道Mapper接口 @@ -60,4 +62,11 @@ public interface DcPublishingChannelsMapper int deleteDcPublishingChannelsByIds(Long[] ids); //查询数据类型是否已经存在 public List selectChannelsDataCategory(Integer dataCategory); + //修改启用停用 + int updateEnabled(DcPublishingChannels dcPublishingChannels); + //查询事件类型 + public String eventType(@Param("id")String id); + //事件调度处置事件推送发布渠道 + public DcPublishingChannels eventPublishChannels(@Param("dataCategory") String dataCategory); + } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java b/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java index 70d73cbd..8488a4a3 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java @@ -1,7 +1,9 @@ package com.zc.business.service; +import java.util.HashMap; import java.util.List; import com.zc.business.domain.DcPublishingChannels; +import org.apache.ibatis.annotations.Param; /** * 发布渠道Service接口 @@ -60,4 +62,8 @@ public interface IDcPublishingChannelsService int deleteDcPublishingChannelsById(Long id); //查询数据类型是否已经存在 public List selectChannelsDataCategory(Integer dataCategory); + //修改启用停用 + int updateEnabled(DcPublishingChannels dcPublishingChannels); + //事件调度处置事件推送发布渠道 + public DcPublishingChannels eventPublishChannels(String eventId); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java index f9e8f5ab..fa1461a0 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java @@ -1,7 +1,9 @@ package com.zc.business.service.impl; +import java.util.HashMap; import java.util.List; import com.ruoyi.common.utils.DateUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zc.business.mapper.DcPublishingChannelsMapper; @@ -54,6 +56,7 @@ public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsSer public int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels) { dcPublishingChannels.setCreateTime(DateUtils.getNowDate()); + dcPublishingChannels.setEnabled(0);//新增时默认状态为停用 return dcPublishingChannelsMapper.insertDcPublishingChannels(dcPublishingChannels); } @@ -98,4 +101,18 @@ public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsSer public List selectChannelsDataCategory(Integer dataCategory) { return dcPublishingChannelsMapper.selectChannelsDataCategory(dataCategory); } + //修改启用停用 + @Override + public int updateEnabled(DcPublishingChannels dcPublishingChannels) { + return dcPublishingChannelsMapper.updateEnabled(dcPublishingChannels); + } + //事件调度处置事件推送发布渠道 + @Override + public DcPublishingChannels eventPublishChannels(String eventId) { + String type = dcPublishingChannelsMapper.eventType(eventId);//事件类型 + if (StringUtils.isBlank(type)){ + return null; + } + return dcPublishingChannelsMapper.eventPublishChannels(type); + } } diff --git a/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml b/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml index e9341438..5cf86603 100644 --- a/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml @@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" GROUP BY manage.event_id - ORDER BY manage.create_time + ORDER BY event.create_time desc + and enable_date >= #{startDate} + and enable_date <= #{endDate} and enable_date = #{enableDate} and data_category = #{dataCategory} and info_level = #{infoLevel} @@ -78,6 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + update dc_publishing_channels + + enabled = #{enabled}, + enable_date = #{enableDate}, + + where id = #{id} + delete from dc_publishing_channels where id = #{id} @@ -92,4 +102,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + \ No newline at end of file