Przeglądaj źródła

Merge remote-tracking branch 'origin/developerD' into developer

huangzhiguo 2 lat temu
rodzic
commit
d821a9365d

+ 10 - 7
src/main/java/com/caimei365/order/components/OrderCommonService.java

@@ -82,9 +82,9 @@ public class OrderCommonService {
             // 冷链商品判定
             List<Integer> collect = orderProductList.stream().map(OrderProductVo::getProductId).collect(Collectors.toList());
             collect.removeIf(c -> c == 999);
-            if (collect.stream().allMatch(c -> c == 7881)) {
+            if (collect.stream().allMatch(c -> c == 7536)) {
                 arrList.add(1);
-            } else if (!collect.contains(7881)) {
+            } else if (!collect.contains(7536)) {
                 arrList.add(2);
             } else {
                 arrList.add(3);
@@ -241,7 +241,7 @@ public class OrderCommonService {
      */
     public void setShopOrderStatus(ShopOrderVo shopOrderVo) {
         // 11, 待付待收待发
-        if (1 == shopOrderVo.getStatus() ) {
+        if (1 == shopOrderVo.getStatus() && 1 == shopOrderVo.getOrderStatusFlag() && 1 == shopOrderVo.getRefundStatus()) {
             if ( 1 == shopOrderVo.getReceiptStatus() && 1 == shopOrderVo.getSendOutStatus()){
                 shopOrderVo.setStatus(11);
             } else if ( 1 == shopOrderVo.getReceiptStatus() && 2 == shopOrderVo.getSendOutStatus()) {
@@ -267,6 +267,9 @@ public class OrderCommonService {
         if (5 == shopOrderVo.getStatus() && logisticsCount > 0) {
             shopOrderVo.setStatus(6);
         }
+        if (1 != shopOrderVo.getOrderStatusFlag() || 1 != shopOrderVo.getRefundStatus()) {
+            shopOrderVo.setStatus(5);
+        }
     }
 
     /**
@@ -289,9 +292,9 @@ public class OrderCommonService {
             // 冷链商品判定
             List<Integer> collect = orderProductList.stream().map(OrderProductVo::getProductId).collect(Collectors.toList());
             collect.removeIf(c -> c == 999);
-            if (collect.stream().allMatch(c -> c == 7881)) {
+            if (collect.stream().allMatch(c -> c == 7536)) {
                 arrList.add(1);
-            } else if (!collect.contains(7881)) {
+            } else if (!collect.contains(7536)) {
                 arrList.add(2);
             } else {
                 arrList.add(3);
@@ -454,9 +457,9 @@ public class OrderCommonService {
         // 冷链商品判定
         List<Integer> collect = orderProductList.stream().map(OrderProductVo::getProductId).collect(Collectors.toList());
         collect.removeIf(c -> c == 999);
-        if (collect.stream().allMatch(c -> c == 7881)) {
+        if (collect.stream().allMatch(c -> c == 7536)) {
             arrList.add(1);
-        } else if (!collect.contains(7881)) {
+        } else if (!collect.contains(7536)) {
             arrList.add(2);
         } else {
             arrList.add(3);

+ 2 - 2
src/main/java/com/caimei365/order/components/ProductService.java

@@ -217,9 +217,9 @@ public class ProductService {
         }
         // 是否包含需要冷链运输商品
         List<Integer> collect = postageFlagList.stream().map(ProductPostageVo::getProductId).collect(Collectors.toList());
-        if (collect.stream().allMatch(c -> c == 7881)) {
+        if (collect.stream().allMatch(c -> c == 7536)) {
             postageMap.put("designatedFlag", 1);
-        } else if (!collect.contains(7881)) {
+        } else if (!collect.contains(7536)) {
             postageMap.put("designatedFlag", 2);
         } else {
             postageMap.put("designatedFlag", 3);

+ 23 - 0
src/main/java/com/caimei365/order/controller/CartSellerApi.java

@@ -72,6 +72,29 @@ public class CartSellerApi {
         return cartSellerService.getSellerCartList(serviceProviderId, clubId, againBuyProductIds, pageNum, pageSize);
     }
 
+    /**
+     * 协销购物车列表数据 -- 组织
+     */
+    @ApiOperation("协销购物车列表数据 -- 组织")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, name = "serviceProviderId", value = "协销Id"),
+            @ApiImplicitParam(required = true, name = "clubId", value = "机构Id"),
+            @ApiImplicitParam(required = false, name = "pageNum", value = "页码"),
+            @ApiImplicitParam(required = false, name = "pageSize", value = "每页数量")
+    })
+    @GetMapping("/cart/organizeList")
+    public ResponseJson<Map<String, Object>> getShoppingOrganizeCarts(Integer serviceProviderId, Integer clubId,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+        if (null == serviceProviderId) {
+            return ResponseJson.error("协销Id不能为空!", null);
+        }
+        if (null == clubId) {
+            return ResponseJson.error("机构Id不能为空!", null);
+        }
+        return cartSellerService.getSellerCartOrganizeList(serviceProviderId, clubId, pageNum, pageSize);
+    }
+
     /**
      * 获取协销购物车商品种类
      */

+ 7 - 0
src/main/java/com/caimei365/order/mapper/CartSellerMapper.java

@@ -30,6 +30,13 @@ public interface CartSellerMapper {
      * @param shopId             供应商Id
      */
     List<CartItemVo> getSellerCartProducts(Integer serviceProviderId, Integer clubId, Integer shopId);
+    /**
+     * 协销购物车供应商下商品列表 -- 组织
+     * @param serviceProviderId  协销Id
+     * @param clubId             机构Id
+     * @param shopId             供应商Id
+     */
+    List<CartItemVo> getSellerCartOrganizeProducts(Integer serviceProviderId, Integer clubId, Integer shopId);
 
     /**
      * 获取协销购物车商品种类

+ 4 - 0
src/main/java/com/caimei365/order/model/vo/ShopOrderVo.java

@@ -286,6 +286,10 @@ public class ShopOrderVo implements Serializable {
      * (收款买家)收款状态:1待收款、2部分收款、3已收款
      */
     private Integer receiptStatus;
+    /**
+     * 订单状态标识,1:非退货退款订单、2:退货退款中、3退货退款完成
+     */
+    private Integer orderStatusFlag;
     /**
      * 退款状态:1无退款、3有退款
      */

+ 9 - 0
src/main/java/com/caimei365/order/service/CartSellerService.java

@@ -26,6 +26,15 @@ public interface CartSellerService {
      */
     ResponseJson<Map<String, Object>> getSellerCartList(Integer serviceProviderId, Integer clubId, String againBuyProductIds, int pageNum, int pageSize);
 
+    /**
+     * 协销购物车列表数据 -- 组织
+     * @param serviceProviderId 协销Id
+     * @param clubId            机构Id
+     * @param pageNum            页码
+     * @param pageSize           每页数量
+     */
+    ResponseJson<Map<String, Object>> getSellerCartOrganizeList(Integer serviceProviderId, Integer clubId, int pageNum, int pageSize);
+
     /**
      * 获取协销购物车商品种类
      * @param serviceProviderId 协销Id

+ 5 - 5
src/main/java/com/caimei365/order/service/impl/CartClubServiceImpl.java

@@ -863,7 +863,7 @@ public class CartClubServiceImpl implements CartClubService {
         if (null != cartList && cartList.size() > 0) {
 
             cartList.removeIf(cartItemVo ->
-                    cartItemVo.getValidFlag() == 2
+                    cartItemVo.getValidFlag() == 3
             );
             return ResponseJson.success(cartList.size());
         } else {
@@ -1048,7 +1048,7 @@ public class CartClubServiceImpl implements CartClubService {
                         // 迭代器设置商品信息
                         for (CartItemVo cartItemVo : productList) {
                             // 设置商品运费
-                            if (7881 == cartItemVo.getProductId()) {
+                            if (7536 == cartItemVo.getProductId()) {
                                 if (cartItemVo.getNumber() >= 100) {
                                     coldChain = 0d;
                                 } else {
@@ -1341,7 +1341,7 @@ public class CartClubServiceImpl implements CartClubService {
             double coldChain = 0.00d;
             if (null != totalProductList) {
                 for (CartItemVo cart :totalProductList) {
-                    if (7881 == cart.getProductId()) {
+                    if (7536 == cart.getProductId()) {
                         if (cart.getNumber() >= 100) {
                             coldChain = 0.00d;
                         } else {
@@ -1502,7 +1502,7 @@ public class CartClubServiceImpl implements CartClubService {
                         for (CartItemVo cartItemVo : productList) {
                             // 设置商品运费
                             if (null != townId) {
-                                if (7881 == cartItemVo.getProductId()) {
+                                if (7536 == cartItemVo.getProductId()) {
                                     if (cartItemVo.getNumber() >= 100) {
                                         coldChain = 0d;
                                     } else {
@@ -1986,7 +1986,7 @@ public class CartClubServiceImpl implements CartClubService {
             shop.setPostageFlag((Integer) postageMap.get("postageFlag"));
             shop.setUserBeans((Integer) postageMap.get("userBeans"));
             shop.setDesignatedFlag((Integer) postageMap.get("designatedFlag"));
-            if (7881 == cartItemVo.getProductId()) {
+            if (7536 == cartItemVo.getProductId()) {
                 if (cartItemVo.getNumber() >= 100) {
                     coldChain = 0d;
                 } else {

+ 83 - 1
src/main/java/com/caimei365/order/service/impl/CartSellerServiceImpl.java

@@ -13,6 +13,7 @@ import com.caimei365.order.model.dto.SellerCartDto;
 import com.caimei365.order.model.po.SellerCartPo;
 import com.caimei365.order.model.vo.*;
 import com.caimei365.order.service.CartSellerService;
+import com.caimei365.order.utils.ImageUtil;
 import com.caimei365.order.utils.MathUtil;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
@@ -303,6 +304,87 @@ public class CartSellerServiceImpl implements CartSellerService {
         return ResponseJson.success(resultMap);
     }
 
+    /**
+     * 协销购物车列表数据 -- 组织
+     *
+     * @param serviceProviderId 协销Id
+     * @param clubId            机构Id
+     * @param pageNum           页码
+     * @param pageSize          每页数量
+     */
+    @Override
+    public ResponseJson<Map<String, Object>> getSellerCartOrganizeList(Integer serviceProviderId, Integer clubId, int pageNum, int pageSize) {
+        List<Integer> againBuyIdList = Lists.newArrayList();
+        // 失效商品列表(总)
+        List<CartItemVo> invalidList = new ArrayList<>();
+        // 开始分页请求供应商数据
+        PageHelper.startPage(pageNum, pageSize);
+        log.info("serviceProviderId, clubId"+serviceProviderId+"---"+clubId);
+        // 协销购物车供应商列表
+        List<CartShopVo> shopInfoList = cartSellerMapper.getSellerCartShops(serviceProviderId, clubId);
+        if (null != shopInfoList && shopInfoList.size() > 0) {
+            shopInfoList.removeIf(Objects::isNull);
+            // 遍历供应商列表
+            shopInfoList.forEach(shop -> {
+                // 默认未选中状态(前端要求)
+                shop.setIsChecked(false);
+                // 该供应商下商品种类
+                AtomicInteger shopKindCount = new AtomicInteger(0);
+                // 该供应商总价
+                AtomicDouble shopPrice = new AtomicDouble(0);
+
+                // 供应商下商品列表
+                List<CartItemVo> productList = cartSellerMapper.getSellerCartOrganizeProducts(serviceProviderId, clubId, shop.getShopId());
+                // 迭代器设置商品信息
+                Iterator<CartItemVo> productIterator = productList.iterator();
+                while (productIterator.hasNext()) {
+                    CartItemVo cartItemVo = productIterator.next();
+                    // 设置商品图片及税费
+                    productService.setCartItemImgAndTax(cartItemVo);
+                    // 默认所有商品未选中状态(前端要求)
+                    cartItemVo.setIsChecked(false);
+                    // 设置skus
+                    cartItemVo.setSkus(orderClubMapper.getOrganizeSku(cartItemVo.getProductId()));
+                    if (cartItemVo.getValidFlag() != 2) {
+                        // 后台逻辑删除,已停售
+                        cartItemVo.setStatus(1);
+                        invalidList.add(cartItemVo);
+                    } else {
+                        // 设置商品有效
+                        cartItemVo.setStatus(0);
+
+                        // 再来一单的商品前端默认勾选
+                        if (againBuyIdList.contains(cartItemVo.getProductId())) {
+                            cartItemVo.setIsChecked(true);
+                        }
+                        // 该供应商下商品种类 +1
+                        shopKindCount.incrementAndGet();
+                    }
+                }
+                // 供应商商品
+                shop.setCartList(productList);
+                // 供应商总价
+                shop.setTotalPrice(shopPrice.get());
+                // 供应商下商品种类
+                shop.setCount(shopKindCount.get());
+            });
+            // 删除空数据
+            shopInfoList.removeIf(shop -> (null == shop || shop.getCount() == 0));
+        }
+        if (null == shopInfoList) {
+            shopInfoList = new ArrayList<>();
+        }
+        PageInfo<CartShopVo> pageInfo = new PageInfo(shopInfoList);
+        /*
+         * 返回结果
+         */
+        Map<String, Object> resultMap = new HashMap<>(2);
+        resultMap.put("pageDate", pageInfo);
+        resultMap.put("invalidProductList", invalidList);
+        // 返回数据
+        return ResponseJson.success(resultMap);
+    }
+
     /**
      * 获取协销购物车商品种类
      *
@@ -506,7 +588,7 @@ public class CartSellerServiceImpl implements CartSellerService {
                 AtomicDouble coldChain = new AtomicDouble(0);
                 if (null != productList && productList.size() > 0) {
                     for (CartItemVo cartItemVo : productList) {
-                        if (7881 == cartItemVo.getProductId()) {
+                        if (7536 == cartItemVo.getProductId()) {
                             if (cartItemVo.getNumber() >= 100) {
                                 coldChain.set(0);
                             } else {

+ 6 - 0
src/main/java/com/caimei365/order/service/impl/OrderClubServiceImpl.java

@@ -200,6 +200,11 @@ public class OrderClubServiceImpl implements OrderClubService {
             orderCommonService.setShopOrderInfo(shopOrder);
             // 设置付款金额
             orderCommonService.getDiscernReceiptAndSetShoporder(shopOrder);
+            if ((4 != shopOrder.getStatus() && 5 != shopOrder.getStatus()) && ((1 == shopOrder.getReceiptStatus() && (2 == shopOrder.getOnlinePay() || 0 == shopOrder.getOnlinePay())) || (2 == shopOrder.getReceiptStatus() && 2 == shopOrder.getOnlinePay()))) {
+                shopOrder.setCheckFlag(2);
+            } else {
+                shopOrder.setCheckFlag(1);
+            }
         });
         //不是协销,订单不可见屏蔽
         if (identity != 1) {
@@ -1039,6 +1044,7 @@ public class OrderClubServiceImpl implements OrderClubService {
         } else {
             loginData = remoteCallService.appletsOrganizeAuthorization(code, encryptedData, iv, headers, userId);
         }
+        log.info("loginData====="+loginData);
         if (StringUtils.isEmpty(loginData)) {
             return ResponseJson.error("微信授权登录异常!", null);
         }

+ 1 - 0
src/main/java/com/caimei365/order/service/impl/RemoteCallServiceImpl.java

@@ -162,6 +162,7 @@ public class RemoteCallServiceImpl implements RemoteCallService {
             } else {
                 jsonStr = userFeign.appletsAuthorization(code, encryptedData, iv, referer);
             }
+            log.info("jsonStr======"+jsonStr);
             JSONObject parseObject = JSONObject.parseObject(jsonStr);
             if (0 == parseObject.getInteger("code") || -4 == parseObject.getInteger("code")) {
                 // 授权登录成功(游客-4)

+ 5 - 11
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -592,7 +592,7 @@ public class SubmitServiceImpl implements SubmitService {
                 }
                 // 联合丽格冷链费商品
                 if (1 == isColdChinaShop) {
-                    if (7881 == product.getProductId()) {
+                    if (7536 == product.getProductId()) {
                         if (productNum >= 100) {
                             shopIsColdChina.set(0.00d);
                         } else {
@@ -1198,15 +1198,9 @@ public class SubmitServiceImpl implements SubmitService {
         // 订单总额(商品金额+运费)-- 冷链运输费
         mainOrder.setPayTotalFee(payTotalFee.get());
         // 订单状态
-        if (0 == organizeId) {
-            if (3 == orderParamBo.getCartType()) {
-                // 协销 状态为 待确认
-                mainOrder.setStatus(0);
-            } else {
-                // 机构用户 状态为 待收待发
-                mainOrder.setStatus(11);
-                mainOrder.setConfirmTime(curDateStr);
-            }
+        if (3 == orderParamBo.getCartType()) {
+            // 协销 状态为 待确认
+            mainOrder.setStatus(0);
         } else {
             // 机构用户 状态为 待收待发
             mainOrder.setStatus(11);
@@ -2052,7 +2046,7 @@ public class SubmitServiceImpl implements SubmitService {
                 // 统计 总金额 包括税费
                 shopProductFee.set(MathUtil.add(shopProductFee.get(), product.getRealProductFee()).doubleValue());
                 // 再勾选冷链费时
-                if (1 == oldShop.get(0).getIsColdChina() && product.getProductId() == 7881) {
+                if (1 == oldShop.get(0).getIsColdChina() && product.getProductId() == 7536) {
                     isColdChina.set(MathUtil.add(isColdChina.get(), 700).doubleValue());
                 }
                 // 商品总金额

+ 0 - 1
src/main/resources/mapper/BaseMapper.xml

@@ -312,7 +312,6 @@
         FROM product p
                  LEFT JOIN cm_sku cs on cs.productId = p.productID
         WHERE cs.skuId = #{skuId}
-          and cs.organizeId = 0
     </select>
     <select id="getClauseList" resultType="com.caimei365.order.model.vo.ClauseVo">
         SELECT id,

+ 1 - 1
src/main/resources/mapper/CartClubMapper.xml

@@ -421,7 +421,7 @@
     <select id="getUserInvoice" resultType="com.caimei365.order.model.vo.InvoiceVo">
         SELECT id,
                type,
-               headingType,
+               ifnull(headingType, 0) as headingType,
                userId,
                invoiceTitle,
                corporationTaxNum,

+ 34 - 1
src/main/resources/mapper/CartSellerMapper.xml

@@ -49,6 +49,39 @@
           and cs.organizeId = 0
         ORDER BY c.id DESC
     </select>
+    <select id="getSellerCartOrganizeProducts" resultType="com.caimei365.order.model.vo.CartItemVo">
+        SELECT c.id,
+               c.skuId,
+               c.num                        AS number,
+               cs.productId,
+               p.shopId,
+               p.`name`                     AS `name`,
+               p.mainImage                  AS image,
+               p.productCode,
+               cs.price,
+               cs.price                     AS originalPrice,
+               cs.unit                      AS unit,
+               cs.stock                     AS stock,
+               p.step                       AS step,
+               cs.minBuyNumber              AS min,
+               p.priceFlag,
+               cs.ladderPriceFlag           AS ladderFlag,
+               p.includedTax                AS includedTax,
+               p.invoiceType                AS invoiceType,
+               p.taxPoint                   AS taxRate,
+               p.productCategory,
+               copi.validFlag                  AS validFlag,
+               p.productType
+        FROM bp_order_product_cart c
+                 LEFT JOIN cm_sku cs on c.skuId = cs.skuId
+                 LEFT JOIN product p ON cs.productId = p.productID
+                 LEFT JOIN cm_organize_product_info copi ON copi.productId = p.productId
+        WHERE c.serviceProviderId = #{serviceProviderId}
+          AND c.clubId = #{clubId}
+          AND c.shopID = #{shopId}
+          AND copi.organizeId = 4
+        ORDER BY c.id DESC
+    </select>
     <select id="getSellerCartCount" resultType="java.lang.Integer">
         SELECT COUNT(*)
         FROM bp_order_product_cart
@@ -157,7 +190,7 @@
         LEFT JOIN cm_sku cs ON c.skuId = cs.skuId
         LEFT JOIN product p ON cs.productId = p.productID
         LEFT JOIN cm_svip_product csp ON cs.productID = csp.productId
-        WHERE c.serviceProviderId = #{serviceProviderId} AND c.clubId = #{clubId} AND c.shopID = #{shopId} and cs.organizeId = 0
+        WHERE c.serviceProviderId = #{serviceProviderId} AND c.clubId = #{clubId} AND c.shopID = #{shopId}
         AND c.skuId in
         <foreach collection="skuIds" open="(" separator="," close=")" item="skuId">
             #{skuId}

+ 18 - 9
src/main/resources/mapper/OrderClubMapper.xml

@@ -286,6 +286,8 @@
             co.clauseID AS clauseId,
             co.invoiceFlag,
             ifnull(cso.receiptStatus, 1) as receiptStatus,
+            ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+            ifnull(cso.refundStatus, 1) as refundStatus,
             cso.shopStatus as status
         FROM cm_shop_order cso
                  LEFT JOIN shop s ON cso.shopID = s.shopID
@@ -429,16 +431,16 @@
             AND shopStatus = 0
         </if>
         <if test="orderState == 2 ">
-            AND receiptStatus = 1 AND shopStatus not in (4,5)
+            AND receiptStatus = 1 AND shopStatus not in (0, 4, 5) AND orderStatusFlag = 1 AND refundStatus = 1
         </if>
         <if test="orderState == 3 ">
-            AND sendOutStatus = 1 AND shopStatus not in (4,5)
+            AND sendOutStatus = 1 AND shopStatus not in (0, 4, 5) AND orderStatusFlag = 1 AND refundStatus = 1
         </if>
         <if test="orderState == 4 ">
-            AND sendOutStatus = 3 AND shopStatus not in (4,5)
+            AND sendOutStatus = 3 AND shopStatus not in (0, 4, 5) AND orderStatusFlag = 1 AND refundStatus = 1
         </if>
         <if test="orderState == 5 ">
-            AND (orderStatusFlag in (2, 3) or refundStatus = 3) AND shopStatus not in (4,5)
+            AND (orderStatusFlag in (2, 3) or refundStatus in (2, 3)) AND shopStatus not in (0, 4)
         </if>
     </select>
     <select id="getOrderSeenCount" resultType="java.lang.Integer">
@@ -583,6 +585,8 @@
             cso.eachDiscount,
             IFNULL(cso.realPay, cso.needPayAmount)AS readPay,
             ifnull(cso.receiptStatus, 1) as receiptStatus,
+            ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+            ifnull(cso.refundStatus, 1) as refundStatus,
             cso.shopStatus as status
         FROM cm_shop_order cso
                  LEFT JOIN shop s ON cso.shopID = s.shopID
@@ -592,16 +596,16 @@
                 AND cso.shopStatus = 0
             </if>
             <if test="status == 2 ">
-                AND cso.receiptStatus = 1 AND shopStatus not in (4,5)
+                AND cso.receiptStatus = 1 AND shopStatus not in (0, 4, 5) AND cso.orderStatusFlag = 1 AND cso.refundStatus = 1
             </if>
             <if test="status == 3 ">
-                AND cso.sendOutStatus = 1 AND shopStatus not in (4,5)
+                AND cso.sendOutStatus = 1 AND shopStatus not in (0, 4, 5) AND cso.orderStatusFlag = 1 AND cso.refundStatus = 1
             </if>
             <if test="status == 4 ">
-                AND cso.sendOutStatus = 3 AND shopStatus not in (4,5)
+                AND cso.sendOutStatus = 3 AND shopStatus not in (0, 4, 5) AND cso.orderStatusFlag = 1 AND cso.refundStatus = 1
             </if>
             <if test="status == 5 ">
-                AND (cso.orderStatusFlag in (2, 3) or cso.refundStatus = 3) AND cso.shopStatus not in (4,5)
+                AND (cso.orderStatusFlag in (2, 3) or cso.refundStatus in (2, 3)) AND cso.shopStatus not in (0, 4)
             </if>
             <if test="shopOrderNo != null and shopOrderNo != '' ">
                 AND cso.shopOrderNo = #{shopOrderNo}
@@ -708,9 +712,14 @@
                         (SELECT secondHandOrderFlag FROM cm_order WHERE orderId = cso.orderId ) AS secondHandOrderFlag,
                         IFNULL(cso.receiptAmount,0) AS receiptAmount,
                         cso.eachDiscount,
-                        ifnull(s.payway, 0) AS payway,
+                        s.name AS shopName,
+                        IFNULL(s.payway, 0) AS payway,
+                        s.logo AS shopLogo,
+                        s.shopType AS shopType,
                         IFNULL(cso.realPay, cso.needPayAmount)AS readPay,
                         ifnull(cso.receiptStatus, 1) as receiptStatus,
+                        ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+                        ifnull(cso.refundStatus, 1) as refundStatus,
                         cso.shopStatus AS STATUS
         FROM cm_shop_order cso
                  LEFT JOIN cm_order_product cop ON cso.shopOrderId = cop.shopOrderId

+ 3 - 1
src/main/resources/mapper/OrderCommonMapper.xml

@@ -447,7 +447,7 @@
                p.productType
         FROM cm_order_product cop
                  LEFT JOIN product p ON cop.productID = p.productID
-                 LEFT JOIN cm_shop_order cso ON cop.orderId = cso.orderId
+                 LEFT JOIN cm_shop_order cso ON cop.shopOrderId = cso.shopOrderId
         WHERE cso.shopOrderId = #{shopOrderId}
           AND IF(cso.useBeanAmount = 0, 1 = 1, cop.shopid != 998)
         ORDER BY cop.discountPrice DESC
@@ -570,6 +570,8 @@
         cso.eachDiscount,
         IFNULL(cso.realPay, cso.needPayAmount)AS readPay,
         ifnull(cso.receiptStatus, 1) as receiptStatus,
+        ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+        ifnull(cso.refundStatus, 1) as refundStatus,
         cso.shopStatus as status
         FROM cm_shop_order cso
         LEFT JOIN shop s ON cso.shopID = s.shopID

+ 22 - 16
src/main/resources/mapper/OrderSellerMapper.xml

@@ -142,15 +142,17 @@
         s.shopType AS shopType,
         IFNULL(cso.realPay, cso.needPayAmount)AS readPay,
         ifnull(cso.receiptStatus, 1) as receiptStatus,
+        ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+        ifnull(cso.refundStatus, 1) as refundStatus,
         cso.shopStatus as status
         <if test="orderSubmitType == 3">
-            ,s.linkMan as serviceName
+            ,ser.linkMan as serviceName
         </if>
         FROM cm_shop_order cso
         LEFT JOIN shop s ON cso.shopID = s.shopID
         <if test="orderSubmitType == 3">
             LEFT JOIN club c ON cso.userId=c.userId
-            LEFT JOIN serviceprovider s ON c.spId=s.serviceProviderID
+            LEFT JOIN serviceprovider ser ON c.spId=ser.serviceProviderID
         </if>
         <where>
             cso.delFlag = 0 AND cso.userID IN
@@ -161,16 +163,16 @@
                 AND cso.shopStatus = 0
             </if>
             <if test="listType == 2 ">
-                AND cso.payStatus = 1
+                AND receiptStatus = 1 AND shopStatus not in (0, 4,5) AND cso.orderStatusFlag = 1 AND cso.refundStatus = 1
             </if>
             <if test="listType == 3 ">
-                AND cso.sendOutStatus = 1
+                AND cso.sendOutStatus = 1 AND cso.shopStatus not in (0,4,5) AND cso.orderStatusFlag = 1 AND cso.refundStatus = 1
             </if>
             <if test="listType == 4 ">
-                AND cso.sendOutStatus = 3
+                AND cso.sendOutStatus = 3 AND cso.shopStatus not in (0,4,5) AND cso.orderStatusFlag = 1 AND cso.refundStatus = 1
             </if>
             <if test="listType == 5 ">
-                AND (cso.orderStatusFlag in (2, 3) or cso.refundStatus = 2)
+                AND (cso.orderStatusFlag in (2, 3) or cso.refundStatus in (2, 3)) AND cso.shopStatus not in (0,4)
             </if>
             <if test="shopOrderNo != null and shopOrderNo != '' ">
                 AND cso.shopOrderNo = #{shopOrderNo}
@@ -306,6 +308,8 @@
         s.shopType AS shopType,
         IFNULL(cso.realPay, cso.needPayAmount)AS readPay,
         ifnull(cso.receiptStatus, 1) as receiptStatus,
+        ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+        ifnull(cso.refundStatus, 1) as refundStatus,
         cso.shopStatus as status
         FROM cm_shop_order cso
         LEFT JOIN shop s ON cso.shopID = s.shopID
@@ -314,16 +318,16 @@
             AND cso.shopStatus = 0
         </if>
         <if test="listType == 2 ">
-            AND cso.payStatus = 1
+            AND cso.receiptStatus = 1 AND cso.shopStatus not in (0, 4,5)
         </if>
         <if test="listType == 3 ">
-            AND cso.sendOutStatus = 1
+            AND cso.sendOutStatus = 1 AND cso.shopStatus not in (0, 4,5)
         </if>
         <if test="listType == 4 ">
-            AND cso.sendOutStatus = 3
+            AND cso.sendOutStatus = 3 AND cso.shopStatus not in (0, 4,5)
         </if>
         <if test="listType == 5 ">
-            AND (cso.orderStatusFlag in (2, 3) or cso.refundStatus = 2)
+            AND (cso.orderStatusFlag in (2, 3) or cso.refundStatus in( 2, 3 )) AND cso.shopStatus not in (0, 4,5)
         </if>
         <if test="orderSubmitType == 1">
             AND cso.orderSubmitType IN (0,1,2)
@@ -440,6 +444,8 @@
         s.shopType AS shopType,
         IFNULL(cso.realPay, cso.needPayAmount)AS readPay,
         ifnull(cso.receiptStatus, 1) as receiptStatus,
+        ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+        ifnull(cso.refundStatus, 1) as refundStatus,
         cso.shopStatus as status
         FROM cm_shop_order cso
         LEFT JOIN cm_order_product cop ON cso.shopOrderId = cop.shopOrderId
@@ -458,25 +464,25 @@
         where spID = #{serviceProviderId}
     </select>
     <select id="getSellerOrderCount" resultType="java.lang.Integer">
-        SELECT COUNT(*) FROM cm_order
+        SELECT COUNT(*) FROM cm_shop_order
         WHERE delFlag = 0 AND userID IN
         <foreach item="userId" index="index" collection="userIds" open="(" separator="," close=")">
             #{userId}
         </foreach>
         <if test="orderState == 1 ">
-            AND status = '0'
+            AND shopStatus = 0
         </if>
         <if test="orderState == 2 ">
-            AND status IN(11,12,13,21,22,23)
+            AND receiptStatus = 1 AND shopStatus not in (0, 4, 5)
         </if>
         <if test="orderState == 3 ">
-            AND status IN(11,12,21,22,31,32)
+            AND sendOutStatus = 1 AND shopStatus not in (0, 4, 5)
         </if>
         <if test="orderState == 4 ">
-            AND status IN(12,13,22,23,32,33)
+            AND sendOutStatus = 3 AND shopStatus not in (0, 4, 5)
         </if>
         <if test="orderState == 5 ">
-            AND refundType IN(1,2)
+            AND (orderStatusFlag in (2, 3) or refundStatus in (2, 3)) AND shopStatus not in (0, 4)
         </if>
     </select>
     <select id="getLastCheckOrderDate" resultType="java.util.Date">

+ 4 - 2
src/main/resources/mapper/ShipMapper.xml

@@ -129,7 +129,8 @@
             a.settlestatus,
             ifnull(a.sendOutStatus, 1) as sendOutStatus,
             ifnull(a.receiptStatus, 1) as receiptStatus,
-            a.refundStatus,
+            ifnull(a.orderStatusFlag, 1) as orderStatusFlag,
+            ifnull(a.refundStatus, 1) as refundStatus,
             ifnull(s.payway, 0) AS payway,
             a.shopStatus as status,
             a.splitFlag,
@@ -277,7 +278,8 @@
             cso.settlestatus,
             ifnull(cso.sendOutStatus, 1) as sendOutStatus,
             ifnull(cso.receiptStatus, 1) as receiptStatus,
-            cso.refundStatus,
+            ifnull(cso.orderStatusFlag, 1) as orderStatusFlag,
+            ifnull(cso.refundStatus, 1) as refundStatus,
             ifnull(s.payway, 0) AS payway,
             cso.shopStatus as status,
             cso.splitFlag,