1
0
zcb 4 rokov pred
rodič
commit
cc452e88bf

+ 10 - 7
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -23,6 +23,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.apache.tools.zip.ZipEntry;
 import org.apache.tools.zip.ZipFile;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -32,6 +33,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.*;
 import java.util.*;
+import java.util.logging.Logger;
 
 /**
  * Controller
@@ -58,7 +60,6 @@ public class GoodsController {
 
 
 
-
     /**
      * 查看列表
      */
@@ -301,7 +302,7 @@ public class GoodsController {
 
     @RequestMapping("/generalGoodsImgUploadByZip")
     @ResponseBody
-    public R batchAddImgByZip(@RequestParam("file") MultipartFile file) {
+    public R batchAddImgByZip(@RequestParam("file") MultipartFile file) throws IOException {
         //上传文件
         batchAdd(file,2);
         return R.ok();
@@ -309,7 +310,7 @@ public class GoodsController {
 
     @RequestMapping("/generalGoodsImgUpload")
     @ResponseBody
-    public R batchAddImg(@RequestParam("file") MultipartFile file) {
+    public R batchAddImg(@RequestParam("file") MultipartFile file) throws IOException {
         //上传文件
         batchAdd(file,1);
         return R.ok();
@@ -317,16 +318,16 @@ public class GoodsController {
 
 
 
-    private Map<String, Object> batchAdd(MultipartFile file, int type) {
+    private Map<String, Object> batchAdd(MultipartFile file, int type) throws IOException {
         /*
          *创建临时文件夹
          * 解压文件
          */
         String fileName = file.getOriginalFilename();
-        String path = "d:/zip/";
+        String path = "/data/project/img/";
         File dir = new File(path);
         dir.mkdirs();
-        String filePath = "d:/test/";
+        String filePath = "/data/project/img2/";
         File fileDir = new File(filePath);
         fileDir.mkdirs();
         File saveFile = new File(fileDir, fileName);//将压缩包解析到指定位置
@@ -340,7 +341,9 @@ public class GoodsController {
             System.out.println(JSON.toJSONString(list));
         } catch (Exception e) {
             e.printStackTrace();
+
             System.out.println("解压执行失败");
+            throw e ;
         }
         //程序结束时,删除临时文件
         deleteFiles(filePath);//删除压缩包文件夹
@@ -396,7 +399,7 @@ public class GoodsController {
 
 
                     if(type == 1){
-                        String sku = entry.getName().split("/")[2].split("\\.")[0];
+                        String sku = entry.getName().split("/")[1].split("\\.")[0];
                         GoodsEntity goodsEntity = goodsService.queryBySku(sku);
                         goodsEntity.setPrimaryPicUrl(url);
                         goodsEntity.setListPicUrl(url);

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java

@@ -1119,6 +1119,7 @@ public class GoodsServiceImpl implements GoodsService {
         }
         goods.setDiscountedPrice(new BigDecimal(0));
         goods.setActualPaymentAmount(goods.getRetailPrice());
+        String goodsRate = goods.getGoodsRate();
         Map<String,Object> skuActivitiesMap = new HashMap<>();
 
         SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

+ 32 - 11
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -1775,23 +1775,45 @@ public class OrderServiceImpl implements OrderService {
 
                     if(goodsDto.get("actualPaymentAmount") instanceof Double){
                         goodsEntity.setStoreRetailPrice(new BigDecimal((Double)goodsDto.get("actualPaymentAmount")));
-                        goodsEntity.setRetailPrice(new BigDecimal((Double)goodsDto.get("retailPrice"))); // 单价
-                        goodsEntity.setDiscountedPrice(new BigDecimal((Double)goodsDto.get("discountedPrice"))); // 优惠金额
-                        goodsEntity.setActualPaymentAmount(new BigDecimal((Double)goodsDto.get("actualPaymentAmount"))); // 实际支付价格
+
                     }else if(goodsDto.get("actualPaymentAmount") instanceof Integer){
                         goodsEntity.setStoreRetailPrice(new BigDecimal((Integer)goodsDto.get("actualPaymentAmount")));
-                        goodsEntity.setRetailPrice(new BigDecimal((Integer)goodsDto.get("retailPrice")));
-                        goodsEntity.setDiscountedPrice(new BigDecimal((Integer)goodsDto.get("discountedPrice")));
-                        goodsEntity.setActualPaymentAmount(new BigDecimal((Integer)goodsDto.get("actualPaymentAmount")));
+
+
+
                     }else if(goodsDto.get("actualPaymentAmount") instanceof Float){
                         goodsEntity.setStoreRetailPrice(new BigDecimal((Float)goodsDto.get("actualPaymentAmount")));
+
+
+
+                    }
+
+                    if(goodsDto.get("retailPrice") instanceof Double){
+                    goodsEntity.setRetailPrice(new BigDecimal((Double)goodsDto.get("retailPrice"))); // 单价
+
+                    }else if(goodsDto.get("retailPrice") instanceof Integer){
+                        goodsEntity.setRetailPrice(new BigDecimal((Integer)goodsDto.get("retailPrice")));
+                    }else if(goodsDto.get("retailPrice") instanceof Float){
                         goodsEntity.setRetailPrice(new BigDecimal((Float)goodsDto.get("retailPrice")));
+                    }
+                    if(goodsDto.get("discountedPrice") instanceof Double){
+                        goodsEntity.setDiscountedPrice(new BigDecimal((Integer)goodsDto.get("discountedPrice"))); // 优惠金额
+                    }else if(goodsDto.get("discountedPrice") instanceof Integer){
+                        goodsEntity.setDiscountedPrice(new BigDecimal((Integer)goodsDto.get("discountedPrice")));
+                    }else if(goodsDto.get("discountedPrice") instanceof Float){
                         goodsEntity.setDiscountedPrice(new BigDecimal((Float)goodsDto.get("discountedPrice")));
+                    }
+                    if(goodsDto.get("actualPaymentAmount") instanceof Double){
+                        goodsEntity.setActualPaymentAmount(new BigDecimal((Double)goodsDto.get("actualPaymentAmount"))); // 实际支付价格
+                    }else if(goodsDto.get("actualPaymentAmount") instanceof Integer){
+                        goodsEntity.setActualPaymentAmount(new BigDecimal((Integer)goodsDto.get("actualPaymentAmount")));
+                    }else if(goodsDto.get("actualPaymentAmount") instanceof Float){
                         goodsEntity.setActualPaymentAmount(new BigDecimal((Float)goodsDto.get("actualPaymentAmount")));
                     }
 
 
 
+
 //                    goodsEntity.setStoreRetailPrice(productInfo.getRetailPrice());
                     // 借用这个字段来存储购买数
                     goodsEntity.setGoodsNumber(sellVolume);
@@ -1855,7 +1877,6 @@ public class OrderServiceImpl implements OrderService {
             }
 
 
-
             // 生成订单
             String merchOrderSn = "EMATO" + CommonUtil.generateOrderNumber();
             OrderVo order = setOrderVo(goodsEntities, userEntity,storeId.longValue(), user.getMerchSn(),disCountAmount);
@@ -1909,12 +1930,12 @@ public class OrderServiceImpl implements OrderService {
             // 微信支付
 //            wxPay(user, parCode, resultObj, order, processRecordEntity, orderWXPayRecordCurrent, store);
             // 支付宝支付
-            AliPay(user, parCode , order, processRecordEntity, orderWXPayRecordCurrent, store);
+//            AliPay(user, parCode , order, processRecordEntity, orderWXPayRecordCurrent, store);
             OrderEntity orderEntity = queryObject(order.getId());
-//            orderEntity.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
-//            orderEntity.setPayStatus(Integer.parseInt(Dict.payStatus.item_2.getItem()));
+            orderEntity.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
+            orderEntity.setPayStatus(Integer.parseInt(Dict.payStatus.item_2.getItem()));
 //            orderEntity.setPayFlag(payFlag);
-//            orderEntity.setPayTime(new Date());
+            orderEntity.setPayTime(new Date());
             orderDao.update(orderEntity);
             resultObj.put("shopName",store.getStoreName()); // 根据门店编号查询
             resultObj.put("userName",user.getUsername());

+ 4 - 3
kmall-admin/src/main/webapp/WEB-INF/page/sale/sale.html

@@ -63,6 +63,7 @@
                             <img style="height: 400px;width: 400px;" :src="goods.primaryPicUrl" class="img-rounded"/>
                             <h1 style="margin: 8px;"><strong>{{goods.name}}</strong></h1>
                             <p style="margin: 8px;">单价: <strong>{{goods.retailPrice}}</strong> /元</p>
+                            <p style="margin: 8px;">税费: <strong>{{goods.tax}}</strong> /元</p>
                             <p style="margin: 8px;">规格: {{goods.specification}}</p>
                             <p style="margin: 8px;">条形码: {{goods.prodBarcode}}</p>
                             <!--<span style="margin: 8px;">商品描述: {{goods.goodsDesc}}</span>-->
@@ -80,21 +81,21 @@
                         <table id="cbec" class="table .table-striped">
                             <tr style="border: white;background-color: #F5DCB3;font-size: 1.3em" >
                                 <th style="width: 350px;padding: 7px">跨境商品名称</th>
-                                <th style="padding: 7px">规格</th>
                                 <th style="padding: 7px">单价</th>
                                 <th style="padding: 7px">优惠金额</th>
                                 <th style="padding: 7px">实际支付价</th>
-                                <!--<th>税费</th>-->
+                                <th style="padding: 7px">税费</th>
+<!--                                <th>税费</th>-->
                                 <th style="padding: 7px">数量</th>
 <!--                                <th>操作</th>-->
                                 <th style="padding: 7px">参与活动</th>
                             </tr>
                             <tr v-for="(item,i) in goodsList" v-if="item.name" style="font-size: 1.3em">
                                 <td><h3>{{item.name}}</h3></td>
-                                <td> {{item.specification}}</td>
                                 <td> {{item.retailPrice}}</td>
                                 <td> {{item.discountedPrice}}</td>
                                 <td> {{item.actualPaymentAmount}}</td>
+                                <td> {{item.specification}}</td>
                                 <td>
 <!--                                    <i class="glyphicon glyphicon-minus" aria-hidden="true" @click="minus(item.id)"></i>-->
                                     {{item.sellVolume}}

+ 2 - 1
kmall-admin/src/main/webapp/js/sale/sale.js

@@ -886,7 +886,8 @@ function openWebSocket() {
         //无法使用wss,浏览器打开WebSocket时报错
         //ws对应http、wss对应https。
         // webSocket = new WebSocket("ws://183.62.225.124:8080/ws/server/"+storeId);
-        webSocket = new WebSocket("ws://127.0.0.1:8080//ws/server/"+storeId);
+        // webSocket = new WebSocket("ws://127.0.0.1:8080//ws/server/"+storeId);
+        webSocket = new WebSocket("wss://cb.k1net.cn/ws/server/"+storeId);
         if (webSocket.readyState === webSocket.CONNECTING) {
             console.log('1.连接正在打开......');
         }

+ 1 - 0
kmall-admin/src/main/webapp/js/shop/storeProductStock.js

@@ -586,6 +586,7 @@ var vm = new Vue({
         getAttributes: function (opt) {
             var value = opt.value;
             if(value){
+                vm.getBrand(value);
                 $.get("../attribute/query?attributeCategoryId=" + value , function (r) {
                     vm.attributes = r.list;
                 });