|
@@ -71,6 +71,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
private IOrderGoodsService iOrderGoodsService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IGoodsService iGoodsService;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public GoodsVo queryById(Long goodsId){
|
|
public GoodsVo queryById(Long goodsId){
|
|
@@ -285,8 +288,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
if(bo.getGoodsPhotographExamConfig()!=null){
|
|
if(bo.getGoodsPhotographExamConfig()!=null){
|
|
|
update.setGoodsPhotoExamConfig(JSON.toJSONString(bo.getGoodsPhotographExamConfig()));
|
|
update.setGoodsPhotoExamConfig(JSON.toJSONString(bo.getGoodsPhotographExamConfig()));
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- return this.updateById(update);
|
|
|
|
|
|
|
+ //学习服务期设置
|
|
|
|
|
+ Goods edit= this.setStudyServiceTime(update);
|
|
|
|
|
+ return this.updateById(edit);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -433,4 +437,35 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
public int queryUpGoods() {
|
|
public int queryUpGoods() {
|
|
|
return baseMapper.queryUpGoods();
|
|
return baseMapper.queryUpGoods();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ //设置学习服务期
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public Goods setStudyServiceTime(Goods g){
|
|
|
|
|
+ GoodsVo goodsVo = iGoodsService.queryById(g.getGoodsId());
|
|
|
|
|
+ //商品设置学习服务有效期
|
|
|
|
|
+ if(Validator.isNotEmpty(goodsVo.getServiceTimeType())){
|
|
|
|
|
+ if(Validator.isNotEmpty(goodsVo.getServiceTimeNum())){
|
|
|
|
|
+ if(goodsVo.getServiceTimeType()==1){ //年
|
|
|
|
|
+ Calendar cal = new GregorianCalendar();
|
|
|
|
|
+ cal.add(Calendar.YEAR,goodsVo.getServiceTimeNum().intValue());
|
|
|
|
|
+ g.setStudyStartTime(DateUtils.getNowTime());
|
|
|
|
|
+ g.setStudyEndTime(cal.getTimeInMillis()/1000);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(goodsVo.getServiceTimeType()==2){ //月
|
|
|
|
|
+ Calendar cal = new GregorianCalendar();
|
|
|
|
|
+ cal.add(Calendar.MONTH,goodsVo.getServiceTimeNum().intValue());
|
|
|
|
|
+ g.setStudyStartTime(DateUtils.getNowTime());
|
|
|
|
|
+ g.setStudyEndTime(cal.getTimeInMillis()/1000);
|
|
|
|
|
+ }
|
|
|
|
|
+ else if(goodsVo.getServiceTimeType()==3){ //天
|
|
|
|
|
+ Calendar cal = new GregorianCalendar();
|
|
|
|
|
+ cal.add(Calendar.DATE,goodsVo.getServiceTimeNum().intValue());
|
|
|
|
|
+ g.setStudyStartTime(DateUtils.getNowTime());
|
|
|
|
|
+ g.setStudyEndTime(cal.getTimeInMillis()/1000);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return g;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|