订阅功能
This commit is contained in:
parent
45c8ddfcb6
commit
d45bdbaef3
@ -228,7 +228,7 @@ public class BusiNoticeController extends BaseController
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||
{
|
||||
Page<BusiNotice> page = new Page<>(pageNum, pageSize);
|
||||
IPage<BusiNoticeVo> list = busiNoticeService.appFootprintList(query,page);
|
||||
IPage<BusiNoticeVo> list = busiNoticeService.subscribeList(query,page);
|
||||
return success(list);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,10 @@
|
||||
package com.ruoyi.busi.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.busi.domain.BusiSubscribe;
|
||||
import com.ruoyi.busi.service.IBusiSubscribeService;
|
||||
import com.ruoyi.busi.vo.SubscribeDataObj;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
@ -55,6 +57,9 @@ public class BusiSubscribeController extends BaseController {
|
||||
public AjaxResult save(@RequestBody BusiSubscribe busiSubscribe) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
busiSubscribe.setUserId(userId);
|
||||
SubscribeDataObj subscribeDataObj = JSONObject.parseObject(busiSubscribe.getJsonObj(), SubscribeDataObj.class);
|
||||
busiSubscribe.setNewNotice(subscribeDataObj.getNewNotice()?"1":"0");
|
||||
busiSubscribe.setForkNotice(subscribeDataObj.getForkNotice()?"1":"0");
|
||||
busiSubscribeService.saveOrUpdate(busiSubscribe);
|
||||
return success();
|
||||
}
|
||||
|
@ -32,5 +32,9 @@ public class BusiSubscribe extends DlBaseEntity
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String jsonObj;
|
||||
//符合订阅设置的新通告 0 否 1是
|
||||
private String newNotice;
|
||||
//订阅通告主新通告0否 1是
|
||||
private String forkNotice;
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.ruoyi.busi.domain.BusiNotice;
|
||||
import com.ruoyi.busi.query.AppNoticeQuery;
|
||||
import com.ruoyi.busi.query.BusiNoticeQuery;
|
||||
import com.ruoyi.busi.vo.BusiNoticeVo;
|
||||
import com.ruoyi.busi.vo.SubscribeDataObj;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -50,6 +51,16 @@ public interface BusiNoticeMapper extends BaseMapper<BusiNotice> {
|
||||
**/
|
||||
IPage<BusiNoticeVo> appFootprintList(@Param("entity") AppNoticeQuery query, Page<BusiNotice> page);
|
||||
|
||||
/**
|
||||
* 小程序端查询订阅通告列表
|
||||
* @author zcy
|
||||
* @date 15:39 2025/3/29
|
||||
* @param subscribeDataObj 查询条件
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
**/
|
||||
IPage<BusiNoticeVo> subscribeList(@Param("entity") SubscribeDataObj subscribeDataObj, Page<BusiNotice> page);
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端查询通告详细信息
|
||||
* @author 朱春云
|
||||
|
@ -81,4 +81,7 @@ public interface IBusiNoticeService extends IService<BusiNotice>
|
||||
* @return JSONObject
|
||||
**/
|
||||
JSONObject appGetDetail(String noticeId);
|
||||
|
||||
IPage<BusiNoticeVo> subscribeList(AppNoticeQuery query, Page<BusiNotice> page);
|
||||
|
||||
}
|
||||
|
@ -8,11 +8,14 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.ruoyi.base.domain.BaseCategory;
|
||||
import com.ruoyi.base.service.IBaseCategoryService;
|
||||
import com.ruoyi.busi.domain.BusiNoticeSign;
|
||||
import com.ruoyi.busi.domain.BusiSubscribe;
|
||||
import com.ruoyi.busi.domain.BusiUserLove;
|
||||
import com.ruoyi.busi.mapper.BusiNoticeSignMapper;
|
||||
import com.ruoyi.busi.query.AppNoticeQuery;
|
||||
import com.ruoyi.busi.service.IBusiSubscribeService;
|
||||
import com.ruoyi.busi.service.IBusiUserLoveService;
|
||||
import com.ruoyi.busi.vo.BusiNoticeVo;
|
||||
import com.ruoyi.busi.vo.SubscribeDataObj;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
@ -65,6 +68,8 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
private IMemberUserService memberUserService;
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
@Autowired
|
||||
private IBusiSubscribeService subscribeService;
|
||||
|
||||
@Override
|
||||
public IPage<BusiNoticeVo> queryListPage(BusiNoticeQuery query, Page<BusiNotice> page) {
|
||||
@ -322,6 +327,30 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
}
|
||||
return res;
|
||||
}
|
||||
/**
|
||||
* 小程序端查询订阅通告列表
|
||||
* @author zcy
|
||||
* @date 15:39 2025/3/29
|
||||
* @param query 查询条件
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
**/
|
||||
@Override
|
||||
public IPage<BusiNoticeVo> subscribeList(AppNoticeQuery query, Page<BusiNotice> page) {
|
||||
//获取当前登录用户
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
LambdaQueryWrapper<BusiSubscribe> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BusiSubscribe::getUserId,userId).last("limit 1");
|
||||
BusiSubscribe subscribe = subscribeService.getOne(queryWrapper);
|
||||
if(null!=subscribe){
|
||||
//如果使用订阅 则获取 订阅规则进行查询
|
||||
SubscribeDataObj subscribeDataObj = JSONObject.parseObject(subscribe.getJsonObj(), SubscribeDataObj.class);
|
||||
return baseMapper.subscribeList(subscribeDataObj,page);
|
||||
}else {
|
||||
//未设置订阅则使用常规查询
|
||||
return this.queryAppListPage(query,page);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.busi.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SubscribeDataObj {
|
||||
//领域 博主类型
|
||||
private List<String> bloggerTypeCode;
|
||||
//平台
|
||||
private List<String> platformCode;
|
||||
//通告类型
|
||||
private List<String> noticeTypeCode;
|
||||
//关键词
|
||||
private List<String> keywordsList;
|
||||
//奖励类型
|
||||
private List<String> rewardTypeCode;
|
||||
//粉丝数量是否限制
|
||||
private Boolean fansLimit;
|
||||
//粉丝数量上限
|
||||
private Integer fansUp;
|
||||
//粉丝数量下限
|
||||
private Integer fansDown;
|
||||
//费用是否限制
|
||||
private Boolean feeLimit;
|
||||
//费用上限
|
||||
private Double feeDown;
|
||||
//费用下限
|
||||
private Double feeUp;
|
||||
//
|
||||
private Boolean newNotice;
|
||||
private Boolean forkNotice;
|
||||
}
|
@ -197,5 +197,66 @@ order by dbns.create_time desc
|
||||
</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
<select id="subscribeList" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
SELECT
|
||||
dbn.*,
|
||||
dbnv.view_num AS viewNum,
|
||||
su.avatar,
|
||||
su.nick_name AS userNickName
|
||||
FROM
|
||||
dl_busi_notice dbn
|
||||
LEFT JOIN dl_busi_notice_view dbnv ON dbn.id = dbnv.id
|
||||
LEFT JOIN sys_user su ON dbn.user_id = su.user_id
|
||||
WHERE
|
||||
dbn.del_flag = 0
|
||||
AND (dbn.approval_status = '1')
|
||||
<if test="entity.gift!=null and entity.gift!=''">
|
||||
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail != '' )
|
||||
</if>
|
||||
<if test="entity.platformCode!=null and entity.platformCode!=''">
|
||||
AND ( dbn.platform_code =#{entity.platformCode} )
|
||||
</if>
|
||||
<if test="entity.bloggerTypeCode!=null and entity.bloggerTypeCode!=''">
|
||||
AND ( dbn.blogger_types LIKE CONCAT('%',#{entity.bloggerType},'%') )
|
||||
</if>
|
||||
<if test="entity.searchValue!=null and entity.searchValue!=''">
|
||||
AND ( dbn.title LIKE CONCAT('%',#{entity.searchValue},'%') OR
|
||||
dbn.detail LIKE CONCAT('%',#{entity.searchValue},'%') )
|
||||
</if>
|
||||
<if test="entity.rewardType=='money'">
|
||||
AND ( dbn.fee_down IS NOT NULL OR dbn.fee_up IS NOT NULL )
|
||||
</if>
|
||||
<if test="entity.rewardType=='gift'">
|
||||
AND ( dbn.gift_detail IS NOT NULL AND dbn.gift_detail!='' )
|
||||
</if>
|
||||
<if test="entity.fansUp!=null">
|
||||
AND ( dbn.fans_up <=#{entity.fansUp} )
|
||||
</if>
|
||||
<if test="entity.fansDown!=null">
|
||||
AND ( dbn.fans_up >=#{entity.fansDown} )
|
||||
</if>
|
||||
<if test="entity.feeUp!=null">
|
||||
AND ( dbn.fee_up <=#{entity.feeUp} )
|
||||
</if>
|
||||
<if test="entity.feeDown!=null">
|
||||
AND ( dbn.fee_down >=#{entity.feeDown} )
|
||||
</if>
|
||||
ORDER BY
|
||||
<choose>
|
||||
<when test="entity.sortBy=='new'">
|
||||
-- 查最新的 --
|
||||
dbn.create_time DESC
|
||||
</when>
|
||||
<when test="entity.sortBy=='money'">
|
||||
-- 查高奖励 --
|
||||
dbn.fee_up DESC
|
||||
</when>
|
||||
<otherwise>
|
||||
-- 默认正序排列 --
|
||||
dbn.create_time ASC
|
||||
</otherwise>
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user