Sfoglia il codice sorgente

xwh增加手动触发税率同步按钮

xwh 4 anni fa
parent
commit
136f0ec471

+ 31 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -699,4 +699,35 @@ public class GoodsController {
 
 
 
+    /**
+     * 同步海关编号和商品税率
+     * @return
+     */
+    @PostMapping("/syncGoodsRate")
+    public R syncGoodsRate(){
+        // 先同步海关商品编码,再同步税率
+        try {
+            goodsService.syncOmsHsCode();
+        }catch (Exception e){
+            e.printStackTrace();
+            return R.error("同步海关商品编码失败,请联系管理员");
+        }
+        try {
+            goodsService.syncGoodsRate();
+        }catch (Exception e){
+            e.printStackTrace();
+            return R.error("同步商品税率失败,请联系管理员");
+        }
+        return R.ok();
+    }
+
+
+
+
+
+
+
+
+
+
 }

+ 2 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/goods.html

@@ -140,6 +140,8 @@
                 <i-button type="dashed" @click="unSale"><i class="fa fa-hand-o-down"></i>&nbsp;下架</i-button>
                 #end
 
+                <i-button type="primary" @click="syncGoodsRate"><i class="fa fa-pencil-square-o"></i>&nbsp;同步税率</i-button>
+
                 <!--<i-button type="info" @click="goodsExport"><i class="fa fa-plus"></i>&nbsp;商品导入</i-button>-->
                 <!--<i-button type="info" @click="sameGoodsExport"><i class="fa fa-plus"></i>&nbsp;普货商品导入</i-button>-->
 

+ 18 - 0
kmall-admin/src/main/webapp/js/shop/goods.js

@@ -365,6 +365,24 @@ var vm = new Vue({
                 });
             });
         },
+        syncGoodsRate: function () {
+            confirm('同步商品税率会影响线上收银,请谨慎确认,同步税率预需要数分钟,确定要同步商品税率?', function () {
+                $.ajax({
+                    type: "POST",
+                    url: "../goods/syncGoodsRate",
+                    contentType: "application/json",
+                    success: function (r) {
+                        if (r.code == 0) {
+                            alert('同步税率成功', function (index) {
+                                $("#jqGrid").trigger("reloadGrid");
+                            });
+                        } else {
+                            alert(r.msg);
+                        }
+                    }
+                });
+            });
+        },
         openSpe: function () {
             var id = getSelectedRow();
             if (id == null) {