Fad.java 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473
  1. package restcontroller.webmanage.saletool.fad;
  2. import beans.attachment.Attachment;
  3. import beans.brand.Brand;
  4. import beans.itemclass.ItemClass;
  5. import beans.time.Time;
  6. import com.alibaba.fastjson.JSONArray;
  7. import com.alibaba.fastjson.JSONObject;
  8. import common.Controller;
  9. import common.YosException;
  10. import common.annotation.API;
  11. import common.data.*;
  12. import org.apache.commons.lang.StringUtils;
  13. import restcontroller.R;
  14. import java.util.ArrayList;
  15. import java.util.LinkedHashSet;
  16. /**
  17. * 单品管理
  18. */
  19. public class Fad extends Controller {
  20. /**
  21. * 构造函数
  22. *
  23. * @param content
  24. */
  25. public Fad(JSONObject content) throws YosException {
  26. super(content);
  27. }
  28. String sa_fad = "sa_fad";
  29. @API(title = "单品新增或编辑", apiversion = R.ID20240418140902.v1.class)
  30. public String insertOrUpdate() throws YosException {
  31. Long sa_fadid = content.getLongValue("sa_fadid");
  32. Long itemid = content.getLongValue("itemid");
  33. int isonsale = content.getIntValue("isonsale");
  34. JSONArray sa_fadclassids = new JSONArray();
  35. if (content.containsKey("sa_fadclassids")) {
  36. sa_fadclassids = content.getJSONArray("sa_fadclassids");
  37. for (Object obj : sa_fadclassids) {
  38. if (!(obj instanceof JSONArray)) {
  39. return getErrReturnObject().setErrMsg("分类格式不正确").toString();
  40. }
  41. }
  42. }
  43. if (sa_fadid <= 0) {
  44. sa_fadid = createTableID(sa_fad);
  45. InsertSQL sqlFactory = SQLFactory.createInsertSQL(this, sa_fad);
  46. sqlFactory.setSiteid(siteid);
  47. sqlFactory.setUniqueid(sa_fadid);
  48. sqlFactory.setValue("name", content.getStringValue("name"));
  49. sqlFactory.setValue("model", content.getStringValue("model"));
  50. sqlFactory.setValue("spec", content.getStringValue("spec"));
  51. sqlFactory.setValue("candownload", content.getBooleanValue("candownload"));
  52. sqlFactory.setValue("outurl", content.getStringValue("outurl", true));
  53. sqlFactory.setValue("isnew", content.getBooleanValue("isnew"));
  54. sqlFactory.setValue("sequence", content.getLongValue("sequence"));
  55. sqlFactory.setValue("content", content.getStringValue("contentstr", true));
  56. sqlFactory.setValue("price", content.getBigDecimalValue("price"));
  57. sqlFactory.setValue("offsaledate", content.getStringValue("offsaledate", true, "null"));
  58. sqlFactory.setValue("sa_fadclassids", sa_fadclassids);
  59. sqlFactory.insert();
  60. content.put("sa_fadid", sa_fadid);
  61. } else {
  62. UpdateSQL sqlFactory = SQLFactory.createUpdateSQL(this, sa_fad);
  63. sqlFactory.setUniqueid(sa_fadid);
  64. sqlFactory.setSiteid(siteid);
  65. sqlFactory.setValue("name", content.getStringValue("name"));
  66. sqlFactory.setValue("model", content.getStringValue("model"));
  67. sqlFactory.setValue("spec", content.getStringValue("spec"));
  68. sqlFactory.setValue("candownload", content.getBooleanValue("candownload"));
  69. sqlFactory.setValue("outurl", content.getStringValue("outurl", true));
  70. sqlFactory.setValue("isnew", content.getBooleanValue("isnew"));
  71. sqlFactory.setValue("sequence", content.getLongValue("sequence"));
  72. sqlFactory.setValue("content", content.getStringValue("contentstr", true));
  73. sqlFactory.setValue("price", content.getBigDecimalValue("price"));
  74. sqlFactory.setValue("offsaledate", content.getStringValue("offsaledate", true, "null"));
  75. sqlFactory.setValue("sa_fadclassids", sa_fadclassids);
  76. sqlFactory.update();
  77. }
  78. //上下架
  79. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, sa_fad);
  80. updateSQL.setSiteid(siteid);
  81. updateSQL.setWhere("sa_fadid", sa_fadid);
  82. updateSQL.setValue("isonsale", isonsale);
  83. updateSQL.setValue("onsaledate", isonsale == 1 ? Time.getDateTime_Str() : "null");
  84. updateSQL.setValue("onsaleby", isonsale == 1 ? username : "null");
  85. updateSQL.update();
  86. //关联商品
  87. InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sa_fad_link");
  88. insertSQL.setSiteid(siteid);
  89. insertSQL.setUniqueid(createTableID("sa_fad_link"));
  90. insertSQL.setValue("itemid", itemid);
  91. insertSQL.setValue("sa_fadid", sa_fadid);
  92. insertSQL.setWhere("not exists(select 1 from sa_fad_link where itemid=" + itemid + " and sa_fadid=" + sa_fadid + " )");
  93. insertSQL.insert();
  94. //插入图片
  95. Rows rows = Attachment.get(this, "plm_item", itemid, "cover");
  96. if (rows.isEmpty()) {
  97. rows = Attachment.get(this, "plm_item", itemid, "default");
  98. }
  99. if (rows.isNotEmpty()) {
  100. insertSQL = SQLFactory.createInsertSQL(this, "sys_attachment_links");
  101. insertSQL.setSiteid(siteid);
  102. insertSQL.setUniqueid(createTableID("sys_attachment_links"));
  103. insertSQL.setValue("usetype", sa_fad);
  104. insertSQL.setValue("attachmentid", rows.get(0).getLong("attachmentid"));
  105. insertSQL.setValue("sequence", 1);
  106. insertSQL.setValue("ownertable", sa_fad);
  107. insertSQL.setValue("ownerid", sa_fadid);
  108. insertSQL.setWhere("not exists(select 1 from sys_attachment_links where attachmentid=" + rows.get(0).getLong("attachmentid") + " and ownertable='sa_fad' and siteid='" + siteid + "' and ownerid=" + sa_fadid + " )");
  109. insertSQL.insert();
  110. }
  111. return detail();
  112. }
  113. @API(title = "单品详情", apiversion = R.ID20240418141002.v1.class)
  114. public String detail() throws YosException {
  115. Long sa_fadid = content.getLongValue("sa_fadid");
  116. String ownertable = sa_fad;
  117. QuerySQL querySQ = SQLFactory.createQuerySQL(this, sa_fad)
  118. .setTableAlias("t1");
  119. querySQ.addJoinTable(JOINTYPE.left, "sys_datacollect", "t2", "t2.siteid=t1.siteid and t2.ownertable='sa_fad' and type=1 and t2.ownerid=t1.sa_fadid and t2.userid='" + userid + "'");
  120. querySQ.addQueryFields("iscollect", "CASE WHEN t2.sys_datacollectid>0 THEN 1 ELSE 0 END");
  121. querySQ.setSiteid(siteid);
  122. querySQ.setWhere("sa_fadid", sa_fadid);
  123. Rows rows = querySQ.query();
  124. Row detailRow = rows.isNotEmpty() ? rows.get(0) : new Row();
  125. Rows attRows = getAttachmentUrl(sa_fad, sa_fadid);
  126. detailRow.put("attinfos", attRows);
  127. detailRow.put("appleturl", "xxx/pages/product/ctw/share?id=" + sa_fadid);
  128. QuerySQL attachmentQuery = SQLFactory.createQuerySQL(this, "sys_attachment_links").setTableAlias("t1");
  129. attachmentQuery.setSiteid(detailRow.getString("siteid"));
  130. attachmentQuery.setWhere("ownertable", ownertable);
  131. attachmentQuery.setWhere("ownerid", sa_fadid);
  132. attachmentQuery.setWhere("usetype", ownertable);
  133. attachmentQuery.setOrderBy("t1.sequence");
  134. Rows attachmentRows = attachmentQuery.query();
  135. ArrayList<Long> ids = attachmentRows.toArrayList("attachmentid", new ArrayList<>());
  136. RowsMap attRowsMap = Attachment.get(this, ids).toRowsMap("attachmentid");
  137. for (Row row : attachmentRows) {
  138. Rows attPicRows = new Rows();
  139. Rows tempAttRows = attRowsMap.getOrDefault(row.getString("attachmentid"), new Rows());
  140. for (Row tempAttRow : tempAttRows) {
  141. if (tempAttRow.getString("usetype").equals(ownertable)) {
  142. attPicRows.add(tempAttRow);
  143. }
  144. }
  145. row.put("attinfos", attPicRows);
  146. }
  147. detailRow.put("attinfos_pic", attachmentRows);
  148. detailRow.putIfAbsent("offsaledate", "");
  149. detailRow.putIfAbsent("onsaledate", "");
  150. detailRow.put("classnames", getClassnames(detailRow.getJSONArray("sa_fadclassids"), false));
  151. detailRow.put("mainclassnames", getClassnames(detailRow.getJSONArray("sa_fadclassids"), true));
  152. return getSucReturnObject().setData(detailRow).toString();
  153. }
  154. @API(title = "单品删除", apiversion = R.ID20240418141102.v1.class)
  155. public String delete() throws YosException {
  156. JSONArray sa_fadids = content.getJSONArray("sa_fadids");
  157. if (sa_fadids.size() == 0) {
  158. return getErrReturnObject().setErrMsg("请选择要删除的数据").toString();
  159. }
  160. DeleteSQL sqlFactory = SQLFactory.createDeleteSQL(this, sa_fad);
  161. sqlFactory.setSiteid(siteid);
  162. sqlFactory.setWhere("sa_fadid", sa_fadids.toArray());
  163. sqlFactory.delete();
  164. return getSucReturnObject().toString();
  165. }
  166. @API(title = "单品上下架", apiversion = R.ID20240418141202.v1.class)
  167. public String isonsale() throws YosException {
  168. JSONArray sa_fadids = content.getJSONArray("sa_fadids");
  169. int isonsale = content.getIntValue("isonsale");
  170. UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, sa_fad);
  171. updateSQL.setSiteid(siteid);
  172. updateSQL.setWhere("sa_fadid", sa_fadids);
  173. updateSQL.setValue("isonsale", isonsale);
  174. updateSQL.setValue("onsaledate", isonsale == 0 ? "null" : Time.getDateTime_Str());
  175. updateSQL.setValue("onsaleby", isonsale == 0 ? "null" : username);
  176. updateSQL.update();
  177. return getSucReturnObject().toString();
  178. }
  179. @API(title = "单品列表", apiversion = R.ID20240418141302.v1.class)
  180. public String list() throws YosException {
  181. /*
  182. 过滤条件设置
  183. */
  184. StringBuffer where = new StringBuffer(" 1=1 ");
  185. if (content.containsKey("where")) {
  186. JSONObject whereObject = content.getJSONObject("where");
  187. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  188. where.append(" and (");
  189. where.append("t1.name like'%").append(whereObject.getString("condition")).append("%' ");
  190. where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
  191. where.append("or t1.spec like'%").append(whereObject.getString("condition")).append("%' ");
  192. where.append(")");
  193. }
  194. if (whereObject.containsKey("isonsale") && !"".equals(whereObject.getString("isonsale"))) {
  195. where.append(" and (");
  196. where.append("t1.isonsale ='").append(whereObject.getString("isonsale")).append("' ");
  197. where.append(")");
  198. }
  199. if (whereObject.containsKey("begindate_create") && !"".equals(whereObject.getString("begindate_create"))) {
  200. where.append(" and (");
  201. where.append("t1.createdate >='").append(whereObject.getString("begindate_create")).append("' ");
  202. where.append(")");
  203. }
  204. if (whereObject.containsKey("enddate_create") && !"".equals(whereObject.getString("enddate_create"))) {
  205. where.append(" and (");
  206. where.append("t1.createdate <='").append(whereObject.getString("enddate_create")).append(" 23:59:59' ");
  207. where.append(")");
  208. }
  209. if (whereObject.containsKey("begindate_onsale") && !"".equals(whereObject.getString("begindate_onsale"))) {
  210. where.append(" and (");
  211. where.append("t1.onsaledate >='").append(whereObject.getString("begindate_onsale")).append("' ");
  212. where.append(")");
  213. }
  214. if (whereObject.containsKey("enddate_onsale") && !"".equals(whereObject.getString("enddate_onsale"))) {
  215. where.append(" and (");
  216. where.append("t1.onsaledate <='").append(whereObject.getString("enddate_onsale")).append(" 23:59:59' ");
  217. where.append(")");
  218. }
  219. if (whereObject.containsKey("sa_fadclassids") && !"".equals(whereObject.getString("sa_fadclassids"))) {
  220. JSONArray sa_fadclassids = whereObject.getJSONArray("sa_fadclassids");
  221. if (sa_fadclassids.size() > 0) {
  222. where.append(" and (1=2");
  223. for (Object obj : sa_fadclassids) {
  224. JSONArray array = (JSONArray) obj;
  225. for (Object obj2 : array) {
  226. where.append(" or (");
  227. where.append("JSON_CONTAINS(t1.sa_fadclassids,'" + obj2 + "')");
  228. where.append(")");
  229. }
  230. }
  231. where.append(")");
  232. }
  233. }
  234. }
  235. QuerySQL querySQL = SQLFactory.createQuerySQL(this, sa_fad,
  236. "sa_fadid", "name", "isonsale", "model", "spec", "price", "sequence", "createby", "createdate", "onsaledate")
  237. .setTableAlias("t1");
  238. querySQL.setSiteid(siteid);
  239. querySQL.setWhere(where.toString());
  240. querySQL.setOrderBy(pageSorting).setPage(pageSize, pageNumber);
  241. Rows rows = querySQL.query();
  242. ArrayList<Long> ids = rows.toArrayList("sa_fadid", new ArrayList<>());
  243. // 附件
  244. RowsMap RowsMap = getAttachmentUrl(sa_fad, ids);
  245. for (Row row : rows) {
  246. Rows Rows = RowsMap.getOrDefault(row.getString("sa_fadid"), new Rows());
  247. row.put("attinfos", Rows);
  248. row.put("appleturl", "xxx/pages/product/ctw/share?id=" + row.getString("sa_fadid"));
  249. row.putIfAbsent("onsaledate", "");
  250. }
  251. return getSucReturnObject().setData(rows).toString();
  252. }
  253. @API(title = "选择商品列表", apiversion = R.ID20240418141402.v1.class)
  254. public String chooseItemlist() throws YosException {
  255. StringBuffer where = new StringBuffer(" 1=1 ");
  256. if (content.containsKey("where")) {
  257. JSONObject whereObject = content.getJSONObject("where");
  258. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  259. where.append(" and(");
  260. where.append("t1.itemno like'%").append(whereObject.getString("condition")).append("%' ");
  261. where.append("or t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
  262. where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
  263. where.append("or t1.spec like'%").append(whereObject.getString("condition")).append("%' ");
  264. where.append("or t1.color like'%").append(whereObject.getString("condition")).append("%' ");
  265. where.append(")");
  266. }
  267. }
  268. Long sa_fadid = content.getLongValue("sa_fadid");
  269. QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item"
  270. , "itemid", "itemname", "itemno", "model", "spec", "color", "marketprice", "standards");
  271. querySQL.setTableAlias("t1");
  272. querySQL.addJoinTable(JOINTYPE.left, "plm_itemclass", "t2", "t2.itemclassid = t1.marketingcategory AND t2.siteid = t1.siteid",
  273. "itemclassname");
  274. querySQL.setWhere("t1.siteid", siteid);
  275. querySQL.setWhere(where.toString());
  276. querySQL.setWhere("not exists(select 1 from sa_fad_link where sa_fadid=" + sa_fadid + " and itemid=t1.itemid and siteid='" + siteid + "' )");
  277. querySQL.setOrderBy(pageSorting);
  278. querySQL.setPage(pageSize, pageNumber);
  279. Rows rows = querySQL.query();
  280. // 默认商品图片
  281. Rows defaultImageRows = getAttachmentUrl("system", (long) 1, "defaultImage");
  282. // 附件
  283. ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
  284. RowsMap attRowsMapCover = getAttachmentUrl("plm_item", ids, "cover");
  285. RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
  286. // 商品领域
  287. RowsMap tradefieldRowsMap = beans.Item.Item.getTradefieldRowsMap(this, ids);
  288. RowsMap itemclassRowsMap = ItemClass.getAllItemClassRowsMap(this, ids);
  289. for (Row row : rows) {
  290. if (attRowsMapCover.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
  291. row.put("attinfos", attRowsMapCover.getOrDefault(row.getString("itemid"), new Rows()));
  292. } else if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
  293. row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
  294. } else {
  295. row.put("attinfos", defaultImageRows);
  296. }
  297. String[] tradefield = tradefieldRowsMap.getOrDefault(row.getString("itemid"), new Rows()).toArray("tradefield");
  298. row.put("tradefield", StringUtils.join(tradefield, ","));
  299. String[] itemclass = itemclassRowsMap.getOrDefault(row.getString("itemid"), new Rows()).toArray("itemclassname");
  300. row.put("itemclass", StringUtils.join(itemclass, ","));
  301. }
  302. return getSucReturnObject().setData(rows).toString();
  303. }
  304. @API(title = "关联商品列表", apiversion = R.ID20240418141502.v1.class)
  305. public String relateItemlist() throws YosException {
  306. StringBuffer where = new StringBuffer(" 1=1 ");
  307. if (content.containsKey("where")) {
  308. JSONObject whereObject = content.getJSONObject("where");
  309. if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
  310. where.append(" and(");
  311. where.append("t1.itemno like'%").append(whereObject.getString("condition")).append("%' ");
  312. where.append("or t1.itemname like'%").append(whereObject.getString("condition")).append("%' ");
  313. where.append("or t1.model like'%").append(whereObject.getString("condition")).append("%' ");
  314. where.append("or t1.spec like'%").append(whereObject.getString("condition")).append("%' ");
  315. where.append("or t1.color like'%").append(whereObject.getString("condition")).append("%' ");
  316. where.append(")");
  317. }
  318. }
  319. Long sa_fadid = content.getLongValue("sa_fadid");
  320. QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item"
  321. , "itemid", "itemname", "itemno", "model", "spec", "color", "marketprice", "standards");
  322. querySQL.setTableAlias("t1");
  323. querySQL.addJoinTable(JOINTYPE.left, "plm_itemclass", "t2", "t2.itemclassid = t1.marketingcategory AND t2.siteid = t1.siteid",
  324. "itemclassname");
  325. querySQL.addJoinTable(JOINTYPE.left, "sa_fad_link", "t3", "t3.itemid = t1.itemid AND t3.siteid = t1.siteid",
  326. "sa_fad_linkid");
  327. querySQL.setWhere("t1.siteid", siteid);
  328. querySQL.setWhere(where.toString());
  329. querySQL.setWhere("t3.sa_fadid",sa_fadid);
  330. querySQL.setOrderBy(pageSorting);
  331. querySQL.setPage(pageSize, pageNumber);
  332. Rows rows = querySQL.query();
  333. // 默认商品图片
  334. Rows defaultImageRows = getAttachmentUrl("system", (long) 1, "defaultImage");
  335. // 附件
  336. ArrayList<Long> ids = rows.toArrayList("itemid", new ArrayList<>());
  337. RowsMap attRowsMapCover = getAttachmentUrl("plm_item", ids, "cover");
  338. RowsMap attRowsMap = getAttachmentUrl("plm_item", ids);
  339. // 商品领域
  340. RowsMap tradefieldRowsMap = beans.Item.Item.getTradefieldRowsMap(this, ids);
  341. RowsMap itemclassRowsMap = ItemClass.getAllItemClassRowsMap(this, ids);
  342. for (Row row : rows) {
  343. if (attRowsMapCover.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
  344. row.put("attinfos", attRowsMapCover.getOrDefault(row.getString("itemid"), new Rows()));
  345. } else if (attRowsMap.getOrDefault(row.getString("itemid"), new Rows()).isNotEmpty()) {
  346. row.put("attinfos", attRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
  347. } else {
  348. row.put("attinfos", defaultImageRows);
  349. }
  350. String[] tradefield = tradefieldRowsMap.getOrDefault(row.getString("itemid"), new Rows()).toArray("tradefield");
  351. row.put("tradefield", StringUtils.join(tradefield, ","));
  352. String[] itemclass = itemclassRowsMap.getOrDefault(row.getString("itemid"), new Rows()).toArray("itemclassname");
  353. row.put("itemclass", StringUtils.join(itemclass, ","));
  354. }
  355. return getSucReturnObject().setData(rows).toString();
  356. }
  357. @API(title = "关联商品", apiversion = R.ID20240418141602.v1.class)
  358. public String relateItem() throws YosException {
  359. Long sa_fadid = content.getLongValue("sa_fadid");
  360. JSONArray itemids = content.getJSONArray("itemids");
  361. ArrayList<String> sqlList = new ArrayList<>();
  362. for (Object obj : itemids) {
  363. InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sa_fad_link");
  364. insertSQL.setSiteid(siteid);
  365. insertSQL.setUniqueid(createTableID("sa_fad_link"));
  366. insertSQL.setValue("itemid", obj);
  367. insertSQL.setValue("sa_fadid", sa_fadid);
  368. sqlList.add(insertSQL.getSQL());
  369. }
  370. dbConnect.runSqlUpdate(sqlList);
  371. return getSucReturnObject().toString();
  372. }
  373. @API(title = "删除商品", apiversion = R.ID20240418141702.v1.class)
  374. public String deleteItem() throws YosException {
  375. JSONArray sa_fad_linkids = content.getJSONArray("sa_fad_linkids");
  376. DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sa_fad_link");
  377. deleteSQL.setSiteid(siteid);
  378. deleteSQL.setWhere("sa_fad_linkid", sa_fad_linkids);
  379. deleteSQL.delete();
  380. return getSucReturnObject().toString();
  381. }
  382. public String getClassnames(JSONArray sa_fadclassids, boolean isMain) throws YosException {
  383. //[[1,2,3,6],[1,2]]
  384. RowsMap rowsMap = dbConnect.runSqlQuery("SELECT sa_fadclassid,classname from sa_fadclass WHERE siteid='" + siteid + "'").toRowsMap("sa_fadclassid");
  385. LinkedHashSet<String> classnames = new LinkedHashSet<>();
  386. for (Object object : sa_fadclassids) {
  387. ArrayList<String> temp = new ArrayList<>();
  388. if (object instanceof JSONArray) {
  389. JSONArray array = (JSONArray) object;
  390. for (Object obj : array) {
  391. temp.add(rowsMap.get(obj.toString()).get(0).getString("classname"));
  392. }
  393. }
  394. if (isMain) {
  395. classnames.add(temp.get(0));
  396. } else {
  397. classnames.add(String.join("-", temp));
  398. }
  399. }
  400. return String.join(";", classnames);
  401. }
  402. }