|
@@ -7,19 +7,17 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.zanxiang.common.enums.DeleteEnum;
|
|
|
+import com.zanxiang.common.enums.PromoAccountTypeEnum;
|
|
|
+import com.zanxiang.common.enums.PromoProviderEnum;
|
|
|
import com.zanxiang.common.enums.StatusEnum;
|
|
|
import com.zanxiang.common.text.UUID;
|
|
|
import com.zanxiang.common.utils.bean.BeanUtils;
|
|
|
-import com.zanxiang.manage.domain.dto.PromoChannelDTO;
|
|
|
-import com.zanxiang.manage.domain.dto.PromoMediaDTO;
|
|
|
+import com.zanxiang.manage.domain.dto.*;
|
|
|
import com.zanxiang.manage.domain.params.PromoChannelAddUpdateParam;
|
|
|
import com.zanxiang.manage.domain.params.PromoChannelListParam;
|
|
|
import com.zanxiang.manage.domain.vo.PromoChannelChoiceVO;
|
|
|
import com.zanxiang.manage.domain.vo.PromoChannelListVO;
|
|
|
-import com.zanxiang.manage.service.PromoAccountService;
|
|
|
-import com.zanxiang.manage.service.PromoChannelService;
|
|
|
-import com.zanxiang.manage.service.PromoMediaService;
|
|
|
-import com.zanxiang.manage.service.PromoSiteService;
|
|
|
+import com.zanxiang.manage.service.*;
|
|
|
import com.zanxiang.mybatis.entity.PromoAccount;
|
|
|
import com.zanxiang.mybatis.entity.PromoChannel;
|
|
|
import com.zanxiang.mybatis.entity.PromoSite;
|
|
@@ -53,6 +51,12 @@ public class PromoChannelServiceImpl extends ServiceImpl<PromoChannelMapper, Pro
|
|
|
@Autowired
|
|
|
private PromoSiteService promoSiteService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private GameService gameService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private GameCategoryService gameCategoryService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询推广媒体列表
|
|
|
*
|
|
@@ -62,9 +66,13 @@ public class PromoChannelServiceImpl extends ServiceImpl<PromoChannelMapper, Pro
|
|
|
@Override
|
|
|
public IPage<PromoChannelListVO> list(PromoChannelListParam param) {
|
|
|
Map<Long, PromoMediaDTO> promoMediaMap = promoMediaService.promoMediaMap();
|
|
|
+ Map<Long, PromoSiteDTO> promoSiteMap = promoSiteService.promoSiteMap();
|
|
|
+ Map<Long, PromoAccountDTO> promoAccountMap = promoAccountService.promoAccountMap();
|
|
|
+ Map<Long, GameDTO> gameMap = gameService.gameMap();
|
|
|
+ Map<Long, GameCategoryDTO> gameCategoryMap = gameCategoryService.gameCategoryMap();
|
|
|
return page(param.toPage(), new QueryWrapper<PromoChannel>().lambda()
|
|
|
.orderByDesc(PromoChannel::getCreateTime))
|
|
|
- .convert(promoAccount -> this.toVo(promoMediaMap, promoAccount));
|
|
|
+ .convert(promoAccount -> this.toVo(promoAccountMap, promoMediaMap, promoAccount, promoSiteMap, gameMap, gameCategoryMap));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -74,11 +82,40 @@ public class PromoChannelServiceImpl extends ServiceImpl<PromoChannelMapper, Pro
|
|
|
* @param promoChannel 推广渠道
|
|
|
* @return {@link PromoChannelListVO}
|
|
|
*/
|
|
|
- private PromoChannelListVO toVo(Map<Long, PromoMediaDTO> promoMediaMap, PromoChannel promoChannel) {
|
|
|
+ private PromoChannelListVO toVo(Map<Long, PromoAccountDTO> promoAccountMap, Map<Long, PromoMediaDTO> promoMediaMap, PromoChannel promoChannel,
|
|
|
+ Map<Long, PromoSiteDTO> promoSiteMap, Map<Long, GameDTO> gameMap, Map<Long, GameCategoryDTO> gameCategoryMap) {
|
|
|
PromoChannelListVO promoChannelListVO = BeanUtils.copy(promoChannel, PromoChannelListVO.class);
|
|
|
if (Objects.isNull(promoChannelListVO)) {
|
|
|
return null;
|
|
|
}
|
|
|
+ PromoAccountDTO promoAccountDTO = promoAccountMap.get(promoChannelListVO.getAccountId());
|
|
|
+ if (promoAccountDTO != null) {
|
|
|
+ promoChannelListVO.setPitcherId(promoAccountDTO.getPitcherId());
|
|
|
+ promoChannelListVO.setPitcherName(promoAccountDTO.getPitcherName());
|
|
|
+ promoChannelListVO.setPitcherGroupId(promoAccountDTO.getPitcherGroupId());
|
|
|
+ promoChannelListVO.setPitcherGroupName(promoAccountDTO.getPitcherGroupName());
|
|
|
+ promoChannelListVO.setAccountName(promoAccountDTO.getName());
|
|
|
+ promoChannelListVO.setAccountTypeName(PromoAccountTypeEnum.getNameByType(promoAccountDTO.getAccountType()));
|
|
|
+ }
|
|
|
+ PromoMediaDTO promoMediaDTO = promoMediaMap.get(promoChannelListVO.getMediaId());
|
|
|
+ if (promoMediaDTO != null) {
|
|
|
+ promoChannelListVO.setMediaName(promoMediaDTO.getName());
|
|
|
+ }
|
|
|
+ PromoSiteDTO promoSiteDTO = promoSiteMap.get(promoChannelListVO.getPromoSiteId());
|
|
|
+ if (promoSiteDTO != null) {
|
|
|
+ promoChannelListVO.setMediaSite(promoSiteDTO.getMediaSite());
|
|
|
+ promoChannelListVO.setPlateSite(promoSiteDTO.getPlateSite());
|
|
|
+ }
|
|
|
+ GameDTO gameDTO = gameMap.get(promoChannelListVO.getGameId());
|
|
|
+ if (gameDTO != null){
|
|
|
+ promoChannelListVO.setGameName(gameDTO.getName());
|
|
|
+ GameCategoryDTO gameCategoryDTO = gameCategoryMap.get(gameDTO.getCategory());
|
|
|
+ if (gameCategoryDTO != null){
|
|
|
+ promoChannelListVO.setGameCategory(gameCategoryDTO.getId());
|
|
|
+ promoChannelListVO.setGameCategoryName(gameCategoryDTO.getName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ promoChannelListVO.setProviderName(PromoProviderEnum.getNameByType(promoChannelListVO.getProviderId()));
|
|
|
return promoChannelListVO;
|
|
|
}
|
|
|
|