|
|
@@ -0,0 +1,88 @@
|
|
|
+package restcontroller.webmanage.sale.order;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.huaweicloud.sdk.lts.v2.model.SqlAlarmRuleRespList;
|
|
|
+import common.Controller;
|
|
|
+import common.YosException;
|
|
|
+import common.annotation.API;
|
|
|
+import common.data.*;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import restcontroller.R;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 订单费用计算方案
|
|
|
+ */
|
|
|
+public class OrderFeeCostPlan extends Controller {
|
|
|
+ /**
|
|
|
+ * 构造函数
|
|
|
+ *
|
|
|
+ * @param content
|
|
|
+ */
|
|
|
+ public OrderFeeCostPlan(JSONObject content) throws YosException {
|
|
|
+ super(content);
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "查询可选定制方案列表", apiversion = R.ID20231208133902.v1.class)
|
|
|
+ public String customPlanList() throws YosException {
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_datafunction",
|
|
|
+ "sys_datafunctionid", "functionname", "remarks", "isused", "createdate");
|
|
|
+ //创建人写死admin
|
|
|
+ querySQL.addQueryFields("createby", "\'admin\'");
|
|
|
+ querySQL.setWhere("t1.functionclass", "ordercost");
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting).setTableAlias("t1");
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "绑定定制方案", apiversion = R.ID20231208134002.v1.class)
|
|
|
+ public String insertOrUpdatePlan() throws YosException {
|
|
|
+
|
|
|
+ Long sys_datafunctionid = content.getLongValue("sys_datafunctionid");
|
|
|
+ Long ownerid = content.getLongValue("ownerid");
|
|
|
+ String ownertable = content.getStringValue("ownertable");
|
|
|
+
|
|
|
+ Rows rows = dbConnect.runSqlQuery("SELECT * from sys_datafunction_bind WHERE ownerid=" + ownerid + " and ownertable='" + ownertable + "'");
|
|
|
+ if (rows.isEmpty()) {
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sys_datafunction_bind");
|
|
|
+ insertSQL.setUniqueid(createTableID("sys_datafunction_bind"));
|
|
|
+ insertSQL.setValue("ownerid", ownerid);
|
|
|
+ insertSQL.setValue("ownertable", ownertable);
|
|
|
+ insertSQL.setValue("sys_datafunctionid", sys_datafunctionid);
|
|
|
+ insertSQL.insert();
|
|
|
+ } else {
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "sys_datafunction_bind");
|
|
|
+ updateSQL.setUniqueid(rows.get(0).getLong("sys_datafunction_bindid"));
|
|
|
+ updateSQL.setValue("sys_datafunctionid", sys_datafunctionid);
|
|
|
+ updateSQL.update();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "删除商品定制方案", apiversion = R.ID20231208134102.v1.class)
|
|
|
+ public String delete() throws YosException {
|
|
|
+ Long sys_datafunction_bindid = content.getLongValue("sys_datafunction_bindid");
|
|
|
+ DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(this, "sys_datafunction_bind");
|
|
|
+ deleteSQL.setUniqueid(sys_datafunction_bindid);
|
|
|
+ deleteSQL.delete();
|
|
|
+ return getSucReturnObject().toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "商品定制方案列表", apiversion = R.ID20231208134202.v1.class)
|
|
|
+ public String list() throws YosException {
|
|
|
+ Long ownerid = content.getLongValue("ownerid");
|
|
|
+ String ownertable = content.getStringValue("ownertable");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sys_datafunction_bind");
|
|
|
+ querySQL.addJoinTable(JOINTYPE.left, "sys_datafunction", "t2", "t2.sys_datafunctionid=t1.sys_datafunctionid"
|
|
|
+ , "functionname", "remarks", "isused", "createdate");
|
|
|
+ querySQL.setWhere("t1.ownerid", ownerid);
|
|
|
+ querySQL.setWhere("t1.ownertable", ownertable);
|
|
|
+ querySQL.setPage(pageSize, pageNumber).setOrderBy(pageSorting).setTableAlias("t1");
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|