Commit ea41aea7 by gaopeng

社群书

parent d3f9d6ee
......@@ -440,6 +440,50 @@ public class BookDto extends BaseDto {
* 唯一编号
*/
private String uniqueNumber;
/**
* 社群码数据
*/
/**
* 社群码ID
*/
private Long bookGroupId;
/**
* 社群码图片
*/
private String groupQrcodeUrl;
/**
* 社群码名称
*/
private String groupQrcodeName;
/**
* 群分类数量
*/
private Long classifyCount;
/**
* 群总人数
*/
private Long groupPersonCount;
/**
* 群数量
*/
private Long groupCount;
/**
* 累计收益
*/
private BigDecimal totalIncome;
/**
* 社群码链接
*/
private String groupQrcodeLink;
public String getQrRemark() {
return qrRemark;
}
......@@ -1116,6 +1160,30 @@ public class BookDto extends BaseDto {
this.officialAccountsName = officialAccountsName;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getGroupQrcodeUrl() {
return groupQrcodeUrl;
}
public void setGroupQrcodeUrl(String groupQrcodeUrl) {
this.groupQrcodeUrl = groupQrcodeUrl;
}
public String getGroupQrcodeName() {
return groupQrcodeName;
}
public void setGroupQrcodeName(String groupQrcodeName) {
this.groupQrcodeName = groupQrcodeName;
}
public String getUniqueNumber() {
return uniqueNumber;
}
......@@ -1123,6 +1191,47 @@ public class BookDto extends BaseDto {
public void setUniqueNumber(String uniqueNumber) {
this.uniqueNumber = uniqueNumber;
}
public Long getClassifyCount() {
return classifyCount;
}
public void setClassifyCount(Long classifyCount) {
this.classifyCount = classifyCount;
}
public Long getGroupPersonCount() {
return groupPersonCount;
}
public void setGroupPersonCount(Long groupPersonCount) {
this.groupPersonCount = groupPersonCount;
}
public Long getGroupCount() {
return groupCount;
}
public void setGroupCount(Long groupCount) {
this.groupCount = groupCount;
}
public BigDecimal getTotalIncome() {
return totalIncome;
}
public void setTotalIncome(BigDecimal totalIncome) {
this.totalIncome = totalIncome;
}
public String getGroupQrcodeLink() {
return groupQrcodeLink;
}
public void setGroupQrcodeLink(String groupQrcodeLink) {
this.groupQrcodeLink = groupQrcodeLink;
}
@Override
public String toString() {
return "BookDto{" +
......@@ -1210,7 +1319,14 @@ public class BookDto extends BaseDto {
", exposureNum=" + exposureNum +
", clickNum=" + clickNum +
", officialAccountsName='" + officialAccountsName + '\'' +
", bookGroupId=" + bookGroupId +
", groupQrcodeUrl='" + groupQrcodeUrl + '\'' +
", groupQrcodeName='" + groupQrcodeName + '\'' +
", uniqueNumber='" + uniqueNumber + '\'' +
", classifyCount=" + classifyCount +
", groupPersonCount=" + groupPersonCount +
", groupCount=" + groupCount +
", totalIncome=" + totalIncome +
'}';
}
}
......@@ -182,6 +182,11 @@ public class Book extends BaseEntity {
*/
private Integer isDelete;
/**
* 是否社群书
*/
private Boolean isBookGroup;
public String getTypeCode() {
return typeCode;
}
......@@ -447,6 +452,14 @@ public class Book extends BaseEntity {
this.isDelete = isDelete;
}
public Boolean getIsBookGroup() {
return isBookGroup;
}
public void setIsBookGroup(Boolean isBookGroup) {
this.isBookGroup = isBookGroup;
}
@Override
public String toString() {
return "Book [bookId=" + bookId + ", typeCode=" + typeCode + ", isbn=" + isbn + ", bookName=" + bookName
......@@ -457,7 +470,8 @@ public class Book extends BaseEntity {
+ mailCode + ", address=" + address + ", telephone=" + telephone + ", mail=" + mail + ", purpose="
+ purpose + ", createdUser=" + createdUser + ", lastModifiedUser=" + lastModifiedUser + ", channelId="
+ channelId + ", issn=" + issn + ", serialNumber=" + serialNumber + ", adImg=" + adImg + ", templetId="
+ templetId + ", agentId=" + agentId + ", sceneId=" + sceneId + ", isDelete=" + isDelete + "]";
+ templetId + ", agentId=" + agentId + ", sceneId=" + sceneId + ", isDelete=" + isDelete + ", isBookGroup="
+ isBookGroup + "]";
}
}
......@@ -9,6 +9,7 @@ import java.util.Map;
import com.pcloud.book.appeal.dao.BookAppealResultDao;
import com.pcloud.book.appeal.entity.BookAppealResult;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.common.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -102,6 +103,9 @@ public class BookAppealBizImpl implements BookAppealBiz {
@Autowired
private ChannelConsr channelConsr;
@Autowired
private BookGroupBiz bookGroupBiz;
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(5);
/**
* 书刊申诉
......@@ -349,6 +353,8 @@ public class BookAppealBizImpl implements BookAppealBiz {
bookcaseConsr.deleteBookForAdviser(bookId, channelId, adviserBook.getAdviserId());
//删除与二维码关联关系
qrcodeSceneConsr.deleteBook(bookId, adviserBook.getChannelId(), adviserBook.getAdviserId());
// 删除社群码
bookGroupBiz.deleteByBookId(bookId, adviserBook.getChannelId(), adviserBook.getAdviserId());
}
);
});
......
......@@ -17,6 +17,7 @@ import com.pcloud.book.consumer.settlement.BookConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.BookcaseConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SceneCode;
import com.pcloud.common.core.constant.SendType;
......@@ -85,6 +86,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
@Autowired
private ChannelConsr channelConsr;
@Autowired
private BookGroupBiz bookGroupBiz;
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(5);
/**
......@@ -666,6 +670,11 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
paramMap.put("status", deleteStatus);
paramMap.put("templetId", templetId);
bookAdviserDao.updateBook4Adviser(paramMap);
if (BookConstant.BOOK_ADVISER_DELETE.equals(deleteStatus)) {
bookGroupBiz.deleteByBookId(bookId, channelId, adviserId);
} else {
bookGroupBiz.recoverByBookId(bookId, channelId, adviserId);
}
LOGGER.info("修改书籍编辑的状态(删除或者恢复) <END>");
}
......
......@@ -3,23 +3,25 @@
*/
package com.pcloud.book.consumer.resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.resourcecenter.product.dto.Product4BookDTO;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Product;
import com.pcloud.resourcecenter.product.service.ProductService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @描述:商品中间件
* @作者:songx
......@@ -129,4 +131,16 @@ public class ProductConsr {
return productDtoMap;
}
public Product postUpdateBookGroupProduct(UpdateAppProductParamDTO updateAppProductParamDTO) {
try {
Product product = ResponseHandleUtil.parseResponse(productService.postUpdateBookGroupProduct(updateAppProductParamDTO), Product.class);
return product;
} catch (BizException e) {
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "设置商品失败!");
}
}
}
......@@ -4,6 +4,8 @@ import java.util.Map;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam;
/**
* Description 社群书群二维码业务逻辑层接口
......@@ -70,4 +72,38 @@ public interface BookGroupBiz {
* @throws BizException
*/
Map<String, Object> getBookNameByBookGroupId(Long bookGroupId) throws BizException;
/**
* 获取社群书列表(编辑)
* @param paramMap 参数Map
* @param pageParam 分页参数
* @param adviserId 编辑ID
* @return
* @throws BizException
*/
PageBean listBookGroup4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException;
/**
* 获取未创建社群码的书刊列表
* @param paramMap 参数Map
* @param pageParam 分页参数
* @param adviserId 编辑ID
* @return
* @throws BizException
*/
PageBean listBook4CreateBookGroup(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException;
/**
* @Author:lili
* @Desr:获取排序方式
* @Date:2019/4/19 14:57
*/
Integer getRankType(Long bookGroupId) throws BizException;
/**
* @Author:lili
* @Desr:更新排序方式
* @Date:2019/4/19 14:58
*/
void updateRankType(Long bookGroupId, Integer rankType) throws BizException;
}
package com.pcloud.book.group.biz.impl;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -11,7 +12,9 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dao.BookGroupDao;
......@@ -20,6 +23,8 @@ import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.ProductTypeConstant;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.QrcodeUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
......@@ -52,6 +57,10 @@ public class BookGroupBizImpl implements BookGroupBiz {
private AdviserConsr adviserConsr;
@Autowired
private BookBiz bookBiz;
@Autowired
private BookSet bookSet;
@Autowired
private BookDao bookDao;
/**
* 创建社群书时生成群二维码
......@@ -93,7 +102,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (null != bookGroupDTO.getPurLabelId()) {
labelIds.add(bookGroupDTO.getPurLabelId());
}
if (ListUtils.isEmpty(labelIds)) {
if (!ListUtils.isEmpty(labelIds)) {
Map<Long, String> labelMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
if (!MapUtils.isEmpty(labelMap)) {
if (null != bookGroupDTO.getProLabelId() && labelMap.containsKey(bookGroupDTO.getProLabelId())) {
......@@ -168,7 +177,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
if (null == group) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码不存在!");
}
/*if (null == group.getProductId()) {
if (null == group.getProductId()) {
AddAppProductParamDTO addAppProductParamDTO = new AddAppProductParamDTO();
addAppProductParamDTO.setAppProCode(ProductTypeConstant.BOOK_GROUP);
addAppProductParamDTO.setAppProName(bookGroup.getGroupQrcodeName());
......@@ -189,7 +198,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
updateAppProductParamDTO.setAppProName(bookGroup.getGroupQrcodeName());
ResponseHandleUtil.parseResponse(productService.postUpdateBookGroupProduct(updateAppProductParamDTO), Product.class);
}
bookGroupDao.update(bookGroup);*/
bookGroupDao.update(bookGroup);
}
/**
......@@ -227,4 +236,52 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
return result;
}
/**
* 获取社群书列表(编辑)
*/
@Override
public PageBean listBookGroup4Adviser(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException {
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listBookGroup4Adviser");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
// 设置是否被冻结
bookSet.setFreezeStatus(pageBean.getRecordList());
// 填充社群书数据
for (Object object : pageBean.getRecordList()) {
BookDto bookDto = (BookDto) object;
bookDto.setGroupQrcodeLink(bookGroupQrcodeDomain + "/" + bookDto.getBookGroupId());
bookDto.setScanCount(0L);
bookDto.setClassifyCount(0L);
bookDto.setGroupPersonCount(0L);
bookDto.setGroupCount(0L);
bookDto.setTotalIncome(BigDecimal.ZERO);
}
return pageBean;
}
/**
* 获取未创建社群码的书刊列表
*/
@Override
public PageBean listBook4CreateBookGroup(Map<String, Object> paramMap, PageParam pageParam, Long adviserId) throws BizException {
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listBook4CreateBookGroup");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
return pageBean;
}
@Override
@ParamLog("获取排序类型")
public Integer getRankType(Long bookGroupId) throws BizException {
return bookGroupDao.getRankType(bookGroupId);
}
@Override
@ParamLog("更新排序类型")
public void updateRankType(Long bookGroupId, Integer rankType) throws BizException {
bookGroupDao.updateRankType(bookGroupId, rankType);
}
}
......@@ -43,4 +43,18 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* @return
*/
long recoverByBookId(Long bookId, Long channelId, Long adviserId);
/**
* @Author:lili
* @Desr:获取排序类型
* @Date:2019/4/19 15:01
*/
Integer getRankType(Long bookGroupId);
/**
* @Author:lili
* @Desr:更新排序类型
* @Date:2019/4/19 15:01
*/
void updateRankType(Long bookGroupId, Integer rankType);
}
......@@ -58,4 +58,17 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
paramMap.put("adviserId", adviserId);
return super.getSqlSession().update(getStatement("recoverByBookId"), paramMap);
}
@Override
public Integer getRankType(Long bookGroupId) {
return super.getSqlSession().selectOne(getStatement("getRankType"), bookGroupId);
}
@Override
public void updateRankType(Long bookGroupId, Integer rankType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupId", bookGroupId);
paramMap.put("rankType", rankType);
super.getSqlSession().update(getStatement("updateRankType"), paramMap);
}
}
......@@ -2,14 +2,18 @@ package com.pcloud.book.group.facade;
import org.codehaus.jackson.JsonParseException;
import org.springframework.cloud.netflix.feign.FeignClient;
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.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -24,15 +28,6 @@ import io.swagger.annotations.ApiOperation;
@Api(description = "社群书群二维码接口")
public interface BookGroupFacade {
/**
* 获取社群书群二维码信息
* @param token 用户身份信息
* @param bookGroupId 群二维码ID
* @return
* @throws BizException
* @throws PermissionException
* @throws JsonParseException
*/
@ApiOperation(value = "获取社群书群二维码信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", dataType = "string", paramType = "header"),
......@@ -42,16 +37,6 @@ public interface BookGroupFacade {
ResponseDto<?> getBookGroupInfo(@RequestHeader("token") String token, @RequestParam(value = "bookGroupId", required = false) Long bookGroupId)
throws BizException, PermissionException, JsonParseException;
/**
* 获取社群书群二维码信息
* @param token 用户身份信息
* @param bookId 书刊ID
* @param channelId 运营ID
* @return
* @throws BizException
* @throws PermissionException
* @throws JsonParseException
*/
@ApiOperation(value = "获取社群书群二维码信息", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", dataType = "string", paramType = "header"),
......@@ -62,15 +47,6 @@ public interface BookGroupFacade {
ResponseDto<?> getBookGroupInfoByBookId(@RequestHeader("token") String token, @RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "channelId", required = false) Long channelId) throws BizException, PermissionException, JsonParseException;
/**
* 更新群二维码信息
* @param token 用户身份信息
* @param bookGroup 群二维码实体
* @return
* @throws BizException
* @throws PermissionException
* @throws JsonParseException
*/
@ApiOperation(value = "更新群二维码信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "用户身份信息", dataType = "string", paramType = "header"),
......@@ -80,14 +56,6 @@ public interface BookGroupFacade {
ResponseDto<?> updateBookGroup(@RequestHeader("token") String token, @RequestBody BookGroup bookGroup)
throws BizException, PermissionException, JsonParseException;
/**
* 根据社群码ID获取书名
* @param bookGroupId 社群码ID
* @return
* @throws BizException
* @throws PermissionException
* @throws JsonParseException
*/
@ApiOperation(value = "根据社群码ID获取书名", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "bookGroupId", value = "社群码ID", dataType = "long", paramType = "query")
......@@ -95,4 +63,45 @@ public interface BookGroupFacade {
@RequestMapping(value = "getBookNameByBookGroupId", method = RequestMethod.GET)
ResponseDto<?> getBookNameByBookGroupId(@RequestParam(value = "bookGroupId", required = false) Long bookGroupId)
throws BizException, PermissionException, JsonParseException;
@ApiOperation(value = "获取社群书列表(编辑)", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "bookName", value = "书籍名称", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "isbn", value = "isbn", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "channelId", value = "渠道标识", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "typeCode", value = "书刊类型", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "isMainEditor", value = "只看我是主编辑", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "isFundSupport", value = "只看基金支持", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "bookId", value = "书籍标识", dataType = "int", paramType = "query")
})
@RequestMapping(value = "listBookGroup4Adviser", method = RequestMethod.GET)
ResponseDto<PageBean> listBookGroup4Adviser(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "bookName", required = false) String bookName,
@RequestParam(value = "isbn", required = false) String isbn,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage,
@RequestParam(value = "isMainEditor", required = false) Integer isMainEditor,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "bookId", required = false) Integer bookId)
throws BizException, PermissionException;
@ApiOperation(value = "获取未创建社群码的书刊列表", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "name", value = "搜索字段", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "listBook4CreateBookGroup", method = RequestMethod.GET)
ResponseDto<?> listBook4CreateBookGroup(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
}
package com.pcloud.book.group.facade.impl;
import java.util.HashMap;
import java.util.Map;
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;
......@@ -14,6 +18,8 @@ import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.facade.BookGroupFacade;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
......@@ -82,4 +88,60 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
}
return new ResponseDto<>(bookGroupBiz.getBookNameByBookGroupId(bookGroupId));
}
/**
* 获取社群书列表(编辑)
*/
@Override
@RequestMapping(value = "listBookGroup4Adviser", method = RequestMethod.GET)
public ResponseDto<PageBean> listBookGroup4Adviser(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "bookName", required = false) String bookName,
@RequestParam(value = "isbn", required = false) String isbn,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "typeCode", required = false) String typeCode,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage,
@RequestParam(value = "isMainEditor", required = false) Integer isMainEditor,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "bookId", required = false) Integer bookId)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("isMainEditor", isMainEditor);
paramMap.put("isFundSupport", isFundSupport);
paramMap.put("channelId", channelId);
paramMap.put("name", name != null && "".equals(name.trim()) ? null : name);
paramMap.put("isbn", isbn != null && "".equals(isbn.trim()) ? null : isbn);
paramMap.put("bookName", bookName != null && "".equals(bookName.trim()) ? null : bookName);
paramMap.put("typeCode", typeCode != null && "".equals(typeCode.trim()) ? null : typeCode);
paramMap.put("bookId", bookId);
PageBean pageBean = bookGroupBiz.listBookGroup4Adviser(paramMap, new PageParam(currentPage, numPerPage), adviserId);
return new ResponseDto<>(pageBean);
}
/**
* 获取未创建社群码的书刊列表
*/
@Override
@RequestMapping(value = "listBook4CreateBookGroup", method = RequestMethod.GET)
public ResponseDto<?> listBook4CreateBookGroup(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("name", name != null && "".equals(name.trim()) ? null : name);
PageBean pageBean = bookGroupBiz.listBook4CreateBookGroup(paramMap, new PageParam(currentPage, numPerPage), adviserId);
return new ResponseDto<>(pageBean);
}
}
......@@ -511,6 +511,80 @@
</if>
</select>
<!-- 获取未创建社群码的书刊列表 -->
<select id="listBook4CreateBookGroup" resultMap="bookMap" parameterType="map">
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, B.ISBN, B.BOOK_NAME,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
LEFT JOIN book_group G on G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID
WHERE
A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0 AND G.ID IS NULL
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%') OR CONCAT('BK',A.BOOK_ID) = #{name})
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
A.LAST_MODIFIED_DATE DESC
</select>
<!-- 获取社群书列表(编辑) -->
<select id="listBookGroup4Adviser" resultMap="bookMap" parameterType="map">
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, T.TYPE_CODE, T.TYPE_NAME, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT, A.TEMPLET_ID, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber,
G.update_time LAST_MODIFIED_DATE, G.create_time CREATED_DATE, G.id bookGroupId, G.group_qrcode_url groupQrcodeUrl,
G.group_qrcode_name groupQrcodeName
FROM
BOOK_ADVISER A
INNER JOIN book_group G on G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
WHERE
A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0
<if test="bookId != null">
AND
A.BOOK_ID = #{bookId}
</if>
<if test="typeCode != null">
AND
B.TYPE_CODE = #{typeCode}
</if>
<if test="channelId != null">
AND
A.CHANNEL_ID = #{channelId}
</if>
<if test="bookName != null">
AND
B.BOOK_NAME LIKE CONCAT('%', #{bookName}, '%')
</if>
<if test="isbn != null">
AND
B.ISBN LIKE CONCAT(#{isbn},'%')
</if>
<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="isMainEditor != null">
AND
A.IS_MAIN_EDITOR = 1
</if>
<if test="isFundSupport != null">
AND
BF.BOOK_FUND_ID IS NOT NULL
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
G.UPDATE_TIME DESC
</select>
<!-- 获取书籍列表(编辑) -->
<select id="listBook4Adviser" resultMap="bookMap" parameterType="map">
SELECT
......
......@@ -167,4 +167,19 @@
where id = #{id,jdbcType=BIGINT}
</update>
<select id="getRankType" resultType="Integer" parameterType="java.lang.Long">
select
rank_type
from book_group
where id = #{_parameter,jdbcType=BIGINT}
</select>
<update id="updateRankType" parameterType="map">
update book_group
<set>
rank_type = #{rankType},
update_time = NOW()
</set>
where id = #{bookGroupId,jdbcType=BIGINT}
</update>
</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