feat:
1. notice module
This commit is contained in:
@@ -17,14 +17,11 @@ import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserAddressVO;
|
||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||
import org.springblade.modules.customer.service.IUserNoticeService;
|
||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@@ -36,7 +33,7 @@ public class APPUserController {
|
||||
|
||||
private final ICommonUserOrderService orderService;
|
||||
|
||||
private final IUserNoticeService userNoticeService;
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -101,30 +98,27 @@ public class APPUserController {
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/app-notice-page")
|
||||
@GetMapping("/notice-page")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
||||
public R<IPage<AppUserNoticeVO>> appUserNoticeList(Query query) {
|
||||
public R<IPage<AppUserNoticeVO>> noticePage(Query query) {
|
||||
IPage<AppUserNoticeVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query));
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@GetMapping("/app-notread-notice-num")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户未读消息数量")
|
||||
public R<Integer> appNotReadNoticeNum() {
|
||||
return R.data(userNoticeService.appNotReadNoticeNum());
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/app-read-notice")
|
||||
@PostMapping("/notice-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户读取消息", description = "传入request")
|
||||
public R<Boolean> appUserReadNotice(@RequestBody AppUserNoticeRequest request) {
|
||||
return R.status(userNoticeService.appUserReadNotice(request));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/unread-num")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户未读消息数量")
|
||||
public R<Integer> appNotReadNoticeNum() {
|
||||
return R.data(userNoticeService.appNotReadNoticeNum());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||
import org.springblade.modules.customer.service.IUserNoticeService;
|
||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||
import org.springblade.modules.market.manager.MarketUserManager;
|
||||
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
|
||||
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
||||
@@ -31,7 +31,7 @@ public class MarketUserController {
|
||||
|
||||
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
||||
private final MarketUserManager marketUserManager;
|
||||
private final IUserNoticeService userNoticeService;
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
|
||||
@GetMapping("/find-user-benefit-pack-list")
|
||||
|
||||
@@ -52,7 +52,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("blade-regionsinfo/regionsInfo")
|
||||
@RequestMapping("/common/region")
|
||||
@Tag(name = "地区详情表", description = "地区详情表接口")
|
||||
public class CommonRegionsInfoController extends BladeController {
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("blade-useraddress/userAddress")
|
||||
@RequestMapping("/common/address")
|
||||
@Tag(name = "用户地址表", description = "用户地址表接口")
|
||||
public class CommonUserAddressController extends BladeController {
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.controller;
|
||||
package org.springblade.modules.common.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -38,14 +38,12 @@ import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
||||
import org.springblade.modules.customer.wrapper.UserNoticeWrapper;
|
||||
import org.springblade.modules.customer.service.IUserNoticeService;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||
import org.springblade.modules.common.wrapper.CommonUserNoticeWrapper;
|
||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 用户通知 控制器
|
||||
@@ -55,11 +53,11 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("blade-usernotice/userNotice")
|
||||
@RequestMapping("/common/notice")
|
||||
@Tag(name = "用户通知", description = "用户通知接口")
|
||||
public class UserNoticeController extends BladeController {
|
||||
public class CommonUserNoticeController extends BladeController {
|
||||
|
||||
private final IUserNoticeService userNoticeService;
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
/**
|
||||
* 用户通知 详情
|
||||
@@ -67,9 +65,9 @@ public class UserNoticeController extends BladeController {
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "详情", description = "传入userNotice")
|
||||
public R<UserNoticeVO> detail(UserNoticeEntity userNotice) {
|
||||
UserNoticeEntity detail = userNoticeService.getOne(Condition.getQueryWrapper(userNotice));
|
||||
return R.data(UserNoticeWrapper.build().entityVO(detail));
|
||||
public R<CommonUserNoticeVO> detail(CommonUserNoticeEntity userNotice) {
|
||||
CommonUserNoticeEntity detail = userNoticeService.getOne(Condition.getQueryWrapper(userNotice));
|
||||
return R.data(CommonUserNoticeWrapper.build().entityVO(detail));
|
||||
}
|
||||
/**
|
||||
* 用户通知 分页
|
||||
@@ -77,9 +75,9 @@ public class UserNoticeController extends BladeController {
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "分页", description = "传入userNotice")
|
||||
public R<IPage<UserNoticeVO>> list(UserNoticeEntity userNotice, Query query) {
|
||||
IPage<UserNoticeEntity> pages = userNoticeService.page(Condition.getPage(query), Condition.getQueryWrapper(userNotice).orderByDesc("id"));
|
||||
return R.data(UserNoticeWrapper.build().pageVO(pages));
|
||||
public R<IPage<CommonUserNoticeVO>> list(CommonUserNoticeEntity userNotice, Query query) {
|
||||
IPage<CommonUserNoticeEntity> pages = userNoticeService.page(Condition.getPage(query), Condition.getQueryWrapper(userNotice).orderByDesc("id"));
|
||||
return R.data(CommonUserNoticeWrapper.build().pageVO(pages));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,8 +86,8 @@ public class UserNoticeController extends BladeController {
|
||||
@GetMapping("/page")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "分页", description = "传入userNotice")
|
||||
public R<IPage<UserNoticeVO>> page(UserNoticeVO userNotice, Query query) {
|
||||
IPage<UserNoticeVO> pages = userNoticeService.selectUserNoticePage(Condition.getPage(query), userNotice);
|
||||
public R<IPage<CommonUserNoticeVO>> page(CommonUserNoticeVO userNotice, Query query) {
|
||||
IPage<CommonUserNoticeVO> pages = userNoticeService.selectUserNoticePage(Condition.getPage(query), userNotice);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
@@ -99,7 +97,7 @@ public class UserNoticeController extends BladeController {
|
||||
@PostMapping("/save")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "新增", description = "传入userNotice")
|
||||
public R save(@Valid @RequestBody UserNoticeVO userNotice) {
|
||||
public R save(@Valid @RequestBody CommonUserNoticeVO userNotice) {
|
||||
return R.status(userNoticeService.saveUserNotice(userNotice));
|
||||
}
|
||||
|
||||
@@ -109,7 +107,7 @@ public class UserNoticeController extends BladeController {
|
||||
@PostMapping("/update")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "修改", description = "传入userNotice")
|
||||
public R update(@Valid @RequestBody UserNoticeEntity userNotice) {
|
||||
public R update(@Valid @RequestBody CommonUserNoticeEntity userNotice) {
|
||||
return R.status(userNoticeService.updateById(userNotice));
|
||||
}
|
||||
|
||||
@@ -119,7 +117,7 @@ public class UserNoticeController extends BladeController {
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "新增或修改", description = "传入userNotice")
|
||||
public R submit(@Valid @RequestBody UserNoticeEntity userNotice) {
|
||||
public R submit(@Valid @RequestBody CommonUserNoticeEntity userNotice) {
|
||||
return R.status(userNoticeService.saveOrUpdate(userNotice));
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("user-order/order")
|
||||
@RequestMapping("/common/order")
|
||||
@Tag(name = "用户订单", description = "用户订单接口")
|
||||
public class CommonUserOrderController extends BladeController {
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springblade.modules.api.request.CreateOrderRequest;
|
||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||
@@ -41,4 +43,7 @@ public interface AppCommonConvert {
|
||||
|
||||
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
|
||||
|
||||
AppUserNoticeVO convertNoticeEntityToVO(CommonUserNoticeEntity commonUserNoticeEntity);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,10 +23,10 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.mapper;
|
||||
package org.springblade.modules.common.mapper;
|
||||
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import java.util.List;
|
||||
@@ -37,7 +37,7 @@ import java.util.List;
|
||||
* @author BladeX
|
||||
* @since 2026-02-09
|
||||
*/
|
||||
public interface UserNoticeMapper extends BaseMapper<UserNoticeEntity> {
|
||||
public interface CommonUserNoticeMapper extends BaseMapper<CommonUserNoticeEntity> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
@@ -46,7 +46,7 @@ public interface UserNoticeMapper extends BaseMapper<UserNoticeEntity> {
|
||||
* @param userNotice 查询参数
|
||||
* @return List<UserNoticeVO>
|
||||
*/
|
||||
List<UserNoticeVO> selectUserNoticePage(IPage page, UserNoticeVO userNotice);
|
||||
List<CommonUserNoticeVO> selectUserNoticePage(IPage page, CommonUserNoticeVO userNotice);
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?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="org.springblade.modules.customer.mapper.UserNoticeMapper">
|
||||
<mapper namespace="org.springblade.modules.common.mapper.CommonUserNoticeMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="userNoticeResultMap" type="org.springblade.modules.customer.pojo.entity.UserNoticeEntity">
|
||||
<resultMap id="userNoticeResultMap" type="org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity">
|
||||
<result column="id" property="id"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="notice_type" property="noticeType"/>
|
||||
@@ -23,9 +23,9 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.pojo.dto;
|
||||
package org.springblade.modules.common.pojo.dto;
|
||||
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
@@ -38,7 +38,7 @@ import java.io.Serial;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserNoticeDTO extends UserNoticeEntity {
|
||||
public class CommonUserNoticeDTO extends CommonUserNoticeEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.pojo.entity;
|
||||
package org.springblade.modules.common.pojo.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
@@ -32,7 +32,7 @@ import java.util.Date;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springblade.core.mp.base.BaseEntity;
|
||||
import org.springblade.core.tenant.mp.TenantEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ import java.io.Serial;
|
||||
@Schema(description = "UserNotice对象")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class UserNoticeEntity extends BaseEntity {
|
||||
public class CommonUserNoticeEntity extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -23,9 +23,9 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.pojo.vo;
|
||||
package org.springblade.modules.common.pojo.vo;
|
||||
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.io.Serial;
|
||||
@@ -38,7 +38,7 @@ import java.io.Serial;
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserNoticeVO extends UserNoticeEntity {
|
||||
public class CommonUserNoticeVO extends CommonUserNoticeEntity {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -23,16 +23,15 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.service;
|
||||
package org.springblade.modules.common.service;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springblade.core.mp.base.BaseService;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户通知 服务类
|
||||
@@ -40,7 +39,7 @@ import java.util.List;
|
||||
* @author BladeX
|
||||
* @since 2026-02-09
|
||||
*/
|
||||
public interface IUserNoticeService extends BaseService<UserNoticeEntity> {
|
||||
public interface ICommonUserNoticeService extends BaseService<CommonUserNoticeEntity> {
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
@@ -48,12 +47,12 @@ public interface IUserNoticeService extends BaseService<UserNoticeEntity> {
|
||||
* @param userNotice 查询参数
|
||||
* @return IPage<UserNoticeVO>
|
||||
*/
|
||||
IPage<UserNoticeVO> selectUserNoticePage(IPage<UserNoticeVO> page, UserNoticeVO userNotice);
|
||||
IPage<CommonUserNoticeVO> selectUserNoticePage(IPage<CommonUserNoticeVO> page, CommonUserNoticeVO userNotice);
|
||||
|
||||
|
||||
boolean saveUserNotice(@Valid UserNoticeVO userNotice);
|
||||
boolean saveUserNotice(@Valid CommonUserNoticeVO userNotice);
|
||||
|
||||
IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<UserNoticeEntity> page);
|
||||
IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeEntity> page);
|
||||
|
||||
Integer appNotReadNoticeNum();
|
||||
|
||||
@@ -61,7 +60,7 @@ public interface IUserNoticeService extends BaseService<UserNoticeEntity> {
|
||||
|
||||
|
||||
|
||||
IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<UserNoticeEntity> page);
|
||||
IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeEntity> page);
|
||||
|
||||
|
||||
|
||||
@@ -23,18 +23,18 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.service.impl;
|
||||
package org.springblade.modules.common.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||
import org.springblade.modules.customer.convert.AppUserNoticeConvert;
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
||||
import org.springblade.modules.customer.mapper.UserNoticeMapper;
|
||||
import org.springblade.modules.customer.service.IUserNoticeService;
|
||||
import org.springblade.modules.common.convert.AppCommonConvert;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||
import org.springblade.modules.common.mapper.CommonUserNoticeMapper;
|
||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -47,7 +47,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户通知 服务实现类
|
||||
@@ -57,18 +56,18 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, UserNoticeEntity> implements IUserNoticeService {
|
||||
public class CommonUserNoticeServiceImpl extends BaseServiceImpl<CommonUserNoticeMapper, CommonUserNoticeEntity> implements ICommonUserNoticeService {
|
||||
private final IUserService userService;
|
||||
private final static long PAGE_SIZE = 1000L;
|
||||
|
||||
@Override
|
||||
public IPage<UserNoticeVO> selectUserNoticePage(IPage<UserNoticeVO> page, UserNoticeVO userNotice) {
|
||||
public IPage<CommonUserNoticeVO> selectUserNoticePage(IPage<CommonUserNoticeVO> page, CommonUserNoticeVO userNotice) {
|
||||
return page.setRecords(baseMapper.selectUserNoticePage(page, userNotice));
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
@Override
|
||||
public boolean saveUserNotice(UserNoticeVO userNotice) {
|
||||
public boolean saveUserNotice(CommonUserNoticeVO userNotice) {
|
||||
Assert.notNull(userNotice.getNoticeType(), "通知类型不能为空");
|
||||
Assert.notNull(userNotice.getTitle(), "标题不能为空");
|
||||
Assert.notNull(userNotice.getContent(), "内容不能为空");
|
||||
@@ -77,7 +76,7 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
||||
User user = userService.getById(userNotice.getUserId());
|
||||
Assert.notNull(user , "用户不存在");
|
||||
return save(
|
||||
new UserNoticeEntity()
|
||||
new CommonUserNoticeEntity()
|
||||
.setUserId(userNotice.getUserId())
|
||||
.setTitle(userNotice.getTitle())
|
||||
.setContent(userNotice.getContent())
|
||||
@@ -94,7 +93,7 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
||||
// 向上取整
|
||||
long pageNun = (count + PAGE_SIZE - 1) / PAGE_SIZE;
|
||||
|
||||
List<UserNoticeEntity> noticeList = new ArrayList<>();
|
||||
List<CommonUserNoticeEntity> noticeList = new ArrayList<>();
|
||||
for (int i = 0; i < pageNun; i++) {
|
||||
List<Long> userIdList = userService.list(
|
||||
Wrappers.lambdaQuery(User.class)
|
||||
@@ -106,7 +105,7 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
||||
|
||||
userIdList.forEach(userId -> {
|
||||
noticeList.add(
|
||||
new UserNoticeEntity()
|
||||
new CommonUserNoticeEntity()
|
||||
.setUserId(userId)
|
||||
.setTitle(userNotice.getTitle())
|
||||
.setContent(userNotice.getContent())
|
||||
@@ -127,26 +126,26 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<UserNoticeEntity> page) {
|
||||
IPage<UserNoticeEntity> noticeEntityIPage = page(
|
||||
public IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeEntity> page) {
|
||||
IPage<CommonUserNoticeEntity> noticeEntityIPage = page(
|
||||
page,
|
||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.in(UserNoticeEntity::getNoticeType, List.of(0, 1))
|
||||
.orderByAsc(UserNoticeEntity::getHasRead)
|
||||
.orderByDesc(UserNoticeEntity::getCreateTime)
|
||||
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.in(CommonUserNoticeEntity::getNoticeType, List.of(0, 1))
|
||||
.orderByAsc(CommonUserNoticeEntity::getHasRead)
|
||||
.orderByDesc(CommonUserNoticeEntity::getCreateTime)
|
||||
|
||||
);
|
||||
return noticeEntityIPage.convert(AppUserNoticeConvert.INSTANCE::convertNoticeEntityToVO);
|
||||
return noticeEntityIPage.convert(AppCommonConvert.INSTANCE::convertNoticeEntityToVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer appNotReadNoticeNum() {
|
||||
long count = count(
|
||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.eq(UserNoticeEntity::getHasRead, 0)
|
||||
.in(UserNoticeEntity::getNoticeType, List.of(0, 1))
|
||||
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
||||
.in(CommonUserNoticeEntity::getNoticeType, List.of(0, 1))
|
||||
|
||||
);
|
||||
return Math.toIntExact(count);
|
||||
@@ -155,41 +154,41 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
||||
@Override
|
||||
public boolean appUserReadNotice(AppUserNoticeRequest request) {
|
||||
|
||||
UserNoticeEntity userNotice = getById(request.getId());
|
||||
CommonUserNoticeEntity userNotice = getById(request.getId());
|
||||
Assert.notNull(userNotice, "通知不存在");
|
||||
Assert.isTrue(Objects.equals(userNotice.getUserId(), AuthUtil.getUserId()), "无权限阅读其他用户消息");
|
||||
Assert.isTrue(Objects.equals(userNotice.getNoticeType(), 0) || Objects.equals(userNotice.getNoticeType(), 1), "无效消息类型");
|
||||
Assert.isTrue(Objects.equals(userNotice.getHasRead(), 0), "消息已读");
|
||||
return update(
|
||||
Wrappers.lambdaUpdate(UserNoticeEntity.class)
|
||||
.eq(UserNoticeEntity::getId, request.getId())
|
||||
.set(UserNoticeEntity::getHasRead, 1)
|
||||
.set(UserNoticeEntity::getReleaseTime, new Date())
|
||||
Wrappers.lambdaUpdate(CommonUserNoticeEntity.class)
|
||||
.eq(CommonUserNoticeEntity::getId, request.getId())
|
||||
.set(CommonUserNoticeEntity::getHasRead, 1)
|
||||
.set(CommonUserNoticeEntity::getReleaseTime, new Date())
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<UserNoticeEntity> page) {
|
||||
IPage<UserNoticeEntity> noticeEntityIPage = page(
|
||||
public IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeEntity> page) {
|
||||
IPage<CommonUserNoticeEntity> noticeEntityIPage = page(
|
||||
page,
|
||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.in(UserNoticeEntity::getNoticeType, List.of(1 , 2))
|
||||
.orderByAsc(UserNoticeEntity::getHasRead)
|
||||
.orderByDesc(UserNoticeEntity::getCreateTime)
|
||||
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.in(CommonUserNoticeEntity::getNoticeType, List.of(1 , 2))
|
||||
.orderByAsc(CommonUserNoticeEntity::getHasRead)
|
||||
.orderByDesc(CommonUserNoticeEntity::getCreateTime)
|
||||
|
||||
);
|
||||
return noticeEntityIPage.convert(AppUserNoticeConvert.INSTANCE::convertNoticeEntityToVO);
|
||||
return noticeEntityIPage.convert(AppCommonConvert.INSTANCE::convertNoticeEntityToVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer marketNotReadNoticeNum() {
|
||||
long count = count(
|
||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.eq(UserNoticeEntity::getHasRead, 0)
|
||||
.in(UserNoticeEntity::getNoticeType, List.of(1 ,2))
|
||||
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
||||
.in(CommonUserNoticeEntity::getNoticeType, List.of(1 ,2))
|
||||
|
||||
);
|
||||
return Math.toIntExact(count);
|
||||
@@ -197,16 +196,16 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
||||
|
||||
@Override
|
||||
public boolean marketUserReadNotice(AppUserNoticeRequest request) {
|
||||
UserNoticeEntity userNotice = getById(request.getId());
|
||||
CommonUserNoticeEntity userNotice = getById(request.getId());
|
||||
Assert.notNull(userNotice, "通知不存在");
|
||||
Assert.isTrue(Objects.equals(userNotice.getUserId(), AuthUtil.getUserId()), "无权限阅读其他用户消息");
|
||||
Assert.isTrue(Objects.equals(userNotice.getNoticeType(), 1) || Objects.equals(userNotice.getNoticeType(), 2), "无效消息类型");
|
||||
Assert.isTrue(Objects.equals(userNotice.getHasRead(), 0), "消息已读");
|
||||
return update(
|
||||
Wrappers.lambdaUpdate(UserNoticeEntity.class)
|
||||
.eq(UserNoticeEntity::getId, request.getId())
|
||||
.set(UserNoticeEntity::getHasRead, 1)
|
||||
.set(UserNoticeEntity::getReleaseTime, new Date())
|
||||
Wrappers.lambdaUpdate(CommonUserNoticeEntity.class)
|
||||
.eq(CommonUserNoticeEntity::getId, request.getId())
|
||||
.set(CommonUserNoticeEntity::getHasRead, 1)
|
||||
.set(CommonUserNoticeEntity::getReleaseTime, new Date())
|
||||
);
|
||||
}
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.modules.customer.wrapper;
|
||||
package org.springblade.modules.common.wrapper;
|
||||
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -37,15 +37,15 @@ import java.util.Objects;
|
||||
* @author BladeX
|
||||
* @since 2026-02-09
|
||||
*/
|
||||
public class UserNoticeWrapper extends BaseEntityWrapper<UserNoticeEntity, UserNoticeVO> {
|
||||
public class CommonUserNoticeWrapper extends BaseEntityWrapper<CommonUserNoticeEntity, CommonUserNoticeVO> {
|
||||
|
||||
public static UserNoticeWrapper build() {
|
||||
return new UserNoticeWrapper();
|
||||
public static CommonUserNoticeWrapper build() {
|
||||
return new CommonUserNoticeWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserNoticeVO entityVO(UserNoticeEntity userNotice) {
|
||||
UserNoticeVO userNoticeVO = Objects.requireNonNull(BeanUtil.copyProperties(userNotice, UserNoticeVO.class));
|
||||
public CommonUserNoticeVO entityVO(CommonUserNoticeEntity userNotice) {
|
||||
CommonUserNoticeVO userNoticeVO = Objects.requireNonNull(BeanUtil.copyProperties(userNotice, CommonUserNoticeVO.class));
|
||||
|
||||
//User createUser = UserCache.getUser(userNotice.getCreateUser());
|
||||
//User updateUser = UserCache.getUser(userNotice.getUpdateUser());
|
||||
@@ -1,16 +0,0 @@
|
||||
package org.springblade.modules.customer.convert;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface AppUserNoticeConvert {
|
||||
|
||||
AppUserNoticeConvert INSTANCE = Mappers.getMapper(AppUserNoticeConvert.class);
|
||||
|
||||
|
||||
AppUserNoticeVO convertNoticeEntityToVO(UserNoticeEntity userNoticeEntity);
|
||||
}
|
||||
Reference in New Issue
Block a user