通知中心调整

This commit is contained in:
张松 2025-04-08 09:54:06 +08:00
parent 5bd6bfd66f
commit 81b23506ac
4 changed files with 18 additions and 35 deletions

View File

@ -27,7 +27,7 @@ public class SyncNoticeController {
* @param name 名称
* @param startTime 起始时间
* @param endTime 结束时间
* @param type 0-商品 1-耗材
* @param type 0 商品新增 1 商品编辑 2 耗材新增 3 耗材编辑
* @param isRead 0-未读 1-已读
* @return 分页数据
*/

View File

@ -33,23 +33,13 @@ public class SyncNotice implements Serializable {
@Id(keyType = KeyType.Auto)
private Long id;
/**
* 商品名称或耗材名称
*/
private String name;
/**
* 来源id
*/
private Long sourceId;
/**
* 操作用户id
*/
private Long sysUserId;
/**
* 通知类型 0 商品变动 1 耗材变动
* 通知类型 0 商品新增 1 商品编辑 2耗材新增 3耗材编辑
*/
private Integer type;
@ -62,16 +52,14 @@ public class SyncNotice implements Serializable {
* 店铺id
*/
private Long shopId;
/**
* 操作类型 0 新增 1 修改
*/
private Integer operationType;
/**
* 消息内容
*/
private String content;
private String extraJson;
/**
* 创建时间
*/

View File

@ -20,10 +20,9 @@ public interface SyncNoticeService extends IService<SyncNotice> {
* @param sysUserId 操作用户id
* @param name 商品/耗材名称
* @param id 商品/耗材id
* @param type 0-商品 1-耗材
* @param operationType 0-新增 1-修改
* @param type 0 商品新增 1 商品编辑 2 耗材新增 3 耗材编辑
*/
void addNotice(Long shopId, Long sysUserId, String name, Long id, Integer type, Integer operationType);
void addNotice(Long shopId, Long sysUserId, String name, Long id, Integer type);
Page<SyncNotice> pageInfo(Long shopId, String name, String startTime, String endTime, Integer type, Integer isRead);

View File

@ -25,31 +25,27 @@ import java.util.List;
public class SyncNoticeServiceImpl extends ServiceImpl<SyncNoticeMapper, SyncNotice> implements SyncNoticeService {
@Override
public void addNotice(Long shopId, Long sysUserId, String name, Long id, Integer type, Integer operationType) {
public void addNotice(Long shopId, Long sysUserId, String name, Long id, Integer type) {
SyncNotice syncNotice = new SyncNotice();
syncNotice.setShopId(shopId);
syncNotice.setSysUserId(sysUserId);
syncNotice.setName(name);
syncNotice.setSourceId(id);
syncNotice.setType(type);
syncNotice.setOperationType(operationType);
String content = switch (operationType) {
case 0 -> "新增";
case 1 -> "修改";
String content = switch (type) {
case 0 -> "新增商品";
case 1 -> "修改商品";
case 2 -> "新增耗材";
case 3 -> "修改耗材";
default -> "";
};
switch (type) {
case 0:
content += "商品";
break;
case 1:
content += "耗材";
break;
}
String json = switch (type) {
case 0, 1, 2, 3 -> StrUtil.format("{\"id\":{},\"name\":\"{}\"}", id, name);
default -> "";
};
content = StrUtil.format("{}: {}, 请及时确认;", content, name);
syncNotice.setContent(content);
syncNotice.setExtraJson(json);
save(syncNotice);
}
@ -57,7 +53,7 @@ public class SyncNoticeServiceImpl extends ServiceImpl<SyncNoticeMapper, SyncNot
public Page<SyncNotice> pageInfo(Long shopId, String name, String startTime, String endTime, Integer type, Integer isRead) {
QueryWrapper queryWrapper = new QueryWrapper().eq(SyncNotice::getShopId, shopId);
if (StrUtil.isNotBlank(name)) {
queryWrapper.like(SyncNotice::getName, name);
queryWrapper.like(SyncNotice::getContent, name);
}
if (StrUtil.isNotBlank(startTime)) {