|
@@ -20,6 +20,8 @@ import com.ruoyi.system.mapper.PostCollectionsSystemMapper;
|
|
|
import com.ruoyi.system.domain.PostCollectionsSystem;
|
|
|
import com.ruoyi.system.service.IPostCollectionsSystemService;
|
|
|
|
|
|
+import javax.xml.bind.annotation.XmlEnumValue;
|
|
|
+
|
|
|
import static com.ruoyi.common.utils.SecurityUtils.getUsername;
|
|
|
|
|
|
/**
|
|
@@ -108,38 +110,39 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
|
|
|
//补充字段
|
|
|
postCollectionsSystem.setUpdateBy(getUsername());
|
|
|
postCollectionsSystem.setUpdateTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,DateUtils.getTime()));
|
|
|
- /*SimpleDateFormat formatter= new SimpleDateFormat("YYYY_MM_DD_HH_MM_SS");
|
|
|
- Date localDate = new Date(System.currentTimeMillis());
|
|
|
- Date startDate=postCollectionsSystem.getStartTime();
|
|
|
- Date endDate=postCollectionsSystem.getEndTime();
|
|
|
- if(localDate.after(startDate)){
|
|
|
- postCollectionsSystem.setType(Long.valueOf(1));
|
|
|
- }else if(startDate.after(localDate)&&endDate.after(localDate)){
|
|
|
- postCollectionsSystem.setType(Long.valueOf(0));
|
|
|
- }else {
|
|
|
- postCollectionsSystem.setType(Long.valueOf(2));
|
|
|
- }*/
|
|
|
/**
|
|
|
* 判断时间 (在售0/预售1/已过期2)
|
|
|
* 根据当前时间,对比套系时间,当前小于套系时间,该套系藏品为“以过期”,
|
|
|
* 当前时间大于套系时间为“预售”
|
|
|
*/
|
|
|
- Date nowDate = DateUtils.getNowDate();
|
|
|
- Date startTime = postCollectionsSystem.getStartTime();
|
|
|
- Date endTime = postCollectionsSystem.getEndTime();
|
|
|
- //当前时间早于套系时间 ->预售
|
|
|
- if (null!=startTime && null!=endTime){
|
|
|
- if (nowDate.before(startTime)){
|
|
|
- postCollectionsSystem.setType((long) 1);
|
|
|
- }
|
|
|
- else if (nowDate.after(endTime)){
|
|
|
- postCollectionsSystem.setType((long) 2);
|
|
|
+ String status = postCollectionsSystemMapper.selectPostCollectionsSystemByStatus(postCollectionsSystem.getId());
|
|
|
+ //未上架什么都可以改
|
|
|
+ int row=0;
|
|
|
+ if(status.equals("0")) {
|
|
|
+ Date nowDate = DateUtils.getNowDate();
|
|
|
+ Date startTime = postCollectionsSystem.getStartTime();
|
|
|
+ Date endTime = postCollectionsSystem.getEndTime();
|
|
|
+ //当前时间早于套系时间 ->预售
|
|
|
+ if (null != startTime && null != endTime) {
|
|
|
+ if (nowDate.before(startTime)) {
|
|
|
+ postCollectionsSystem.setType((long) 1);
|
|
|
+ } else if (nowDate.after(endTime)) {
|
|
|
+ postCollectionsSystem.setType((long) 2);
|
|
|
+ } else {
|
|
|
+ postCollectionsSystem.setType((long) 0);
|
|
|
+ }
|
|
|
}
|
|
|
- else {
|
|
|
- postCollectionsSystem.setType((long) 0);
|
|
|
+ row=postCollectionsSystemMapper.updatePostCollectionsSystem(postCollectionsSystem);
|
|
|
+ }
|
|
|
+ //已上架“时间”只允许修改截止时间,且只能可以向当前截止时间之后设置
|
|
|
+ else {
|
|
|
+ Date originEndTime=postCollectionsSystemMapper.getEndTime(postCollectionsSystem.getId());
|
|
|
+ Date endTime = postCollectionsSystem.getEndTime();
|
|
|
+ if(endTime.after(originEndTime)) {
|
|
|
+ row = postCollectionsSystemMapper.shelvesUpdatePostCollectionsSystem(postCollectionsSystem);
|
|
|
}
|
|
|
}
|
|
|
- return postCollectionsSystemMapper.updatePostCollectionsSystem(postCollectionsSystem);
|
|
|
+ return row;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -211,6 +214,12 @@ public class PostCollectionsSystemServiceImpl implements IPostCollectionsSystemS
|
|
|
return postCollectionsSystemMapper.getCopiesById(id);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Date getEndTime(Long id) {
|
|
|
+ return postCollectionsSystemMapper.getEndTime(id);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public List<CollectionsVo> selectPostCollectionsSystemListPage(PostCollectionsSystem postCollectionsSystem) {
|
|
|
List<PostCollectionsSystem> list = postCollectionsSystemMapper.selectPostCollectionsSystemList(postCollectionsSystem);
|