|
@@ -3,6 +3,7 @@ package com.zhongzheng.modules.goods.service.impl;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
@@ -279,6 +280,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
*/
|
|
|
private void validEntityBeforeSave(Goods entity){
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
+ if(entity.getStatus()==0&&entity.getGoodsStatus()==1){
|
|
|
+ throw new CustomException("无效商品不允许上架");
|
|
|
+ }
|
|
|
+ if((entity.getValidityEndTime()<DateUtils.getNowTime())&&entity.getGoodsStatus()==1){
|
|
|
+ throw new CustomException("过期商品不允许上架");
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|