|
|
@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.activity.ActBannerDTO; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.FieldConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.constant.NumConstant; |
|
|
|
import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
@ -101,10 +102,13 @@ public class ActBannerServiceImpl extends BaseServiceImpl<ActBannerDao, ActBanne |
|
|
|
updateEntity.setStatusTime(new Date()); |
|
|
|
// 上架
|
|
|
|
if (ActStateConstant.ACT_BANNER_STATUS_UNDERCARRIAGE.equals(entity.getStatus())) { |
|
|
|
// 上架前banner表处理
|
|
|
|
this.takeOffOtherBanners(); |
|
|
|
updateEntity.setStatus(ActStateConstant.ACT_BANNER_STATUS_GROUNDING); |
|
|
|
updateById(updateEntity); |
|
|
|
// 上架的banner数量不能超过5条
|
|
|
|
if (NumConstant.FIVE > baseDao.getBannerStatusNumber()) { |
|
|
|
updateEntity.setStatus(ActStateConstant.ACT_BANNER_STATUS_GROUNDING); |
|
|
|
updateById(updateEntity); |
|
|
|
} else { |
|
|
|
return new Result().error("Banner上架数量不能超过5条"); |
|
|
|
} |
|
|
|
// 下架
|
|
|
|
} else if (ActStateConstant.ACT_BANNER_STATUS_GROUNDING.equals(entity.getStatus())) { |
|
|
|
updateEntity.setStatus(ActStateConstant.ACT_BANNER_STATUS_UNDERCARRIAGE); |
|
|
@ -115,9 +119,15 @@ public class ActBannerServiceImpl extends BaseServiceImpl<ActBannerDao, ActBanne |
|
|
|
|
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void save(ActBannerDTO dto) { |
|
|
|
public Result save(ActBannerDTO dto) { |
|
|
|
ActBannerEntity entity = ConvertUtils.sourceToTarget(dto, ActBannerEntity.class); |
|
|
|
insert(entity); |
|
|
|
// 上架的banner数量不能超过5条
|
|
|
|
if (NumConstant.FIVE > baseDao.getBannerStatusNumber()) { |
|
|
|
insert(entity); |
|
|
|
} else { |
|
|
|
return new Result().error("Banner上架数量不能超过5条"); |
|
|
|
} |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|