zoujiajian 3 ani în urmă
părinte
comite
5b1b203b34

+ 3 - 1
netflix-dao/src/main/resources/mapper/CouponUserMapper.xml

@@ -187,11 +187,13 @@
                c.discount,
                c.use_scope,
                c.goods_sku_ids,
+               cu.valid_start_time,
+               cu.valid_end_time,
                unix_timestamp(cu.valid_end_time) * 1000 as validEndTimestamp
         from (select coupon_id,
                      valid_start_time,
                      valid_end_time,
-                     status
+                     status as couponUserStatus
               from `coupon_user`
               where channel = #{channel}
                 and user_id = #{userId}

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/coupon/impl/CouponFontServiceImpl.java

@@ -268,7 +268,7 @@ public class CouponFontServiceImpl implements CouponFontService {
 			}
 			couponUser.setValidStartTime(DateTime.now());
 			if (coupon.getValidHours() > 0) {
-				couponUser.setValidEndTime(DateUtil.offsetDay(couponUser.getValidStartTime(), coupon.getValidHours()));
+				couponUser.setValidEndTime(DateUtil.offsetHour(couponUser.getValidStartTime(), coupon.getValidHours()));
 				return;
 			}
 			couponUser.setValidEndTime(DateUtil.offsetDay(couponUser.getValidStartTime(), coupon.getValidDays()));

+ 17 - 4
netflix-service/src/main/java/com/cyksj/service/user/impl/UserServiceImpl.java

@@ -107,7 +107,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			this.save(user);
 			//发放新用户福利
 			final Long fUid = user.getId();
-			TASK_POOL.execute(() -> sendNewUserWelfare(fUid));
+			TASK_POOL.execute(() -> {
+				try {
+					sendNewUserWelfare(fUid);
+				} catch (Exception e) {
+				}
+			});
 		} else {
 			if (StrUtil.isEmpty(user.getRegisterEnv())) {
 				user.setRegisterEnv(registerEnv.name());
@@ -390,7 +395,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 			}
 			//发放新用户福利
 			final Long fUid = user.getId();
-			TASK_POOL.execute(() -> sendNewUserWelfare(fUid));
+			TASK_POOL.execute(() -> {
+				try {
+					sendNewUserWelfare(fUid);
+				} catch (Exception e) {
+				}
+			});
 		}
 		if (StrUtil.isEmpty(user.getShowId())) {
 			user.setShowId(getUserShowId(user.getId()));
@@ -402,10 +412,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
 	/**
 	 * 发放新用户福利
 	 */
-	public void sendNewUserWelfare(Long userId) {
+	public void sendNewUserWelfare(Long userId) throws Exception {
 		SysConfig newUserWelfareConfig = sysConfigService.getOne(Wrappers.lambdaQuery(SysConfig.class)
 				.eq(SysConfig::getSysKey, Constant.NEW_USER_WELFARE_KEY).last("limit 1"));
-		NewUserWelfareDto newUserWelfareDto = Jsons.parseObject(newUserWelfareConfig, NewUserWelfareDto.class);
+		if (StrUtil.isEmpty(newUserWelfareConfig.getSysValue())) {
+			return;
+		}
+		NewUserWelfareDto newUserWelfareDto = Jsons.parseObject(newUserWelfareConfig.getSysValue(), NewUserWelfareDto.class);
 		if (newUserWelfareDto != null) {
 			List<Long> couponIds = newUserWelfareDto.getCouponIds();
 			couponIds.forEach(couponId -> couponCommonService.sendCouponToUser(userId, couponId, null, null, null, CouponUser.Channel.new_welfare));