Răsfoiți Sursa

Merge branch 'master' into pre

zoujiajian 2 ani în urmă
părinte
comite
b573d3e78c

+ 2 - 0
netflix-dao/src/main/java/com/cyksj/mapper/OrderDonMapper.java

@@ -89,4 +89,6 @@ public interface OrderDonMapper extends BaseMapper<OrderDon> {
 	List<Long> getPayGoodsIds(@Param("userIds") List<Long> relationUserIdList);
 
 	BigDecimal getTotalRefundAmountTime(@Param("startDate") Date startDate, @Param("endDate") Date endDate);
+
+	BigDecimal getCouponUsedMoney(Long couponId);
 }

+ 6 - 0
netflix-dao/src/main/resources/mapper/OrderDonMapper.xml

@@ -507,4 +507,10 @@
             and created_time &lt; #{endDate}
         </if>
     </select>
+
+    <select id="getCouponUsedMoney" resultType="java.math.BigDecimal">
+        select sum(money) - sum(ifnull(refund_money, 0))
+        from (select id from coupon_user where coupon_id = #{couponId}) cu
+                 inner join order_don o on o.coupon_user_id = cu.id and o.status not in ('close', 'noPayment')
+    </select>
 </mapper>

+ 3 - 2
netflix-service/src/main/java/com/cyksj/service/relation/impl/GroupRelationFrontServiceImpl.java

@@ -588,10 +588,11 @@ public class GroupRelationFrontServiceImpl implements GroupRelationFrontService
 	public Integer getUserCodeNumBySkuId(Long userId, Long skuId, Boolean isHasVerifyCode) {
 		//查看双重验证码
 		UserFuncProperty userFuncProperty = userFuncPropertyMapper.selectOne(Wrappers.lambdaQuery(UserFuncProperty.class).eq(UserFuncProperty::getUserId, userId).last("limit 1"));
-		//默认0
-		int num = 0;
+		//默认2
+		int num = 2;
 		//有安全码查看次数 置为0
 		if (isHasVerifyCode) {
+			num = 0;
 			//存在身份实名认证有两次机会
 			List<Long> userIdList = userBindRelationService.getRelationUserIdList(userId, null);
 			Integer selectCount = userCertRecordMapper.selectCount(Wrappers.lambdaQuery(UserCertRecord.class)

+ 11 - 0
netflix-web/src/main/java/com/cyksj/web/controller/manage/coupon/CouponController.java

@@ -38,6 +38,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.validation.constraints.Min;
+import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -536,4 +538,13 @@ public class CouponController {
 				.build());
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);
 	}
+
+	/**
+	 * 使用优惠券订单金额
+	 */
+	@GetMapping("/get/used/money/{couponId}")
+	public Result<BigDecimal> getUsedMoney(@PathVariable Long couponId) {
+		BigDecimal money = Optional.ofNullable(orderDonMapper.getCouponUsedMoney(couponId)).orElse(BigDecimal.ZERO);
+		return GatewayResponse.SUCCESS.newBuilder().toResult(money.divide(BigDecimal.valueOf(100), 2, RoundingMode.DOWN));
+	}
 }