feat:
1. notice module
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
|
|
||||||
DROP TABLE IF EXISTS user_notice;
|
DROP TABLE IF EXISTS user_notice;
|
||||||
CREATE TABLE user_notice
|
CREATE TABLE user_notice
|
||||||
(
|
(
|
||||||
id int8 NOT NULL PRIMARY KEY, -- 主键
|
id int8 NOT NULL PRIMARY KEY, -- 主键
|
||||||
user_id int8 DEFAULT 0 NOT NULL, -- 用户id
|
user_id int8 NOT NULL, -- 用户id
|
||||||
notice_type int4 DEFAULT 0 NOT NULL, -- 通知类型 0-系统通知 1-app通知 2-market通知
|
notice_type int4 DEFAULT 0 NOT NULL, -- 通知类型 0-系统通知 1-app通知 2-market通知
|
||||||
|
module_type int4 NULL, -- 业务模块
|
||||||
has_read int4 DEFAULT 0 NOT NULL, -- 是否已读 0-否 1-是
|
has_read int4 DEFAULT 0 NOT NULL, -- 是否已读 0-否 1-是
|
||||||
release_time timestamp(6) NULL, -- 阅读时间
|
release_time timestamp(6) NULL, -- 阅读时间
|
||||||
title VARCHAR(100) NULL, -- 标题
|
title VARCHAR(100) NULL, -- 标题
|
||||||
@@ -23,6 +23,7 @@ COMMENT ON TABLE user_notice IS '用户通知';
|
|||||||
COMMENT ON COLUMN user_notice.id IS '主键';
|
COMMENT ON COLUMN user_notice.id IS '主键';
|
||||||
COMMENT ON COLUMN user_notice.user_id IS '用户id';
|
COMMENT ON COLUMN user_notice.user_id IS '用户id';
|
||||||
COMMENT ON COLUMN user_notice.notice_type IS '通知类型 0-系统通知 1-app通知 2-market通知';
|
COMMENT ON COLUMN user_notice.notice_type IS '通知类型 0-系统通知 1-app通知 2-market通知';
|
||||||
|
COMMENT ON COLUMN user_notice.module_type IS '业务模块类型';
|
||||||
COMMENT ON COLUMN user_notice.has_read IS '是否已读 0-否 1-是';
|
COMMENT ON COLUMN user_notice.has_read IS '是否已读 0-否 1-是';
|
||||||
COMMENT ON COLUMN user_notice.release_time IS '阅读时间';
|
COMMENT ON COLUMN user_notice.release_time IS '阅读时间';
|
||||||
COMMENT ON COLUMN user_notice.title IS '标题';
|
COMMENT ON COLUMN user_notice.title IS '标题';
|
||||||
@@ -40,18 +41,38 @@ CREATE INDEX CONCURRENTLY idx_user_notice_opt ON user_notice (user_id, has_read
|
|||||||
|
|
||||||
CREATE INDEX CONCURRENTLY idx_user_notice_count ON user_notice (user_id, notice_type, has_read) WHERE is_deleted = 0;
|
CREATE INDEX CONCURRENTLY idx_user_notice_count ON user_notice (user_id, notice_type, has_read) WHERE is_deleted = 0;
|
||||||
|
|
||||||
alter table user_notice owner to yicha1lu;
|
|
||||||
|
|
||||||
---- 后台页面菜单
|
---- 后台页面菜单
|
||||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2016444412729917441, 0, 'customer', '用户配置', 'menu', '/customer', 'iconfont iconicon_subordinate', 9, 1, -1, 1, '', '', 0);
|
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
|
||||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787265, 2016444412729917441, 'userNotice', '用户通知', 'menu', '/customer/userNotice', null, 1, 1, 0, 1, null, null, 0);
|
remark, is_deleted)
|
||||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/customer/userNotice/add', 'plus', 1, 2, 1, 1, null, null, 0);
|
VALUES (2016444412729917441, 0, 'customer', '用户配置', 'menu', '/customer', 'iconfont iconicon_subordinate', 9, 1, -1,
|
||||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/customer/userNotice/edit', 'form', 2, 2, 2, 1, null, null, 0);
|
1, '', '', 0);
|
||||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete', '/api/blade-usernotice/userNotice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
|
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
|
||||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/customer/userNotice/view', 'file-text', 4, 2, 2, 1, null, null, 0);
|
remark, is_deleted)
|
||||||
|
VALUES (2020763647899787265, 2016444412729917441, 'userNotice', '用户通知', 'menu', '/customer/userNotice', null, 1, 1,
|
||||||
|
0, 1, null, null, 0);
|
||||||
|
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
|
||||||
|
remark, is_deleted)
|
||||||
|
VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/customer/userNotice/add', 'plus',
|
||||||
|
1, 2, 1, 1, null, null, 0);
|
||||||
|
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
|
||||||
|
remark, is_deleted)
|
||||||
|
VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/customer/userNotice/edit',
|
||||||
|
'form', 2, 2, 2, 1, null, null, 0);
|
||||||
|
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
|
||||||
|
remark, is_deleted)
|
||||||
|
VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete',
|
||||||
|
'/api/blade-usernotice/userNotice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
|
||||||
|
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component,
|
||||||
|
remark, is_deleted)
|
||||||
|
VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/customer/userNotice/view',
|
||||||
|
'file-text', 4, 2, 2, 1, null, null, 0);
|
||||||
|
|
||||||
--- 后台系统参数-字典
|
--- 后台系统参数-字典
|
||||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2020766458167353346, 0, 'app_notice_type', '-1', 'app通知类型', 28, '', 0, 1, 0);
|
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2020766503033823233, 2020766458167353346, 'app_notice_type', '0', '系统通知', 0, '', 0, 1, 0);
|
VALUES (2020766458167353346, 0, 'app_notice_type', '-1', 'app通知类型', 28, '', 0, 1, 0);
|
||||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2020766543760515074, 2020766458167353346, 'app_notice_type', '1', 'app通知', 1, '', 0, 1, 0);
|
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2020766604569534466, 2020766458167353346, 'app_notice_type', '2', 'market通知', 2, '', 0, 1, 0);
|
VALUES (2020766503033823233, 2020766458167353346, 'app_notice_type', '0', '系统通知', 0, '', 0, 1, 0);
|
||||||
|
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||||
|
VALUES (2020766543760515074, 2020766458167353346, 'app_notice_type', '1', 'app通知', 1, '', 0, 1, 0);
|
||||||
|
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted)
|
||||||
|
VALUES (2020766604569534466, 2020766458167353346, 'app_notice_type', '2', 'market通知', 2, '', 0, 1, 0);
|
||||||
|
|||||||
@@ -17,14 +17,11 @@ import org.springblade.modules.api.response.CreateOrderResponse;
|
|||||||
import org.springblade.modules.api.response.PaymentResponse;
|
import org.springblade.modules.api.response.PaymentResponse;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
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.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.springblade.modules.system.service.IUserService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Hidden
|
@Hidden
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@@ -36,7 +33,7 @@ public class APPUserController {
|
|||||||
|
|
||||||
private final ICommonUserOrderService orderService;
|
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)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
@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));
|
IPage<AppUserNoticeVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query));
|
||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/app-notread-notice-num")
|
|
||||||
@ApiOperationSupport(order = 6)
|
|
||||||
@Operation(summary = "用户未读消息数量")
|
|
||||||
public R<Integer> appNotReadNoticeNum() {
|
|
||||||
return R.data(userNoticeService.appNotReadNoticeNum());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@PostMapping("/notice-detail")
|
||||||
@PostMapping("/app-read-notice")
|
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "用户读取消息", description = "传入request")
|
@Operation(summary = "用户读取消息", description = "传入request")
|
||||||
public R<Boolean> appUserReadNotice(@RequestBody AppUserNoticeRequest request) {
|
public R<Boolean> appUserReadNotice(@RequestBody AppUserNoticeRequest request) {
|
||||||
return R.status(userNoticeService.appUserReadNotice(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.core.tool.api.R;
|
||||||
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
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.market.manager.MarketUserManager;
|
||||||
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
|
import org.springblade.modules.api.vo.MarketBenefitPackageVO;
|
||||||
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
||||||
@@ -31,7 +31,7 @@ public class MarketUserController {
|
|||||||
|
|
||||||
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
||||||
private final MarketUserManager marketUserManager;
|
private final MarketUserManager marketUserManager;
|
||||||
private final IUserNoticeService userNoticeService;
|
private final ICommonUserNoticeService userNoticeService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/find-user-benefit-pack-list")
|
@GetMapping("/find-user-benefit-pack-list")
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("blade-regionsinfo/regionsInfo")
|
@RequestMapping("/common/region")
|
||||||
@Tag(name = "地区详情表", description = "地区详情表接口")
|
@Tag(name = "地区详情表", description = "地区详情表接口")
|
||||||
public class CommonRegionsInfoController extends BladeController {
|
public class CommonRegionsInfoController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ import org.springblade.core.boot.ctrl.BladeController;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("blade-useraddress/userAddress")
|
@RequestMapping("/common/address")
|
||||||
@Tag(name = "用户地址表", description = "用户地址表接口")
|
@Tag(name = "用户地址表", description = "用户地址表接口")
|
||||||
public class CommonUserAddressController extends BladeController {
|
public class CommonUserAddressController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* 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.tags.Tag;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
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.springblade.core.tool.utils.Func;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
import org.springblade.modules.customer.wrapper.UserNoticeWrapper;
|
import org.springblade.modules.common.wrapper.CommonUserNoticeWrapper;
|
||||||
import org.springblade.modules.customer.service.IUserNoticeService;
|
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||||
import org.springblade.core.boot.ctrl.BladeController;
|
import org.springblade.core.boot.ctrl.BladeController;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户通知 控制器
|
* 用户通知 控制器
|
||||||
@@ -55,11 +53,11 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("blade-usernotice/userNotice")
|
@RequestMapping("/common/notice")
|
||||||
@Tag(name = "用户通知", description = "用户通知接口")
|
@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")
|
@GetMapping("/detail")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@Operation(summary = "详情", description = "传入userNotice")
|
@Operation(summary = "详情", description = "传入userNotice")
|
||||||
public R<UserNoticeVO> detail(UserNoticeEntity userNotice) {
|
public R<CommonUserNoticeVO> detail(CommonUserNoticeEntity userNotice) {
|
||||||
UserNoticeEntity detail = userNoticeService.getOne(Condition.getQueryWrapper(userNotice));
|
CommonUserNoticeEntity detail = userNoticeService.getOne(Condition.getQueryWrapper(userNotice));
|
||||||
return R.data(UserNoticeWrapper.build().entityVO(detail));
|
return R.data(CommonUserNoticeWrapper.build().entityVO(detail));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 用户通知 分页
|
* 用户通知 分页
|
||||||
@@ -77,9 +75,9 @@ public class UserNoticeController extends BladeController {
|
|||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@Operation(summary = "分页", description = "传入userNotice")
|
@Operation(summary = "分页", description = "传入userNotice")
|
||||||
public R<IPage<UserNoticeVO>> list(UserNoticeEntity userNotice, Query query) {
|
public R<IPage<CommonUserNoticeVO>> list(CommonUserNoticeEntity userNotice, Query query) {
|
||||||
IPage<UserNoticeEntity> pages = userNoticeService.page(Condition.getPage(query), Condition.getQueryWrapper(userNotice).orderByDesc("id"));
|
IPage<CommonUserNoticeEntity> pages = userNoticeService.page(Condition.getPage(query), Condition.getQueryWrapper(userNotice).orderByDesc("id"));
|
||||||
return R.data(UserNoticeWrapper.build().pageVO(pages));
|
return R.data(CommonUserNoticeWrapper.build().pageVO(pages));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,8 +86,8 @@ public class UserNoticeController extends BladeController {
|
|||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 3)
|
||||||
@Operation(summary = "分页", description = "传入userNotice")
|
@Operation(summary = "分页", description = "传入userNotice")
|
||||||
public R<IPage<UserNoticeVO>> page(UserNoticeVO userNotice, Query query) {
|
public R<IPage<CommonUserNoticeVO>> page(CommonUserNoticeVO userNotice, Query query) {
|
||||||
IPage<UserNoticeVO> pages = userNoticeService.selectUserNoticePage(Condition.getPage(query), userNotice);
|
IPage<CommonUserNoticeVO> pages = userNoticeService.selectUserNoticePage(Condition.getPage(query), userNotice);
|
||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +97,7 @@ public class UserNoticeController extends BladeController {
|
|||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
@ApiOperationSupport(order = 4)
|
@ApiOperationSupport(order = 4)
|
||||||
@Operation(summary = "新增", description = "传入userNotice")
|
@Operation(summary = "新增", description = "传入userNotice")
|
||||||
public R save(@Valid @RequestBody UserNoticeVO userNotice) {
|
public R save(@Valid @RequestBody CommonUserNoticeVO userNotice) {
|
||||||
return R.status(userNoticeService.saveUserNotice(userNotice));
|
return R.status(userNoticeService.saveUserNotice(userNotice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +107,7 @@ public class UserNoticeController extends BladeController {
|
|||||||
@PostMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperationSupport(order = 5)
|
@ApiOperationSupport(order = 5)
|
||||||
@Operation(summary = "修改", description = "传入userNotice")
|
@Operation(summary = "修改", description = "传入userNotice")
|
||||||
public R update(@Valid @RequestBody UserNoticeEntity userNotice) {
|
public R update(@Valid @RequestBody CommonUserNoticeEntity userNotice) {
|
||||||
return R.status(userNoticeService.updateById(userNotice));
|
return R.status(userNoticeService.updateById(userNotice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,7 +117,7 @@ public class UserNoticeController extends BladeController {
|
|||||||
@PostMapping("/submit")
|
@PostMapping("/submit")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "新增或修改", description = "传入userNotice")
|
@Operation(summary = "新增或修改", description = "传入userNotice")
|
||||||
public R submit(@Valid @RequestBody UserNoticeEntity userNotice) {
|
public R submit(@Valid @RequestBody CommonUserNoticeEntity userNotice) {
|
||||||
return R.status(userNoticeService.saveOrUpdate(userNotice));
|
return R.status(userNoticeService.saveOrUpdate(userNotice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
|||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@RequestMapping("user-order/order")
|
@RequestMapping("/common/order")
|
||||||
@Tag(name = "用户订单", description = "用户订单接口")
|
@Tag(name = "用户订单", description = "用户订单接口")
|
||||||
public class CommonUserOrderController extends BladeController {
|
public class CommonUserOrderController extends BladeController {
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import org.mapstruct.Mapper;
|
|||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
import org.springblade.modules.api.request.CreateOrderRequest;
|
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.api.vo.CommonUserOrderApiVO;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonRegionsInfoEntity;
|
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.entity.CommonUserOrderEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserOrderVO;
|
||||||
@@ -41,4 +43,7 @@ public interface AppCommonConvert {
|
|||||||
|
|
||||||
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
|
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
|
||||||
|
|
||||||
|
AppUserNoticeVO convertNoticeEntityToVO(CommonUserNoticeEntity commonUserNoticeEntity);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* 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.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -37,7 +37,7 @@ import java.util.List;
|
|||||||
* @author BladeX
|
* @author BladeX
|
||||||
* @since 2026-02-09
|
* @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 查询参数
|
* @param userNotice 查询参数
|
||||||
* @return List<UserNoticeVO>
|
* @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"?>
|
<?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">
|
<!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="id" property="id"/>
|
||||||
<result column="user_id" property="userId"/>
|
<result column="user_id" property="userId"/>
|
||||||
<result column="notice_type" property="noticeType"/>
|
<result column="notice_type" property="noticeType"/>
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* 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.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -38,7 +38,7 @@ import java.io.Serial;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class UserNoticeDTO extends UserNoticeEntity {
|
public class CommonUserNoticeDTO extends CommonUserNoticeEntity {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
*/
|
*/
|
||||||
package org.springblade.modules.customer.pojo.entity;
|
package org.springblade.modules.common.pojo.entity;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
@@ -32,7 +32,7 @@ import java.util.Date;
|
|||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
import org.springblade.core.mp.base.BaseEntity;
|
import org.springblade.core.mp.base.BaseEntity;
|
||||||
import org.springblade.core.tenant.mp.TenantEntity;
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,7 +46,7 @@ import java.io.Serial;
|
|||||||
@Schema(description = "UserNotice对象")
|
@Schema(description = "UserNotice对象")
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class UserNoticeEntity extends BaseEntity {
|
public class CommonUserNoticeEntity extends BaseEntity {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@@ -23,9 +23,9 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* 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.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
@@ -38,7 +38,7 @@ import java.io.Serial;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class UserNoticeVO extends UserNoticeEntity {
|
public class CommonUserNoticeVO extends CommonUserNoticeEntity {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@@ -23,16 +23,15 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* Author: Chill Zhuang (bladejava@qq.com)
|
||||||
*/
|
*/
|
||||||
package org.springblade.modules.customer.service;
|
package org.springblade.modules.common.service;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import org.springblade.core.mp.base.BaseService;
|
import org.springblade.core.mp.base.BaseService;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户通知 服务类
|
* 用户通知 服务类
|
||||||
@@ -40,7 +39,7 @@ import java.util.List;
|
|||||||
* @author BladeX
|
* @author BladeX
|
||||||
* @since 2026-02-09
|
* @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 查询参数
|
* @param userNotice 查询参数
|
||||||
* @return IPage<UserNoticeVO>
|
* @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();
|
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>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* 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 com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
import org.springblade.modules.api.request.AppUserNoticeRequest;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
||||||
import org.springblade.modules.customer.convert.AppUserNoticeConvert;
|
import org.springblade.modules.common.convert.AppCommonConvert;
|
||||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
import org.springblade.modules.customer.mapper.UserNoticeMapper;
|
import org.springblade.modules.common.mapper.CommonUserNoticeMapper;
|
||||||
import org.springblade.modules.customer.service.IUserNoticeService;
|
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
import org.springblade.modules.system.service.IUserService;
|
import org.springblade.modules.system.service.IUserService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -47,7 +47,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户通知 服务实现类
|
* 用户通知 服务实现类
|
||||||
@@ -57,18 +56,18 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@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 IUserService userService;
|
||||||
private final static long PAGE_SIZE = 1000L;
|
private final static long PAGE_SIZE = 1000L;
|
||||||
|
|
||||||
@Override
|
@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));
|
return page.setRecords(baseMapper.selectUserNoticePage(page, userNotice));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = RuntimeException.class)
|
@Transactional(rollbackFor = RuntimeException.class)
|
||||||
@Override
|
@Override
|
||||||
public boolean saveUserNotice(UserNoticeVO userNotice) {
|
public boolean saveUserNotice(CommonUserNoticeVO userNotice) {
|
||||||
Assert.notNull(userNotice.getNoticeType(), "通知类型不能为空");
|
Assert.notNull(userNotice.getNoticeType(), "通知类型不能为空");
|
||||||
Assert.notNull(userNotice.getTitle(), "标题不能为空");
|
Assert.notNull(userNotice.getTitle(), "标题不能为空");
|
||||||
Assert.notNull(userNotice.getContent(), "内容不能为空");
|
Assert.notNull(userNotice.getContent(), "内容不能为空");
|
||||||
@@ -77,7 +76,7 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
|||||||
User user = userService.getById(userNotice.getUserId());
|
User user = userService.getById(userNotice.getUserId());
|
||||||
Assert.notNull(user , "用户不存在");
|
Assert.notNull(user , "用户不存在");
|
||||||
return save(
|
return save(
|
||||||
new UserNoticeEntity()
|
new CommonUserNoticeEntity()
|
||||||
.setUserId(userNotice.getUserId())
|
.setUserId(userNotice.getUserId())
|
||||||
.setTitle(userNotice.getTitle())
|
.setTitle(userNotice.getTitle())
|
||||||
.setContent(userNotice.getContent())
|
.setContent(userNotice.getContent())
|
||||||
@@ -94,7 +93,7 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
|||||||
// 向上取整
|
// 向上取整
|
||||||
long pageNun = (count + PAGE_SIZE - 1) / PAGE_SIZE;
|
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++) {
|
for (int i = 0; i < pageNun; i++) {
|
||||||
List<Long> userIdList = userService.list(
|
List<Long> userIdList = userService.list(
|
||||||
Wrappers.lambdaQuery(User.class)
|
Wrappers.lambdaQuery(User.class)
|
||||||
@@ -106,7 +105,7 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
|||||||
|
|
||||||
userIdList.forEach(userId -> {
|
userIdList.forEach(userId -> {
|
||||||
noticeList.add(
|
noticeList.add(
|
||||||
new UserNoticeEntity()
|
new CommonUserNoticeEntity()
|
||||||
.setUserId(userId)
|
.setUserId(userId)
|
||||||
.setTitle(userNotice.getTitle())
|
.setTitle(userNotice.getTitle())
|
||||||
.setContent(userNotice.getContent())
|
.setContent(userNotice.getContent())
|
||||||
@@ -127,26 +126,26 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<UserNoticeEntity> page) {
|
public IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeEntity> page) {
|
||||||
IPage<UserNoticeEntity> noticeEntityIPage = page(
|
IPage<CommonUserNoticeEntity> noticeEntityIPage = page(
|
||||||
page,
|
page,
|
||||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||||
.in(UserNoticeEntity::getNoticeType, List.of(0, 1))
|
.in(CommonUserNoticeEntity::getNoticeType, List.of(0, 1))
|
||||||
.orderByAsc(UserNoticeEntity::getHasRead)
|
.orderByAsc(CommonUserNoticeEntity::getHasRead)
|
||||||
.orderByDesc(UserNoticeEntity::getCreateTime)
|
.orderByDesc(CommonUserNoticeEntity::getCreateTime)
|
||||||
|
|
||||||
);
|
);
|
||||||
return noticeEntityIPage.convert(AppUserNoticeConvert.INSTANCE::convertNoticeEntityToVO);
|
return noticeEntityIPage.convert(AppCommonConvert.INSTANCE::convertNoticeEntityToVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer appNotReadNoticeNum() {
|
public Integer appNotReadNoticeNum() {
|
||||||
long count = count(
|
long count = count(
|
||||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||||
.eq(UserNoticeEntity::getHasRead, 0)
|
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
||||||
.in(UserNoticeEntity::getNoticeType, List.of(0, 1))
|
.in(CommonUserNoticeEntity::getNoticeType, List.of(0, 1))
|
||||||
|
|
||||||
);
|
);
|
||||||
return Math.toIntExact(count);
|
return Math.toIntExact(count);
|
||||||
@@ -155,41 +154,41 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
|||||||
@Override
|
@Override
|
||||||
public boolean appUserReadNotice(AppUserNoticeRequest request) {
|
public boolean appUserReadNotice(AppUserNoticeRequest request) {
|
||||||
|
|
||||||
UserNoticeEntity userNotice = getById(request.getId());
|
CommonUserNoticeEntity userNotice = getById(request.getId());
|
||||||
Assert.notNull(userNotice, "通知不存在");
|
Assert.notNull(userNotice, "通知不存在");
|
||||||
Assert.isTrue(Objects.equals(userNotice.getUserId(), AuthUtil.getUserId()), "无权限阅读其他用户消息");
|
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.getNoticeType(), 0) || Objects.equals(userNotice.getNoticeType(), 1), "无效消息类型");
|
||||||
Assert.isTrue(Objects.equals(userNotice.getHasRead(), 0), "消息已读");
|
Assert.isTrue(Objects.equals(userNotice.getHasRead(), 0), "消息已读");
|
||||||
return update(
|
return update(
|
||||||
Wrappers.lambdaUpdate(UserNoticeEntity.class)
|
Wrappers.lambdaUpdate(CommonUserNoticeEntity.class)
|
||||||
.eq(UserNoticeEntity::getId, request.getId())
|
.eq(CommonUserNoticeEntity::getId, request.getId())
|
||||||
.set(UserNoticeEntity::getHasRead, 1)
|
.set(CommonUserNoticeEntity::getHasRead, 1)
|
||||||
.set(UserNoticeEntity::getReleaseTime, new Date())
|
.set(CommonUserNoticeEntity::getReleaseTime, new Date())
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<UserNoticeEntity> page) {
|
public IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeEntity> page) {
|
||||||
IPage<UserNoticeEntity> noticeEntityIPage = page(
|
IPage<CommonUserNoticeEntity> noticeEntityIPage = page(
|
||||||
page,
|
page,
|
||||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||||
.in(UserNoticeEntity::getNoticeType, List.of(1 , 2))
|
.in(CommonUserNoticeEntity::getNoticeType, List.of(1 , 2))
|
||||||
.orderByAsc(UserNoticeEntity::getHasRead)
|
.orderByAsc(CommonUserNoticeEntity::getHasRead)
|
||||||
.orderByDesc(UserNoticeEntity::getCreateTime)
|
.orderByDesc(CommonUserNoticeEntity::getCreateTime)
|
||||||
|
|
||||||
);
|
);
|
||||||
return noticeEntityIPage.convert(AppUserNoticeConvert.INSTANCE::convertNoticeEntityToVO);
|
return noticeEntityIPage.convert(AppCommonConvert.INSTANCE::convertNoticeEntityToVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer marketNotReadNoticeNum() {
|
public Integer marketNotReadNoticeNum() {
|
||||||
long count = count(
|
long count = count(
|
||||||
Wrappers.lambdaQuery(UserNoticeEntity.class)
|
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
||||||
.eq(UserNoticeEntity::getUserId, AuthUtil.getUserId())
|
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||||
.eq(UserNoticeEntity::getHasRead, 0)
|
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
||||||
.in(UserNoticeEntity::getNoticeType, List.of(1 ,2))
|
.in(CommonUserNoticeEntity::getNoticeType, List.of(1 ,2))
|
||||||
|
|
||||||
);
|
);
|
||||||
return Math.toIntExact(count);
|
return Math.toIntExact(count);
|
||||||
@@ -197,16 +196,16 @@ public class UserNoticeServiceImpl extends BaseServiceImpl<UserNoticeMapper, Use
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean marketUserReadNotice(AppUserNoticeRequest request) {
|
public boolean marketUserReadNotice(AppUserNoticeRequest request) {
|
||||||
UserNoticeEntity userNotice = getById(request.getId());
|
CommonUserNoticeEntity userNotice = getById(request.getId());
|
||||||
Assert.notNull(userNotice, "通知不存在");
|
Assert.notNull(userNotice, "通知不存在");
|
||||||
Assert.isTrue(Objects.equals(userNotice.getUserId(), AuthUtil.getUserId()), "无权限阅读其他用户消息");
|
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.getNoticeType(), 1) || Objects.equals(userNotice.getNoticeType(), 2), "无效消息类型");
|
||||||
Assert.isTrue(Objects.equals(userNotice.getHasRead(), 0), "消息已读");
|
Assert.isTrue(Objects.equals(userNotice.getHasRead(), 0), "消息已读");
|
||||||
return update(
|
return update(
|
||||||
Wrappers.lambdaUpdate(UserNoticeEntity.class)
|
Wrappers.lambdaUpdate(CommonUserNoticeEntity.class)
|
||||||
.eq(UserNoticeEntity::getId, request.getId())
|
.eq(CommonUserNoticeEntity::getId, request.getId())
|
||||||
.set(UserNoticeEntity::getHasRead, 1)
|
.set(CommonUserNoticeEntity::getHasRead, 1)
|
||||||
.set(UserNoticeEntity::getReleaseTime, new Date())
|
.set(CommonUserNoticeEntity::getReleaseTime, new Date())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,12 +23,12 @@
|
|||||||
* <p>
|
* <p>
|
||||||
* Author: Chill Zhuang (bladejava@qq.com)
|
* 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.mp.support.BaseEntityWrapper;
|
||||||
import org.springblade.core.tool.utils.BeanUtil;
|
import org.springblade.core.tool.utils.BeanUtil;
|
||||||
import org.springblade.modules.customer.pojo.entity.UserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.customer.pojo.vo.UserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,15 +37,15 @@ import java.util.Objects;
|
|||||||
* @author BladeX
|
* @author BladeX
|
||||||
* @since 2026-02-09
|
* @since 2026-02-09
|
||||||
*/
|
*/
|
||||||
public class UserNoticeWrapper extends BaseEntityWrapper<UserNoticeEntity, UserNoticeVO> {
|
public class CommonUserNoticeWrapper extends BaseEntityWrapper<CommonUserNoticeEntity, CommonUserNoticeVO> {
|
||||||
|
|
||||||
public static UserNoticeWrapper build() {
|
public static CommonUserNoticeWrapper build() {
|
||||||
return new UserNoticeWrapper();
|
return new CommonUserNoticeWrapper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserNoticeVO entityVO(UserNoticeEntity userNotice) {
|
public CommonUserNoticeVO entityVO(CommonUserNoticeEntity userNotice) {
|
||||||
UserNoticeVO userNoticeVO = Objects.requireNonNull(BeanUtil.copyProperties(userNotice, UserNoticeVO.class));
|
CommonUserNoticeVO userNoticeVO = Objects.requireNonNull(BeanUtil.copyProperties(userNotice, CommonUserNoticeVO.class));
|
||||||
|
|
||||||
//User createUser = UserCache.getUser(userNotice.getCreateUser());
|
//User createUser = UserCache.getUser(userNotice.getCreateUser());
|
||||||
//User updateUser = UserCache.getUser(userNotice.getUpdateUser());
|
//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