|
|
@@ -5,12 +5,11 @@ import com.mysql.cj.x.protobuf.MysqlxCrud;
|
|
|
import common.Controller;
|
|
|
import common.YosException;
|
|
|
import common.annotation.API;
|
|
|
-import common.data.Row;
|
|
|
-import common.data.Rows;
|
|
|
-import common.data.SQLFactory;
|
|
|
-import common.data.UpdateSQL;
|
|
|
+import common.data.*;
|
|
|
import restcontroller.R;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
import static restcontroller.webmanage.sale.enterprise.enterprise.validatePhoneNumber;
|
|
|
|
|
|
/**
|
|
|
@@ -51,9 +50,9 @@ public class visitors extends Controller {
|
|
|
|
|
|
@API(title = "更新游客信息", apiversion = R.ID20240511151602.v1.class)
|
|
|
public String updatevisitorsInfo() throws YosException {
|
|
|
- String phonenumber=content.getStringValue("phonenumber");
|
|
|
+ String phonenumber = content.getStringValue("phonenumber");
|
|
|
|
|
|
- if(!content.getStringValue("phonenumber").isEmpty()){
|
|
|
+ if (!content.getStringValue("phonenumber").isEmpty()) {
|
|
|
boolean isValidPhoneNumber = validatePhoneNumber(phonenumber);
|
|
|
if (!isValidPhoneNumber) {
|
|
|
return getErrReturnObject().setErrMsg("请输入正确的手机号").toString();
|
|
|
@@ -77,5 +76,151 @@ public class visitors extends Controller {
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @API(title = "全局搜索", apiversion = R.ID20240513085802.v1.class)
|
|
|
+ public String search() throws YosException {
|
|
|
+
|
|
|
+ //1:产品:来源单品、案例-电器系统
|
|
|
+ //2:效果图:来源效果图管理;
|
|
|
+ //3:课件:来源商学院授权可查看的课程中的课件;
|
|
|
+ //4:资料:来源装备资源库授权可查看的资料;
|
|
|
+ int type = content.getIntValue("type");
|
|
|
+
|
|
|
+ Rows rows = new Rows();
|
|
|
+ if (type == 1) {
|
|
|
+ rows = searchFads();
|
|
|
+ }
|
|
|
+ if (type == 2) {
|
|
|
+ rows = searchRenderings();
|
|
|
+ }
|
|
|
+ if (type == 3) {
|
|
|
+ rows = searchCoursewaredetail();
|
|
|
+ }
|
|
|
+ if (type == 4) {
|
|
|
+ rows = searchEquipmentResourceLibrary();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ public Rows searchFads() 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.name like'%").append(whereObject.getString("condition")).append("%' ");
|
|
|
+ where.append(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_fad", "sa_fadid").setTableAlias("t1");
|
|
|
+ querySQL.setWhere("isonsale", 1);
|
|
|
+ querySQL.setWhere("classid", 1);
|
|
|
+ querySQL.addQueryFields("title", "t1.name");
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+ RowsMap RowsMap = getAttachmentUrl("sa_fad", rows.toArrayList("sa_fadid", new ArrayList<>()));
|
|
|
+ for (Row row : rows) {
|
|
|
+ Rows attRows = RowsMap.getOrDefault(row.getString("sa_fadid"), new Rows());
|
|
|
+ attRows.sortby("sequence", "linksid");
|
|
|
+ row.put("attinfos", attRows);
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Rows searchRenderings() 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(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_sharematerial", "sat_sharematerialid", "title").setTableAlias("t1");
|
|
|
+ querySQL.setWhere("classid", 4);
|
|
|
+ querySQL.setWhere("status", "审核");
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+ RowsMap RowsMap = getAttachmentUrl("sat_sharematerial", rows.toArrayList("sat_sharematerialid", new ArrayList<>()));
|
|
|
+ for (Row row : rows) {
|
|
|
+ Rows attRows = RowsMap.getOrDefault(row.getString("sat_sharematerialid"), new Rows());
|
|
|
+ attRows.sortby("sequence", "linksid");
|
|
|
+ row.put("attinfos", attRows);
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ //课件
|
|
|
+ public Rows searchCoursewaredetail() 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(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_courseware", "sat_coursewareid").setTableAlias("t1");
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere("status", "审核");
|
|
|
+ querySQL.setDataAuth(true);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ ArrayList<Long> sat_coursewareids = rows.toArrayList("sat_coursewareid", new ArrayList<>());
|
|
|
+
|
|
|
+
|
|
|
+ querySQL = SQLFactory.createQuerySQL(this, "sat_coursewaredetail", "sat_coursewaredetailid", "title").setTableAlias("t1");
|
|
|
+ querySQL.setWhere("sat_coursewareid", sat_coursewareids);
|
|
|
+ querySQL.setWhere("status", "上架");
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting);
|
|
|
+ rows = querySQL.query();
|
|
|
+ RowsMap RowsMap = getAttachmentUrl("sat_coursewaredetail", rows.toArrayList("sat_coursewaredetailid", new ArrayList<>()));
|
|
|
+ for (Row row : rows) {
|
|
|
+ Rows attRows = RowsMap.getOrDefault(row.getString("sat_coursewaredetailid"), new Rows());
|
|
|
+ attRows.sortby("sequence", "linksid");
|
|
|
+ row.put("attinfos", attRows);
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Rows searchEquipmentResourceLibrary() 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(")");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sat_sharematerial", "sat_sharematerialid", "title").setTableAlias("t1");
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere("classid", 3);
|
|
|
+ querySQL.setWhere("status", "审核");
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
|
|
|
+ querySQL.setDataAuth(true);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ RowsMap RowsMap = getAttachmentUrl("sat_sharematerial", rows.toArrayList("sat_sharematerialid", new ArrayList<>()));
|
|
|
+ for (Row row : rows) {
|
|
|
+ Rows attRows = RowsMap.getOrDefault(row.getString("sat_sharematerialid"), new Rows());
|
|
|
+ attRows.sortby("sequence", "linksid");
|
|
|
+ row.put("attinfos", attRows);
|
|
|
+ }
|
|
|
+ return rows;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|