1
0
Преглед на файлове

小程序管理前后台端修改

hyq преди 6 години
родител
ревизия
e49ee75f28

+ 2 - 1
kmall-api/src/main/java/com/kmall/api/api/ApiCartController.java

@@ -547,7 +547,8 @@ public class ApiCartController extends ApiBaseAction {
             }
         }
         // 根据收货地址计算运费
-        BigDecimal freightPrice = apiCouponService.matchShipping(loginUser.getId(), goodsTotalPrice);
+//        BigDecimal freightPrice = apiCouponService.matchShipping(loginUser.getId(), goodsTotalPrice);
+        BigDecimal freightPrice = new BigDecimal("00");
         // 单独计算满减券
         BigDecimal fullCutCouponDec = new BigDecimal(0);
         Long fullCutCouponId = 0L;

+ 2 - 0
kmall-api/src/main/java/com/kmall/api/dao/ApiGoodsMapper.java

@@ -3,6 +3,7 @@ package com.kmall.api.dao;
 import com.kmall.api.entity.GoodsVo;
 import com.kmall.common.dao.BaseDao;
 import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
 
 import java.util.List;
 import java.util.Map;
@@ -12,6 +13,7 @@ import java.util.Map;
  * @email
  * @date 2017-08-11 09:16:45
  */
