|
|
@@ -24,6 +24,7 @@ import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
/*
|
|
|
*项目名: netflix
|
|
|
@@ -74,6 +75,7 @@ public class EquipmentDistributeServiceImpl implements EquipmentDistributeServic
|
|
|
}
|
|
|
} catch (DuplicateKeyException e) {
|
|
|
log.info("实物分销被邀请人id:{}重复插入", userId);
|
|
|
+ } catch (Exception e) {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -176,13 +178,19 @@ public class EquipmentDistributeServiceImpl implements EquipmentDistributeServic
|
|
|
equipmentUserReceiveBenefitsRecordMapper.updateById(receiveBenefitsRecord);
|
|
|
}
|
|
|
|
|
|
- public void sendInvitedUserEquipmentCoupon(Long userId) {
|
|
|
+ public void sendInvitedUserEquipmentCoupon(Long userId) throws Exception {
|
|
|
SysConfig config = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
|
|
|
.eq(SysConfig::getSysKey, Constant.EQUIPMENT_DISTRIBUTE_KEY).last("limit 1"));
|
|
|
- EquipmentConfigDto equipmentConfigDto = Jsons.parseObject(config, EquipmentConfigDto.class);
|
|
|
- equipmentConfigDto.getCouponIds().forEach(couponId->{
|
|
|
- couponCommonService.sendCouponToUser(userId, couponId, null, null, null, CouponUser.Channel.equipment);
|
|
|
+ Optional.ofNullable(config).ifPresent(cf->{
|
|
|
+ EquipmentConfigDto equipmentConfigDto = null;
|
|
|
+ try {
|
|
|
+ equipmentConfigDto = Jsons.parseObject(config.getSysValue(), EquipmentConfigDto.class);
|
|
|
+ equipmentConfigDto.getCouponIds().forEach(couponId->{
|
|
|
+ couponCommonService.sendCouponToUser(userId, couponId, null, null, null, CouponUser.Channel.equipment);
|
|
|
+ });
|
|
|
+ redisService.set(RedisService.key.EQUIPMENT_DISTRIBUTE_COUPON_KEY.getNameFormat(userId), userId, RedisService.key.EQUIPMENT_DISTRIBUTE_COUPON_KEY.getTimeout());
|
|
|
+ } catch (Exception e) {
|
|
|
+ }
|
|
|
});
|
|
|
- redisService.set(RedisService.key.EQUIPMENT_DISTRIBUTE_COUPON_KEY.getNameFormat(userId), userId, RedisService.key.EQUIPMENT_DISTRIBUTE_COUPON_KEY.getTimeout());
|
|
|
}
|
|
|
}
|