Browse Source

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

Aslee 3 years ago
parent
commit
568c7e7af1

+ 4 - 1
src/main/java/com/caimei365/order/mapper/CartClubMapper.java

@@ -102,5 +102,8 @@ public interface CartClubMapper {
     CartItemVo getCartItemByProductId(Integer productId);
 
     List<Integer> findVipCoupon();
-
+    /**
+     * 会员机构类型:1医美,2生美
+     */
+    Integer getClubTypeById(Integer userId);
 }

+ 7 - 1
src/main/java/com/caimei365/order/mapper/OrderCommonMapper.java

@@ -4,6 +4,7 @@ import com.caimei365.order.model.vo.*;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -134,8 +135,9 @@ public interface OrderCommonMapper {
     /**
      * 未领取的优惠券
      * @param userId 用户Id
+     * @param registerTime
      */
-    List<CouponVo> getPrevCouponList(Integer userId);
+    List<CouponVo> getPrevCouponList(@Param("userId") Integer userId, @Param("registerTime") Date registerTime);
     /**
      * 活动券商品Ids
      */
@@ -144,4 +146,8 @@ public interface OrderCommonMapper {
      * 获取订单发票信息
      */
     InvoiceVo getOrderInvoice(Integer orderId);
+    /**
+     * 根据用户id查询注册时间
+     */
+    Date getUserRegisterTime(Integer userId);
 }

+ 6 - 2
src/main/java/com/caimei365/order/model/vo/CartItemVo.java

@@ -24,7 +24,7 @@ public class CartItemVo implements Serializable {
      */
     private Integer number;
     /**
-     * 购物商品效状态:0有效,1后台删除的,2冻结的,3下架,4售罄 >7库存不足,5价格仅会员可见,6未公开价格
+     * 购物商品效状态:0有效,1后台删除的,2冻结的,3下架,4售罄 >7库存不足,5价格仅会员可见,6未公开价格, 8价格仅医美机构可见
      */
     private Integer status;
     /**
@@ -72,7 +72,7 @@ public class CartItemVo implements Serializable {
      */
     private Integer step;
     /**
-     * 价格可见度:0公开价格 1不公开价格 2仅对会员机构公开
+     * 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
      */
     private Integer priceFlag;
     /**
@@ -99,6 +99,10 @@ public class CartItemVo implements Serializable {
      * 商品是否处于活动状态 1是 0否
      */
     private Integer actStatus;
+    /**
+     * 商品可见度:3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+     */
+    private Integer visibility;
     /**
      * 商品上架状态:0逻辑删除 1待审核 2已上架 3已下架 8审核未通过 9已冻结
      */

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

@@ -1,8 +1,5 @@
 package com.caimei365.order.service.impl;
 
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.caimei365.order.components.ProductService;
@@ -90,18 +87,33 @@ public class CartClubServiceImpl implements CartClubService {
         // 促销活动(总)
         List<PromotionsVo> totalPromotions = new ArrayList<>();
         List<Integer> promotionsIds = new ArrayList<>();
+        // 用户注册时间
+        Date registerTime = orderCommonMapper.getUserRegisterTime(userId);
         // 用户可用优惠券(总)
         List<CouponVo> couponList = orderCommonMapper.getClubCouponList(userId);
+        // 用户可领取优惠券(总)
+        List<CouponVo> preCouponList = orderCommonMapper.getPrevCouponList(userId, registerTime);
+        List<CouponVo> totalCouponList = new ArrayList<>();
+        totalCouponList.addAll(couponList);
+        totalCouponList.addAll(preCouponList);
         List<CartItemVo> cartAllProducts = new ArrayList<>();
-        // 用户身份
+        // 用户身份:  0个人,1协销,2会员机构,3供应商,4普通机构
         Integer userIdentity = baseMapper.getIdentityByUserId(userId);
-
+        userIdentity = null == userIdentity ? 0 : userIdentity;
+        // 会员机构类型:1医美,2生美
+        Integer userClubType = 0;
+        if (null != userIdentity && userIdentity == 2) {
+            userClubType = cartClubMapper.getClubTypeById(userId);
+            userClubType = null == userClubType ? 0 : userClubType;
+        }
         // 超级会员标识
         Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
         boolean svipUserFlag = null != svipUserId;
         if (null != shopInfoList && shopInfoList.size() > 0) {
             // 删除空数据
             shopInfoList.removeIf(Objects::isNull);
+            Integer finalUserIdentity = userIdentity;
+            Integer finalUserClubType = userClubType;
             // 遍历供应商列表
             shopInfoList.forEach(shop -> {
                 // 默认未选中状态(前端要求)
@@ -120,7 +132,7 @@ public class CartClubServiceImpl implements CartClubService {
                 AtomicDouble shopOriginalPrice = new AtomicDouble(0);
                 // 供应商促销优惠活动,以活动分类排序,店铺>凑单>单品
                 PromotionsVo shopPromotion = baseMapper.getPromotionByShopId(shop.getShopId());
-                if (shopPromotion != null && shopPromotion.getSeen() != null && shopPromotion.getSeen() == 2 && userIdentity == 1) {
+                if (shopPromotion != null && shopPromotion.getSeen() != null && shopPromotion.getSeen() == 2 && finalUserIdentity == 1) {
                     shopPromotion = null;
                 }
                 // 供应商下商品列表 ,购物车里的该供应商商品
@@ -132,14 +144,21 @@ public class CartClubServiceImpl implements CartClubService {
                     CartItemVo cartItemVo = productIterator.next();
                     // 设置商品图片及税费
                     boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
+                    // 商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+                    Integer visibility = cartItemVo.getVisibility();
+                    boolean visibleFlag = visibility == 3 || visibility==2 || (visibility == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (visibility == 4 && finalUserClubType == 1);
+                    if (!visibleFlag) {
+                        //不可见商品 不加入失效商品,直接去除
+                        productIterator.remove();
+                    }
                     // 已上架商品
-                    if (cartItemVo.getValidFlag() == 2) {
+                    else if (cartItemVo.getValidFlag() == 2) {
                         // 设置商品有效
                         cartItemVo.setStatus(0);
                         // 默认所有商品未选中状态(前端要求)
                         cartItemVo.setIsChecked(false);
-                        // 价格是否可见
-                        boolean priceVisible = (cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag)));
+                        // 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
+                        boolean priceVisible = (cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && finalUserClubType == 1));
                         // 是否库存充足
                         boolean isStocked = (cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber());
                         if (priceVisible && isStocked) {
@@ -159,7 +178,7 @@ public class CartClubServiceImpl implements CartClubService {
                                     // 获取商品促销信息
                                     promotions = baseMapper.getPromotionByProductId(cartItemVo.getProductId());
                                     // 促销活动如果协销不可见直接置空
-                                    if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2 && userIdentity == 1) {
+                                    if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2 && finalUserIdentity == 1) {
                                         promotions = null;
                                     }
                                     /*
@@ -229,9 +248,12 @@ public class CartClubServiceImpl implements CartClubService {
                             if (cartItemVo.getPriceFlag() == 1) {
                                 // 未公开价格
                                 cartItemVo.setStatus(6);
-                            } else if (cartItemVo.getPriceFlag() == 2 && userIdentity == 4) {
+                            } else if (cartItemVo.getPriceFlag() == 2 && finalUserIdentity == 4) {
                                 // 价格仅会员可见
                                 cartItemVo.setStatus(5);
+                            } else if (cartItemVo.getPriceFlag() == 3 && finalUserClubType != 1) {
+                                // 价格仅医美机构可见
+                                cartItemVo.setStatus(8);
                             } else if (cartItemVo.getStock() == null || cartItemVo.getStock() == 0) {
                                 // 售罄
                                 cartItemVo.setStatus(4);
@@ -315,7 +337,7 @@ public class CartClubServiceImpl implements CartClubService {
                         }
                     }
                     // 是否可领取优惠券
-                    Boolean couponsLogo = setCouponsLogo(shop.getShopId(), source, productList, couponList);
+                    Boolean couponsLogo = setCouponsLogo(shop.getShopId(), source, productList, totalCouponList);
                     shop.setCouponsLogo(couponsLogo);
 
                     // 供应商商品
@@ -332,6 +354,8 @@ public class CartClubServiceImpl implements CartClubService {
                     totalPrice.set(MathUtil.add(totalPrice, shop.getTotalPrice()).doubleValue());
                     // 优惠总额
                     reducedPrice.set(MathUtil.add(reducedPrice, shop.getReducedPrice()).doubleValue());
+                    // 超级会员优惠总额
+                    svipReducedPrice.set(MathUtil.add(svipReducedPrice, shop.getSvipReducedPrice()).doubleValue());
                     // 总划线价
                     totalOriginalPrice.set(MathUtil.add(totalOriginalPrice, shop.getOriginalPrice()).doubleValue());
                     // 商品种类
@@ -382,6 +406,7 @@ public class CartClubServiceImpl implements CartClubService {
         resultMap.put("totalCount", totalCount);
         resultMap.put("totalPrice", totalPrice);
         resultMap.put("reducedPrice", reducedPrice);
+        resultMap.put("svipReducedPrice", svipReducedPrice);
         resultMap.put("totalOriginalPrice", totalOriginalPrice);
         resultMap.put("promotions", totalPromotions);
         resultMap.put("couponList", couponList);
@@ -513,21 +538,36 @@ public class CartClubServiceImpl implements CartClubService {
         List<Integer> promotionsIds = new ArrayList<>();
         // 用户身份
         Integer userIdentity = baseMapper.getIdentityByUserId(userId);
+        // 会员机构类型:1医美,2生美
+        Integer userClubType = 0;
+        if (null != userIdentity && userIdentity == 2) {
+            userClubType = cartClubMapper.getClubTypeById(userId);
+            userClubType = null == userClubType ? 0 : userClubType;
+        }
         // 超级会员标识
         Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
         boolean svipUserFlag = null != svipUserId;
         // 获取购物车商品列表(不区分供应商)
         cartList = cartClubMapper.getCartProductList(userId);
         if (null != cartList && cartList.size() > 0) {
-            // 移除价格不可见商品
-            cartList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag))));
+            // 移除不可见商品,价格不可见商品,无库存
+            Integer finalUserClubType = userClubType;
+            Integer finalUserIdentity = userIdentity;
+            cartList.removeIf(cartItemVo -> !(
+                // visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+                (cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1))
+                // 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
+                || (cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && finalUserClubType == 1))
+                // 是否库存充足
+                || (cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber())
+            ));
             cartList.forEach(cartItemVo -> {
                 // 设置商品图片及税费
                 boolean taxFlag = productService.setCartItemImgAndTax(cartItemVo);
                 // 获取商品促销信息
                 PromotionsVo promotions = baseMapper.getPromotionByProductId(cartItemVo.getProductId());
                 // 如果促销活动协销不可见,移除促销
-                if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2 && userIdentity == 1) {
+                if (promotions != null && promotions.getSeen() != null && promotions.getSeen() == 2 && finalUserIdentity == 1) {
                     promotions = null;
                 }
                 /*
@@ -759,11 +799,26 @@ public class CartClubServiceImpl implements CartClubService {
         if (null != cartList && cartList.size() > 0) {
             // 用户身份
             Integer userIdentity = baseMapper.getIdentityByUserId(userId);
+            userIdentity = null == userIdentity ? 0 : userIdentity;
             // 超级会员标识
             Integer svipUserId = baseMapper.getSvipUserIdByUserId(userId);
             boolean svipUserFlag = null != svipUserId;
-            // 移除价格不可见商品
-            cartList.removeIf(cartItemVo -> !(cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (userIdentity == 2 || svipUserFlag))));
+            // 会员机构类型:1医美,2生美
+            Integer userClubType = 0;
+            if (null != userIdentity && userIdentity == 2) {
+                userClubType = cartClubMapper.getClubTypeById(userId);
+                userClubType = null == userClubType ? 0 : userClubType;
+            }
+            int finalUserIdentity = userIdentity;
+            int finalUserClubType = userClubType;
+            cartList.removeIf(cartItemVo -> !(
+                // visibility商品可见度: 3:所有人可见,2:普通机构可见,1:会员机构可见,4:仅医美机构可见
+                (cartItemVo.getVisibility() == 3 || cartItemVo.getVisibility()==2 || (cartItemVo.getVisibility() == 1 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getVisibility() == 4 && finalUserClubType == 1))
+                // 价格可见度: 0公开价格,1不公开价格,2仅对会员机构公开,3仅对医美机构公开
+                || (cartItemVo.getPriceFlag() == 0 || (cartItemVo.getPriceFlag() == 2 && (finalUserIdentity == 2 || svipUserFlag)) || (cartItemVo.getPriceFlag() == 3 && finalUserClubType == 1))
+                // 是否库存充足
+                || (cartItemVo.getStock() != null && cartItemVo.getStock() > 0 && cartItemVo.getStock() >= cartItemVo.getMin() && cartItemVo.getStock() >= cartItemVo.getNumber())
+            ));
             return cartList.size();
         } else {
             return 0;
@@ -1798,8 +1853,10 @@ public class CartClubServiceImpl implements CartClubService {
     public ResponseJson<Map<String, Object>> getShopCoupons(Integer userId, Integer shopId, Integer source, Integer status) {
         // 供应商下购物车商品列表
         List<CartItemVo> productList = cartClubMapper.getCartProductsByShopId(shopId, userId);
+        // 用户注册时间
+        Date registerTime = orderCommonMapper.getUserRegisterTime(userId);
         // 未领取的优惠券
-        List<CouponVo> preCouponList = orderCommonMapper.getPrevCouponList(userId);
+        List<CouponVo> preCouponList = orderCommonMapper.getPrevCouponList(userId, registerTime);
         //剔除超级会员优惠券
         List<Integer> vipCoupon = cartClubMapper.findVipCoupon();
         if (preCouponList != null && preCouponList.size() > 0) {

+ 4 - 2
src/main/java/com/caimei365/order/service/impl/RemoteCallServiceImpl.java

@@ -85,8 +85,10 @@ public class RemoteCallServiceImpl implements RemoteCallService {
                         String jsonStr = toolsFeign.getSendSms(mobile, content);
                         JSONObject parseObject = JSONObject.parseObject(jsonStr);
                         if (0 == parseObject.getInteger("code")){
-                            // 保存短信发送条数+count
-                            messagePushMapper.updateSmsSendCount(markId, 1);
+                            if (markId > 0 ) {
+                                // 保存短信发送条数+count
+                                messagePushMapper.updateSmsSendCount(markId, 1);
+                            }
                             returnValue.set(true);
                         }
                     }

+ 2 - 2
src/main/resources/mapper/BaseMapper.xml

@@ -87,7 +87,7 @@
         where r.productId = #{productId}
           and r.userId = #{userId}
           and ((p.costCheckFlag = 1 and r.currentPrice <![CDATA[ >= ]]> p.costPrice) or p.costCheckFlag = 2)
-          and p.price1 <![CDATA[ >= ]]> r.currentPrice
+          and p.price <![CDATA[ >= ]]> r.currentPrice
           and r.delFlag = 0
     </select>
     <select id="getPromotionByShopId" resultType="com.caimei365.order.model.vo.PromotionsVo">
@@ -147,7 +147,7 @@
                cpg.number  AS number,
                0           AS price,
                2           as productType,
-               p.price1    AS originalPrice,
+               p.price    AS originalPrice,
                p.unit      AS unit,
                p.stock     AS stock,
                p.validFlag AS validFlag

+ 24 - 16
src/main/resources/mapper/CartClubMapper.xml

@@ -53,19 +53,20 @@
             p.`name` AS `name`,
             p.mainImage AS image,
             p.productCode,
-            p.price1 AS price,
-            p.price1 AS originalPrice,
+            p.price,
+            p.price AS originalPrice,
             p.unit AS unit,
             p.stock AS stock,
             p.step AS step,
             p.minBuyNumber AS min,
-            p.price1TextFlag AS priceFlag,
+            p.priceFlag,
             p.ladderPriceFlag AS ladderFlag,
             p.includedTax AS includedTax,
             p.invoiceType AS invoiceType,
             p.taxPoint AS taxRate,
             p.productCategory,
             p.validFlag AS validFlag,
+            p.visibility,
             if(csp.id is not null,1,0) as svipProductFlag,
             csp.priceType as svipPriceType,
             csp.discount as svipDiscount,
@@ -85,19 +86,20 @@
         p.`name` AS `name`,
         p.mainImage AS image,
         p.productCode,
-        p.price1 AS price,
-        p.price1 AS originalPrice,
+        p.price,
+        p.price AS originalPrice,
         p.unit AS unit,
         p.stock AS stock,
         p.step AS step,
         p.minBuyNumber AS min,
-        p.price1TextFlag AS priceFlag,
+        p.priceFlag,
         p.ladderPriceFlag AS ladderFlag,
         p.includedTax AS includedTax,
         p.invoiceType AS invoiceType,
         p.taxPoint AS taxRate,
         p.productCategory,
         p.validFlag AS validFlag,
+        p.visibility,
         p.commodityType as commodityType,
         if(csp.id is not null,1,0) as svipProductFlag,
         csp.priceType as svipPriceType,
@@ -121,19 +123,20 @@
         p.`name` AS `name`,
         p.mainImage AS image,
         p.productCode,
-        p.price1 AS price,
-        p.price1 AS originalPrice,
+        p.price,
+        p.price AS originalPrice,
         p.unit AS unit,
         p.stock AS stock,
         p.step AS step,
         p.minBuyNumber AS min,
-        p.price1TextFlag AS priceFlag,
+        p.priceFlag,
         p.ladderPriceFlag AS ladderFlag,
         p.includedTax AS includedTax,
         p.invoiceType AS invoiceType,
         p.taxPoint AS taxRate,
         p.productCategory,
         p.validFlag AS validFlag,
+        p.visibility,
         p.commodityType as commodityType,
         if(csp.id is not null,1,0) as svipProductFlag,
         csp.priceType as svipPriceType,
@@ -157,23 +160,24 @@
             p.`name` AS `name`,
             p.mainImage AS image,
             p.productCode,
-            p.price1 AS price,
-            p.price1 AS originalPrice,
+            p.price,
+            p.price AS originalPrice,
             p.unit AS unit,
             p.stock AS stock,
             p.step AS step,
             p.minBuyNumber AS min,
-            p.price1TextFlag AS priceFlag,
+            p.priceFlag,
             p.ladderPriceFlag AS ladderFlag,
             p.includedTax AS includedTax,
             p.invoiceType AS invoiceType,
             p.taxPoint AS taxRate,
             p.productCategory,
+            p.visibility,
             p.validFlag AS validFlag
         FROM cm_cart c
         LEFT JOIN product p ON c.productID = p.productID
         WHERE p.validFlag='2' AND c.userID = #{userId}
-        AND p.price1TextFlag != '1'
+        AND p.priceFlag != '1'
         AND p.stock != '0' AND p.stock <![CDATA[ >= ]]> c.productCount
         ORDER BY c.cm_cartID DESC
     </select>
@@ -239,19 +243,20 @@
         p.`name` AS `name`,
         p.mainImage AS image,
         p.productCode,
-        p.price1 AS price,
-        p.price1 AS originalPrice,
+        p.price,
+        p.price AS originalPrice,
         p.unit AS unit,
         p.stock AS stock,
         p.step AS step,
         p.minBuyNumber AS min,
-        p.price1TextFlag AS priceFlag,
+        p.priceFlag,
         p.ladderPriceFlag AS ladderFlag,
         p.includedTax AS includedTax,
         p.invoiceType AS invoiceType,
         p.taxPoint AS taxRate,
         p.productCategory,
         p.validFlag AS validFlag,
+        p.visibility,
         p.commodityType AS commodityType,
         if(csp.id is not null,1,0) as svipProductFlag,
         csp.priceType as svipPriceType,
@@ -265,4 +270,7 @@
     <select id="findVipCoupon" resultType="java.lang.Integer">
         select couponId from cm_svip_coupon
     </select>
+    <select id="getClubTypeById" resultType="java.lang.Integer">
+        SELECT firstClubType FROM club WHERE userID = #{userId}
+    </select>
 </mapper>

+ 8 - 8
src/main/resources/mapper/CartSellerMapper.xml

@@ -21,13 +21,13 @@
             p.`name` AS `name`,
             p.mainImage AS image,
             p.productCode,
-            p.price1 AS price,
-            p.price1 AS originalPrice,
+            p.price,
+            p.price AS originalPrice,
             p.unit AS unit,
             p.stock AS stock,
             p.step AS step,
             p.minBuyNumber AS min,
-            p.price1TextFlag AS priceFlag,
+            p.priceFlag,
             p.ladderPriceFlag AS ladderFlag,
             p.includedTax AS includedTax,
             p.invoiceType AS invoiceType,
@@ -110,13 +110,13 @@
             p.`name` AS `name`,
             p.mainImage AS image,
             p.productCode,
-            p.price1 AS price,
-            p.price1 AS originalPrice,
+            p.price,
+            p.price AS originalPrice,
             p.unit AS unit,
             p.stock AS stock,
             p.step AS step,
             p.minBuyNumber AS min,
-            p.price1TextFlag AS priceFlag,
+            p.priceFlag,
             p.ladderPriceFlag AS ladderFlag,
             p.includedTax AS includedTax,
             p.invoiceType AS invoiceType,
@@ -144,10 +144,10 @@
             p.`name` AS `name`,
             p.mainImage AS image,
             p.productCode,
-            p.price1 AS price,
+            p.price,
             cshd.originalPrice AS originalPrice,
             p.unit AS unit,
-            p.price1TextFlag AS priceFlag,
+            p.priceFlag,
             p.ladderPriceFlag AS ladderFlag,
             p.includedTax AS includedTax,
             p.invoiceType AS invoiceType,

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

@@ -427,7 +427,6 @@
             returnedWay,
             payType,
             operatingOrderStatus,
-            returnedBankInfo,
             bankAccountName,
             bankAccountNo,
             openBank,

+ 21 - 7
src/main/resources/mapper/OrderCommonMapper.xml

@@ -404,8 +404,14 @@
             id AS couponId,
             couponAmount,
             touchPrice,
-            startDate,
-            endDate,
+            <if test="userId == null || userId == 0">
+                startDate,
+                endDate,
+            </if>
+            <if test="userId >0">
+                if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate) as startDate,
+                if(receiveFlag=1,endDate,date_add(if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),interval receivePeriod day)) as endDate,
+            </if>
             couponType,
             userId,
             shopId,
@@ -413,9 +419,10 @@
             categoryType
         FROM cm_coupon
         WHERE delFlag = 0 AND couponsMode = 0 AND status != 2
-        AND (NOW() BETWEEN startDate AND endDate)
         <if test="userId == null or userId == 0">
             AND couponType != 2
+            AND NOW() <![CDATA[ > ]]> startDate
+            AND NOW() <![CDATA[ < ]]> if(receiveFlag = 1,endDate,date_add(startDate,interval receivePeriod day)
         </if>
         <if test="userId > 0">
             AND id NOT IN(SELECT couponId FROM cm_coupon_club WHERE userId = #{userId})
@@ -423,6 +430,10 @@
             OR couponType = 2 AND userId = #{userId}
             OR ((SELECT registerTime FROM USER WHERE userID = #{userId}) <![CDATA[ >= ]]> startDate
             AND couponType = 4))
+            and NOW() <![CDATA[ > ]]> startDate
+            and NOW() <![CDATA[ < ]]> if(receiveFlag = 1,endDate,
+            date_add(if(#{registerTime} <![CDATA[ > ]]> startDate,#{registerTime},startDate),
+            interval receivePeriod day))
         </if>
         ORDER BY createDate DESC
     </select>
@@ -432,8 +443,8 @@
             cc.id AS couponId,
             cc.couponAmount,
             cc.touchPrice,
-            cc.startDate,
-            cc.endDate,
+            a.createDate as startDate,
+            date_add(a.createDate,interval cc.usePeriod day) as endDate,
             cc.couponType,
             cc.userId,
             cc.shopId,
@@ -445,8 +456,8 @@
         AND a.delFlag = 0
         AND a.userId = #{userId}
         AND a.status = 1
-        AND NOW() BETWEEN cc.startDate
-        AND cc.endDate
+        AND NOW() BETWEEN a.createDate
+        AND date_add(a.createDate,interval cc.usePeriod day)
         AND cc.status != 2
         ORDER BY a.createDate DESC
     </select>
@@ -475,4 +486,7 @@
         WHERE orderId = #{orderId}
         LIMIT 1
     </select>
+    <select id="getUserRegisterTime" resultType="java.util.Date">
+        select registerTime from user where userID = #{userId}
+    </select>
 </mapper>

+ 3 - 3
src/main/resources/mapper/PayOrderMapper.xml

@@ -39,7 +39,7 @@
         VALUES (#{orderId}, #{productId}, #{orderProductId}, #{shopId},#{vipRecordId}, #{type}, #{subUserNo}, #{splitAccount},
                 #{mbOrderId}, #{orderRequestNo}, #{payStatus}, #{productType}, NOW());
     </insert>
-    <insert id="insertPayShop">
+    <insert id="insertPayShop" keyColumn="id" keyProperty="id" parameterType="com.caimei365.order.model.po.PayShopPo">
         INSERT INTO cm_pay_shop (shopID, name, bankAccountName, bankAccount, bankName, type, totalAmount, balancePayFee,
                                  transferPayFee, payType, wipePayment, wipeRemarks, wipeRemarkImages, wipeTime, applicant,
                                  applyTime, reviewer, reviewTime, payTime, status, reason, delFlag)
@@ -47,11 +47,11 @@
                 #{transferPayFee}, #{payType}, #{wipePayment}, #{wipeRemarks}, #{wipeRemarkImages}, #{wipeTime}, #{applicant},
                 #{applyTime}, #{reviewer}, #{reviewTime}, #{payTime}, #{status}, #{reason}, #{delFlag})
     </insert>
-    <insert id="insertPayShopRecord">
+    <insert id="insertPayShopRecord" keyColumn="id" keyProperty="id" parameterType="com.caimei365.order.model.po.PayShopRecordPo">
         INSERT INTO cm_pay_shop_record (shopID, shopOrderID, shopOrderNo, payAmount, wipePayment, payType, payTime, payShopID, status, delFlag)
         VALUES (#{shopId}, #{shopOrderId}, #{shopOrderNo}, #{payAmount}, #{wipePayment}, #{payType}, #{payTime}, #{payShopId}, #{status}, #{delFlag})
     </insert>
-    <insert id="insertUserVipInfo">
+    <insert id="insertUserVipInfo" keyColumn="id" keyProperty="id" parameterType="com.caimei365.order.model.po.UserVipPo">
         INSERT INTO cm_svip_user(userId, beginTime, endTime, delFlag, updateTime)
         VALUES (#{userId}, #{beginTime}, #{endTime}, #{delFlag}, #{updateTime})
     </insert>

+ 3 - 3
src/main/resources/mapper/SubmitMapper.xml

@@ -47,7 +47,7 @@
             parameterType="com.caimei365.order.model.po.OrderProductPo" useGeneratedKeys="true">
         INSERT INTO cm_order_product (orderID, orderNo, shopOrderID, shopOrderNo, orderPromotionsId, productId, shopId,
                                       name,
-                                      productImage, price, price1, shopName, costPrice, normalPrice, ladderPriceFlag,
+                                      productImage, price, shopName, costPrice, normalPrice, ladderPriceFlag,
                                       discountPrice, discount,
                                       totalAmount, totalFee, shouldPayFee, productUnit, num, presentNum, discountFee,
                                       includedTax,
@@ -60,7 +60,7 @@
                                       svipDiscount, svipReduction)
         VALUES (#{orderId}, #{orderNo}, #{shopOrderId}, #{shopOrderNo}, #{orderPromotionsId}, #{productId}, #{shopId},
                 #{name},
-                #{image}, #{price}, #{price}, #{shopName}, #{costPrice}, #{normalPrice}, #{ladderPriceFlag},
+                #{image}, #{price}, #{shopName}, #{costPrice}, #{normalPrice}, #{ladderPriceFlag},
                 #{discountPrice}, #{discount},
                 #{totalAmount}, #{totalFee}, #{shouldPayFee}, #{productUnit}, #{num}, #{presentNum}, #{discountFee},
                 #{includedTax},
@@ -183,7 +183,7 @@
                p.shopID           AS shopId,
                p.`name`           AS `name`,
                p.mainImage        AS image,
-               p.price1           AS price,
+               p.price,
                p.costPrice,
                IFNULL(p.costCheckFlag, 1) AS costCheckFlag,
                p.costProportional,