feat:
1. notice module
This commit is contained in:
@@ -6,7 +6,6 @@ CREATE TABLE user_notice
|
|||||||
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, -- 业务模块
|
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, -- 阅读时间
|
|
||||||
title VARCHAR(100) NULL, -- 标题
|
title VARCHAR(100) NULL, -- 标题
|
||||||
content TEXT NULL, -- 内容
|
content TEXT NULL, -- 内容
|
||||||
remarks varchar(200) NULL, -- 备注
|
remarks varchar(200) NULL, -- 备注
|
||||||
@@ -25,7 +24,6 @@ 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.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.title IS '标题';
|
COMMENT ON COLUMN user_notice.title IS '标题';
|
||||||
COMMENT ON COLUMN user_notice.content IS '内容';
|
COMMENT ON COLUMN user_notice.content IS '内容';
|
||||||
COMMENT ON COLUMN user_notice.remarks IS '备注';
|
COMMENT ON COLUMN user_notice.remarks IS '备注';
|
||||||
|
|||||||
@@ -40,8 +40,8 @@ public class APPCommonController {
|
|||||||
/**
|
/**
|
||||||
* 获取省市区列表
|
* 获取省市区列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/find-region-list")
|
@GetMapping("/region-list")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 2)
|
||||||
@Operation(summary = "获取省市区列表")
|
@Operation(summary = "获取省市区列表")
|
||||||
public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "父级id不能小于0") Long pid ,
|
public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "父级id不能小于0") Long pid ,
|
||||||
@RequestParam @Min(value = 1 , message = "只能选到省") @Max(value = 4 , message = "只能选到街道") Integer level) {
|
@RequestParam @Min(value = 1 , message = "只能选到省") @Max(value = 4 , message = "只能选到街道") Integer level) {
|
||||||
|
|||||||
@@ -10,18 +10,21 @@ import lombok.AllArgsConstructor;
|
|||||||
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Condition;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
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.NoticeDetailRequest;
|
||||||
import org.springblade.modules.api.request.CreateOrderRequest;
|
import org.springblade.modules.api.request.CreateOrderRequest;
|
||||||
import org.springblade.modules.api.request.PaymentRequest;
|
import org.springblade.modules.api.request.PaymentRequest;
|
||||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
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.CommonUserNoticeApiVO;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
|
||||||
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
import org.springblade.modules.api.vo.CommonUserOrderApiVO;
|
||||||
import org.springblade.modules.common.service.ICommonUserOrderService;
|
import org.springblade.modules.common.service.ICommonUserOrderService;
|
||||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
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
|
||||||
@@ -98,27 +101,35 @@ public class APPUserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/notice-page")
|
@GetMapping("/system-notice")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 7)
|
||||||
|
@Operation(summary = "APP系统消息列表")
|
||||||
|
public R<List<CommonUserNoticeApiVO>> systemNotice() {
|
||||||
|
return R.data(userNoticeService.appSystemNoticeList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/user-notice")
|
||||||
|
@ApiOperationSupport(order = 8)
|
||||||
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
||||||
public R<IPage<AppUserNoticeVO>> noticePage(Query query) {
|
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||||
IPage<AppUserNoticeVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query));
|
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/notice-detail")
|
@PostMapping("/notice-detail")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 9)
|
||||||
@Operation(summary = "用户读取消息", description = "传入request")
|
@Operation(summary = "用户读取消息", description = "传入request")
|
||||||
public R<Boolean> noticeDetail(@RequestBody AppUserNoticeRequest request) {
|
public R<CommonUserNoticeDetailApiVO> noticeDetail(@RequestBody @Valid NoticeDetailRequest request) {
|
||||||
return R.status(userNoticeService.appUserReadNotice(request));
|
return R.data(userNoticeService.userNoticeDetail(request.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unread-num")
|
@GetMapping("/unread")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 10)
|
||||||
@Operation(summary = "用户未读消息数量")
|
@Operation(summary = "用户未读消息数量")
|
||||||
public R<Integer> unreadNum() {
|
public R<Long> unreadNum() {
|
||||||
return R.data(userNoticeService.appNotReadNoticeNum());
|
return R.data(userNoticeService.appUnreadNoticeNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,17 +6,19 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|||||||
import io.swagger.v3.oas.annotations.Hidden;
|
import io.swagger.v3.oas.annotations.Hidden;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springblade.core.mp.support.Condition;
|
import org.springblade.core.mp.support.Condition;
|
||||||
import org.springblade.core.mp.support.Query;
|
import org.springblade.core.mp.support.Query;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
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.NoticeDetailRequest;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
import org.springblade.modules.api.vo.CommonUserNoticeApiVO;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
|
||||||
|
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
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.userPackage.service.IUserMarketBenefitPackageService;
|
import org.springblade.modules.userPackage.service.IUserMarketBenefitPackageService;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@@ -30,11 +32,13 @@ import java.util.List;
|
|||||||
public class MarketUserController {
|
public class MarketUserController {
|
||||||
|
|
||||||
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
private final IUserMarketBenefitPackageService userMarketBenefitPackageService;
|
||||||
|
|
||||||
private final MarketUserManager marketUserManager;
|
private final MarketUserManager marketUserManager;
|
||||||
|
|
||||||
private final ICommonUserNoticeService userNoticeService;
|
private final ICommonUserNoticeService userNoticeService;
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/find-user-benefit-pack-list")
|
@GetMapping("/package-list")
|
||||||
@ApiOperationSupport(order = 1)
|
@ApiOperationSupport(order = 1)
|
||||||
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
||||||
public R<IPage<MarketBenefitPackageVO>> findUserPackList(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
|
public R<IPage<MarketBenefitPackageVO>> findUserPackList(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
|
||||||
@@ -46,7 +50,7 @@ public class MarketUserController {
|
|||||||
@GetMapping("/my-team")
|
@GetMapping("/my-team")
|
||||||
@ApiOperationSupport(order = 2)
|
@ApiOperationSupport(order = 2)
|
||||||
@Operation(summary = "查直推")
|
@Operation(summary = "查直推")
|
||||||
public R<List<MarketDirectInfoVO>> myTeam() {
|
public R<List<MarketDirectInfoApiVO>> myTeam() {
|
||||||
return R.data(marketUserManager.findUserPackList());
|
return R.data(marketUserManager.findUserPackList());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,17 +58,24 @@ public class MarketUserController {
|
|||||||
@GetMapping("/my-invitor")
|
@GetMapping("/my-invitor")
|
||||||
@ApiOperationSupport(order = 3)
|
@ApiOperationSupport(order = 3)
|
||||||
@Operation(summary = "查推荐人信息")
|
@Operation(summary = "查推荐人信息")
|
||||||
public R<MarketDirectInfoVO> myInvitor() {
|
public R<MarketDirectInfoApiVO> myInvitor() {
|
||||||
return R.data(marketUserManager.findMarketParent());
|
return R.data(marketUserManager.findMarketParent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/system-notice")
|
||||||
|
@ApiOperationSupport(order = 4)
|
||||||
|
@Operation(summary = "Market系统消息列表")
|
||||||
|
public R<List<CommonUserNoticeApiVO>> systemNotice() {
|
||||||
|
return R.data(userNoticeService.marketSystemNoticeList());
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/notice-page")
|
|
||||||
@ApiOperationSupport(order = 6)
|
@GetMapping("/user-notice")
|
||||||
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
@ApiOperationSupport(order = 5)
|
||||||
public R<IPage<AppUserNoticeVO>> noticePage(Query query) {
|
@Operation(summary = "Market用户消息列表", description = "传入userNoticeVO")
|
||||||
IPage<AppUserNoticeVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query));
|
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||||
|
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectMarketUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||||
return R.data(pages);
|
return R.data(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,15 +83,15 @@ public class MarketUserController {
|
|||||||
@PostMapping("/notice-detail")
|
@PostMapping("/notice-detail")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "用户消息详情", description = "传入request")
|
@Operation(summary = "用户消息详情", description = "传入request")
|
||||||
public R<Boolean> noticeDetail(@RequestBody AppUserNoticeRequest request) {
|
public R<CommonUserNoticeDetailApiVO> noticeDetail(@RequestBody @Valid NoticeDetailRequest request) {
|
||||||
return R.status(userNoticeService.appUserReadNotice(request));
|
return R.data(userNoticeService.userNoticeDetail(request.getId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/unread-num")
|
@GetMapping("/unread-num")
|
||||||
@ApiOperationSupport(order = 6)
|
@ApiOperationSupport(order = 6)
|
||||||
@Operation(summary = "用户未读消息数量")
|
@Operation(summary = "APP用户未读消息数量")
|
||||||
public R<Integer> unreadNum() {
|
public R<Long> unreadNum() {
|
||||||
return R.data(userNoticeService.appNotReadNoticeNum());
|
return R.data(userNoticeService.marketUnreadNoticeNum());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,21 +25,16 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.modules.api.request;
|
package org.springblade.modules.api.request;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
public class NoticeDetailRequest implements Serializable {
|
||||||
|
|
||||||
@Accessors(chain = true)
|
@NotNull(message = "无效消息详情")
|
||||||
public class AppUserNoticeRequest implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
@@ -26,51 +26,30 @@
|
|||||||
package org.springblade.modules.api.vo;
|
package org.springblade.modules.api.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.io.Serial;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
|
public class CommonUserNoticeApiVO implements Serializable {
|
||||||
@Accessors(chain = true)
|
|
||||||
public class AppUserNoticeVO implements Serializable {
|
|
||||||
|
|
||||||
@Serial
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Long id;
|
private Long id;
|
||||||
/**
|
|
||||||
* 通知类型 0-系统通知 1-app通知 2-market通知
|
private Integer moduleType;
|
||||||
*/
|
|
||||||
private Integer noticeType;
|
|
||||||
/**
|
/**
|
||||||
* 是否已读 0-否 1-是
|
* 是否已读 0-否 1-是
|
||||||
*/
|
*/
|
||||||
private Integer hasRead;
|
private Integer hasRead;
|
||||||
/**
|
|
||||||
* 阅读时间
|
|
||||||
*/
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date releaseTime;
|
|
||||||
/**
|
/**
|
||||||
* 标题
|
* 标题
|
||||||
*/
|
*/
|
||||||
private String title;
|
private String title;
|
||||||
/**
|
|
||||||
* 内容
|
|
||||||
*/
|
|
||||||
private String content;
|
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package org.springblade.modules.api.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class CommonUserNoticeDetailApiVO implements Serializable {
|
||||||
|
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
private Integer moduleType;
|
||||||
|
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -42,10 +42,11 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Accessors(chain = true)
|
@Accessors(chain = true)
|
||||||
public class MarketDirectInfoVO implements Serializable {
|
public class MarketDirectInfoApiVO implements Serializable {
|
||||||
private String phone;
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@@ -4,7 +4,8 @@ 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.CommonUserNoticeApiVO;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
|
||||||
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.CommonUserNoticeEntity;
|
||||||
@@ -43,7 +44,9 @@ public interface AppCommonConvert {
|
|||||||
|
|
||||||
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
|
List<CommonUserOrderApiVO> convertOrderApiListVO(List<CommonUserOrderVO> voList);
|
||||||
|
|
||||||
AppUserNoticeVO convertNoticeEntityToVO(CommonUserNoticeEntity commonUserNoticeEntity);
|
CommonUserNoticeApiVO convertNoticeEntityToVO(CommonUserNoticeEntity commonUserNoticeEntity);
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> convertNoticeVOList(List<CommonUserNoticeEntity> list);
|
||||||
|
|
||||||
|
CommonUserNoticeDetailApiVO convertNoticeDetailVO(CommonUserNoticeEntity entity);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.springblade.modules.common.eums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum NoticeType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全局通知
|
||||||
|
*/
|
||||||
|
GLOBAL(0),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP系统通知
|
||||||
|
*/
|
||||||
|
APP_SYSTEM(1),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Market系统通知
|
||||||
|
*/
|
||||||
|
MARKET_SYSTEM(2),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* APP用户通知
|
||||||
|
*/
|
||||||
|
APP_USER(3),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Market用户通知
|
||||||
|
*/
|
||||||
|
MARKET_USER(4);
|
||||||
|
|
||||||
|
private final int code;
|
||||||
|
|
||||||
|
NoticeType(int code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 code 值获取对应的枚举项
|
||||||
|
*
|
||||||
|
* @param code 通知类型代码
|
||||||
|
* @return 对应的 NotificationType 枚举
|
||||||
|
* @throws IllegalArgumentException 如果 code 无效
|
||||||
|
*/
|
||||||
|
public static NoticeType fromCode(int code) {
|
||||||
|
for (NoticeType type : NoticeType.values()) {
|
||||||
|
if (type.code == code) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Invalid notification type code: " + code);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package org.springblade.modules.common.mapper;
|
package org.springblade.modules.common.mapper;
|
||||||
|
|
||||||
|
import org.springblade.modules.api.vo.CommonUserNoticeApiVO;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
@@ -48,5 +49,11 @@ public interface CommonUserNoticeMapper extends BaseMapper<CommonUserNoticeEntit
|
|||||||
*/
|
*/
|
||||||
List<CommonUserNoticeVO> selectUserNoticePage(IPage page, CommonUserNoticeVO userNotice);
|
List<CommonUserNoticeVO> selectUserNoticePage(IPage page, CommonUserNoticeVO userNotice);
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> selectAppSystemNoticeVOList();
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> selectAppUserNoticeApiPage(IPage page, CommonUserNoticeApiVO vo, Long userId);
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> selectMarketSystemNoticeVOList();
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> selectMarketUserNoticeApiPage(IPage page, CommonUserNoticeApiVO vo, Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,38 @@
|
|||||||
select * from user_notice where is_deleted = 0
|
select * from user_notice where is_deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAppSystemNoticeVOList" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO">
|
||||||
|
select id, module_type, has_read, title, create_time
|
||||||
|
from user_notice
|
||||||
|
where notice_type in (0, 1)
|
||||||
|
and is_deleted = 0
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAppUserNoticeApiPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO">
|
||||||
|
select id, module_type, has_read, title, create_time
|
||||||
|
from user_notice
|
||||||
|
where user_id = #{userId}
|
||||||
|
and notice_type = 3
|
||||||
|
and is_deleted = 0
|
||||||
|
order by has_read asc, create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMarketSystemNoticeVOList" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO">
|
||||||
|
select id, module_type, has_read, title, create_time
|
||||||
|
from user_notice
|
||||||
|
where notice_type in (0, 2)
|
||||||
|
and is_deleted = 0
|
||||||
|
order by create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectMarketUserNoticeApiPage" resultType="org.springblade.modules.common.pojo.vo.CommonUserNoticeVO">
|
||||||
|
select id, module_type, has_read, title, create_time
|
||||||
|
from user_notice
|
||||||
|
where user_id = #{userId}
|
||||||
|
and notice_type = 4
|
||||||
|
and is_deleted = 0
|
||||||
|
order by has_read asc, create_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -59,18 +59,18 @@ public class CommonUserNoticeEntity extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 通知类型 0-系统通知 1-app通知 2-market通知
|
* 通知类型 0-系统通知 1-app通知 2-market通知
|
||||||
*/
|
*/
|
||||||
@Schema(description = "通知类型 0-系统通知 1-app通知 2-market通知")
|
@Schema(description = "通知类型 0-全局通知 1-APP系统通知 2-Market系统通知 3-APP用户通知 4-Market用户通知")
|
||||||
private Integer noticeType;
|
private Integer noticeType;
|
||||||
|
/**
|
||||||
|
* 业务类型
|
||||||
|
*/
|
||||||
|
@Schema(description = "通知类型 0-全局通知 1-APP系统通知 2-Market系统通知 3-APP用户通知 4-Market用户通知")
|
||||||
|
private Integer moduleType;
|
||||||
/**
|
/**
|
||||||
* 是否已读 0-否 1-是
|
* 是否已读 0-否 1-是
|
||||||
*/
|
*/
|
||||||
@Schema(description = "是否已读 0-否 1-是")
|
@Schema(description = "是否已读 0-否 1-是")
|
||||||
private Integer hasRead;
|
private Integer hasRead;
|
||||||
/**
|
|
||||||
* 阅读时间
|
|
||||||
*/
|
|
||||||
@Schema(description = "阅读时间")
|
|
||||||
private Date releaseTime;
|
|
||||||
/**
|
/**
|
||||||
* 标题
|
* 标题
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,13 +26,16 @@
|
|||||||
package org.springblade.modules.common.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.NoticeDetailRequest;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
import org.springblade.modules.api.vo.CommonUserNoticeApiVO;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户通知 服务类
|
* 用户通知 服务类
|
||||||
*
|
*
|
||||||
@@ -52,21 +55,18 @@ public interface ICommonUserNoticeService extends BaseService<CommonUserNoticeEn
|
|||||||
|
|
||||||
boolean saveUserNotice(@Valid CommonUserNoticeVO userNotice);
|
boolean saveUserNotice(@Valid CommonUserNoticeVO userNotice);
|
||||||
|
|
||||||
IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeEntity> page);
|
IPage<CommonUserNoticeApiVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeApiVO> page, CommonUserNoticeApiVO vo);
|
||||||
|
|
||||||
Integer appNotReadNoticeNum();
|
Long appUnreadNoticeNum();
|
||||||
|
|
||||||
boolean appUserReadNotice(AppUserNoticeRequest request);
|
IPage<CommonUserNoticeApiVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeApiVO> page, CommonUserNoticeApiVO vo);
|
||||||
|
|
||||||
|
Long marketUnreadNoticeNum();
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> appSystemNoticeList();
|
||||||
|
|
||||||
IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeEntity> page);
|
CommonUserNoticeDetailApiVO userNoticeDetail(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Integer marketNotReadNoticeNum();
|
|
||||||
|
|
||||||
boolean marketUserReadNotice(AppUserNoticeRequest request);
|
|
||||||
|
|
||||||
|
List<CommonUserNoticeApiVO> marketSystemNoticeList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,9 @@ 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.NoticeDetailRequest;
|
||||||
import org.springblade.modules.api.vo.AppUserNoticeVO;
|
import org.springblade.modules.api.vo.CommonUserNoticeApiVO;
|
||||||
|
import org.springblade.modules.api.vo.CommonUserNoticeDetailApiVO;
|
||||||
import org.springblade.modules.common.convert.AppCommonConvert;
|
import org.springblade.modules.common.convert.AppCommonConvert;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserNoticeEntity;
|
||||||
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
import org.springblade.modules.common.pojo.vo.CommonUserNoticeVO;
|
||||||
@@ -44,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
@@ -71,10 +71,10 @@ public class CommonUserNoticeServiceImpl extends BaseServiceImpl<CommonUserNotic
|
|||||||
Assert.notNull(userNotice.getNoticeType(), "通知类型不能为空");
|
Assert.notNull(userNotice.getNoticeType(), "通知类型不能为空");
|
||||||
Assert.notNull(userNotice.getTitle(), "标题不能为空");
|
Assert.notNull(userNotice.getTitle(), "标题不能为空");
|
||||||
Assert.notNull(userNotice.getContent(), "内容不能为空");
|
Assert.notNull(userNotice.getContent(), "内容不能为空");
|
||||||
if (userNotice.getNoticeRange() == 0){
|
if (userNotice.getNoticeRange() == 0) {
|
||||||
|
|
||||||
User user = userService.getById(userNotice.getUserId());
|
User user = userService.getById(userNotice.getUserId());
|
||||||
Assert.notNull(user , "用户不存在");
|
Assert.notNull(user, "用户不存在");
|
||||||
return save(
|
return save(
|
||||||
new CommonUserNoticeEntity()
|
new CommonUserNoticeEntity()
|
||||||
.setUserId(userNotice.getUserId())
|
.setUserId(userNotice.getUserId())
|
||||||
@@ -83,7 +83,7 @@ public class CommonUserNoticeServiceImpl extends BaseServiceImpl<CommonUserNotic
|
|||||||
.setNoticeType(userNotice.getNoticeType())
|
.setNoticeType(userNotice.getNoticeType())
|
||||||
.setHasRead(0)
|
.setHasRead(0)
|
||||||
);
|
);
|
||||||
}else if (userNotice.getNoticeRange() == 1){
|
} else if (userNotice.getNoticeRange() == 1) {
|
||||||
|
|
||||||
long count = userService.count(
|
long count = userService.count(
|
||||||
Wrappers.lambdaQuery(User.class)
|
Wrappers.lambdaQuery(User.class)
|
||||||
@@ -113,101 +113,66 @@ public class CommonUserNoticeServiceImpl extends BaseServiceImpl<CommonUserNotic
|
|||||||
.setHasRead(0)
|
.setHasRead(0)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
if (!saveBatch(noticeList)){
|
if (!saveBatch(noticeList)) {
|
||||||
throw new RuntimeException("批量保存用户通知失败");
|
throw new RuntimeException("批量保存用户通知失败");
|
||||||
}else {
|
} else {
|
||||||
noticeList.clear();
|
noticeList.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
throw new RuntimeException("通知范围错误");
|
throw new RuntimeException("通知范围错误");
|
||||||
}
|
}
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<AppUserNoticeVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeEntity> page) {
|
public IPage<CommonUserNoticeApiVO> selectAppUserNoticeApiPage(IPage<CommonUserNoticeApiVO> page, CommonUserNoticeApiVO vo) {
|
||||||
IPage<CommonUserNoticeEntity> noticeEntityIPage = page(
|
return page.setRecords(baseMapper.selectAppUserNoticeApiPage(page, vo, AuthUtil.getUserId()));
|
||||||
page,
|
|
||||||
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(AppCommonConvert.INSTANCE::convertNoticeEntityToVO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer appNotReadNoticeNum() {
|
public Long appUnreadNoticeNum() {
|
||||||
long count = count(
|
return count(Wrappers.<CommonUserNoticeEntity>lambdaQuery()
|
||||||
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
|
||||||
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||||
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
||||||
.in(CommonUserNoticeEntity::getNoticeType, List.of(0, 1))
|
.eq(CommonUserNoticeEntity::getNoticeType, 3)
|
||||||
|
.eq(CommonUserNoticeEntity::getIsDeleted, 0));
|
||||||
);
|
|
||||||
return Math.toIntExact(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean appUserReadNotice(AppUserNoticeRequest request) {
|
public IPage<CommonUserNoticeApiVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeApiVO> page, CommonUserNoticeApiVO vo) {
|
||||||
|
return page.setRecords(baseMapper.selectMarketUserNoticeApiPage(page, vo, AuthUtil.getUserId()));
|
||||||
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(CommonUserNoticeEntity.class)
|
|
||||||
.eq(CommonUserNoticeEntity::getId, request.getId())
|
|
||||||
.set(CommonUserNoticeEntity::getHasRead, 1)
|
|
||||||
.set(CommonUserNoticeEntity::getReleaseTime, new Date())
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IPage<AppUserNoticeVO> selectMarketUserNoticeApiPage(IPage<CommonUserNoticeEntity> page) {
|
public Long marketUnreadNoticeNum() {
|
||||||
IPage<CommonUserNoticeEntity> noticeEntityIPage = page(
|
return count(Wrappers.<CommonUserNoticeEntity>lambdaQuery()
|
||||||
page,
|
|
||||||
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(AppCommonConvert.INSTANCE::convertNoticeEntityToVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Integer marketNotReadNoticeNum() {
|
|
||||||
long count = count(
|
|
||||||
Wrappers.lambdaQuery(CommonUserNoticeEntity.class)
|
|
||||||
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
.eq(CommonUserNoticeEntity::getUserId, AuthUtil.getUserId())
|
||||||
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
.eq(CommonUserNoticeEntity::getHasRead, 0)
|
||||||
.in(CommonUserNoticeEntity::getNoticeType, List.of(1 ,2))
|
.eq(CommonUserNoticeEntity::getNoticeType, 4)
|
||||||
|
.eq(CommonUserNoticeEntity::getIsDeleted, 0));
|
||||||
);
|
|
||||||
return Math.toIntExact(count);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean marketUserReadNotice(AppUserNoticeRequest request) {
|
public List<CommonUserNoticeApiVO> appSystemNoticeList() {
|
||||||
CommonUserNoticeEntity userNotice = getById(request.getId());
|
return baseMapper.selectAppSystemNoticeVOList();
|
||||||
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(CommonUserNoticeEntity.class)
|
|
||||||
.eq(CommonUserNoticeEntity::getId, request.getId())
|
|
||||||
.set(CommonUserNoticeEntity::getHasRead, 1)
|
|
||||||
.set(CommonUserNoticeEntity::getReleaseTime, new Date())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonUserNoticeDetailApiVO userNoticeDetail(Long id) {
|
||||||
|
CommonUserNoticeEntity notice = getById(id);
|
||||||
|
Assert.notNull(notice, "无效消息");
|
||||||
|
Assert.isTrue(Objects.equals(notice.getUserId(), AuthUtil.getUserId()), "无效消息");
|
||||||
|
if (notice.getHasRead() == 0) {
|
||||||
|
notice.setHasRead(1);
|
||||||
|
updateById(notice);
|
||||||
|
}
|
||||||
|
return AppCommonConvert.INSTANCE.convertNoticeDetailVO(notice);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CommonUserNoticeApiVO> marketSystemNoticeList() {
|
||||||
|
return baseMapper.selectMarketSystemNoticeVOList();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package org.springblade.modules.market.convert;
|
|||||||
import org.mapstruct.Mapper;
|
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.vo.MarketDirectInfoVO;
|
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -16,7 +16,7 @@ public interface MarketUserMarketInfoConvert {
|
|||||||
@Mapping(target = "phone", expression = "java(org.springblade.core.tool.sensitive.SensitiveUtil.process(entity.getAccount()))")
|
@Mapping(target = "phone", expression = "java(org.springblade.core.tool.sensitive.SensitiveUtil.process(entity.getAccount()))")
|
||||||
@Mapping(target = "name", source = "name")
|
@Mapping(target = "name", source = "name")
|
||||||
@Mapping(target = "registerTime", source = "createTime")
|
@Mapping(target = "registerTime", source = "createTime")
|
||||||
MarketDirectInfoVO convertMarketUserMarketInfoVO(User entity);
|
MarketDirectInfoApiVO convertMarketUserMarketInfoVO(User entity);
|
||||||
|
|
||||||
List<MarketDirectInfoVO> convertMarketUserMarketInfoVOList(List<User> list);
|
List<MarketDirectInfoApiVO> convertMarketUserMarketInfoVOList(List<User> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,10 +4,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springblade.core.secure.utils.AuthUtil;
|
import org.springblade.core.secure.utils.AuthUtil;
|
||||||
import org.springblade.core.tool.sensitive.SensitiveType;
|
|
||||||
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
import org.springblade.core.tool.sensitive.SensitiveUtil;
|
||||||
import org.springblade.modules.market.convert.MarketUserMarketInfoConvert;
|
import org.springblade.modules.api.vo.MarketDirectInfoApiVO;
|
||||||
import org.springblade.modules.api.vo.MarketDirectInfoVO;
|
|
||||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||||
import org.springblade.modules.market.service.IMarketInfoService;
|
import org.springblade.modules.market.service.IMarketInfoService;
|
||||||
import org.springblade.modules.system.pojo.entity.User;
|
import org.springblade.modules.system.pojo.entity.User;
|
||||||
@@ -28,12 +26,12 @@ public class MarketUserManager {
|
|||||||
private final IMarketInfoService marketInfoService;
|
private final IMarketInfoService marketInfoService;
|
||||||
private final IUserService userService;
|
private final IUserService userService;
|
||||||
|
|
||||||
public List<MarketDirectInfoVO> findUserPackList() {
|
public List<MarketDirectInfoApiVO> findUserPackList() {
|
||||||
Long userId = AuthUtil.getUserId();
|
Long userId = AuthUtil.getUserId();
|
||||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||||
Assert.notNull(marketInfoEntity, "用户不存在");
|
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||||
|
|
||||||
List<MarketDirectInfoVO> marketDirectInfoVOList = new LinkedList<>();
|
List<MarketDirectInfoApiVO> marketDirectInfoApiVOList = new LinkedList<>();
|
||||||
|
|
||||||
List<MarketInfoEntity> marketInfoEntityList = marketInfoService.list(
|
List<MarketInfoEntity> marketInfoEntityList = marketInfoService.list(
|
||||||
Wrappers.lambdaQuery(MarketInfoEntity.class)
|
Wrappers.lambdaQuery(MarketInfoEntity.class)
|
||||||
@@ -60,15 +58,15 @@ public class MarketUserManager {
|
|||||||
if (marketInfoEntityMap.containsKey(user.getId())){
|
if (marketInfoEntityMap.containsKey(user.getId())){
|
||||||
MarketInfoEntity marketInfo = marketInfoEntityMap.get(user.getId());
|
MarketInfoEntity marketInfo = marketInfoEntityMap.get(user.getId());
|
||||||
if (marketInfo.getVerified() == 1){
|
if (marketInfo.getVerified() == 1){
|
||||||
marketDirectInfoVOList.add(
|
marketDirectInfoApiVOList.add(
|
||||||
new MarketDirectInfoVO()
|
new MarketDirectInfoApiVO()
|
||||||
.setPhone(SensitiveUtil.process(user.getAccount()))
|
.setPhone(SensitiveUtil.process(user.getAccount()))
|
||||||
.setName(desensitizationByPhone(marketInfo.getRealName()))
|
.setName(desensitizationByPhone(marketInfo.getRealName()))
|
||||||
.setRegisterTime(user.getCreateTime())
|
.setRegisterTime(user.getCreateTime())
|
||||||
);
|
);
|
||||||
}else {
|
}else {
|
||||||
marketDirectInfoVOList.add(
|
marketDirectInfoApiVOList.add(
|
||||||
new MarketDirectInfoVO()
|
new MarketDirectInfoApiVO()
|
||||||
.setPhone(SensitiveUtil.process(user.getAccount()))
|
.setPhone(SensitiveUtil.process(user.getAccount()))
|
||||||
.setName(desensitizationByPhone(user.getName()))
|
.setName(desensitizationByPhone(user.getName()))
|
||||||
.setRegisterTime(user.getCreateTime())
|
.setRegisterTime(user.getCreateTime())
|
||||||
@@ -79,23 +77,23 @@ public class MarketUserManager {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return marketDirectInfoVOList;
|
return marketDirectInfoApiVOList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarketDirectInfoVO findMarketParent() {
|
public MarketDirectInfoApiVO findMarketParent() {
|
||||||
Long userId = AuthUtil.getUserId();
|
Long userId = AuthUtil.getUserId();
|
||||||
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
MarketInfoEntity marketInfoEntity = marketInfoService.getById(userId);
|
||||||
Assert.notNull(marketInfoEntity, "用户不存在");
|
Assert.notNull(marketInfoEntity, "用户不存在");
|
||||||
if (marketInfoEntity.getPid() == null || marketInfoEntity.getPid() <= 0){
|
if (marketInfoEntity.getPid() == null || marketInfoEntity.getPid() <= 0){
|
||||||
return new MarketDirectInfoVO();
|
return new MarketDirectInfoApiVO();
|
||||||
}
|
}
|
||||||
User user = userService.getById(marketInfoEntity.getPid());
|
User user = userService.getById(marketInfoEntity.getPid());
|
||||||
if (user == null){
|
if (user == null){
|
||||||
return new MarketDirectInfoVO();
|
return new MarketDirectInfoApiVO();
|
||||||
}
|
}
|
||||||
|
|
||||||
MarketDirectInfoVO marketDirectInfoVO = new MarketDirectInfoVO()
|
MarketDirectInfoApiVO marketDirectInfoApiVO = new MarketDirectInfoApiVO()
|
||||||
.setPhone(SensitiveUtil.process(user.getAccount()))
|
.setPhone(SensitiveUtil.process(user.getAccount()))
|
||||||
.setName(desensitizationByPhone(user.getName()))
|
.setName(desensitizationByPhone(user.getName()))
|
||||||
.setRegisterTime(user.getCreateTime());
|
.setRegisterTime(user.getCreateTime());
|
||||||
@@ -104,12 +102,12 @@ public class MarketUserManager {
|
|||||||
MarketInfoEntity parentMarketInfoEntity = marketInfoService.getById(marketInfoEntity.getPid());
|
MarketInfoEntity parentMarketInfoEntity = marketInfoService.getById(marketInfoEntity.getPid());
|
||||||
|
|
||||||
if(parentMarketInfoEntity != null && parentMarketInfoEntity.getVerified() == 1){
|
if(parentMarketInfoEntity != null && parentMarketInfoEntity.getVerified() == 1){
|
||||||
marketDirectInfoVO.setName(desensitizationByPhone(parentMarketInfoEntity.getRealName()));
|
marketDirectInfoApiVO.setName(desensitizationByPhone(parentMarketInfoEntity.getRealName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return marketDirectInfoVO;
|
return marketDirectInfoApiVO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user