lhm пре 3 година
родитељ
комит
e23ba6a4f0

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

@@ -4389,19 +4389,19 @@ public class OrderServiceImpl implements OrderService {
                     String sku = goodsDetailsDto.getGoodsSn();
                     BigDecimal scoreLimitDecimal = skuScoreLimitMap.get(sku);
                     String prodBarcode = goodsDetailsDto.getProdBarcode();
-                    BigDecimal actualPaymentAmount = goodsDetailsDto.getActualPaymentAmount();
+                    BigDecimal retailPrice = goodsDetailsDto.getRetailPrice();
                     // 计算抵扣,当商品不是最后一个商品
                     if (i < index) {
                         // 商品总价
                         // 分摊积分
-                        BigDecimal shareScoreItem = actualPaymentAmount.divide(skuTotalPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(scoreIntegerDecimal);
+                        BigDecimal shareScoreItem = retailPrice.divide(skuTotalPrice, 2, BigDecimal.ROUND_HALF_UP).multiply(scoreIntegerDecimal);
                         shareScore = shareScore.add(shareScoreItem);
                         // 保留两位小数,四舍五入
                         BigDecimal discountedPrice = shareScore.divide(BigDecimal.valueOf(scoreLimit), 2, BigDecimal.ROUND_HALF_UP);
                         goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
                         goodsDetailsDto.setDiscountedPrice(discountedPrice);
                         goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
-                        goodsDetailsDto.setActualPaymentAmount(actualPaymentAmount.subtract(discountedPrice));
+                        goodsDetailsDto.setActualPaymentAmount(retailPrice.subtract(discountedPrice));
                     }
                     // 订单商品详情最后一个商品并且详情不止一个商品
                     if (i == index && size > 1) {// 商品总价
@@ -4411,11 +4411,11 @@ public class OrderServiceImpl implements OrderService {
                         goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
                         goodsDetailsDto.setDiscountedPrice(discountedPrice);
                         goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
-                        goodsDetailsDto.setActualPaymentAmount(actualPaymentAmount.subtract(discountedPrice));
+                        goodsDetailsDto.setActualPaymentAmount(retailPrice.subtract(discountedPrice));
                     }
                     // 订单商品详情只有一个商品的情况下
                     if (size == 1) {
-                        BigDecimal shareScoreItem = scoreIntegerDecimal.subtract(shareScore);
+                        shareScore = scoreIntegerDecimal;
                         // 3-1. 计算总价的50%,百分比可以进行设置,算出整数(向下取整)
                         BigDecimal halfPrice = orderTotalPrice.multiply(scoreLimitDecimal).setScale(0, BigDecimal.ROUND_FLOOR);
                         // 3-3. 计算积分抵扣后的价格
@@ -4426,8 +4426,8 @@ public class OrderServiceImpl implements OrderService {
                         }
                         goodsDetailScoreDeductionPrice = goodsDetailScoreDeductionPrice.add(discountedPrice);
                         goodsDetailsDto.setDiscountedPrice(discountedPrice);
-                        goodsDetailsDto.setDeductionScore(shareScoreItem.intValue());
-                        goodsDetailsDto.setActualPaymentAmount(actualPaymentAmount.subtract(discountedPrice));
+                        goodsDetailsDto.setDeductionScore(shareScore.intValue());
+                        goodsDetailsDto.setActualPaymentAmount(retailPrice.subtract(discountedPrice));
                     }
                     LOGGER.info("--------------------------------------------------------");
                     LOGGER.info("【计算优惠价】sku:【{}】,条码:【{}】积分抵扣{}元,抵扣积分{}分", sku, prodBarcode, goodsDetailsDto.getDiscountedPrice(), shareScore.intValue());

+ 10 - 2
kmall-admin/src/main/resources/mybatis/mapper/UserDao.xml

@@ -20,6 +20,8 @@
         <result property="weixinOpenid" column="weixin_openid"/>
         <result property="idNo" column="id_no"/>
         <result property="lastFaceTime" column="last_face_time"/>
+        <result property="openId" column="open_id"/>
+        <result property="memberCode" column="member_code"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.UserEntity">
@@ -107,7 +109,9 @@
 			`register_ip`,
 			`avatar`,
 			`weixin_openid`,
-			last_face_time)
+			last_face_time,
+			`open_id`,
+			`member_code`)
 		values(
 			#{username},
 			#{password},
@@ -123,7 +127,9 @@
 			#{registerIp},
 			#{avatar},
 			#{weixinOpenid},
-			#{lastFaceTime})
+			#{lastFaceTime},
+			#{openId},
+			#{memberCode})
 	</insert>
 
     <update id="update" parameterType="com.kmall.admin.entity.UserEntity">
@@ -144,6 +150,8 @@
             <if test="avatar != null">`avatar` = #{avatar},</if>
             <if test="weixinOpenid != null">`weixin_openid` = #{weixinOpenid}</if>
             <if test="lastFaceTime != null">`last_face_time` = #{lastFaceTime}</if>
+            <if test="openId != null">`open_id` = #{openId}</if>
+            <if test="memberCode != null">`member_code` = #{memberCode}</if>
         </set>
         where id = #{id}
     </update>