Commit e4bda5b7 by 杨涛

feat/知识商城

parent 099d40a3
......@@ -2,6 +2,7 @@ package com.pcloud.book.group.service;
import java.util.List;
import java.util.Map;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -10,7 +11,10 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -30,6 +34,20 @@ public interface BookGroupService {
@RequestMapping(value = "getBookGroupInfoByIds", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<Long, BookGroupDTO>>> getBookGroupInfoByIds(@RequestBody List<Long> bookGroupIds) throws BizException;
@ApiOperation("为信息流批量获取社群书基本信息")
@RequestMapping(value = "getFlowInfoByBookGroupIds", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<Long, StoreFlowInfoDto>>> getFlowInfoByBookGroupIds(@RequestBody List<Long> bookGroupIds) throws BizException;
@ApiOperation("获取指定条数社群书基本信息")
@RequestMapping(value = "getBookGroupInfoByChannelId",method = RequestMethod.GET)
ResponseEntity<ResponseDto<Map<Long, StoreFlowInfoDto>>> getBookGroupInfoByChannelId(@RequestParam("channelId")Long channelId, @RequestParam("itemNum")Integer itemNum) throws BizException;
@ApiOperation(value = "知识商城获取社群书信息")
@RequestMapping(value = "listBookGroup4KnowledgeMall",method = RequestMethod.GET)
ResponseEntity<ResponseDto<PageBeanNew<StoreFlowInfoDto>>> listBookGroup4KnowledgeMall(@RequestParam(value="channelId",required = false)Long channelId,
@RequestParam("currentPage")int currentPage,
@RequestParam("numPerPage") int numPerPage) throws BizException;
@ApiOperation("获取社群书基本信息")
@RequestMapping(value = "getBaseInfoBySceneId",method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookGroupDTO>> getBaseInfoBySceneId(@RequestParam("sceneId")Long sceneId) throws BizException;
......
......@@ -126,4 +126,16 @@ public class TradeConsr {
return amount;
}
@ParamLog("获取用户购买或者参与过的社群码ID")
public List<Long> getBuyBookGroupIdList(Long channelId, Long wechatUserId) throws BizException {
List<Long> results = new ArrayList<>();
try {
ResponseEntity<ResponseDto<List<Long>>> responseEntity = orderFormService.getBuyBookGroupIdList(wechatUserId, channelId);
results = ResponseHandleUtil.parseListResponse(responseEntity, Long.class);
} catch (Exception e) {
LOGGER.error("获取用户购买或者参与过的社群码ID详情:" + e.getMessage(), e);
}
return results;
}
}
......@@ -4,9 +4,13 @@ import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.*;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
......@@ -126,6 +130,13 @@ public interface BookGroupBiz {
PageBean listBookGroup4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException;
/**
* @description 获取社群书列表(运营)
* @author 戴兴
* @date 2019/7/23 15:39
*/
PageBean listBookGroup4Channel(Long channelId, ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO);
/**
* 获取社群书列表(编辑)
* @param paramMap 参数Map
* @return
......@@ -245,4 +256,22 @@ public interface BookGroupBiz {
* 获取是否显示书名
*/
Boolean getIsShowBookName(Long partyId);
/**
* 为信息流批量获取社群书基本信息
*/
Map<Long, StoreFlowInfoDto> getFlowInfoByBookGroupIds(List<Long> bookGroupIds);
/**
* 获取指定条数社群书基本信息
*/
Map<Long, StoreFlowInfoDto> getBookGroupInfoByChannelId(Long channelId, Integer itemNum);
/**
* 知识商城获取社群书信息
*/
PageBeanNew<StoreFlowInfoDto> listBookGroup4KnowledgeMall(Long channelId, int currentPage, int numPerPage);
/**
* 获取用户购买或者参与过的社群书信息
*/
PageBeanNew<GroupStoreMyPayDto> getUserBrowseGroup4KnowLedgeMall(Long channelId, Long wechatUserId, Integer currentPage, Integer numPerPage);
}
package com.pcloud.book.group.biz.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.appcenter.base.dto.AppPriceCacheDTO;
import com.pcloud.appcenter.cache.service.AppPriceCacheService;
......@@ -27,9 +30,10 @@ import com.pcloud.book.group.dto.AppStatisticsDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.ClassifyKeywordDTO;
import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.vo.*;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.ListKeywordVO;
......@@ -42,6 +46,7 @@ import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.core.dto.SendNotifyDto;
import com.pcloud.common.core.enums.NotifyOriginTypeEnum;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.entity.UploadResultInfo;
import com.pcloud.common.enums.AppTypeEnum;
import com.pcloud.common.exceptions.BizException;
......@@ -67,6 +72,8 @@ import com.pcloud.resourcecenter.product.dto.SpecificationDto;
import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Product;
import com.pcloud.resourcecenter.product.service.ProductService;
import com.pcloud.resourcecenter.store.constants.StoreCons;
import com.pcloud.settlementcenter.record.dto.GroupRescourceIncomeParamDTO;
import com.pcloud.settlementcenter.record.service.SettlementService;
import com.pcloud.videolesson.schedule.service.ScheduleService;
import com.pcloud.wechatgroup.group.service.GroupMemberService;
......@@ -512,6 +519,51 @@ public class BookGroupBizImpl implements BookGroupBiz {
return pageBean;
}
@Override
public PageBean listBookGroup4Channel(Long channelId, ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO) {
Integer currentPage = listBookGroup4ChannelParamVO.getCurrentPage();
Integer numPerPage = listBookGroup4ChannelParamVO.getNumPerPage();
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
paramMap.put("keywords", listBookGroup4ChannelParamVO.getKeywords());
paramMap.put("isFundBook", listBookGroup4ChannelParamVO.getIsFundBook());
String startTime = listBookGroup4ChannelParamVO.getStartTime();
String endTime = listBookGroup4ChannelParamVO.getEndTime();
if (startTime != null){
paramMap.put("startTime", startTime + " 00:00:00");
}
if (endTime != null){
paramMap.put("endTime", endTime + " 23:59:59");
}
PageBean listBookGroup4Channel = bookDao.listPage(pageParam, paramMap, "listBookGroup4Channel");
List<Long> bookGroupIds = new ArrayList<>();
listBookGroup4Channel.getRecordList().forEach(e -> {
ListBook4ChannelVO listBook4ChannelVO = (ListBook4ChannelVO) e;
bookGroupIds.add(listBook4ChannelVO.getBookGroupId());
});
if(ListUtils.isEmpty(bookGroupIds)){
return new PageBean(0, 0, new ArrayList<>());
}
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(bookGroupIds);
listBookGroup4Channel.getRecordList().forEach( e ->{
ListBook4ChannelVO listBook4ChannelVO = (ListBook4ChannelVO) e;
if (!MapUtils.isEmpty(statisMap) && statisMap.containsKey(listBook4ChannelVO.getBookGroupId())) {
BookGroupStatisticDTO dto = statisMap.get(listBook4ChannelVO.getBookGroupId());
listBook4ChannelVO.setClassifyNum(null != dto.getClassifyCount() ? dto.getClassifyCount().longValue() : 0L);
listBook4ChannelVO.setTotalNum(null != dto.getUserNumber() ? dto.getUserNumber().longValue() : 0L);
}else {
listBook4ChannelVO.setClassifyNum(0L);
listBook4ChannelVO.setTotalNum(0L);
}
});
return listBookGroup4Channel;
}
/**
* 获取社群书列表(编辑)
*/
......@@ -1058,4 +1110,144 @@ public class BookGroupBizImpl implements BookGroupBiz {
return bookGroupDao.getIsShowBookName(partyId);
}
@ParamLog("为信息流批量获取社群书基本信息")
@Override
public Map<Long, StoreFlowInfoDto> getFlowInfoByBookGroupIds(List<Long> bookGroupIds) {
Map<Long, StoreFlowInfoDto> result = new HashMap<>();
if (ListUtils.isEmpty(bookGroupIds)) {
return null;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupIds", bookGroupIds);
List<Object> listBook4ChannelVOS = bookDao.listBy(paramMap, "getBookGroupInfo4Channel");
if(ListUtils.isEmpty(bookGroupIds)){
return new HashMap<>();
}
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(bookGroupIds);
listBook4ChannelVOS.forEach( e ->{
ListBook4ChannelVO listBook4ChannelVO = (ListBook4ChannelVO) e;
StoreFlowInfoDto storeFlowInfoDto = new StoreFlowInfoDto();
storeFlowInfoDto.setOriginId(listBook4ChannelVO.getBookGroupId());
storeFlowInfoDto.setOriginType(StoreCons.OriginTypeEnum.BOOK_GROUP.getCode());
storeFlowInfoDto.setCoverImg(listBook4ChannelVO.getCoverImg());
storeFlowInfoDto.setTitle(listBook4ChannelVO.getBookName());
if (!MapUtils.isEmpty(statisMap) && statisMap.containsKey(listBook4ChannelVO.getBookGroupId())) {
BookGroupStatisticDTO dto = statisMap.get(listBook4ChannelVO.getBookGroupId());
storeFlowInfoDto.setResourceNum(null != dto.getClassifyCount() ? dto.getClassifyCount() : 0);
storeFlowInfoDto.setResourceItemNum(null != dto.getUserNumber() ? dto.getUserNumber() : 0);
}else {
storeFlowInfoDto.setResourceNum(0);
storeFlowInfoDto.setResourceItemNum(0);
}
result.put(listBook4ChannelVO.getBookGroupId(), storeFlowInfoDto);
});
return result;
}
@ParamLog("获取指定条数社群书基本信息")
@Override
public Map<Long, StoreFlowInfoDto> getBookGroupInfoByChannelId(Long channelId, Integer itemNum) {
Map<Long, StoreFlowInfoDto> result = new HashMap<>();
PageParam pageParam = new PageParam(0, itemNum);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
PageBean listBookGroup4Channel = bookDao.listPage(pageParam, paramMap, "listBookGroup4Channel");
List<Long> bookGroupIds = new ArrayList<>();
listBookGroup4Channel.getRecordList().forEach(e -> {
ListBook4ChannelVO listBook4ChannelVO = (ListBook4ChannelVO) e;
bookGroupIds.add(listBook4ChannelVO.getBookGroupId());
});
if(ListUtils.isEmpty(bookGroupIds)){
return new HashMap<>();
}
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(bookGroupIds);
listBookGroup4Channel.getRecordList().forEach( e ->{
ListBook4ChannelVO listBook4ChannelVO = (ListBook4ChannelVO) e;
StoreFlowInfoDto storeFlowInfoDto = new StoreFlowInfoDto();
storeFlowInfoDto.setOriginId(listBook4ChannelVO.getBookGroupId());
storeFlowInfoDto.setOriginType(StoreCons.OriginTypeEnum.BOOK_GROUP.getCode());
storeFlowInfoDto.setCoverImg(listBook4ChannelVO.getCoverImg());
storeFlowInfoDto.setTitle(listBook4ChannelVO.getBookName());
if (!MapUtils.isEmpty(statisMap) && statisMap.containsKey(listBook4ChannelVO.getBookGroupId())) {
BookGroupStatisticDTO dto = statisMap.get(listBook4ChannelVO.getBookGroupId());
storeFlowInfoDto.setResourceNum(null != dto.getClassifyCount() ? dto.getClassifyCount() : 0);
storeFlowInfoDto.setResourceItemNum(null != dto.getUserNumber() ? dto.getUserNumber() : 0);
}else {
storeFlowInfoDto.setResourceNum(0);
storeFlowInfoDto.setResourceItemNum(0);
}
result.put(listBook4ChannelVO.getBookGroupId(), storeFlowInfoDto);
});
return result;
}
@Override
@ParamLog("知识商城获取社群书信息")
public PageBeanNew<StoreFlowInfoDto> listBookGroup4KnowledgeMall(Long channelId, int currentPage, int numPerPage) {
List<StoreFlowInfoDto> results = new ArrayList<>();
PageParam pageParam = new PageParam(currentPage, numPerPage);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
PageBeanNew<ListBook4ChannelVO> resultInfos = bookDao.listPageNew(pageParam, paramMap, "listBookGroup4Channel");
List<Long> bookGroupIds = resultInfos.getRecordList().stream().map(ListBook4ChannelVO::getBookGroupId).collect(Collectors.toList());
if(ListUtils.isEmpty(bookGroupIds)){
return new PageBeanNew(0, 0, 0, new ArrayList<>());
}
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(bookGroupIds);
for (ListBook4ChannelVO listBook4ChannelVO : resultInfos.getRecordList()) {
StoreFlowInfoDto storeFlowInfoDto = new StoreFlowInfoDto();
storeFlowInfoDto.setOriginId(listBook4ChannelVO.getBookGroupId());
storeFlowInfoDto.setOriginType(StoreCons.OriginTypeEnum.BOOK_GROUP.getCode());
storeFlowInfoDto.setCoverImg(listBook4ChannelVO.getCoverImg());
storeFlowInfoDto.setTitle(listBook4ChannelVO.getBookName());
if (!MapUtils.isEmpty(statisMap) && statisMap.containsKey(listBook4ChannelVO.getBookGroupId())) {
BookGroupStatisticDTO dto = statisMap.get(listBook4ChannelVO.getBookGroupId());
storeFlowInfoDto.setResourceNum(null != dto.getClassifyCount() ? dto.getClassifyCount() : 0);
storeFlowInfoDto.setResourceItemNum(null != dto.getUserNumber() ? dto.getUserNumber() : 0);
} else {
storeFlowInfoDto.setResourceNum(0);
storeFlowInfoDto.setResourceItemNum(0);
}
results.add(storeFlowInfoDto);
}
return new PageBeanNew<>(currentPage, numPerPage, resultInfos.getTotalCount(), results);
}
@ParamLog("获取用户购买或者参与过的社群书信息")
@Override
public PageBeanNew<GroupStoreMyPayDto> getUserBrowseGroup4KnowLedgeMall(Long channelId, Long wechatUserId, Integer currentPage, Integer numPerPage) {
List<GroupStoreMyPayDto> results = new ArrayList<>();
PageParam pageParam = new PageParam(currentPage, numPerPage);
List<Long> bookGroupIds = Lists.newArrayList();
bookGroupIds = tradeConsr.getBuyBookGroupIdList(channelId, wechatUserId);
Map<String, Object> paramMap = new HashMap<>();
if(ListUtils.isEmpty(bookGroupIds)){
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
paramMap.put("bookGroupIds", bookGroupIds);
PageBeanNew<ListBook4ChannelVO> resultInfos = bookDao.listPageNew(pageParam, paramMap, "getBookGroupInfo4Channel");
List<Long> groupIds = resultInfos.getRecordList().stream().map(ListBook4ChannelVO::getBookGroupId).collect(Collectors.toList());
if(ListUtils.isEmpty(bookGroupIds)){
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
Map<Long, BookGroupStatisticDTO> statisMap = bookGroupClassifyBiz.getBookGroupStatistic(groupIds);
for (ListBook4ChannelVO listBook4ChannelVO : resultInfos.getRecordList()) {
GroupStoreMyPayDto groupStoreMyPayDto = new GroupStoreMyPayDto();
groupStoreMyPayDto.setOriginId(listBook4ChannelVO.getBookGroupId());
groupStoreMyPayDto.setOriginType(StoreCons.OriginTypeEnum.BOOK_GROUP.getCode());
groupStoreMyPayDto.setCoverImg(listBook4ChannelVO.getCoverImg());
groupStoreMyPayDto.setOriginName(listBook4ChannelVO.getBookName());
if (!MapUtils.isEmpty(statisMap) && statisMap.containsKey(listBook4ChannelVO.getBookGroupId())) {
BookGroupStatisticDTO dto = statisMap.get(listBook4ChannelVO.getBookGroupId());
groupStoreMyPayDto.setResourceNum(null != dto.getClassifyCount() ? dto.getClassifyCount() : 0);
groupStoreMyPayDto.setResourceItemNum(null != dto.getUserNumber() ? dto.getUserNumber() : 0);
} else {
groupStoreMyPayDto.setResourceNum(0);
groupStoreMyPayDto.setResourceItemNum(0);
}
results.add(groupStoreMyPayDto);
}
return new PageBeanNew<>(currentPage, numPerPage, resultInfos.getTotalCount(), results);
}
}
package com.pcloud.book.group.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.math.BigDecimal;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author 杨涛
* @description 商城用户已购买的社群码dto
* @date 2019/8/9 10:30
*/
@ApiModel("商城用户已购买的社群码dto")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class GroupStoreMyPayDto {
@ApiModelProperty("标识(appId/productId/bookGroupId)")
private Long originId;
@ApiModelProperty("类型(APP/PRODUCT/BOOK_GROUP)")
private String originType;
@ApiModelProperty("标题")
private String originName;
@ApiModelProperty("封面图片")
private String coverImg;
@ApiModelProperty("已经购买的资源数量")
private Integer resourceNum;
@ApiModelProperty("已经购买的资源数量")
private Integer resourceItemNum;
public Long getOriginId() {
return originId;
}
public void setOriginId(Long originId) {
this.originId = originId;
}
public String getOriginType() {
return originType;
}
public void setOriginType(String originType) {
this.originType = originType;
}
public String getOriginName() {
return originName;
}
public void setOriginName(String originName) {
this.originName = originName;
}
public String getCoverImg() {
return coverImg;
}
public void setCoverImg(String coverImg) {
this.coverImg = coverImg;
}
public Integer getResourceNum() {
return resourceNum;
}
public void setResourceNum(Integer resourceNum) {
this.resourceNum = resourceNum;
}
public Integer getResourceItemNum() {
return resourceItemNum;
}
public void setResourceItemNum(Integer resourceItemNum) {
this.resourceItemNum = resourceItemNum;
}
@Override
public String toString() {
return "GroupStoreMyPayDto{" +
"originId=" + originId +
", originType='" + originType + '\'' +
", originName='" + originName + '\'' +
", coverImg='" + coverImg + '\'' +
", resourceNum=" + resourceNum +
", resourceItemNum=" + resourceItemNum +
'}';
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.group.facade;
import com.pcloud.book.group.entity.BookGroupClassify;
import org.codehaus.jackson.JsonParseException;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.vo.ListBookGroup4ChannelParamVO;
import com.pcloud.book.group.vo.UpdateRankTypeVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
......@@ -118,6 +120,28 @@ public interface BookGroupFacade {
@RequestParam(value = "endDate", required = false) String endDate)
throws BizException, PermissionException;
@ApiOperation(value = "获取社群书列表(运营)", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "listBookGroup4ChannelParamVO", value = "ListBookGroup4ChannelParamVO", dataType = "ListBookGroup4ChannelParamVO", paramType = "body")
})
@RequestMapping(value = "listBookGroup4Channel", method = RequestMethod.POST)
ResponseDto<PageBean> listBookGroup4Channel(@RequestHeader("token") String token,
@RequestBody ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO)
throws BizException, PermissionException;
@ApiOperation(value = "获取用户购买或者参与过的社群书信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "Integer", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "Integer", paramType = "query")
})
@RequestMapping(value = "getUserBrowseGroup4KnowLedgeMall", method = RequestMethod.GET)
ResponseDto<?> getUserBrowseGroup4KnowLedgeMall(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
@ApiOperation(value = "获取社群书列表(编辑)", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
......
......@@ -6,17 +6,20 @@ import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.facade.BookGroupFacade;
import com.pcloud.book.group.vo.UpdateRankTypeVO;
import com.pcloud.book.group.vo.*;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil;
import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -170,6 +173,26 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(pageBean);
}
@Override
@RequestMapping(value = "listBookGroup4Channel", method = RequestMethod.POST)
public ResponseDto<PageBean> listBookGroup4Channel(@RequestHeader("token") String token,
@RequestBody ListBookGroup4ChannelParamVO listBookGroup4ChannelParamVO) throws BizException, PermissionException {
Long channelId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBean pageBean = bookGroupBiz.listBookGroup4Channel(channelId, listBookGroup4ChannelParamVO);
return new ResponseDto<>(pageBean);
}
@Override
@RequestMapping(value = "getUserBrowseGroup4KnowLedgeMall", method = RequestMethod.GET)
public ResponseDto<?> getUserBrowseGroup4KnowLedgeMall(@CookieValue("userInfo")String userInfo,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage) throws BizException, PermissionException {
Long channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
PageBeanNew<GroupStoreMyPayDto> resultInfos= bookGroupBiz.getUserBrowseGroup4KnowLedgeMall(channelId, wechatUserId, currentPage, numPerPage);
return new ResponseDto<>(resultInfos);
}
/**
* 获取社群书列表(编辑)
*/
......
......@@ -2,6 +2,7 @@ package com.pcloud.book.group.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -13,7 +14,9 @@ import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.service.BookGroupService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.dto.StoreFlowInfoDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.utils.ResponseHandleUtil;
/**
......@@ -46,6 +49,35 @@ public class BookGroupServiceImpl implements BookGroupService {
}
/**
* 为信息流批量获取社群书基本信息
*/
@Override
@RequestMapping(value = "getFlowInfoByBookGroupIds", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Map<Long, StoreFlowInfoDto>>> getFlowInfoByBookGroupIds(@RequestBody List<Long> bookGroupIds) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getFlowInfoByBookGroupIds(bookGroupIds));
}
/**
* 获取指定条数社群书基本信息
*/
@Override
@RequestMapping(value = "getBookGroupInfoByChannelId",method = RequestMethod.GET)
public ResponseEntity<ResponseDto<Map<Long, StoreFlowInfoDto>>> getBookGroupInfoByChannelId(@RequestParam("channelId")Long channelId, @RequestParam("itemNum")Integer itemNum) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.getBookGroupInfoByChannelId(channelId, itemNum));
}
/**
* 知识商城获取社群书信息
*/
@Override
@RequestMapping(value = "listBookGroup4KnowledgeMall",method = RequestMethod.GET)
public ResponseEntity<ResponseDto<PageBeanNew<StoreFlowInfoDto>>> listBookGroup4KnowledgeMall(@RequestParam(value="channelId",required = false)Long channelId,
@RequestParam("currentPage")int currentPage,
@RequestParam("numPerPage") int numPerPage) throws BizException {
return ResponseHandleUtil.toResponse(bookGroupBiz.listBookGroup4KnowledgeMall(channelId, currentPage, numPerPage));
}
/**
* 获取社群书基本信息
*/
@Override
......
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/23 15:53
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListBook4ChannelVO implements Serializable {
@ApiModelProperty("书唯一标识")
private Long bookId;
@ApiModelProperty("书群唯一标识")
private Long bookGroupId;
@ApiModelProperty("书名")
private String bookName;
@ApiModelProperty("ISBN")
private String isbn;
@ApiModelProperty("书编号")
private String bookNumber;
@ApiModelProperty("群分类数")
private Long classifyNum;
@ApiModelProperty("群总人数")
private Long totalNum;
@ApiModelProperty("书封面图")
private String coverImg;
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
public String getBookNumber() {
return bookNumber;
}
public void setBookNumber(String bookNumber) {
this.bookNumber = bookNumber;
}
public Long getClassifyNum() {
return classifyNum;
}
public void setClassifyNum(Long classifyNum) {
this.classifyNum = classifyNum;
}
public Long getTotalNum() {
return totalNum;
}
public void setTotalNum(Long totalNum) {
this.totalNum = totalNum;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getCoverImg() {
return coverImg;
}
public void setCoverImg(String coverImg) {
this.coverImg = coverImg;
}
@Override
public String toString() {
return "ListBook4ChannelVO{" +
"bookId=" + bookId +
", bookGroupId=" + bookGroupId +
", bookName='" + bookName + '\'' +
", isbn='" + isbn + '\'' +
", bookNumber='" + bookNumber + '\'' +
", classifyNum=" + classifyNum +
", totalNum=" + totalNum +
", coverImg='" + coverImg + '\'' +
'}';
}
}
\ No newline at end of file
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/23 15:28
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListBookGroup4ChannelParamVO implements Serializable {
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页条数")
private Integer numPerPage;
@ApiModelProperty("搜索的关键词")
private String keywords;
@ApiModelProperty("开始时间")
private String startTime;
@ApiModelProperty("结束时间")
private String endTime;
@ApiModelProperty("是否是基金书 0-否,1-是")
private Integer isFundBook;
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getNumPerPage() {
return numPerPage;
}
public void setNumPerPage(Integer numPerPage) {
this.numPerPage = numPerPage;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Integer getIsFundBook() {
return isFundBook;
}
public void setIsFundBook(Integer isFundBook) {
this.isFundBook = isFundBook;
}
@Override
public String toString() {
return "ListBookGroup4ChannelParamVO{" +
"currentPage=" + currentPage +
", numPerPage=" + numPerPage +
", keywords='" + keywords + '\'' +
", startTime=" + startTime +
", endTime=" + endTime +
", isFundBook=" + isFundBook +
'}';
}
}
\ No newline at end of file
......@@ -604,6 +604,50 @@
G.UPDATE_TIME DESC
</select>
<select id="listBookGroup4Channel" resultType="com.pcloud.book.group.vo.ListBook4ChannelVO" parameterType="map">
SELECT b.BOOK_ID bookId,b.COVER_IMG coverImg, bg.id bookGroupId ,b.ISBN isbn,b.BOOK_NAME bookName,CONCAT('BK',b.BOOK_ID) bookNumber FROM `book_group` bg
LEFT JOIN book b ON bg.book_id = b.BOOK_ID
LEFT JOIN book_fund bf ON bg.book_id = bf.BOOK_ID AND bf.END_TIME <![CDATA[ > ]]> NOW() AND bf.START_TIME <![CDATA[ < ]]> NOW()
LEFT JOIN book_group_classify bgc ON bg.id = bgc.book_group_id
WHERE bg.channel_id = #{channelId}
<if test="keywords != null">
AND (b.ISBN like CONCAT('%',#{keywords},'%') OR b.BOOK_NAME like CONCAT('%',#{keywords},'%') OR bg.group_qrcode_name like CONCAT('%',#{keywords},'%'))
</if>
<if test="isFundBook != null and isFundBook == 1">
AND bf.BOOK_FUND_ID IS NOT NULL
</if>
<if test="startTime != null ">
AND bg.create_time &gt;= #{startTime}
</if>
<if test="endTime != null ">
AND bg.create_time &lt;= #{endTime}
</if>
AND bgc.id is not null
AND b.BOOK_ID is not null
AND b.IS_DELETE = 0
AND bg.IS_DELETE = 0
AND bgc.is_delete = 0
GROUP BY b.BOOK_ID
ORDER BY bg.create_time DESC
</select>
<select id="getBookGroupInfo4Channel" resultType="com.pcloud.book.group.vo.ListBook4ChannelVO" parameterType="map">
SELECT b.BOOK_ID bookId,b.COVER_IMG coverImg, bg.id bookGroupId ,b.ISBN isbn,b.BOOK_NAME bookName,CONCAT('BK',b.BOOK_ID) bookNumber FROM `book_group` bg
LEFT JOIN book b ON bg.book_id = b.BOOK_ID
LEFT JOIN book_fund bf ON bg.book_id = bf.BOOK_ID
LEFT JOIN book_group_classify bgc ON bg.id = bgc.book_group_id
WHERE bg.id in
<foreach collection="bookGroupIds" index="i" item="item" open="(" separator="," close=")">
${item}
</foreach>
AND bgc.id is not null
AND b.BOOK_ID is not null
AND b.IS_DELETE = 0
AND bg.IS_DELETE = 0
AND bgc.is_delete = 0
GROUP BY b.BOOK_ID
</select>
<!-- 获取社群书列表(编辑) -->
<select id="listSimpleBookGroup4Adviser" resultMap="bookMap" parameterType="map">
SELECT
......
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