Ver código fonte

统一增加列表导出功能

hu 2 anos atrás
pai
commit
9f26df33c8

+ 65 - 4
src/custom/restcontroller/sale/cashbill/cashbill.java

@@ -400,11 +400,13 @@ public class cashbill extends Controller {
 
     @API(title = "收入凭证列表", apiversion = R.ID20221009102903.v1.class)
     @CACHEING
-    public String queryIncomeCashbillList() throws YosException {
+    public String queryIncomeCashbillList() throws YosException, IOException {
 
         /*
          * 过滤条件设置
          */
+
+        boolean isExport = content.getBooleanValue("isExport");
         String where = " 1=1 and t1.type=1 ";
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
@@ -452,7 +454,9 @@ public class cashbill extends Controller {
         }
         QuerySQL querySQL = queryList(where);
         querySQL.setOrderBy(pageSorting);
-        querySQL.setPage(pageSize, pageNumber);
+        if (!isExport) {
+            querySQL.setPage(pageSize, pageNumber);
+        }
         Rows rows = querySQL.query();
         ArrayList sa_cashbillids = rows.toArrayList("sa_cashbillid", new ArrayList<>());
         sa_cashbillids.add(0L);
@@ -466,16 +470,44 @@ public class cashbill extends Controller {
             }
             row.put("amount", row.getBigDecimal("amount"));
         }
+
+        if (isExport) {
+            //去除不需要导出项
+            rows.getFieldList().remove("sa_accountclassid");
+            rows.getFieldList().remove("period");
+            rows.getFieldList().remove("sys_enterpriseid");
+            rows.getFieldList().remove("abbreviation");
+            rows.getFieldList().remove("enterprisename");
+            rows.getFieldList().remove("sa_accountclassid");
+            rows.getFieldList().remove("status");
+            rows.getFieldList().remove("sourcenote");
+            rows.getFieldList().remove("ownertable");
+            rows.getFieldList().remove("ownerid");
+            rows.getFieldList().remove("createuserid");
+            rows.getFieldList().remove("createby");
+            rows.getFieldList().remove("createdate");
+            rows.getFieldList().remove("changeuserid");
+            rows.getFieldList().remove("changeby");
+            rows.getFieldList().remove("changedate");
+            rows.getFieldList().remove("subclass");
+            rows.getFieldList().remove("class");
+            rows.getFieldList().remove("unwriteoffamount");
+            rows.getFieldList().remove("offsettingbillno");
+
+            Rows uploadRows = uploadExcelToObs("cashBill", "收入凭证列表", rows, getTitleMap());
+            return getSucReturnObject().setData(uploadRows).toString();
+        }
         return getSucReturnObject().setData(rows).toString();
     }
 
     @API(title = "支出收入凭证列表", apiversion = R.ID20221010102903.v1.class)
     @CACHEING
-    public String queryPayCashbillList() throws YosException {
+    public String queryPayCashbillList() throws YosException, IOException {
 
         /*
          * 过滤条件设置
          */
+        boolean isExport = content.getBooleanValue("isExport");
         String where = " 1=1 and t1.type=0 ";
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
@@ -523,11 +555,40 @@ public class cashbill extends Controller {
         }
         QuerySQL querySQL = queryList(where);
         querySQL.setOrderBy(pageSorting);
-        querySQL.setPage(pageSize, pageNumber);
+        if (!isExport) {
+            querySQL.setPage(pageSize, pageNumber);
+        }
         Rows rows = querySQL.query();
         for (Row row : rows) {
             row.put("amount", row.getBigDecimal("amount"));
         }
+        if (isExport) {
+            //去除不需要导出项
+            rows.getFieldList().remove("sa_accountclassid");
+            rows.getFieldList().remove("period");
+            rows.getFieldList().remove("sys_enterpriseid");
+            rows.getFieldList().remove("abbreviation");
+            rows.getFieldList().remove("enterprisename");
+            rows.getFieldList().remove("sa_accountclassid");
+            rows.getFieldList().remove("status");
+            rows.getFieldList().remove("sourcenote");
+            rows.getFieldList().remove("ownertable");
+            rows.getFieldList().remove("ownerid");
+            rows.getFieldList().remove("createuserid");
+            rows.getFieldList().remove("createby");
+            rows.getFieldList().remove("createdate");
+            rows.getFieldList().remove("changeuserid");
+            rows.getFieldList().remove("changeby");
+            rows.getFieldList().remove("changedate");
+            rows.getFieldList().remove("subclass");
+            rows.getFieldList().remove("class");
+            rows.getFieldList().remove("unwriteoffamount");
+            rows.getFieldList().remove("offsettingbillno");
+
+            Rows uploadRows = uploadExcelToObs("cashBill", "支出凭证列表", rows, getTitleMap());
+            return getSucReturnObject().setData(uploadRows).toString();
+        }
+
         return getSucReturnObject().setData(rows).toString();
     }
 

+ 79 - 2
src/custom/restcontroller/webmanage/sale/item/Item.java

@@ -24,6 +24,7 @@ import restcontroller.webmanage.sale.itemgroup.itemgroup;
 import utility.ERPDocking;
 
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -327,8 +328,9 @@ public class Item extends Controller {
 
     @API(title = "货品档案列表", apiversion = R.ID20220923140602.v1.class)
     @CACHEING
-    public String queryList() throws YosException {
+    public String queryList() throws YosException, IOException {
         StringBuffer where = new StringBuffer(" 1=1 ");
+        boolean isExport = content.getBooleanValue("isExport");
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
             if (whereObject.containsKey("condition") && !"".equals(whereObject.getString("condition"))) {
@@ -396,7 +398,9 @@ public class Item extends Controller {
 //        Rows rows = dbConnect.runSqlQuery(sqlFactory.getSQL());
         QuerySQL querySQL = queryList(where.toString());
         querySQL.setOrderBy(pageSorting);
-        querySQL.setPage(pageSize, pageNumber);
+        if (!isExport) {
+            querySQL.setPage(pageSize, pageNumber);
+        }
         Rows rows = querySQL.query();
         // 默认商品图片
         Rows defaultImageRows = getAttachmentUrl("system", (long) 1, "defaultImage");
@@ -419,9 +423,82 @@ public class Item extends Controller {
             row.put("itemclass", itemclassRowsMap.getOrDefault(row.getString("itemid"), new Rows()));
         }
 
+
+        if (isExport) {
+            //去除不需要导出项
+            rows.getFieldList().remove("itemid");
+            rows.getFieldList().remove("marketprice");
+            rows.getFieldList().remove("unitid");
+            rows.getFieldList().remove("createdate");
+            rows.getFieldList().remove("barcode");
+            rows.getFieldList().remove("skucontrol");
+            rows.getFieldList().remove("batchcontrol");
+            rows.getFieldList().remove("grossweight");
+            rows.getFieldList().remove("weight");
+            rows.getFieldList().remove("height");
+            rows.getFieldList().remove("width");
+            rows.getFieldList().remove("length");
+            rows.getFieldList().remove("delivery");
+            rows.getFieldList().remove("istool");
+            rows.getFieldList().remove("volume");
+            rows.getFieldList().remove("marketingcategory");
+            rows.getFieldList().remove("ismodule");
+            rows.getFieldList().remove("cheek");
+            rows.getFieldList().remove("material");
+            rows.getFieldList().remove("iswoodproducts");
+            rows.getFieldList().remove("financeclasstype");
+            rows.getFieldList().remove("delistingstatus");
+            rows.getFieldList().remove("stockno");
+            rows.getFieldList().remove("widthschemeid");
+            rows.getFieldList().remove("lengthschemeid");
+            rows.getFieldList().remove("iscustomsize");
+            rows.getFieldList().remove("customprice");
+            rows.getFieldList().remove("auxunitid");
+            rows.getFieldList().remove("unitgroupname");
+            rows.getFieldList().remove("axunitname");
+            rows.getFieldList().remove("caliber");
+            rows.getFieldList().remove("pressure");
+            rows.getFieldList().remove("butterflyplatedrive");
+            rows.getFieldList().remove("valveplatematerial");
+            rows.getFieldList().remove("bodymaterial");
+            rows.getFieldList().remove("actuatortype");
+            rows.getFieldList().remove("actuatorbrand");
+            rows.getFieldList().remove("isbutterfly");
+            rows.getFieldList().remove("erpitemno");
+            rows.getFieldList().remove("erpitemname");
+            rows.getFieldList().remove("specalnote");
+            rows.getFieldList().remove("prodline");
+            rows.getFieldList().remove("device");
+            rows.getFieldList().remove("widthschemename");
+            rows.getFieldList().remove("lengthschemename");
+            rows.getFieldList().remove("brand");
+
+            Rows uploadRows = uploadExcelToObs("item", "商品列表", rows, getTitleMap());
+            return getSucReturnObject().setData(uploadRows).toString();
+        }
+
         return getSucReturnObject().setData(rows).toString();
     }
 
+    //返回导出的标题
+    public HashMap<String, String> getTitleMap() {
+        HashMap<String, String> titleMap = new HashMap<>();
+        titleMap.put("itemno", "产品编号");
+        titleMap.put("itemname", "产品名称");
+        titleMap.put("isonsale", "上/下架");
+        titleMap.put("tradefield", "领域");
+        titleMap.put("packageqty", "包装数量");
+        titleMap.put("itemclass", "营销类别");
+        titleMap.put("unitname", "单位");
+        titleMap.put("orderminqty", "起订量");
+        titleMap.put("orderaddqty", "增量");
+        titleMap.put("model", "型号");
+        titleMap.put("spec", "规格");
+        titleMap.put("color", "颜色");
+
+        return titleMap;
+    }
+
     public QuerySQL queryList(String where) throws YosException {
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "plm_item");
         querySQL.setTableAlias("t1");

+ 37 - 2
src/custom/restcontroller/webmanage/sale/paybill/Paybill.java

@@ -19,8 +19,10 @@ import common.data.Rows;
 import common.data.SQLFactory;
 import restcontroller.R;
 
+import java.io.IOException;
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.HashMap;
 
 @API(title = "打款凭证")
 public class Paybill extends Controller {
@@ -35,7 +37,8 @@ public class Paybill extends Controller {
 
     @API(title = "列表", apiversion = R.ID20221226152904.v1.class)
     @CACHEING
-    public String query() throws YosException {
+    public String query() throws YosException, IOException {
+        boolean isExport = content.getBooleanValue("isExport");
         StringBuffer where = new StringBuffer(" 1=1 ");
         if (content.containsKey("where")) {
             JSONObject whereObject = content.getJSONObject("where");
@@ -71,12 +74,44 @@ public class Paybill extends Controller {
             pageSorting = "t1.status desc, t1.createdate desc";
         }
         QuerySQL querySQL = query(where.toString());
-        querySQL.setPage(pageSize, pageNumber);
         querySQL.setOrderBy(pageSorting);
+        if (!isExport) {
+            querySQL.setPage(pageSize, pageNumber);
+        }
         Rows rows = querySQL.query();
+
+        if (isExport) {
+            //去除不需要导出项
+            rows.getFieldList().remove("sa_paybillid");
+            rows.getFieldList().remove("sys_enterpriseid");
+            rows.getFieldList().remove("checkby");
+            rows.getFieldList().remove("checkdate");
+            rows.getFieldList().remove("remarks");
+            rows.getFieldList().remove("enterprisename");
+            rows.getFieldList().remove("createby");
+            rows.getFieldList().remove("createdate");
+
+            Rows uploadRows = uploadExcelToObs("cashBill", "打款凭证列表", rows, getTitleMap());
+            return getSucReturnObject().setData(uploadRows).toString();
+        }
+
         return getSucReturnObject().setData(rows).toString();
     }
 
+    //返回导出的标题
+    public HashMap<String, String> getTitleMap() {
+        HashMap<String, String> titleMap = new HashMap<>();
+        titleMap.put("billno", "凭证编号");
+        titleMap.put("status", "单据状态");
+        titleMap.put("agentnum", "经销商编号");
+        titleMap.put("abbreviation", "经销商简称");
+        titleMap.put("payer", "付款人");
+        titleMap.put("paydate", "付款时间");
+        titleMap.put("period", "回款归属月份");
+        titleMap.put("amount", "打款金额");
+        return titleMap;
+    }
+
     public QuerySQL query(String where) throws YosException {
         QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_paybill");
         querySQL.setTableAlias("t1");