Pārlūkot izejas kodu

fix 邮箱交付

zoujiajian 3 gadi atpakaļ
vecāks
revīzija
27c0709d0b

+ 4 - 2
netflix-service/src/main/java/com/cyksj/service/mail/impl/MailServiceImpl.java

@@ -90,7 +90,7 @@ public class MailServiceImpl implements MailService {
 	public void sendCoursewareByGoodsId(Long goodsId, Long relationId, Long userId, String goodsTitle, String email) throws Exception {
 		//获取当前目前下的课程文件
 		MimeMessage msg = mailSender.createMimeMessage();
-		MimeMessageHelper helper = new MimeMessageHelper(msg,true);
+		MimeMessageHelper helper = new MimeMessageHelper(msg, true, "utf-8");
 		List<GoodsCoursewareFile> coursewareFiles = coursewareFileMapper.selectList(Wrappers.lambdaQuery(GoodsCoursewareFile.class)
 				.eq(GoodsCoursewareFile::getGoodsId, goodsId)
 				.eq(GoodsCoursewareFile::getStatus, true));
@@ -102,7 +102,7 @@ public class MailServiceImpl implements MailService {
 		StringBuilder sb = new StringBuilder(IMG_HTML.length());
 		coursewareFiles.forEach(file->{
 			try {
-				helper.addAttachment(MimeUtility.encodeText(file.getFileName()), new File(file.getPath()));
+				helper.addAttachment(MimeUtility.encodeText(file.getFileName(), "utf-8", "B"), new File(file.getPath()));
 				if (StrUtil.isNotBlank(file.getImg())) {
 					sb.append(String.format(IMG_HTML, file.getImg()));
 					sb.append("<br/>");
@@ -126,8 +126,10 @@ public class MailServiceImpl implements MailService {
 		helper.setTo(email);
 		TASK_EXECUTOR.execute(() -> {
 			try {
+				log.info("开始给用户userId:{},relationId:{} 发送课程:{}专属课件", userId, relationId, goodsTitle);
 				mailSender.send(msg);
 			} catch (Exception e) {
+				log.info("发送课件失败,error:{}", StringUtil.getErrorText(e));
 				groupsRelationMapper.update(null, Wrappers.lambdaUpdate(GroupsRelation.class)
 						.set(GroupsRelation::getAccount, null)
 						.eq(GroupsRelation::getId, relationId)

+ 11 - 38
netflix-web/src/main/java/com/cyksj/web/controller/goods/GoodsDonController.java

@@ -62,12 +62,7 @@ public class GoodsDonController {
      * 获取商品列表
      */
     @GetMapping("/get")
-    public Result<SearchResult<GoodsDon>> get(Boolean isLogin) {
-        Long userId = null;
-        if (isLogin != null && isLogin) {
-            userId = StpUserUtil.getLoginIdAsLong();
-        }
-        final Long fUid = userId;
+    public Result<SearchResult<GoodsDon>> get() {
         SearchResult<GoodsDon> search = beanSearcher.search(GoodsDon.class, MapUtils.flatBuilder(request.getParameterMap())
                 .field(GoodsDon::getStatus, true)
                 .field(GoodsDon::getDeleted, true)
@@ -86,13 +81,6 @@ public class GoodsDonController {
                 goods.setSoldNum(goods.getVirtualSold() + orderDonMapper.selectCount(Wrappers.lambdaQuery(OrderDon.class)
                         .eq(OrderDon::getGoodsId, goods.getId())
                         .notIn(OrderDon::getStatus, Constant.noOrderStatus)));
-                if (fUid != null) {
-                    //设置特定价格
-                    if (!isPaySpecificGoodsIds(sku.getSpecificGoodsIds(), fUid)) {
-                        sku.setSpecificGoodsIds(null);
-                        sku.setSpecificPrice(null);
-                    }
-                }
             });
         });
         return GatewayResponse.SUCCESS.newBuilder().toResult(search);
@@ -168,21 +156,17 @@ public class GoodsDonController {
      * 官网首页 平台列表
      */
     @GetMapping("/get/list")
-    public Result<List<GoodsFrontListView>> getGoodsList(Boolean isLogin) {
+    public Result<List<GoodsFrontListView>> getGoodsList() {
         List<Long> filter_goodsIds = getFilterGoodsIds();
         String pcCacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "PC";
         if (CollUtil.isNotEmpty(filter_goodsIds)) {
             pcCacheKey += ":hz-ip";
         }
-        Long userId = null;
-        if (isLogin != null && isLogin) {
-            userId = StpUserUtil.getLoginIdAsLong();
-        }
-        final Long fUid = userId;
+        Long fUid = StpUserUtil.getUserIdAfterLogin();
         Object value = redisService.get(pcCacheKey);
         if (value != null) {
             try {
-                List<GoodsFrontListView> list = Jsons.parseObject(value, List.class);
+                List<GoodsFrontListView> list = Jsons.parseList(value, GoodsFrontListView.class);
                 if (CollUtil.isNotEmpty(list)) {
                     //设置特定价格
                     setSpecificPrice(list, fUid);
@@ -227,21 +211,17 @@ public class GoodsDonController {
      * h5 银河首页平台展示
      */
     @GetMapping("/get/homePage")
-    public Result<List<GoodsFrontListView>> getGoodsHomePage(Boolean isLogin) {
+    public Result<List<GoodsFrontListView>> getGoodsHomePage() {
         List<Long> filter_goodsIds = getFilterGoodsIds();
         String h5CacheKey = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "H5";
         if (CollUtil.isNotEmpty(filter_goodsIds)) {
             h5CacheKey += ":hz-ip";
         }
-        Long userId = null;
-        if (isLogin != null && isLogin) {
-            userId = StpUserUtil.getLoginIdAsLong();
-        }
-        final Long fUid = userId;
+        Long fUid = StpUserUtil.getUserIdAfterLogin();
         Object value = redisService.get(h5CacheKey);
         if (value != null) {
             try {
-                List<GoodsFrontListView> list = Jsons.parseObject(value, List.class);
+                List<GoodsFrontListView> list = Jsons.parseList(value, GoodsFrontListView.class);
                 if (CollUtil.isNotEmpty(list)) {
                     //设置特定价格
                     setSpecificPrice(list, fUid);
@@ -302,12 +282,9 @@ public class GoodsDonController {
      * 获取商品详情
      */
     @GetMapping("/get/{id}")
-    public Result<GoodsDonViews> getDetail(@PathVariable Long id, Boolean isLogin) {
+    public Result<GoodsDonViews> getDetail(@PathVariable Long id) {
         Long userId = null;
-        if (isLogin != null && isLogin) {
-            userId = StpUserUtil.getLoginIdAsLong();
-        }
-        final Long fUid = userId;
+        Long fUid = StpUserUtil.getUserIdAfterLogin();
         GoodsDonViews views = beanSearcher.searchFirst(GoodsDonViews.class, MapUtils.builder().field(GoodsDonViews::getId, id).build());
 
         views.setSpecs(beanSearcher.searchFirst(GoodsDonSpecFrontView.class, MapUtils.builder().field(GoodsDonSpecFrontView::getGoodsId, views.getId()).build()));
@@ -338,14 +315,10 @@ public class GoodsDonController {
      * 获取商品推荐平台
      */
     @GetMapping("/get/recommend/{id}")
-    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id, Boolean isLogin) throws Exception {
+    public Result<List<GoodsFrontListView>> getRecommendGoodsByGid(@PathVariable Long id) throws Exception {
         String key = RedisService.key.YH_HOME_PAGHE_CACHE.getName() + "recommend:" + id;
         Object value = redisService.get(key);
-        Long userId = null;
-        if (isLogin != null && isLogin) {
-            userId = StpUserUtil.getLoginIdAsLong();
-        }
-        final Long fUid = userId;
+        Long fUid = StpUserUtil.getUserIdAfterLogin();
         if (value != null) {
             List<GoodsFrontListView> goodsRecommendViews = Jsons.parseList(value.toString(), GoodsFrontListView.class);
             setSpecificPrice(goodsRecommendViews, fUid);

+ 3 - 1
netflix-web/src/main/java/com/cyksj/web/controller/user/DistributePopularizeController.java

@@ -112,7 +112,9 @@ public class DistributePopularizeController {
 			GoodsDon goodsDon = goodsDonMapper.selectById(data.getGoodsId());
 			GoodsDonSku goodsDonSku = goodsDonSkuMapper.selectById(data.getSkuId());
 			data.setGoodsTitle(goodsDon.getTitle());
-			data.setSpecVal(goodsDonSku.getSpecVal());
+			if (goodsDonSku != null) {
+				data.setSpecVal(goodsDonSku.getSpecVal());
+			}
 			data.setWaitGetMoney(data.getPoints().divide(points).multiply(money).divide(oneHundred));
 		});
 		return GatewayResponse.SUCCESS.newBuilder().toResult(search);

+ 7 - 0
netflix-web/src/main/java/com/cyksj/web/util/StpUserUtil.java

@@ -86,6 +86,13 @@ public class StpUserUtil {
         return stpLogic.isLogin();
     }
 
+    public static Long getUserIdAfterLogin() {
+        if (isLogin()) {
+            return StpUserUtil.getLoginIdAsLong();
+        }
+        return null;
+    }
+
     public static void checkLogin() {
         stpLogic.checkLogin();
     }