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 {
*/
private Long sceneId;
/**
* 社群书名称
*/
private String bookName;
public String getUrl() {
return url;
}
......@@ -325,6 +330,14 @@ public class BookGroupDTO implements Serializable {
this.sceneId = sceneId;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
@Override
public String toString() {
return "BookGroupDTO{" +
......@@ -351,6 +364,7 @@ public class BookGroupDTO implements Serializable {
", url='" + url + '\'' +
", joinGroupType=" + joinGroupType +
", sceneId=" + sceneId +
", bookName='" + bookName + '\'' +
'}';
}
}
\ No newline at end of file
......@@ -178,4 +178,13 @@ public interface BookGroupService {
@ApiOperation("用户扫码书刊名称")
@PostMapping("mapUserScanBook")
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 {
Long changeQrCodeType(ChangeQrCodeTypeDto changeQrCodeTypeDto);
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);
}
......@@ -279,4 +279,9 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
void insertQrChangeRecord(QrChangeRecord qrChangeRecord);
Long getChangeQrChangeTarget(Long originId, String originType);
/**
* 获取关联社群书
*/
List<BookGroupDTO> getAssocBookGroupByAppInfo(Map<String, Object> paramMap);
}
......@@ -22,4 +22,8 @@ public interface BookGroupServeDao extends BaseDao<BookGroupServe> {
List<BookGroupApp> getAllAppServe();
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
paramMap.put("originType", originType);
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
map.put("bookGroupId", bookGroupId);
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;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.common.dto.BaseDto;
/**
......@@ -197,6 +200,15 @@ public class BookGroupDTO extends BaseDto {
*/
private Boolean isSomeUpdate;
/**
* 1V1社群书下的资源
*/
private List<BookGroupServe> bookGroupServes;
/**
* 判断关联状态
*/
private Boolean assocState;
public String getUrl() {
return url;
......@@ -504,6 +516,22 @@ public class BookGroupDTO extends BaseDto {
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
public String toString() {
return "BookGroupDTO{" +
......@@ -545,6 +573,8 @@ public class BookGroupDTO extends BaseDto {
", publish='" + publish + '\'' +
", lastPushUpdateTime=" + lastPushUpdateTime +
", isSomeUpdate=" + isSomeUpdate +
", bookGroupServes=" + bookGroupServes +
", assocState=" + assocState +
"} " + super.toString();
}
}
\ No newline at end of file
package com.pcloud.book.group.facade;
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.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup;
......@@ -600,4 +601,43 @@ public interface BookGroupFacade {
@ApiOperation(value = "查询转换二维码信息", httpMethod = "GET")
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;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
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.SelfBookGroupStParamDTO;
import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
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.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
......@@ -946,4 +948,51 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
Long newBookGroupId = bookGroupBiz.getChangeQrChangeTarget(id, type);
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 {
Map<String, List<String>> map = bookGroupBiz.mapUserScanBook(altId, wxUserIdList);
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 @@
</if>
limit 1
</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>
\ No newline at end of file
......@@ -127,4 +127,26 @@
from book_group_serve
where book_group_id=#{bookGroupId}
</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>
\ 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