Parcourir la source

Merge branch 'master' of hyq/kmall-pt into master

黄亚琴 il y a 6 ans
Parent
commit
5ee69ebfeb
38 fichiers modifiés avec 2959 ajouts et 71 suppressions
  1. 35 2
      kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java
  2. 138 0
      kmall-admin/src/main/java/com/kmall/admin/controller/OfflineCartController.java
  3. 63 8
      kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java
  4. 4 2
      kmall-admin/src/main/java/com/kmall/admin/controller/OrderRefundController.java
  5. 4 2
      kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java
  6. 4 2
      kmall-admin/src/main/java/com/kmall/admin/controller/StoreController.java
  7. 2 0
      kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java
  8. 25 0
      kmall-admin/src/main/java/com/kmall/admin/dao/OfflineCartDao.java
  9. 6 0
      kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java
  10. 6 0
      kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java
  11. 108 0
      kmall-admin/src/main/java/com/kmall/admin/entity/CartEntity.java
  12. 40 0
      kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java
  13. 348 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OfflineCartEntity.java
  14. 50 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java
  15. 98 0
      kmall-admin/src/main/java/com/kmall/admin/entity/OrderGoodsEntity.java
  16. 29 3
      kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java
  17. 1 0
      kmall-admin/src/main/java/com/kmall/admin/service/CartService.java
  18. 1 0
      kmall-admin/src/main/java/com/kmall/admin/service/GoodsService.java
  19. 77 0
      kmall-admin/src/main/java/com/kmall/admin/service/OfflineCartService.java
  20. 10 0
      kmall-admin/src/main/java/com/kmall/admin/service/OrderService.java
  21. 7 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/GoodsServiceImpl.java
  22. 103 0
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OfflineCartServiceImpl.java
  23. 240 11
      kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java
  24. 50 11
      kmall-admin/src/main/resources/mybatis/mapper/CartDao.xml
  25. 17 0
      kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml
  26. 197 0
      kmall-admin/src/main/resources/mybatis/mapper/OfflineCartDao.xml
  27. 83 8
      kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml
  28. 31 9
      kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml
  29. 228 0
      kmall-admin/src/main/webapp/WEB-INF/page/shop/offilineOrderList.html
  30. 110 0
      kmall-admin/src/main/webapp/WEB-INF/page/shop/scannShop.html
  31. 493 0
      kmall-admin/src/main/webapp/js/shop/offilineOrderList.js
  32. 281 0
      kmall-admin/src/main/webapp/js/shop/scannShop.js
  33. 3 1
      kmall-api/src/main/java/com/kmall/api/api/ApiPayController.java
  34. 32 0
      kmall-api/src/main/java/com/kmall/api/contants/Dict.java
  35. 11 0
      kmall-api/src/main/java/com/kmall/api/entity/OrderVo.java
  36. 5 3
      kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java
  37. 12 3
      kmall-api/src/main/resources/mybatis/mapper/ApiOrderMapper.xml
  38. 7 6
      kmall-schedule/src/main/resources/mybatis/mapper/QzOrderMapper.xml

+ 35 - 2
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -4,16 +4,18 @@ import com.kmall.admin.entity.GoodsEntity;
 import com.kmall.admin.entity.GoodsGalleryEntity;
 import com.kmall.admin.service.GoodsGalleryService;
 import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.service.OfflineCartService;
+import com.kmall.common.entity.SysUserEntity;
 import com.kmall.common.utils.PageUtils;
 import com.kmall.common.utils.Query;
 import com.kmall.common.utils.R;
+import com.kmall.common.utils.ShiroUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Controller
@@ -29,6 +31,8 @@ public class GoodsController {
     private GoodsService goodsService;
     @Autowired
     private GoodsGalleryService goodsGalleryService;
+    @Autowired
+    private OfflineCartService offlineCartService;
 
     /**
      * 查看列表
@@ -202,4 +206,33 @@ public class GoodsController {
         //上传文件
         return R.ok();
     }
+
+    /*@RequestMapping("/scannInfo")
+    @RequiresPermissions("goods:scannInfo")
+    public R scannInfo(@RequestParam Map<String, Object> params) {
+        String goodsSn = (String)params.get("goodsSn");
+        GoodsEntity goods = goodsService.queryObjectByGoodsSnAndBizType(goodsSn);
+        if(goods == null) {
+            return R.error("商品信息不存在");
+        }
+        List<OfflineCartEntity> cartEntityList = offlineCartService.offlineGoodsCart(goods);
+
+        return R.ok().put("cartEntityList", cartEntityList);
+    }*/
+    @RequestMapping("/scannInfo/{prodBarcode}")
+    @RequiresPermissions("goods:scannInfo")
+    public R scannInfo(@PathVariable("prodBarcode")String prodBarcode) {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        if(user == null) {
+            return R.error("用户登录超时,请重新登录");
+        }
+        if (!user.getRoleType().equalsIgnoreCase("2")) {
+            return R.error("该操作只允许店员账户操作");
+        }
+        GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(prodBarcode);
+        if(goods == null) {
+            return R.error("商品信息不存在");
+        }
+        return R.ok().put("goods", goods);
+    }
 }

+ 138 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/OfflineCartController.java

