| 
					
				 | 
			
			
				@@ -2,8 +2,12 @@ package com.ruoyi.system.service.impl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.ruoyi.common.utils.DateUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+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 org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Service; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -26,6 +30,8 @@ public class PostCollectionsServiceImpl implements IPostCollectionsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private PostCollectionsMapper postCollectionsMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private IIssuerService iIssuerService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private PostCollectionsSystemMapper postCollectionsSystemMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询藏品详细信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -41,16 +47,22 @@ public class PostCollectionsServiceImpl implements IPostCollectionsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 查询藏品列表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     * @param id 藏品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * @param systemId 藏品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @return 藏品 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public List<PostCollections> selectPostCollectionsList(Long id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public List<PostCollections> selectPostCollectionsList(Long systemId) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         PostCollections postCollections = new PostCollections(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //id是套系里的主键id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        postCollections.setSystemId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        return postCollectionsMapper.selectPostCollectionsList(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //判断藏品套系是否上架,如果没上架,令藏品status全部置为未上架 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (Objects.equals(postCollectionsSystemStatus, "0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            //批量修改status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postCollectionsMapper.updatePostCollectionsStatus(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //systemId是套系里的主键id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        postCollections.setSystemId(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return postCollectionsMapper.selectPostCollectionsList(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -65,30 +77,40 @@ public class PostCollectionsServiceImpl implements IPostCollectionsService 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date nowDate = DateUtils.getNowDate(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date startTime =  postCollectionsVo.getStartTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Date endTime =  postCollectionsVo.getEndTime(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        //判空 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if (null!=startTime && null!=endTime){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //获取此藏品套系status 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long systemId = postCollectionsVo.getSystemId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String postCollectionsSystemStatus = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(systemId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //判断藏品套系是否上架,如果没上架,令藏品也未上架 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (Objects.equals(postCollectionsSystemStatus, "0")){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            postCollectionsVo.setStatus("4");//未上架 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //如果套系已上架,判断以下时间线 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        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");//售尽 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                 * 判断时间 (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");//售尽 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         postCollectionsVo.setCreateBy(getUsername()); 
			 |