Procházet zdrojové kódy

Merge branch 'master' of yb/kmall-pt-general into master

杨波 před 4 roky
rodič
revize
a6744dbec1

+ 14 - 8
kmall-admin/src/main/java/com/kmall/admin/controller/StoreTransferInventoryOrderController.java

@@ -1,11 +1,5 @@
 package com.kmall.admin.controller;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.kmall.admin.dto.StoreGoodsDto;
 import com.kmall.admin.dto.StoreTransferInventoryOrderImportDto;
 import com.kmall.admin.entity.StoreTransferInventoryOrderEntity;
 import com.kmall.admin.service.StoreTransferInventoryOrderService;
@@ -14,12 +8,16 @@ import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
 import com.kmall.common.utils.excel.ExcelUtil;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
 
 /**
  * 门店库存转移单表Controller
@@ -35,6 +33,7 @@ public class StoreTransferInventoryOrderController {
     private StoreTransferInventoryOrderService storeTransferInventoryOrderService;
     @Autowired
     private ExcelUtil excelUtil;
+
     /**
      * 查看列表
      */
@@ -98,6 +97,13 @@ public class StoreTransferInventoryOrderController {
             e.printStackTrace();
             return R.error("导入失败!");
         }
+        for (int i = 0; i < storeTransferInventoryOrderImportDtoList.size(); i++) {
+            StoreTransferInventoryOrderImportDto dto = storeTransferInventoryOrderImportDtoList.get(i);
+            String msg = dto.validDto();
+            if (msg != null) {
+                return R.error("excel第" + (i + 3) + "行中数据有误," + msg);
+            }
+        }
         storeTransferInventoryOrderService.uploadExcel(storeTransferInventoryOrderImportDtoList);
         return R.ok();
     }
