소스 검색

nsy update 添加订单导出,批量刷新确认期望到货时间

ningsy 4 년 전
부모
커밋
3f3661a21f

+ 44 - 0
suishenbang-order/src/main/java/com/dgtly/order/controller/OrderBaseController.java

@@ -1,8 +1,10 @@
 package com.dgtly.order.controller;
 
 import com.alibaba.fastjson.JSONObject;
+import com.dgtly.common.core.domain.AjaxResult;
 import com.dgtly.common.exception.base.BaseException;
 import com.dgtly.common.utils.MapDataUtil;
+import com.dgtly.common.utils.poi.ExcelUtil;
 import com.dgtly.order.domain.MetaHanaSalesOrder;
 import com.dgtly.order.domain.OrderDetailModel;
 import com.dgtly.order.service.IMetaHanaSalesOrderService;
@@ -92,6 +94,48 @@ public class OrderBaseController extends BaseController {
 
         return prefix + "/edit";
     }
+
+    @RequiresPermissions("order:orderbase:export")
+    @PostMapping("/export")
+    @ResponseBody
+    public AjaxResult export(MetaHanaSalesOrder order)
+    {
+        List<MetaHanaSalesOrder> list = metaHanaSalesOrderService.selectDistinctMetaHanaSalesOrder(order);
+        if(list.size() >= 10000){
+            return new AjaxResult(301,"数据大于 10000 条Excel将无法打开,请过滤查询条件");
+        }
+        ExcelUtil<MetaHanaSalesOrder> util = new ExcelUtil<MetaHanaSalesOrder>(MetaHanaSalesOrder.class);
+        return util.exportExcel(list, "订单数据");
+    }
+
+    /**
+     * 批量刷新确认期望到货时间
+     * @return
+     */
+    @RequiresPermissions("order:orderbase:refreshArrivalTime")
+    @GetMapping("/refreshArrivalTime")
+    @ResponseBody
+    public AjaxResult refreshArrivalTime()
+    {
+        AjaxResult rest = new AjaxResult();
+        String url = cloudPath + "order"+"/order/meta-hana-sales-order/dealHistoryData";
+        String str= "";
+        try{
+            str = restTemplate.getForObject(url, String.class);
+            JSONObject json = JSONObject.parseObject(str);
+            if(json.getInteger("code")==200){
+                rest.setCode(0);
+                rest.setMsg("刷新成功");
+            } else {
+                rest.setCode(-1);
+                rest.setMsg("刷新失败");
+            }
+        }catch(Exception e){
+            logger.error("批量刷新确认期望到货时间"+url,e);
+            throw e;
+        }
+        return rest;
+    }
 }
 
 

+ 19 - 4
suishenbang-order/src/main/resources/templates/order/orderbase/orderbase.html

@@ -91,9 +91,12 @@
                 <!--<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="order:orderbase:remove">-->
                     <!--<i class="fa fa-remove"></i> 删除-->
                 <!--</a>-->
-                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="order:orderbase:export">-->
-                    <!--<i class="fa fa-download"></i> 导出-->
-                 <!--</a>-->
+                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="order:orderbase:export">
+                    <i class="fa fa-download"></i> 导出
+                </a>
+                <a class="btn btn-danger" onclick="refreshArrivalTime()" shiro:hasPermission="order:orderbase:refreshArrivalTime">
+                    <i class="fa fa-refresh"></i> 批量刷新确认期望到货时间
+                </a>
             </div>
             <div class="col-sm-12 select-table table-striped">
                 <table id="bootstrap-table"></table>
@@ -111,6 +114,7 @@
                 url: prefix + "/list",
                 createUrl: prefix + "/add",
                 updateUrl: prefix + "/edit/{id}",
+                exportUrl: prefix + "/export",
                 modalName: "订单基础信息",
                 columns: [{
                     checkbox: false
@@ -185,7 +189,18 @@
                 autoclose: true
             });
         });
-
+        function refreshArrivalTime () {
+            $.modal.confirm("批量刷新确认期望到货时间吗?", function() {
+                $.operate.get(prefix + "/refreshArrivalTime", function(result) {
+                    if (result.code == 0) {
+                        $.modal.alertSuccess(result.msg)
+                    } else {
+                        $.modal.alertError(result.msg);
+                    }
+                    $.modal.closeLoading();
+                });
+            });
+        };
     </script>
 </body>
 </html>