通告详情接口
This commit is contained in:
parent
d60d77e4d4
commit
abb0434360
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.busi.query.AppNoticeQuery;
|
||||
@ -159,4 +161,19 @@ public class BusiNoticeController extends BaseController
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序端查询通告详细信息
|
||||
* @author 朱春云
|
||||
* @date 15:39 2025/3/29
|
||||
* @param noticeId 通告id
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
**/
|
||||
@GetMapping("/appGetDetail")
|
||||
@Anonymous
|
||||
public AjaxResult appGetDetail(@RequestParam(name = "noticeId") String noticeId)
|
||||
{
|
||||
JSONObject detail = busiNoticeService.appGetDetail(noticeId);
|
||||
return success(detail);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,112 @@
|
||||
package com.ruoyi.busi.controller;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.busi.domain.BusiUserLove;
|
||||
import com.ruoyi.busi.service.IBusiUserLoveService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 用户关注Controller
|
||||
*
|
||||
* @author 朱春云
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/busi/love")
|
||||
public class BusiUserLoveController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IBusiUserLoveService busiUserLoveService;
|
||||
|
||||
/**
|
||||
* 查询用户关注列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:love:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(BusiUserLove busiUserLove,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize)
|
||||
{
|
||||
Page<BusiUserLove> page = new Page<>(pageNum, pageSize);
|
||||
IPage<BusiUserLove> list = busiUserLoveService.queryListPage(busiUserLove,page);
|
||||
return success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出用户关注列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:love:export')")
|
||||
@Log(title = "用户关注", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BusiUserLove busiUserLove)
|
||||
{
|
||||
List<BusiUserLove> list = busiUserLoveService.list();
|
||||
ExcelUtil<BusiUserLove> util = new ExcelUtil<BusiUserLove>(BusiUserLove.class);
|
||||
util.exportExcel(response, list, "用户关注数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户关注详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:love:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||
{
|
||||
return success(busiUserLoveService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户关注
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:love:add')")
|
||||
@Log(title = "用户关注", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BusiUserLove busiUserLove)
|
||||
{
|
||||
return toAjax(busiUserLoveService.save(busiUserLove));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户关注
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:love:edit')")
|
||||
@Log(title = "用户关注", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BusiUserLove busiUserLove)
|
||||
{
|
||||
return toAjax(busiUserLoveService.updateById(busiUserLove));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户关注
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('busi:love:remove')")
|
||||
@Log(title = "用户关注", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
List<String> list = new ArrayList<>(Arrays.asList(ids));
|
||||
return toAjax(busiUserLoveService.removeByIds(list));
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.ruoyi.busi.domain;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
|
||||
/**
|
||||
* 用户关注对象 dl_busi_user_love
|
||||
*
|
||||
* @author 朱春云
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
@TableName("dl_busi_user_love")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class BusiUserLove extends DlBaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 用户主键 */
|
||||
@Excel(name = "用户主键")
|
||||
private Long userId;
|
||||
|
||||
/** 被关注通告主用户id */
|
||||
@Excel(name = "被关注通告主用户id")
|
||||
private Long loveUserId;
|
||||
|
||||
}
|
@ -34,11 +34,19 @@ public interface BusiNoticeMapper extends BaseMapper<BusiNotice> {
|
||||
|
||||
/**
|
||||
* 小程序端查询通告列表
|
||||
* @author vinjor-M
|
||||
* @date 15:41 2025/3/25
|
||||
* @author vinjor-M
|
||||
* @date 15:41 2025/3/25
|
||||
* @param query TODO
|
||||
* @param page
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.busi.domain.BusiNotice>
|
||||
**/
|
||||
IPage<BusiNoticeVo> queryAppListPage(@Param("entity") AppNoticeQuery query, Page<BusiNotice> page);
|
||||
/**
|
||||
* 小程序端查询通告详细信息
|
||||
* @author 朱春云
|
||||
* @date 15:39 2025/3/29
|
||||
* @param noticeId 通告id
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
**/
|
||||
BusiNoticeVo selectByIdVo(@Param("noticeId") String noticeId);
|
||||
}
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.ruoyi.busi.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.busi.domain.BusiUserLove;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 用户关注Mapper接口
|
||||
*
|
||||
* @author 朱春云
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
@Mapper
|
||||
public interface BusiUserLoveMapper extends BaseMapper<BusiUserLove>
|
||||
{
|
||||
IPage<BusiUserLove> queryListPage(@Param("entity") BusiUserLove entity, Page<BusiUserLove> page);
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.ruoyi.busi.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -63,11 +64,20 @@ public interface IBusiNoticeService extends IService<BusiNotice>
|
||||
|
||||
/**
|
||||
* 小程序端查询通告列表
|
||||
* @author vinjor-M
|
||||
* @date 15:41 2025/3/25
|
||||
* @author vinjor-M
|
||||
* @date 15:41 2025/3/25
|
||||
* @param query TODO
|
||||
* @param page TODO
|
||||
* @param page TODO
|
||||
* @return com.baomidou.mybatisplus.core.metadata.IPage<com.ruoyi.busi.domain.BusiNotice>
|
||||
**/
|
||||
IPage<BusiNoticeVo> queryAppListPage(AppNoticeQuery query, Page<BusiNotice> page);
|
||||
|
||||
/**
|
||||
* 小程序端查询通告详细信息
|
||||
* @author 朱春云
|
||||
* @date 15:39 2025/3/29
|
||||
* @param noticeId 通告id
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
**/
|
||||
JSONObject appGetDetail(String noticeId);
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.ruoyi.busi.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.busi.domain.BusiUserLove;
|
||||
|
||||
/**
|
||||
* 用户关注Service接口
|
||||
*
|
||||
* @author 朱春云
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
public interface IBusiUserLoveService extends IService<BusiUserLove>
|
||||
{
|
||||
IPage<BusiUserLove> queryListPage(BusiUserLove pageReqVO, Page<BusiUserLove> page);
|
||||
}
|
@ -3,11 +3,15 @@ package com.ruoyi.busi.service.impl;
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
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.BusiUserLove;
|
||||
import com.ruoyi.busi.mapper.BusiNoticeSignMapper;
|
||||
import com.ruoyi.busi.query.AppNoticeQuery;
|
||||
import com.ruoyi.busi.service.IBusiUserLoveService;
|
||||
import com.ruoyi.busi.vo.BusiNoticeVo;
|
||||
import com.ruoyi.common.core.domain.DlBaseEntity;
|
||||
|
||||
@ -17,10 +21,16 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.ruoyi.busi.utils.NoticeUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import com.ruoyi.busi.query.BusiNoticeQuery;
|
||||
import com.ruoyi.constant.DictConstants;
|
||||
import com.ruoyi.member.domain.MemberApply;
|
||||
import com.ruoyi.member.service.IMemberApplyService;
|
||||
import com.ruoyi.system.service.ISysDictDataService;
|
||||
import com.ruoyi.system.service.ISysDictTypeService;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -45,6 +55,14 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
private BusiNoticeSignMapper busiNoticeSignMapper;
|
||||
@Autowired
|
||||
private NoticeUtils noticeUtils;
|
||||
@Autowired
|
||||
private IBusiUserLoveService userLoveService;
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
@Autowired
|
||||
private IMemberApplyService memberApplyService;
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Override
|
||||
public IPage<BusiNoticeVo> queryListPage(BusiNoticeQuery query, Page<BusiNotice> page) {
|
||||
@ -222,6 +240,62 @@ public class BusiNoticeServiceImpl extends ServiceImpl<BusiNoticeMapper,BusiNoti
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* 小程序端查询通告详细信息
|
||||
* @author 朱春云
|
||||
* @date 15:39 2025/3/29
|
||||
* @param noticeId 通告id
|
||||
* @return com.ruoyi.common.core.domain.AjaxResult
|
||||
**/
|
||||
@Override
|
||||
public JSONObject appGetDetail(String noticeId) {
|
||||
JSONObject res =new JSONObject();
|
||||
//通告信息
|
||||
BusiNoticeVo detail = busiNoticeMapper.selectByIdVo(noticeId);
|
||||
res.put("noticeDetail",detail);
|
||||
//通告主信息
|
||||
SysUser userDetail = userService.selectUserById(detail.getUserId());
|
||||
JSONObject userDetailJson = new JSONObject();
|
||||
userDetailJson.put("userId",userDetail.getUserId());
|
||||
userDetailJson.put("nickName",userDetail.getNickName());
|
||||
userDetailJson.put("avatar",userDetail.getAvatar());
|
||||
//关联认证表
|
||||
LambdaQueryWrapper<MemberApply> queryWrapperMember =new LambdaQueryWrapper<>();
|
||||
queryWrapperMember.eq(MemberApply::getUserId,userDetail.getUserId()).eq(MemberApply::getApprovalStatus,1).last("limit 1");
|
||||
MemberApply memberApply = memberApplyService.getOne(queryWrapperMember);
|
||||
if (null != memberApply){
|
||||
userDetailJson.put("identityType",dictDataService.selectDictLabel("dl_identity_type",memberApply.getIdentityType()));
|
||||
}
|
||||
res.put("userDetail",userDetailJson);
|
||||
//已报名用户头像
|
||||
List<BusiNoticeSign> signList = busiNoticeSignMapper.selectList(new LambdaQueryWrapper<BusiNoticeSign>().eq(BusiNoticeSign::getNoticeId, noticeId));
|
||||
List<String> signUserAvatarList = signList.stream().map(BusiNoticeSign::getAvatar).collect(Collectors.toList());
|
||||
res.put("signUserAvatarList",signUserAvatarList);
|
||||
//当前用户是否已关注该通告主
|
||||
Long userId=null;
|
||||
try {
|
||||
userId = SecurityUtils.getUserId();
|
||||
}catch (Exception ignored){
|
||||
//未登录状态
|
||||
}
|
||||
res.put("isLove",false);
|
||||
res.put("isSign",false);
|
||||
if (null != userId){
|
||||
LambdaQueryWrapper<BusiUserLove> queryWrapper =new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(BusiUserLove::getUserId,userId).eq(BusiUserLove::getLoveUserId,detail.getUserId());
|
||||
if(userLoveService.getOne(queryWrapper)!=null){
|
||||
//当前用户已关注通告主
|
||||
res.put("isLove",true);
|
||||
}
|
||||
//当前用户是否已报名该通告
|
||||
if(busiNoticeSignMapper.selectOne(new LambdaQueryWrapper<BusiNoticeSign>().eq(BusiNoticeSign::getNoticeId, noticeId).eq(BusiNoticeSign::getUserId, userId).last("limit 1"))!=null){
|
||||
res.put("isSign",true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.busi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.busi.mapper.BusiUserLoveMapper;
|
||||
import com.ruoyi.busi.domain.BusiUserLove;
|
||||
import com.ruoyi.busi.service.IBusiUserLoveService;
|
||||
|
||||
/**
|
||||
* 用户关注Service业务层处理
|
||||
*
|
||||
* @author 朱春云
|
||||
* @date 2025-03-29
|
||||
*/
|
||||
@Service
|
||||
public class BusiUserLoveServiceImpl extends ServiceImpl<BusiUserLoveMapper,BusiUserLove> implements IBusiUserLoveService
|
||||
{
|
||||
@Autowired
|
||||
private BusiUserLoveMapper busiUserLoveMapper;
|
||||
|
||||
@Override
|
||||
public IPage<BusiUserLove> queryListPage(BusiUserLove pageReqVO, Page<BusiUserLove> page) {
|
||||
return busiUserLoveMapper.queryListPage(pageReqVO, page);
|
||||
}
|
||||
}
|
@ -120,5 +120,19 @@
|
||||
</choose>
|
||||
|
||||
</select>
|
||||
<select id="selectByIdVo" resultType="com.ruoyi.busi.vo.BusiNoticeVo">
|
||||
select main.user_id, main.title, main.platform_code, main.province, main.city, main.fee_down, main.fee_up, main.is_self_price, main.gift_detail,
|
||||
main.gift_price, main.end_date, main.brand, main.is_show_brand, main.need_num, main.fans_down, main.fans_up, main.is_eligible, main.pic, main.collect, main.detail, main.images,
|
||||
main.blogger_types, main.is_show_tel, main.wechat, main.tel, main.group_image, main.is_use_coupon, main.approval_status, main.approval_user_id, main.approval_time,
|
||||
main.approval_remark, main.creator, main.create_time, main.updater, main.update_time, main.del_flag,
|
||||
uTable.nick_name as userNickName,ifnull(noticeView.view_num,0) as viewNum,
|
||||
bTable.title as platformName
|
||||
from dl_busi_notice main
|
||||
left join sys_user uTable on main.user_id = uTable.user_id
|
||||
left join dl_base_category bTable on main.platform_code = bTable.code
|
||||
left join dl_busi_notice_view noticeView on noticeView.id = main.id
|
||||
WHERE
|
||||
main.id = #{noticeId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,26 @@
|
||||
<?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.ruoyi.busi.mapper.BusiUserLoveMapper">
|
||||
|
||||
<resultMap type="BusiUserLove" id="BusiUserLoveResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="loveUserId" column="love_user_id" />
|
||||
<result property="creator" column="creator" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBusiUserLoveVo">
|
||||
select id, user_id, love_user_id, creator, create_time from dl_busi_user_love
|
||||
</sql>
|
||||
|
||||
<select id="queryListPage" parameterType="BusiUserLove" resultMap="BusiUserLoveResult">
|
||||
<include refid="selectBusiUserLoveVo"/>
|
||||
<where>
|
||||
<if test="entity.userId != null "> and user_id = #{entity.userId}</if>
|
||||
<if test="entity.loveUserId != null "> and love_user_id = #{entity.loveUserId}</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user