@@ -0,0 +1,138 @@
+package com.kmall.admin.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import com.kmall.admin.entity.GoodsEntity;
+import com.kmall.admin.entity.OfflineCartEntity;
+import com.kmall.admin.service.GoodsService;
+import com.kmall.admin.service.OfflineCartService;
+import com.kmall.common.entity.SysUserEntity;
+import com.kmall.common.utils.PageUtils;
+import com.kmall.common.utils.Query;
+import com.kmall.common.utils.R;
+import com.kmall.common.utils.ShiroUtils;
+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.*;
+
+/**
+ * Controller
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-11-29 15:14:59
+ */
+@Controller
+@RequestMapping("offlinecart")
+public class OfflineCartController {
+    @Autowired
+    private OfflineCartService offlineCartService;
+    @Autowired
+    private GoodsService goodsService;
+
+    /**
+     * 查看列表
+     */
+    @RequestMapping("/list")
+    @RequiresPermissions("offlinecart:list")
+    @ResponseBody
+    public R list(@RequestParam Map<String, Object> params) {
+        //查询列表数据
+        Query query = new Query(params);
+
+        List<OfflineCartEntity> offlineCartList = offlineCartService.queryList(query);
+        int total = offlineCartService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(offlineCartList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    /**
+     * 查看信息
+     */
+    @RequestMapping("/info/{id}")
+    @RequiresPermissions("offlinecart:info")
+    @ResponseBody
+    public R info(@PathVariable("id") Integer id) {
+        OfflineCartEntity offlineCart = offlineCartService.queryObject(id);
+
+        return R.ok().put("offlineCart", offlineCart);
+    }
+
+    /**
+     * 保存
+     */
+    @RequestMapping("/save")
+    @RequiresPermissions("offlinecart:save")
+    @ResponseBody
+    public R save(@RequestBody OfflineCartEntity offlineCart) {
+        offlineCartService.save(offlineCart);
+
+        return R.ok();
+    }
+
+    /**
+     * 修改
+     */
+    @RequestMapping("/update")
+    @RequiresPermissions("offlinecart:update")
+    @ResponseBody
+    public R update(@RequestBody OfflineCartEntity offlineCart) {
+        offlineCartService.update(offlineCart);
+
+        return R.ok();
+    }
+
+    /**
+     * 删除
+     */
+    @RequestMapping("/delete")
+    @RequiresPermissions("offlinecart:delete")
+    @ResponseBody
+    public R delete(@RequestBody Integer[]ids) {
+        offlineCartService.deleteBatch(ids);
+
+        return R.ok();
+    }
+
+    /**
+     * 查看所有列表
+     */
+    @RequestMapping("/queryAll")
+    @ResponseBody
+    public R queryAll(@RequestParam Map<String, Object> params) {
+
+        List<OfflineCartEntity> list = offlineCartService.queryList(params);
+
+        return R.ok().put("list", list);
+    }
+    @RequestMapping("/infoList")
+    @RequiresPermissions("offlinecart:infoList")
+    @ResponseBody
+    public R infoList(@RequestBody List<OfflineCartEntity> offlineCartEntityList) {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        offlineCartService.deleteByUserId(user.getUserId());
+        List<OfflineCartEntity> cartEntityList = new ArrayList<>();
+        for (OfflineCartEntity cartEntity:offlineCartEntityList) {
+            GoodsEntity goods = goodsService.queryObjectByProdBarcodeAndBizType(cartEntity.getProdBarcode());
+            cartEntityList = offlineCartService.offlineGoodsCart(goods);
+        }
+
+        return R.ok().put("list", cartEntityList);
+    }
+    /**
+     * 删除
+     */
+    @RequestMapping("/deleteByUserId")
+    @RequiresPermissions("offlinecart:deleteByUserId")
+    @ResponseBody
+    public R deleteByUserId() {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        offlineCartService.deleteByUserId(user.getUserId());
+        return R.ok();
+    }
+}

+ 63 - 8
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -1,10 +1,7 @@
 package com.kmall.admin.controller;
 
-import com.kmall.admin.entity.OrderEntity;
-import com.kmall.admin.entity.OrderExceptionRecordEntity;
-import com.kmall.admin.entity.OrderRefundEntity;
+import com.kmall.admin.entity.*;
 import com.kmall.admin.service.*;
-import com.kmall.admin.entity.OrderProcessRecordEntity;
 import com.kmall.admin.service.OrderExceptionRecordService;
 import com.kmall.admin.service.OrderProcessRecordService;
 import com.kmall.admin.service.OrderService;
@@ -49,12 +46,14 @@ public class OrderController {
     @RequiresPermissions("order:list")
     public R list(@RequestParam Map<String, Object> params) {
         SysUserEntity user = ShiroUtils.getUserEntity();
-        if(user.getRoleType().equalsIgnoreCase("2")){
-            params.put("storeId", user.getStoreId());
+        if(user != null) {
+            if (user.getRoleType().equalsIgnoreCase("2")) {
+                params.put("storeId", user.getStoreId());
+            }
         }
         //查询列表数据
         Query query = new Query(params);
-
+        query.put("isOnfiilineOrder",Dict.isOnfflineOrder.item_0.getItem());
         List<OrderEntity> orderList = orderService.queryList(query);
         int total = orderService.queryTotal(query);
 
@@ -63,7 +62,6 @@ public class OrderController {
         return R.ok().put("page", pageUtil);
     }
 
-
     /**
      * 信息
      */
@@ -331,4 +329,61 @@ public class OrderController {
 
         return R.ok().put("result", result);
     }
+
+    @RequiresPermissions(value = {"order:orderSubmit"})
+    @RequestMapping(value = "orderSubmit", method = RequestMethod.POST)
+    @ResponseBody
+    public R orderSubmit(@RequestBody List<OfflineCartEntity> offlineCartEntityList) {
+        Map resultObj = null;
+        try {
+            SysUserEntity user = ShiroUtils.getUserEntity();
+            resultObj = orderService.orderSubmit(offlineCartEntityList,user);
+            if (null != resultObj) {
+                return R.error((String)resultObj.get("errmsg"));
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return R.ok("订单提交成功");
+    }
+
+    /**
+     * 确认付款
+     * @param id
+     * @return
+     */
+    @RequestMapping("/confirmPay")
+    @RequiresPermissions("order:confirmPay")
+    public R confirmPay(@RequestBody Long id) {
+        orderService.confirmPay(id);
+
+        return R.ok();
+    }
+
+    @RequestMapping("/offilineOrderList")
+    @RequiresPermissions("order:offilineOrderList")
+    public R offilineOrderList(@RequestParam Map<String, Object> params) {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        if(user != null) {
+            if (user.getRoleType().equalsIgnoreCase("2")) {
+                params.put("storeId", user.getStoreId());
+            }
+        }
+        //查询列表数据
+        Query query = new Query(params);
+        query.put("isOnfiilineOrder",Dict.isOnfflineOrder.item_1.getItem());
+        List<OrderEntity> orderList = orderService.queryOffilineOrderList(query);
+        int total = orderService.queryTotal(query);
+
+        PageUtils pageUtil = new PageUtils(orderList, total, query.getLimit(), query.getPage());
+
+        return R.ok().put("page", pageUtil);
+    }
+
+    @RequestMapping("/offlineInfos/{id}")
+    @RequiresPermissions("order:offlineInfos")
+    public R queryObjectBySysUser(@PathVariable("id") Long id) {
+        OrderEntity order = orderService.queryObjectBySysUser(id);
+        return R.ok().put("order", order);
+    }
 }

+ 4 - 2
kmall-admin/src/main/java/com/kmall/admin/controller/OrderRefundController.java

@@ -36,8 +36,10 @@ public class OrderRefundController {
     @ResponseBody
     public R list(@RequestParam Map<String, Object> params) {
         SysUserEntity user = ShiroUtils.getUserEntity();
-        if(user.getRoleType().equalsIgnoreCase("2")){
-            params.put("storeId", user.getStoreId());
+        if(user != null) {
+            if (user.getRoleType().equalsIgnoreCase("2")) {
+                params.put("storeId", user.getStoreId());
+            }
         }
         //查询列表数据
         Query query = new Query(params);

+ 4 - 2
kmall-admin/src/main/java/com/kmall/admin/controller/ProductStoreRelaController.java

@@ -37,8 +37,10 @@ public class ProductStoreRelaController {
     @ResponseBody
     public R list(@RequestParam Map<String, Object> params) {
         SysUserEntity user = ShiroUtils.getUserEntity();
-        if(user.getRoleType().equalsIgnoreCase("2")){
-            params.put("storeId", user.getStoreId());
+        if(user != null) {
+            if (user.getRoleType().equalsIgnoreCase("2")) {
+                params.put("storeId", user.getStoreId());
+            }
         }
         //查询列表数据
         Query query = new Query(params);

+ 4 - 2
kmall-admin/src/main/java/com/kmall/admin/controller/StoreController.java

@@ -36,8 +36,10 @@ public class StoreController {
     @ResponseBody
     public R list(@RequestParam Map<String, Object> params) {
         SysUserEntity user = ShiroUtils.getUserEntity();
-        if(user.getRoleType().equalsIgnoreCase("2")){
-            params.put("id", user.getStoreId());
+        if(user != null) {
+            if (user.getRoleType().equalsIgnoreCase("2")) {
+                params.put("id", user.getStoreId());
+            }
         }
         //查询列表数据
         Query query = new Query(params);

+ 2 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/GoodsDao.java

@@ -18,5 +18,7 @@ public interface GoodsDao extends BaseDao<GoodsEntity> {
 
     GoodsEntity queryObjectBySn(String goodsSn);
 
+    GoodsEntity queryObjectByProdBarcodeAndBizType(String goodsSn);
+
     List<GoodsEntity> querySame(Map<String, Object> map);
 }

+ 25 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OfflineCartDao.java

@@ -0,0 +1,25 @@
+package com.kmall.admin.dao;
+
+import com.kmall.admin.entity.OfflineCartEntity;
+import com.kmall.common.dao.BaseDao;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Dao
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-11-29 15:14:59
+ */
+public interface OfflineCartDao extends BaseDao<OfflineCartEntity> {
+
+    OfflineCartEntity queryObjectByGoodsIdAndType(@Param("goodsId") Integer goodsId, @Param("userId")Long userId);
+
+    List<OfflineCartEntity> queryOfflineCartByBizType(Map<String, Object> map);
+
+    int deleteByUserId(@Param("userId")long userId);
+
+}

+ 6 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java

@@ -4,6 +4,9 @@ import com.kmall.admin.entity.OrderEntity;
 import org.apache.ibatis.annotations.Param;
 import com.kmall.common.dao.BaseDao;
 
+import java.util.List;
+import java.util.Map;
+
 /**
  * @author Scott
  * @email
@@ -19,6 +22,7 @@ public interface OrderDao extends BaseDao<OrderEntity> {
      */
     OrderEntity queryObjectByActivityId(@Param("activityId") Long activityId, @Param("orderType") Integer orderType);
 
+    OrderEntity queryObjectBySysUser(Long id);
     /**
      * 已付款订单会员数
      *
@@ -62,4 +66,6 @@ public interface OrderDao extends BaseDao<OrderEntity> {
     int getPayedOrderCount();
 
     Double getTotalActualPrice(@Param("merchOrderSn")String merchOrderSn);
+
+    List<OrderEntity> queryOffilineOrderList(Map<String, Object> map);
 }

+ 6 - 0
kmall-admin/src/main/java/com/kmall/admin/dao/ProductStoreRelaDao.java

@@ -20,7 +20,13 @@ public interface ProductStoreRelaDao extends BaseDao<ProductStoreRelaEntity> {
 
     ProductStoreRelaEntity queryByStoreIdProductId(@Param("storeId") Long storeId, @Param("productId") Long productId);
 
+    ProductStoreRelaEntity queryByGoodsIdAndStoreId(@Param("storeId") Long storeId, @Param("goodsId") Long goodsId);
+
     List<ProductStoreRelaEntity> queryByGoodsId(Long id);
 
     List<ProductStoreRelaEntity> querySameList(Map<String, Object> map);
+
+    void updateStockNum(ProductStoreRelaEntity productStoreRelaEntity);
+
+    void updateSellVolumeNum(ProductStoreRelaEntity productStoreRelaEntity);
 }

+ 108 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/CartEntity.java

@@ -2,6 +2,7 @@ package com.kmall.admin.entity;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 
 /**
@@ -43,6 +44,25 @@ public class CartEntity implements Serializable {
 
     private String userName;
 
+
+    private String sku;
+
+    private String goodsBizType;
+
+    private String createrSn;
+
+    private Date createTime;
+
+    private String moderSn;
+
+    private Date modTime;
+
+    private Date tstm;
+
+    private Integer stockNum;
+
+    private String storeName;
+
     /**
      * 设置:主键
      */
@@ -234,4 +254,92 @@ public class CartEntity implements Serializable {
     public void setUserName(String userName) {
         this.userName = userName;
     }
+
+    public String getGoodsSpecificationNameValue() {
+        return goodsSpecificationNameValue;
+    }
+
+    public void setGoodsSpecificationNameValue(String goodsSpecificationNameValue) {
+        this.goodsSpecificationNameValue = goodsSpecificationNameValue;
+    }
+
+    public String getGoodsSpecificationIds() {
+        return goodsSpecificationIds;
+    }
+
+    public void setGoodsSpecificationIds(String goodsSpecificationIds) {
+        this.goodsSpecificationIds = goodsSpecificationIds;
+    }
+
+    public String getSku() {
+        return sku;
+    }
+
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    public String getGoodsBizType() {
+        return goodsBizType;
+    }
+
+    public void setGoodsBizType(String goodsBizType) {
+        this.goodsBizType = goodsBizType;
+    }
+
+    public String getCreaterSn() {
+        return createrSn;
+    }
+
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getModerSn() {
+        return moderSn;
+    }
+
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    public Date getModTime() {
+        return modTime;
+    }
+
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    public Date getTstm() {
+        return tstm;
+    }
+
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    public Integer getStockNum() {
+        return stockNum;
+    }
+
+    public void setStockNum(Integer stockNum) {
+        this.stockNum = stockNum;
+    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
 }

+ 40 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java

@@ -132,6 +132,46 @@ public class GoodsEntity implements Serializable {
     //视频地址
     private String videoUrl;
 
+    private String stockNum;
+
+    private String storeName;
+
+    private String productId;
+
+    private Integer storeId;
+
+    public Integer getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getProductId() {
+        return productId;
+    }
+
+    public void setProductId(String productId) {
+        this.productId = productId;
+    }
+
+    public String getStockNum() {
+        return stockNum;
+    }
+
+    public void setStockNum(String stockNum) {
+        this.stockNum = stockNum;
+    }
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+
     public Integer getSupplierId() {
         return supplierId;
     }

+ 348 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OfflineCartEntity.java

@@ -0,0 +1,348 @@
+package com.kmall.admin.entity;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 实体
+ * 表名 offline_cart
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-11-29 15:14:59
+ */
+public class OfflineCartEntity implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private Integer id;
+    /**
+     * 会员Id
+     */
+    private Integer userId;
+    /**
+     * 商品Id
+     */
+    private Integer goodsId;
+    /**
+     * sku
+     */
+    private String sku;
+    /**
+     * 商品序列号
+     */
+    private String goodsSn;
+    /**
+     * 产品条码
+     */
+    private String prodBarcode;
+    /**
+     * 产品Id
+     */
+    private Integer productId;
+    /**
+     * 产品名称
+     */
+    private String goodsName;
+    /**
+     * 市场价
+     */
+    private BigDecimal marketPrice;
+    /**
+     * 零售价格
+     */
+    private BigDecimal retailPrice;
+    /**
+     * 数量
+     */
+    private Integer number;
+    /**
+     * 商品库存数量
+     */
+    private Integer stockNum;
+    /**
+     * 商品图片
+     */
+    private String listPicUrl;
+    /**
+     * 门店Id
+     */
+    private Integer storeId;
+    /**
+     * 创建人编号
+     */
+    private String createrSn;
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+    /**
+     * 修改人编号
+     */
+    private String moderSn;
+    /**
+     * 修改时间
+     */
+    private Date modTime;
+    /**
+     * 时间戳
+     */
+    private Date tstm;
+
+    private String storeName;
+
+    public String getStoreName() {
+        return storeName;
+    }
+
+    public void setStoreName(String storeName) {
+        this.storeName = storeName;
+    }
+
+    /**
+     * 设置:主键
+     */
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    /**
+     * 获取:主键
+     */
+    public Integer getId() {
+        return id;
+    }
+    /**
+     * 设置:会员Id
+     */
+    public void setUserId(Integer userId) {
+        this.userId = userId;
+    }
+
+    /**
+     * 获取:会员Id
+     */
+    public Integer getUserId() {
+        return userId;
+    }
+    /**
+     * 设置:商品Id
+     */
+    public void setGoodsId(Integer goodsId) {
+        this.goodsId = goodsId;
+    }
+
+    /**
+     * 获取:商品Id
+     */
+    public Integer getGoodsId() {
+        return goodsId;
+    }
+    /**
+     * 设置:sku
+     */
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    /**
+     * 获取:sku
+     */
+    public String getSku() {
+        return sku;
+    }
+    /**
+     * 设置:商品序列号
+     */
+    public void setGoodsSn(String goodsSn) {
+        this.goodsSn = goodsSn;
+    }
+
+    /**
+     * 获取:商品序列号
+     */
+    public String getGoodsSn() {
+        return goodsSn;
+    }
+
+    public String getProdBarcode() {
+        return prodBarcode;
+    }
+
+    public void setProdBarcode(String prodBarcode) {
+        this.prodBarcode = prodBarcode;
+    }
+
+    /**
+     * 设置:产品Id
+     */
+    public void setProductId(Integer productId) {
+        this.productId = productId;
+    }
+
+    /**
+     * 获取:产品Id
+     */
+    public Integer getProductId() {
+        return productId;
+    }
+    /**
+     * 设置:产品名称
+     */
+    public void setGoodsName(String goodsName) {
+        this.goodsName = goodsName;
+    }
+
+    /**
+     * 获取:产品名称
+     */
+    public String getGoodsName() {
+        return goodsName;
+    }
+    /**
+     * 设置:市场价
+     */
+    public void setMarketPrice(BigDecimal marketPrice) {
+        this.marketPrice = marketPrice;
+    }
+
+    /**
+     * 获取:市场价
+     */
+    public BigDecimal getMarketPrice() {
+        return marketPrice;
+    }
+    /**
+     * 设置:零售价格
+     */
+    public void setRetailPrice(BigDecimal retailPrice) {
+        this.retailPrice = retailPrice;
+    }
+
+    /**
+     * 获取:零售价格
+     */
+    public BigDecimal getRetailPrice() {
+        return retailPrice;
+    }
+    /**
+     * 设置:数量
+     */
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
+    /**
+     * 获取:数量
+     */
+    public Integer getNumber() {
+        return number;
+    }
+    /**
+     * 设置:商品库存数量
+     */
+    public void setStockNum(Integer stockNum) {
+        this.stockNum = stockNum;
+    }
+
+    /**
+     * 获取:商品库存数量
+     */
+    public Integer getStockNum() {
+        return stockNum;
+    }
+    /**
+     * 设置:商品图片
+     */
+    public void setListPicUrl(String listPicUrl) {
+        this.listPicUrl = listPicUrl;
+    }
+
+    /**
+     * 获取:商品图片
+     */
+    public String getListPicUrl() {
+        return listPicUrl;
+    }
+    /**
+     * 设置:门店Id
+     */
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
+    }
+
+    /**
+     * 获取:门店Id
+     */
+    public Integer getStoreId() {
+        return storeId;
+    }
+    /**
+     * 设置:创建人编号
+     */
+    public void setCreaterSn(String createrSn) {
+        this.createrSn = createrSn;
+    }
+
+    /**
+     * 获取:创建人编号
+     */
+    public String getCreaterSn() {
+        return createrSn;
+    }
+    /**
+     * 设置:创建时间
+     */
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    /**
+     * 获取:创建时间
+     */
+    public Date getCreateTime() {
+        return createTime;
+    }
+    /**
+     * 设置:修改人编号
+     */
+    public void setModerSn(String moderSn) {
+        this.moderSn = moderSn;
+    }
+
+    /**
+     * 获取:修改人编号
+     */
+    public String getModerSn() {
+        return moderSn;
+    }
+    /**
+     * 设置:修改时间
+     */
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
+    /**
+     * 获取:修改时间
+     */
+    public Date getModTime() {
+        return modTime;
+    }
+    /**
+     * 设置:时间戳
+     */
+    public void setTstm(Date tstm) {
+        this.tstm = tstm;
+    }
+
+    /**
+     * 获取:时间戳
+     */
+    public Date getTstm() {
+        return tstm;
+    }
+}

+ 50 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderEntity.java

@@ -119,6 +119,56 @@ public class OrderEntity implements Serializable {
 
     private String buyerPayCheck;
 
+    private String merchSn;
+
+    private String sku;
+
+    private Date createTime;
+
+    private Date modTime;
+
+    private String isOnfflineOrder;
+
+    public String getIsOnfflineOrder() {
+        return isOnfflineOrder;
+    }
+
+    public void setIsOnfflineOrder(String isOnfflineOrder) {
+        this.isOnfflineOrder = isOnfflineOrder;
+    }
+
+    public String getMerchSn() {
+        return merchSn;
+    }
+
+    public void setMerchSn(String merchSn) {
+        this.merchSn = merchSn;
+    }
+
+    public String getSku() {
+        return sku;
+    }
+
+    public void setSku(String sku) {
+        this.sku = sku;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public Date getModTime() {
+        return modTime;
+    }
+
+    public void setModTime(Date modTime) {
+        this.modTime = modTime;
+    }
+
     public String getBuyerPayCheck() {
         return buyerPayCheck;
     }

+ 98 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/OrderGoodsEntity.java

@@ -2,6 +2,7 @@ package com.kmall.admin.entity;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.Date;
 
 
 /**
@@ -41,6 +42,103 @@ public class OrderGoodsEntity implements Serializable {
 	//图片链接
 	private String listPicUrl;
 
+
+	private String sku;
+
+	private String orderBizType;
+
+	private String createrSn;
+
+	private Date createTime;
+
+	private String moderSn;
+
+	private Date modTime;
+
+	private Date tstm;
+
+	private BigDecimal goodsRate;
+
+	public String getGoodsSpecificationNameValue() {
+		return goodsSpecificationNameValue;
+	}
+
+	public void setGoodsSpecificationNameValue(String goodsSpecificationNameValue) {
+		this.goodsSpecificationNameValue = goodsSpecificationNameValue;
+	}
+
+	public String getGoodsSpecificationIds() {
+		return goodsSpecificationIds;
+	}
+
+	public void setGoodsSpecificationIds(String goodsSpecificationIds) {
+		this.goodsSpecificationIds = goodsSpecificationIds;
+	}
+
+	public String getSku() {
+		return sku;
+	}
+
+	public void setSku(String sku) {
+		this.sku = sku;
+	}
+
+	public String getOrderBizType() {
+		return orderBizType;
+	}
+
+	public void setOrderBizType(String orderBizType) {
+		this.orderBizType = orderBizType;
+	}
+
+	public String getCreaterSn() {
+		return createrSn;
+	}
+
+	public void setCreaterSn(String createrSn) {
+		this.createrSn = createrSn;
+	}
+
+	public Date getCreateTime() {
+		return createTime;
+	}
+
+	public void setCreateTime(Date createTime) {
+		this.createTime = createTime;
+	}
+
+	public String getModerSn() {
+		return moderSn;
+	}
+
+	public void setModerSn(String moderSn) {
+		this.moderSn = moderSn;
+	}
+
+	public Date getModTime() {
+		return modTime;
+	}
+
+	public void setModTime(Date modTime) {
+		this.modTime = modTime;
+	}
+
+	public Date getTstm() {
+		return tstm;
+	}
+
+	public void setTstm(Date tstm) {
+		this.tstm = tstm;
+	}
+
+	public BigDecimal getGoodsRate() {
+		return goodsRate;
+	}
+
+	public void setGoodsRate(BigDecimal goodsRate) {
+		this.goodsRate = goodsRate;
+	}
+
 	/**
 	 * 设置:主键
 	 */

+ 29 - 3
kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java

@@ -52,7 +52,7 @@ public class ProductStoreRelaEntity implements Serializable {
     /**
      * 销售量
      */
-    private BigDecimal sellVolume = Constant.ZERO;
+    private Integer sellVolume = 0;
 
     // 翻译
     private String storeName;
@@ -79,6 +79,16 @@ public class ProductStoreRelaEntity implements Serializable {
     // 规格
     private String specification;
 
+    private String listPicUrl;
+
+    public String getListPicUrl() {
+        return listPicUrl;
+    }
+
+    public void setListPicUrl(String listPicUrl) {
+        this.listPicUrl = listPicUrl;
+    }
+
     public String getSku() {
         return sku;
     }
@@ -269,11 +279,11 @@ public class ProductStoreRelaEntity implements Serializable {
         this.stockPrice = stockPrice;
     }
 
-    public BigDecimal getSellVolume() {
+    public Integer getSellVolume() {
         return sellVolume;
     }
 
-    public void setSellVolume(BigDecimal sellVolume) {
+    public void setSellVolume(Integer sellVolume) {
         this.sellVolume = sellVolume;
     }
 
@@ -284,4 +294,20 @@ public class ProductStoreRelaEntity implements Serializable {
     public void setSpecification(String specification) {
         this.specification = specification;
     }
+
+    public void addSellVolume() {
+        if (null == sellVolume) {
+            sellVolume = 1;
+        } else {
+            sellVolume++;
+        }
+    }
+
+    public void minusSellVolume() {
+        if (null == sellVolume || 0 == sellVolume) {
+            sellVolume = 0;
+        } else {
+            sellVolume--;
+        }
+    }
 }

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

@@ -1,6 +1,7 @@
 package com.kmall.admin.service;
 
 import com.kmall.admin.entity.CartEntity;
+import com.kmall.admin.entity.GoodsEntity;
 
 import java.util.List;
 import java.util.Map;

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

@@ -24,6 +24,7 @@ public interface GoodsService {
      */
     GoodsEntity queryObject(Integer id);
 
+    GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode);
     /**
      * 分页查询
      *

+ 77 - 0
kmall-admin/src/main/java/com/kmall/admin/service/OfflineCartService.java

@@ -0,0 +1,77 @@
+package com.kmall.admin.service;
+
+import com.kmall.admin.entity.GoodsEntity;
+import com.kmall.admin.entity.OfflineCartEntity;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service接口
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-11-29 15:14:59
+ */
+public interface OfflineCartService {
+
+    /**
+     * 根据主键查询实体
+     *
+     * @param id 主键
+     * @return 实体
+     */
+    OfflineCartEntity queryObject(Integer id);
+
+    /**
+     * 分页查询
+     *
+     * @param map 参数
+     * @return list
+     */
+    List<OfflineCartEntity> queryList(Map<String, Object> map);
+
+    /**
+     * 分页统计总数
+     *
+     * @param map 参数
+     * @return 总数
+     */
+    int queryTotal(Map<String, Object> map);
+
+    /**
+     * 保存实体
+     *
+     * @param offlineCart 实体
+     * @return 保存条数
+     */
+    int save(OfflineCartEntity offlineCart);
+
+    /**
+     * 根据主键更新实体
+     *
+     * @param offlineCart 实体
+     * @return 更新条数
+     */
+    int update(OfflineCartEntity offlineCart);
+
+    /**
+     * 根据主键删除
+     *
+     * @param id
+     * @return 删除条数
+     */
+    int delete(Integer id);
+
+    int deleteByUserId(long userId);
+
+    /**
+     * 根据主键批量删除
+     *
+     * @param ids
+     * @return 删除条数
+     */
+    int deleteBatch(Integer[] ids);
+
+    List<OfflineCartEntity> offlineGoodsCart(GoodsEntity goods);
+}

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/service/OrderService.java

@@ -1,7 +1,9 @@
 package com.kmall.admin.service;
 
+import com.kmall.admin.entity.OfflineCartEntity;
 import com.kmall.admin.entity.OrderEntity;
 import com.kmall.admin.entity.OrderRefundEntity;
+import com.kmall.common.entity.SysUserEntity;
 import com.kmall.common.utils.print.ticket.item.Ticket;
 import com.kmall.common.utils.wechat.WechatRefundApiResult;
 
@@ -18,10 +20,14 @@ public interface OrderService {
 
     OrderEntity queryObject(Long id);
 
+    OrderEntity queryObjectBySysUser(Long id);
+
     List<OrderEntity> queryList(Map<String, Object> map);
 
     int queryTotal(Map<String, Object> map);
 
+    List<OrderEntity> queryOffilineOrderList(Map<String, Object> map);
+
     int save(OrderEntity order);
 
     int update(OrderEntity order);
@@ -76,4 +82,8 @@ public interface OrderService {
     OrderEntity queryInfos(Long id);
 
     Double getTotalActualPrice(String merchOrderSn);
+
+    Map orderSubmit(List<OfflineCartEntity> offlineCartEntityList,SysUserEntity user);
+
+    int confirmPay(Long id);
 }

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

@@ -62,6 +62,13 @@ public class GoodsServiceImpl implements GoodsService {
     }
 
     @Override
+    public GoodsEntity queryObjectByProdBarcodeAndBizType(String prodBarcode){
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("prodBarcode", prodBarcode);
+        GoodsEntity entity = goodsDao.queryObjectByProdBarcodeAndBizType(prodBarcode);
+        return entity;
+    }
+    @Override
     public List<GoodsEntity> queryList(Map<String, Object> map) {
         return goodsDao.queryList(map);
     }

+ 103 - 0
kmall-admin/src/main/java/com/kmall/admin/service/impl/OfflineCartServiceImpl.java

@@ -0,0 +1,103 @@
+package com.kmall.admin.service.impl;
+
+import com.kmall.admin.dao.OfflineCartDao;
+import com.kmall.admin.entity.CartEntity;
+import com.kmall.admin.entity.GoodsEntity;
+import com.kmall.admin.entity.OfflineCartEntity;
+import com.kmall.admin.service.OfflineCartService;
+import com.kmall.api.contants.Dict;
+import com.kmall.common.entity.SysUserEntity;
+import com.kmall.common.utils.ShiroUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Service实现类
+ *
+ * @author emato
+ * @email admin@qhdswl.com
+ * @date 2018-11-29 15:14:59
+ */
+@Service("offlineCartService")
+public class OfflineCartServiceImpl implements OfflineCartService {
+    @Autowired
+    private OfflineCartDao offlineCartDao;
+
+    @Override
+    public OfflineCartEntity queryObject(Integer id) {
+        return offlineCartDao.queryObject(id);
+    }
+
+    @Override
+    public List<OfflineCartEntity> queryList(Map<String, Object> map) {
+        return offlineCartDao.queryList(map);
+    }
+
+    @Override
+    public int queryTotal(Map<String, Object> map) {
+        return offlineCartDao.queryTotal(map);
+    }
+
+    @Override
+    public int save(OfflineCartEntity offlineCart) {
+        return offlineCartDao.save(offlineCart);
+    }
+
+    @Override
+    public int update(OfflineCartEntity offlineCart) {
+        return offlineCartDao.update(offlineCart);
+    }
+
+    @Override
+    public int delete(Integer id) {
+        return offlineCartDao.delete(id);
+    }
+
+    @Override
+    public int deleteByUserId(long userId){
+        return offlineCartDao.deleteByUserId(userId);
+    }
+    @Override
+    public int deleteBatch(Integer[]ids) {
+        return offlineCartDao.deleteBatch(ids);
+    }
+
+
+    @Override
+    public List<OfflineCartEntity> offlineGoodsCart(GoodsEntity goods){
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        OfflineCartEntity cart = offlineCartDao.queryObjectByGoodsIdAndType(Integer.parseInt(goods.getId().toString()),user.getUserId());
+        OfflineCartEntity cartEntity = new OfflineCartEntity();
+        cartEntity.setGoodsId(Integer.parseInt(goods.getId().toString()));
+        cartEntity.setModTime(new Date());
+        if(cart != null){
+            cartEntity.setId(cart.getId());
+            cartEntity.setNumber(cart.getNumber()+1);
+            update(cartEntity);
+        }else{
+            cartEntity.setUserId(Integer.parseInt(user.getUserId().toString()));
+            cartEntity.setGoodsName(goods.getName());
+            cartEntity.setGoodsSn(goods.getGoodsSn());
+            cartEntity.setProdBarcode(goods.getProdBarcode());
+            cartEntity.setSku(goods.getSku());
+            cartEntity.setProductId(Integer.parseInt(goods.getProductId()));
+            cartEntity.setMarketPrice(goods.getMarketPrice());
+            cartEntity.setRetailPrice(goods.getRetailPrice());
+            cartEntity.setNumber(1);
+            cartEntity.setStockNum(Integer.parseInt(goods.getStockNum()));
+            cartEntity.setListPicUrl(goods.getListPicUrl());
+            cartEntity.setStoreId(goods.getStoreId());
+            cartEntity.setCreateTime(new Date());
+            save(cartEntity);
+        }
+        Map map= new HashMap();
+        map.put("userId",user.getUserId());
+        map.put("storeId",goods.getStoreId());
+        return offlineCartDao.queryOfflineCartByBizType(map);
+    }
+}

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

@@ -1,17 +1,24 @@
 package com.kmall.admin.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.kmall.admin.dao.*;
 import com.kmall.admin.entity.*;
+import com.kmall.admin.entity.OrderProcessRecordEntity;
 import com.kmall.admin.service.OrderService;
 import com.kmall.api.contants.Dict;
+import com.kmall.api.dto.IdCardMsgVo;
+import com.kmall.api.entity.*;
 import com.kmall.api.service.merch.OmsMerchPropertiesBuilder;
+import com.kmall.api.util.CommonUtil;
+import com.kmall.api.util.IdCardUtil;
+import com.kmall.common.entity.SysUserEntity;
 import com.kmall.common.service.print.ticket.PrintTicketPropertiesBuilder;
 import com.kmall.common.utils.Constant;
+import com.kmall.common.utils.ShiroUtils;
 import com.kmall.common.utils.print.ticket.TicketPrintUtil;
 import com.kmall.common.utils.print.ticket.item.*;
 import com.kmall.common.utils.RRException;
-import com.kmall.common.utils.ShiroUtils;
 import com.kmall.common.utils.StringUtils;
 import com.kmall.common.utils.express.kdn.KdniaoUtil;
 import com.kmall.common.utils.wechat.WechatRefundApiResult;
@@ -46,11 +53,16 @@ public class OrderServiceImpl implements OrderService {
     private OrderRefundDao orderRefundDao;
     @Autowired
     private StoreDao storeDao;
+    @Autowired
+    private OfflineCartDao offlineCartDao;
+    @Autowired
+    private GoodsDao goodsDao;
 
     @Override
     public OrderEntity queryObject(Long id) {
         return orderDao.queryObject(id);
     }
+
     @Override
     public Double getTotalActualPrice(String merchOrderSn) {
         return orderDao.getTotalActualPrice(merchOrderSn);
@@ -104,13 +116,13 @@ public class OrderServiceImpl implements OrderService {
         for (OrderGoodsEntity orderGoodsEntity : orderGoodsVoList) {
             ProductStoreRelaEntity storeRelaEntity = productStoreRelaDao.queryByStoreIdProductId(Long.valueOf(order.getStoreId()), Long.valueOf(orderGoodsEntity.getProductId()));
             if (null == storeRelaEntity || null == storeRelaEntity.getSellVolume()) {
-                storeRelaEntity.setSellVolume(Constant.ZERO);
+                storeRelaEntity.setSellVolume(0);
             }
-            BigDecimal sellVolume = storeRelaEntity.getSellVolume().subtract(new BigDecimal(orderGoodsEntity.getNumber()));//销售量
+            BigDecimal sellVolume = new BigDecimal(storeRelaEntity.getSellVolume()-orderGoodsEntity.getNumber());//销售量
             if (sellVolume.compareTo(Constant.ZERO) < 0) {
                 sellVolume = Constant.ZERO;
             }
-            storeRelaEntity.setSellVolume(sellVolume);
+            storeRelaEntity.setSellVolume(Integer.parseInt(sellVolume.toString()));
             if (null == storeRelaEntity.getStockNum()) {
                 storeRelaEntity.setStockNum(0);
             }
@@ -231,10 +243,12 @@ public class OrderServiceImpl implements OrderService {
         // 海关清单
         CusListing cusListing = new CusListing();
         cusListing.setOrderId(orderEntity.getOrderSn());
-        cusListing.setWaybillId(orderProcessRecordEntity.getLogisticsNo());
-        cusListing.setInvtNo(orderProcessRecordEntity.getInvtNo());
-        cusListing.setConsignee(orderEntity.getConsignee());
-        cusListing.setConsigneeTel(orderEntity.getMobile());
+        if(!orderEntity.getOrderBizType().equalsIgnoreCase(Dict.orderBizType.item_11.getItem())){
+            cusListing.setWaybillId(orderProcessRecordEntity.getLogisticsNo());
+            cusListing.setInvtNo(orderProcessRecordEntity.getInvtNo());
+            cusListing.setConsignee(orderEntity.getConsignee());
+            cusListing.setConsigneeTel(orderEntity.getMobile());
+        }
         cusListing.setOriginAddress(PrintTicketPropertiesBuilder.instance().getAddress());
         cusListing.setDeliveryAddress(storeEntity.getStoreAddress());
 
@@ -289,13 +303,13 @@ public class OrderServiceImpl implements OrderService {
         for (OrderGoodsEntity orderGoodsEntity : orderGoodsVoList) {
             ProductStoreRelaEntity storeRelaEntity = productStoreRelaDao.queryByStoreIdProductId(Long.valueOf(order.getStoreId()), Long.valueOf(orderGoodsEntity.getProductId()));
             if (null == storeRelaEntity || null == storeRelaEntity.getSellVolume()) {
-                storeRelaEntity.setSellVolume(Constant.ZERO);
+                storeRelaEntity.setSellVolume(0);
             }
-            BigDecimal sellVolume = storeRelaEntity.getSellVolume().subtract(new BigDecimal(orderGoodsEntity.getNumber()));//销售量
+            BigDecimal sellVolume = new BigDecimal(storeRelaEntity.getSellVolume()-orderGoodsEntity.getNumber());//销售量
             if (sellVolume.compareTo(Constant.ZERO) < 0) {
                 sellVolume = Constant.ZERO;
             }
-            storeRelaEntity.setSellVolume(sellVolume);
+            storeRelaEntity.setSellVolume(Integer.parseInt(sellVolume.toString()));
             if (null == storeRelaEntity.getStockNum()) {
                 storeRelaEntity.setStockNum(0);
             }
@@ -469,4 +483,219 @@ public class OrderServiceImpl implements OrderService {
         orderEntity.setOrderGoodsEntityList(orderGoodsEntityList);
         return orderEntity;
     }
+
+    @Transactional
+    @Override
+    public Map orderSubmit(List<OfflineCartEntity> offlineCartList,SysUserEntity user){
+        Map resultObj = new HashMap();
+        try{
+            if(user == null) {
+                resultObj.put("errno", 400);
+                resultObj.put("errmsg", "用户登录超时,请重新登录");
+                return resultObj;
+            }
+            if (!user.getRoleType().equalsIgnoreCase("2")) {
+                resultObj.put("errno", 400);
+                resultObj.put("errmsg", "该操作只允许店员账户操作");
+                return resultObj;
+            }
+            Long userId = user.getUserId();
+            Integer storeId = user.getStoreId();
+            //获取要购买的商品
+            Map param = new HashMap();
+            param.put("userId", userId);
+            param.put("storeId", storeId);
+            if (null == offlineCartList && offlineCartList.size() == 0) {
+                resultObj.put("errno", 400);
+                resultObj.put("errmsg", "购买商品数据为空");
+                return resultObj;
+            }
+            List<OfflineCartEntity> offlineCartEntityList = offlineCartDao.queryOfflineCartByBizType(param);
+            if (null == offlineCartEntityList && offlineCartEntityList.size() == 0 && offlineCartList.size()>0) {
+                resultObj.put("errno", 400);
+                resultObj.put("errmsg", "已下单成功,请重新扫描商品进行购买");
+                return resultObj;
+            }
+            // 检查库存和更新库存
+            for (OfflineCartEntity cartEntity : offlineCartEntityList) {
+                if(goodsDao.queryObject(cartEntity.getGoodsId()) == null){
+                    resultObj.put("errno", 400);
+                    resultObj.put("errmsg", "订单提交失败:商品不存在");
+                    return resultObj;
+                }
+                //取得规格的信息,判断规格库存
+                ProductStoreRelaEntity productInfo = productStoreRelaDao.queryByGoodsIdAndStoreId(Long.valueOf(storeId),Long.valueOf(cartEntity.getGoodsId()));
+                synchronized (productInfo){
+                    if (null == productInfo || null == productInfo.getStockNum() || productInfo.getStockNum() < cartEntity.getNumber()) {
+                        resultObj.put("errno", 400);
+                        resultObj.put("errmsg", "库存不足,仅剩余" + productInfo.getStockNum());
+                        return resultObj;
+                    }else{
+                        productInfo.setStockNum(productInfo.getStockNum() - cartEntity.getNumber());
+                        productInfo.setStoreId(Long.valueOf(storeId));
+                        productInfo.addSellVolume();
+                        productStoreRelaDao.updateStockNum(productInfo);
+                    }
+                }
+            }
+            String merchOrderSn = "EMATO"+CommonUtil.generateOrderNumber();
+            OrderEntity order = setOrderVo(user,offlineCartEntityList);
+            order.setStoreId(storeId);
+            order.setMerchOrderSn(merchOrderSn);
+
+            //开启事务,插入订单信息和订单商品
+            if(order != null) {
+                orderDao.save(order);
+                if (null == order.getId()) {
+                    resultObj.put("errno", 400);
+                    resultObj.put("errmsg", "订单提交失败");
+                    return resultObj;
+                }
+                for (OfflineCartEntity cartEntity : offlineCartEntityList) {
+                    OrderGoodsEntity orderGoodsEntity = setOrderGoodsVo(order, cartEntity);
+                    //新增订单详情
+                    orderGoodsDao.save(orderGoodsEntity);
+                }
+                //清空预订单商品临时表
+                offlineCartDao.deleteByUserId(userId);
+                resultObj.put("errno", 0);
+                resultObj.put("errmsg", "订单提交成功");
+                Map orderInfoMap = new HashMap();
+                orderInfoMap.put("orderInfo", order);
+                resultObj.put("data", orderInfoMap);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+            resultObj.put("errno", 400);
+            resultObj.put("errmsg", "订单异常");
+            return resultObj;
+        }
+        return resultObj;
+    }
+
+    /**
+     * 设置订单数据
+     * @param loginUser
+     * @return
+     */
+    public OrderEntity setOrderVo(SysUserEntity loginUser,List<OfflineCartEntity> offlineCartEntityList){
+        OrderEntity orderInfo = new OrderEntity();
+        BigDecimal freightPrice = new BigDecimal(0.00);
+        BigDecimal goodsTotalPrice = new BigDecimal(0.00);
+        for (OfflineCartEntity offlineCartEntity : offlineCartEntityList) {
+            goodsTotalPrice = goodsTotalPrice.add(offlineCartEntity.getRetailPrice().multiply(new BigDecimal(offlineCartEntity.getNumber())));
+        }
+        //订单价格计算:订单的总价+运费
+        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice);
+        //查询未使用的优惠券
+        /*String couponName = "";
+        BigDecimal fullCutCouponDec = Constant.ZERO;
+        UserCouponVo couponVo = null;*/
+        BigDecimal couponPrice = new BigDecimal(0.00);
+        //减去其它支付的金额后,要实际支付的金额   订单的总价+运费-优惠券金额
+        BigDecimal actualPrice = orderTotalPrice.subtract(couponPrice);
+
+        //商户(拼音首字母)+业务类型+编号
+        String merchSn = OmsMerchPropertiesBuilder.instance().getMerchSn();
+        String merchShortName = OmsMerchPropertiesBuilder.instance().getMerchShortName();
+        String orderSn = merchShortName + Dict.orderBizType.item_11.getItem() + CommonUtil.generateOrderNumber();
+        orderInfo.setOrderSn(orderSn);
+        orderInfo.setMerchSn(merchSn);
+        orderInfo.setUserId(Integer.parseInt(loginUser.getUserId()+""));
+        orderInfo.setFreightPrice(freightPrice.intValue());
+        orderInfo.setOrderBizType(Dict.orderBizType.item_11.getItem());
+
+        /*orderInfo.setCoupon_id(userCouponId);
+        orderInfo.setCoupon_name(couponName);*/
+//        orderInfo.setFullCutPrice(fullCutCouponDec);//使用的优惠券
+        orderInfo.setCouponPrice(couponPrice);
+        orderInfo.setPostscript("");//留言
+        orderInfo.setAddTime(new Date());
+        orderInfo.setGoodsPrice(goodsTotalPrice);
+        orderInfo.setOrderPrice(orderTotalPrice);
+        orderInfo.setActualPrice(actualPrice);
+        orderInfo.setOrderType("1");
+        orderInfo.setOrderStatus(0);// 待付款
+        orderInfo.setShippingStatus(0);
+        orderInfo.setPayStatus(0);
+        orderInfo.setShippingId(0L);
+        orderInfo.setShippingFee(Constant.ZERO);
+        orderInfo.setIntegral(0);
+        orderInfo.setIntegralMoney(Constant.ZERO);
+        orderInfo.setCreateTime(new Date());
+        orderInfo.setModTime(new Date());
+        orderInfo.setIsOnfflineOrder(Dict.isOnfflineOrder.item_1.getItem());
+        /*//标记该订单已使用优惠券
+        if(couponVo != null){
+            couponVo.setUsed_time(new Date());
+            couponVo.setIsUsed(Dict.isUsed.item_1.getItem());
+            apiUserCouponMapper.update(couponVo);
+        }*/
+        return orderInfo;
+    }
+
+
+    public OrderGoodsEntity setOrderGoodsVo(OrderEntity orderInfo,OfflineCartEntity goodsItem){
+        GoodsEntity goodsVo = goodsDao.queryObject(goodsItem.getGoodsId());
+        OrderGoodsEntity orderGoodsVo = new OrderGoodsEntity();
+        orderGoodsVo.setOrderId(Integer.parseInt(orderInfo.getId()+""));
+        orderGoodsVo.setGoodsId(goodsItem.getGoodsId());
+        orderGoodsVo.setGoodsSn(goodsItem.getGoodsSn());
+        orderGoodsVo.setProductId(goodsItem.getProductId());
+        orderGoodsVo.setGoodsName(goodsItem.getGoodsName());
+        orderGoodsVo.setListPicUrl(goodsItem.getListPicUrl());
+        orderGoodsVo.setMarketPrice(goodsItem.getMarketPrice());
+        orderGoodsVo.setRetailPrice(goodsItem.getRetailPrice());
+        orderGoodsVo.setNumber(goodsItem.getNumber());
+        orderGoodsVo.setOrderBizType(Dict.orderBizType.item_11.getItem());
+        orderGoodsVo.setCreateTime(new Date());
+        orderGoodsVo.setModTime(new Date());
+        orderGoodsVo.setGoodsRate(goodsVo.getGoodsRate());
+        orderGoodsVo.setSku(goodsVo.getSku());
+        return orderGoodsVo;
+    }
+
+    @Override
+    public OrderEntity queryObjectBySysUser(Long id){
+        OrderEntity orderEntity = orderDao.queryObjectBySysUser(id);
+
+        Map<String, Object> map = new HashMap<String, Object>();
+        map.put("orderId", id);
+        List<OrderGoodsEntity> orderGoodsEntityList = orderGoodsDao.queryList(map);
+        orderEntity.setOrderGoodsEntityList(orderGoodsEntityList);
+        return orderEntity;
+    }
+    @Override
+    public int confirmPay(Long id) {
+        SysUserEntity user = ShiroUtils.getUserEntity();
+        if(user == null) {
+            throw new RRException("用户登录超时,请重新登录");
+        }
+        if (!user.getRoleType().equalsIgnoreCase("2")) {
+            throw new RRException("该操作只允许店员账户操作");
+        }
+        OrderEntity orderEntity = queryObject(id);
+        if (orderEntity.getOrderStatus() == Integer.valueOf(Dict.orderStatus.item_201.getItem())) {
+            throw new RRException("此订单已付款!");
+        }
+        if (orderEntity.getOrderStatus() == Integer.valueOf(Dict.orderStatus.item_301.getItem())) {
+            throw new RRException("此订单已完成!");
+        }
+        if (orderEntity.getOrderStatus() == Integer.valueOf(Dict.orderStatus.item_101.getItem())) {
+            throw new RRException("此订单已取消!");
+        }
+        if (orderEntity.getOrderStatus() == Integer.valueOf(Dict.orderStatus.item_102.getItem())) {
+            throw new RRException("此订单已删除!");
+        }
+        orderEntity.setOrderStatus(Integer.parseInt(Dict.orderStatus.item_201.getItem()));
+        orderEntity.setPayStatus(Integer.parseInt(Dict.payStatus.item_2.getItem()));
+        orderEntity.setPayTime(new Date());
+        orderDao.update(orderEntity);
+        return 0;
+    }
+
+    @Override
+    public List<OrderEntity> queryOffilineOrderList(Map<String, Object> map) {
+        return orderDao.queryOffilineOrderList(map);
+    }
 }

+ 50 - 11
kmall-admin/src/main/resources/mybatis/mapper/CartDao.xml

@@ -2,13 +2,11 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 
 <mapper namespace="com.kmall.admin.dao.CartDao">
-
     <!-- 可根据自己的需求,是否要使用 -->
     <resultMap type="com.kmall.admin.entity.CartEntity" id="cartMap">
         <result property="id" column="id"/>
         <result property="userName" column="user_name"/>
         <result property="userId" column="user_id"/>
-        <result property="sessionId" column="session_id"/>
         <result property="goodsId" column="goods_id"/>
         <result property="goodsSn" column="goods_sn"/>
         <result property="productId" column="product_id"/>
@@ -20,6 +18,16 @@
         <result property="goodsSpecificationIds" column="goods_specification_ids"/>
         <result property="checked" column="checked"/>
         <result property="listPicUrl" column="list_pic_url"/>
+        <result column="sku" property="sku" jdbcType="VARCHAR" />
+        <result column="goods_biz_type" property="goodsBizType" jdbcType="CHAR" />
+        <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
+        <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
+        <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
+        <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
+        <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
+        <result property="stockNum" column="productStockNum"/>
+        <result property="storeName" column="store_name"/>
+
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.CartEntity">
@@ -34,6 +42,9 @@
         <if test="userId != null">
             AND a.user_id = #{userId}
         </if>
+        <if test="goodsBizType != null">
+            AND a.goods_biz_type = #{goodsBizType}
+        </if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
@@ -57,24 +68,30 @@
     <insert id="save" parameterType="com.kmall.admin.entity.CartEntity" useGeneratedKeys="true" keyProperty="id">
 		insert into mall_cart
 		(
-			`user_id`, 
-			`session_id`, 
+			`user_id`,
 			`goods_id`, 
 			`goods_sn`, 
 			`product_id`, 
 			`goods_name`, 
 			`market_price`, 
 			`retail_price`, 
-			`number`, 
+			`number`,
 			`goods_specification_name_value`,
 			`goods_specification_ids`,
 			`checked`, 
-			`list_pic_url`
+			`list_pic_url`,
+			`stock_num`,
+			`store_id`,
+			`sku`,
+			`goods_biz_type`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`
 		)
 		values
 		(
-			#{userId}, 
-			#{sessionId}, 
+			#{userId},
 			#{goodsId}, 
 			#{goodsSn}, 
 			#{productId}, 
@@ -85,7 +102,15 @@
 			#{goodsSpecificationNameValue},
 			#{goodsSpecificationIds},
 			#{checked}, 
-			#{listPicUrl}
+			#{listPicUrl},
+			#{stockNum},
+			#{storeId},
+			#{sku},
+			#{goodsBizType},
+			#{createrSn},
+			#{createTime},
+			#{moderSn},
+			#{modTime}
 		)
 	</insert>
 
@@ -93,7 +118,6 @@
         update mall_cart
         <set>
             <if test="userId != null">`user_id` = #{userId},</if>
-            <if test="sessionId != null">`session_id` = #{sessionId},</if>
             <if test="goodsId != null">`goods_id` = #{goodsId},</if>
             <if test="goodsSn != null">`goods_sn` = #{goodsSn},</if>
             <if test="productId != null">`product_id` = #{productId},</if>
@@ -106,7 +130,22 @@
             </if>
             <if test="goodsSpecificationIds != null">`goods_specification_ids` = #{goodsSpecificationIds},</if>
             <if test="checked != null">`checked` = #{checked},</if>
-            <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl}</if>
+            <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl},</if>
+            <if test="stockNum != null">`stock_num` = #{stockNum},</if>
+            <if test="storeId != null">`store_id` = #{storeId},</if>
+            <if test="goodsBizType != null">`goods_biz_type` = #{goodsBizType},</if>
+            <if test="createrSn != null" >
+                creater_sn = #{createrSn,jdbcType=VARCHAR},
+            </if>
+            <if test="createTime != null" >
+                create_time = #{createTime,jdbcType=TIMESTAMP},
+            </if>
+            <if test="moderSn != null" >
+                moder_sn = #{moderSn,jdbcType=VARCHAR},
+            </if>
+            <if test="modTime != null" >
+                mod_time = #{modTime,jdbcType=TIMESTAMP}
+            </if>
         </set>
         where id = #{id}
     </update>

+ 17 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -54,6 +54,10 @@
         <result property="cusDeclEle" column="cus_decl_ele"/>
         <result property="cusRecCode" column="cus_rec_code"/>
         <result property="supplierId" column="supplier_id"/>
+        <result property="stockNums" column="stock_num"/>
+        <result property="storeName" column="store_name"/>
+        <result property="productId" column="productId"/>
+        <result property="storeId" column="storeId"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.GoodsEntity">
@@ -67,6 +71,16 @@
         WHERE a.id = #{value}
     </select>
 
+    <select id="queryObjectByProdBarcodeAndBizType" resultType="com.kmall.admin.entity.GoodsEntity">
+        SELECT
+            a.id,a.sku,a.goods_sn,a.name,a.list_pic_url,a.prod_barcode,r.market_price,r.retail_price,r.stock_num,s.store_name,r.product_id,s.id 'storeId'
+        FROM
+            mall_goods a
+        LEFT JOIN mall_product_store_rela r ON r.goods_id = a.id
+        inner join mall_store s on r.store_id=s.id
+        where a.prod_barcode = #{prodBarcode} and a.goods_biz_type = 11
+    </select>
+
     <select id="queryObjectBySn" resultType="com.kmall.admin.entity.GoodsEntity">
         SELECT
             a.*, CASE
@@ -120,6 +134,9 @@
         <if test="isDelete != null and isDelete != ''">
             AND mall_goods.is_Delete = #{isDelete}
         </if>
+        <if test="goodsBizType != null and goodsBizType != ''">
+            AND mall_goods.goods_biz_type = #{goodsBizType}
+        </if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}

+ 197 - 0
kmall-admin/src/main/resources/mybatis/mapper/OfflineCartDao.xml

@@ -0,0 +1,197 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.kmall.admin.dao.OfflineCartDao">
+
+    <resultMap type="com.kmall.admin.entity.OfflineCartEntity" id="offlineCartMap">
+        <result property="id" column="id"/>
+        <result property="userId" column="user_id"/>
+        <result property="goodsId" column="goods_id"/>
+        <result property="sku" column="sku"/>
+        <result property="goodsSn" column="goods_sn"/>
+        <result property="productId" column="product_id"/>
+		<result property="prodBarcode" column="prod_barcode"/>
+        <result property="goodsName" column="goods_name"/>
+        <result property="marketPrice" column="market_price"/>
+        <result property="retailPrice" column="retail_price"/>
+        <result property="number" column="number"/>
+        <result property="stockNum" column="stock_num"/>
+        <result property="listPicUrl" column="list_pic_url"/>
+        <result property="storeId" column="store_id"/>
+        <result property="createrSn" column="creater_sn"/>
+        <result property="createTime" column="create_time"/>
+        <result property="moderSn" column="moder_sn"/>
+        <result property="modTime" column="mod_time"/>
+        <result property="tstm" column="tstm"/>
+    </resultMap>
+	<select id="queryObjectByGoodsIdAndType" resultType="com.kmall.admin.entity.OfflineCartEntity">
+		select * from offline_cart where goods_id = #{goodsId} and user_id = #{userId}
+	</select>
+
+	<select id="queryOfflineCartByBizType" resultMap="offlineCartMap">
+		select a.* ,s.store_name
+		from offline_cart a
+		inner join mall_store s on a.store_id=s.id
+		where 1=1
+		<if test="userId != null">
+			AND a.user_id = #{userId}
+		</if>
+		<if test="storeId != null">
+			AND a.store_id = #{storeId}
+		</if>
+	</select>
+
+	<select id="queryObject" resultType="com.kmall.admin.entity.OfflineCartEntity">
+		select
+			`id`,
+			`user_id`,
+			`goods_id`,
+			`sku`,
+			`goods_sn`,
+			`product_id`,
+			`goods_name`,
+			`market_price`,
+			`retail_price`,
+			`number`,
+			`stock_num`,
+			`list_pic_url`,
+			`store_id`,
+			prod_barcode,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`
+		from offline_cart
+		where id = #{id}
+	</select>
+
+	<select id="queryList" resultType="com.kmall.admin.entity.OfflineCartEntity">
+		select
+    		`id`,
+    		`user_id`,
+    		`goods_id`,
+    		`sku`,
+    		`goods_sn`,
+    		`product_id`,
+    		`goods_name`,
+    		`market_price`,
+    		`retail_price`,
+    		`number`,
+    		`stock_num`,
+    		`list_pic_url`,
+    		`store_id`,
+			prod_barcode,
+    		`creater_sn`,
+    		`create_time`,
+    		`moder_sn`,
+    		`mod_time`,
+    		`tstm`
+		from offline_cart
+		WHERE 1=1
+		<if test="name != null and name.trim() != ''">
+			AND name LIKE concat('%',#{name},'%')
+		</if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+			<otherwise>
+                order by id desc
+			</otherwise>
+        </choose>
+		<if test="offset != null and limit != null">
+			limit #{offset}, #{limit}
+		</if>
+	</select>
+	
+ 	<select id="queryTotal" resultType="int">
+		select count(*) from offline_cart
+		WHERE 1=1
+        <if test="name != null and name.trim() != ''">
+            AND name LIKE concat('%',#{name},'%')
+        </if>
+	</select>
+	 
+	<insert id="save" parameterType="com.kmall.admin.entity.OfflineCartEntity" useGeneratedKeys="true" keyProperty="id">
+		insert into offline_cart(
+			`user_id`,
+			`goods_id`,
+			`sku`,
+			`goods_sn`,
+			`product_id`,
+			`prod_barcode`,
+			`goods_name`,
+			`market_price`,
+			`retail_price`,
+			`number`,
+			`stock_num`,
+			`list_pic_url`,
+			`store_id`,
+			`creater_sn`,
+			`create_time`,
+			`moder_sn`,
+			`mod_time`,
+			`tstm`)
+		values(
+			#{userId},
+			#{goodsId},
+			#{sku},
+			#{goodsSn},
+			#{productId},
+			#{prodBarcode},
+			#{goodsName},
+			#{marketPrice},
+			#{retailPrice},
+			#{number},
+			#{stockNum},
+			#{listPicUrl},
+			#{storeId},
+			#{createrSn},
+			#{createTime},
+			#{moderSn},
+			#{modTime},
+			#{tstm})
+	</insert>
+	 
+	<update id="update" parameterType="com.kmall.admin.entity.OfflineCartEntity">
+		update offline_cart 
+		<set>
+			<if test="userId != null">`user_id` = #{userId}, </if>
+			<if test="goodsId != null">`goods_id` = #{goodsId}, </if>
+			<if test="sku != null">`sku` = #{sku}, </if>
+			<if test="goodsSn != null">`goods_sn` = #{goodsSn}, </if>
+			<if test="productId != null">`product_id` = #{productId}, </if>
+			<if test="prodBarcode != null">`prod_barcode` = #{prodBarcode}, </if>
+			<if test="goodsName != null">`goods_name` = #{goodsName}, </if>
+			<if test="marketPrice != null">`market_price` = #{marketPrice}, </if>
+			<if test="retailPrice != null">`retail_price` = #{retailPrice}, </if>
+			<if test="number != null">`number` = #{number}, </if>
+			<if test="stockNum != null">`stock_num` = #{stockNum}, </if>
+			<if test="listPicUrl != null">`list_pic_url` = #{listPicUrl}, </if>
+			<if test="storeId != null">`store_id` = #{storeId}, </if>
+			<if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
+			<if test="createTime != null">`create_time` = #{createTime}, </if>
+			<if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
+			<if test="modTime != null">`mod_time` = #{modTime}, </if>
+			<if test="tstm != null">`tstm` = #{tstm}</if>
+		</set>
+		where id = #{id}
+	</update>
+	
+	<delete id="delete">
+		delete from offline_cart where id = #{value}
+	</delete>
+
+	<delete id="deleteByUserId">
+		delete from offline_cart where user_id = #{userId}
+	</delete>
+
+	<delete id="deleteBatch">
+		delete from offline_cart where id in 
+		<foreach item="id" collection="array" open="(" separator="," close=")">
+			#{id}
+		</foreach>
+	</delete>
+
+</mapper>

+ 83 - 8
kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml

@@ -36,7 +36,6 @@
         <result property="payTime" column="pay_time"/>
         <result property="freightPrice" column="freight_price"/>
         <result property="couponId" column="coupon_id"/>
-        <result property="parentId" column="parent_id"/>
         <result property="couponPrice" column="coupon_price"/>
         <result property="callbackStatus" column="callback_status"/>
         <result property="orderType" column="order_type"/>
@@ -52,6 +51,11 @@
         <result property="isEleOrderSend" column="is_ele_order_send"/>
         <result property="isCustomsSend" column="is_customs_send"/>
         <result column="buyer_pay_check" property="buyerPayCheck"/>
+        <result property="merchSn" column="merch_sn"/>
+        <result property="sku" column="sku"/>
+        <result property="createTime" column="create_time"/>
+        <result property="modTime" column="mod_time"/>
+        <result property="isOnfflineOrder" column="is_onffline_order"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
@@ -60,6 +64,12 @@
         left join mall_user u on o.user_id = u.id
         where o.id = #{value}
 	</select>
+    <select id="queryObjectBySysUser" resultType="com.kmall.admin.entity.OrderEntity">
+        select o.*,u.username as username
+        from mall_order o
+        left join sys_user u on o.user_id = u.user_id
+        where o.id = #{value}
+    </select>
 
     <select id="queryObjectByActivityId" resultType="com.kmall.admin.entity.OrderEntity">
         select o.*,u.username as username
@@ -106,6 +116,9 @@
         <if test="orderType != null and orderType.trim() != ''">
             AND o.order_type = #{orderType}
         </if>
+        <if test="isOnfiilineOrder != null">
+            AND o.is_onffline_order = #{isOnfiilineOrder}
+        </if>
         <if test="ids != null and ids.trim() != ''">
             AND o.id in (${ids})
         </if>
@@ -145,10 +158,64 @@
         <if test="orderType != null and orderType.trim() != ''">
             AND o.order_type = #{orderType}
         </if>
+        <if test="isOnfiilineOrder != null">
+            AND o.is_onffline_order = #{isOnfiilineOrder}
+        </if>
         <if test="ids != null and ids.trim() != ''">
             AND o.id in (${ids})
         </if>
     </select>
+    <select id="queryOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
+        SELECT
+        o.*,
+        u.username AS username,
+        p.is_payment_send,
+        p.is_ele_order_send,
+        p.is_customs_send
+        FROM
+        mall_order o
+        LEFT JOIN sys_user u ON o.user_id = u.user_id
+        LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
+        WHERE 1=1
+        <if test="storeId != null">
+            AND o.store_id = #{storeId}
+        </if>
+        <if test="orderSn != null and orderSn.trim() != ''">
+            AND o.order_sn LIKE concat('%',#{orderSn},'%')
+        </if>
+        <if test="shippingStatus != null">
+            AND o.shipping_status = #{shippingStatus}
+        </if>
+        <if test="payStatus != null">
+            AND o.pay_status = #{payStatus}
+        </if>
+        <if test="orderStatus != null and orderStatus.trim() != ''">
+            AND o.order_status = #{orderStatus}
+        </if>
+        <if test="shippingId != null and shippingId != 0">
+            AND o.shipping_id = #{shippingId}
+        </if>
+        <if test="orderType != null and orderType.trim() != ''">
+            AND o.order_type = #{orderType}
+        </if>
+        <if test="isOnfiilineOrder != null">
+            AND o.is_onffline_order = #{isOnfiilineOrder}
+        </if>
+        <if test="ids != null and ids.trim() != ''">
+            AND o.id in (${ids})
+        </if>
+        <choose>
+            <when test="sidx != null and sidx.trim() != ''">
+                order by ${sidx} ${order}
+            </when>
+            <otherwise>
+                order by id desc
+            </otherwise>
+        </choose>
+        <if test="offset != null and limit != null">
+            limit #{offset}, #{limit}
+        </if>
+    </select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.OrderEntity" useGeneratedKeys="true" keyProperty="id">
 		insert into mall_order
@@ -182,13 +249,16 @@
 			`confirm_time`, 
 			`pay_time`, 
 			`freight_price`, 
-			`coupon_id`, 
-			`parent_id`, 
+			`coupon_id`,
 			`coupon_price`, 
 			`callback_status`,
 			`order_type`,
 			`store_id`,
-			`order_biz_type`
+			`order_biz_type`,
+			`is_onffline_order`,
+            `merch_sn`,
+            `create_time`,
+            `mod_time`
 		)
 		values
 		(
@@ -221,13 +291,16 @@
 			#{confirmTime}, 
 			#{payTime}, 
 			#{freightPrice}, 
-			#{couponId}, 
-			#{parentId}, 
+			#{couponId},
 			#{couponPrice}, 
 			#{callbackStatus},
 			#{orderType},
 			#{storeId},
-			#{orderBizType}
+			#{orderBizType},
+			#{isOnfflineOrder},
+            #{merchSn},
+            #{createTime},
+            #{modTime}
 		)
 	</insert>
 
@@ -264,12 +337,14 @@
             <if test="payTime != null">`pay_time` = #{payTime},</if>
             <if test="freightPrice != null">`freight_price` = #{freightPrice},</if>
             <if test="couponId != null">`coupon_id` = #{couponId},</if>
-            <if test="parentId != null">`parent_id` = #{parentId},</if>
             <if test="couponPrice != null">`coupon_price` = #{couponPrice},</if>
             <if test="callbackStatus != null">`callback_status` = #{callbackStatus},</if>
             <if test="orderType != null">`order_type` = #{orderType},</if>
             <if test="storeId != null">`store_id` = #{storeId},</if>
             <if test="orderBizType != null">`order_biz_type` = #{orderBizType},</if>
+            <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
+            <if test="createTime != null">`create_time` = #{createTime},</if>
+            <if test="modTime != null">`mod_time` = #{modTime},</if>
         </set>
         where id = #{id}
     </update>

+ 31 - 9
kmall-admin/src/main/resources/mybatis/mapper/ProductStoreRelaDao.xml

@@ -27,6 +27,7 @@
         <result column="moder_sn" property="moderSn" />
         <result column="mod_time" property="modTime" />
         <result column="tstm" property="tstm" />
+        <result column="list_pic_url" property="listPicUrl" />
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
@@ -99,8 +100,9 @@
         a.`market_price`,
         a.`stock_price`,
         a.`sell_volume`,
-        a.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
+        b.sku,a.goods_biz_type, a.creater_sn, a.create_time, a.moder_sn, a.mod_time, a.tstm,
         b.goods_sn goodsSn,
+        b.list_pic_url,
         c.goods_sn productSn,
         b.name goodsName,
         cg.name categoryName,
@@ -129,6 +131,9 @@
         <if test="storeId != null and storeId != ''">
             AND s.id = #{storeId}
         </if>
+        <if test="goodsBizType != null and goodsBizType != ''">
+            AND b.goods_biz_type = #{goodsBizType}
+        </if>
         <choose>
             <when test="sidx != null and sidx.trim() != ''">
                 order by ${sidx} ${order}
@@ -213,6 +218,9 @@
         <if test="storeId != null and storeId != ''">
             AND s.id = #{storeId}
         </if>
+        <if test="goodsBizType != null and goodsBizType != ''">
+            AND b.goods_biz_type = #{goodsBizType}
+        </if>
     </select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.ProductStoreRelaEntity" useGeneratedKeys="true"
@@ -326,19 +334,33 @@
         </foreach>
     </delete>
 
+    <select id="queryByGoodsId" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
+        select a.*
+		from mall_product_store_rela a
+		where a.goods_id = #{goodsId}
+    </select>
+
+    <select id="queryByGoodsIdAndStoreId" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
+        select a.*
+        from mall_product_store_rela a
+        where a.goods_id = #{goodsId} and a.store_id = #{storeId}
+    </select>
+
     <update id="updateStockNum" parameterType="com.kmall.admin.entity.ProductStoreRelaEntity">
         update mall_product_store_rela a
         <set>
-            <if test="stock_num != null">a.`stock_num` = #{stock_num},</if>
-            <if test="sell_volume != null">a.`sell_volume` = #{sell_volume},</if>
+            <if test="stockNum != null">a.`stock_num` = #{stockNum},</if>
+            <if test="sellVolume != null">a.`sell_volume` = #{sellVolume},</if>
         </set>
-        where a.id = #{id}
+        where a.goods_id = #{goodsId} and a.store_id = #{storeId}
     </update>
 
-    <select id="queryByGoodsId" resultType="com.kmall.admin.entity.ProductStoreRelaEntity">
-        select a.*
-		from mall_product_store_rela a
-		where a.goods_id = #{goodsId}
-    </select>
+    <update id="updateSellVolumeNum" parameterType="com.kmall.api.entity.ProductVo">
+        update mall_product_store_rela a
+        <set>
+            <if test="sellVolume != null">a.`sell_volume` = #{sellVolume},</if>
+        </set>
+        where a.product_id = #{goodsId} and a.store_id = #{storeId}
+    </update>
 
 </mapper>

+ 228 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/offilineOrderList.html

@@ -0,0 +1,228 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title></title>
+    #parse("sys/header.html")
+</head>
+<body>
+<div id="rrapp" v-cloak>
+    <div v-show="showDiv == 1">
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.orderSn" @on-enter="query" placeholder="订单号"/>
+                </i-col>
+                <i-col span="4">
+                    <i-select v-model="q.orderStatus" placeholder="订单状态">
+                        <i-option value="0">待付款</i-option>
+                        <i-option value="101">订单已取消</i-option>
+                        <i-option value="102">订单已删除</i-option>
+                        <i-option value="201">订单已付款</i-option>
+                        <i-option value="300">订单已发货</i-option>
+                        <i-option value="301">用户确认收货</i-option>
+                        <i-option value="401">退款</i-option>
+                        <i-option value="402">完成</i-option>
+                    </i-select>
+                </i-col>
+                <!--<i-col span="4">
+                    <i-select v-model="q.orderType">
+                        <i-option value="1">普通订单</i-option>
+                        <i-option value="2">团购订单</i-option>
+                    </i-select>
+                </i-col>-->
+                <i-button @click="query">查询</i-button>
+                <i-button @click="reloadSearch">重置</i-button>
+            </div>
+            <div class="buttons-group">
+                <i-button type="error" @click="confirm">确认付款</i-button>
+            </div>
+        </Row>
+        <table id="jqGrid"></table>
+        <div id="jqGridPager"></div>
+    </div>
+
+    <Card v-show="showDiv == 2">
+        <p slot="title" style="height: auto">{{title}}</p>
+        <Tabs>
+            <Tab-Pane label="订单信息" name="name1">
+                <i-form ref="formValidate" :model="order" :label-width="100">
+                    <Form-item label="订单号" prop="orderSn">
+                        <i-input v-model="order.orderSn" readonly/>
+                    </Form-item>
+                    <Form-item label="会员" prop="userName">
+                        <i-input v-model="order.userName" readonly/>
+                    </Form-item>
+                    <Form-item label="订单业务类型" prop="orderBizType" >
+                        <i-select v-model="order.orderBizType" filterable placeholder="订单业务类型"
+                                  label-in-value disabled>
+                            <i-option v-for="macro in macros" :value="macro.value" :key="macro.id">{{macro.name}}
+                            </i-option>
+                        </i-select>
+                    </Form-item>
+                    <Form-item label="订单状态" prop="orderStatus" readonly>
+                        <Radio-group v-model="order.orderStatus">
+                            <Radio label="0" disabled>
+                                <span>待付款</span>
+                            </Radio>
+                            <Radio label="101" disabled>
+                                <span>订单已取消</span>
+                            </Radio>
+                            <Radio label="102" disabled>
+                                <span>订单已删除</span>
+                            </Radio>
+                            <Radio label="201" disabled>
+                                <span>订单已付款</span>
+                            </Radio>
+                            <Radio label="300" disabled>
+                                <span>订单已发货</span>
+                            </Radio>
+                            <Radio label="301" disabled>
+                                <span>用户确认收货</span>
+                            </Radio>
+                            <Radio label="401" disabled>
+                                <span>退款</span>
+                            </Radio>
+                            <Radio label="402" disabled>
+                                <span>完成</span>
+                            </Radio>
+                        </Radio-group>
+                    </Form-item>
+                    <!--<Form-item label="发货状态" prop="shippingStatus">-->
+                        <!--<Radio-group v-model="order.shippingStatus">-->
+                            <!--<Radio label="0" disabled>-->
+                                <!--<span>待发货</span>-->
+                            <!--</Radio>-->
+                            <!--<Radio label="1" disabled>-->
+                                <!--<span>已发货</span>-->
+                            <!--</Radio>-->
+                            <!--<Radio label="2" disabled>-->
+                                <!--<span>已收货</span>-->
+                            <!--</Radio>-->
+                            <!--<Radio label="4" disabled>-->
+                                <!--<span>退货</span>-->
+                            <!--</Radio>-->
+                        <!--</Radio-group>-->
+                    <!--</Form-item>-->
+                    <Form-item label="付款状态" prop="payStatus">
+                        <Radio-group v-model="order.payStatus">
+                            <Radio label="0" disabled>
+                                <span>待付款</span>
+                            </Radio>
+                            <Radio label="1" disabled>
+                                <span>付款中</span>
+                            </Radio>
+                            <Radio label="2" disabled>
+                                <span>已付款</span>
+                            </Radio>
+                        </Radio-group>
+                    </Form-item>
+                    <!--<Form-item label="收货人" prop="consignee">-->
+                        <!--<i-input v-model="order.consignee" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="收货地址" prop="address">-->
+                        <!--<i-input v-model="order.address" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="联系电话" prop="mobile">-->
+                        <!--<i-input v-model="order.mobile" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="客户留言" prop="postscript">-->
+                        <!--<i-input v-model="order.postscript" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="快递公司" prop="shippingName">-->
+                        <!--<i-input v-model="order.shippingName" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="配送单号" prop="shippingNo">-->
+                        <!--<i-input v-model="order.shippingNo" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="配送费用" prop="shippingFee">-->
+                        <!--<i-input v-model="order.shippingFee" readonly/>-->
+                    <!--</Form-item>-->
+                    <Form-item label="实际支付" prop="actualPrice">
+                        <i-input v-model="order.actualPrice" readonly/>
+                    </Form-item>
+                    <Form-item label="订单总价" prop="orderPrice">
+                        <i-input v-model="order.orderPrice" readonly/>
+                    </Form-item>
+                    <Form-item label="商品总价" prop="goodsPrice">
+                        <i-input v-model="order.goodsPrice" readonly/>
+                    </Form-item>
+                    <Form-item label="下单时间" prop="addTime">
+                        <Date-picker format="yyyy-MM-dd HH:mm:ss" v-model="order.addTime" placeholder="使用时间" readonly/>
+                    </Form-item>
+                    <!--<Form-item label="付款时间" prop="payTime">-->
+                        <!--<Date-picker format="yyyy-MM-dd HH:mm:ss" v-model="order.payTime" placeholder="使用时间" readonly/>-->
+                    <!--</Form-item>-->
+                    <!--<Form-item label="配送费用" prop="freightPrice">-->
+                        <!--<i-input v-model="order.freightPrice" readonly/>-->
+                    <!--</Form-item>-->
+                    <Form-item>
+                        <i-button type="warning" @click="reload" style="margin-left: 8px"/>
+                        返回</i-button>
+                    </Form-item>
+                </i-form>
+            </Tab-Pane>
+            <Tab-Pane label="商品" name="name2">
+                <table class="table">
+                    <tr>
+                        <td style="text-align: left; width: 600px; font-weight: bold;" colspan="2">商品</td>
+                        <td style="text-align: center; width: 240px; font-weight: bold;">小计</td>
+                        <td style="text-align: center; width: 240px; font-weight: bold;">优惠抵扣金额(元)</td>
+                        <td style="text-align: center; width: 240px; font-weight: bold;">应收金额(元)</td>
+                        <td style="text-align: center; width: 240px; font-weight: bold;">实收金额(元)</td>
+                    </tr>
+                    <tr v-for="(item,index) in orderGoodsList">
+                        <td width="120px">
+                            <img :src="item.listPicUrl" width="100px" height="100px" />
+                        </td>
+                        <td>
+                            <p style="line-height: 30px;">{{item.goodsName}}</p>
+                            <p style="line-height: 30px;">数量:{{item.number}}</p>
+                            <p style="line-height: 30px;">单价:¥{{item.retailPrice}}</p>
+                            <p style="line-height: 30px;">SKU:{{item.sku}}</p>
+                        </td>
+                        <td align="center">¥{{item.number * item.retailPrice}}</td>
+                        <td align="center">-</td>
+                        <td align="center">-</td>
+                        <td align="center">-</td>
+                    </tr>
+                    <tr>
+                        <td align="left" style="font-weight: bold;">运费</td>
+                        <td align="center">-</td>
+                        <td align="center">-</td>
+                        <td align="center">-</td>
+                        <td align="center">¥{{order.freightPrice}}</td>
+                        <td align="center">-</td>
+                    </tr>
+                    <tr>
+                        <td align="left" colspan="2" style="font-weight: bold;">总计</td>
+                        <td align="center">¥{{order.orderPrice}}</td>
+                        <td align="center">¥{{order.couponPrice}}</td>
+                        <td align="center">¥{{order.actualPrice}}</td>
+                        <td align="center" v-show="order.payStatus == 0">未付款</td>
+                        <td align="center" v-show="order.payStatus == 1">付款中</td>
+                        <td align="center" v-show="order.payStatus == 2 || order.payStatus == 4">¥{{order.actualPrice}}</td>
+                    </tr>
+                </table>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>返回</i-button>
+            </Tab-Pane>
+        </Tabs>
+    </Card>
+
+    <Card v-show="showDiv == 5">
+        <p slot="title">退款</p>
+        <i-form :model="order" :label-width="100">
+            <Form-item label="退款金额" prop="refundMoney">
+                <i-input v-model="refundMoney" placeholder="退款金额"/>
+            </Form-item>
+            <Form-item>
+                <i-button type="primary" @click="refundUpdate">提交</i-button>
+                <i-button type="warning" @click="reload" style="margin-left: 8px"/>
+                返回</i-button>
+            </Form-item>
+        </i-form>
+    </Card>
+
+</div>
+<script src="${rc.contextPath}/js/shop/offilineOrderList.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 110 - 0
kmall-admin/src/main/webapp/WEB-INF/page/shop/scannShop.html

@@ -0,0 +1,110 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title></title>
+    #parse("sys/header.html")
+    <style>
+        .upload-list {
+            display: inline-block;
+            width: 60px;
+            height: 60px;
+            text-align: center;
+            line-height: 60px;
+            border: 1px solid transparent;
+            border-radius: 4px;
+            overflow: hidden;
+            background: #fff;
+            position: relative;
+            box-shadow: 0 1px 1px rgba(0, 0, 0, .2);
+            margin-right: 4px;
+        }
+
+        .upload-list img {
+            width: 100%;
+            height: 100%;
+        }
+
+        .upload-list-cover {
+            display: none;
+            position: absolute;
+            top: 0;
+            bottom: 0;
+            left: 0;
+            right: 0;
+            background: rgba(0, 0, 0, .6);
+        }
+
+        .upload-list:hover .upload-list-cover {
+            display: block;
+        }
+
+        .upload-list-cover i {
+            color: #fff;
+            font-size: 20px;
+            cursor: pointer;
+            margin: 0 2px;
+        }
+
+        .hselect {
+            margin: 0;
+            padding: 0;
+        }
+    </style>
+</head>
+<body>
+<div id="rrapp" v-cloak>
+    <div v-show="showList">
+        <Row :gutter="16">
+            <div class="search-group">
+                <i-col span="4">
+                    <i-input v-model="q.prodBarcode" @on-enter="query" placeholder="商品编码"/>
+                </i-col>
+                <i-button @click="query">查询</i-button>
+                <i-button @click="reloadSearch">重置</i-button>
+            </div>
+            <div class="buttons-group">
+                <i-button type="info" @click="getTotal"><i class="fa"></i>&nbsp;全选</i-button>
+                #if($shiro.hasPermission("goods:update"))
+                <i-button type="info" @click="getInfo"><i class="fa fa-plus"></i>&nbsp;普货订单生成</i-button>
+                <i-button class="btn btn-outline btn-primary" onclick="vm.removeData()"><i class="fa fa-remove"></i>批量删除</i-button>&nbsp;
+                #end
+            </div>
+        </Row>
+        <table id="jqGrid"></table>
+        <!--<div id="jqGridPager">-->
+            <!--商品合计:{{goodsTotalPrice}}-->
+            <!--实收:{{applyPrice}}-->
+        <!--</div>-->
+    </div>
+
+    <Card v-show="!showList">
+        <p slot="title">{{title}}</p>
+        <i-form ref="formValidate" :model="offlineCart" :rules="ruleValidate" :label-width="140">
+            <table class="table">
+                <tr>
+                    <th style="text-align: left; width: 600px; font-weight: bold;" colspan="2">商品名称</th>
+                    <th style="text-align: center; width: 240px; font-weight: bold;">单价</th>
+                    <th style="text-align: center; width: 240px; font-weight: bold;">数量</th>
+                    <th style="text-align: center; width: 240px; font-weight: bold;">小计</th>
+                </tr>
+                <tr v-for="(item,index) in offlineCartList">
+                    <td colspan="2"><p style="line-height: 30px;">{{item.goodsName}}</p></td>
+                    <td align="center"><p style="line-height: 30px;">¥{{item.retailPrice}}</p></td>
+                    <td align="center"><p style="line-height: 30px;">{{item.number}}</p></td>
+                    <td align="center">¥{{item.number * item.retailPrice}}</td>
+                </tr>
+                <tr>
+                    <td align="left" colspan="2" style="font-weight: bold;">总计</td>
+                    <td align="center">-</td>
+                    <td align="center">-</td>
+                    <td align="center">¥{{goodsTotalPrice}}</td>
+                </tr>
+            </table>
+            <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
+            <i-button type="warning" @click="back" style="margin-left: 8px"/>返回</i-button>
+        </i-form>
+    </Card>
+</div>
+<script src="${rc.contextPath}/js/shop/scannShop.js?_${date.systemTime}"></script>
+</body>
+</html>

+ 493 - 0
kmall-admin/src/main/webapp/js/shop/offilineOrderList.js

@@ -0,0 +1,493 @@
+$(function () {
+    let shippingStatus = getQueryString("shippingStatus");
+    let payStatus = getQueryString("payStatus");
+    let orderStatus = getQueryString("orderStatus");
+    let orderType = getQueryString("orderType");
+    let url = '../order/offilineOrderList?1';
+    if (shippingStatus) {
+        url += '&shippingStatus=' + shippingStatus;
+    }
+    if (payStatus) {
+        url += '&payStatus=' + payStatus;
+    }
+    if (orderStatus) {
+        url += '&orderStatus=' + orderStatus;
+    }
+    if (orderType) {
+        url += '&orderType=' + orderType;
+    }
+    $("#jqGrid").jqGrid({
+        url: url,
+        datatype: "json",
+        colModel: [
+            {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
+            {label: '订单号', name: 'orderSn', index: 'order_sn', align: 'center',width: 100},
+            {label: '操作店员', name: 'userName', index: 'user_name', align: 'center',width: 80},
+            {
+                label: '购买类型', name: 'isOnfflineOrder', index: 'is_onffline_order', align: 'center',width: 80,
+                formatter: function (value) {
+                    if (value == '0') {
+                        return '线上购买';
+                    } else if (value == '1') {
+                        return '线下购买';
+                    }
+                    return '-';
+                }
+            },
+            {
+                label: '订单业务类型', name: 'orderBizType', index: 'order_biz_type', align: 'center',width: 80,
+                formatter: function (value) {
+                    if (value == '00') {
+                        return '保税备货';
+                    } else if (value == '02') {
+                        return '保税展示补货';
+                    } else if (value == '10') {
+                        return '保税展示跨境';
+                    } else if (value == '11') {
+                        return '普通货物';
+                    }
+                    return '-';
+                }
+            },
+            {
+                label: '订单状态', name: 'orderStatus', index: 'order_status', align: 'center',width: 80,
+                formatter: function (value) {
+                    if (value == '0') {
+                        return '订单创建成功等待付款';
+                    } else if (value == '100') {
+                        return '订单付款中';
+                    } else if (value == '101') {
+                        return '订单已取消';
+                    } else if (value == '102') {
+                        return '订单已删除';
+                    } else if (value == '201') {
+                        return '订单已付款';
+                    } else if (value == '300') {
+                        return '订单已发货';
+                    } else if (value == '301') {
+                        return '用户确认收货';
+                    } else if (value == '401') {
+                        return '没有发货,退款';
+                    } else if (value == '402') {
+                        return '已收货,退款退货';
+                    }
+                    return value;
+                }
+            },
+            {
+                label: '付款状态', name: 'payStatus', index: 'pay_status', align: 'center',width: 80,
+                formatter: function (value) {
+                    if (value == '0') {
+                        return '未付款';
+                    } else if (value == '1') {
+                        return '付款中';
+                    } else if (value == '2') {
+                        return '已付款';
+                    } else if (value == '3') {
+                        return '退款中';
+                    } else if (value == '4') {
+                        return '退款';
+                    }
+                    return value;
+                }
+            },
+            // {label: '收货人', name: 'consignee', index: 'consignee', width: 80},
+            // {label: '收货地址', name: 'address', index: 'address', width: 80},
+            // {label: '联系电话', name: 'mobile', index: 'mobile', width: 80},
+            {label: '实际支付', name: 'actualPrice', index: 'actual_price', align: 'center',width: 60},
+            {label: '订单总价', name: 'orderPrice', index: 'order_price',align: 'center', width: 60},
+            {
+                label: '下单时间', name: 'addTime', index: 'add_time', width: 120,align: 'center',
+                formatter: function (value) {
+                    return transDate(value, 'yyyy-MM-dd hh:mm:ss');
+                }
+            },
+            {
+                label: '付款时间', name: 'payTime', index: 'pay_time', width: 120, align: 'center',
+                formatter: function (value) {
+                    return transDate(value, 'yyyy-MM-dd hh:mm:ss');
+                }
+            },
+            // {label: '快递公司', name: 'shippingName', index: 'shipping_name', width: 80},
+            // {label: '配送单号', name: 'shippingNo', index: 'shipping_No', width: 80},
+            // {label: '快递费用', name: 'shippingFee', index: 'shipping_fee', width: 80},
+            {
+                label: '操作', width: 180, sortable: false,align: 'center',
+                formatter: function (value, col, row) {
+                    let htmlStr = '<button class="btn btn-outline btn-info" onclick="vm.lookDetail(' + row.id + ')"><i class="fa fa-info-circle"></i>详情</button>&nbsp;';
+                    if (row.orderStatus == 201 && (row.orderBizType == '11')) {
+                        htmlStr += '<button class="btn btn-outline btn-primary" onclick="vm.printDetail(' + row.id + ')"><i class="fa fa-print"></i>打印</button>&nbsp;';
+                    }
+                    if (row.orderStatus == 0) {
+                        htmlStr += '<button class="btn btn-outline btn-danger" onclick="vm.cancelUpdate(' + row.id + ')"><i class="fa fa-times-circle-o"></i>&nbsp;取消</button>&nbsp;';
+                    }
+
+                    // if (row.orderStatus == 201) {
+                    //     if (row.isPaymentSend == 0 || row.isEleOrderSend == 0 || row.isCustomsSend == 0 || row.buyerPayCheck != 0) {
+                    //         htmlStr += '<button class="btn btn-outline btn-danger" onclick="vm.refundUpdate(' + row.id + ')"><i class="fa fa-times-circle-o"></i>&nbsp;退款</button>&nbsp;';
+                    //     }
+                    // }
+
+                    return htmlStr;
+                }
+            }
+        ],
+        viewrecords: true,
+        height: 675,
+        rowNum: 10,
+        rowList: [10, 30, 50],
+        rownumbers: true,
+        rownumWidth: 25,
+        autowidth: true,
+        multiselect: true,
+        pager: "#jqGridPager",
+        jsonReader: {
+            root: "page.list",
+            page: "page.currPage",
+            total: "page.totalPage",
+            records: "page.totalCount"
+        },
+        prmNames: {
+            page: "page",
+            rows: "limit",
+            order: "order"
+        },
+        gridComplete: function () {
+            $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+        }
+    });
+});
+
+let vm = new Vue({
+    el: '#rrapp',
+    data: {
+        showDiv: 1, // 1查询 2编辑 3发货 4选择骑手 5退款
+        title: null,
+        order: {},
+        shippings: [],
+        q: {
+            orderSn: '',
+            orderStatus: '',
+            orderType: ''
+        },
+        refundMoney: 0,
+        shipping: {},
+        logisticsInfo: {
+            tracesList: [],
+            logisticCode: '',
+            shipperCode: ''
+        },
+        macros: [],
+        orderProcessRecordEntity: {},
+        orderGoodsList: []
+    },
+    methods: {
+        query: function () {
+            vm.reload(1);
+        },
+        getMacro: function () {
+            $.get("../sys/macro/queryMacrosByValue?value=goodsBizType", function (r) {
+                vm.macros = r.list;
+            });
+        },
+        shippingChange: function (opt) {
+            vm.order.shippingName = opt.label;
+            vm.order.shippingCode = opt.value;
+        },
+        saveOrUpdate: function (event) {
+            $.ajax({
+                type: "POST",
+                url: '../order/sendGoods',
+                contentType: "application/json",
+                data: JSON.stringify(vm.order),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+        },
+        reload: function (event) {
+            vm.showDiv = 1;
+            let page = event;
+            if (event != 1) {
+                page = $("#jqGrid").jqGrid('getGridParam', 'page');
+            }
+            $("#jqGrid").jqGrid('setGridParam', {
+                postData: {
+                    'orderSn': vm.q.orderSn,
+                    'orderStatus': vm.q.orderStatus,
+                    'orderType': vm.q.orderType
+                },
+                page: page
+            }).trigger("reloadGrid");
+        },
+        reloadSearch: function () {
+            vm.q = {
+                orderSn: '',
+                orderStatus: '',
+                orderType: ''
+            };
+        },
+        lookDetail: function (rowId) { //第三步:定义编辑操作
+            vm.showDiv = 2;
+            vm.title = "订单详情";
+            $.get("../order/offlineInfos/" + rowId, function (r) {
+                vm.order = r.order;
+                vm.orderGoodsList = r.order.orderGoodsEntityList;
+            });
+            vm.getMacro();
+        },
+        printDetail: function (rowId) {
+            confirm('确定连接打票机打印出票?', function () {
+                $.ajax({
+                    type: "POST",
+                    url: "../order/printMsg",
+                    contentType: "application/json",
+                    data: JSON.stringify(rowId),
+                    success: function (r) {
+                        if (r.ticket != null) {
+                            // printArea(r.ticket);
+                            var content = getPrintContent(r.ticket);
+                            printArea(content);
+                            alert('打印小票完成');
+                        }else{
+                            alert("打印小票失败");
+                        }
+                    }
+                });
+            })
+        },
+        confirm: function (event) {
+            let id = getSelectedRow();
+            if (id == null) {
+                return;
+            }
+            confirm('确定付款?', function () {
+                $.ajax({
+                    type: "POST",
+                    url: "../order/confirmPay",
+                    contentType: "application/json",
+                    data: JSON.stringify(id),
+                    dataType: "json",
+                    success: function (r) {
+
+                        if (r.code == 0) {
+                            alert('操作成功', function (index) {
+                                $("#jqGrid").trigger("reloadGrid");
+                            });
+                        } else {
+                            alert(r.msg);
+                        }
+                    }
+                });
+            });
+        },
+        shippingBind: function (event) {
+            let orderId = vm.order.id;
+            $.ajax({
+                type: "POST",
+                url: '../order/shippingBind',
+                data: {orderId: orderId, shippingCode: vm.shipping},
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('操作成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+        },
+        refund: function (rowId) {
+            vm.showDiv = 5;
+            vm.refundMoney = 0;
+            Ajax.request({
+                url: "../order/info/" + rowId,
+                async: true,
+                successCallback: function (r) {
+                    vm.order = r.order;
+                    vm.refundMoney = r.order.actualPrice;
+                }
+            });
+        },
+        cancelUpdate: function (rowId) {
+            let params = {};
+            params.orderId = rowId;
+
+            $.ajax({
+                type: "POST",
+                url: '../order/cancel',
+                data: params,
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('取消成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+        },
+        refundUpdate: function (rowId) {
+            let params = {};
+            params.orderId = rowId;
+
+            $.ajax({
+                type: "POST",
+                url: '../order/refund',
+                data: params,
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('退款成功', function (index) {
+                            vm.reload();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+        }
+    },
+    created: function () {
+        $.get("../shipping/queryAll", function (r) {
+            vm.shippings = r.list;
+        });
+    }
+});
+    function getPrintContent(ticket) {
+        var content = "<div style=\"width: 250px;font-family: 微软雅黑;font-size: 8px;\">";
+        //小票头
+        content += "<div style=\"text-align: center;width: 100%;font-weight:bold;font-size: 13px;\">";
+        content += ticket.ticketHead.title;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "会员:" + ticket.ticketHead.memberId;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "订单号:" + ticket.ticketHead.orderId;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "交易时间:" + ticket.ticketHead.tradeTime;
+        content += "</div>";
+        content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
+        //商品信息
+        content += "<table style=\"width: 100%;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
+        content += "<tr>";
+        content += "<td style=\"width: 50%;text-align: left;font-size: 10px;font-weight: bold;\">商品名称</td>";
+        content += "<td style=\"width: 17%;text-align: right;font-size: 10px;font-weight: bold;\">单价</td>";
+        content += "<td style=\"width: 15%;text-align: right;font-size: 10px;font-weight: bold;\">数量</td>";
+        content += "<td style=\"width: 18%;text-align: right;font-size: 10px;font-weight: bold;\">小计</td>";
+        content += "</tr>";
+        content += "</table>";
+        content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
+        content += "<table style=\"width: 100%;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
+        for (var i=0;i< ticket.goods.length;i++){
+            content += "<tr>";
+            content += "<td style=\"width: 50%;text-align: left;font-size: 8px;padding-top: 8px;\">";
+            content += "<table style=\"width: 100%;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
+            content += "<tr>";
+            content += "<td style=\"text-align: left;font-size: 8px;vertical-align:top;\">#</td>";
+            content += "<td style=\"text-align: left;font-size: 8px;\">" + ticket.goods[i].gname + "</td>";
+            content += "</tr>";
+            content += "</table>";
+            content += "</td>";
+            content += "<td style=\"width: 17%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].uprice + "</td>";
+            content += "<td style=\"width: 15%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].num + "</td>";
+            content += "<td style=\"width: 18%;text-align: right;font-size: 8px;vertical-align:bottom;padding-top: 8px;\">" + ticket.goods[i].subtotal + "元</td>";
+            content += "</tr>";
+
+        }
+        content += "</table>";
+        content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
+        //收银信息
+        content += "<div style=\"width: 100%;\">";
+        content += "<span style=\"float: left;width: 50%;text-align: left;\">商品合计:</span>";
+        content += "<span style=\"float: left;width: 17%;text-align: left;\">" + ticket.cashInfo.goodsTotal + "件</span>";
+        content += "<span style=\"float: right;width: 33%;text-align: right;\">" + ticket.cashInfo.total + "元</span>";
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "<span style=\"float: left;width: 50%;text-align: left;\">实收:</span>";
+        content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.receipts + "元</span>";
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "<span style=\"float: left;width: 50%;text-align: left;\">找零:</span>";
+        content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.oddChange + "元</span>";
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "<span style=\"float: left;width: 50%;text-align: left;\">优惠券:</span>";
+        content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.coupon + "元</span>";
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "<span style=\"float: left;width: 50%;text-align: left;\">运费:</span>";
+        content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.freight + "元</span>";
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "<span style=\"float: left;width: 50%;text-align: left;\">支付渠道:</span>";
+        content += "<span style=\"float: right;width: 50%;text-align: right;\">" + ticket.cashInfo.paymentMode + "</span>";
+        content += "</div>";
+        content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
+        //海关清单信息
+        content += "<div style=\"width: 100%;\">";
+        content += "订单号:" + ticket.cusListing.orderId;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "始发地:" + ticket.cusListing.originAddress;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "交货地:" + ticket.cusListing.deliveryAddress;
+        content += "</div>";
+        content += "<div style=\"width: 100%;overflow:hidden;white-space: nowrap;\">--------------------------------------------------</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += ticket.ticketFoot.summary;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "客服电话:" + ticket.ticketFoot.serviceTel;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += "网址:" + ticket.ticketFoot.url1;
+        content += "</div>";
+        content += "<div style=\"width: 100%;\">";
+        content += ticket.ticketFoot.welcome;
+        content += "</div>";
+        return content;
+    }
+    var printAreaCount = 0;
+    function printArea(content) {
+        var idPrefix = "printArea_";
+        removePrintArea(idPrefix + printAreaCount);
+        printAreaCount++;
+        var iframeId = idPrefix + printAreaCount;
+        var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
+        iframe = document.createElement('IFRAME');
+        $(iframe).attr({
+            style: iframeStyle,
+            id: iframeId
+        });
+        document.body.appendChild(iframe);
+        var doc = iframe.contentWindow.document;
+        doc.open();
+        //$(document).find("link").filter(function () {
+            //return $(this).attr("rel").toLowerCase() == "stylesheet";
+        //}).each(
+            //function () {
+                //doc.write('<link type="text/css" rel="stylesheet" href="'
+                    //+ $(this).attr("href") + '" >');
+            //});
+        doc.write('<div class="">' + content
+            + '</div>');
+        doc.close();
+        var frameWindow = iframe.contentWindow;
+        frameWindow.close();
+        frameWindow.focus();
+        frameWindow.print();
+    }
+    var removePrintArea = function (id) {
+        $("iframe#" + id).remove();
+    };

+ 281 - 0
kmall-admin/src/main/webapp/js/shop/scannShop.js

@@ -0,0 +1,281 @@
+$(function () {
+    $("#jqGrid").jqGrid(
+        {
+            datatype : "local",
+            height : 600,
+            width: 1700,
+            rownumbers: true,
+            colNames : [ 'ID', '产品条码','门店', 'SKU', '名称', '零售价格','数量','库存', '商品图'],
+            colModel : [
+                {name : 'id',index : 'id',width : 60,sorttype : "int",hidden: true, key: true},
+                {name : 'prodBarcode',index : 'prodBarcode',width : 80, align: 'center'},
+                {name : 'storeName',index : 'storeName',width : 90, align: 'center'},
+                {name: 'sku', index: 'sku', width: 80, align: 'center'},
+                {name: 'goodsName', index: 'name', width: 160, align: 'center'},
+                {name: 'retailPrice', index: 'retailPrice', width: 60, align: 'center'},
+                {name: 'number', index: 'nums', width: 60, align: 'center'},
+                {name: 'stockNum', index: 'stockNum', width: 60, align: 'center'},
+                {name: 'listPicUrl', index: 'listPicUrl', width: 80, align: 'center'}
+            ],
+            multiselect : true
+     });
+    // $("#jqGrid").jqGrid({
+    //     url: '../goods/scannInfo',
+    //     datatype: "json",
+    //     colModel: [
+    //         {label: 'ID', name: 'id', index: 'id', hidden: true, key: true},
+    //         {label: '商品编码', name: 'goodsSn',index: 'goods_Sn', width: 60, align: 'center'},
+    //         {label: '门店', name: 'storeName', index: 'storeName', width: 60, align: 'center'},
+    //         {label: 'SKU', name: 'sku', index: 'sku', width: 80, align: 'center'},
+    //         {label: '名称', name: 'goodsName', index: 'goodsName', width: 160, align: 'center'},
+    //         {label: '零售价格', name: 'retailPrice', index: 'retail_price', width: 80, align: 'center'},
+    //         {label: '数量', name: 'number', index: 'number', width: 80, align: 'center'},
+    //         {label: '库存', name: 'stockNum', index: 'stockNum', width: 80, align: 'center'},
+    //         {
+    //             label: '商品图', name: 'listPicUrl', index: 'list_pic_url', width: 80, align: 'center',
+    //             formatter: function (value) {
+    //                 return transImg(value);
+    //             }
+    //         }
+    //     ],
+    //     viewrecords: true,
+    //     height: 385,
+    //     rownumbers: true,
+    //     rownumWidth: 25,
+    //     autowidth: true,
+    //     multiselect: true,
+    //     jsonReader: {
+    //         root: "cartEntityList"
+    //     },
+    //     prmNames: {
+    //         page: "page",
+    //         rows: "limit",
+    //         order: "order"
+    //     },
+    //     gridComplete: function () {
+    //         $("#jqGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "hidden"});
+    //     }
+    // });
+});
+
+var ztree;
+
+var setting = {
+    data: {
+        simpleData: {
+            enable: true,
+            idKey: "id",
+            pIdKey: "parentId",
+            rootPId: -1
+        },
+        key: {
+            url: "nourl"
+        }
+    }
+};
+var vm = new Vue({
+    el: '#rrapp',
+    data: {
+        showList: true,
+        title: null,
+        uploadList: [],
+        offlineCartList: [{'id': '', 'prodBarcode': '', 'storeName': '', 'SKU': '', 'goodsName': '', 'retailPrice':'', 'number':'','stockNum':'','listPicUrl':''}],
+        offlineCart:{'id': '', 'prodBarcode': '', 'storeName': '', 'SKU': '', 'goodsName': '', 'retailPrice':'', 'number':'','stockNum':'','listPicUrl':''},
+        imgName: '',
+        visible: false,
+        ruleValidate: {
+        },
+        q: {prodBarcode: ''},
+        goodsTotalPrice:0,
+        applyPrice:0,
+        idList:[],
+        count:0
+    },
+    methods: {
+        reloadSearch: function () {
+            vm.q = {
+                prodBarcode: ''
+            }
+        },
+        query: function () {
+            vm.reload(1);
+        },
+        getInfo: function (event) {
+            var ids = getSelectedRows();
+            if (ids == null) {
+                return;
+            }
+            vm.offlineCartList = [];
+            var totalPrice =0;
+            for(var i = 0;i < ids.length ;i ++) {
+                var rowData = $("#jqGrid").jqGrid('getRowData', ids[i]);
+                vm.offlineCartList.push(rowData);
+                totalPrice = (rowData.number * rowData.retailPrice)+totalPrice;
+            }
+            totalPrice = totalPrice.toFixed(2);
+            vm.goodsTotalPrice = totalPrice;
+            vm.applyPrice = totalPrice;
+            console.log('合计后的总和:'+vm.goodsTotalPrice);
+
+            for(var i = 0;i < vm.offlineCartList.length ;i ++) {
+                vm.offlineCartList[i].listPicUrl ='';
+            }
+            $.ajax({
+                type: "POST",
+                url: "../offlinecart/infoList",
+                dataType: "json",
+                contentType: "application/json",
+                data: JSON.stringify(vm.offlineCartList),
+                success: function (r) {
+                    if (r.code == 0) {
+                        vm.offlineCartList = r.list;
+                        vm.showList = false;
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+
+            // vm.showList = false;
+            vm.title = "预订单生成";
+        },
+        reload: function (event) {
+            vm.showList = true;
+            // let page = event;
+            // if (event != 1) {
+            //     page = $("#jqGrid").jqGrid('getGridParam', 'page');
+            // }
+            // $("#jqGrid").jqGrid('setGridParam', {
+            //     postData: {
+            //         'goodsSn': vm.q.goodsSn
+            //     }
+            // }).trigger("reloadGrid");
+            $.get("../goods/scannInfo/" + vm.q.prodBarcode, function (r) {
+                if (r.code === 0) {
+                    vm.goods = r.goods;
+                    var mydata = {id : vm.goods.id,prodBarcode : vm.goods.prodBarcode,storeName:vm.goods.storeName,sku : vm.goods.sku,goodsName : vm.goods.name,
+                            retailPrice : vm.goods.retailPrice,number:1,stockNum : vm.goods.stockNum,listPicUrl : transImg(vm.goods.listPicUrl)};
+                    vm.count = vm.count+1;
+                    // var ids = $("#jqGrid").jqGrid('getDataIDs');
+                    // if(ids!=""){
+                    //     vm.idList = ids.split(",");
+                    //     ids = vm.idList[vm.idList.length];
+                    //     console.log("ids2:"+ids);
+                    // }
+                    // console.log("ids4:"+ids);
+                    var rowid = parseInt(vm.count);
+                    $("#jqGrid").jqGrid('addRowData', rowid, mydata, "last");
+                    vm.q = {
+                        prodBarcode: ''
+                    };
+                } else {
+                    alert(r.msg);
+                }
+            });
+
+
+        },
+        back: function (event) {
+            vm.showList = true;
+            $.ajax({
+                type: "POST",
+                url: "../offlinecart/deleteByUserId",
+                contentType: "application/json",
+                success: function (r) {
+                    if (r.code == 0) {
+                        vm.q = {
+                            prodBarcode: ''
+                        };
+                        jQuery("#jqGrid").jqGrid("clearGridData");
+                        $("#cb_jqGrid").click();
+                    }
+                }
+            });
+        },
+        orderSubmit: function (event) {
+            var url = "../order/orderSubmit";
+            $.ajax({
+                type: "POST",
+                url: url,
+                dataType: "json",
+                contentType: "application/json",
+                data: JSON.stringify(vm.offlineCartList),
+                success: function (r) {
+                    if (r.code === 0) {
+                        alert('订单生成成功,请到线下订单页面中操作待付款单', function (index) {
+                            vm.showList = true;
+                            vm.q = {
+                                prodBarcode: ''
+                            };
+                            jQuery("#jqGrid").jqGrid("clearGridData");
+                            $("#cb_jqGrid").click();
+                        });
+                    } else {
+                        alert(r.msg);
+                    }
+                }
+            });
+        },
+        handleSubmit: function (name) {
+            vm.orderSubmit();
+        },
+        removeData: function () {
+        //     var ids = getSelectedRows();
+        //     if (ids == null) {
+        //         return;
+        //     }
+        //     confirm('确定要删除选中的记录?', function () {
+        //         $.ajax({
+        //             type: "POST",
+        //             url: "../offlinecart/delete",
+        //             contentType: "application/json",
+        //             data: JSON.stringify(ids),
+        //             success: function (r) {
+        //                 if (r.code == 0) {
+        //                     alert('操作成功', function (index) {
+        //                         vm.q = {
+        //                             goodsSn: ''
+        //                         }
+        //                         $("#jqGrid").jqGrid('setGridParam', {
+        //                             postData: {
+        //                                 'goodsSn': ''
+        //                             }
+        //                         }).trigger("reloadGrid");
+        //                     });
+        //                 } else {
+        //                     alert(r.msg);
+        //                 }
+        //             }
+        //         });
+        //     });
+            var selectedRowIds = $("#jqGrid").jqGrid("getGridParam","selarrrow");
+            if(!selectedRowIds){
+                alert("请选择要删除的行");
+                return;
+            }else{
+                var len = selectedRowIds.length;
+                for(var i = 0;i < len ;i ++) {
+                    $("#jqGrid").jqGrid("delRowData", selectedRowIds[0]);
+                }
+            }
+        },
+        getTotal:function () {
+
+            $("#cb_jqGrid").click();
+
+            // var totalPrice =0;
+            // var ids = $("#jqGrid").jqGrid('getGridParam', 'selarrrow');//获取 多行数据
+            // for(var i = 0;i < ids.length ;i ++) {
+            //     var rowData = $("#jqGrid").jqGrid('getRowData', ids[i]);
+            //     totalPrice = (rowData.nums * rowData.retailPrice)+totalPrice;
+            // }
+            // vm.goodsTotalPrice = totalPrice;
+            // vm.applyPrice = totalPrice;
+        }
+    },
+    mounted() {
+        // $.get("../store/queryAll", function (r) {
+        //     vm.stores = r.list;
+        // });
+    }
+});

+ 3 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiPayController.java

@@ -8,6 +8,7 @@ import com.kmall.api.entity.*;
 import com.kmall.api.service.*;
 import com.kmall.api.service.pay.wxpay.WxPayPropertiesBuilder;
 import com.kmall.api.util.ApiBaseAction;
+import com.kmall.api.util.CommonUtil;
 import com.kmall.common.utils.CharUtil;
 import com.kmall.common.utils.Constant;
 import com.kmall.common.utils.MapUtils;
@@ -87,7 +88,8 @@ public class ApiPayController extends ApiBaseAction {
             //如此次是单笔支付,则判断下单时该商户订单是否是拆单订单,如果都满足,则更新商户订单号,生成新的预支付信息
             if(Dict.isMergePay.item_0.getItem().equalsIgnoreCase(isMergePay)) {
                 if ("2".equalsIgnoreCase(orderInfo.getIsMergePay())) {//多笔订单单笔支付,则商户订单号,生成新的预支付信息
-                    merchOrderSn = "EMATO" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
+//                    merchOrderSn = "EMATO" + new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
+                    merchOrderSn = "EMATO"+ CommonUtil.generateOrderNumber();
                     orderInfo.setMerchOrderSn(merchOrderSn);
                 }
             }

+ 32 - 0
kmall-api/src/main/java/com/kmall/api/contants/Dict.java

@@ -574,4 +574,36 @@ public class Dict {
             this.itemName = itemName;
         }
     }
+
+    /**
+     *  是否线下订单:0:线上购买 1:线下购买
+     */
+    public enum isOnfflineOrder {
+        item_0("0", "线上购买"),
+        item_1("1", "线下购买");
+
+        private String item;
+        private String itemName;
+
+        isOnfflineOrder(String item, String itemName) {
+            this.item = item;
+            this.itemName = itemName;
+        }
+
+        public String getItem() {
+            return item;
+        }
+
+        public void setItem(String item) {
+            this.item = item;
+        }
+
+        public String getItemName() {
+            return itemName;
+        }
+
+        public void setItemName(String itemName) {
+            this.itemName = itemName;
+        }
+    }
 }

+ 11 - 0
kmall-api/src/main/java/com/kmall/api/entity/OrderVo.java

@@ -173,6 +173,17 @@ public class OrderVo implements Serializable {
 
     private String isCreatePayId;
 
+    private String isOnfflineOrder;
+
+    public String getIsOnfflineOrder() {
+        return isOnfflineOrder;
+    }
+
+    public void setIsOnfflineOrder(String isOnfflineOrder) {
+        this.isOnfflineOrder = isOnfflineOrder;
+    }
+
+
     public String getIsCreatePayId() {
         return isCreatePayId;
     }

+ 5 - 3
kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java

@@ -150,7 +150,7 @@ public class ApiOrderService {
         String postscript00 = jsonParam.getString("postscript00");
         String postscript02 = jsonParam.getString("postscript02");
         String postscript10 = jsonParam.getString("postscript10");
-        String postscript11 = jsonParam.getString("postscript11");
+        String postscript11 = jsonParam.getString("postscript11");//留言备注
         UserVo user = apiUserMapper.queryObjectByIdNoAndName(idNo, userName);
         UserVo userVo = new UserVo();
         userVo.setId(loginUser.getId());
@@ -239,7 +239,7 @@ public class ApiOrderService {
         }
 
         List<OrderVo> orderInfoList = new ArrayList();
-        String merchOrderSn = "EMATO"+new SimpleDateFormat("yyyyMMddhhmmss").format(new Date());
+        String merchOrderSn = "EMATO"+CommonUtil.generateOrderNumber();
         if(isBizType00){
             OrderVo order00 = setOrderVo(loginUser,jsonParam,storeId,freightPrice00,checkedGoodsList,Dict.orderBizType.item_00.getItem());
             order00.setOrderBizType(Dict.orderBizType.item_00.getItem());
@@ -415,7 +415,8 @@ public class ApiOrderService {
         //商户(拼音首字母)+业务类型+编号
         String merchSn = OmsMerchPropertiesBuilder.instance().getMerchSn();
         String merchShortName = OmsMerchPropertiesBuilder.instance().getMerchShortName();
-        String orderSn = merchShortName + bizType + CommonUtil.generateOrderNumber();
+        String supplier = "";//供货商标识
+        String orderSn = merchShortName + supplier + bizType + CommonUtil.generateOrderNumber();
         orderInfo.setOrder_sn(orderSn);
         orderInfo.setMerchSn(merchSn);
 
@@ -465,6 +466,7 @@ public class ApiOrderService {
 
         orderInfo.setPayMobile(userVo.getMobile());
         orderInfo.setPay_name(userVo.getUsername());
+        orderInfo.setIsOnfflineOrder(Dict.isOnfflineOrder.item_0.getItem());
 
         //标记该订单已使用优惠券
         if(couponVo != null){

+ 12 - 3
kmall-api/src/main/resources/mybatis/mapper/ApiOrderMapper.xml

@@ -69,6 +69,7 @@
         <result property="refundStatus" column="refund_status"/>
         <result property="approvalRemark" column="approval_remark"/>
         <result property="isMergePay" column="is_merge_pay"/>
+        <result property="isOnfflineOrder" column="is_onffline_order"/>
     </resultMap>
 
     <select id="queryObject" resultMap="orderMap">
@@ -241,6 +242,9 @@
         <if test="buyerPayCheck != null" >
             buyer_pay_check,
         </if>
+        <if test="isOnfflineOrder != null" >
+            `is_onffline_order`,
+        </if>
         <if test="payFlag != null" >
             pay_flag,
         </if>
@@ -321,6 +325,9 @@
         <if test="buyerPayCheck != null" >
             #{buyerPayCheck,jdbcType=VARCHAR},
         </if>
+        <if test="isOnfflineOrder != null" >
+            #{isOnfflineOrder,jdbcType=VARCHAR},
+        </if>
         <if test="payFlag != null" >
             #{payFlag,jdbcType=VARCHAR},
         </if>
@@ -390,10 +397,11 @@
         `coupon_name`,
         `comment_count`,
          merch_sn,
-        merch_order_sn,
-        is_scan,
-        is_merge_pay,
+         merch_order_sn,
+         is_scan,
+         is_merge_pay,
          order_biz_type,
+        `is_onffline_order`,
          pay_transaction_id,
          pay_mobile,
          create_time,
@@ -445,6 +453,7 @@
             #{orderInfo.isScan,jdbcType=VARCHAR},
             #{orderInfo.isMergePay},
             #{orderInfo.orderBizType,jdbcType=CHAR},
+            #{orderInfo.isOnfflineOrder},
             #{orderInfo.payTransactionId,jdbcType=VARCHAR},
             #{orderInfo.payMobile,jdbcType=VARCHAR},
             #{orderInfo.createTime,jdbcType=TIMESTAMP},

+ 7 - 6
kmall-schedule/src/main/resources/mybatis/mapper/QzOrderMapper.xml

@@ -28,14 +28,14 @@
         AND c.store_id = a.store_id
         WHERE 1 = 1
         AND a.add_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -15 MINUTE)
-        AND a.order_status in (0,100) and a.order_type = 1
+        AND a.order_status in (0,100) and a.order_type = 1 AND a.is_onffline_order = 0
     </select>
     <update id="unpayPastUpdate">
         UPDATE mall_order a
         SET order_status=101,shipping_status=0,pay_status=0
         WHERE 1 = 1
         AND a.add_time <![CDATA[ <  ]]> DATE_ADD(now(),INTERVAL -15 MINUTE)
-        AND a.order_status = 0  and a.order_type = 1
+        AND a.order_status = 0  and a.order_type = 1  AND a.is_onffline_order = 0
     </update>
 
     <update id="updateStockNum" parameterType="map">
@@ -52,7 +52,7 @@
         from mall_order a
         inner join mall_order_refund f on a.id = f.order_id	where (f.out_refund_no is null or f.refund_id is null
         or f.refund_time is null or f.wechat_refund_status_des is null) and a.order_status = '401' and f.refund_status
-        in (2,5)
+        in (2,5)  AND a.is_onffline_order = 0
     </select>
 
     <select id="queryPayingOrderList" resultType="map">
@@ -63,6 +63,7 @@
         LEFT JOIN mall_product_store_rela c ON b.product_id = c.product_id
         AND c.store_id = a.store_id  where (a.order_status in ('100','201') and a.pay_status in (1,2))
         and (a.pay_transaction_id = '' or a.pay_transaction_id is null or a.pay_time is null or a.pay_time = '')
+        AND a.is_onffline_order = 0
     </select>
 
 
@@ -95,12 +96,12 @@
     <select id="queryShipmentOrderList" resultType="map">
         SELECT a.order_sn,a.order_status,a.pay_status,a.id 'orderId',a.merch_order_sn,date_format(r.customs_succ_time,'%Y-%m-%d %H:%i:%s') as customs_succ_time
         FROM `mall_order` a inner join mall_order_process_record r on a.order_sn=r.order_sn where order_status='300'
-        and shipping_status ='1' and a.order_biz_type in(10,02) AND r.customs_succ_time <![CDATA[ <  ]]>  DATE_ADD(now(),INTERVAL -7 DAY)
+        and shipping_status ='1' and a.order_biz_type in(10,02) AND r.customs_succ_time <![CDATA[ <  ]]>  DATE_ADD(now(),INTERVAL -7 DAY)  AND a.is_onffline_order = 0
     </select>
     <select id="queryShipmentBondedOrderList" resultType="map">
         SELECT a.order_sn,a.order_status,a.pay_status,a.id 'orderId',a.merch_order_sn,date_format(r.shipment_succ_time,'%Y-%m-%d %H:%i:%s') as shipment_succ_time
         FROM `mall_order` a inner join mall_order_process_record r on a.order_sn=r.order_sn where order_status='300' and shipping_status ='1'
-        and a.order_biz_type in(00,11) AND r.shipment_succ_time <![CDATA[ <  ]]>  DATE_ADD(now(),INTERVAL -7 DAY)
+        and a.order_biz_type in(00,11) AND r.shipment_succ_time <![CDATA[ <  ]]>  DATE_ADD(now(),INTERVAL -7 DAY)  AND a.is_onffline_order = 0
     </select>
 
     <update id="updateShipmentOrder" parameterType="map">
@@ -110,7 +111,7 @@
     <select id="queryReceiptOrderList" resultType="map">
         select o.user_id 'userId',o.id 'orderId',g.product_id'productId',g.goods_specification_name_value 'goodsSpecificationNameValue', g.goods_id 'goodsId',
         g.goods_name 'goodsName',confirm_time FROM `mall_order` o inner join mall_order_goods g on o.id = g.order_id
-        where order_status='301' and shipping_status ='2' and comment_count=0 AND confirm_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -30 DAY)
+        where order_status='301' and shipping_status ='2' and comment_count=0 AND confirm_time <![CDATA[ < ]]> DATE_ADD(now(),INTERVAL -30 DAY)  AND o.is_onffline_order = 0
     </select>
 
     <update id="updateReceiptOrderByCommentCount">