+@Component
 public interface ApiGoodsMapper extends BaseDao<GoodsVo> {
 
     List<GoodsVo> queryHotGoodsList(Map<String, Object> params);

+ 10 - 0
kmall-api/src/main/java/com/kmall/api/entity/GoodsVo.java

@@ -99,6 +99,16 @@ public class GoodsVo implements Serializable {
 
     private Date tstm;
 
+    private BigDecimal goodsRate;
+
+    public BigDecimal getGoodsRate() {
+        return goodsRate;
+    }
+
+    public void setGoodsRate(BigDecimal goodsRate) {
+        this.goodsRate = goodsRate;
+    }
+
     public String getSku() {
         return sku;
     }

+ 20 - 0
kmall-api/src/main/java/com/kmall/api/entity/OrderGoodsVo.java

@@ -56,6 +56,26 @@ public class OrderGoodsVo implements Serializable {
 
     private Date tstm;
 
+    private BigDecimal goodsRate;
+
+    private BigDecimal settlePrice;
+
+    public BigDecimal getGoodsRate() {
+        return goodsRate;
+    }
+
+    public void setGoodsRate(BigDecimal goodsRate) {
+        this.goodsRate = goodsRate;
+    }
+
+    public BigDecimal getSettlePrice() {
+        return settlePrice;
+    }
+
+    public void setSettlePrice(BigDecimal settlePrice) {
+        this.settlePrice = settlePrice;
+    }
+
     public String getSku() {
         return sku;
     }

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

@@ -157,6 +157,16 @@ public class OrderVo implements Serializable {
 
     private String merchOrderSn;
 
+    private String isScan;
+
+    public String getIsScan() {
+        return isScan;
+    }
+
+    public void setIsScan(String isScan) {
+        this.isScan = isScan;
+    }
+
     public String getMerchOrderSn() {
         return merchOrderSn;
     }

+ 18 - 1
kmall-api/src/main/java/com/kmall/api/entity/PayerChildOrderRealEntity.java

@@ -9,7 +9,7 @@ import java.util.Date;
  *
  * @author emato
  * @email admin@qhdswl.com
- * @date 2018-10-11 14:38:15
+ * @date 2018-10-19 16:14:30
  */
 public class PayerChildOrderRealEntity implements Serializable {
     private static final long serialVersionUID = 1L;
@@ -27,6 +27,10 @@ public class PayerChildOrderRealEntity implements Serializable {
      */
     private Integer userId;
     /**
+     * 商户订单号
+     */
+    private String merchOrderSn;
+    /**
      * 支付单编号
      */
     private String payNo;
@@ -103,6 +107,19 @@ public class PayerChildOrderRealEntity implements Serializable {
         return userId;
     }
     /**
+     * 设置:商户订单号
+     */
+    public void setMerchOrderSn(String merchOrderSn) {
+        this.merchOrderSn = merchOrderSn;
+    }
+
+    /**
+     * 获取:商户订单号
+     */
+    public String getMerchOrderSn() {
+        return merchOrderSn;
+    }
+    /**
      * 设置:支付单编号
      */
     public void setPayNo(String payNo) {

+ 29 - 17
kmall-api/src/main/java/com/kmall/api/service/ApiOrderService.java

@@ -51,6 +51,8 @@ public class ApiOrderService {
     private ApiGoodsGroupOpenDetailMapper apiGoodsGroupOpenDetailMapper;
     @Autowired
     private FormIdsService formIdsService;
+    @Autowired
+    private ApiGoodsMapper apiGoodsMapper;
 
     public OrderVo queryObject(Long id) {
         return apiOrderMapper.queryObject(id);
@@ -99,6 +101,7 @@ public class ApiOrderService {
     }
 
     public void update(OrderVo order) {
+        order.setIsScan("0");
         apiOrderMapper.update(order);
     }
 
@@ -231,7 +234,11 @@ public class ApiOrderService {
                     //统计商品总价
                     List<OrderGoodsVo> orderGoodsData = new ArrayList();
                     if (orderInfo.getOrderBizType().equalsIgnoreCase(goodsItem.getGoodsBizType())) {
-                        OrderGoodsVo orderGoodsVo = setOrderGoodsVo(orderInfo, goodsItem);
+                        GoodsVo goodsVo = apiGoodsMapper.queryObject(goodsItem.getId());
+                        if(goodsVo==null){
+                            throw new RRException("订单提交失败:商品不存在");
+                        }
+                        OrderGoodsVo orderGoodsVo = setOrderGoodsVo(orderInfo, goodsItem,goodsVo);
                         apiOrderGoodsMapper.save(orderGoodsVo);
                     }
                 }
@@ -281,7 +288,8 @@ public class ApiOrderService {
         Integer userCouponId = jsonParam.getInteger("userCouponId");
         String postscript = jsonParam.getString("postscript");
         Long fullCutCouponId = jsonParam.getLong("fullCutCouponId");
-        BigDecimal freightPrice = new BigDecimal(10.00);
+//        BigDecimal freightPrice = new BigDecimal(10.00);
+        BigDecimal freightPrice = new BigDecimal(0.00);
         AddressVo addressVo = jsonParam.getObject("checkedAddress", AddressVo.class);
         Date delivery_date = jsonParam.getDate("delivery_date");
         if (null == delivery_date) {
@@ -311,19 +319,19 @@ public class ApiOrderService {
             }
         }
         // 获取优惠信息提示
-        Map couponParam = new HashMap();
-        couponParam.put("enabled", true);
-        Integer[] send_types = new Integer[]{7};
-        couponParam.put("send_types", send_types);
-        List<CouponVo> couponVos = apiCouponMapper.queryList(couponParam);
-        if (null != couponVos && couponVos.size() > 0) {
-            for (CouponVo couponVo : couponVos) {
-                // 是否免运费
-                if (couponVo.getSend_type() == 7 && couponVo.getMin_goods_amount().compareTo(goodsTotalPrice) <= 0) {
-                    freightPrice = couponVo.getType_money();
-                }
-            }
-        }
+//        Map couponParam = new HashMap();
+//        couponParam.put("enabled", true);
+//        Integer[] send_types = new Integer[]{7};
+//        couponParam.put("send_types", send_types);
+//        List<CouponVo> couponVos = apiCouponMapper.queryList(couponParam);
+//        if (null != couponVos && couponVos.size() > 0) {
+//            for (CouponVo couponVo : couponVos) {
+//                // 是否免运费
+//                if (couponVo.getSend_type() == 7 && couponVo.getMin_goods_amount().compareTo(goodsTotalPrice) <= 0) {
+//                    freightPrice = couponVo.getType_money();
+//                }
+//            }
+//        }
         // 获取优惠信息 满减
         BigDecimal fullCutCouponDec = new BigDecimal(0);
         CouponVo fullCutCoupon = apiCouponMapper.queryObject(fullCutCouponId);
@@ -332,7 +340,7 @@ public class ApiOrderService {
         }
 
         //订单价格计算
-        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice); //订单的总价
+        BigDecimal orderTotalPrice = goodsTotalPrice.add(freightPrice); //订单的总价+运费
 
         BigDecimal actualPrice = orderTotalPrice.subtract(fullCutCouponDec).subtract(couponPrice);  //减去其它支付的金额后,要实际支付的金额
 
@@ -377,11 +385,12 @@ public class ApiOrderService {
         orderInfo.setModTime(new Date());
         orderInfo.setPayMobile(loginUser.getMobile());
         orderInfo.setPayTransactionId("");
+        orderInfo.setIsScan("0");//默认未扫描
         return orderInfo;
     }
 
 
-    public OrderGoodsVo setOrderGoodsVo(OrderVo orderInfo,CartVo goodsItem){
+    public OrderGoodsVo setOrderGoodsVo(OrderVo orderInfo,CartVo goodsItem,GoodsVo goodsVo){
         OrderGoodsVo orderGoodsVo = new OrderGoodsVo();
         orderGoodsVo.setOrder_id(orderInfo.getId());
         orderGoodsVo.setGoods_id(goodsItem.getGoods_id());
@@ -397,6 +406,9 @@ public class ApiOrderService {
         orderGoodsVo.setOrderBizType(goodsItem.getGoodsBizType());
         orderGoodsVo.setCreateTime(new Date());
         orderGoodsVo.setModTime(new Date());
+
+        orderGoodsVo.setGoodsRate(goodsVo.getGoodsRate());
+        orderGoodsVo.setSettlePrice(new BigDecimal("0"));//商品结算平摊价格=(零售价格*数量)/订单结算总金额
         return orderGoodsVo;
     }
     /**

+ 16 - 0
kmall-api/src/main/java/com/kmall/api/service/ApiPayService.java

@@ -3,6 +3,7 @@ package com.kmall.api.service;
 import com.kmall.api.entity.GoodsGroupOpenDetailVo;
 import com.kmall.api.entity.GoodsGroupOpenVo;
 import com.kmall.api.entity.OrderVo;
+import com.kmall.api.entity.PayerChildOrderRealEntity;
 import com.kmall.api.service.pay.wxpay.WxPayPropertiesBuilder;
 import com.kmall.common.service.FormIdsService;
 import com.kmall.common.utils.DateUtils;
@@ -37,6 +38,8 @@ public class ApiPayService {
     @Autowired
     private ApiGoodsGroupOpenService apiGoodsGroupOpenService;
 
+    @Autowired
+    private PayerChildOrderRealService payerChildOrderRealService;
 
     @Transactional
     public void payPrepay(Map<Object, Object> resultObj, Map<String, Object> resultUn, String nonceStr, List<OrderVo> orderVoList) {
@@ -56,6 +59,19 @@ public class ApiPayService {
             orderInfo.setPay_id(prepay_id);
             orderInfo.setPay_status(1); // 付款中
             orderService.update(orderInfo);
+
+            PayerChildOrderRealEntity entity = new PayerChildOrderRealEntity();
+            entity.setGoodsBizType(orderInfo.getOrderBizType());
+            entity.setOrderSn(orderInfo.getOrder_sn());
+            entity.setMerchSn(orderInfo.getMerchSn());
+            entity.setMerchOrderSn(orderInfo.getMerchOrderSn());
+            entity.setPayNo(orderInfo.getPay_id());
+            entity.setPayPrice(Integer.parseInt(orderInfo.getActual_price()+""));
+            entity.setCreateTime(new Date());
+            entity.setModTime(new Date());
+            entity.setUserId(Integer.parseInt(orderInfo.getUser_id()+""));
+            payerChildOrderRealService.save(entity);//记录微信返回的支付单与子订单信息
+
             // 保存form_id
             formIdsService.save(orderInfo.getUser_id(), prepay_id, 1);
         }

+ 3 - 2
kmall-api/src/main/resources/mybatis/mapper/ApiGoodsMapper.xml

@@ -44,6 +44,7 @@
         <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="goodsRate" column="goods_rate"/>
     </resultMap>
 
     <sql id="Base_Column_List" >
@@ -52,7 +53,7 @@
         extra_price, is_new, goods_unit, primary_pic_url, list_pic_url, retail_price, sell_volume,
         primary_product_id, unit_price, promotion_desc, promotion_tag, app_exclusive_price,
         is_app_exclusive, is_limited, is_hot, market_price, creater_sn, create_time, moder_sn,
-        mod_time, tstm,goods_desc
+        mod_time, tstm,goods_desc,goods_rate
     </sql>
 
     <select id="queryObject" resultMap="goodsMap">
@@ -94,7 +95,7 @@
         a.is_hot,
         psr1.market_price,
         psr1.stock_num,
-        a.goods_desc,a.goods_biz_type
+        a.goods_desc,a.goods_biz_type,a.goods_rate
         from mall_goods a
         LEFT JOIN mall_product_store_rela psr1 ON a.id = psr1.goods_id AND a.primary_product_id = psr1.product_id
         where a.id = #{id} and psr1.store_id = #{storeId}

+ 17 - 0
kmall-api/src/main/resources/mybatis/mapper/ApiOrderGoodsMapper.xml

@@ -25,6 +25,8 @@
         <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="goodsRate" column="goods_rate"/>
+        <result property="settlePrice" column="settle_price"/>
     </resultMap>
 
     <select id="queryObject" resultMap="orderGoodsMap">
@@ -70,6 +72,12 @@
 			`is_real`, 
 			`goods_specification_ids`,
 			`list_pic_url`,
+            <if test="goodsRate != null" >
+                goods_rate,
+            </if>
+            <if test="settlePrice != null" >
+                settle_price,
+            </if>
 
             <if test="sku != null" >
                 sku,
@@ -104,6 +112,12 @@
 			#{is_real},
 			#{goods_specification_ids},
 			#{list_pic_url},
+        <if test="goodsRate != null" >
+            #{goodsRate},
+        </if>
+        <if test="settlePrice != null" >
+            #{settlePrice},
+        </if>
 
         <if test="sku != null" >
             #{sku,jdbcType=VARCHAR},
@@ -144,6 +158,9 @@
             <if test="goods_specification_ids != null">`goods_specification_ids` = #{goods_specification_ids},</if>
             <if test="list_pic_url != null">`list_pic_url` = #{list_pic_url},</if>
 
+            <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
+            <if test="settlePrice != null">`settle_price` = #{settlePrice},</if>
+
             <if test="sku != null" >
                 sku = #{sku,jdbcType=VARCHAR},
             </if>

+ 13 - 0
kmall-api/src/main/resources/mybatis/mapper/ApiOrderMapper.xml

@@ -63,6 +63,8 @@
         <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
         <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
         <result column="merch_order_sn" property="merchOrderSn" jdbcType="VARCHAR" />
+        <result column="is_scan" property="isScan" jdbcType="VARCHAR" />
+
     </resultMap>
 
     <select id="queryObject" resultMap="orderMap">
@@ -203,6 +205,9 @@
         <if test="merchOrderSn != null" >
             merch_order_sn,
         </if>
+        <if test="isScan != null" >
+            is_scan,
+        </if>
         <if test="orderBizType != null" >
             order_biz_type,
         </if>
@@ -277,6 +282,9 @@
         <if test="merchOrderSn != null" >
             #{merchOrderSn,jdbcType=VARCHAR},
         </if>
+        <if test="isScan != null" >
+            #{isScan,jdbcType=VARCHAR},
+        </if>
         <if test="orderBizType != null" >
             #{orderBizType,jdbcType=CHAR},
         </if>
@@ -359,6 +367,7 @@
         `comment_count`,
          merch_sn,
         merch_order_sn,
+        is_scan,
          order_biz_type,
          pay_transaction_id,
          pay_mobile,
@@ -408,6 +417,7 @@
             #{orderInfo.comment_count},
             #{orderInfo.merchSn,jdbcType=VARCHAR},
             #{orderInfo.merchOrderSn,jdbcType=VARCHAR},
+            #{orderInfo.isScan,jdbcType=VARCHAR},
             #{orderInfo.orderBizType,jdbcType=CHAR},
             #{orderInfo.payTransactionId,jdbcType=VARCHAR},
             #{orderInfo.payMobile,jdbcType=VARCHAR},
@@ -467,6 +477,9 @@
             <if test="merchOrderSn != null" >
                 merch_order_sn = #{merchOrderSn,jdbcType=VARCHAR},
             </if>
+            <if test="isScan != null" >
+                is_scan = #{isScan,jdbcType=VARCHAR},
+            </if>
             <if test="orderBizType != null" >
                 order_biz_type = #{orderBizType,jdbcType=CHAR},
             </if>

+ 6 - 0
kmall-api/src/main/resources/mybatis/mapper/PayerChildOrderRealMapper.xml

@@ -9,6 +9,7 @@
         <result property="userId" column="user_id"/>
         <result property="payNo" column="pay_no"/>
         <result property="merchSn" column="merch_sn"/>
+		<result property="merchOrderSn" column="merch_order_sn"/>
         <result property="payPrice" column="pay_price"/>
         <result property="goodsBizType" column="goods_biz_type"/>
         <result property="createrSn" column="creater_sn"/>
@@ -23,6 +24,7 @@
 			`id`,
 			`order_sn`,
 			`user_id`,
+			`merch_order_sn`,
 			`pay_no`,
 			`merch_sn`,
 			`pay_price`,
@@ -41,6 +43,7 @@
     		`id`,
     		`order_sn`,
     		`user_id`,
+			`merch_order_sn`,
     		`pay_no`,
     		`merch_sn`,
     		`pay_price`,
@@ -81,6 +84,7 @@
 			`id`,
 			`order_sn`,
 			`user_id`,
+			`merch_order_sn`,
 			`pay_no`,
 			`merch_sn`,
 			`pay_price`,
@@ -94,6 +98,7 @@
 			#{id},
 			#{orderSn},
 			#{userId},
+			#{merchOrderSn},
 			#{payNo},
 			#{merchSn},
 			#{payPrice},
@@ -110,6 +115,7 @@
 		<set>
 			<if test="orderSn != null">`order_sn` = #{orderSn}, </if>
 			<if test="userId != null">`user_id` = #{userId}, </if>
+			<if test="merchOrderSn != null">`merch_order_sn` = #{merchOrderSn}, </if>
 			<if test="payNo != null">`pay_no` = #{payNo}, </if>
 			<if test="merchSn != null">`merch_sn` = #{merchSn}, </if>
 			<if test="payPrice != null">`pay_price` = #{payPrice}, </if>

+ 7 - 3
wx-mall/pages/catalog/catalog.js

@@ -49,9 +49,9 @@ Page({
         openCoupon: true
       });
     }
-    that.setData({
-      goodsBizType: app.globalData.appGoodsBizType
-    });
+    // that.setData({
+    //   goodsBizType: app.globalData.appGoodsBizType
+    // });
 
     wx.setNavigationBarTitle({
       title: '分类'
@@ -235,24 +235,28 @@ Page({
         that.setData({
           'goodsBizType': '00'
         });
+        app.globalData.appGoodsBizType = '00';
         this.getGoodsList();
         break;
       case 'discountActivity':
         that.setData({
           'goodsBizType': '02'
         });
+        app.globalData.appGoodsBizType = '02';
         this.getGoodsList();
         break;
       case 'groupActivity':
         that.setData({
           'goodsBizType': '10'
         });
+        app.globalData.appGoodsBizType = '10';
         this.getGoodsList();
         break;
       case 'ordActivity':
         that.setData({
           'goodsBizType': '11'
         });
+        app.globalData.appGoodsBizType = '11';
         this.getGoodsList();
         break;
       case 'sellSort':