|
|
@@ -1525,83 +1525,6 @@ public class WxCouponOrderServiceImpl implements WxCouponOrderService { |
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(propagation = Propagation.REQUIRED, readOnly = false, rollbackFor = {Exception.class}) |
|
|
|
public WxCouponOrder verifyByEquiment(Long couponOrderId,String tenantId,String parentTenantId,String remark) { |
|
|
|
|
|
|
|
TenantEntity tenantEntity = new TenantEntity(); |
|
|
|
tenantEntity.setTenantId(tenantId); |
|
|
|
tenantEntity.setParentTenantId(parentTenantId); |
|
|
|
|
|
|
|
WxCouponOrderCVo wxCouponOrderCVo = this.detailCUserVo(String.valueOf(couponOrderId),tenantEntity); |
|
|
|
if (wxCouponOrderCVo == null) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
WxCUserBasicInfo wxCUserBasicInfo = wxCUserBasicInfoService.getById(wxCouponOrderCVo.getcUserId(),wxCouponOrderCVo.getFinalTenantId()); |
|
|
|
if (wxCUserBasicInfo != null && EnumCreditLockedStatus.CLOSE.getCode().equals(wxCUserBasicInfo.getStatus())) { |
|
|
|
throw new MallinkException(ErrorCode.MEMBER_IS_LOCKED); |
|
|
|
} |
|
|
|
|
|
|
|
Date now = new Date(); |
|
|
|
if (wxCouponOrderCVo.getValidType().equals(EnumCouponValidType.BETWEEN_TWO_TIME.getCode())){ |
|
|
|
// && !wxCouponOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())) { |
|
|
|
if(wxCouponOrderCVo.getType().equals(EnumCouponType.COUPON_PREORDER.getCode())){ |
|
|
|
if (wxCouponOrderCVo.getPickStartDate().after(now)) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_EARLIER_THAN_VALIDDATE); |
|
|
|
} |
|
|
|
if (wxCouponOrderCVo.getPickEndDate().before(now)) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_LATER_THAN_VALIDDATE); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
if (wxCouponOrderCVo.getValidStartDate().after(now)) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_EARLIER_THAN_VALIDDATE); |
|
|
|
} |
|
|
|
if (wxCouponOrderCVo.getValidEndDate().before(now)) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_LATER_THAN_VALIDDATE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
if (wxCouponOrderCVo.getExpiredTime().before(now)) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_IS_EXPIRED); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
WxCouponOrder wxCouponOrder = this.getById(couponOrderId,tenantEntity.getTenantId()); |
|
|
|
if (wxCouponOrder == null) { |
|
|
|
throw new MallinkException(ErrorCode.COUPON_ORDER_IS_NULL); |
|
|
|
} |
|
|
|
|
|
|
|
SysConfig sysConfig = sysConfigService.getByKey(SysConfigConstant.default_merchant_b_user, tenantEntity); |
|
|
|
if (null == sysConfig) { |
|
|
|
throw new MallinkException(ErrorCode.SYS_CONFIG_DEFAULT_MERCHANT_B_USER_UNSET); |
|
|
|
} |
|
|
|
|
|
|
|
WxMerchantBUser wxMerchantBUser = wxMerchantBUserService.getById(Long.parseLong(sysConfig.getConfigItemValue())); |
|
|
|
if (wxMerchantBUser == null) { |
|
|
|
throw new MallinkException(ErrorCode.USER_IS_EMPTY.getCode(), "核销员ID不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
WxCouponOrder couponOrder = null; |
|
|
|
try { |
|
|
|
wxCouponOrder.setVerifyRemark(remark); |
|
|
|
couponOrder = this.verify(wxCouponOrder, wxMerchantBUser, EnumCouponVerifyType.VERIFY_B); |
|
|
|
} catch (MallinkException e) { |
|
|
|
logger.error("核销异常: " ,e); |
|
|
|
throw new MallinkException(e.getErrorCode(), e.getMessage()); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("核销异常: " ,e); |
|
|
|
throw new MallinkException(ErrorCode.VERIFY_ERROR.getCode(), e.getMessage()); |
|
|
|
} |
|
|
|
|
|
|
|
if (couponOrder != null) { |
|
|
|
this.sendInsideCouponVerifyMsg(couponOrder.getId(),couponOrder, wxMerchantBUser.getMerchantId(), wxMerchantBUser); |
|
|
|
} |
|
|
|
|
|
|
|
return couponOrder; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 核销增加成长值,积分 |
|
|
|