Commit 223a5b45 by 朱亚洁

1002752品牌方数据

parent 8e19c524
package com.pcloud.book.advertising.dto;
import com.pcloud.common.dto.BaseDto;
import java.util.List;
import lombok.Data;
/**
* @描述:二维码及资源数据查询参数
* @作者:zhuyajie
* @创建时间:16:02 2020/4/16
* @版本:1.0
*/
@Data
public class BrandDataDTO4Channel extends BaseDto{
/**
* 来源类型(BOOK/QRCODE/APP/PRODUCT)
*/
private String fromType;
/**
* 书刊id
*/
private Long bookId;
/**
* 编辑id
*/
private Long adviserId;
/**
* 运营id
*/
private Long channelId;
/**
* 二维码id
*/
private Long sceneId;
/**
* 二维码列表
*/
private List<Long> sceneIdList;
/**
* 应用或作品id
*/
private List<Long>serveIdList;
/**
* 扫码人数
*/
private Integer scanQrUserCount;
/**
* 读者量
*/
private Integer readerNum;
/**
* 浏览量
*/
private Integer browseNum;
}
package com.pcloud.book.advertising.service; package com.pcloud.book.advertising.service;
import com.pcloud.book.advertising.dto.BrandDataDTO4Channel;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -18,6 +19,7 @@ import java.util.Map; ...@@ -18,6 +19,7 @@ import java.util.Map;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@FeignClient(value = "pcloud-service-book", qualifier = "advertisingSpaceServiceCloud", path = "book/v1.0/advertisingSpaceService") @FeignClient(value = "pcloud-service-book", qualifier = "advertisingSpaceServiceCloud", path = "book/v1.0/advertisingSpaceService")
@Api(description = "广告位内部接口") @Api(description = "广告位内部接口")
...@@ -44,4 +46,12 @@ public interface AdvertisingSpaceService { ...@@ -44,4 +46,12 @@ public interface AdvertisingSpaceService {
@ApiImplicitParam(name = "wxGroupId", value = "微信群id", dataType = "string", required = true, paramType = "query") @ApiImplicitParam(name = "wxGroupId", value = "微信群id", dataType = "string", required = true, paramType = "query")
@GetMapping("getBrandIdsByWxGroupId") @GetMapping("getBrandIdsByWxGroupId")
ResponseEntity<ResponseDto<List<Long>>> getBrandIdsByWxGroupId(@RequestParam("wxGroupId") String wxGroupId); ResponseEntity<ResponseDto<List<Long>>> getBrandIdsByWxGroupId(@RequestParam("wxGroupId") String wxGroupId);
@ApiOperation("品牌方增加的二维码下资源数据")
@PostMapping("mapBrandQrServeAddData")
ResponseEntity<ResponseDto<Map<Long,BrandDataDTO4Channel>>> mapBrandQrServeAddData(@RequestBody @ApiParam BrandDataDTO4Channel brandDataDTO4Channel);
@ApiOperation("品牌方增加的二维码数据")
@PostMapping("mapBrandQrAddData")
ResponseEntity<ResponseDto<Map<Long,BrandDataDTO4Channel>>> mapBrandQrAddData(@RequestBody @ApiParam BrandDataDTO4Channel brandDataDTO4Channel);
} }
package com.pcloud.book.advertising.biz;
import com.pcloud.book.advertising.dto.AddAdvertisingBrandBooksDTO;
import com.pcloud.book.advertising.dto.BookListForAdvertisingDTO;
import com.pcloud.book.advertising.dto.BrandDataDTO4Channel;
import com.pcloud.book.advertising.entity.AdvertisingBrandBook;
import com.pcloud.book.advertising.dto.BrandDataParamDTO;
import com.pcloud.book.advertising.entity.AdvertisingBrandData;
import com.pcloud.common.page.PageBeanNew;
import java.util.Map;
import java.util.List;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:11:56 2020/4/16
* @版本:1.0
*/
public interface AdvertisingBrandDataBiz {
/**
* 添加品牌方数据
*/
public void addBrandData(BrandDataParamDTO brandDataParamDTO);
/**
* 获取品牌方数据
* @param advertisingBrandData
* @return
*/
Map<String,Integer>getBrandData(AdvertisingBrandData advertisingBrandData);
void addAdvertisingBrandBooks(AddAdvertisingBrandBooksDTO addAdvertisingBrandBooksDTO);
void deleteAdvertisingBrandBooksByBookIds(List<Long> bookIds);
PageBeanNew<BookListForAdvertisingDTO> getBookListForAdvertising(Integer currentPage, Integer numPerPage, String keyword, Long advertisingBrandId, Boolean isPitch, Boolean is1v1);
/**
* 品牌方增加的二维码下资源数据
* @param brandDataDTO4Channel
* @return
*/
Map<Long, BrandDataDTO4Channel> mapBrandQrServeAddData(BrandDataDTO4Channel brandDataDTO4Channel);
/**
* 品牌方增加的二维码数据
* @param brandDataDTO4Channel
* @return
*/
Map<Long, BrandDataDTO4Channel> mapBrandQrAddData(BrandDataDTO4Channel brandDataDTO4Channel);
List<Long> getAdvertisingBrandBooksIds(Long advertisingBrandId);
}
...@@ -57,4 +57,11 @@ public interface LinkRevertBiz { ...@@ -57,4 +57,11 @@ public interface LinkRevertBiz {
* 统计昨日链接发送次数 * 统计昨日链接发送次数
*/ */
void addYesterdaySendStatistic(); void addYesterdaySendStatistic();
/**
* 修改链接数据变化值
* @param linkRevert
*/
void updateLinkBrandData(AdvertisingLinkRevert linkRevert);
} }
...@@ -57,6 +57,8 @@ import java.util.Date; ...@@ -57,6 +57,8 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -429,6 +431,10 @@ public class GroupTagBizImpl implements GroupTagBiz { ...@@ -429,6 +431,10 @@ public class GroupTagBizImpl implements GroupTagBiz {
/** /**
* excel打包 * excel打包
* @param list
* @param fileName
* @param zipTitle
* @return
*/ */
private String packExcelZip4GroupBrand(List<GroupTagDTO> list, String fileName, String zipTitle) { private String packExcelZip4GroupBrand(List<GroupTagDTO> list, String fileName, String zipTitle) {
Integer totalCount = list.size(); Integer totalCount = list.size();
...@@ -816,6 +822,7 @@ public class GroupTagBizImpl implements GroupTagBiz { ...@@ -816,6 +822,7 @@ public class GroupTagBizImpl implements GroupTagBiz {
if (null != brandDTO) { if (null != brandDTO) {
map.put("brandName", brandDTO.getBrandName()); map.put("brandName", brandDTO.getBrandName());
map.put("loginName", brandDTO.getLoginName()); map.put("loginName", brandDTO.getLoginName());
map.put("userId", userId);
} }
return map; return map;
} }
......
...@@ -98,26 +98,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz { ...@@ -98,26 +98,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>()); return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
} }
List<LinkRevertRecordDTO> list = pageBean.getRecordList(); List<LinkRevertRecordDTO> list = pageBean.getRecordList();
List<LinkGroupParamDTO> paramDTOS = new ArrayList<>(); //今日之前发送次数,因耗时不统计今天的20200106bug1019123
for (LinkRevertRecordDTO linkRevertRecordDTO : list) {
if (null == linkRevertRecordDTO || StringUtil.isEmpty(linkRevertRecordDTO.getShortLink())) {
continue;
}
List<String> groupIds = advertisingGroupTagDao.getTagWxGroupIdsByBrandId(linkRevertRecordDTO.getBrandId());
if (ListUtils.isEmpty(groupIds)) {
continue;
}
LinkGroupParamDTO paramDTO = new LinkGroupParamDTO();
paramDTO.setLink(linkRevertRecordDTO.getShortLink());
paramDTO.setWxGroupIds(groupIds);
paramDTO.setDate(DateUtils.today());
paramDTOS.add(paramDTO);
}
//今日之前发送次数
List<Long> linkIds = list.stream().filter(s -> s.getLink() != null).map(LinkRevertRecordDTO::getId).distinct().collect(Collectors.toList()); List<Long> linkIds = list.stream().filter(s -> s.getLink() != null).map(LinkRevertRecordDTO::getId).distinct().collect(Collectors.toList());
Map<Long, LinkRevertRecordDTO> sendCountMap = advertisingLinkSendDao.mapSendCount(linkIds); Map<Long, LinkRevertRecordDTO> sendCountMap = advertisingLinkSendDao.mapSendCount(linkIds);
//今日发送次数,因耗时不统计今天的20200106bug1019123
// Map<String, Integer> sendCountTodayMap = wechatGroupConsr.getLinkSendCount(paramDTOS);
for (LinkRevertRecordDTO revertRecordDTO : list) { for (LinkRevertRecordDTO revertRecordDTO : list) {
AdvertisingBrandDTO brandDTO = advertisingBrandDao.getBrandById(revertRecordDTO.getBrandId()); AdvertisingBrandDTO brandDTO = advertisingBrandDao.getBrandById(revertRecordDTO.getBrandId());
revertRecordDTO.setBrandName(null == brandDTO ? "" : brandDTO.getBrandName()); revertRecordDTO.setBrandName(null == brandDTO ? "" : brandDTO.getBrandName());
...@@ -128,9 +111,6 @@ public class LinkRevertBizImpl implements LinkRevertBiz { ...@@ -128,9 +111,6 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
if (!MapUtils.isEmpty(sendCountMap) && sendCountMap.containsKey(revertRecordDTO.getId())) { if (!MapUtils.isEmpty(sendCountMap) && sendCountMap.containsKey(revertRecordDTO.getId())) {
sendCount = sendCountMap.get(revertRecordDTO.getId()).getSendCount(); sendCount = sendCountMap.get(revertRecordDTO.getId()).getSendCount();
} }
// if (!MapUtils.isEmpty(sendCountTodayMap) && sendCountTodayMap.containsKey(revertRecordDTO.getShortLink())) {
// sendCount = sendCount + sendCountTodayMap.get(revertRecordDTO.getShortLink());
// }
revertRecordDTO.setSendCount(sendCount); revertRecordDTO.setSendCount(sendCount);
} }
return pageBean; return pageBean;
...@@ -145,23 +125,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz { ...@@ -145,23 +125,9 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> { ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> {
String[] rowsName = {"序号", "品牌方", "外链", "短链", "链接发送次数", "浏览量", "浏览人数", "生成时间"}; String[] rowsName = {"序号", "品牌方", "外链", "短链", "链接发送次数", "浏览量", "浏览人数", "生成时间"};
List<Object[]> dataList = new ArrayList<Object[]>(); List<Object[]> dataList = new ArrayList<Object[]>();
List<LinkGroupParamDTO> paramDTOS = new ArrayList<>();
for (LinkRevertRecordDTO linkRevertRecordDTO : list) {
List<String> groupIds = advertisingGroupTagDao.getTagWxGroupIdsByBrandId(linkRevertRecordDTO.getBrandId());
if (ListUtils.isEmpty(groupIds)) {
continue;
}
LinkGroupParamDTO paramDTO = new LinkGroupParamDTO();
paramDTO.setLink(linkRevertRecordDTO.getShortLink());
paramDTO.setWxGroupIds(groupIds);
paramDTO.setDate(DateUtils.today());
paramDTOS.add(paramDTO);
}
//今日之前发送次数 //今日之前发送次数
List<Long> linkIds = list.stream().filter(s -> s.getLink() != null).map(LinkRevertRecordDTO::getId).distinct().collect(Collectors.toList()); List<Long> linkIds = list.stream().filter(s -> s.getLink() != null).map(LinkRevertRecordDTO::getId).distinct().collect(Collectors.toList());
Map<Long, LinkRevertRecordDTO> sendCountMap = advertisingLinkSendDao.mapSendCount(linkIds); Map<Long, LinkRevertRecordDTO> sendCountMap = advertisingLinkSendDao.mapSendCount(linkIds);
//今日发送次数
// Map<String, Integer> sendCountTodayMap = wechatGroupConsr.getLinkSendCount(paramDTOS);
for (int i = 0, size = list.size(); i < size; i++) { for (int i = 0, size = list.size(); i < size; i++) {
LinkRevertRecordDTO revertRecordDTO = list.get(i); LinkRevertRecordDTO revertRecordDTO = list.get(i);
Object[] obj = new Object[rowsName.length]; Object[] obj = new Object[rowsName.length];
...@@ -174,9 +140,7 @@ public class LinkRevertBizImpl implements LinkRevertBiz { ...@@ -174,9 +140,7 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
if (!MapUtils.isEmpty(sendCountMap) && sendCountMap.containsKey(revertRecordDTO.getId())) { if (!MapUtils.isEmpty(sendCountMap) && sendCountMap.containsKey(revertRecordDTO.getId())) {
sendCount = sendCountMap.get(revertRecordDTO.getId()).getSendCount(); sendCount = sendCountMap.get(revertRecordDTO.getId()).getSendCount();
} }
// if (!MapUtils.isEmpty(sendCountTodayMap) && sendCountTodayMap.containsKey(revertRecordDTO.getShortLink())) {
// sendCount = sendCount + sendCountTodayMap.get(revertRecordDTO.getShortLink());
// }
obj[4] = sendCount; obj[4] = sendCount;
LinkRevertRecordDTO clickStatistic = advertisingLinkClickDao.getCountByLink(revertRecordDTO.getShortLink()); LinkRevertRecordDTO clickStatistic = advertisingLinkClickDao.getCountByLink(revertRecordDTO.getShortLink());
obj[5] = null == clickStatistic ? 0 : clickStatistic.getClickCount(); obj[5] = null == clickStatistic ? 0 : clickStatistic.getClickCount();
...@@ -243,4 +207,10 @@ public class LinkRevertBizImpl implements LinkRevertBiz { ...@@ -243,4 +207,10 @@ public class LinkRevertBizImpl implements LinkRevertBiz {
} }
}.start(); }.start();
} }
@Override
public void updateLinkBrandData(AdvertisingLinkRevert linkRevert) {
advertisingLinkRevertDao.updateLinkBrandData(linkRevert);
}
} }
package com.pcloud.book.advertising.check;
import com.pcloud.book.advertising.dto.BrandDataAddDTO;
import com.pcloud.book.advertising.dto.BrandDataParamDTO;
import com.pcloud.book.advertising.enums.BrandDataFromTypeEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @描述:品牌方数据校验
* @作者:zhuyajie
* @创建时间:14:04 2020/4/16
* @版本:1.0
*/
@Component
public class BrandDataCheck {
/**
* 添加参数校验
* @param brandDataParamDTO
*/
public void checkAddData(BrandDataParamDTO brandDataParamDTO) {
if (null == brandDataParamDTO){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数为空!");
}
if (StringUtil.isEmpty(brandDataParamDTO.getFromType())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "来源类型为空!");
}
String fromType=brandDataParamDTO.getFromType();
//书刊
if (BrandDataFromTypeEnum.BOOK.value.equals(fromType)){
if (null==brandDataParamDTO.getBookId() || null==brandDataParamDTO.getChannelId()
|| null==brandDataParamDTO.getAdviserId()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "书刊参数有误!");
}
brandDataParamDTO.setSceneId(null);
brandDataParamDTO.setServeId(null);
}
//二维码
if (BrandDataFromTypeEnum.QRCODE.value.equals(fromType)){
if (null == brandDataParamDTO.getSceneId()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "二维码参数有误!");
}
brandDataParamDTO.setServeId(null);
}
//应用、作品
if (BrandDataFromTypeEnum.APP.value.equals(fromType)||BrandDataFromTypeEnum.PRODUCT.value.equals(fromType)){
if (null==brandDataParamDTO.getSceneId()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "二维码参数有误!");
}
if (null==brandDataParamDTO.getServeId()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "资源服务参数有误!");
}
}
//数据类型
if (ListUtils.isEmpty(brandDataParamDTO.getDataAddDTOS())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "数据列表有误!");
}
for (BrandDataAddDTO dataAddDTO: brandDataParamDTO.getDataAddDTOS()){
if (null==dataAddDTO){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数为空!");
}
if (StringUtil.isEmpty(dataAddDTO.getAddType())){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "数据类型参数为空!");
}
dataAddDTO.setAddCount(dataAddDTO.getAddCount()==null?0:dataAddDTO.getAddCount());
}
}
}
package com.pcloud.book.advertising.dao;
import com.pcloud.book.advertising.entity.AdvertisingBrandBook;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 14:00
**/
public interface AdvertisingBrandBookDao extends BaseDao<AdvertisingBrandBook> {
void deleteByBookId(Long bookId);
Integer batchInsert(List<AdvertisingBrandBook> list);
void deleteByBookIds(List<Long> bookIds);
List<AdvertisingBrandBook> getByBookIds(List<Long> bookIds);
List<Long> getBookIdsByAdvertisingBrandId(Long advertisingBrandId);
void deleteByAdvertisingBrandId(Long advertisingBrandId);
}
package com.pcloud.book.advertising.dao;
import com.pcloud.book.advertising.dto.BrandDataDTO4Channel;
import com.pcloud.book.advertising.entity.AdvertisingBrandData;
import com.pcloud.common.core.dao.BaseDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 品牌方数据修改(AdvertisingBrandData)表数据库访问层
*
* @author zhuyajie
* @since 2020-04-16 11:39:50
*/
public interface AdvertisingBrandDataDao extends BaseDao<AdvertisingBrandData> {
/**
* 通过实体作为筛选条件查询
*
* @param advertisingBrandData 实例对象
* @return 对象列表
*/
List<AdvertisingBrandData> queryAll(AdvertisingBrandData advertisingBrandData);
/**
* 二维码资源数据
* @param brandDataDTO4Channel
* @return
*/
List<AdvertisingBrandData> getQrServeData4Channel(BrandDataDTO4Channel brandDataDTO4Channel);
/**
* 二维码数据
* @param brandDataDTO4Channel
* @return
*/
List<AdvertisingBrandData> getQrData4Channel(BrandDataDTO4Channel brandDataDTO4Channel);
List<AdvertisingBrandData> getBookAddByType(List<Long> bookIds,String addType);
}
\ No newline at end of file
...@@ -27,4 +27,9 @@ public interface AdvertisingLinkRevertDao extends BaseDao<AdvertisingLinkRevert> ...@@ -27,4 +27,9 @@ public interface AdvertisingLinkRevertDao extends BaseDao<AdvertisingLinkRevert>
*/ */
public List<AdvertisingLinkRevert> getAll(); public List<AdvertisingLinkRevert> getAll();
/**
* 修改品牌方数据
* @param linkRevert
*/
void updateLinkBrandData(AdvertisingLinkRevert linkRevert);
} }
package com.pcloud.book.advertising.dao.impl;
import com.pcloud.book.advertising.dao.AdvertisingBrandBookDao;
import com.pcloud.book.advertising.entity.AdvertisingBrandBook;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 14:01
**/
@Repository("advertisingBrandBookDao")
public class AdvertisingBrandBookDaoImpl extends BaseDaoImpl<AdvertisingBrandBook> implements AdvertisingBrandBookDao {
@Override
public void deleteByBookId(Long bookId) {
super.getSqlSession().delete(getStatement("deleteByBookId"), bookId);
}
@Override
public Integer batchInsert(List<AdvertisingBrandBook> list) {
return super.getSqlSession().insert(getStatement("batchInsert"), list);
}
@Override
public void deleteByBookIds(List<Long> bookIds) {
super.getSqlSession().delete(getStatement("deleteByBookIds"), bookIds);
}
@Override
public List<AdvertisingBrandBook> getByBookIds(List<Long> bookIds) {
return super.getSqlSession().selectList(getStatement("getByBookIds"), bookIds);
}
@Override
public List<Long> getBookIdsByAdvertisingBrandId(Long advertisingBrandId) {
return super.getSqlSession().selectList(getStatement("getBookIdsByAdvertisingBrandId"), advertisingBrandId);
}
@Override
public void deleteByAdvertisingBrandId(Long advertisingBrandId) {
super.getSqlSession().delete(getStatement("deleteByAdvertisingBrandId"), advertisingBrandId);
}
}
package com.pcloud.book.advertising.dao.impl;
import com.pcloud.book.advertising.dao.AdvertisingBrandDataDao;
import com.pcloud.book.advertising.dto.BrandDataDTO4Channel;
import com.pcloud.book.advertising.entity.AdvertisingBrandData;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:11:49 2020/4/16
* @版本:1.0
*/
@Component("dvertisingBrandDataDao")
public class AdvertisingBrandDataDaoImpl extends BaseDaoImpl<AdvertisingBrandData> implements AdvertisingBrandDataDao{
@Override
public List<AdvertisingBrandData> queryAll(AdvertisingBrandData advertisingBrandData) {
return getSessionTemplate().selectList(getStatement("queryAll"),advertisingBrandData);
}
@Override
public List<AdvertisingBrandData> getQrServeData4Channel(BrandDataDTO4Channel brandDataDTO4Channel) {
Map<String,Object>map=new HashMap<>();
map.put("fromType",brandDataDTO4Channel.getFromType());
map.put("bookId",brandDataDTO4Channel.getBookId());
map.put("sceneId",brandDataDTO4Channel.getSceneId());
map.put("serveIdList",brandDataDTO4Channel.getServeIdList());
map.put("adviserId",brandDataDTO4Channel.getAdviserId());
map.put("channelId",brandDataDTO4Channel.getChannelId());
return getSessionTemplate().selectList(getStatement("getQrServeData4Channel"),map);
}
@Override
public List<AdvertisingBrandData> getQrData4Channel(BrandDataDTO4Channel brandDataDTO4Channel) {
Map<String,Object>map=new HashMap<>();
map.put("fromType",brandDataDTO4Channel.getFromType());
map.put("bookId",brandDataDTO4Channel.getBookId());
map.put("sceneIdList",brandDataDTO4Channel.getSceneIdList());
map.put("adviserId",brandDataDTO4Channel.getAdviserId());
map.put("channelId",brandDataDTO4Channel.getChannelId());
return getSessionTemplate().selectList(getStatement("getQrData4Channel"),map);
}
@Override
public List<AdvertisingBrandData> getBookAddByType(List<Long> bookIds, String addType) {
Map<String,Object>map=new HashMap<>();
map.put("bookIds",bookIds);
map.put("addType",addType);
return getSessionTemplate().selectList(getStatement("getBookAddByType"),map);
}
}
...@@ -31,4 +31,9 @@ public class AdvertisingLinkRevertDaoImpl extends BaseDaoImpl<AdvertisingLinkRev ...@@ -31,4 +31,9 @@ public class AdvertisingLinkRevertDaoImpl extends BaseDaoImpl<AdvertisingLinkRev
public List<AdvertisingLinkRevert> getAll() { public List<AdvertisingLinkRevert> getAll() {
return getSessionTemplate().selectList(getStatement("getAll")); return getSessionTemplate().selectList(getStatement("getAll"));
} }
@Override
public void updateLinkBrandData(AdvertisingLinkRevert linkRevert) {
getSessionTemplate().update(getStatement("updateLinkBrandData"), linkRevert);
}
} }
package com.pcloud.book.advertising.dto;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/24 11:08
**/
@Data
public class AddAdvertisingBrandBooksDTO {
private Long advertisingBrandId;
private List<Long> bookIds;
}
package com.pcloud.book.advertising.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 15:05
**/
@Data
public class BookListForAdvertisingDTO {
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("书名")
private String bookName;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("渠道Id")
private Long channelId;
@ApiModelProperty("社群书id")
private Long bookGroupId;
@ApiModelProperty("isbn")
private String isbn;
@ApiModelProperty("品牌方id")
private Long advertisingBrandId;
@ApiModelProperty("品牌方名称")
private String brandName;
@ApiModelProperty("二维码个数")
private Integer qrcodeCount;
@ApiModelProperty("扫码次数")
private Long scanCount;
@ApiModelProperty("扫码人数")
private Long scanPeople;
@ApiModelProperty("服务点击次数")
private Long serveBrowseCount;
@ApiModelProperty("好友人数")
private Integer friendCount;
@ApiModelProperty("增加扫码次数")
private Integer addScanCount;
@ApiModelProperty("增加扫码人数")
private Integer addScanPeople;
@ApiModelProperty("增加服务点击次数")
private Integer addServeBrowseCount;
@ApiModelProperty("增加加好友人数")
private Integer addFriendCount;
}
package com.pcloud.book.advertising.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
/**
* @描述:数据类型和数值
* @作者:zhuyajie
* @创建时间:13:59 2020/4/16
* @版本:1.0
*/
@Data
public class BrandDataAddDTO extends BaseDto {
/**
* 修改的数据类型
*/
private String addType;
/**
* 增加数量
*/
private Integer addCount;
}
package com.pcloud.book.advertising.dto;
import com.pcloud.common.dto.BaseDto;
import java.util.List;
import lombok.Data;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:14:01 2020/4/16
* @版本:1.0
*/
@Data
public class BrandDataParamDTO extends BaseDto {
/**
* 来源类型(BOOK/QRCODE/APP/PRODUCT)
*/
private String fromType;
/**
* 书刊id
*/
private Long bookId;
/**
* 编辑id
*/
private Long adviserId;
/**
* 运营id
*/
private Long channelId;
/**
* 二维码id
*/
private Long sceneId;
/**
* 应用或作品id
*/
private Long serveId;
/**
* 数据类型和数值
*/
private List<BrandDataAddDTO> dataAddDTOS;
}
...@@ -5,12 +5,15 @@ import com.pcloud.common.dto.BaseDto; ...@@ -5,12 +5,15 @@ import com.pcloud.common.dto.BaseDto;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* @描述:链接转换记录 * @描述:链接转换记录
* @作者:zhuyajie * @作者:zhuyajie
* @创建时间:17:13 2019/10/10 * @创建时间:17:13 2019/10/10
* @版本:1.0 * @版本:1.0
*/ */
@Data
public class LinkRevertRecordDTO extends BaseDto { public class LinkRevertRecordDTO extends BaseDto {
/** /**
...@@ -51,91 +54,18 @@ public class LinkRevertRecordDTO extends BaseDto { ...@@ -51,91 +54,18 @@ public class LinkRevertRecordDTO extends BaseDto {
* 点击人数 * 点击人数
*/ */
private Integer clickUserCount; private Integer clickUserCount;
/**
* 发送次数变化
*/
private Integer sendCountChange;
/**
*点击次数变化
*/
private Integer clickCountChange;
/**
*点击人数变化
*/
private Integer clickUserCountChange;
public Long getBrandId() {
return brandId;
}
public void setBrandId(Long brandId) {
this.brandId = brandId;
}
public String getBrandName() {
return brandName;
}
public void setBrandName(String brandName) {
this.brandName = brandName;
}
public String getLink() {
return link;
}
public void setLink(String link) {
this.link = link;
}
public String getShortLink() {
return shortLink;
}
public void setShortLink(String shortLink) {
this.shortLink = shortLink;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Integer getSendCount() {
return sendCount;
}
public void setSendCount(Integer sendCount) {
this.sendCount = sendCount;
}
public Integer getClickCount() {
return clickCount;
}
public void setClickCount(Integer clickCount) {
this.clickCount = clickCount;
}
public Integer getClickUserCount() {
return clickUserCount;
}
public void setClickUserCount(Integer clickUserCount) {
this.clickUserCount = clickUserCount;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Override
public String toString() {
return "LinkRevertRecordDTO{" +
"id=" + id +
", brandId=" + brandId +
", brandName='" + brandName + '\'' +
", link='" + link + '\'' +
", shortLink='" + shortLink + '\'' +
", createTime=" + createTime +
", sendCount=" + sendCount +
", clickCount=" + clickCount +
", clickUserCount=" + clickUserCount +
'}';
}
} }
package com.pcloud.book.advertising.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/16 13:58
**/
@ApiModel("品牌方与书关联关系")
@Data
public class AdvertisingBrandBook extends BaseEntity {
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("品牌方id")
private Long advertisingBrandId;
}
package com.pcloud.book.advertising.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
/**
* 品牌方数据修改(AdvertisingBrandData)实体类
*
* @author zhuyajie
* @since 2020-04-16 11:39:22
*/
public class AdvertisingBrandData extends BaseEntity {
private static final long serialVersionUID = -93346942764371273L;
private Long id;
/**
* 来源类型(BOOK/QRCODE/APP/PRODUCT)
*/
private String fromType;
/**
* 书刊id
*/
private Long bookId;
/**
* 编辑id
*/
private Long adviserId;
/**
* 运营id
*/
private Long channelId;
/**
* 二维码id
*/
private Long sceneId;
/**
* 应用或作品id
*/
private Long serveId;
/**
* 修改的数据类型
*/
private String addType;
/**
* 增加数量
*/
private Integer addCount;
/**
* 创建时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
/**
* 修改时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getFromType() {
return fromType;
}
public void setFromType(String fromType) {
this.fromType = fromType;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getSceneId() {
return sceneId;
}
public void setSceneId(Long sceneId) {
this.sceneId = sceneId;
}
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getAddType() {
return addType;
}
public void setAddType(String addType) {
this.addType = addType;
}
public Integer getAddCount() {
return addCount;
}
public void setAddCount(Integer addCount) {
this.addCount = addCount;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
...@@ -5,9 +5,12 @@ import com.pcloud.common.entity.BaseEntity; ...@@ -5,9 +5,12 @@ import com.pcloud.common.entity.BaseEntity;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
*链接转换记录 *链接转换记录
*/ */
@Data
public class AdvertisingLinkRevert extends BaseEntity { public class AdvertisingLinkRevert extends BaseEntity {
/** /**
...@@ -34,51 +37,16 @@ public class AdvertisingLinkRevert extends BaseEntity { ...@@ -34,51 +37,16 @@ public class AdvertisingLinkRevert extends BaseEntity {
private Long createUser; private Long createUser;
public Long getBrandId() { /**
return brandId; * 发送次数变化
} */
private Integer sendCountChange;
public void setBrandId(Long brandId) { /**
this.brandId = brandId; *点击次数变化
} */
private Integer clickCountChange;
public String getLink() { /**
return link; *点击人数变化
} */
private Integer clickUserCountChange;
public void setLink(String link) {
this.link = link == null ? null : link.trim();
}
public String getRevertLink() {
return revertLink;
}
public void setRevertLink(String revertLink) {
this.revertLink = revertLink;
}
public String getShortLink() {
return shortLink;
}
public void setShortLink(String shortLink) {
this.shortLink = shortLink == null ? null : shortLink.trim();
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
} }
\ No newline at end of file
package com.pcloud.book.advertising.enums;
/**
* @描述:修改的数据类型
* @作者:zhuyajie
* @创建时间:13:47 2020/4/16
* @版本:1.0
*/
public enum BrandDataAddTypeEnum {
/**
* 扫码量
*/
SCAN("SCAN"),
/**
* 扫码人数
*/
SCAN_USER("SCAN_USER"),
/**
*服务点击次数
*/
SERVE_CLICK("SERVE_CLICK"),
/**
*读者量
*/
READER("READER"),
/**
*浏览量
*/
BROWSE("BROWSE"),
/**
*好友数量
*/
FRIENDS_COUNT("FRIENDS_COUNT"),
/**
* 1v1扫码量
*/
GROUP_SCAN("GROUP_SCAN"),
/**
* 1v1扫码人数
*/
GROUP_SCAN_USER("GROUP_SCAN_USER"),
/**
*1v1服务点击次数
*/
GROUP_SERVE_CLICK("GROUP_SERVE_CLICK");
public String value;
BrandDataAddTypeEnum(String value) {
this.value = value;
}
}
package com.pcloud.book.advertising.enums;
/**
* @描述:数据来源类型
* @作者:zhuyajie
* @创建时间:13:36 2020/4/16
* @版本:1.0
*/
public enum BrandDataFromTypeEnum {
/**
* 书刊
*/
BOOK("BOOK"),
/**
* 二维码
*/
QRCODE("QRCODE"),
/**
* 应用
*/
APP("APP"),
/**
* 作品
*/
PRODUCT("PRODUCT");
public String value;
BrandDataFromTypeEnum(String value) {
this.value = value;
}
}
package com.pcloud.book.advertising.facade;
import com.pcloud.book.advertising.biz.AdvertisingBrandDataBiz;
import com.pcloud.book.advertising.dto.AddAdvertisingBrandBooksDTO;
import com.pcloud.book.advertising.dto.BrandDataParamDTO;
import com.pcloud.book.advertising.entity.AdvertisingBrandBook;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @描述:品牌方数据修改
* @作者:zhuyajie
* @创建时间:12:06 2020/4/16
* @版本:1.0
*/
@Api(description = "品牌方数据修改外部接口")
@RequestMapping(value = "/brandData")
@RestController("advertisingBrandData")
public class AdvertisingBrandDataFacade {
@Autowired
private AdvertisingBrandDataBiz advertisingBrandDataBiz;
@ApiOperation("添加品牌方数据")
@PostMapping("addBrandData")
public ResponseDto<?> addBrandData(@RequestHeader("token") String token, @RequestBody @ApiParam BrandDataParamDTO brandDataParamDTO) throws PermissionException {
SessionUtil.getToken4Redis(token);
advertisingBrandDataBiz.addBrandData(brandDataParamDTO);
return new ResponseDto<>();
}
@ApiOperation("添加品牌方和书的关联关系")
@PostMapping("addAdvertisingBrandBooks")
public ResponseDto<?> addAdvertisingBrandBooks(
@RequestHeader("token") String token,
@RequestBody AddAdvertisingBrandBooksDTO addAdvertisingBrandBooksDTO
) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
advertisingBrandDataBiz.addAdvertisingBrandBooks(addAdvertisingBrandBooksDTO);
return new ResponseDto<>();
}
@ApiOperation("获取品牌方已经标记的书id集合")
@GetMapping("getAdvertisingBrandBooksIds")
public ResponseDto<?> getAdvertisingBrandBooksIds(
@RequestHeader("token") String token,
@RequestParam("advertisingBrandId") Long advertisingBrandId
) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingBrandDataBiz.getAdvertisingBrandBooksIds(advertisingBrandId));
}
@ApiOperation("按书id批量删除品牌方和书的关联关系")
@PostMapping("deleteAdvertisingBrandBooksByBookIds")
public ResponseDto<?> deleteAdvertisingBrandBooksByBookIds(
@RequestHeader("token") String token,
@RequestBody List<Long> bookIds
) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
advertisingBrandDataBiz.deleteAdvertisingBrandBooksByBookIds(bookIds);
return new ResponseDto<>();
}
@ApiOperation("获取品牌方书刊列表")
@GetMapping("getBookListForAdvertising")
public ResponseDto<?> getBookListForAdvertising(
@RequestHeader("token") String token,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam(value = "advertisingBrandId", required = false) Long advertisingBrandId,
@RequestParam(value = "isPitch", required = false) Boolean isPitch,
@RequestParam(value = "is1v1", required = false) Boolean is1v1
) throws PermissionException, BizException, JsonParseException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(advertisingBrandDataBiz.getBookListForAdvertising(currentPage,numPerPage,keyword,advertisingBrandId,isPitch,is1v1));
}
}
package com.pcloud.book.advertising.facade; package com.pcloud.book.advertising.facade;
import com.pcloud.book.advertising.dto.AdvertisingCpaDTO;
import com.pcloud.book.advertising.dto.AdvertisingBrandDTO; import com.pcloud.book.advertising.dto.AdvertisingBrandDTO;
import com.pcloud.book.advertising.dto.AdvertisingCpaDTO;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO; import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.book.advertising.dto.AdvertisingWechatMsgDTO; import com.pcloud.book.advertising.dto.AdvertisingWechatMsgDTO;
import com.pcloud.book.advertising.dto.Book4AdvertisingTagDTO; import com.pcloud.book.advertising.dto.Book4AdvertisingTagDTO;
...@@ -1183,42 +1183,6 @@ public interface AdvertisingSpaceFacade { ...@@ -1183,42 +1183,6 @@ public interface AdvertisingSpaceFacade {
public ResponseDto<List<Long>> getTagBookIds4AdMatser( public ResponseDto<List<Long>> getTagBookIds4AdMatser(
@RequestHeader("token") String token, @RequestParam(value = "brandId", required = false) Long brandId) throws PermissionException; @RequestHeader("token") String token, @RequestParam(value = "brandId", required = false) Long brandId) throws PermissionException;
@ApiOperation(value = "创建品牌方账号", httpMethod = "POST")
@PostMapping("createBrand")
public ResponseDto<?> createBrand(@RequestHeader("token") String token, @RequestBody @ApiParam AdvertisingBrand advertisingBrand) throws PermissionException;
@ApiOperation(value = "根据id获得品牌方信息", httpMethod = "GET")
@ApiImplicitParam(name = "brandId", value = "品牌方id", dataType = "long", paramType = "query")
@GetMapping("getBrandById")
public ResponseDto<AdvertisingBrandDTO> getBrandById(@RequestHeader("token") String token, @RequestParam("brandId") Long brandId) throws PermissionException;
@ApiOperation(value = "修改品牌方密码", httpMethod = "POST")
@PostMapping("updateBrandPassword")
public ResponseDto<?> updateBrandPassword(@RequestHeader("token") String token, @RequestBody @ApiParam AdvertisingBrand advertisingBrand) throws PermissionException;
@ApiOperation(value = "根据id删除品牌方", httpMethod = "GET")
@ApiImplicitParam(name = "brandId", value = "品牌方id", dataType = "long", paramType = "query")
@GetMapping("deleteBrandById")
public ResponseDto<?> deleteBrandById(@RequestHeader("token") String token, @RequestParam("brandId") Long brandId) throws PermissionException;
@ApiOperation(value = "分页查询品牌方", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页数量", dataType = "integer", paramType = "query"),
@ApiImplicitParam(name = "name", value = "登录账号", dataType = "string", required = false, paramType = "query")})
@GetMapping("listPageBrand")
public ResponseDto<PageBean> listPageBrand(
@RequestHeader("token") String token, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage, @RequestParam(value = "name", required = false) String name) throws PermissionException;
@ApiOperation(value = "品牌方登录", httpMethod = "POST")
@PostMapping("brandLogin")
public ResponseDto<?> brandLogin(@RequestBody @ApiParam AdvertisingBrandDTO advertisingBrandDTO);
@ApiOperation(value = "获得品牌方登录信息", httpMethod = "GET")
@GetMapping("getBrandLoginInfo")
public ResponseDto<?> getBrandLoginInfo(@RequestHeader("token") String token) throws PermissionException;
@ApiOperation(value = "创建多条微信群消息", httpMethod = "POST") @ApiOperation(value = "创建多条微信群消息", httpMethod = "POST")
@PostMapping("createWechatGroupMsg") @PostMapping("createWechatGroupMsg")
public ResponseDto<?> createWechatGroupMsg(@RequestHeader("token") String token, @RequestBody @ApiParam List<AdvertisingWechatMsg> advertisingWechatMsgList) throws PermissionException; public ResponseDto<?> createWechatGroupMsg(@RequestHeader("token") String token, @RequestBody @ApiParam List<AdvertisingWechatMsg> advertisingWechatMsgList) throws PermissionException;
...@@ -1272,10 +1236,48 @@ public interface AdvertisingSpaceFacade { ...@@ -1272,10 +1236,48 @@ public interface AdvertisingSpaceFacade {
@ApiOperation(value = "根据广告位查询配置的微信群消息", httpMethod = "GET") @ApiOperation(value = "根据广告位查询配置的微信群消息", httpMethod = "GET")
@ApiImplicitParam(name = "adId", value = "广告id", dataType = "long", paramType = "query") @ApiImplicitParam(name = "adId", value = "广告id", dataType = "long", paramType = "query")
@GetMapping("getWechatGroupMsgListByAdId") @GetMapping("getWechatGroupMsgListByAdId")
public ResponseDto<List<AdvertisingWechatMsgDTO>> getWechatGroupMsgListByAdId(@RequestHeader("token") String token, @RequestParam("adId") Long adId) throws PermissionException; public ResponseDto<List<AdvertisingWechatMsgDTO>> getWechatGroupMsgListByAdId(
@RequestHeader("token") String token, @RequestParam("adId") Long adId) throws PermissionException;
@ApiOperation(value = "创建品牌方账号", httpMethod = "POST")
@PostMapping("createBrand")
public ResponseDto<?> createBrand(@RequestHeader("token") String token, @RequestBody @ApiParam AdvertisingBrand advertisingBrand) throws PermissionException;
@ApiOperation(value = "根据id获得品牌方信息", httpMethod = "GET")
@ApiImplicitParam(name = "brandId", value = "品牌方id", dataType = "long", paramType = "query")
@GetMapping("getBrandById")
public ResponseDto<AdvertisingBrandDTO> getBrandById(@RequestHeader("token") String token, @RequestParam("brandId") Long brandId) throws PermissionException;
@ApiOperation(value = "修改品牌方密码", httpMethod = "POST")
@PostMapping("updateBrandPassword")
public ResponseDto<?> updateBrandPassword(@RequestHeader("token") String token, @RequestBody @ApiParam AdvertisingBrand advertisingBrand) throws PermissionException;
@ApiOperation(value = "根据id删除品牌方", httpMethod = "GET")
@ApiImplicitParam(name = "brandId", value = "品牌方id", dataType = "long", paramType = "query")
@GetMapping("deleteBrandById")
public ResponseDto<?> deleteBrandById(@RequestHeader("token") String token, @RequestParam("brandId") Long brandId) throws PermissionException;
@ApiOperation(value = "分页查询品牌方", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页数量", dataType = "integer", paramType = "query"),
@ApiImplicitParam(name = "name", value = "登录账号", dataType = "string", required = false, paramType = "query")})
@GetMapping("listPageBrand")
public ResponseDto<PageBean> listPageBrand(
@RequestHeader("token") String token, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage, @RequestParam(value = "name", required = false) String name) throws PermissionException;
@ApiOperation(value = "品牌方登录", httpMethod = "POST")
@PostMapping("brandLogin")
public ResponseDto<?> brandLogin(@RequestBody @ApiParam AdvertisingBrandDTO advertisingBrandDTO);
@ApiOperation(value = "客户端-根据id查询cpa内容", httpMethod = "GET") @ApiOperation(value = "客户端-根据id查询cpa内容", httpMethod = "GET")
@ApiImplicitParam(name = "cpaId", value = "cpa内容id", dataType = "Long", paramType = "query") @ApiImplicitParam(name = "cpaId", value = "cpa内容id", dataType = "Long", paramType = "query")
@GetMapping("getCPAContentById4Wechat") @GetMapping("getCPAContentById4Wechat")
public ResponseDto<AdvertisingCpaDTO> getCPAContentById4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam("cpaId") Long cpaId) throws PermissionException; public ResponseDto<AdvertisingCpaDTO> getCPAContentById4Wechat(@CookieValue("userInfo") String userInfo, @RequestParam("cpaId") Long cpaId) throws PermissionException;
@ApiOperation(value = "获得品牌方登录信息", httpMethod = "GET")
@GetMapping("getBrandLoginInfo")
public ResponseDto<?> getBrandLoginInfo(@RequestHeader("token") String token) throws PermissionException;
} }
...@@ -133,4 +133,38 @@ public class LinkRevertFacade { ...@@ -133,4 +133,38 @@ public class LinkRevertFacade {
AdvertisingLinkRevert revert = linkRevertBiz.getById(id); AdvertisingLinkRevert revert = linkRevertBiz.getById(id);
return new ResponseDto<>(revert); return new ResponseDto<>(revert);
} }
@ApiOperation("修改链接数据变化值")
@PostMapping("updateLinkBrandData")
public ResponseDto<?> updateLinkBrandData(@RequestHeader("token") String token, @RequestBody @ApiParam AdvertisingLinkRevert linkRevert) throws PermissionException {
SessionUtil.getToken4Redis(token);
if (null==linkRevert || null == linkRevert.getId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少参数");
}
linkRevert.setSendCountChange(linkRevert.getSendCountChange()==null?0:linkRevert.getSendCountChange());
linkRevert.setClickCountChange(linkRevert.getClickCountChange()==null?0:linkRevert.getClickCountChange());
linkRevert.setClickUserCountChange(linkRevert.getClickUserCountChange()==null?0:linkRevert.getClickUserCountChange());
linkRevertBiz.updateLinkBrandData(linkRevert);
return new ResponseDto<>();
}
@ApiOperation(value = "品牌方-转换记录列表查询", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页数量", dataType = "integer", paramType = "query")
})
@GetMapping("listPageRevertRecord4Brand")
public ResponseDto<PageBeanNew<LinkRevertRecordDTO>> listPageRevertRecord4Brand(
@RequestHeader("token") String token,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) throws PermissionException {
Long userId = (Long) SessionUtil.getVlaue(token, SessionUtil.USER_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
//品牌方登录,userId=brandId
PageBeanNew<LinkRevertRecordDTO> pageBean = linkRevertBiz.listPageRevertRecord(userId, currentPage, numPerPage);
return new ResponseDto<>(pageBean);
}
} }
package com.pcloud.book.advertising.service.impl; package com.pcloud.book.advertising.service.impl;
import com.pcloud.book.advertising.biz.AdvertisingBrandDataBiz;
import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz; import com.pcloud.book.advertising.biz.AdvertisingSpaceBiz;
import com.pcloud.book.advertising.biz.GroupTagBiz; import com.pcloud.book.advertising.biz.GroupTagBiz;
import com.pcloud.book.advertising.biz.LinkRevertBiz; import com.pcloud.book.advertising.biz.LinkRevertBiz;
import com.pcloud.book.advertising.dto.BrandDataDTO4Channel;
import com.pcloud.book.advertising.service.AdvertisingSpaceService; import com.pcloud.book.advertising.service.AdvertisingSpaceService;
import com.pcloud.book.group.service.BookGroupService; import com.pcloud.book.group.service.BookGroupService;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
...@@ -45,6 +47,8 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService { ...@@ -45,6 +47,8 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
private LinkRevertBiz linkRevertBiz; private LinkRevertBiz linkRevertBiz;
@Autowired @Autowired
private BookGroupService bookGroupService; private BookGroupService bookGroupService;
@Autowired
private AdvertisingBrandDataBiz advertisingBrandDataBiz;
/** /**
* 每日凌晨计算昨日广告位收益 * 每日凌晨计算昨日广告位收益
...@@ -83,4 +87,16 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService { ...@@ -83,4 +87,16 @@ public class AdvertisingSpaceServiceImpl implements AdvertisingSpaceService {
return ResponseHandleUtil.toResponse(brandIds); return ResponseHandleUtil.toResponse(brandIds);
} }
@Override
@PostMapping("mapBrandQrServeAddData")
public ResponseEntity<ResponseDto<Map<Long, BrandDataDTO4Channel>>> mapBrandQrServeAddData(@RequestBody BrandDataDTO4Channel brandDataDTO4Channel) {
return ResponseHandleUtil.toResponse(advertisingBrandDataBiz.mapBrandQrServeAddData(brandDataDTO4Channel));
}
@Override
@PostMapping("mapBrandQrAddData")
public ResponseEntity<ResponseDto<Map<Long, BrandDataDTO4Channel>>> mapBrandQrAddData(@RequestBody BrandDataDTO4Channel brandDataDTO4Channel) {
return ResponseHandleUtil.toResponse(advertisingBrandDataBiz.mapBrandQrAddData(brandDataDTO4Channel));
}
} }
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingBrandBookDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.advertising.entity.AdvertisingBrandBook" >
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="bookId" column="book_id" jdbcType="BIGINT"/>
<result property="advertisingBrandId" column="advertising_brand_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List" >
id,book_id,advertising_brand_id,create_time
</sql>
<!--新增所有列-->
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingBrandBook" useGeneratedKeys="true" keyProperty="id">
insert into advertising_brand_book (book_id, advertising_brand_id,create_time)
values (#{bookId}, #{advertisingBrandId},NOW())
</insert>
<delete id="deleteByBookId" parameterType="long">
delete from advertising_brand_book
where book_id=#{bookId}
</delete>
<insert id="batchInsert" parameterType="com.pcloud.book.advertising.entity.AdvertisingBrandBook" useGeneratedKeys="true" keyProperty="id">
insert into advertising_brand_book (
book_id, advertising_brand_id,create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.bookId}, #{item.advertisingBrandId},NOW()
)
</foreach>
</insert>
<delete id="deleteByBookIds" parameterType="long">
delete from advertising_brand_book
where book_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</delete>
<select id="getByBookIds" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> from advertising_brand_book
where book_id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</select>
<select id="getBookIdsByAdvertisingBrandId" parameterType="long" resultType="long">
select book_id from advertising_brand_book
where advertising_brand_id=#{advertisingBrandId}
</select>
<delete id="deleteByAdvertisingBrandId" parameterType="long">
delete from advertising_brand_book
where advertising_brand_id=#{advertisingBrandId}
</delete>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.advertising.dao.impl.AdvertisingBrandDataDaoImpl">
<resultMap type="com.pcloud.book.advertising.entity.AdvertisingBrandData" id="AdvertisingBrandDataMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="fromType" column="from_type" jdbcType="VARCHAR"/>
<result property="bookId" column="book_id" jdbcType="INTEGER"/>
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
<result property="channelId" column="channel_id" jdbcType="INTEGER"/>
<result property="sceneId" column="scene_id" jdbcType="INTEGER"/>
<result property="serveId" column="serve_id" jdbcType="INTEGER"/>
<result property="addType" column="add_type" jdbcType="VARCHAR"/>
<result property="addCount" column="add_count" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultMap="AdvertisingBrandDataMap" parameterType="com.pcloud.book.advertising.entity.AdvertisingBrandData">
select
id, from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time
from book.advertising_brand_data
<where>
<if test="fromType != null and fromType != ''">
and from_type = #{fromType}
</if>
<if test="bookId != null">
and book_id = #{bookId}
</if>
<if test="adviserId != null">
and adviser_id = #{adviserId}
</if>
<if test="channelId != null">
and channel_id = #{channelId}
</if>
<if test="sceneId != null">
and scene_id = #{sceneId}
</if>
<if test="serveId != null">
and serve_id = #{serveId}
</if>
</where>
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.advertising_brand_data(from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time)
values (#{fromType}, #{bookId}, #{adviserId}, #{channelId}, #{sceneId}, #{serveId}, #{addType}, #{addCount}, NOW(), NOW())
</insert>
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into advertising_brand_data (
from_type, book_id, adviser_id, channel_id,
scene_id, serve_id, add_type, add_count, create_time, update_time
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.fromType}, #{item.bookId}, #{item.adviserId}, #{item.channelId},
#{item.sceneId}, #{item.serveId}, #{item.addType}, #{item.addCount}, NOW(), NOW()
)
</foreach>
</insert>
<!--通过主键删除-->
<delete id="deleteById">
delete from book.advertising_brand_data where id = #{id}
</delete>
<select id="getQrServeData4Channel" parameterType="map" resultMap="AdvertisingBrandDataMap">
select
id, from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time
from advertising_brand_data
WHERE from_type = #{fromType}
and book_id = #{bookId}
and scene_id = #{sceneId}
<if test="adviserId != null">
and adviser_id = #{adviserId}
</if>
<if test="channelId != null">
and channel_id = #{channelId}
</if>
and serve_id in
<foreach collection="serveIdList" item="item" open="(" close=")" separator="," index="index">
#{item}
</foreach>
</select>
<select id="getQrData4Channel" parameterType="map" resultMap="AdvertisingBrandDataMap">
select
id, from_type, book_id, adviser_id, channel_id, scene_id, serve_id, add_type, add_count, create_time, update_time
from advertising_brand_data
WHERE from_type = #{fromType}
and book_id = #{bookId}
and adviser_id = #{adviserId}
and channel_id = #{channelId}
and scene_id in
<foreach collection="sceneIdList" item="item" open="(" close=")" separator="," index="index">
#{item}
</foreach>
</select>
<select id="getBookAddByType" parameterType="map" resultMap="AdvertisingBrandDataMap">
select
book_id, add_count
from advertising_brand_data
WHERE from_type = 'BOOK'
and book_id in
<foreach collection="bookIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
and add_type=#{addType}
group by book_id
</select>
</mapper>
\ No newline at end of file
...@@ -9,19 +9,22 @@ ...@@ -9,19 +9,22 @@
<result column="short_link" property="shortLink" jdbcType="VARCHAR" /> <result column="short_link" property="shortLink" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="create_user" property="createUser" jdbcType="BIGINT" /> <result column="create_user" property="createUser" jdbcType="BIGINT" />
<result column="send_count_change" property="sendCountChange" jdbcType="INTEGER" />
<result column="click_count_change" property="clickCountChange" jdbcType="INTEGER" />
<result column="click_user_count_change" property="clickUserCountChange" jdbcType="INTEGER" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, brand_id, link, revert_link, short_link, create_time, create_user id, brand_id, link, revert_link, short_link, create_time, create_user,send_count_change,click_count_change,click_user_count_change
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingLinkRevert" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.advertising.entity.AdvertisingLinkRevert" useGeneratedKeys="true" keyProperty="id">
insert into advertising_link_revert (id, brand_id, link, revert_link, insert into advertising_link_revert (id, brand_id, link, revert_link,
short_link, create_time, create_user short_link, create_time, create_user,send_count_change,click_count_change,click_user_count_change
) )
values (#{id,jdbcType=BIGINT}, #{brandId,jdbcType=BIGINT}, #{link,jdbcType=VARCHAR}, #{revertLink}, values (#{id,jdbcType=BIGINT}, #{brandId,jdbcType=BIGINT}, #{link,jdbcType=VARCHAR}, #{revertLink},
#{shortLink,jdbcType=VARCHAR}, NOW(), #{createUser,jdbcType=BIGINT} #{shortLink,jdbcType=VARCHAR}, NOW(), #{createUser,jdbcType=BIGINT},0,0,0
) )
</insert> </insert>
...@@ -36,7 +39,10 @@ ...@@ -36,7 +39,10 @@
brand_id brandId, brand_id brandId,
link link, link link,
short_link shortLink, short_link shortLink,
create_time createTime create_time createTime,
send_count_change sendCountChange,
click_count_change clickCountChange,
click_user_count_change clickUserCountChange
FROM FROM
advertising_link_revert advertising_link_revert
WHERE WHERE
...@@ -76,4 +82,12 @@ ...@@ -76,4 +82,12 @@
FROM advertising_link_revert FROM advertising_link_revert
</select> </select>
<update id="updateLinkBrandData" parameterType="com.pcloud.book.advertising.entity.AdvertisingLinkRevert">
UPDATE advertising_link_revert
SET send_count_change = #{sendCountChange},
click_count_change = #{clickCountChange},
click_user_count_change = #{clickUserCountChange}
WHERE id = #{id}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -652,4 +652,42 @@ ...@@ -652,4 +652,42 @@
AND IS_MAIN_EDITOR=1 AND IS_DELETE=0 AND IS_MAIN_EDITOR=1 AND IS_DELETE=0
LIMIT 1 LIMIT 1
</select> </select>
<select id="getBookListForAdvertising" parameterType="map" resultType="com.pcloud.book.advertising.dto.BookListForAdvertisingDTO">
SELECT
t.BOOK_ID bookId,
t.channel_id channelId,
t.adviser_id adviserId,
<if test="is1v1!=null and is1v1">
tt.id bookGroupId,
</if>
t1.BOOK_NAME bookName,
t1.ISBN,
t2.advertising_brand_id advertisingBrandId,
t3.brand_name brandName
FROM
book_adviser t
INNER JOIN book t1 ON t.BOOK_ID = t1.BOOK_ID
<if test="is1v1!=null and is1v1">
INNER JOIN book_group tt on t.BOOK_ID = tt.BOOK_ID and tt.join_group_type=2
</if>
AND t.IS_DELETE = 0
AND t1.IS_DELETE = 0
LEFT JOIN advertising_brand_book t2
on t2.book_id=t.BOOK_ID
LEFT JOIN advertising_brand t3 on t2.advertising_brand_id=t3.id
WHERE
t.IS_MAIN_EDITOR = 1
<if test="keyword != null">
AND (t1.BOOK_NAME LIKE CONCAT('%', #{keyword}, '%') or t1.ISBN LIKE CONCAT('%', #{keyword},'%'))
</if>
<if test="advertisingBrandId!=null">
and t2.advertising_brand_id=#{advertisingBrandId}
</if>
<if test="isPitch!=null and isPitch">
and t2.advertising_brand_id is null
</if>
group by t.BOOK_ID
</select>
</mapper> </mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment