hu 2 лет назад
Родитель
Сommit
2df2504997

+ 15 - 0
src/custom/restcontroller/webmanage/sale/rebateaccount/SQL/返利结算单导出数据查询.sql

@@ -0,0 +1,15 @@
+SELECT
+    t3.agentnum,
+		t4.enterprisename,
+		t1.accumulatedamount,
+		t1.rebateamount,
+		t5.sonum,
+		t2.amount,
+		t2.rateamount
+FROM
+	sa_rebateaccount t1
+	inner join sa_rebateaccountdetail t2 on t1.sa_rebateaccountid=t2.sa_rebateaccountid and t1.siteid=t2.siteid
+	left join sa_agents t3 on t1.sys_enterpriseid=t3.sys_enterpriseid and t1.siteid=t3.siteid
+	left join sys_enterprise t4 on t1.sys_enterpriseid=t4.sys_enterpriseid and t1.siteid=t4.siteid
+	left join sa_order t5 on t2.sa_orderid=t5.sa_orderid and t2.siteid=t5.siteid
+	where t1.sa_rebateaccountheadid=$sa_rebateaccountheadid$ and t1.siteid=$siteid$ and t2.amount!=0

+ 28 - 2
src/custom/restcontroller/webmanage/sale/rebateaccount/rebateaccounthead.java

@@ -19,9 +19,11 @@ import common.data.RowsMap;
 import common.data.SQLFactory;
 import restcontroller.R;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
+import java.util.HashMap;
 
 public class rebateaccounthead extends Controller {
     /**
@@ -35,7 +37,7 @@ public class rebateaccounthead extends Controller {
 
     @API(title = "返利结算单新增更新", apiversion = R.ID20230627091003.v1.class)
     @CACHEING_CLEAN(apiClass = {rebateaccounthead.class})
-    public String insertormodify_rebateaccounthead() throws YosException {
+    public String insertormodify_rebateaccounthead() throws YosException , IOException{
         ArrayList<String> sqlList = new ArrayList<>();
         // 表名
         String tableName = "sa_rebateaccounthead";
@@ -61,7 +63,8 @@ public class rebateaccounthead extends Controller {
 
     @API(title = "返利结算单详情", apiversion = R.ID20230627091503.v1.class)
     @CACHEING
-    public String queryrebateaccountheadMain() throws YosException {
+    public String queryrebateaccountheadMain() throws YosException, IOException {
+        boolean isExport=content.getBooleanValue("isExport");
         Long sa_rebateaccountheadid = content.getLong("sa_rebateaccountheadid");
         SQLFactory sqlFactory = new SQLFactory(this, "返利结算单详情查询");
         sqlFactory.addParameter("sa_rebateaccountheadid", sa_rebateaccountheadid);
@@ -69,9 +72,32 @@ public class rebateaccounthead extends Controller {
         Rows rows = dbConnect.runSqlQuery(sqlFactory);
         Row row = rows.isNotEmpty() ? rows.get(0) : new Row();
 
+        if(isExport){
+             System.out.println(1111);
+            sqlFactory = new SQLFactory(this, "返利结算单导出数据查询");
+            sqlFactory.addParameter("sa_rebateaccountheadid", sa_rebateaccountheadid);
+            sqlFactory.addParameter("siteid", siteid);
+            rows = dbConnect.runSqlQuery(sqlFactory);
+            Rows uploadRows = uploadExcelToObs("rebateaccount", " 返利结算单数据列表", rows, getTitleMap());
+            return getSucReturnObject().setData(uploadRows).toString();
+        }
+
         return getSucReturnObject().setData(row).toString();
     }
 
+    //返回导出的标题
+    public HashMap<String, String> getTitleMap() {
+        HashMap<String, String> titleMap = new HashMap<>();
+        titleMap.put("agentnum", "经销商编码");
+        titleMap.put("enterprisename", "经销商名称");
+        titleMap.put("accumulatedamount", "累计订购返利商品金额");
+        titleMap.put("rebateamount", "装修返利金额");
+        titleMap.put("sonum", "订单号");
+        titleMap.put("amount", "订单金额(活动商品)");
+        titleMap.put("rateamount", "返利金额");
+        return titleMap;
+    }
+
     @API(title = "查询返利结算单列表", apiversion = R.ID20230627091603.v1.class)
     @CACHEING
     public String queryrebateaccountheadList() throws YosException {