|
@@ -198,122 +198,122 @@ public class LongPicText extends Controller {
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
- @API(title = "长图文图片列表", apiversion = R.ID20240329145502.v1.class)
|
|
|
- public String piclist() throws YosException {
|
|
|
-
|
|
|
- Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
- Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
- if (rows.isNotEmpty()) {
|
|
|
- jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
|
|
|
- if (jsonObject.containsKey("pics")) {
|
|
|
- jsonArray = jsonObject.getJSONArray("pics");
|
|
|
- } else {
|
|
|
- jsonArray = new JSONArray();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- ArrayList<Long> ids = new ArrayList<>();
|
|
|
- for (Object o : jsonArray) {
|
|
|
- JSONObject jsonObject1 = (JSONObject) o;
|
|
|
- ids.add(jsonObject1.getLongValue("attachmentid"));
|
|
|
- }
|
|
|
-
|
|
|
- RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
|
|
|
- for (Object object : jsonArray) {
|
|
|
- JSONObject jsonObject1 = (JSONObject) object;
|
|
|
- jsonObject1.put("attinfos", attRowsMap.getOrDefault(jsonObject1.getString("attachmentid"), new Rows()));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return getSucReturnObject().setData(jsonArray).toString();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @API(title = "长图文绑定图片信息", apiversion = R.ID20240329131902.v1.class)
|
|
|
- public String updatePicInfo() throws YosException {
|
|
|
-
|
|
|
- Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
- Long attachmentid = content.getLongValue("attachmentid");
|
|
|
-
|
|
|
- Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
- if (rows.isNotEmpty()) {
|
|
|
- jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
|
|
|
- if (jsonObject.containsKey("pics")) {
|
|
|
- jsonArray = jsonObject.getJSONArray("pics");
|
|
|
- } else {
|
|
|
- jsonArray = new JSONArray();
|
|
|
- }
|
|
|
- }
|
|
|
- JSONArray newjsonArray = getTempJSONArray(jsonArray, String.valueOf(attachmentid));
|
|
|
-
|
|
|
- JSONObject object = new JSONObject();
|
|
|
- object.put("attachmentid", attachmentid);
|
|
|
- object.put("url", content.getStringValue("url"));
|
|
|
- object.put("sequence", content.getIntValue("sequence"));
|
|
|
- newjsonArray.add(object);
|
|
|
- jsonObject.put("pics", newjsonArray);
|
|
|
-
|
|
|
- UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
|
|
|
- updateSQL.setSiteid(siteid);
|
|
|
- updateSQL.setUniqueid(sat_sharematerialid);
|
|
|
-
|
|
|
- updateSQL.setValue("sharepagecontrol", jsonObject);
|
|
|
- System.err.println(updateSQL.getSQL());
|
|
|
- updateSQL.update();
|
|
|
-
|
|
|
-
|
|
|
- object.put("attinfos", Attachment.get(this, attachmentid));
|
|
|
-
|
|
|
-
|
|
|
- return getSucReturnObject().setData(object).toString();
|
|
|
- }
|
|
|
-
|
|
|
- @API(title = "长图文解绑图片信息", apiversion = R.ID20240329132002.v1.class)
|
|
|
- public String deletePicInfo() throws YosException {
|
|
|
-
|
|
|
- Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
- Long attachmentid = content.getLongValue("attachmentid");
|
|
|
-
|
|
|
- Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
|
|
|
- JSONObject jsonObject = new JSONObject();
|
|
|
- JSONArray jsonArray = new JSONArray();
|
|
|
- if (rows.isNotEmpty()) {
|
|
|
- jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
|
|
|
- if (jsonObject.containsKey("pics")) {
|
|
|
- jsonArray = jsonObject.getJSONArray("pics");
|
|
|
- } else {
|
|
|
- jsonArray = new JSONArray();
|
|
|
- }
|
|
|
- }
|
|
|
- jsonObject.put("pics", getTempJSONArray(jsonArray, String.valueOf(attachmentid)));
|
|
|
-
|
|
|
-
|
|
|
- UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
|
|
|
- updateSQL.setSiteid(siteid);
|
|
|
- updateSQL.setUniqueid(sat_sharematerialid);
|
|
|
-
|
|
|
- updateSQL.setValue("sharepagecontrol", jsonObject);
|
|
|
- System.err.println(updateSQL.getSQL());
|
|
|
- updateSQL.update();
|
|
|
-
|
|
|
- return detail();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- public JSONArray getTempJSONArray(JSONArray jsonArray, String attachmentid) throws YosException {
|
|
|
- JSONArray temp = new JSONArray();
|
|
|
- for (Object object : jsonArray) {
|
|
|
- JSONObject temp_object = (JSONObject) object;
|
|
|
- if (!temp_object.getString("attachmentid").equals(attachmentid)) {
|
|
|
- temp.add(object);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return temp;
|
|
|
- }
|
|
|
+// @API(title = "长图文图片列表", apiversion = R.ID20240329145502.v1.class)
|
|
|
+// public String piclist() throws YosException {
|
|
|
+//
|
|
|
+// Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
+// Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
|
|
|
+// JSONObject jsonObject = new JSONObject();
|
|
|
+// JSONArray jsonArray = new JSONArray();
|
|
|
+// if (rows.isNotEmpty()) {
|
|
|
+// jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
|
|
|
+// if (jsonObject.containsKey("pics")) {
|
|
|
+// jsonArray = jsonObject.getJSONArray("pics");
|
|
|
+// } else {
|
|
|
+// jsonArray = new JSONArray();
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// ArrayList<Long> ids = new ArrayList<>();
|
|
|
+// for (Object o : jsonArray) {
|
|
|
+// JSONObject jsonObject1 = (JSONObject) o;
|
|
|
+// ids.add(jsonObject1.getLongValue("attachmentid"));
|
|
|
+// }
|
|
|
+//
|
|
|
+// RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
|
|
|
+// for (Object object : jsonArray) {
|
|
|
+// JSONObject jsonObject1 = (JSONObject) object;
|
|
|
+// jsonObject1.put("attinfos", attRowsMap.getOrDefault(jsonObject1.getString("attachmentid"), new Rows()));
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// return getSucReturnObject().setData(jsonArray).toString();
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// @API(title = "长图文绑定图片信息", apiversion = R.ID20240329131902.v1.class)
|
|
|
+// public String updatePicInfo() throws YosException {
|
|
|
+//
|
|
|
+// Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
+// Long attachmentid = content.getLongValue("attachmentid");
|
|
|
+//
|
|
|
+// Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
|
|
|
+// JSONObject jsonObject = new JSONObject();
|
|
|
+// JSONArray jsonArray = new JSONArray();
|
|
|
+// if (rows.isNotEmpty()) {
|
|
|
+// jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
|
|
|
+// if (jsonObject.containsKey("pics")) {
|
|
|
+// jsonArray = jsonObject.getJSONArray("pics");
|
|
|
+// } else {
|
|
|
+// jsonArray = new JSONArray();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// JSONArray newjsonArray = getTempJSONArray(jsonArray, String.valueOf(attachmentid));
|
|
|
+//
|
|
|
+// JSONObject object = new JSONObject();
|
|
|
+// object.put("attachmentid", attachmentid);
|
|
|
+// object.put("url", content.getStringValue("url"));
|
|
|
+// object.put("sequence", content.getIntValue("sequence"));
|
|
|
+// newjsonArray.add(object);
|
|
|
+// jsonObject.put("pics", newjsonArray);
|
|
|
+//
|
|
|
+// UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
|
|
|
+// updateSQL.setSiteid(siteid);
|
|
|
+// updateSQL.setUniqueid(sat_sharematerialid);
|
|
|
+//
|
|
|
+// updateSQL.setValue("sharepagecontrol", jsonObject);
|
|
|
+// System.err.println(updateSQL.getSQL());
|
|
|
+// updateSQL.update();
|
|
|
+//
|
|
|
+//
|
|
|
+// object.put("attinfos", Attachment.get(this, attachmentid));
|
|
|
+//
|
|
|
+//
|
|
|
+// return getSucReturnObject().setData(object).toString();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @API(title = "长图文解绑图片信息", apiversion = R.ID20240329132002.v1.class)
|
|
|
+// public String deletePicInfo() throws YosException {
|
|
|
+//
|
|
|
+// Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
|
|
|
+// Long attachmentid = content.getLongValue("attachmentid");
|
|
|
+//
|
|
|
+// Rows rows = dbConnect.runSqlQuery("SELECT * from sat_sharematerial WHERE sat_sharematerialid=" + sat_sharematerialid + " and siteid='" + siteid + "'");
|
|
|
+// JSONObject jsonObject = new JSONObject();
|
|
|
+// JSONArray jsonArray = new JSONArray();
|
|
|
+// if (rows.isNotEmpty()) {
|
|
|
+// jsonObject = rows.get(0).getJSONObject("sharepagecontrol");
|
|
|
+// if (jsonObject.containsKey("pics")) {
|
|
|
+// jsonArray = jsonObject.getJSONArray("pics");
|
|
|
+// } else {
|
|
|
+// jsonArray = new JSONArray();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// jsonObject.put("pics", getTempJSONArray(jsonArray, String.valueOf(attachmentid)));
|
|
|
+//
|
|
|
+//
|
|
|
+// UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sat_sharematerial");
|
|
|
+// updateSQL.setSiteid(siteid);
|
|
|
+// updateSQL.setUniqueid(sat_sharematerialid);
|
|
|
+//
|
|
|
+// updateSQL.setValue("sharepagecontrol", jsonObject);
|
|
|
+// System.err.println(updateSQL.getSQL());
|
|
|
+// updateSQL.update();
|
|
|
+//
|
|
|
+// return detail();
|
|
|
+// }
|
|
|
+
|
|
|
+
|
|
|
+// public JSONArray getTempJSONArray(JSONArray jsonArray, String attachmentid) throws YosException {
|
|
|
+// JSONArray temp = new JSONArray();
|
|
|
+// for (Object object : jsonArray) {
|
|
|
+// JSONObject temp_object = (JSONObject) object;
|
|
|
+// if (!temp_object.getString("attachmentid").equals(attachmentid)) {
|
|
|
+// temp.add(object);
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// return temp;
|
|
|
+// }
|
|
|
|
|
|
}
|