Ver código fonte

经销商查重规则

wu 2 meses atrás
pai
commit
d0b910aa77

+ 5 - 0
src/custom/restcontroller/R.java

@@ -7497,6 +7497,11 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID2025111215082702 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 20 - 8
src/custom/restcontroller/webmanage/site/site.java

@@ -9,10 +9,7 @@ import common.annotation.API;
 import common.annotation.CACHEING;
 import common.annotation.CACHEING_CLEAN;
 import common.annotation.cm;
-import common.data.Row;
-import common.data.Rows;
-import common.data.RowsMap;
-import common.data.SQLFactory;
+import common.data.*;
 import restcontroller.R;
 
 @API(title = "企业站点管理")
@@ -129,7 +126,7 @@ public class site extends Controller {
         sqlFactory.addParameter("custcheckrule", custcheckrule);
         sqlFactory.addParameter("siteid", siteid);
         dbConnect.runSqlUpdate(sqlFactory);
-        return getSucReturnObject().toString();
+        return selectRule();
     }
 
     @API(title = "项目查重规则", apiversion = R.ID20230408091702.v1.class)
@@ -144,7 +141,7 @@ public class site extends Controller {
         sqlFactory.addParameter("projectnameexcludefields", projectnameexcludefields);
         sqlFactory.addParameter("siteid", siteid);
         dbConnect.runSqlUpdate(sqlFactory);
-        return getSucReturnObject().toString();
+        return selectRule();
     }
 
     @API(title = "项目报备规则", apiversion = R.ID20230408091802.v1.class)
@@ -154,12 +151,12 @@ public class site extends Controller {
         sqlFactory.addParameter("projectcheckfields", projectcheckfields);
         sqlFactory.addParameter("siteid", siteid);
         dbConnect.runSqlUpdate(sqlFactory);
-        return getSucReturnObject().toString();
+        return selectRule();
     }
 
     @API(title = "规则查询", apiversion = R.ID20230410090502.v1.class)
     public String selectRule() throws YosException {
-        Rows rows = dbConnect.runSqlQuery("SELECT custcheckrule, projectcheckrule,projectprotectionperiod,projectcheckfields,projectnameexcludefields from sys_site_parameter WHERE siteid='" + siteid + "' ");
+        Rows rows = dbConnect.runSqlQuery("SELECT agentcheckrule,custcheckrule, projectcheckrule,projectprotectionperiod,projectcheckfields,projectnameexcludefields from sys_site_parameter WHERE siteid='" + siteid + "' ");
         Row row = new Row();
         if (rows.isNotEmpty()) {
             row = rows.get(0);
@@ -175,9 +172,24 @@ public class site extends Controller {
                 String json = "[]";
                 row.put("projectcheckfields", JSONObject.parse(json));
             }
+            if (row.getJSONObject("agentcheckrule").isEmpty()) {
+                String json = "{\"factor1\":\"and\",\"factor2\":\"and\",\"factor3\":\"and\",\"fields1\":[],\"fields2\":[],\"fields3\":[]}";
+                row.put("agentcheckrule", JSONObject.parse(json));
+            }
         }
 
         return getSucReturnObject().setData(row).toString();
     }
 
+    @API(title = "更新查重规则", apiversion = R.ID2025111215082702.v1.class)
+    public String updateRules() throws YosException {
+        JSONObject agentcheckrule = content.getJSONObject("agentcheckrule");
+        UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_site_parameter");
+        updateSQL.setSiteid(siteid);
+        updateSQL.setValue("agentcheckrule", agentcheckrule);
+        updateSQL.update();
+        return selectRule();
+    }
+
+
 }