|
@@ -74,6 +74,12 @@ public class SysNotificationController extends BaseController
|
|
{
|
|
{
|
|
return success(sysNotificationService.getById(id));
|
|
return success(sysNotificationService.getById(id));
|
|
}
|
|
}
|
|
|
|
+ @Log(title = "搜索更新中,公告中的发版内容", businessType = BusinessType.SELECT)
|
|
|
|
+ @GetMapping(value = "/getFbNotification")
|
|
|
|
+ public AjaxResult getFbNotification(SysNotification sysNotification) throws NoSuchFieldException, IllegalAccessException
|
|
|
|
+ {
|
|
|
|
+ return success(sysNotificationService.query().eq("type", 2).in("status", 1, 2).list());
|
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 新增发版通知公告
|
|
* 新增发版通知公告
|
|
@@ -84,7 +90,32 @@ public class SysNotificationController extends BaseController
|
|
public AjaxResult add(@RequestBody SysNotification sysNotification) throws NoSuchFieldException, IllegalAccessException
|
|
public AjaxResult add(@RequestBody SysNotification sysNotification) throws NoSuchFieldException, IllegalAccessException
|
|
{
|
|
{
|
|
setTenantId(sysNotification);
|
|
setTenantId(sysNotification);
|
|
- return toAjax(sysNotificationService.save(sysNotification));
|
|
|
|
|
|
+ if(canSave(sysNotification)){
|
|
|
|
+ return toAjax(sysNotificationService.save(sysNotification));
|
|
|
|
+ }
|
|
|
|
+ return error("已经存在发版公告,不能新增");
|
|
|
|
+ }
|
|
|
|
+ //判断如果系统公告类型是发版,且存在其状态为公告中,更新中,不能保存
|
|
|
|
+ public boolean canSave(SysNotification sysNotification) {
|
|
|
|
+ //发版且状态为更新中、公告中
|
|
|
|
+ if(sysNotification.getType() == 2 && (sysNotification.getStatus() == 1 || sysNotification.getStatus() == 2)){
|
|
|
|
+ //新增
|
|
|
|
+ if(sysNotification.getId() == null){
|
|
|
|
+ List<SysNotification> list = sysNotificationService.query().eq("type", 2).in("status", 1, 2).list();
|
|
|
|
+ if (!list.isEmpty()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }else{
|
|
|
|
+ List<SysNotification> list = sysNotificationService.query()
|
|
|
|
+ .eq("type", 2).in("status", 1, 2).ne("id", sysNotification.getId()).list();
|
|
|
|
+ if (!list.isEmpty()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return true;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -96,7 +127,10 @@ public class SysNotificationController extends BaseController
|
|
public AjaxResult edit(@RequestBody SysNotification sysNotification) throws NoSuchFieldException, IllegalAccessException
|
|
public AjaxResult edit(@RequestBody SysNotification sysNotification) throws NoSuchFieldException, IllegalAccessException
|
|
{
|
|
{
|
|
setTenantId(sysNotification);
|
|
setTenantId(sysNotification);
|
|
- return toAjax(sysNotificationService.updateById(sysNotification));
|
|
|
|
|
|
+ if(canSave(sysNotification)){
|
|
|
|
+ return toAjax(sysNotificationService.updateById(sysNotification));
|
|
|
|
+ }
|
|
|
|
+ return error("已经存在发版公告,不能修改");
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|