Pārlūkot izejas kodu

Merge branch 'develop'

hu 1 gadu atpakaļ
vecāks
revīzija
702beefd52

BIN
lib/yos.core-2.2.4-sources.jar → lib/yos.core-2.3.0-sources.jar


BIN
lib/yos.core-2.2.4.jar → lib/yos.core-2.3.0.jar


+ 16 - 1
src/custom/restcontroller/R.java

@@ -5354,7 +5354,22 @@ public class R {
         public static class v1 {
         }
     }
-
+    public static class ID20231201144302 {
+        public static class v1 {
+        }
+    }
+    public static class ID20231201145402 {
+        public static class v1 {
+        }
+    }
+    public static class ID20231201145502 {
+        public static class v1 {
+        }
+    }
+    public static class ID20231201153702 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 143 - 0
src/custom/restcontroller/webmanage/role/RoleOptionLimit.java

@@ -0,0 +1,143 @@
+package restcontroller.webmanage.role;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.huaweicloud.sdk.meeting.v1.model.SearchQosHistoryMeetingsRequest;
+import common.BaseClass;
+import common.Controller;
+import common.YosException;
+import common.annotation.API;
+import common.data.*;
+import restcontroller.R;
+
+import java.util.ArrayList;
+
+/**
+ * 用户角色选项权限-sys_role_optionlimit
+ */
+public class RoleOptionLimit extends Controller {
+    /**
+     * 构造函数
+     *
+     * @param content
+     */
+    public RoleOptionLimit(JSONObject content) throws YosException {
+        super(content);
+    }
+
+    @API(title = "角色选项权限-新增或更新", apiversion = R.ID20231201144302.v1.class)
+    public String insertOrUpdate() throws YosException {
+
+        Long optiontypeid = content.getLongValue("optiontypeid");
+        Long roleid = content.getLongValue("roleid");
+        JSONArray values = content.getJSONArray("values");
+
+        if (optiontypeid <= 0) {
+            return getErrReturnObject().setErrMsg("请选择分类项").toString();
+        }
+        if (roleid <= 0) {
+            return getErrReturnObject().setErrMsg("请选择角色").toString();
+        }
+
+        ArrayList<String> sqlList = new ArrayList<>();
+
+        for (Object obj : values) {
+            String value = obj.toString();
+            InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_role_optionlimit");
+            insertSQL.setUniqueid(createTableID("sys_role_optionlimit"));
+            insertSQL.setValue("roleid", roleid);
+            insertSQL.setValue("optiontypeid", optiontypeid);
+            insertSQL.setValue("value", value);
+            insertSQL.setWhere("not exists(select 1 from  sys_role_optionlimit where roleid=" + roleid + " and optiontypeid=" + optiontypeid + " and value='" + value + "' )");
+            sqlList.add(insertSQL.getSQL());
+        }
+        String deleteSql = "DELETE from sys_role_optionlimit WHERE roleid=" + roleid + " and optiontypeid=" + optiontypeid;
+        if (values.size() > 0) {
+            deleteSql = deleteSql + " and value not in " + values;
+        }
+        sqlList.add(deleteSql.replace("[", "(").replace("]", ")"));
+
+        dbConnect.runSqlUpdate(sqlList);
+
+
+        return detail();
+    }
+
+    @API(title = "角色选项权限-删除", apiversion = R.ID20231201145402.v1.class)
+    public String delete() throws YosException {
+
+        Long optiontypeid = content.getLongValue("optiontypeid");
+        Long roleid = content.getLongValue("roleid");
+        String deleteSql = "DELETE from sys_role_optionlimit WHERE optiontypeid = " + optiontypeid + " and roleid=" + roleid + "";
+        dbConnect.runSqlUpdate(deleteSql);
+
+
+        return getSucReturnObject().toString();
+    }
+
+    @API(title = "角色选项权限-列表", apiversion = R.ID20231201145502.v1.class)
+    public String list() throws YosException {
+        Long roleid = content.getLongValue("roleid");
+
+        SQLFactory sqlFactory = new SQLFactory(this, "角色选项限制查询列表", pageSize, pageNumber, pageSorting);
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("roleid", roleid);
+        Rows rows = sqlFactory.runSqlQuery(dbConnect);
+
+        RowsMap optiontypemxMap = new RowsMap();
+
+        if (rows.isNotEmpty()) {
+            String sql = "SELECT distinct optiontypeid,value from sys_optiontypemx WHERE optiontypeid in " + rows.toArrayList("optiontypeid");
+            optiontypemxMap = dbConnect.runSqlQuery(sql.replace("[", "(").replace("]", ")")).toRowsMap("optiontypeid");
+        }
+
+        for (Row row : rows) {
+            Rows optiontypemxRows = optiontypemxMap.getOrDefault(row.getString("optiontypeid"), new Rows());
+//            for (Row optiontypemxRow : optiontypemxRows) {
+//                optiontypemxRow.putIfAbsent("subvalues", new JSONArray());
+//            }
+
+//            row.put("optiontypemxall", optiontypemxRows);
+            row.put("optiontypemx", optiontypemxRows.toArray("value"));
+            Long optiontypeid = row.getLong("optiontypeid");
+            Rows valuerows = dbConnect.runSqlQuery("SELECT `value` from sys_role_optionlimit WHERE roleid=" + roleid + " and optiontypeid=" + optiontypeid);
+            row.put("values", valuerows.toArray("value"));
+        }
+
+
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+    @API(title = "详细", apiversion = R.ID20231201153702.v1.class)
+    public String detail() throws YosException {
+        Long optiontypeid = content.getLongValue("optiontypeid");
+        Long roleid = content.getLongValue("roleid");
+
+        SQLFactory sqlFactory = new SQLFactory(this, "角色选项限制查询详情");
+        sqlFactory.addParameter("siteid", siteid);
+        sqlFactory.addParameter("optiontypeid", optiontypeid);
+        sqlFactory.addParameter("roleid", roleid);
+        Rows rows = sqlFactory.runSqlQuery(dbConnect);
+        if (rows.isEmpty()) {
+            return getSucReturnObject().setData(new Row()).toString();
+        }
+
+        String sql = "SELECT distinct optiontypeid,value from sys_optiontypemx WHERE optiontypeid in " + rows.toArrayList("optiontypeid");
+        RowsMap optiontypemxMap = dbConnect.runSqlQuery(sql.replace("[", "(").replace("]", ")")).toRowsMap("optiontypeid");
+
+        for (Row row : rows) {
+            Rows optiontypemxRows = optiontypemxMap.getOrDefault(row.getString("optiontypeid"), new Rows());
+//            for (Row optiontypemxRow : optiontypemxRows) {
+//                optiontypemxRow.putIfAbsent("subvalues", new JSONArray());
+//            }
+//            row.put("optiontypemxall", optiontypemxRows);
+            row.put("optiontypemx", optiontypemxRows.toArray("value"));
+
+            Rows valuerows = dbConnect.runSqlQuery("SELECT `value` from sys_role_optionlimit WHERE roleid=" + roleid + " and optiontypeid=" + optiontypeid);
+            row.put("values", valuerows.toArray("value"));
+        }
+
+
+        return getSucReturnObject().setData(rows.get(0)).toString();
+    }
+}

+ 9 - 0
src/custom/restcontroller/webmanage/role/SQL/角色选项限制查询列表.sql

@@ -0,0 +1,9 @@
+SELECT t1.*
+from (
+         SELECT DISTINCT t1.roleid, t1.optiontypeid, t2.remarks optionttypename, t3.rolename
+         from sys_role_optionlimit t1
+                  LEFT JOIN sys_optiontype t2 ON t2.optiontypeid = t1.optiontypeid
+                  LEFT JOIN sys_role t3 ON t3.roleid = t1.roleid
+         where t3.siteid = $siteid$
+           and t1.roleid = $roleid$
+     ) t1

+ 7 - 0
src/custom/restcontroller/webmanage/role/SQL/角色选项限制查询详情.sql

@@ -0,0 +1,7 @@
+SELECT DISTINCT t1.roleid, t1.optiontypeid, t2.remarks optionttypename, t3.rolename
+from sys_role_optionlimit t1
+         LEFT JOIN sys_optiontype t2 ON t2.optiontypeid = t1.optiontypeid
+         LEFT JOIN sys_role t3 ON t3.roleid = t1.roleid
+where t3.siteid = $siteid$
+  and t1.roleid = $roleid$
+  and t1.optiontypeid = $optiontypeid$

+ 2 - 2
src/custom/restcontroller/webmanage/sale/order/OrderItems.java

@@ -901,10 +901,10 @@ public class OrderItems extends Controller {
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_orderitems",
                 "sa_orderitemsid", "itemid", "rowno", "itemno", "itemname", "unit", "qty", "undeliqty", "saleprice", "defaultprice", "price", "amount", "remarks", "customproperties", "batchcontrol", "model",
                 "conversionrate", "marketprice", "defaultprice", "defaultamount", "auxqty", "needdate", "deliedqty", "rebateamount", "invoiceamount", "writeoffamount", "auxunit", "sa_orderid",
-                "deliverydate", "returnqty", "stockno", "position", "batchno", "isfreeze", "decorationrebateflag");
+                "deliverydate", "returnqty", "stockno", "position", "batchno", "isfreeze", "decorationrebateflag", "spec");
         querySQL.setTableAlias("t1");
         querySQL.addJoinTable(JOINTYPE.left, "plm_item", "t3", "t3.itemid = t1.itemid and t3.siteid = t1.siteid",
-                "orderminqty_auxunit", "orderminqty", "orderaddqty_auxunit", "orderaddqty", "spec", "standards", "packageqty", "delivery", "k3outcode");
+                "orderminqty_auxunit", "orderminqty", "orderaddqty_auxunit", "orderaddqty", "standards", "packageqty", "delivery", "k3outcode");
         querySQL.addJoinTable(JOINTYPE.left, "sa_order", "t5", "t5.sa_orderid = t1.sa_orderid and t5.siteid = t1.siteid",
                 "sonum", "type", "typemx", "status", "billdate", "submitdate", "checkdate", "tradefield", "closedate", "remarks");
         querySQL.addJoinTable(JOINTYPE.left, "sa_agents", "t6", "t6.sys_enterpriseid = t5.sys_enterpriseid and t6.siteid = t5.siteid",