eganwu преди 1 година
родител
ревизия
668c536b41

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

@@ -6433,6 +6433,11 @@ public class R {
         public static class v1 {
         }
     }
+
+    public static class ID20240515153202 {
+        public static class v1 {
+        }
+    }
 }
 
 

+ 72 - 0
src/custom/restcontroller/webmanage/saletool/fad/FadGoods.java

@@ -11,6 +11,7 @@ import common.annotation.API;
 import common.data.*;
 import org.apache.commons.lang.StringUtils;
 import restcontroller.R;
+import restcontroller.system.dataauth.DataAuthHelper;
 
 import java.util.ArrayList;
 
@@ -80,6 +81,13 @@ public class FadGoods extends Controller {
                 InsertSQL sqlFactory = FadHelper.getFadInsertSQL(this, sa_fadid, parentid);
                 listSQL.add(sqlFactory.getSQL());
                 content.put("sa_fadid", sa_fadid);
+                //修改
+                content.put("ownertable", "sa_fad");
+                content.put("ownerid", sa_fadid);
+                Long sys_dataauthid = createTableID("sys_dataauth");
+                listSQL.add(DataAuthHelper.getDataAuthInsertSQL(this, sys_dataauthid).getSQL());
+                listSQL.add(DataAuthHelper.getDataAuthsInsertSQL(this, "sys_enterpriseid", sys_enterpriseid).getSQL());
+
             } else {
                 UpdateSQL sqlFactory = FadHelper.getFadUpdateSQL(this, sa_fadid);
                 listSQL.add(sqlFactory.getSQL());
@@ -347,6 +355,7 @@ public class FadGoods extends Controller {
         querySQL.setWhere("classid", 2);
         querySQL.setWhere("isonsale", 1);
         querySQL.setWhere(where.toString());
+        querySQL.setDataAuth(true);
         querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();
 
@@ -364,6 +373,69 @@ public class FadGoods extends Controller {
         }
 
 
+        return getSucReturnObject().setData(rows).toString();
+    }
+
+    @API(title = "获取门店调整商品列表", apiversion = R.ID20240515153202.v1.class)
+    public String getAdjustStoreList() throws YosException {
+        /*
+          过滤条件设置
+         */
+        StringBuffer where = new StringBuffer(" 1=1 ");
+        if (content.containsKey("where")) {
+            JSONObject whereObject = content.getJSONObject("where");
+            if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
+                where.append(" and (");
+                where.append("t1.name like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append("or t2.tag like'%").append(whereObject.getString("condition")).append("%' ");
+                where.append(")");
+            }
+
+
+            if (whereObject.containsKey("class") && !"".equals(whereObject.getString("class"))) {
+                where.append(" and (");
+                where.append("JSON_CONTAINS(t1.class,'\"" + whereObject.getString("class") + "\"')");
+                where.append(")");
+            }
+
+        }
+
+        ArrayList<Long> sys_enterpriseids = new ArrayList<Long>();
+        Long sys_enterpriseid = content.getLongValue("sys_enterpriseid");
+        if (sys_enterpriseid == -1) {
+            return getSucReturnObject().setData(new Rows()).toString();
+        }
+        sys_enterpriseids.add(sys_enterpriseid);
+        sys_enterpriseids.add(0L);
+
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, sa_fad,
+                        "sa_fadid", "name", "pricetype", "price", "price_deposit", "unitname")
+                .setTableAlias("t1");
+
+        querySQL.addJoinTable(JOINTYPE.left, "sys_datatag", "t2", "t2.ownertable='sa_fad' and t2.ownerid=t1.sa_fadid and t2.siteid=t1.siteid");
+        querySQL.setSiteid(siteid);
+        querySQL.setWhere("not EXISTS(SELECT 1 from sa_fad WHERE sys_enterpriseid=" + sys_enterpriseid + " and parentid=t1.sa_fadid and siteid=t1.siteid)");
+        querySQL.setWhere("sys_enterpriseid", sys_enterpriseids);
+        querySQL.setWhere("classid", 2);
+        querySQL.setWhere("isonsale", 1);
+        querySQL.setWhere("canadjust", 1);
+        querySQL.setWhere(where.toString());
+        querySQL.setDataAuth(true);
+        querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
+        Rows rows = querySQL.query();
+
+
+        ArrayList<Long> ids = rows.toArrayList("sa_fadid", new ArrayList<>());
+        // 附件
+        RowsMap RowsMap = getAttachmentUrl(sa_fad, ids);
+        for (Row row : rows) {
+            Rows attRows = RowsMap.getOrDefault(row.getString("sa_fadid"), new Rows());
+            attRows.sortby("sequence", "linksid");
+            row.put("attinfos", attRows);
+        }
+
+
         return getSucReturnObject().setData(rows).toString();
     }
 }

+ 1 - 0
src/custom/restcontroller/webmanage/users/visitors.java

@@ -60,6 +60,7 @@ public class visitors extends Controller {
 
         row.putAll(getUser(userid));
         row.put("headpic", getHeadPic(userid));
+        row.put("attinfos", Attachment.get(this,"sys_users",userid,"headportrait"));
         //查询角色
         Rows rolenameRows = dbConnect.runSqlQuery("select rolename from sys_userrole t1 " +
                 "inner join sys_role t2 ON t2.roleid=t1.roleid and t2.siteid=t1.siteid " +