吴志根 3 rokov pred
rodič
commit
547f701a86

+ 6 - 0
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/SQL/获取浏览电话分享.sql

@@ -0,0 +1,6 @@
+select isnull(t2.fname,'ÄäÃû') fname, t1.createdate, t1.tenterprise_userid
+from tsupplyanddemand_log t1
+         left JOIN tenterprise_users t2
+                   ON t1.tenterprise_userid = t2.tenterprise_userid
+WHERE t1.tsupplyanddemandid = $tsupplyanddemandid$
+  AND t1.ftype = $ftype$

+ 7 - 0
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/SQL/获取浏览电话分享前十.sql

@@ -0,0 +1,7 @@
+select top 10 isnull(t2.fname,'ÄäÃû') fname, t1.createdate, t1.tenterprise_userid
+from tsupplyanddemand_log t1
+         left JOIN tenterprise_users t2
+                   ON t1.tenterprise_userid = t2.tenterprise_userid
+WHERE t1.tsupplyanddemandid = $tsupplyanddemandid$
+  AND t1.ftype = $ftype$
+order by t1.createdate desc

+ 86 - 0
src/dsb/com/cnd3b/restcontroller/customer/supplyanddemand/supplyanddemand.java

@@ -9,6 +9,7 @@ import com.cnd3b.common.data.Rows;
 import com.cnd3b.common.data.RowsMap;
 import com.cnd3b.common.data.SQLFactory;
 import com.cnd3b.common.parameter.parameter;
+import p2.common.parse.J;
 import p2.pao.PaoRemote;
 import p2.pao.PaoSetRemote;
 import p2.util.P2Exception;
@@ -464,4 +465,89 @@ public class supplyanddemand extends Controller {
         logPaoSetRemote.save();
     }
 
+
+    /**
+     * 获取某个用户的分享总次数、电话总数、浏览总数
+     *
+     * @return
+     */
+    public String getsupplyanddemandtimes() {
+
+        Long tenterprise_userid = content.getLong("tenterprise_userid");
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("freadtimes", getTimesSQl(tenterprise_userid, 1));
+        jsonObject.put("fphonetimes", getTimesSQl(tenterprise_userid, 2));
+        jsonObject.put("fsharetimes", getTimesSQl(tenterprise_userid, 3));
+        return getSucReturnObject().setData(jsonObject).toString();
+
+
+    }
+
+    public int getTimesSQl(Long tenterprise_userid, int ftype) {
+        String sql = "SELECT COUNT (*) num FROM tsupplyanddemand_log t1 LEFT JOIN tsupplyanddemand t2 ON t1.tenterprise_userid =t2.tenterprise_userid WHERE t1.tenterprise_userid ='" + tenterprise_userid + "' AND t1.ftype ='" + ftype + "'";
+        Rows rows = dbConnect.runSqlQuery(sql);
+        if (rows.isEmpty()) {
+            return 0;
+        }
+        return rows.get(0).getInteger("num");
+    }
+
+
+    /**
+     * 获取某个供需的记录(浏览,分享,电话)
+     *
+     * @return
+     */
+    public String getsupplyanddemandLogTop10() {
+        Long tsupplyanddemandid = content.getLong("tsupplyanddemandid");
+
+
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("read", getTop10Rows(tsupplyanddemandid, 1));
+        jsonObject.put("phone", getTop10Rows(tsupplyanddemandid, 2));
+        jsonObject.put("share", getTop10Rows(tsupplyanddemandid, 3));
+
+        return getSucReturnObject().setData(jsonObject).toString();
+
+
+    }
+
+    public Rows getTop10Rows(Long tsupplyanddemandid, int ftype) {
+        SQLFactory sqlFactory = new SQLFactory(this, "获取浏览电话分享前十");
+        sqlFactory.addParameter("tsupplyanddemandid", tsupplyanddemandid);
+        sqlFactory.addParameter("ftype", ftype);
+
+        Rows rows = dbConnect.runSqlQuery(sqlFactory);
+        for (Row row : rows) {
+            //创建者头像
+            row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
+        }
+
+        return rows;
+    }
+
+    /**
+     * 获取某个供需的记录(浏览,分享,电话)(分页)
+     *
+     * @return
+     */
+    public String getsupplyanddemandLogList() {
+        Long tsupplyanddemandid = content.getLong("tsupplyanddemandid");
+        int ftype = content.getIntValue("ftype");
+
+        SQLFactory sqlFactory = new SQLFactory(this, "获取浏览电话分享", pageSize, pageNumber, "t1.createdate desc");
+        sqlFactory.addParameter("tsupplyanddemandid", tsupplyanddemandid);
+        sqlFactory.addParameter("ftype", ftype);
+
+        Rows rows = dbConnect.runSqlQuery(sqlFactory);
+        for (Row row : rows) {
+            //创建者头像
+            row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
+        }
+
+        return getSucReturnObject().setDataByPaging(rows).preloading(1).toString();
+
+    }
+
+
 }