Browse Source

fix bug

release_toaliyun_real
xiaohanzi 4 years ago
parent
commit
c72cae6121
3 changed files with 28 additions and 4 deletions
  1. +1
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java
  2. +4
    -4
      mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java
  3. +23
    -0
      mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml

+ 1
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponOrderMapper.java View File

@@ -33,6 +33,7 @@ public interface WxCouponOrderMapper extends CommonMapper<WxCouponOrder, Long> {


//统一的计数接口 //统一的计数接口
int findCount(WxCouponOrder wxCouponOrder); int findCount(WxCouponOrder wxCouponOrder);
int findProductCount(WxCouponOrder wxCouponOrder);
List<Map<String, Object>> getCountByBusinessId(WxCouponOrder wxCouponOrder); List<Map<String, Object>> getCountByBusinessId(WxCouponOrder wxCouponOrder);
List<Map<String, Object>> getCountBySubBusinessId(WxCouponOrder wxCouponOrder); List<Map<String, Object>> getCountBySubBusinessId(WxCouponOrder wxCouponOrder);
//统一额度统计接口 //统一额度统计接口


+ 4
- 4
mallinkService/src/main/java/com/iformall/service/impl/WxOrderServiceImpl.java View File

@@ -462,7 +462,7 @@ public class WxOrderServiceImpl implements WxOrderService {
* @param counpon * @param counpon
* @return * @return
*/ */
private int getUserCouponOrderCount(WxCUserBasicInfo user, WxCoupon counpon) {
private int getUserCouponOrderCount(WxCUserBasicInfo user, WxCoupon counpon,int couponNumber) {
// + couponOrder ---待使用 // + couponOrder ---待使用
try { try {
WxCouponOrder couponOrderQ = new WxCouponOrder(); WxCouponOrder couponOrderQ = new WxCouponOrder();
@@ -475,7 +475,7 @@ public class WxOrderServiceImpl implements WxOrderService {
// if (counpon.getSendType().equals(EnumCouponSendType.PASSIVE.getCode())) { // if (counpon.getSendType().equals(EnumCouponSendType.PASSIVE.getCode())) {
// couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode()); // couponOrderQ.setCouponOrderStatus(EnumCouponOrderStatus.COUPON_ORDER_USE_WAIT.getCode());
// } // }
return wxCouponOrderMapper.findCount(couponOrderQ);
return wxCouponOrderMapper.findProductCount(couponOrderQ)+couponNumber;
} catch (Exception e) { } catch (Exception e) {
logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage(),e); logger.error("购买是否超限-DB, couponId: " + counpon.getId() + ", e:" + e.getMessage(),e);
throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"["+counpon.getTitle()+"]查询待使用订单错误."); throw new MallinkException(ErrorCode.ORDER_IS_FAIL.getCode(),"["+counpon.getTitle()+"]查询待使用订单错误.");
@@ -532,7 +532,7 @@ public class WxOrderServiceImpl implements WxOrderService {
// } // }
// 检查用户已购买数量 // 检查用户已购买数量
try { try {
count = getUserCouponOrderCount(user, coupon);
count = getUserCouponOrderCount(user, coupon,1);
} catch (Exception e) { } catch (Exception e) {
//解锁 //解锁
redisLock.unlock(couponIdStr, timeStr); redisLock.unlock(couponIdStr, timeStr);
@@ -632,7 +632,7 @@ public class WxOrderServiceImpl implements WxOrderService {


// 检查用户已购买数量 // 检查用户已购买数量
try { try {
count = getUserCouponOrderCount(user, coupon);
count = getUserCouponOrderCount(user, coupon,number);
} catch (Exception e) { } catch (Exception e) {
throw new MallinkException(ErrorCode.DB_FAIL.getCode(),"["+coupon.getTitle()+"]查询待使用订单错误."); throw new MallinkException(ErrorCode.DB_FAIL.getCode(),"["+coupon.getTitle()+"]查询待使用订单错误.");
} }


+ 23
- 0
mallinkService/src/main/resources/mapper/WxCouponOrderMapper.xml View File

@@ -519,6 +519,29 @@
</if> </if>
</if> </if>
</select> </select>
<select id="findProductCount" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="java.lang.Integer">
select sum(coupon_number) FROM wx_coupon_order co
where 1=1
<if test=" null != tenantId and '' != tenantId">
and co.`tenant_id` = #{tenantId}
</if>
<if test=" null != parentTenantId and '' != parentTenantId">
and co.`parent_tenant_id` = #{parentTenantId}
</if>
<if test=" null != couponOrderStatus">
and co.coupon_order_status = #{couponOrderStatus}
</if>
<if test=" null != cUserId">
and co.c_user_id = #{cUserId}
</if>
<if test=" null != couponId ">
and co.coupon_id = #{couponId}
</if>
<if test=" null != couponType ">
and co.coupon_type = #{couponType}
</if>
</select>


<select id="getCountByBusinessId" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="hashmap"> <select id="getCountByBusinessId" parameterType="com.iformall.domain.po.WxCouponOrder" resultType="hashmap">
select c.business, COUNT(c.business) bu_count select c.business, COUNT(c.business) bu_count


Loading…
Cancel
Save