shenjingwei 1 неделя назад
Родитель
Сommit
316bd2cf26

+ 7 - 4
src/custom/restcontroller/crm/agent/stock/invbal.java

@@ -19,7 +19,7 @@ public class invbal extends Controller {
 
     @API(title = "美大CRM_经销商_即时库存查询", type = API.Type.PageQuery, apiversion = R.ID2026031715005701.v1.class)
     public String sys_enterprise_invbal_querylist() throws YosException {
-        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_enterprise_invbal", "sys_enterprise_itemid", "qty").setTableAlias("t1");
+        QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_enterprise_invbal", "sys_enterprise_itemid", "sys_enterprise_stockid", "qty").setTableAlias("t1");
         querySQL.addJoinTable(JOINTYPE.inner, "sys_enterprise_item", "t2", "t1.sys_enterprise_itemid=t2.sys_enterprise_itemid", "itemid", "itemno", "itemname", "model", "spec", "color");
         querySQL.addJoinTable(JOINTYPE.inner, "sys_enterprise_stock", "t3", "t1.sys_enterprise_stockid=t3.sys_enterprise_stockid", "stockno", "stockname");
         querySQL.addJoinTable(JOINTYPE.left, "plm_unit", "t4", "t2.unitid=t4.unitid", "unitname");
@@ -43,19 +43,22 @@ public class invbal extends Controller {
     }
 
     @API(title = "美大CRM_经销商_总仓库存序列号查询", type = API.Type.PageQuery, apiversion = R.ID2026033015555101.v1.class, params = {
-            @Param(paramname = "itemid", fieldtype = FieldType.BigInt, remarks = "商品ID", isrequired = true),
+            @Param(paramname = "itemid", fieldtype = FieldType.BigInt, remarks = "商品ID,可不传", isrequired = true),
             @Param(paramname = "sys_enterprise_stockid", fieldtype = FieldType.BigInt, remarks = "仓库ID,可不传", isrequired = false),
     })
     public String sa_itemsku_querylist() throws YosException {
-        long itemid = content.getLong("itemid");
+        long itemid = content.getLongValue("itemid");
         long sys_enterprise_stockid = content.getLongValue("sys_enterprise_stockid");
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_itemsku").setTableAlias("t1");
         querySQL.addJoinTable(JOINTYPE.inner, "st_stock", "t2", "t1.stockid=t2.stockid and t2.stockno='00'");
-        querySQL.setWhere("t1.itemid", itemid);
+
         querySQL.setWhere("t1.sys_enterpriseid", sys_enterpriseid);
         if (sys_enterprise_stockid > 0) {
             querySQL.setWhere("t1.sys_enterprise_stockid", sys_enterprise_stockid);
         }
+        if (itemid > 0) {
+            querySQL.setWhere("t1.itemid", itemid);
+        }
         querySQL.setSiteid(siteid);
         querySQL.setPage(pageSize, pageNumber);
         Rows rows = querySQL.query();

+ 15 - 3
src/custom/restcontroller/webmanage/saletool/orderclue/publicclue/PublicClue.java

@@ -27,8 +27,8 @@ public class PublicClue extends Controller {
     @API(title = "公海线索-线索列表", apiversion = R.ID20221101094402.v1.class)
     public String selectList() throws YosException, IOException {
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_orderclue", "sat_orderclueid", "name", "phonenumber", "province", "city", "county", "address", "notes", "cluesource", "status", "cluetype", "createdate", "changedate").setTableAlias("t1");
-        querySQL.addJoinTable(JOINTYPE.left, "sat_orderclue_auth", "t2", "t1.sat_orderclueid=t2.sat_orderclueid ");
-        querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise", "t3", "t2.sys_enterpriseid=t3.sys_enterpriseid", "enterprisename");
+        querySQL.addJoinTable(JOINTYPE.left, "sat_orderclue_auth", "t2", "t1.sat_orderclueid=t2.sat_orderclueid ", "createdate as authtime");
+        querySQL.addJoinTable(JOINTYPE.left, "sv_agents", "t3", "t2.sys_enterpriseid=t3.sys_enterpriseid", "agentnum", "enterprisename", "abbreviation");
         querySQL.addJoinTable(JOINTYPE.left, "sys_enterprise_hr", "t4", "t2.hrid=t4.sys_enterprise_hrid");
         querySQL.addQueryFields("leadername", "ifnull(t4.name, '')");
         querySQL.setWhere("t1.isprivate", 0);
@@ -38,15 +38,20 @@ public class PublicClue extends Controller {
 
         QuerySQL lastfollowuplogquery = SQLFactory.createQuerySQL(this, "sat_ordercluefollowuplog", "sat_orderclueid");
         lastfollowuplogquery.addQueryFields("sat_ordercluefollowuplogid", "max(sat_ordercluefollowuplogid)");
+        lastfollowuplogquery.addQueryFields("first_ordercluefollowuplogid", "min(sat_ordercluefollowuplogid)");
         lastfollowuplogquery.addQueryFields("count", "count(0)");
         lastfollowuplogquery.addGroupBy("sat_orderclueid");
         lastfollowuplogquery.setWhere("sat_orderclueid", rows.toArrayList("sat_orderclueid"));
         Rows followuplogRows = lastfollowuplogquery.query();
         RowsMap followuplogRowsMap = followuplogRows.toRowsMap("sat_orderclueid");
         ArrayList<Long> sat_ordercluefollowuplogids = followuplogRows.toArrayList("sat_ordercluefollowuplogid", new ArrayList<>());
-
         RowsMap lastfollowuplogRowsMap = SQLFactory.createQuerySQL(this, "sat_ordercluefollowuplog").setWhere("sat_ordercluefollowuplogid", sat_ordercluefollowuplogids).query().toRowsMap("sat_orderclueid");
 
+
+        ArrayList<Long> first_ordercluefollowuplogids = followuplogRows.toArrayList("first_ordercluefollowuplogid", new ArrayList<>());
+        RowsMap firstfollowuplogRowsMap = SQLFactory.createQuerySQL(this, "sat_ordercluefollowuplog").setWhere("sat_ordercluefollowuplogid", first_ordercluefollowuplogids).query().toRowsMap("sat_orderclueid");
+
+
         for (Row row : rows) {
             Rows lognumRows = followuplogRowsMap.get(row.getString("sat_orderclueid"));
             if (lognumRows.isNotEmpty()) {
@@ -62,6 +67,13 @@ public class PublicClue extends Controller {
                 row.put("logtype", "");
                 row.put("followcontent", "");
             }
+
+            Rows firstlogtypeRows = firstfollowuplogRowsMap.get(row.getString("sat_orderclueid"));
+            if (firstlogtypeRows.isNotEmpty()) {
+                row.put("firstfollowuptime", firstlogtypeRows.get(0).getString("createdate"));
+            } else {
+                row.put("firstfollowuptime", "");
+            }
         }
         return getSucReturnObject().setData(rows).toString();
     }