|
|
@@ -0,0 +1,158 @@
|
|
|
+package restcontroller.webmanage.sale.agentssales;
|
|
|
+
|
|
|
+import beans.data.BatchDeleteErr;
|
|
|
+import beans.datacontrllog.DataContrlLog;
|
|
|
+import com.alibaba.fastjson2.JSONArray;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
+import common.Controller;
|
|
|
+import common.YosException;
|
|
|
+import common.annotation.API;
|
|
|
+import common.annotation.CACHEING;
|
|
|
+import common.annotation.CACHEING_CLEAN;
|
|
|
+import common.data.*;
|
|
|
+import restcontroller.R;
|
|
|
+
|
|
|
+
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
+
|
|
|
+@API(title = "电商销售额表")
|
|
|
+public class agentssales extends Controller {
|
|
|
+
|
|
|
+ public agentssales(JSONObject content) throws YosException {
|
|
|
+ super(content);
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "新增更新电商销售额信息", apiversion = R.ID2025120608581803.v1.class)
|
|
|
+ public String insertormodify_agentssales() throws YosException {
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+ // 表名
|
|
|
+ String tableName = "sa_agents_sales";
|
|
|
+ Long sa_agents_salesid = content.getLong("sa_agents_salesid");
|
|
|
+ Long sa_agentsid = content.getLong("sa_agentsid");
|
|
|
+ String type =content.getString("type");
|
|
|
+ long year = content.getLong("year");
|
|
|
+ BigDecimal m1 = content.getBigDecimal("m1");
|
|
|
+ BigDecimal m2 = content.getBigDecimal("m2");
|
|
|
+ BigDecimal m3 = content.getBigDecimal("m3");
|
|
|
+ BigDecimal m4 = content.getBigDecimal("m4");
|
|
|
+ BigDecimal m5 = content.getBigDecimal("m5");
|
|
|
+ BigDecimal m6 = content.getBigDecimal("m6");
|
|
|
+ BigDecimal m7 = content.getBigDecimal("m7");
|
|
|
+ BigDecimal m8 = content.getBigDecimal("m8");
|
|
|
+ BigDecimal m9 = content.getBigDecimal("m9");
|
|
|
+ BigDecimal m10 = content.getBigDecimal("m10");
|
|
|
+ BigDecimal m11 = content.getBigDecimal("m11");
|
|
|
+ BigDecimal m12 = content.getBigDecimal("m12");
|
|
|
+ if (sa_agents_salesid <= 0 || dbConnect.runSqlQuery(
|
|
|
+ "select sa_agents_salesid from sa_agents_sales where sa_agents_salesid=" + sa_agents_salesid)
|
|
|
+ .isEmpty()) {
|
|
|
+ sa_agents_salesid = createTableID(tableName);
|
|
|
+ InsertSQL insertSQL = SQLFactory.createInsertSQL(this, tableName);
|
|
|
+ insertSQL.setUniqueid(sa_agents_salesid);
|
|
|
+ insertSQL.setSiteid(siteid);
|
|
|
+ insertSQL.setValue("sa_agentsid", sa_agentsid);
|
|
|
+ insertSQL.setValue("type", type);
|
|
|
+ insertSQL.setValue("year",year);
|
|
|
+ insertSQL.setValue("m1", m1);
|
|
|
+ insertSQL.setValue("m2", m2);
|
|
|
+ insertSQL.setValue("m3", m3);
|
|
|
+ insertSQL.setValue("m4", m4);
|
|
|
+ insertSQL.setValue("m5", m5);
|
|
|
+ insertSQL.setValue("m6", m6);
|
|
|
+ insertSQL.setValue("m7", m7);
|
|
|
+ insertSQL.setValue("m8", m8);
|
|
|
+ insertSQL.setValue("m9", m9);
|
|
|
+ insertSQL.setValue("m10", m10);
|
|
|
+ insertSQL.setValue("m11", m11);
|
|
|
+ insertSQL.setValue("m12", m12);
|
|
|
+ sqlList.add(insertSQL.getSQL());
|
|
|
+ sqlList.add(
|
|
|
+ DataContrlLog.createLog(this, "sa_agents_sales", sa_agents_salesid, "新增", "电商销售额信息新增成功").getSQL());
|
|
|
+ } else {
|
|
|
+ Rows rows = dbConnect.runSqlQuery(
|
|
|
+ "SELECT 1 from sa_agents_sales WHERE sa_agents_salesid = "
|
|
|
+ + sa_agents_salesid);
|
|
|
+ if (rows.isNotEmpty()) {
|
|
|
+ UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, tableName);
|
|
|
+ updateSQL.setUniqueid(sa_agents_salesid);
|
|
|
+ updateSQL.setSiteid(siteid);
|
|
|
+ updateSQL.setValue("sa_agentsid", sa_agentsid);
|
|
|
+ updateSQL.setValue("type", type);
|
|
|
+ updateSQL.setValue("year",year);
|
|
|
+ updateSQL.setValue("m1", m1);
|
|
|
+ updateSQL.setValue("m2", m2);
|
|
|
+ updateSQL.setValue("m3", m3);
|
|
|
+ updateSQL.setValue("m4", m4);
|
|
|
+ updateSQL.setValue("m5", m5);
|
|
|
+ updateSQL.setValue("m6", m6);
|
|
|
+ updateSQL.setValue("m7", m7);
|
|
|
+ updateSQL.setValue("m8", m8);
|
|
|
+ updateSQL.setValue("m9", m9);
|
|
|
+ updateSQL.setValue("m10", m10);
|
|
|
+ updateSQL.setValue("m11", m11);
|
|
|
+ updateSQL.setValue("m12", m12);
|
|
|
+ sqlList.add(updateSQL.getSQL());
|
|
|
+ sqlList.add(DataContrlLog.createLog(this, "sa_agents_sales", sa_agents_salesid, "更新", "电商销售额信息更新成功")
|
|
|
+ .getSQL());
|
|
|
+
|
|
|
+ } else {
|
|
|
+ return getErrReturnObject().setErrMsg("该电商销售额信息不存在").toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ dbConnect.runSqlUpdate(sqlList);
|
|
|
+ content.put("sa_agents_salesid", sa_agents_salesid);
|
|
|
+
|
|
|
+ return queryagents_salesMain();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @API(title = "电商销售额信息详情", apiversion = R.ID2025120609001403.v1.class)
|
|
|
+ @CACHEING
|
|
|
+ public String queryagents_salesMain() throws YosException {
|
|
|
+ Long sa_agents_salesid = content.getLong("sa_agents_salesid");
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents_sales", "*");
|
|
|
+ querySQL.setTableAlias("t1");
|
|
|
+ querySQL.setWhere("t1.sa_agents_salesid",sa_agents_salesid);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+ Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
|
|
|
+ return getSucReturnObject().setData(row).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @API(title = "查询电商销售额信息列表", apiversion = R.ID2025120609002203.v1.class)
|
|
|
+ @CACHEING
|
|
|
+ public String queryagents_salesList() throws YosException {
|
|
|
+ StringBuffer where = new StringBuffer(" 1=1 ");
|
|
|
+ Long sa_agentsid = content.getLong("sa_agentsid");
|
|
|
+
|
|
|
+ QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_agents_sales", "*");
|
|
|
+ querySQL.setTableAlias("t1");
|
|
|
+ querySQL.setSiteid(siteid);
|
|
|
+ querySQL.setWhere(where.toString());
|
|
|
+ querySQL.setWhere("t1.sa_agentsid",sa_agentsid);
|
|
|
+ querySQL.setPage(pageSize, pageNumber);
|
|
|
+ Rows rows = querySQL.query();
|
|
|
+
|
|
|
+ return getSucReturnObject().setData(rows).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ @API(title = "电商销售额信息删除", apiversion = R.ID2025120609003003.v1.class)
|
|
|
+ @CACHEING_CLEAN(apiClass = {agentssales.class})
|
|
|
+ public String delete() throws YosException {
|
|
|
+ JSONArray sa_agents_salesids = content.getJSONArray("sa_agents_salesids");
|
|
|
+ BatchDeleteErr batchDeleteErr = BatchDeleteErr.create(this, sa_agents_salesids.size());
|
|
|
+ for (Object o : sa_agents_salesids) {
|
|
|
+ long sa_agents_salesid = Long.parseLong(o.toString());
|
|
|
+ dbConnect.runSqlUpdate("delete from sa_agents_sales where siteid='" + siteid + "' and sa_agents_salesid="
|
|
|
+ + sa_agents_salesid);
|
|
|
+ }
|
|
|
+ return batchDeleteErr.getReturnObject().toString();
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|