|
@@ -24,6 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
+import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
|
|
@@ -57,10 +58,12 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
|
|
|
|
|
|
if (posterLib != null) {
|
|
|
// 查询该时间段是否已经插入海报悄悄话
|
|
|
- TreePosterContent treePosterContent = this.lambdaQuery().eq(TreePosterContent::getPosterLibId, posterLib.getId()).one();
|
|
|
- if (treePosterContent == null) {
|
|
|
+ List<TreePosterContent> treePosterContentList = this.lambdaQuery()
|
|
|
+ .eq(TreePosterContent::getPosterLibId, posterLib.getId())
|
|
|
+ .list();
|
|
|
+ if (treePosterContentList.size() == 0) {
|
|
|
// 2.获取悄悄话,取最新一条记录
|
|
|
- treePosterContent = new TreePosterContent();
|
|
|
+ TreePosterContent treePosterContent = new TreePosterContent();
|
|
|
BeanUtil.copyProperties(addDTO, treePosterContent);
|
|
|
treePosterContent.setTenantId(tenantId);
|
|
|
treePosterContent.setPosterLibId(posterLib.getId());
|
|
@@ -74,7 +77,7 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
|
|
|
// 新增
|
|
|
this.save(treePosterContent);
|
|
|
}
|
|
|
- BeanUtil.copyProperties(treePosterContent, respDTO);
|
|
|
+ BeanUtil.copyProperties(treePosterContentList, respDTO);
|
|
|
}
|
|
|
return respDTO;
|
|
|
}
|
|
@@ -94,6 +97,7 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
|
|
|
IPage<TreePosterContent> pageInfo = this.lambdaQuery()
|
|
|
.eq(TreePosterContent::getAppUserId, queryDTO.getAppUserId())
|
|
|
.eq(TreePosterContent::getTreeId, queryDTO.getTreeId())
|
|
|
+ .orderByDesc(TreePosterContent::getCreatedTime)
|
|
|
.page(page);
|
|
|
List<AppTreePosterContentRespDTO> list = new ArrayList<>();
|
|
|
AppTreePosterContentRespDTO respDTO;
|
|
@@ -112,14 +116,23 @@ public class TreePosterContentServiceImpl extends ServiceImpl<ITreePosterContent
|
|
|
List<AppTreePosterContentRespDTO> list = new ArrayList<>();
|
|
|
AppTreePosterContentRespDTO respDTO;
|
|
|
|
|
|
+ LocalDateTime queryDateTime;
|
|
|
+ if (StrUtil.isNotBlank(queryDTO.getCreatedTime())) {
|
|
|
+ DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
|
|
+ queryDateTime = LocalDateTime.parse(queryDTO.getCreatedTime(), fmt);
|
|
|
+ } else {
|
|
|
+ queryDateTime = LocalDateTime.now();
|
|
|
+ }
|
|
|
// 当天最小时间
|
|
|
- LocalDateTime min = LocalDateTime.of(LocalDate.from(LocalDateTime.now()), LocalDateTime.MIN.toLocalTime());
|
|
|
+ LocalDateTime min = LocalDateTime.of(LocalDate.from(queryDateTime), LocalDateTime.MIN.toLocalTime());
|
|
|
// 当天最大时间
|
|
|
- LocalDateTime max = LocalDateTime.of(LocalDate.from(LocalDateTime.now()), LocalDateTime.MAX.toLocalTime());
|
|
|
+ LocalDateTime max = LocalDateTime.of(LocalDate.from(queryDateTime), LocalDateTime.MAX.toLocalTime());
|
|
|
+
|
|
|
|
|
|
List<TreePosterContent> treePosterContentList = this.lambdaQuery()
|
|
|
.eq(TreePosterContent::getTreeId, queryDTO.getTreeId())
|
|
|
.between(TreePosterContent::getCreatedTime, min, max)
|
|
|
+ .orderByDesc(TreePosterContent::getCreatedTime)
|
|
|
.list();
|
|
|
for (TreePosterContent treePosterContent : treePosterContentList) {
|
|
|
respDTO = new AppTreePosterContentRespDTO();
|