master:系统通知调整;

pull/1121/head
liujiang 2025-07-13 17:56:17 +08:00
parent e92685e322
commit 21c14363d1
16 changed files with 197 additions and 48 deletions

View File

@ -16,6 +16,8 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
*
@ -66,4 +68,12 @@ public class NoticeController extends BaseController {
return R.ok(noticeService.page(BeanUtil.toBean(pageVO, NoticePageDTO.class)));
}
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()")
@ApiOperation(value = "档口首页获取正在生效的公告列表", httpMethod = "GET", response = R.class)
@GetMapping("/list")
public R<List<NoticeLatest10ResVO>> latest10() {
return R.ok(BeanUtil.copyToList(noticeService.latest10(), NoticeLatest10ResVO.class));
}
}

View File

@ -27,7 +27,7 @@ public class NoticeCreateVO {
@ApiModelProperty(value = "公告标题", required = true)
private String noticeTitle;
@NotNull(message = "公告类型不能为空")
@ApiModelProperty(value = "公告类型", required = true)
@ApiModelProperty(value = "公告类型 1 通知 2 公告", required = true)
private Integer noticeType;
@NotBlank(message = "公告内容不能为空")
@ApiModelProperty(value = "公告内容", required = true)

View File

@ -0,0 +1,25 @@
package com.ruoyi.web.controller.xkt.vo.notice;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel
@Data
@Accessors(chain = true)
public class NoticeLatest10ResVO {
@ApiModelProperty(value = "公告ID")
@JsonProperty(value = "noticeId")
private Long id;
@ApiModelProperty(value = "公告标题")
private String noticeTitle;
}

View File

@ -4,10 +4,8 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.List;
/**
* @author liujiang
@ -19,31 +17,35 @@ import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StoreSaleSnResVO {
@ApiModelProperty(value = "错误列表")
List<String> failList;
@ApiModelProperty(value = "成功列表")
List<SPSDetailVO> successList;
@Data
@ApiModel
@Accessors(chain = true)
public static class SPSDetailVO {
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "档口商品颜色尺码ID")
private Long storeProdColorId;
@ApiModelProperty(value = "档口颜色ID")
private Long storeColorId;
@ApiModelProperty(value = "颜色")
private String colorName;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "生产价格")
private BigDecimal producePrice;
@ApiModelProperty(value = "尺码")
private Integer size;
@ApiModelProperty(value = "销售条码")
private String sn;
}
@ApiModelProperty(value = "是否成功")
private Boolean success;
@ApiModelProperty(value = "档口商品ID")
private Long storeProdId;
@ApiModelProperty(value = "档口商品颜色尺码ID")
private Long storeProdColorId;
@ApiModelProperty(value = "颜色")
private String colorName;
@ApiModelProperty(value = "尺码")
private Integer size;
@ApiModelProperty(value = "商品货号")
private String prodArtNum;
@ApiModelProperty(value = "销售条码")
private String sn;
@ApiModelProperty(value = "销售单价")
private BigDecimal price;
@ApiModelProperty(value = "档口客户优惠金额")
private BigDecimal discount;
@ApiModelProperty(value = "大小码加价")
private BigDecimal overPrice;
@ApiModelProperty(value = "标准尺码")
private Integer standard;
@ApiModelProperty(value = "[退货扫码时才有]优惠后销售单价")
private BigDecimal discountedPrice;
@ApiModelProperty(value = "[退货扫码时才有]销售金额")
private BigDecimal amount;
@ApiModelProperty(value = "[退货扫码时才有]销售数量")
private BigDecimal quantity;
@ApiModelProperty(value = "[退货扫码时才有]其它优惠")
private BigDecimal otherDiscount;
}

View File

@ -28,7 +28,7 @@ public class StoreSaleSnVO {
@ApiModelProperty(value = "是否退货", required = true)
private Boolean refund;
@NotBlank(message = "条码不能为空!")
@ApiModelProperty(value = "条码")
@ApiModelProperty(value = "条码", required = true)
private String sn;
}

View File

@ -1512,7 +1512,7 @@ public class XktTask {
Notice notice = new Notice().setNoticeTitle(storeName + "商品上新啦!").setNoticeType(NoticeType.NOTICE.getValue())
.setNoticeContent(storeName + "上新了货号为: " + storeProd.getProdArtNum() + " 的商品!请及时关注!")
.setOwnerType(NoticeOwnerType.STORE.getValue()).setStoreId(storeProd.getStoreId())
.setUserId(userId).setPerpetuity(1);
.setUserId(userId).setPerpetuity(NoticePerpetuityType.PERMANENT.getValue());
this.noticeMapper.insert(notice);
final Date voucherDate = java.sql.Date.valueOf(LocalDate.now());
// 新增消息通知列表

View File

@ -55,7 +55,7 @@ public class Notice extends XktBaseEntity {
*/
private Date effectEnd;
/**
*
* 1 2
*/
private Integer perpetuity;

View File

@ -18,7 +18,7 @@ public class APPStrengthStoreDTO {
@ApiModelProperty(value = "会员等级")
private Integer memberLevel;
@ApiModelProperty(value = "档口ID")
private String storeId;
private Long storeId;
@ApiModelProperty(value = "档口名称")
private String storeName;
@ApiModelProperty(value = "商品第一张主图路径")

View File

@ -0,0 +1,25 @@
package com.ruoyi.xkt.dto.notice;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
/**
* @author liujiang
* @version v1.0
* @date 2025/3/27 15:12
*/
@ApiModel
@Data
@Accessors(chain = true)
public class NoticeLatest10ResDTO {
@ApiModelProperty(value = "公告ID")
@JsonProperty(value = "noticeId")
private Long id;
@ApiModelProperty(value = "公告标题")
private String noticeTitle;
}

View File

@ -15,7 +15,6 @@ import java.util.List;
*/
@Data
@Accessors(chain = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StoreSaleSnResDTO {
@ApiModelProperty(value = "是否成功")
@ -36,5 +35,17 @@ public class StoreSaleSnResDTO {
private BigDecimal price;
@ApiModelProperty(value = "档口客户优惠金额")
private BigDecimal discount;
@ApiModelProperty(value = "大小码加价")
private BigDecimal overPrice;
@ApiModelProperty(value = "标准尺码")
private Integer standard;
@ApiModelProperty(value = "[退货扫码时才有]优惠后销售单价")
private BigDecimal discountedPrice;
@ApiModelProperty(value = "[退货扫码时才有]销售金额")
private BigDecimal amount;
@ApiModelProperty(value = "[退货扫码时才有]销售数量")
private BigDecimal quantity;
@ApiModelProperty(value = "[退货扫码时才有]其它优惠")
private BigDecimal otherDiscount;
}

View File

@ -0,0 +1,36 @@
package com.ruoyi.xkt.enums;
import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
*
*
* @author liujiang
* @date 2025-04-02 23:42
*/
@Getter
@AllArgsConstructor
public enum NoticePerpetuityType {
// 存在有效期
TEMPORARY(1, "存在有效期"),
// 永久有效
PERMANENT(2, "永久有效"),
;
private final Integer value;
private final String label;
public static NoticePerpetuityType of(Integer value) {
for (NoticePerpetuityType e : NoticePerpetuityType.values()) {
if (e.getValue().equals(value)) {
return e;
}
}
throw new ServiceException("通知类型不存在!", HttpStatus.ERROR);
}
}

View File

@ -3,6 +3,8 @@ package com.ruoyi.xkt.service;
import com.ruoyi.common.core.page.Page;
import com.ruoyi.xkt.dto.notice.*;
import java.util.List;
/**
*
*
@ -64,4 +66,12 @@ public interface INoticeService {
*/
Integer createSingleNotice(Long userId, String title, Integer noticeType, Integer ownerType,
Long storeId, Integer targetNoticeType, String content);
/**
* 10
*
* @return List<NoticeLatest10ResDTO>
*/
List<NoticeLatest10ResDTO> latest10();
}

View File

@ -14,9 +14,7 @@ import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.xkt.domain.Notice;
import com.ruoyi.xkt.domain.UserNotice;
import com.ruoyi.xkt.dto.notice.*;
import com.ruoyi.xkt.enums.NoticeOwnerType;
import com.ruoyi.xkt.enums.NoticeReadType;
import com.ruoyi.xkt.enums.UserNoticeType;
import com.ruoyi.xkt.enums.*;
import com.ruoyi.xkt.mapper.*;
import com.ruoyi.xkt.service.INoticeService;
import lombok.RequiredArgsConstructor;
@ -27,10 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -59,7 +54,7 @@ public class NoticeServiceImpl implements INoticeService {
@Transactional
public Integer create(NoticeCreateDTO createDTO) {
nullFilter(createDTO.getOwnerType(), createDTO.getStoreId(), createDTO.getPerpetuity(), createDTO.getEffectStart(), createDTO.getEffectEnd());
Notice notice = BeanUtil.toBean(createDTO, Notice.class).setUserId(SecurityUtils.getUserId());
Notice notice = BeanUtil.toBean(createDTO, Notice.class).setNoticeType(NoticeType.ANNOUNCEMENT.getValue()).setUserId(SecurityUtils.getUserId());
notice.setCreateBy(SecurityUtils.getUsername());
int count = this.noticeMapper.insert(notice);
final Date voucherDate = java.sql.Date.valueOf(LocalDate.now());
@ -97,6 +92,7 @@ public class NoticeServiceImpl implements INoticeService {
.eq(Notice::getId, editDTO.getNoticeId()).eq(Notice::getDelFlag, Constants.UNDELETED)))
.orElseThrow(() -> new ServiceException("公告不存在!", HttpStatus.ERROR));
BeanUtil.copyProperties(editDTO, notice);
notice.setNoticeType(NoticeType.ANNOUNCEMENT.getValue());
notice.setUpdateBy(SecurityUtils.getUsername());
return this.noticeMapper.updateById(notice);
}
@ -153,7 +149,9 @@ public class NoticeServiceImpl implements INoticeService {
@Override
@Transactional(readOnly = true)
public Page<NoticeResDTO> page(NoticePageDTO pageDTO) {
// 查询公告
LambdaQueryWrapper<Notice> queryWrapper = new LambdaQueryWrapper<Notice>().eq(Notice::getDelFlag, Constants.UNDELETED)
.eq(Notice::getNoticeType, NoticeType.ANNOUNCEMENT.getValue())
.eq(Notice::getOwnerType, pageDTO.getOwnerType()).orderByDesc(Notice::getCreateTime);
if (StringUtils.isNotBlank(pageDTO.getNoticeTitle())) {
queryWrapper.like(Notice::getNoticeTitle, pageDTO.getNoticeTitle());
@ -196,11 +194,38 @@ public class NoticeServiceImpl implements INoticeService {
*/
public Integer createSingleNotice(Long userId, String title, Integer noticeType, Integer ownerType, Long storeId, Integer targetNoticeType, String content) {
Notice notice = new Notice().setNoticeTitle(title).setNoticeType(noticeType).setOwnerType(ownerType)
.setStoreId(storeId).setUserId(userId).setPerpetuity(1).setNoticeContent(content);
.setStoreId(storeId).setUserId(userId).setPerpetuity(NoticePerpetuityType.PERMANENT.getValue())
.setNoticeContent(content);
this.noticeMapper.insert(notice);
return this.userNoticeMapper.insert(new UserNotice().setNoticeId(notice.getId()).setUserId(userId).setReadStatus(NoticeReadType.UN_READ.getValue())
.setVoucherDate(java.sql.Date.valueOf(LocalDate.now())).setTargetNoticeType(targetNoticeType));
}
/**
* 10
*
* @return List<NoticeLatest10ResDTO>
*/
@Override
@Transactional(readOnly = true)
public List<NoticeLatest10ResDTO> latest10() {
List<Notice> noticeList = this.noticeMapper.selectList(new LambdaQueryWrapper<Notice>()
.eq(Notice::getNoticeType, NoticeType.ANNOUNCEMENT.getValue()).eq(Notice::getDelFlag, Constants.UNDELETED)
.eq(Notice::getOwnerType, NoticeOwnerType.SYSTEM.getValue()).orderByDesc(Notice::getCreateTime));
if (CollectionUtils.isEmpty(noticeList)) {
return new ArrayList<>();
}
final Date now = new Date();
return noticeList.stream().filter(x -> {
// 存在有效期,则判断是否在有效期内
if (Objects.equals(x.getPerpetuity(), NoticePerpetuityType.TEMPORARY.getValue())) {
return x.getEffectStart().before(now) && x.getEffectEnd().after(now);
}
return Boolean.TRUE;
}).limit(10)
.map(x -> new NoticeLatest10ResDTO().setId(x.getId()).setNoticeTitle(x.getNoticeTitle()))
.collect(Collectors.toList());
}
}

View File

@ -1096,7 +1096,7 @@ public class StoreProductServiceImpl implements IStoreProductService {
Notice notice = new Notice().setNoticeTitle(storeName + "商品上新啦!").setNoticeType(NoticeType.NOTICE.getValue())
.setNoticeContent(storeName + "上新了货号为: " + storeProd.getProdArtNum() + " 的商品!请及时关注!")
.setOwnerType(NoticeOwnerType.STORE.getValue()).setStoreId(storeProd.getStoreId())
.setUserId(userId).setPerpetuity(1);
.setUserId(userId).setPerpetuity(NoticePerpetuityType.PERMANENT.getValue());
this.noticeMapper.insert(notice);
final Date voucherDate = java.sql.Date.valueOf(LocalDate.now());
// 新增消息通知列表
@ -1131,7 +1131,7 @@ public class StoreProductServiceImpl implements IStoreProductService {
Notice notice = new Notice().setNoticeTitle(storeName + "商品更新啦!").setNoticeType(NoticeType.NOTICE.getValue())
.setNoticeContent(storeName + "更新了货号为: " + storeProd.getProdArtNum() + " 的商品!请及时关注!")
.setOwnerType(NoticeOwnerType.STORE.getValue()).setStoreId(storeProd.getStoreId())
.setUserId(userId).setPerpetuity(1);
.setUserId(userId).setPerpetuity(NoticePerpetuityType.PERMANENT.getValue());
this.noticeMapper.insert(notice);
final Date voucherDate = java.sql.Date.valueOf(LocalDate.now());
// 新增消息通知列表
@ -1168,7 +1168,8 @@ public class StoreProductServiceImpl implements IStoreProductService {
final Date voucherDate = java.sql.Date.valueOf(LocalDate.now());
storeProdList.forEach(storeProd -> {
// 新增一条档口消息通知
Notice notice = new Notice().setNoticeType(NoticeType.NOTICE.getValue()).setUserId(userId).setPerpetuity(1)
Notice notice = new Notice().setNoticeType(NoticeType.NOTICE.getValue()).setUserId(userId)
.setPerpetuity(NoticePerpetuityType.PERMANENT.getValue())
.setOwnerType(NoticeOwnerType.STORE.getValue()).setStoreId(storeProd.getStoreId())
.setNoticeTitle(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "" + "商品" + (offSale ? "下架" : "重新上架") + "啦!")
.setNoticeContent(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "" + (offSale ? "下架" : "重新上架")

View File

@ -379,11 +379,11 @@ public class WebsiteAPPServiceImpl implements IWebsiteAPPService {
Long userId = SecurityUtils.getUserIdSafe();
Map<Long, Long> focusStoreIdMap = ObjectUtils.isEmpty(userId) ? new HashMap<>()
: this.userSubMapper.selectList(new LambdaQueryWrapper<UserSubscriptions>()
.eq(UserSubscriptions::getUserId, userId).in(UserSubscriptions::getStoreId, storeList)
.eq(UserSubscriptions::getUserId, userId).in(UserSubscriptions::getStoreId, storeIdList)
.eq(UserSubscriptions::getDelFlag, Constants.UNDELETED)).stream()
.collect(Collectors.toMap(UserSubscriptions::getStoreId, UserSubscriptions::getStoreId));
List<APPStrengthStoreDTO> list = storeList.stream().map(store -> BeanUtil.toBean(store, APPStrengthStoreDTO.class)
.setFocus(focusStoreIdMap.containsKey(store.getId())).setMainPicUrl(storeFileMap.get(store.getId())))
.setStoreId(store.getId()).setFocus(focusStoreIdMap.containsKey(store.getId())).setMainPicUrl(storeFileMap.get(store.getId())))
.collect(Collectors.toList());
// 设置档口会员等级
list.forEach(x -> {

View File

@ -27,6 +27,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
spc.id AS storeProdColorId,
spc.color_name,
spcs.size,
sp.over_price,
spcs.standard,
sp.prod_art_num,
spcp.price,
( SELECT discount FROM store_customer_product_discount WHERE store_cus_id = #{storeCusId} AND store_prod_color_id = spc.id AND del_flag = 0 ) AS discount
@ -47,6 +49,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
spc.id AS storeProdColorId,
spc.color_name,
spcs.size,
sp.over_price,
spcs.standard,
sp.prod_art_num,
spcp.price,
( SELECT discount FROM store_customer_product_discount WHERE store_cus_id = #{storeCusId} AND store_prod_color_id = spc.id AND del_flag = 0 ) AS discount