|
@@ -2,6 +2,7 @@ package com.ruoyi.system.utils;
|
|
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
import com.ruoyi.system.domain.PostCollections;
|
|
import com.ruoyi.system.domain.PostCollections;
|
|
|
|
+import com.ruoyi.system.domain.PostCollectionsSystem;
|
|
import com.ruoyi.system.domain.vo.PostCollectionsVo;
|
|
import com.ruoyi.system.domain.vo.PostCollectionsVo;
|
|
import com.ruoyi.system.mapper.PostCollectionsMapper;
|
|
import com.ruoyi.system.mapper.PostCollectionsMapper;
|
|
import com.ruoyi.system.mapper.PostCollectionsSystemMapper;
|
|
import com.ruoyi.system.mapper.PostCollectionsSystemMapper;
|
|
@@ -9,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
|
|
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
@@ -43,8 +45,8 @@ public class CollectionStatusJudgment {
|
|
Date endTime = postCollectionsVo.getEndTime();
|
|
Date endTime = postCollectionsVo.getEndTime();
|
|
//获取此藏品套系status
|
|
//获取此藏品套系status
|
|
Long systemId = postCollectionsVo.getSystemId();
|
|
Long systemId = postCollectionsVo.getSystemId();
|
|
-
|
|
|
|
String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId);
|
|
String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId);
|
|
|
|
+
|
|
if (Objects.equals(postCollectionsSystemStatus, "1")) {
|
|
if (Objects.equals(postCollectionsSystemStatus, "1")) {
|
|
//判空
|
|
//判空
|
|
if (null != startTime && null != endTime) {
|
|
if (null != startTime && null != endTime) {
|
|
@@ -79,22 +81,51 @@ public class CollectionStatusJudgment {
|
|
* @param systemId
|
|
* @param systemId
|
|
* @return 结果
|
|
* @return 结果
|
|
*/
|
|
*/
|
|
- public static void JudgmentStatus(Long systemId) {
|
|
|
|
|
|
+ public static void JudgmentStatus(List<Long> systemId,String status) {
|
|
PostCollections postCollections = new PostCollections();
|
|
PostCollections postCollections = new PostCollections();
|
|
- String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId);
|
|
|
|
|
|
+ List<PostCollectionsSystem> postCollectionsSystemList = postCollectionsSystemMapper.selectPostCollectionsSystemByIdList(systemId);
|
|
//判断藏品套系是否上架,如果没上架,令藏品status全部置为未上架
|
|
//判断藏品套系是否上架,如果没上架,令藏品status全部置为未上架
|
|
- if (null != postCollectionsSystemStatus) {
|
|
|
|
- if (Objects.equals(postCollectionsSystemStatus, "0")) {
|
|
|
|
|
|
+ for (int i = 0; i < postCollectionsSystemList.size(); i++) {
|
|
|
|
+ //判断套系是否status=0
|
|
|
|
+ if (Objects.equals(status, "0")) {
|
|
postCollections.setUpdateBy(getUsername());
|
|
postCollections.setUpdateBy(getUsername());
|
|
postCollections.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getTime()));
|
|
postCollections.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getTime()));
|
|
- postCollections.setSystemId(systemId);
|
|
|
|
|
|
+ postCollections.setSystemId(postCollectionsSystemList.get(i).getId());
|
|
//批量修改status,动态查询藏品列表
|
|
//批量修改status,动态查询藏品列表
|
|
postCollectionsMapper.updatePostCollectionsStatus(postCollections);
|
|
postCollectionsMapper.updatePostCollectionsStatus(postCollections);
|
|
} else {
|
|
} else {
|
|
//上架
|
|
//上架
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ Long id = postCollectionsSystemList.get(i).getId();
|
|
|
|
+ List<PostCollections> postCollectionsList = postCollectionsMapper.selectPostCollectionsList(id);//获取藏品列表根据套系id
|
|
|
|
+ for (int j = 0; j < postCollectionsList.size(); j++) {
|
|
|
|
+ postCollectionsList.get(j).setUpdateBy(getUsername());
|
|
|
|
+ postCollectionsList.get(j).setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.getTime()));
|
|
|
|
+ postCollectionsList.get(j).setSystemId(postCollectionsSystemList.get(i).getId());
|
|
|
|
+ //获取时间线
|
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
|
+ Date startTime = postCollectionsList.get(j).getStartTime();
|
|
|
|
+ Date endTime = postCollectionsList.get(j).getEndTime();
|
|
|
|
+ //判空
|
|
|
|
+ if (null != startTime && null != endTime) {
|
|
|
|
+ if (nowDate.before(startTime)) {
|
|
|
|
+ postCollectionsList.get(j).setStatus("0");//预售
|
|
|
|
+ }else if (nowDate.after(endTime)) {
|
|
|
|
+ postCollectionsList.get(j).setStatus("3");//已过期
|
|
|
|
+ }else if (startTime.before(nowDate) &&
|
|
|
|
+ endTime.after(nowDate) &&
|
|
|
|
+ null!=postCollectionsList.get(j).getCollectionsNumber()&&
|
|
|
|
+ postCollectionsList.get(j).getCollectionsNumber() > 0) {
|
|
|
|
+ postCollectionsList.get(j).setStatus("2");//正在售卖
|
|
|
|
+ } else if (startTime.before(nowDate) &&
|
|
|
|
+ endTime.after(nowDate) &&
|
|
|
|
+ null!=postCollectionsList.get(j).getCollectionsNumber()&&
|
|
|
|
+ postCollectionsList.get(j).getCollectionsNumber() == 0) {
|
|
|
|
+ postCollectionsList.get(j).setStatus("1");//售尽
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ postCollectionsMapper.updatePostCollectionsStatus1(postCollectionsList.get(j));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|