| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- package restcontroller.webmanage.saletool.sharematerial;
- import com.alibaba.fastjson.JSONObject;
- import common.Controller;
- import common.YosException;
- import common.annotation.API;
- import common.data.*;
- import org.apache.commons.lang.StringUtils;
- import restcontroller.R;
- /**
- * 效果图管理
- */
- public class Renderings extends Controller {
- /**
- * 构造函数
- *
- * @param content
- */
- public Renderings(JSONObject content) throws YosException {
- super(content);
- }
- String sat_sharematerial = "sat_sharematerial";
- @API(title = "效果图新增或编辑", apiversion = R.ID20240415164202.v1.class)
- public String insertOrUpdate() throws YosException {
- Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
- if (sat_sharematerialid <= 0) {
- sat_sharematerialid = createTableID(sat_sharematerial);
- InsertSQL sqlFactory = SQLFactory.createInsertSQL(this, sat_sharematerial);
- sqlFactory.setSiteid(siteid);
- sqlFactory.setUniqueid(sat_sharematerialid);
- sqlFactory.setValue("classid", 4);
- sqlFactory.setValue("sys_enterpriseid", sys_enterpriseid);
- sqlFactory.setValue("title", content.getStringValue("title"));
- sqlFactory.setValue("subtitle", content.getStringValue("subtitle"));
- sqlFactory.setValue("notes", content.getStringValue("notes"));
- sqlFactory.setValue("panoramaurl", content.getStringValue("panoramaurl", true));
- sqlFactory.setValue("renderingstype", content.getStringValue("renderingstype"));
- sqlFactory.setValue("renderingsclass", content.getJSONObject("renderingsclass"));
- sqlFactory.setValue("isapplet", content.getBooleanValue("isapplet"));
- sqlFactory.setValue("isbussinesspic", content.getBooleanValue("isbussinesspic"));
- sqlFactory.setValue("sequence", content.getLongValue("sequence"));
- sqlFactory.insert();
- content.put("sat_sharematerialid", sat_sharematerialid);
- } else {
- UpdateSQL sqlFactory = SQLFactory.createUpdateSQL(this, sat_sharematerial);
- sqlFactory.setUniqueid(sat_sharematerialid);
- sqlFactory.setSiteid(siteid);
- sqlFactory.setValue("title", content.getStringValue("title"));
- sqlFactory.setValue("subtitle", content.getStringValue("subtitle"));
- sqlFactory.setValue("notes", content.getStringValue("notes"));
- sqlFactory.setValue("panoramaurl", content.getStringValue("panoramaurl", true));
- sqlFactory.setValue("renderingstype", content.getStringValue("renderingstype"));
- sqlFactory.setValue("renderingsclass", content.getJSONObject("renderingsclass"));
- sqlFactory.setValue("isapplet", content.getBooleanValue("isapplet"));
- sqlFactory.setValue("isbussinesspic", content.getBooleanValue("isbussinesspic"));
- sqlFactory.setValue("sequence", content.getLongValue("sequence"));
- sqlFactory.update();
- }
- return detail();
- }
- @API(title = "效果图详情", apiversion = R.ID20240415164302.v1.class)
- public String detail() throws YosException {
- Long sat_sharematerialid = content.getLongValue("sat_sharematerialid");
- QuerySQL querySQ = SQLFactory.createQuerySQL(this, "sat_sharematerial")
- .setTableAlias("t1");
- querySQ.setSiteid(siteid);
- querySQ.setWhere("sat_sharematerialid", sat_sharematerialid);
- Rows rows = querySQ.query();
- Row detailRow = rows.isNotEmpty() ? rows.get(0) : new Row();
- Rows attRows = getAttachmentUrl("sat_sharematerial", sat_sharematerialid);
- detailRow.put("attinfos", attRows);
- detailRow.putIfAbsent("checkdate", "");
- detailRow.put("appleturl", "xxx/pages/product/ctw/share?id=" + sat_sharematerialid);
- if(StringUtils.isBlank(detailRow.getString("panoramaurl"))){
- detailRow.put("ispanorama", 0);
- }else{
- detailRow.put("ispanorama", 1);
- }
- return getSucReturnObject().setData(detailRow).toString();
- }
- @API(title = "效果图列表", apiversion = R.ID20240415164402.v1.class)
- public String list() {
- return getSucReturnObject().toString();
- }
- }
|