|
|
@@ -126,7 +126,7 @@ public class supplyanddemand extends Controller {
|
|
|
// * 阅读次数+1
|
|
|
// */
|
|
|
// dbConnect.runSqlUpdate("update tsupplyanddemand set freadtimes=isnull(freadtimes,0)+1 where siteid='" + siteid + "' and tsupplyanddemandid='" + tsupplyanddemandid + "'");
|
|
|
- addsupplyanddemandLog(tsupplyanddemandid, 1,userid);
|
|
|
+ addsupplyanddemandLog(tsupplyanddemandid, 1, userid);
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "供需详情查询");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("tsupplyanddemandid", tsupplyanddemandid);
|
|
|
@@ -230,10 +230,18 @@ public class supplyanddemand extends Controller {
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
RowsMap attinfoRowsMap = getAttachmentUrl("tsupplyanddemand", rows.toArrayList("tsupplyanddemandid"));
|
|
|
|
|
|
+ RowsMap readRowsMap = getTop10Rows(rows.toArrayList("tsupplyanddemandid"),1).toRowsMap("tsupplyanddemandid");
|
|
|
+ RowsMap phoneRowsMap = getTop10Rows(rows.toArrayList("tsupplyanddemandid"),2).toRowsMap("tsupplyanddemandid");
|
|
|
+ RowsMap shareRowsMap = getTop10Rows(rows.toArrayList("tsupplyanddemandid"),3).toRowsMap("tsupplyanddemandid");
|
|
|
+
|
|
|
for (Row row : rows) {
|
|
|
row.put("attinfos", attinfoRowsMap.get(row.getString("tsupplyanddemandid")));
|
|
|
//创建者头像
|
|
|
row.put("headportraiturl", getHeadPic(row.getLong("tenterprise_userid")));
|
|
|
+ row.put("read", readRowsMap.get(row.getString("tsupplyanddemandid")));
|
|
|
+ row.put("phone", phoneRowsMap.get(row.getString("tsupplyanddemandid")));
|
|
|
+ row.put("share", shareRowsMap.get(row.getString("tsupplyanddemandid")));
|
|
|
+ row.put("indexTab", 0);
|
|
|
}
|
|
|
return getSucReturnObject().setDataByPaging(rows).saveToDataPool().toString();
|
|
|
}
|
|
|
@@ -393,10 +401,10 @@ public class supplyanddemand extends Controller {
|
|
|
*/
|
|
|
public String deletesupplyanddemand() {
|
|
|
long tsupplyanddemandid = content.getLongValue("tsupplyanddemandid");
|
|
|
- Rows rows = dbConnect.runSqlQuery("select * from tsupplyanddemand where siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and tsupplyanddemandid='" + tsupplyanddemandid + "'");
|
|
|
- if (!rows.isEmpty() && !"新建".equals(rows.get(0).getString("fstatus"))) {
|
|
|
- return getErrReturnObject().setErrMsg("当前状态不可删除").toString();
|
|
|
- }
|
|
|
+// Rows rows = dbConnect.runSqlQuery("select * from tsupplyanddemand where siteid='" + siteid + "' and tagentsid='" + tagentsid + "' and tsupplyanddemandid='" + tsupplyanddemandid + "'");
|
|
|
+// if (!rows.isEmpty() && !"新建".equals(rows.get(0).getString("fstatus"))) {
|
|
|
+// return getErrReturnObject().setErrMsg("当前状态不可删除").toString();
|
|
|
+// }
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "供需删除");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("tagentsid", tagentsid);
|
|
|
@@ -420,7 +428,7 @@ public class supplyanddemand extends Controller {
|
|
|
long tenterprise_userid = content.getLong("tenterprise_userid");
|
|
|
|
|
|
|
|
|
- addsupplyanddemandLog(tsupplyanddemandid, ftype,tenterprise_userid);
|
|
|
+ addsupplyanddemandLog(tsupplyanddemandid, ftype, tenterprise_userid);
|
|
|
|
|
|
return getSucReturnObject().toString();
|
|
|
|
|
|
@@ -431,7 +439,7 @@ public class supplyanddemand extends Controller {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public void addsupplyanddemandLog(Long tsupplyanddemandid, int ftype,long tenterprise_userid) throws P2Exception {
|
|
|
+ public void addsupplyanddemandLog(Long tsupplyanddemandid, int ftype, long tenterprise_userid) throws P2Exception {
|
|
|
/**
|
|
|
* 阅读次数+1
|
|
|
*/
|
|
|
@@ -484,9 +492,9 @@ public class supplyanddemand extends Controller {
|
|
|
}
|
|
|
|
|
|
public int getTimesSQl(Long tenterprise_userid, int ftype) {
|
|
|
- SQLFactory sqlFactory = new SQLFactory(this,"查询分享电话浏览总数");
|
|
|
- sqlFactory.addParameter("tenterprise_userid",tenterprise_userid);
|
|
|
- sqlFactory.addParameter("ftype",ftype);
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(this, "查询分享电话浏览总数");
|
|
|
+ sqlFactory.addParameter("tenterprise_userid", tenterprise_userid);
|
|
|
+ sqlFactory.addParameter("ftype", ftype);
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
if (rows.isEmpty()) {
|
|
|
return 0;
|
|
|
@@ -503,20 +511,23 @@ public class supplyanddemand extends Controller {
|
|
|
public String getsupplyanddemandLogTop10() {
|
|
|
Long tsupplyanddemandid = content.getLong("tsupplyanddemandid");
|
|
|
|
|
|
+ ArrayList<String> list = new ArrayList<>();
|
|
|
+ list.add(String.valueOf(tsupplyanddemandid));
|
|
|
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
- jsonObject.put("read", getTop10Rows(tsupplyanddemandid, 1));
|
|
|
- jsonObject.put("phone", getTop10Rows(tsupplyanddemandid, 2));
|
|
|
- jsonObject.put("share", getTop10Rows(tsupplyanddemandid, 3));
|
|
|
+ jsonObject.put("read", getTop10Rows(list, 1));
|
|
|
+ jsonObject.put("phone", getTop10Rows(list, 2));
|
|
|
+ jsonObject.put("share", getTop10Rows(list, 3));
|
|
|
+
|
|
|
|
|
|
return getSucReturnObject().setData(jsonObject).toString();
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
- public Rows getTop10Rows(Long tsupplyanddemandid, int ftype) {
|
|
|
+ public Rows getTop10Rows(ArrayList<String> tsupplyanddemandid, int ftype) {
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "获取浏览电话分享前十");
|
|
|
- sqlFactory.addParameter("tsupplyanddemandid", tsupplyanddemandid);
|
|
|
+ sqlFactory.addParameter_in("tsupplyanddemandid", tsupplyanddemandid);
|
|
|
sqlFactory.addParameter("ftype", ftype);
|
|
|
|
|
|
Rows rows = dbConnect.runSqlQuery(sqlFactory);
|
|
|
@@ -536,7 +547,6 @@ public class supplyanddemand extends Controller {
|
|
|
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);
|