Explorar el Código

[update] message:1.生成海报悄悄话逻辑调整

kelei hace 6 meses
padre
commit
05472929e8

+ 7 - 7
admin/src/main/java/com/flyer/foster/service/impl/TreePosterContentServiceImpl.java

@@ -58,12 +58,14 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
 
         if (posterLib != null) {
             // 查询该时间段是否已经插入海报悄悄话
-            List<TreePosterContent> treePosterContentList = this.lambdaQuery()
+            TreePosterContent treePosterContent = this.lambdaQuery()
                     .eq(TreePosterContent::getPosterLibId, posterLib.getId())
-                    .list();
-            if (treePosterContentList.size() == 0) {
+                    .eq(TreePosterContent::getAppUserId, addDTO.getAppUserId())
+                    .eq(TreePosterContent::getTreeId, addDTO.getTreeId())
+                    .one();
+            if (treePosterContent == null) {
                 // 2.获取悄悄话,取最新一条记录
-                TreePosterContent treePosterContent = new TreePosterContent();
+                treePosterContent = new TreePosterContent();
                 BeanUtil.copyProperties(addDTO, treePosterContent);
                 treePosterContent.setTenantId(tenantId);
                 treePosterContent.setPosterLibId(posterLib.getId());
@@ -76,10 +78,8 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
                 treePosterContent.setStatus(1);
                 // 新增
                 this.save(treePosterContent);
-                BeanUtil.copyProperties(treePosterContent, respDTO);
-            } else {
-                BeanUtil.copyProperties(treePosterContentList.get(0), respDTO);
             }
+            BeanUtil.copyProperties(treePosterContent, respDTO);
         }
         return respDTO;
     }