|
@@ -39,6 +39,7 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -74,6 +75,9 @@ public class WxController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private CouponReceiveService couponReceiveService;
|
|
private CouponReceiveService couponReceiveService;
|
|
|
|
|
|
|
|
+ @Resource(name = "commonAsyncExecutor")
|
|
|
|
+ private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 获取二维码
|
|
* 获取二维码
|
|
*
|
|
*
|
|
@@ -242,8 +246,9 @@ public class WxController extends BaseController {
|
|
user.setcIcon(avatarUrl);
|
|
user.setcIcon(avatarUrl);
|
|
user.setcPhone(phoneNumber);
|
|
user.setcPhone(phoneNumber);
|
|
wxUserService.save(user);
|
|
wxUserService.save(user);
|
|
- //添加新人优惠卷
|
|
|
|
- couponReceiveService.submit(new CouponReceive().setOpenid(user.getcOpenid()).setCouponId("1"));
|
|
|
|
|
|
+ //异步 添加新人优惠卷
|
|
|
|
+ TWxUser finalUser = user;
|
|
|
|
+ threadPoolTaskExecutor.submit(()->couponReceiveService.submit(new CouponReceive().setOpenid(finalUser.getcOpenid()).setCouponId("1")));
|
|
user.setId(user.getId());
|
|
user.setId(user.getId());
|
|
}
|
|
}
|
|
|
|
|