| | |
| | | package com.ks.lucky.service.impl; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.ks.lucky.dao.LuckySponsorAdDao; |
| | | import com.ks.lucky.exception.LuckyActivitySponsorInfoException; |
| | | import com.ks.lucky.exception.LuckySponsorAdException; |
| | | import com.ks.lucky.mapper.LuckyActivitySponsorInfoMapper; |
| | | import com.ks.lucky.mapper.LuckySponsorsMapper; |
| | | import com.ks.lucky.pojo.DO.LuckyActivitySponsorInfo; |
| | | import com.ks.lucky.pojo.DO.LuckySponsorAd; |
| | | import com.ks.lucky.pojo.DO.LuckySponsors; |
| | | import com.ks.lucky.query.ActivitySponsorInfoQuery; |
| | | import com.ks.lucky.remote.service.LuckySponsorAdService; |
| | | import com.ks.lucky.util.annotation.RedisCache; |
| | | import com.ks.lucky.util.annotation.RedisCacheEvict; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | private LuckySponsorAdDao luckySponsorAdDao; |
| | | |
| | | @Resource |
| | | private LuckySponsorAdService luckySponsorAdService; |
| | | |
| | | @Resource |
| | | private LuckySponsorsMapper luckySponsorsMapper; |
| | | |
| | | |
| | |
| | | * @throws LuckyActivitySponsorInfoException |
| | | */ |
| | | @Validated |
| | | public void addSponsorInfo(LuckyActivitySponsorInfo sponsorInfo) throws LuckyActivitySponsorInfoException { |
| | | public void addSponsorInfo(LuckyActivitySponsorInfo sponsorInfo) throws LuckyActivitySponsorInfoException, LuckySponsorAdException, ParamsException { |
| | | ActivitySponsorInfoQuery query = new ActivitySponsorInfoQuery(); |
| | | query.activityId = sponsorInfo.getActivityId(); |
| | | query.start = 0; |
| | |
| | | if (sponsorInfo.getCreateTime() == null) { |
| | | sponsorInfo.setCreateTime(new Date()); |
| | | } |
| | | |
| | | if (sponsorInfo.getAd() != null) { |
| | | if (sponsorInfo.getAd().getId() == null) { |
| | | //添加广告 |
| | | String id = luckySponsorAdService.addSponsorAd(sponsorInfo.getAd()); |
| | | sponsorInfo.getAd().setId(id); |
| | | sponsorInfo.setSponsorAdId(id); |
| | | } |
| | | } |
| | | |
| | | |
| | | luckyActivitySponsorInfoMapper.insertSelective(sponsorInfo); |
| | | } |
| | | |