| 
					
				 | 
			
			
				@@ -1,5 +1,6 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.ruoyi.system.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.lang.reflect.Method; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Objects; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9,6 +10,7 @@ import com.ruoyi.system.domain.PostCollectionsSystem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.domain.vo.PostCollectionsVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.mapper.PostCollectionsSystemMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.service.IIssuerService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.ruoyi.system.utils.CollectionStatusJudgment; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.system.mapper.PostCollectionsMapper; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -54,15 +56,13 @@ public class PostCollectionsServiceImpl implements IPostCollectionsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public List<PostCollections> selectPostCollectionsList(Long systemId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PostCollections postCollections = new PostCollections(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //判断藏品套系是否上架,如果没上架,令藏品status全部置为未上架 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (Objects.equals(postCollectionsSystemStatus, "0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //批量修改status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            postCollectionsMapper.updatePostCollectionsStatus(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //套系未上架 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        CollectionStatusJudgment.JudgmentStatus(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //systemId是套系里的主键id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         postCollections.setSystemId(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return postCollectionsMapper.selectPostCollectionsList(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return postCollectionsMapper.selectPostCollectionsList(postCollections.getSystemId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -74,9 +74,6 @@ public class PostCollectionsServiceImpl implements IPostCollectionsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public int insertPostCollections(PostCollectionsVo postCollectionsVo) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date nowDate = DateUtils.getNowDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date startTime =  postCollectionsVo.getStartTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Date endTime =  postCollectionsVo.getEndTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //获取此藏品套系status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Long systemId = postCollectionsVo.getSystemId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,32 +83,8 @@ public class PostCollectionsServiceImpl implements IPostCollectionsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //如果套系已上架,判断以下时间线 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            //判空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (null!=startTime && null!=endTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * 判断时间 (0预售 /1已售尽 /2正在售卖 /3已过期) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * 根据当前时间,对比售卖时间, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * 当前时间小于售卖时间,该套系藏品为预售, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * 当前时间大于售卖时间为已过期, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * 当前时间在售卖时间之间并且数量大于0为正在售卖 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * 其余情况已售尽 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (nowDate.before(startTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postCollectionsVo.setStatus("0");//预售 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                else if (nowDate.after(endTime)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postCollectionsVo.setStatus("3");//已过期 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                else if (startTime.before(nowDate) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        endTime.after(nowDate) && 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        postCollectionsVo.getCollectionsNumber()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postCollectionsVo.setStatus("2");//正在售卖 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                else if(postCollectionsVo.getCollectionsNumber()==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    postCollectionsVo.setStatus("1");//售尽 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //抽出一个工具类 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            CollectionStatusJudgment.JudgmentTime(postCollectionsVo); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         postCollectionsVo.setCreateBy(getUsername()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         postCollectionsVo.setUpdateBy(getUsername()); 
			 |