Sfoglia il codice sorgente

导单导入价格

wangxiaoming 5 anni fa
parent
commit
e049cfab79

+ 2 - 1
watero-rst-web/src/main/java/com/iamberry/rst/controllers/order/AdminOrderController.java

@@ -994,6 +994,7 @@ public class AdminOrderController {
                                        @RequestParam("isOtherStore") Integer isOtherStore,
                                        @RequestParam("storeArray[]") String[] storeArray,
                                        @RequestParam("orderBatch") String orderBatch,
+                                       @RequestParam("selfOperated") Integer selfOperated,
                                        HttpServletRequest request) throws Exception {
         logger.info("-----------根据excel内容推送到百胜开始,Excel路径:"+ filePath +"-----------");
 
@@ -1009,7 +1010,7 @@ public class AdminOrderController {
         }
         // 读取文件中内容
         List<EfastOrder> orderEfasts = excelUtil.readCell(request.getServletContext().getRealPath(filePath),
-                productName, maps, infos, tel, name,platformOrder, num,discount,remark, priceMap, postType,orderStoreInfoSt,isOtherStore, storeArray);
+                productName, maps, infos, tel, name,platformOrder, num,discount,remark, priceMap, postType,orderStoreInfoSt,isOtherStore, storeArray,selfOperated);
         logger.info("---------orderEfasts订单个数为:"+orderEfasts.size() + "------------");
 
         //Efast升级 2018-6-8

+ 25 - 19
watero-rst-web/src/main/java/com/iamberry/rst/utils/ExcelUtil.java

@@ -374,7 +374,7 @@ public class ExcelUtil {
 
     public List<EfastOrder> readCell(String filePath, String productName, String[] maps,
                                             String[] infos, String tel, String name,String platformOrder, String num, String discount,String remark,
-                                            Map<String, ProductColor> price, String postType, String orderStoreInfoSt, Integer isOtherStore,String[] storeArray)
+                                            Map<String, ProductColor> price, String postType, String orderStoreInfoSt, Integer isOtherStore,String[] storeArray,Integer selfOperated)
             throws IOException {
         Map<String, String> map = new HashMap<>();
         for (String t : maps) {
@@ -552,26 +552,32 @@ public class ExcelUtil {
                 }
                 order.setOrderRemark(orderRemark);
 
-                String colorDiscount = getValue(temp.getCell(discountColumnIndex)).trim();
-                if(colorDiscount != null && !"".equals(colorDiscount)){
-                    colorDiscount = colorDiscount.replaceAll("\\r|\\r|\\n","");
-                }
-                if(colorDiscount == null || "".equals(colorDiscount) || Integer.valueOf(colorDiscount) == 0){
-                    order.setReturnStatus("error");
-                    order.setReturnMsg("价格不正确");
-                    // 读取购买数量
+                String colorDiscount = "0";
+                if(selfOperated == 1){
+                    colorDiscount = getValue(temp.getCell(discountColumnIndex)).trim();
+                    if(colorDiscount != null && !"".equals(colorDiscount)){
+                        colorDiscount = colorDiscount.replaceAll("\\r|\\r|\\n","");
+                    }
+                    if(colorDiscount == null || "".equals(colorDiscount) || Integer.valueOf(colorDiscount) == 0){
+                        order.setReturnStatus("error");
+                        order.setReturnMsg("价格不正确");
+                        // 读取购买数量
+                        order.setOrderProductDiscount(0);
+                        order.setOrderProductPrice(0);
+                    }else{
+                        // 读取购买数量
+                        Double colorDiscountDou = Double.valueOf(colorDiscount);
+                        colorDiscountDou = colorDiscountDou*100/orderNumByInt;
+                        order.setOrderProductDiscount(colorDiscountDou.intValue());
+                        order.setOrderProductPrice(colorDiscountDou.intValue());
+                        Double orderTotal = Double.valueOf(colorDiscount);
+                        orderTotal = orderTotal*100;
+                        order.setOrderTotal(orderTotal.intValue());
+                    }
+                }else{
                     order.setOrderProductDiscount(0);
                     order.setOrderProductPrice(0);
-                }else{
-                    // 读取购买数量
-                    Double colorDiscountDou = Double.valueOf(colorDiscount);
-                    colorDiscountDou = colorDiscountDou*100/orderNumByInt;
-                    order.setOrderProductDiscount(colorDiscountDou.intValue());
-                    order.setOrderProductPrice(colorDiscountDou.intValue());
-
-                    Double orderTotal = Double.valueOf(colorDiscount);
-                    orderTotal = orderTotal*100;
-                    order.setOrderTotal(orderTotal.intValue());
+                    order.setOrderTotal(0);
                 }
 
                 try{

+ 14 - 12
watero-rst-web/src/main/webapp/WEB-INF/views/order/excel_to_order_new.ftl

@@ -587,7 +587,9 @@
             layer.msg('订单编号与产品数量列重复!',{icon: 5,time:3000});
             return false;
         }
-        if(platformOrdersName == discountArray[0] ){
+        //1自营 2非自营
+        var  self_operated = $("[name='self_operated']:checked").val();
+        if(platformOrdersName == discountArray[0] && self_operated==1){
             layer.close(index);
             layer.msg('订单编号与产品总金额列重复!',{icon: 5,time:3000});
             return false;
@@ -612,16 +614,15 @@
             storeArray.push(shopId);
         }
 
-        for(var k=0;k<storeArray.length;k++){
-            if(storeArray[k] == 3 || storeArray[k] == 40 || storeArray[k] == 86){
-                var  self_operated = $("[name='self_operated']:checked").val();
-                if(self_operated == 2){
-                    layer.close(index);
-                    vailErrorMsg($("#self_operated_id"),"选择的店铺需要选择订单总额!",3500);
-                    return false;
-                }
-            }
-        }
+//        for(var k=0;k<storeArray.length;k++){
+//            if(storeArray[k] == 3 || storeArray[k] == 40 || storeArray[k] == 86){
+//                if(self_operated == 2){
+//                    layer.close(index);
+//                    vailErrorMsg($("#self_operated_id"),"选择的店铺需要选择订单总额!",3500);
+//                    return false;
+//                }
+//            }
+//        }
 
         /*Excel中的店铺名称*/
         var orderStoreInfoSt = $("#order_store_info").val();
@@ -648,7 +649,8 @@
                 "num":numArray,
                 "discount":discountArray,
                 "remark":remarkArray,
-                "orderBatch":orderBatch
+                "orderBatch":orderBatch,
+                "selfOperated":self_operated
             },
             dataType: 'json',
             async: false,