|
@@ -24,28 +24,30 @@ public class CollectionStatusJudgment {
|
|
|
public void setPostCollectionsSystemMapper(PostCollectionsSystemMapper postCollectionsSystemMapper) {
|
|
|
CollectionStatusJudgment.postCollectionsSystemMapper = postCollectionsSystemMapper;
|
|
|
}
|
|
|
+
|
|
|
@Autowired
|
|
|
public void setPostCollectionsMapper(PostCollectionsMapper postCollectionsMapper) {
|
|
|
CollectionStatusJudgment.postCollectionsMapper = postCollectionsMapper;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 如果已经上架,判断藏品状态时间
|
|
|
*
|
|
|
* @param postCollectionsVo
|
|
|
* @return 结果
|
|
|
*/
|
|
|
- public static void JudgmentTime(PostCollectionsVo postCollectionsVo){
|
|
|
+ public static void JudgmentTime(PostCollectionsVo postCollectionsVo) {
|
|
|
|
|
|
Date nowDate = DateUtils.getNowDate();
|
|
|
- Date startTime = postCollectionsVo.getStartTime();
|
|
|
- Date endTime = postCollectionsVo.getEndTime();
|
|
|
+ Date startTime = postCollectionsVo.getStartTime();
|
|
|
+ Date endTime = postCollectionsVo.getEndTime();
|
|
|
//获取此藏品套系status
|
|
|
Long systemId = postCollectionsVo.getSystemId();
|
|
|
|
|
|
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) {
|
|
|
|
|
|
/**
|
|
|
* 判断时间 (0预售 /1已售尽 /2正在售卖 /3已过期)
|
|
@@ -55,44 +57,44 @@ public class CollectionStatusJudgment {
|
|
|
* 当前时间在售卖时间之间并且数量大于0为正在售卖
|
|
|
* 其余情况已售尽
|
|
|
*/
|
|
|
- if (nowDate.before(startTime)){
|
|
|
+ if (nowDate.before(startTime)) {
|
|
|
postCollectionsVo.setStatus("0");//预售
|
|
|
- }
|
|
|
- else if (nowDate.after(endTime)){
|
|
|
+ } else if (nowDate.after(endTime)) {
|
|
|
postCollectionsVo.setStatus("3");//已过期
|
|
|
- }
|
|
|
- else if (startTime.before(nowDate) &&
|
|
|
+ } else if (startTime.before(nowDate) &&
|
|
|
endTime.after(nowDate) &&
|
|
|
- postCollectionsVo.getCollectionsNumber()>0){
|
|
|
+ postCollectionsVo.getCollectionsNumber() > 0) {
|
|
|
postCollectionsVo.setStatus("2");//正在售卖
|
|
|
- }
|
|
|
- else if(postCollectionsVo.getCollectionsNumber()==0){
|
|
|
+ } else if (postCollectionsVo.getCollectionsNumber() == 0) {
|
|
|
postCollectionsVo.setStatus("1");//售尽
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 如果未上架,令藏品状态为未上架
|
|
|
*
|
|
|
* @param systemId
|
|
|
* @return 结果
|
|
|
*/
|
|
|
- public static void JudgmentStatus(Long systemId){
|
|
|
+ public static void JudgmentStatus(Long systemId) {
|
|
|
PostCollections postCollections = new PostCollections();
|
|
|
String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId);
|
|
|
//判断藏品套系是否上架,如果没上架,令藏品status全部置为未上架
|
|
|
- if (null!=postCollectionsSystemStatus){
|
|
|
- if (Objects.equals(postCollectionsSystemStatus, "0")){
|
|
|
+ if (null != postCollectionsSystemStatus) {
|
|
|
+ if (Objects.equals(postCollectionsSystemStatus, "0")) {
|
|
|
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);
|
|
|
//批量修改status,动态查询藏品列表
|
|
|
postCollectionsMapper.updatePostCollectionsStatus(postCollections);
|
|
|
+ } else {
|
|
|
+ //上架
|
|
|
}
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
+}
|