Browse Source

发布渠道对接

develop
wangsixiang 7 months ago
parent
commit
48be807c4e
  1. 36
      zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java
  2. 25
      zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java
  3. 9
      zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java
  4. 6
      zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java
  5. 17
      zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java
  6. 2
      zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml
  7. 16
      zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml

36
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<DcPublishingChannels> 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));
}
}

25
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;
}

9
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<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory);
//修改启用停用
int updateEnabled(DcPublishingChannels dcPublishingChannels);
//查询事件类型
public String eventType(@Param("id")String id);
//事件调度处置事件推送发布渠道
public DcPublishingChannels eventPublishChannels(@Param("dataCategory") String dataCategory);
}

6
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<DcPublishingChannels> selectChannelsDataCategory(Integer dataCategory);
//修改启用停用
int updateEnabled(DcPublishingChannels dcPublishingChannels);
//事件调度处置事件推送发布渠道
public DcPublishingChannels eventPublishChannels(String eventId);
}

17
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<DcPublishingChannels> 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);
}
}

2
zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml

@ -76,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</where>
GROUP BY manage.event_id
ORDER BY manage.create_time
ORDER BY event.create_time desc
</select>
<select id="selectDcPublishManageById" parameterType="Long" resultMap="DcPublishManageResult">

16
zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml

@ -25,6 +25,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDcPublishingChannelsList" parameterType="DcPublishingChannels" resultMap="DcPublishingChannelsResult">
<include refid="selectDcPublishingChannelsVo"/>
<where>
<if test="startDate != null "> and enable_date >= #{startDate}</if>
<if test="endDate != null "> and enable_date &lt;= #{endDate}</if>
<if test="enableDate != null "> and enable_date = #{enableDate}</if>
<if test="dataCategory != null "> and data_category = #{dataCategory}</if>
<if test="infoLevel != null "> and info_level = #{infoLevel}</if>
@ -78,6 +80,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
where id = #{id}
</update>
<update id="updateEnabled">
update dc_publishing_channels
<trim prefix="SET" suffixOverrides=",">
<if test="enabled != null">enabled = #{enabled},</if>
<if test="enableDate != null">enable_date = #{enableDate},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteDcPublishingChannelsById" parameterType="Long">
delete from dc_publishing_channels where id = #{id}
@ -92,4 +102,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectChannelsDataCategory" resultType="com.zc.business.domain.DcPublishingChannels">
select id from dc_publishing_channels where data_category=#{dataCategory}
</select>
<select id="eventPublishChannels" resultType="com.zc.business.domain.DcPublishingChannels">
select publish_channels publishChannels from dc_publishing_channels where data_category=#{dataCategory}
</select>
<select id="eventType" resultType="java.lang.String">
select event_type from dc_event where id=#{id}
</select>
</mapper>
Loading…
Cancel
Save