@@ -120,7 +126,7 @@ public class StoreTransferInventoryOrderController {
     @RequestMapping("/delete")
 //    @RequiresPermissions("storetransferinventoryorder:delete")
     @ResponseBody
-    public R delete(@RequestBody Integer[]ids) {
+    public R delete(@RequestBody Integer[] ids) {
         storeTransferInventoryOrderService.deleteBatch(ids);
 
         return R.ok();

+ 30 - 0
kmall-admin/src/main/java/com/kmall/admin/dto/StoreTransferInventoryOrderImportDto.java

@@ -1,5 +1,7 @@
 package com.kmall.admin.dto;
 
+import org.apache.commons.lang3.StringUtils;
+
 import java.io.Serializable;
 
 public class StoreTransferInventoryOrderImportDto implements Serializable {
@@ -112,4 +114,32 @@ public class StoreTransferInventoryOrderImportDto implements Serializable {
     public void setRemark(String remark) {
         this.remark = remark;
     }
+
+    public String validDto() {
+        if (StringUtils.isEmpty(this.merchSn)) {
+            return "商户编号不能为空";
+        }
+        if (StringUtils.isEmpty(this.merchName)) {
+            return "商户名称不能为空";
+        }
+        if (StringUtils.isEmpty(this.inStoreSn)) {
+            return "转入门店编号不能为空";
+        }
+        if (StringUtils.isEmpty(this.inStoreName)) {
+            return "转入门店名称不能为空";
+        }
+        if (StringUtils.isEmpty(this.outStoreSn)) {
+            return "转出门店编号不能为空";
+        }
+        if (StringUtils.isEmpty(this.outStoreName)) {
+            return "转出门店名称不能为空";
+        }
+        if (StringUtils.isEmpty(this.sku)) {
+            return "sku不能为空";
+        }
+        if (this.num == null) {
+            return "数量不能为空";
+        }
+        return null;
+    }
 }

+ 8 - 2
kmall-admin/src/main/resources/mybatis/mapper/StoreTransferInventoryOrderDao.xml

@@ -55,8 +55,14 @@
     		`modify_sn`
 		from mall_store_transfer_inventory_order
 		WHERE 1=1
-		<if test="name != null and name.trim() != ''">
-			AND name LIKE concat('%',#{name},'%')
+		<if test="id != null  and id.trim() != ''">
+			AND id = #{id}
+		</if>
+		<if test="inStoreName != null and inStoreName.trim() != ''">
+			AND in_store_name like concat('%', #{inStoreName}, '%')
+		</if>
+		<if test="outStoreName != null and outStoreName.trim() != ''">
+			AND out_store_name like concat('%',#{outStoreName}, '%')
 		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">

+ 5 - 2
kmall-admin/src/main/resources/mybatis/mapper/StoreTransferInventoryOrderDetailDao.xml

@@ -40,8 +40,11 @@
     		`modify_sn`
 		from mall_store_transfer_inventory_order_detail
 		WHERE 1=1
-		<if test="name != null and name.trim() != ''">
-			AND name LIKE concat('%',#{name},'%')
+		<if test="orderId != null and orderId.trim() != ''">
+			AND order_id = #{orderId}
+		</if>
+		<if test="sku != null and sku.trim() != ''">
+			AND sku like concat('%', #{sku}, '%')
 		</if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">

+ 9 - 3
kmall-admin/src/main/webapp/WEB-INF/page/shop/storetransferinventoryorder.html

@@ -10,7 +10,13 @@
         <Row :gutter="16">
             <div class="search-group">
                 <i-col span="4">
-                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
+                    <i-input v-model="q.id" @on-enter="query" placeholder="转移单ID"/>
+                </i-col>
+                <i-col span="4">
+                    <i-input v-model="q.inStoreName" @on-enter="query" placeholder="转入门店名称"/>
+                </i-col>
+                <i-col span="4">
+                    <i-input v-model="q.outStoreName" @on-enter="query" placeholder="转出门店名称"/>
                 </i-col>
                 <i-button @click="query">查询</i-button>
                 <i-button @click="reloadSearch">重置</i-button>
@@ -56,8 +62,8 @@
             <Form-item label="转出门店名称" prop="outStoreName">
                 <i-input v-model="storeTransferInventoryOrder.outStoreName" placeholder="转出门店名称"/>
             </Form-item>
-            <Form-item label="状态 0:未转移 1:转移成功 2:转移失败" prop="status">
-                <i-input v-model="storeTransferInventoryOrder.status" placeholder="状态 0:未转移 1:转移成功 2:转移失败"/>
+            <Form-item label="状态" prop="status">
+                <i-input v-model="storeTransferInventoryOrder.status" placeholder="状态 0:未转移 1:转移成功 2:转移失败 3:转移中"/>
             </Form-item>
             <Form-item label="备注" prop="remark">
                 <i-input v-model="storeTransferInventoryOrder.remark" placeholder="备注"/>

+ 4 - 1
kmall-admin/src/main/webapp/WEB-INF/page/shop/storetransferinventoryorderdetail.html

@@ -10,7 +10,10 @@
         <Row :gutter="16">
             <div class="search-group">
                 <i-col span="4">
-                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
+                    <i-input v-model="q.orderId" @on-enter="query" placeholder="门店转移单id"/>
+                </i-col>
+                <i-col span="4">
+                    <i-input v-model="q.sku" @on-enter="query" placeholder="转移商品sku"/>
                 </i-col>
                 <i-button @click="query">查询</i-button>
                 <i-button @click="reloadSearch">重置</i-button>

+ 60 - 28
kmall-admin/src/main/webapp/js/shop/storetransferinventoryorder.js

@@ -3,14 +3,26 @@ $(function () {
         url: '../storetransferinventoryorder/list',
         datatype: "json",
         colModel: [
-			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+			{label: '转移单id', name: 'id', index: 'id', key: true},
 			{label: '商户编号', name: 'merchSn', index: 'merch_sn', width: 80},
 			{label: '商户名称', name: 'merchName', index: 'merch_name', width: 80},
 			{label: '转入门店编号', name: 'inStoreSn', index: 'in_store_sn', width: 80},
 			{label: '转入门店名称', name: 'inStoreName', index: 'in_store_name', width: 80},
 			{label: '转出门店编号', name: 'outStoreSn', index: 'out_store_sn', width: 80},
 			{label: '转出门店名称', name: 'outStoreName', index: 'out_store_name', width: 80},
-			{label: '状态', name: 'status', index: 'status', width: 80},
+			{label: '状态', name: 'status', index: 'status', width: 80, formatter: function (value, options, row) {
+				let ret = "未知";
+				if (value === 0) {
+					ret = "未转移";
+				} else if (value === 1) {
+					ret = "转移成功";
+				} else if (value === 2) {
+					ret = "转移失败";
+				} else if (value === 3) {
+					ret = "转移中";
+				}
+				return ret;
+			}},
 			{label: '备注', name: 'remark', index: 'remark', width: 80},
 			{label: '创建时间', name: 'createTime', index: 'create_time', width: 80},
 			{label: '创建人', name: 'createSn', index: 'create_sn', width: 80},
@@ -55,7 +67,9 @@ let vm = new Vue({
 			]
 		},
 		q: {
-		    name: ''
+		    id: '',
+			inStoreName: '',
+			outStoreName: ''
 		}
 	},
 	methods: {
@@ -76,11 +90,11 @@ let vm = new Vue({
 			}else{
 				alert(data.msg);
 			}
-			setTimeout(exportMsg, 100);
+			this.$Modal.remove()
 		},
 		uploadExcelError: function () {
 			alert('上传出现异常,请重试!');
-			setTimeout(exportMsg, 100);
+			this.$Modal.remove()
 		},
 		uploadExcelProgress:function(event, file, fileList){
 			console.log("上传中")
@@ -88,18 +102,17 @@ let vm = new Vue({
 			console.log(file)
 			console.log(fileList)
 			console.log("上传中")
-			exportMsg = this.$Message.loading({
-				content: 'Loading...',
-				duration: 0
+			exportMsg = this.$Modal.info({
+				title: "处理中",
+				content: "正在处理中,请勿关闭页面..."
 			});
-			// setTimeout(msg, 3000);
 		},
 		uploadExcelFormatError: function (file) {
 			this.$Notice.warning({
 				title: '文件格式不正确',
 				desc: '文件 ' + file.name + ' 格式不正确,请上传 xls 或 xlsx 格式的文件。'
 			});
-			setTimeout(exportMsg, 100);
+			this.$Modal.remove()
 		},
 		update: function (event) {
             let id = getSelectedRow();
@@ -158,24 +171,41 @@ let vm = new Vue({
 			if (id == null){
 				return;
 			}
+			let that = this;
 
-			confirm('确定要对选中的记录进行转移吗?', function () {
-				$.ajax({
-					type: "POST",
-					url: "../ktooms/sendTransfer/" + id,
-					contentType: "application/json",
-					data: "{}",
-					success: function (r) {
-						if (r.code == 0) {
-							alert('操作成功', function (index) {
-								$("#jqGrid").trigger("reloadGrid");
-							});
-						} else {
-							alert(r.msg);
+			this.$Modal.confirm({
+				title: '提示',
+				content: '确定要对选中的记录进行转移吗?',
+				onOk: () => {
+					that.$Modal.info({
+						title: "处理中",
+						content: "正在处理中,请勿关闭页面..."
+					});
+
+					$.ajax({
+						type: "POST",
+						url: "../ktooms/sendTransfer/" + id,
+						contentType: "application/json",
+						data: "{}",
+						success: function (r) {
+							that.$Modal.remove()
+							if (r.code == 0) {
+								alert('操作成功', function (index) {
+									$("#jqGrid").trigger("reloadGrid");
+								});
+							} else {
+								alert(r.msg);
+							}
 						}
-					}
-				});
+					});
+				},
+				onCancel: () => {
+				}
 			});
+
+			// confirm('确定要对选中的记录进行转移吗?', function () {
+			//
+			// });
 		},
 		getInfo: function(id){
 			$.get("../storetransferinventoryorder/info/"+id, function (r) {
@@ -184,15 +214,17 @@ let vm = new Vue({
 		},
         reloadSearch: function() {
             vm.q = {
-                name: ''
-            }
+				id: '',
+				inStoreName: '',
+				outStoreName: ''
+			}
             vm.reload();
 		},
 		reload: function (event) {
 			vm.showList = true;
             let page = $("#jqGrid").jqGrid('getGridParam', 'page');
 			$("#jqGrid").jqGrid('setGridParam', {
-                postData: {'name': vm.q.name},
+                postData: vm.q,
                 page: page
             }).trigger("reloadGrid");
             vm.handleReset('formValidate');

+ 7 - 5
kmall-admin/src/main/webapp/js/shop/storetransferinventoryorderdetail.js

@@ -3,7 +3,7 @@ $(function () {
         url: '../storetransferinventoryorderdetail/list',
         datatype: "json",
         colModel: [
-			{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+			{label: 'id', name: 'id', index: 'id', key: true},
 			{label: '门店转移单id', name: 'orderId', index: 'order_id', width: 80},
 			{label: '转移商品sku', name: 'sku', index: 'sku', width: 80},
 			{label: '转移商品数量', name: 'num', index: 'num', width: 80},
@@ -49,7 +49,8 @@ let vm = new Vue({
 			]
 		},
 		q: {
-		    name: ''
+		    orderId: '',
+			sku: ''
 		}
 	},
 	methods: {
@@ -120,15 +121,16 @@ let vm = new Vue({
 		},
         reloadSearch: function() {
             vm.q = {
-                name: ''
-            }
+				orderId: '',
+				sku: ''
+			}
             vm.reload();
 		},
 		reload: function (event) {
 			vm.showList = true;
             let page = $("#jqGrid").jqGrid('getGridParam', 'page');
 			$("#jqGrid").jqGrid('setGridParam', {
-                postData: {'name': vm.q.name},
+                postData: vm.q,
                 page: page
             }).trigger("reloadGrid");
             vm.handleReset('formValidate');