瀏覽代碼

Merge branch 'master' into 站内信

ezhizao_zx 3 月之前
父節點
當前提交
af4fdd5173

+ 1 - 0
src/main/java/cn/ezhizao/project/business/carrier/domain/BizCarrierCategory.java

@@ -75,4 +75,5 @@ public class BizCarrierCategory extends BaseEntity {
 
     // 是否允许多批
     private Integer isAllowMore;
+    private Integer isNone;
 }

+ 36 - 2
src/main/java/cn/ezhizao/project/business/notification/controller/SysNotificationController.java

@@ -74,6 +74,12 @@ public class SysNotificationController extends BaseController
     {
         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
     {
         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
     {
         setTenantId(sysNotification);
-        return toAjax(sysNotificationService.updateById(sysNotification));
+        if(canSave(sysNotification)){
+            return toAjax(sysNotificationService.updateById(sysNotification));
+        }
+        return error("已经存在发版公告,不能修改");
     }
 
     /**