Renderings.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. package restcontroller.webmanage.saletool.sharematerial;
  2. import com.alibaba.fastjson.JSONObject;
  3. import common.Controller;
  4. import common.YosException;
  5. import common.annotation.API;
  6. import common.data.*;
  7. import org.apache.commons.lang.StringUtils;
  8. import restcontroller.R;
  9. /**
  10. * 效果图管理
  11. */
  12. public class Renderings extends Controller {
  13. /**
  14. * 构造函数
  15. *
  16. * @param content
  17. */
  18. public Renderings(JSONObject content) throws YosException {
  19. super(content);
  20. }
  21. String sat_sharematerial = "sat_sharematerial";
  22. @API(title = "效果图新增或编辑", apiversion = R.ID20240415164202.v1.class)
  23. public String insertOrUpdate() throws YosException {
  24. Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
  25. if (sat_sharematerialid <= 0) {
  26. sat_sharematerialid = createTableID(sat_sharematerial);
  27. InsertSQL sqlFactory = SQLFactory.createInsertSQL(this, sat_sharematerial);
  28. sqlFactory.setSiteid(siteid);
  29. sqlFactory.setUniqueid(sat_sharematerialid);
  30. sqlFactory.setValue("classid", 4);
  31. sqlFactory.setValue("sys_enterpriseid", sys_enterpriseid);
  32. sqlFactory.setValue("title", content.getStringValue("title"));
  33. sqlFactory.setValue("subtitle", content.getStringValue("subtitle"));
  34. sqlFactory.setValue("notes", content.getStringValue("notes"));
  35. sqlFactory.setValue("panoramaurl", content.getStringValue("panoramaurl", true));
  36. sqlFactory.setValue("renderingstype", content.getStringValue("renderingstype"));
  37. sqlFactory.setValue("renderingsclass", content.getJSONObject("renderingsclass"));
  38. sqlFactory.setValue("isapplet", content.getBooleanValue("isapplet"));
  39. sqlFactory.setValue("isbussinesspic", content.getBooleanValue("isbussinesspic"));
  40. sqlFactory.setValue("sequence", content.getLongValue("sequence"));
  41. sqlFactory.insert();
  42. content.put("sat_sharematerialid", sat_sharematerialid);
  43. } else {
  44. UpdateSQL sqlFactory = SQLFactory.createUpdateSQL(this, sat_sharematerial);
  45. sqlFactory.setUniqueid(sat_sharematerialid);
  46. sqlFactory.setSiteid(siteid);
  47. sqlFactory.setValue("title", content.getStringValue("title"));
  48. sqlFactory.setValue("subtitle", content.getStringValue("subtitle"));
  49. sqlFactory.setValue("notes", content.getStringValue("notes"));
  50. sqlFactory.setValue("panoramaurl", content.getStringValue("panoramaurl", true));
  51. sqlFactory.setValue("renderingstype", content.getStringValue("renderingstype"));
  52. sqlFactory.setValue("renderingsclass", content.getJSONObject("renderingsclass"));
  53. sqlFactory.setValue("isapplet", content.getBooleanValue("isapplet"));
  54. sqlFactory.setValue("isbussinesspic", content.getBooleanValue("isbussinesspic"));
  55. sqlFactory.setValue("sequence", content.getLongValue("sequence"));
  56. sqlFactory.update();
  57. }
  58. return detail();
  59. }
  60. @API(title = "效果图详情", apiversion = R.ID20240415164302.v1.class)
  61. public String detail() throws YosException {
  62. Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
  63. QuerySQL querySQ = SQLFactory.createQuerySQL(this, "sat_sharematerial")
  64. .setTableAlias("t1");
  65. querySQ.setSiteid(siteid);
  66. querySQ.setWhere("sat_sharematerialid", sat_sharematerialid);
  67. Rows rows = querySQ.query();
  68. Row detailRow = rows.isNotEmpty() ? rows.get(0) : new Row();
  69. Rows attRows = getAttachmentUrl("sat_sharematerial", sat_sharematerialid);
  70. detailRow.put("attinfos", attRows);
  71. detailRow.putIfAbsent("checkdate", "");
  72. detailRow.put("appleturl", "xxx/pages/product/ctw/share?id=" + sat_sharematerialid);
  73. if(StringUtils.isBlank(detailRow.getString("panoramaurl"))){
  74. detailRow.put("ispanorama", 0);
  75. }else{
  76. detailRow.put("ispanorama", 1);
  77. }
  78. return getSucReturnObject().setData(detailRow).toString();
  79. }
  80. @API(title = "效果图列表", apiversion = R.ID20240415164402.v1.class)
  81. public String list() {
  82. return getSucReturnObject().toString();
  83. }
  84. }