小程序领取优惠券
This commit is contained in:
parent
3c39f44dc1
commit
e682722d5f
@ -444,8 +444,6 @@ public class PatientCenterServiceImpl implements PatientCenterService {
|
|||||||
return AjaxResult.error("用户不存在,无法领取!");
|
return AjaxResult.error("用户不存在,无法领取!");
|
||||||
}
|
}
|
||||||
PatientCouponReceiveInfoVO patientCouponReceive = patientCouponReceiveMapper.selectPatientCouponReceive(patientId, couponId);
|
PatientCouponReceiveInfoVO patientCouponReceive = patientCouponReceiveMapper.selectPatientCouponReceive(patientId, couponId);
|
||||||
//查询微信小程序订阅消息记录表该会员是否已订阅
|
|
||||||
SubscribeMessageRecord subscribeMessageRecord = subscribeMessageRecordMapper.selectSubscribeMessageRecordByPatientId(null, patientInfo.getOpenid(), appletChatConfig.getCouponReceiveTemplateId());
|
|
||||||
if (Objects.nonNull(patientCouponReceive)) {
|
if (Objects.nonNull(patientCouponReceive)) {
|
||||||
if (StringUtils.isNotBlank(patientCouponReceive.getUseStatus()) && !CouponUseStatusEnum.WAIT_RECEIVE.getInfo().equals(patientCouponReceive.getUseStatus())) {
|
if (StringUtils.isNotBlank(patientCouponReceive.getUseStatus()) && !CouponUseStatusEnum.WAIT_RECEIVE.getInfo().equals(patientCouponReceive.getUseStatus())) {
|
||||||
return AjaxResult.error("该优惠券已领取!");
|
return AjaxResult.error("该优惠券已领取!");
|
||||||
@ -457,17 +455,10 @@ public class PatientCenterServiceImpl implements PatientCenterService {
|
|||||||
patientCouponReceive.setUpdateTime(LocalDateTime.now());
|
patientCouponReceive.setUpdateTime(LocalDateTime.now());
|
||||||
patientCouponReceive.setCouponType(CouponTypeEnum.FULL_REDUCTION_COUPON.getInfo());
|
patientCouponReceive.setCouponType(CouponTypeEnum.FULL_REDUCTION_COUPON.getInfo());
|
||||||
patientCouponReceiveMapper.updatePatientCouponReceive(patientCouponReceive);
|
patientCouponReceiveMapper.updatePatientCouponReceive(patientCouponReceive);
|
||||||
boolean subscribeMessage = Objects.nonNull(subscribeMessageRecord)
|
|
||||||
&& StringUtils.isNotBlank(subscribeMessageRecord.getSubscribeStatus())
|
|
||||||
&& SubscribeStatusEnum.ACCEPT.getInfo().equals(subscribeMessageRecord.getSubscribeStatus());
|
|
||||||
if (BooleanUtils.isTrue(subscribeMessage)) {
|
|
||||||
//优惠券领取异步发送信息
|
|
||||||
messagePushService.messageCouponReceiveThread(subscribeMessageRecord, patientCouponReceive);
|
|
||||||
}
|
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
//组装优惠券信息 并发送订阅消息
|
//组装优惠券信息 并发送订阅消息
|
||||||
this.setCouponReceive(patientId, couponId, subscribeMessageRecord);
|
this.setCouponReceive(patientId, couponId);
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,11 +621,10 @@ public class PatientCenterServiceImpl implements PatientCenterService {
|
|||||||
/**
|
/**
|
||||||
* 组装优惠券信息 并发送订阅消息
|
* 组装优惠券信息 并发送订阅消息
|
||||||
*
|
*
|
||||||
* @param patientId 会员id
|
* @param patientId 会员id
|
||||||
* @param couponId 优惠券id
|
* @param couponId 优惠券id
|
||||||
* @param subscribeMessageRecord 微信小程序订阅消息记录信息
|
|
||||||
**/
|
**/
|
||||||
private void setCouponReceive(Long patientId, Long couponId, SubscribeMessageRecord subscribeMessageRecord) {
|
private void setCouponReceive(Long patientId, Long couponId) {
|
||||||
//组装优惠券信息
|
//组装优惠券信息
|
||||||
Coupon couponInfo = couponMapper.selectCouponById(couponId);
|
Coupon couponInfo = couponMapper.selectCouponById(couponId);
|
||||||
PatientCouponReceive couponReceive = new PatientCouponReceive();
|
PatientCouponReceive couponReceive = new PatientCouponReceive();
|
||||||
@ -651,16 +641,5 @@ public class PatientCenterServiceImpl implements PatientCenterService {
|
|||||||
couponReceive.setCouponDescription(com.xinelu.common.utils.StringUtils.isBlank(couponInfo.getCouponDescription()) ? "" : couponInfo.getCouponDescription());
|
couponReceive.setCouponDescription(com.xinelu.common.utils.StringUtils.isBlank(couponInfo.getCouponDescription()) ? "" : couponInfo.getCouponDescription());
|
||||||
couponReceive.setUseStatus(CouponUseStatusEnum.NOT_USED.getInfo());
|
couponReceive.setUseStatus(CouponUseStatusEnum.NOT_USED.getInfo());
|
||||||
patientCouponReceiveMapper.insertPatientCouponReceive(couponReceive);
|
patientCouponReceiveMapper.insertPatientCouponReceive(couponReceive);
|
||||||
//新建对象并复制
|
|
||||||
PatientCouponReceiveInfoVO couponReceiveInfoVO = new PatientCouponReceiveInfoVO();
|
|
||||||
BeanUtils.copyProperties(couponReceive, couponReceiveInfoVO);
|
|
||||||
couponReceiveInfoVO.setCouponType(CouponTypeEnum.FULL_REDUCTION_COUPON.getInfo());
|
|
||||||
boolean subscribeMessage = Objects.nonNull(subscribeMessageRecord)
|
|
||||||
&& StringUtils.isNotBlank(subscribeMessageRecord.getSubscribeStatus())
|
|
||||||
&& SubscribeStatusEnum.ACCEPT.getInfo().equals(subscribeMessageRecord.getSubscribeStatus());
|
|
||||||
if (BooleanUtils.isTrue(subscribeMessage)) {
|
|
||||||
//异步发送信息
|
|
||||||
messagePushService.messageCouponReceiveThread(subscribeMessageRecord, couponReceiveInfoVO);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user