|
@@ -9,6 +9,8 @@ import com.ruoyi.system.mapper.PostCollectionsSystemMapper;
|
|
|
import com.ruoyi.system.domain.PostCollectionsSystem;
|
|
|
import com.ruoyi.system.service.IPostCollectionsSystemService;
|
|
|
|
|
|
+import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
|
+
|
|
|
/**
|
|
|
* 藏品套系Service业务层处理
|
|
|
*
|
|
@@ -54,7 +56,30 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
|
|
|
@Override
|
|
|
public int insertPostCollectionsSystem(PostCollectionsSystem postCollectionsSystem)
|
|
|
{
|
|
|
- postCollectionsSystem.setCreateTime(DateUtils.getNowDate());
|
|
|
+ /**
|
|
|
+ * 判断时间 (在售0/预售1/已过期2)
|
|
|
+ * 根据当前时间,对比套系时间,当前小于套系时间,该套系藏品为“以过期”,
|
|
|
+ * 当前时间大于套系时间为“预售”
|
|
|
+ */
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
+ Date startTime = postCollectionsSystem.getStartTime();
|
|
|
+ Date endTime = postCollectionsSystem.getEndTime();
|
|
|
+ //当前时间早于套系时间 ->预售
|
|
|
+ if (nowDate.before(startTime)){
|
|
|
+ postCollectionsSystem.setType((long) 1);
|
|
|
+ }
|
|
|
+ else if (nowDate.after(endTime)){
|
|
|
+ postCollectionsSystem.setType((long) 2);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ postCollectionsSystem.setType((long) 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ //补充字段
|
|
|
+ postCollectionsSystem.setCreateBy(getUsername());
|
|
|
+ postCollectionsSystem.setCreateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
|
|
|
+ postCollectionsSystem.setUpdateBy(getUsername());
|
|
|
+ postCollectionsSystem.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
|
|
|
return postCollectionsSystemMapper.insertPostCollectionsSystem(postCollectionsSystem);
|
|
|
}
|
|
|
|
|
@@ -67,7 +92,9 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
|
|
|
@Override
|
|
|
public int updatePostCollectionsSystem(PostCollectionsSystem postCollectionsSystem)
|
|
|
{
|
|
|
- postCollectionsSystem.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ //补充字段
|
|
|
+ postCollectionsSystem.setUpdateBy(getUsername());
|
|
|
+ postCollectionsSystem.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
|
|
|
return postCollectionsSystemMapper.updatePostCollectionsSystem(postCollectionsSystem);
|
|
|
}
|
|
|
|