Appointment.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. package restcontroller.webmanage.saletool.appointment;
  2. import com.alibaba.fastjson.JSONObject;
  3. import common.Controller;
  4. import common.YosException;
  5. import common.annotation.API;
  6. import common.data.InsertSQL;
  7. import common.data.Rows;
  8. import common.data.SQLFactory;
  9. import io.swagger.annotations.Api;
  10. import restcontroller.R;
  11. /**
  12. * 预约报名
  13. */
  14. public class Appointment extends Controller {
  15. /**
  16. * 构造函数
  17. *
  18. * @param content
  19. */
  20. public Appointment(JSONObject content) throws YosException {
  21. super(content);
  22. }
  23. @API(title = "新增预约单", apiversion = R.ID20240513144602.v1.class)
  24. public String insert() throws YosException {
  25. String ownertable = content.getStringValue("ownertable");
  26. String ownerid = content.getStringValue("ownerid");
  27. Long shareuserid = 0L;
  28. String sharename = "";
  29. if (!ownertable.isEmpty()) {
  30. Rows rows = dbConnect.runSqlQuery("SELECT createuserid,createby from " + ownertable + " WHERE " + ownertable + "id=" + ownerid + " and siteid='" + siteid + "'");
  31. if (rows.isNotEmpty()) {
  32. shareuserid = rows.get(0).getLong("createuserid");
  33. sharename = rows.get(0).getString("createby");
  34. }
  35. }
  36. InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sa_appointment");
  37. insertSQL.setUniqueid(createTableID("sa_appointment"));
  38. insertSQL.setSiteid(siteid);
  39. insertSQL.setValue("name", content.getStringValue("name"));
  40. insertSQL.setValue("phonenumber", content.getStringValue("phonenumber"));
  41. insertSQL.setValue("province", content.getStringValue("province"));
  42. insertSQL.setValue("city", content.getStringValue("city"));
  43. insertSQL.setValue("county", content.getStringValue("county"));
  44. insertSQL.setValue("address", content.getStringValue("address"));
  45. insertSQL.setValue("ownertable", ownertable);
  46. insertSQL.setValue("ownerid", ownerid);
  47. insertSQL.setValue("type", content.getStringValue("type"));
  48. insertSQL.setValue("shareuserid", shareuserid);
  49. insertSQL.setValue("sharename", sharename);
  50. insertSQL.insert();
  51. return getSucReturnObject().toString();
  52. }
  53. }