|
@@ -1,5 +1,6 @@
|
|
|
package restcontroller.webmanage.saletool.sharematerial;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
@@ -8,6 +9,8 @@ import common.data.*;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
/**
|
|
|
* 效果图管理
|
|
|
*/
|
|
@@ -85,9 +88,9 @@ public class Renderings extends Controller {
|
|
|
detailRow.put("attinfos", attRows);
|
|
|
detailRow.putIfAbsent("checkdate", "");
|
|
|
detailRow.put("appleturl", "xxx/pages/product/ctw/share?id=" + sat_sharematerialid);
|
|
|
- if(StringUtils.isBlank(detailRow.getString("panoramaurl"))){
|
|
|
+ if (StringUtils.isBlank(detailRow.getString("panoramaurl"))) {
|
|
|
detailRow.put("ispanorama", 0);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
detailRow.put("ispanorama", 1);
|
|
|
}
|
|
|
|
|
@@ -97,8 +100,115 @@ public class Renderings extends Controller {
|
|
|
|
|
|
|
|
|
@API(title = "效果图列表", apiversion = R.ID20240415164402.v1.class)
|
|
|
- public String list() {
|
|
|
- return getSucReturnObject().toString();
|
|
|
+ public String list() 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.title like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (whereObject.containsKey("status") && !"".equals(whereObject.getString("status"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.status ='").append(whereObject.getString("status")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (whereObject.containsKey("begindate_create") && !"".equals(whereObject.getString("begindate_create"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.createdate >='").append(whereObject.getString("begindate_create")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate_create") && !"".equals(whereObject.getString("enddate_create"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.createdate <='").append(whereObject.getString("enddate_create")).append(" 23:59:59' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("begindate") && !"".equals(whereObject.getString("begindate"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.checkdate >='").append(whereObject.getString("begindate")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("enddate") && !"".equals(whereObject.getString("enddate"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.checkdate <='").append(whereObject.getString("enddate")).append(" 23:59:59' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("ispanorama") && !"".equals(whereObject.getString("ispanorama"))) {
|
|
|
+ if(whereObject.getString("ispanorama").equals("1")){
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("LENGTH(t1.panoramaurl)>0 ");
|
|
|
+ where.append(")");
|
|
|
+ }else{
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("LENGTH(t1.panoramaurl)=0 or t1.panoramaurl is null ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("renderingstype") && !"".equals(whereObject.getString("renderingstype"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("t1.renderingstype ='").append(whereObject.getString("renderingstype")).append("' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (whereObject.containsKey("style") && !"".equals(whereObject.getString("style"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("JSON_CONTAINS(t1.renderingsclass->'$.style', '\""+whereObject.getString("style")+"\"')");
|
|
|
+ where.append(")");
|
|
|
+
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("space") && !"".equals(whereObject.getString("space"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("JSON_CONTAINS(t1.renderingsclass->'$.space', '\""+whereObject.getString("space")+"\"')");
|
|
|
+ where.append(")");
|
|
|
+
|
|
|
+ }
|
|
|
+ if (whereObject.containsKey("spec") && !"".equals(whereObject.getString("spec"))) {
|
|
|
+ where.append(" and (");
|
|
|
+ where.append("JSON_CONTAINS(t1.renderingsclass->'$.spec', '\""+whereObject.getString("spec")+"\"')");
|
|
|
+ where.append(")");
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ boolean isDataAuth = content.getBooleanValue("isDataAuth");
|
|
|
+
|
|
|
+ QuerySQL sqlFactory = SQLFactory.createQuerySQL(this, sat_sharematerial,
|
|
|
+ "sat_sharematerialid", "title", "status", "renderingstype", "readcount", "sequence", "createdate", "checkdate","renderingsclass")
|
|
|
+ .setTableAlias("t1");
|
|
|
+ sqlFactory.setSiteid(siteid);
|
|
|
+ sqlFactory.setWhere("classid", 4);
|
|
|
+ sqlFactory.setWhere(where.toString());
|
|
|
+ sqlFactory.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
+ if (isDataAuth) {
|
|
|
+ sqlFactory.setDataAuth(true);
|
|
|
+ }
|
|
|
+ Rows rows = sqlFactory.query();
|
|
|
+
|
|
|
+ ArrayList<Long> ids = rows.toArrayList("sat_sharematerialid", new ArrayList<>());
|
|
|
+ // 附件
|
|
|
+ RowsMap RowsMap = getAttachmentUrl(sat_sharematerial, ids);
|
|
|
+ for (Row row : rows) {
|
|
|
+ Rows Rows = RowsMap.getOrDefault(row.getString("sat_sharematerialid"), new Rows());
|
|
|
+ row.put("attinfos", Rows);
|
|
|
+ row.putIfAbsent("checkdate", "");
|
|
|
+ if (StringUtils.isBlank(row.getString("panoramaurl"))) {
|
|
|
+ row.put("ispanorama", 0);
|
|
|
+ } else {
|
|
|
+ row.put("ispanorama", 1);
|
|
|
+ }
|
|
|
+ row.put("appleturl", "xxx/pages/product/ctw/share?id=" + row.getString("sat_sharematerialid"));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
}
|