Commit 30e43bb9 by 阮思源

Merge branch 'feat-1002086' into 'master'

1v1社群书关联

See merge request rays/pcloud-book!290
parents 02ba31e1 75576123
...@@ -131,6 +131,11 @@ public class BookGroupDTO implements Serializable { ...@@ -131,6 +131,11 @@ public class BookGroupDTO implements Serializable {
*/ */
private Long sceneId; private Long sceneId;
/**
* 社群书名称
*/
private String bookName;
public String getUrl() { public String getUrl() {
return url; return url;
} }
...@@ -325,6 +330,14 @@ public class BookGroupDTO implements Serializable { ...@@ -325,6 +330,14 @@ public class BookGroupDTO implements Serializable {
this.sceneId = sceneId; this.sceneId = sceneId;
} }
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroupDTO{" + return "BookGroupDTO{" +
...@@ -351,6 +364,7 @@ public class BookGroupDTO implements Serializable { ...@@ -351,6 +364,7 @@ public class BookGroupDTO implements Serializable {
", url='" + url + '\'' + ", url='" + url + '\'' +
", joinGroupType=" + joinGroupType + ", joinGroupType=" + joinGroupType +
", sceneId=" + sceneId + ", sceneId=" + sceneId +
", bookName='" + bookName + '\'' +
'}'; '}';
} }
} }
\ No newline at end of file
...@@ -178,4 +178,13 @@ public interface BookGroupService { ...@@ -178,4 +178,13 @@ public interface BookGroupService {
@ApiOperation("用户扫码书刊名称") @ApiOperation("用户扫码书刊名称")
@PostMapping("mapUserScanBook") @PostMapping("mapUserScanBook")
ResponseEntity<ResponseDto<Map<String, List<String>>>> mapUserScanBook(@RequestParam("altId") String altId, @RequestBody @ApiParam List<String> wxUserIdList); ResponseEntity<ResponseDto<Map<String, List<String>>>> mapUserScanBook(@RequestParam("altId") String altId, @RequestBody @ApiParam List<String> wxUserIdList);
@ApiOperation("获取关联社群书数量和名字")
@GetMapping("getAssocBookGroupByServeInfo")
ResponseEntity<ResponseDto<List<BookGroupDTO>>> getAssocBookGroupByServeInfo(
@RequestParam("adviserId") Long adviserId,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType);
} }
...@@ -666,4 +666,19 @@ public interface BookGroupBiz { ...@@ -666,4 +666,19 @@ public interface BookGroupBiz {
Long changeQrCodeType(ChangeQrCodeTypeDto changeQrCodeTypeDto); Long changeQrCodeType(ChangeQrCodeTypeDto changeQrCodeTypeDto);
Long getChangeQrChangeTarget(Long originId, String originType); Long getChangeQrChangeTarget(Long originId, String originType);
/**
* 获取1v1社群书列表
*/
PageBeanNew<BookGroupDTO> getListBookGroup4Adviser(Map<String, Object>paramMap, PageParam pageParam);
/**
* 获取关联1v1书刊
*/
PageBeanNew<BookGroupDTO> getAssocBookGroupByAppInfo(Map<String, Object>paramMap, PageParam pageParam);
/**
* 获取1v1关联社群书数量和名称
*/
List<BookGroupDTO> getAssocBookGroupByServeInfo(Long adviserId,Long channelId,Long serveId,String serveType);
} }
...@@ -91,6 +91,7 @@ import com.pcloud.book.group.entity.TempletRelevance; ...@@ -91,6 +91,7 @@ import com.pcloud.book.group.entity.TempletRelevance;
import com.pcloud.book.group.entity.WeixinQrcodeGeneration; import com.pcloud.book.group.entity.WeixinQrcodeGeneration;
import com.pcloud.book.group.entity.WxUserWechatRelevance; import com.pcloud.book.group.entity.WxUserWechatRelevance;
import com.pcloud.book.group.enums.ChangeOriginTypeEnum; import com.pcloud.book.group.enums.ChangeOriginTypeEnum;
import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.enums.CipherTypeEnum; import com.pcloud.book.group.enums.CipherTypeEnum;
import com.pcloud.book.group.enums.JoinGroupTypeEnum; import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.group.enums.LargeTempletEnum; import com.pcloud.book.group.enums.LargeTempletEnum;
...@@ -2309,15 +2310,40 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -2309,15 +2310,40 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Override @Override
public void batchAddBookGroupServe(Long partyId, List<BookGroupServe> bookGroupServes) { public void batchAddBookGroupServe(Long partyId, List<BookGroupServe> bookGroupServes) {
checkBookGroupServe(bookGroupServes); checkBookGroupServe(bookGroupServes);
Long bookGroupId=bookGroupServes.get(0).getBookGroupId(); List<Long> bookGroupIds = bookGroupServes.stream().filter(s -> s.getBookGroupId() != null).map(BookGroupServe::getBookGroupId).distinct().collect(Collectors.toList());
BookGroupDTO dto = bookGroupDao.getDTOById(bookGroupId); List<BookGroupServe> bookGroupServeLists = bookGroupServeDao.getListByBookGroupIds(bookGroupIds);
if (dto==null){ //校验之前是否已存在
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误!"); for (BookGroupServe bookGroupServe : bookGroupServes) {
Long bookGroupId = bookGroupServe.getBookGroupId();
Long serveId = bookGroupServe.getServeId();
String ServeType = bookGroupServe.getServeType();
for (BookGroupServe bookGroupServeList : bookGroupServeLists) {
if (bookGroupId.equals(bookGroupServeList.getBookGroupId())
&& serveId.equals(bookGroupServeList.getServeId())
&& ServeType.equals(bookGroupServeList.getServeType())) {
throw new BookBizException(BookBizException.PARAM_IS_EXIST, "该资源已存在!");
}
}
}
List<BookGroupDTO> dtos = bookGroupDao.getDTOByIds(bookGroupIds);
Map<Long, BookGroupDTO> dtoMap = new HashMap<>();
List<Long> channelIds=new ArrayList<>();
for (BookGroupDTO bookGroupDTO : dtos) {
dtoMap.put(bookGroupDTO.getId(), bookGroupDTO);
if (!channelIds.contains(bookGroupDTO.getChannelId())){
channelIds.add(bookGroupDTO.getChannelId());
}
}
Map<Long, AccountSettingDto> accountSettingDtoMap = new HashMap<>();
for (Long channelId : channelIds) {
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId);
accountSettingDtoMap.put(channelId, accountSettingDto);
} }
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(dto.getChannelId());
List<Long> productIds = new ArrayList<>();
for (BookGroupServe bookGroupServe : bookGroupServes) { for (BookGroupServe bookGroupServe : bookGroupServes) {
if ("APP".equalsIgnoreCase(bookGroupServe.getServeType())) { Long bookGroupId = bookGroupServe.getBookGroupId();
BookGroupDTO bookGroupDTO = dtoMap.get(bookGroupId);
AccountSettingDto accountSettingDto = accountSettingDtoMap.get(bookGroupDTO.getChannelId());
if (AppAndProductTypeEnum.APP.value.equalsIgnoreCase(bookGroupServe.getServeType())) {
AppDto appDto = appConsr.getBaseById(bookGroupServe.getServeId()); AppDto appDto = appConsr.getBaseById(bookGroupServe.getServeId());
if (appDto != null) { if (appDto != null) {
accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId()); accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
...@@ -2327,18 +2353,22 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -2327,18 +2353,22 @@ public class BookGroupBizImpl implements BookGroupBiz {
String endUrl = bookGroupServe.getServeUrl() + "&book_group_id=" + bookGroupId; String endUrl = bookGroupServe.getServeUrl() + "&book_group_id=" + bookGroupId;
String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl); String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl);
//转短链 //转短链
String resultUrl=UrlUtils.getShortUrl4Own(linkUrl); String resultUrl = UrlUtils.getShortUrl4Own(linkUrl);
bookGroupServe.setShortUrl(resultUrl); bookGroupServe.setShortUrl(resultUrl);
bookGroupServe.setCreateUser(partyId); bookGroupServe.setCreateUser(partyId);
if ("PRODUCT".equalsIgnoreCase(bookGroupServe.getServeType())) {
productIds.add(bookGroupServe.getServeId());
}
} }
bookGroupServeDao.batchInsert(bookGroupServes); bookGroupServeDao.batchInsert(bookGroupServes);
//将作品应用关键词加到社群书应用
bookGroupAppBiz.addServeToBookGroupApp(bookGroupServes); bookGroupAppBiz.addServeToBookGroupApp(bookGroupServes);
if (!ListUtils.isEmpty(productIds)){ Map<Long, List<BookGroupServe>> listMap = bookGroupServes.stream().filter(s -> AppAndProductTypeEnum.PRODUCT.value.equalsIgnoreCase(s.getServeType())).collect(Collectors.groupingBy(s -> s.getBookGroupId()));
//自动上架 for (Long bookGroupId : bookGroupIds) {
productConsr.productAutoOnShelves(dto.getChannelId(), productIds); List<BookGroupServe> list = listMap.get(bookGroupId);
if (!ListUtils.isEmpty(list)) {
BookGroupDTO dto = dtoMap.get(bookGroupId);
List<Long> productIds = list.stream().filter(s -> s.getServeId() != null).map(BookGroupServe::getServeId).collect(Collectors.toList());
//自动上架
productConsr.productAutoOnShelves(dto.getChannelId(), productIds);
}
} }
} }
...@@ -2446,9 +2476,9 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -2446,9 +2476,9 @@ public class BookGroupBizImpl implements BookGroupBiz {
@Override @Override
public void batchUpdateBookGroupServe(Long partyId, List<BookGroupServe> bookGroupServes) { public void batchUpdateBookGroupServe(Long partyId, List<BookGroupServe> bookGroupServes) {
checkBookGroupServe(bookGroupServes); checkBookGroupServe(bookGroupServes);
Long bookGroupId = bookGroupServes.get(0).getBookGroupId(); List<Long> bookGroupIds = bookGroupServes.stream().filter(s -> s.getBookGroupId() != null).map(BookGroupServe::getBookGroupId).distinct().collect(Collectors.toList());
//删除之前旧的 //删除之前旧的
bookGroupServeDao.deleteByBookGroupId(bookGroupId); bookGroupServeDao.deleteByBookGroupIds(bookGroupIds);
//批量新增新的 //批量新增新的
batchAddBookGroupServe(partyId,bookGroupServes); batchAddBookGroupServe(partyId,bookGroupServes);
} }
...@@ -3841,6 +3871,110 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -3841,6 +3871,110 @@ public class BookGroupBizImpl implements BookGroupBiz {
return newBookGroupId; return newBookGroupId;
} }
@ParamLog("获取社群书信息")
@Override
public PageBeanNew<BookGroupDTO> getListBookGroup4Adviser(Map<String, Object>paramMap, PageParam pageParam) {
PageBeanNew<BookGroupDTO> pageBean = bookGroupDao.listPageNew(pageParam, paramMap, "getListBookGroup4Adviser");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew<>(pageParam.getNumPerPage(), pageParam.getNumPerPage(), 0, new ArrayList<>());
}
// 填充社群书数据
List<BookGroupDTO> bookGroupDTOList=pageBean.getRecordList();
//设置关联状态
//1.获取1v1关联社群书
List<BookGroupDTO> bookGroupAssoList=bookGroupDao.getAssocBookGroupByAppInfo(paramMap);
//2.获取关联bookId和bookGroupId
for (BookGroupDTO bookGroupDTO:bookGroupDTOList){
for(BookGroupDTO bookGroupAsso : bookGroupAssoList){
if (bookGroupDTO.getBookId().equals(bookGroupAsso.getBookId())&&bookGroupDTO.getId().equals(bookGroupAsso.getId())){
bookGroupDTO.setAssocState(true);
break;
}else {
bookGroupDTO.setAssocState(false);
}
}
}
fillBookGroupServe(bookGroupDTOList);
return pageBean;
}
@ParamLog("获取1v1社群书关联信息")
@Override
public PageBeanNew<BookGroupDTO> getAssocBookGroupByAppInfo(Map<String, Object>paramMap, PageParam pageParam) {
if(null == paramMap.get("channelId")||null == paramMap.get("serveId")||null == paramMap.get("serveType")) {
throw new BookBizException(BookBizException.ERROR,"缺少必要参数!");
}
PageBeanNew<BookGroupDTO> pageBean = bookGroupDao.listPageNew(pageParam, paramMap, "getAssocBookGroupByAppInfo");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew<>(pageParam.getNumPerPage(), pageParam.getNumPerPage(), 0, new ArrayList<>());
}
return pageBean;
}
@ParamLog("获取1v1社群书关联名称和数量")
@Override
public List<BookGroupDTO> getAssocBookGroupByServeInfo(Long adviserId,Long channelId,Long serveId,String serveType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
paramMap.put("serveId", serveId);
paramMap.put("serveType", serveType);
paramMap.put("adviserId", adviserId);
if(null == paramMap.get("channelId")||null == paramMap.get("serveId")||null == paramMap.get("serveType")) {
throw new BookBizException(BookBizException.ERROR,"缺少必要参数!");
}
List<BookGroupDTO> bookGroupDtos=bookGroupDao.getAssocBookGroupByAppInfo(paramMap);
return bookGroupDtos;
}
@ParamLog("填充资源配置名称和链接")
private void fillBookGroupServe(List<BookGroupDTO> bookGroupDTOList) {
if (ListUtils.isEmpty(bookGroupDTOList)){
return;
}
List<Long> bookGroupIds= bookGroupDTOList.stream().filter(s -> s.getId() != null).map(BookGroupDTO::getId).collect(Collectors.toList());
if (!ListUtils.isEmpty(bookGroupIds)) {
List<BookGroupServe> bookGroupServeList=bookGroupServeDao.getListByBookGroupIds(bookGroupIds);
List<Long> productIds = new ArrayList<>();
List<Long> appIds = new ArrayList<>();
for (BookGroupServe bookGroupServe : bookGroupServeList) {
if (AppAndProductTypeEnum.PRODUCT.value.equals(bookGroupServe.getServeType())) {
productIds.add(bookGroupServe.getServeId());
}
if (AppAndProductTypeEnum.APP.value.equals(bookGroupServe.getServeType())) {
appIds.add(bookGroupServe.getServeId());
}
}
Map<Long, ProductDto> productDtoMap = new HashMap<>();
Map<Long, AppDto> appDtoMap = new HashMap<>();
if (!ListUtils.isEmpty(productIds)) {
productDtoMap = productConsr.getProBasesByIds(productIds);
}
if (!ListUtils.isEmpty(appIds)) {
appDtoMap = appConsr.mapByIds(appIds);
}
for(BookGroupServe bookGroupServe:bookGroupServeList){
if (AppAndProductTypeEnum.PRODUCT.value.equals(bookGroupServe.getServeType())) {
ProductDto productDto = productDtoMap.get(bookGroupServe.getServeId());
if (productDto != null) {
bookGroupServe.setServeName(productDto.getProductName());
}
}
if (AppAndProductTypeEnum.APP.value.equals(bookGroupServe.getServeType())) {
AppDto appDto = appDtoMap.get(bookGroupServe.getServeId());
if (appDto != null) {
bookGroupServe.setServeName(appDto.getTitle());
}
}
}
Map<Long,List<BookGroupServe>> map=bookGroupServeList.stream().collect(Collectors.groupingBy(BookGroupServe::getBookGroupId));
for(BookGroupDTO bookGroupDto : bookGroupDTOList){
List<BookGroupServe> bookGroupServes = map.get(bookGroupDto.getId());
bookGroupDto.setBookGroupServes(bookGroupServes);
}
}
}
@ParamLog("生成随机码") @ParamLog("生成随机码")
private String createRandomCode(){ private String createRandomCode(){
//生成暗号规则:abcdefg,7位字符串 //生成暗号规则:abcdefg,7位字符串
......
...@@ -279,4 +279,9 @@ public interface BookGroupDao extends BaseDao<BookGroup> { ...@@ -279,4 +279,9 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
void insertQrChangeRecord(QrChangeRecord qrChangeRecord); void insertQrChangeRecord(QrChangeRecord qrChangeRecord);
Long getChangeQrChangeTarget(Long originId, String originType); Long getChangeQrChangeTarget(Long originId, String originType);
/**
* 获取关联社群书
*/
List<BookGroupDTO> getAssocBookGroupByAppInfo(Map<String, Object> paramMap);
} }
...@@ -22,4 +22,8 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> { ...@@ -22,4 +22,8 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
List<BookGroupApp> getAllAppServe(); List<BookGroupApp> getAllAppServe();
Integer getCountByBookGroupId(Long bookGroupId); Integer getCountByBookGroupId(Long bookGroupId);
List<BookGroupServe> getListByBookGroupIds(List<Long> bookGroupIds);
void deleteByBookGroupIds(List<Long> bookGroupIds);
} }
...@@ -318,4 +318,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou ...@@ -318,4 +318,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
paramMap.put("originType", originType); paramMap.put("originType", originType);
return getSessionTemplate().selectOne(getStatement("getChangeQrChangeTarget"), paramMap); return getSessionTemplate().selectOne(getStatement("getChangeQrChangeTarget"), paramMap);
} }
@Override
public List<BookGroupDTO> getAssocBookGroupByAppInfo(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("getAssocBookGroupByAppInfo"), paramMap);
}
} }
...@@ -61,4 +61,16 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement ...@@ -61,4 +61,16 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
map.put("bookGroupId", bookGroupId); map.put("bookGroupId", bookGroupId);
return super.getSqlSession().selectOne(getStatement("getCountByBookGroupId"), map); return super.getSqlSession().selectOne(getStatement("getCountByBookGroupId"), map);
} }
@Override
public List<BookGroupServe> getListByBookGroupIds(List<Long> bookGroupIds) {
return super.getSqlSession().selectList(getStatement("getListByBookGroupIds"), bookGroupIds);
}
@Override
public void deleteByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
super.getSqlSession().delete(getStatement("deleteByBookGroupIds"), map);
}
} }
package com.pcloud.book.group.dto; package com.pcloud.book.group.dto;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.book.dto.BookDto; import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.common.dto.BaseDto; import com.pcloud.common.dto.BaseDto;
/** /**
...@@ -197,6 +200,15 @@ public class BookGroupDTO extends BaseDto { ...@@ -197,6 +200,15 @@ public class BookGroupDTO extends BaseDto {
*/ */
private Boolean isSomeUpdate; private Boolean isSomeUpdate;
/**
* 1V1社群书下的资源
*/
private List<BookGroupServe> bookGroupServes;
/**
* 判断关联状态
*/
private Boolean assocState;
public String getUrl() { public String getUrl() {
return url; return url;
...@@ -504,6 +516,22 @@ public class BookGroupDTO extends BaseDto { ...@@ -504,6 +516,22 @@ public class BookGroupDTO extends BaseDto {
this.isSomeUpdate = isSomeUpdate; this.isSomeUpdate = isSomeUpdate;
} }
public List<BookGroupServe> getBookGroupServes() {
return bookGroupServes;
}
public void setBookGroupServes(List<BookGroupServe> bookGroupServes) {
this.bookGroupServes = bookGroupServes;
}
public Boolean getAssocState() {
return assocState;
}
public void setAssocState(Boolean assocState) {
this.assocState = assocState;
}
@Override @Override
public String toString() { public String toString() {
return "BookGroupDTO{" + return "BookGroupDTO{" +
...@@ -545,6 +573,8 @@ public class BookGroupDTO extends BaseDto { ...@@ -545,6 +573,8 @@ public class BookGroupDTO extends BaseDto {
", publish='" + publish + '\'' + ", publish='" + publish + '\'' +
", lastPushUpdateTime=" + lastPushUpdateTime + ", lastPushUpdateTime=" + lastPushUpdateTime +
", isSomeUpdate=" + isSomeUpdate + ", isSomeUpdate=" + isSomeUpdate +
", bookGroupServes=" + bookGroupServes +
", assocState=" + assocState +
"} " + super.toString(); "} " + super.toString();
} }
} }
\ No newline at end of file
package com.pcloud.book.group.facade; package com.pcloud.book.group.facade;
import com.pcloud.book.group.dto.ChangeQrCodeTypeDto; import com.pcloud.book.group.dto.ChangeQrCodeTypeDto;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO; import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.dto.UserSelectParamDTO; import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
...@@ -600,4 +601,43 @@ public interface BookGroupFacade { ...@@ -600,4 +601,43 @@ public interface BookGroupFacade {
@ApiOperation(value = "查询转换二维码信息", httpMethod = "GET") @ApiOperation(value = "查询转换二维码信息", httpMethod = "GET")
ResponseDto<?> getChangeQrChangeTarget(Long id, String type); ResponseDto<?> getChangeQrChangeTarget(Long id, String type);
@ApiOperation("获取1v1社群书列表")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "currentPage", value = "当前页数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "name", value = "社群码名称、书刊名称、isbn、编号", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "channelId", value = "渠道id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "serveId", value = "作品或应用id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "serveType", value = "类型;APP应用,PRODUCT作品", dataType = "string", paramType = "query")
})
@RequestMapping(value = "getListBookGroup4Adviser", method = RequestMethod.GET)
ResponseDto<PageBeanNew<BookGroupDTO>> getListBookGroup4Adviser(
@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType)
throws BizException, PermissionException;
@ApiOperation("获取关联1v1书刊")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "currentPage", value = "当前页数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "channelId", value = "渠道id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "serveId", value = "作品或应用id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "serveType", value = "类型;APP应用,PRODUCT作品", dataType = "string", paramType = "query")
})
@RequestMapping(value = "getAssocBookGroupByAppInfo", method = RequestMethod.GET)
ResponseDto<PageBeanNew<BookGroupDTO>> getAssocBookGroupByAppInfo(
@RequestHeader("token") String token,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage)
throws BizException, PermissionException;
} }
...@@ -4,12 +4,14 @@ import com.pcloud.book.base.exception.BookBizException; ...@@ -4,12 +4,14 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz; import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.dto.ChangeQrCodeTypeDto; import com.pcloud.book.group.dto.ChangeQrCodeTypeDto;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.GroupStoreMyPayDto; import com.pcloud.book.group.dto.GroupStoreMyPayDto;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO; import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.dto.UserSelectParamDTO; import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup; import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify; import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookGroupServe; import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.group.facade.BookGroupFacade; import com.pcloud.book.group.facade.BookGroupFacade;
import com.pcloud.book.group.vo.BookGroupAnalysisParam; import com.pcloud.book.group.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO; import com.pcloud.book.group.vo.BookGroupAnalysisVO;
...@@ -946,4 +948,51 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -946,4 +948,51 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
Long newBookGroupId = bookGroupBiz.getChangeQrChangeTarget(id, type); Long newBookGroupId = bookGroupBiz.getChangeQrChangeTarget(id, type);
return new ResponseDto<>(newBookGroupId); return new ResponseDto<>(newBookGroupId);
} }
@ApiOperation("获取1v1社群书列表")
@Override
@RequestMapping(value = "getListBookGroup4Adviser", method = RequestMethod.GET)
public ResponseDto<PageBeanNew<BookGroupDTO>> getListBookGroup4Adviser(
@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType)
throws BizException, PermissionException {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage <= 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("name", name != null && "".equals(name.trim()) ? null : name);
paramMap.put("joinGroupType", JoinGroupTypeEnum.ROBOT.getCode());
paramMap.put("channelId", channelId);
paramMap.put("serveId", serveId);
paramMap.put("serveType", serveType);
PageBeanNew<BookGroupDTO> pageBean = bookGroupBiz.getListBookGroup4Adviser(paramMap, new PageParam(currentPage, numPerPage));
return new ResponseDto<>(null == pageBean ? new PageBeanNew<>() : pageBean);
}
@ApiOperation("获取1v1关联社群书列表")
@RequestMapping(value = "getAssocBookGroupByAppInfo", method = RequestMethod.GET)
public ResponseDto<PageBeanNew<BookGroupDTO>> getAssocBookGroupByAppInfo(
@RequestHeader("token") String token,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage)
throws BizException, PermissionException{
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("channelId", channelId);
paramMap.put("serveId", serveId);
paramMap.put("serveType", serveType);
paramMap.put("adviserId", adviserId);
PageBeanNew<BookGroupDTO> pageBean = bookGroupBiz.getAssocBookGroupByAppInfo(paramMap, new PageParam(currentPage, numPerPage));
return new ResponseDto<>(null == pageBean ? new PageBeanNew<>() : pageBean);
}
} }
...@@ -312,4 +312,16 @@ public class BookGroupServiceImpl implements BookGroupService { ...@@ -312,4 +312,16 @@ public class BookGroupServiceImpl implements BookGroupService {
Map<String, List<String>> map = bookGroupBiz.mapUserScanBook(altId, wxUserIdList); Map<String, List<String>> map = bookGroupBiz.mapUserScanBook(altId, wxUserIdList);
return ResponseHandleUtil.toResponse(map); return ResponseHandleUtil.toResponse(map);
} }
@GetMapping("getAssocBookGroupByServeInfo")
@ApiOperation("获取关联社群书数量和名字")
@Override
public ResponseEntity<ResponseDto<List<BookGroupDTO>>> getAssocBookGroupByServeInfo(
@RequestParam("adviserId") Long adviserId,
@RequestParam("channelId") Long channelId,
@RequestParam("serveId") Long serveId,
@RequestParam("serveType") String serveType) {
List<BookGroupDTO> bookGroupDTOList =bookGroupBiz.getAssocBookGroupByServeInfo(adviserId,channelId,serveId,serveType);
return ResponseHandleUtil.toResponse(bookGroupDTOList);
}
} }
...@@ -819,4 +819,66 @@ ...@@ -819,4 +819,66 @@
</if> </if>
limit 1 limit 1
</select> </select>
<!-- 获取社群书列表(编辑) -->
<select id="getListBookGroup4Adviser" resultType="com.pcloud.book.group.dto.BookGroupDTO" parameterType="map">
SELECT
B.ISBN isbn,
B.BOOK_NAME bookName,
CONCAT('BK', G.BOOK_ID) bookNumber,
G.ID id,
G.group_qrcode_url groupQrcodeUrl,
G.group_qrcode_name groupQrcodeName,
G.scene_id sceneId,
G.book_id bookId
FROM book_group G
INNER JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID
AND G.CHANNEL_ID = A.CHANNEL_ID
AND G.CREATE_USER = A.ADVISER_ID
AND G.IS_DELETE = 0
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID
AND B.IS_DELETE = 0
WHERE
A.ADVISER_ID = #{adviserId}
AND A.IS_DELETE = 0
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR G.group_qrcode_name LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%') OR CONCAT('BK',A.BOOK_ID) = #{name})
</if>
<if test="joinGroupType !=null">
AND G.join_group_type=#{joinGroupType}
</if>
GROUP BY
G.ID
ORDER BY
G.UPDATE_TIME DESC
</select>
<!-- 获取关联社群书 -->
<select id="getAssocBookGroupByAppInfo" resultType="com.pcloud.book.group.dto.BookGroupDTO" parameterType="map">
SELECT
G.GROUP_QRCODE_URL groupQrcodeUrl,
G.GROUP_QRCODE_NAME groupQrcodeName,
B.BOOK_NAME bookName,
B.COVER_IMG bookImg,
G.UPDATE_TIME updateTime,
G.Id id,
G.BOOK_ID bookId
FROM
BOOK_GROUP G
INNER JOIN BOOK_GROUP_SERVE S ON S.BOOK_GROUP_ID = G.ID
INNER JOIN BOOK B ON B.BOOK_ID = G.BOOK_ID
INNER JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID
AND G.CHANNEL_ID = A.CHANNEL_ID
AND G.CREATE_USER = A.ADVISER_ID
AND G.IS_DELETE = 0
WHERE
S.SERVE_ID = #{serveId}
AND S.SERVE_TYPE = #{serveType}
AND G.CREATE_USER = #{adviserId}
GROUP BY
g.id
ORDER BY
G.UPDATE_TIME DESC
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -127,4 +127,26 @@ ...@@ -127,4 +127,26 @@
from book_group_serve from book_group_serve
where book_group_id=#{bookGroupId} where book_group_id=#{bookGroupId}
</select> </select>
<!--根据社群书id获取资源链接和名称-->
<select id="getListByBookGroupIds" parameterType="list" resultType="com.pcloud.book.group.entity.BookGroupServe">
select t.serve_id serveId,
t.book_group_id bookGroupId,
t.serve_type serveType,
t.serve_url serveUrl
from book_group_serve t
where book_group_id in
<foreach collection="list" open="(" close=")" item="item" separator=",">
${item}
</foreach>
</select>
<!--根据社群码id集合删除-->
<delete id="deleteByBookGroupIds" parameterType="map" >
delete from book_group_serve
where book_group_id in
<foreach collection="bookGroupIds" open="(" close=")" item="item" separator=",">
${item}
</foreach>
</delete>
</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