通知中心调整
This commit is contained in:
@@ -27,7 +27,7 @@ public class SyncNoticeController {
|
|||||||
* @param name 名称
|
* @param name 名称
|
||||||
* @param startTime 起始时间
|
* @param startTime 起始时间
|
||||||
* @param endTime 结束时间
|
* @param endTime 结束时间
|
||||||
* @param type 0-商品 1-耗材
|
* @param type 0 商品新增 1 商品编辑 2 耗材新增 3 耗材编辑
|
||||||
* @param isRead 0-未读 1-已读
|
* @param isRead 0-未读 1-已读
|
||||||
* @return 分页数据
|
* @return 分页数据
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -33,23 +33,13 @@ public class SyncNotice implements Serializable {
|
|||||||
@Id(keyType = KeyType.Auto)
|
@Id(keyType = KeyType.Auto)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 商品名称或耗材名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 来源id
|
|
||||||
*/
|
|
||||||
private Long sourceId;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作用户id
|
* 操作用户id
|
||||||
*/
|
*/
|
||||||
private Long sysUserId;
|
private Long sysUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通知类型 0 商品变动 1 耗材变动
|
* 通知类型 0 商品新增 1 商品编辑 2耗材新增 3耗材编辑
|
||||||
*/
|
*/
|
||||||
private Integer type;
|
private Integer type;
|
||||||
|
|
||||||
@@ -62,16 +52,14 @@ public class SyncNotice implements Serializable {
|
|||||||
* 店铺id
|
* 店铺id
|
||||||
*/
|
*/
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
/**
|
|
||||||
* 操作类型 0 新增 1 修改
|
|
||||||
*/
|
|
||||||
private Integer operationType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 消息内容
|
* 消息内容
|
||||||
*/
|
*/
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
|
private String extraJson;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,10 +20,9 @@ public interface SyncNoticeService extends IService<SyncNotice> {
|
|||||||
* @param sysUserId 操作用户id
|
* @param sysUserId 操作用户id
|
||||||
* @param name 商品/耗材名称
|
* @param name 商品/耗材名称
|
||||||
* @param id 商品/耗材id
|
* @param id 商品/耗材id
|
||||||
* @param type 0-商品 1-耗材
|
* @param type 0 商品新增 1 商品编辑 2 耗材新增 3 耗材编辑
|
||||||
* @param operationType 0-新增 1-修改
|
|
||||||
*/
|
*/
|
||||||
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);
|
Page<SyncNotice> pageInfo(Long shopId, String name, String startTime, String endTime, Integer type, Integer isRead);
|
||||||
|
|
||||||
|
|||||||
@@ -25,31 +25,27 @@ import java.util.List;
|
|||||||
public class SyncNoticeServiceImpl extends ServiceImpl<SyncNoticeMapper, SyncNotice> implements SyncNoticeService {
|
public class SyncNoticeServiceImpl extends ServiceImpl<SyncNoticeMapper, SyncNotice> implements SyncNoticeService {
|
||||||
|
|
||||||
@Override
|
@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 syncNotice = new SyncNotice();
|
||||||
syncNotice.setShopId(shopId);
|
syncNotice.setShopId(shopId);
|
||||||
syncNotice.setSysUserId(sysUserId);
|
syncNotice.setSysUserId(sysUserId);
|
||||||
syncNotice.setName(name);
|
|
||||||
syncNotice.setSourceId(id);
|
|
||||||
syncNotice.setType(type);
|
syncNotice.setType(type);
|
||||||
syncNotice.setOperationType(operationType);
|
String content = switch (type) {
|
||||||
String content = switch (operationType) {
|
case 0 -> "新增商品";
|
||||||
case 0 -> "新增";
|
case 1 -> "修改商品";
|
||||||
case 1 -> "修改";
|
case 2 -> "新增耗材";
|
||||||
|
case 3 -> "修改耗材";
|
||||||
default -> "";
|
default -> "";
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (type) {
|
String json = switch (type) {
|
||||||
case 0:
|
case 0, 1, 2, 3 -> StrUtil.format("{\"id\":{},\"name\":\"{}\"}", id, name);
|
||||||
content += "商品";
|
default -> "";
|
||||||
break;
|
};
|
||||||
case 1:
|
|
||||||
content += "耗材";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
content = StrUtil.format("{}: {}, 请及时确认;", content, name);
|
content = StrUtil.format("{}: {}, 请及时确认;", content, name);
|
||||||
syncNotice.setContent(content);
|
syncNotice.setContent(content);
|
||||||
|
syncNotice.setExtraJson(json);
|
||||||
save(syncNotice);
|
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) {
|
public Page<SyncNotice> pageInfo(Long shopId, String name, String startTime, String endTime, Integer type, Integer isRead) {
|
||||||
QueryWrapper queryWrapper = new QueryWrapper().eq(SyncNotice::getShopId, shopId);
|
QueryWrapper queryWrapper = new QueryWrapper().eq(SyncNotice::getShopId, shopId);
|
||||||
if (StrUtil.isNotBlank(name)) {
|
if (StrUtil.isNotBlank(name)) {
|
||||||
queryWrapper.like(SyncNotice::getName, name);
|
queryWrapper.like(SyncNotice::getContent, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(startTime)) {
|
if (StrUtil.isNotBlank(startTime)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user