协议新增分类
This commit is contained in:
parent
cf9a74528f
commit
66bf3645b6
|
@ -16,14 +16,16 @@ public class AdConverterImpl implements AdConverter {
|
|||
return null;
|
||||
}
|
||||
Ad po = new Ad();
|
||||
po.setAreaId(null);
|
||||
po.setBelong(data.getBelong());
|
||||
// 基础信息
|
||||
if (po.getBelong().equals(AdBlong.STORE.getCode())) {
|
||||
po.setAreaId(data.getAreaId());
|
||||
}else{
|
||||
po.setAreaId(null);
|
||||
}
|
||||
po.setType(data.getType());
|
||||
po.setPicture(data.getPicture());
|
||||
po.setBelong(data.getBelong());
|
||||
|
||||
po.setUrl(data.getUrl());
|
||||
po.setUrlType(data.getUrlType());
|
||||
return po;
|
||||
|
@ -36,14 +38,14 @@ public class AdConverterImpl implements AdConverter {
|
|||
}
|
||||
Ad po = new Ad();
|
||||
// 基础信息
|
||||
po.setAreaId(null);
|
||||
po.setBelong(data.getBelong());
|
||||
if (po.getBelong().equals(AdBlong.STORE.getCode())) {
|
||||
po.setAreaId(data.getAreaId());
|
||||
}else{
|
||||
po.setAreaId(null);
|
||||
}
|
||||
po.setAreaId(data.getAreaId());
|
||||
po.setType(data.getType());
|
||||
po.setPicture(data.getPicture());
|
||||
po.setBelong(data.getBelong());
|
||||
po.setUrl(data.getUrl());
|
||||
po.setUrlType(data.getUrlType());
|
||||
return po;
|
||||
|
|
|
@ -31,8 +31,7 @@ import com.ruoyi.bst.ad.service.AdService;
|
|||
* @date 2025-04-01
|
||||
*/
|
||||
@Service
|
||||
public class AdServiceImpl implements AdService
|
||||
{
|
||||
public class AdServiceImpl implements AdService {
|
||||
@Autowired
|
||||
private AdMapper adMapper;
|
||||
@Autowired
|
||||
|
@ -51,8 +50,7 @@ public class AdServiceImpl implements AdService
|
|||
* @return 广告
|
||||
*/
|
||||
@Override
|
||||
public AdVO selectAdByAdId(Long adId)
|
||||
{
|
||||
public AdVO selectAdByAdId(Long adId) {
|
||||
return adMapper.selectAdByAdId(adId);
|
||||
}
|
||||
|
||||
|
@ -63,8 +61,7 @@ public class AdServiceImpl implements AdService
|
|||
* @return 广告
|
||||
*/
|
||||
@Override
|
||||
public List<AdVO> selectAdList(AdQuery ad)
|
||||
{
|
||||
public List<AdVO> selectAdList(AdQuery ad) {
|
||||
return adMapper.selectAdList(ad);
|
||||
}
|
||||
|
||||
|
@ -75,21 +72,20 @@ public class AdServiceImpl implements AdService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertAd(Ad ad)
|
||||
{
|
||||
public int insertAd(Ad ad) {
|
||||
// 默认设置为商户广告
|
||||
if (ad.getBelong() == null || ad.getBelong().equals("")){
|
||||
if (ad.getBelong() == null || ad.getBelong().equals("")) {
|
||||
ad.setBelong(AdBlong.STORE.getCode());
|
||||
}
|
||||
// 商户广告存在上限
|
||||
if (ad.getBelong().equals(AdBlong.STORE.getCode())){
|
||||
if (ad.getBelong().equals(AdBlong.STORE.getCode())) {
|
||||
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||
ad.setStoreId(area.getUserId());
|
||||
// 条件查询广告
|
||||
AdQuery query = new AdQuery();
|
||||
query.setAreaId(ad.getAreaId());
|
||||
query.setDeleted(false);
|
||||
ServiceUtil.assertion(adMapper.selectOne(query)!=null,"当前运营区存在广告已达上限");
|
||||
ServiceUtil.assertion(adMapper.selectOne(query) != null, "当前运营区存在广告已达上限");
|
||||
}
|
||||
ad.setCreateTime(DateUtils.getNowDate());
|
||||
return adMapper.insertAd(ad);
|
||||
|
@ -102,18 +98,17 @@ public class AdServiceImpl implements AdService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateAd(Ad ad)
|
||||
{
|
||||
if (ad.getAreaId() != null){
|
||||
public int updateAd(Ad ad) {
|
||||
if (ad.getAreaId() != null) {
|
||||
AdVO oldAd = adMapper.selectAdByAdId(ad.getAdId());
|
||||
ServiceUtil.assertion(oldAd == null,"广告不存在");
|
||||
if (!oldAd.getAreaId().equals(ad.getAreaId())){
|
||||
int count = adMapper.countByAreaId(ad.getAreaId(),ad.getAdId());
|
||||
ServiceUtil.assertion(count>0,"该运营区下广告已达上限");
|
||||
ServiceUtil.assertion(oldAd == null, "广告不存在");
|
||||
if (ad.getAreaId() != null) {
|
||||
int count = adMapper.countByAreaId(ad.getAreaId(), ad.getAdId());
|
||||
ServiceUtil.assertion(count > 1, "该运营区下广告已达上限");
|
||||
}
|
||||
}
|
||||
AreaVO area = areaService.selectAreaById(ad.getAreaId());
|
||||
if (area.getUserId() != null){
|
||||
if (area.getUserId() != null) {
|
||||
ad.setStoreId(area.getUserId());
|
||||
}
|
||||
ad.setUpdateTime(DateUtils.getNowDate());
|
||||
|
@ -127,8 +122,7 @@ public class AdServiceImpl implements AdService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAdByAdIds(List<Long> adIds)
|
||||
{
|
||||
public int deleteAdByAdIds(List<Long> adIds) {
|
||||
return adMapper.deleteAdByAdIds(adIds);
|
||||
}
|
||||
|
||||
|
@ -139,8 +133,7 @@ public class AdServiceImpl implements AdService
|
|||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteAdByAdId(Long adId)
|
||||
{
|
||||
public int deleteAdByAdId(Long adId) {
|
||||
return adMapper.deleteAdByAdId(adId);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user