Commit 39e1c260 by 高鹏

Merge branch 'master' into 'feat-zdw'

# Conflicts:
#   pcloud-service-book/src/main/java/com/pcloud/book/clock/biz/impl/BookClockBizImpl.java
#   pcloud-service-book/src/main/resources/mapper/clock/BookClockInfo.Mapper.xml
parents e472ddb2 d9e3e2ed
......@@ -244,4 +244,11 @@ public interface BookService {
@RequestMapping(value = "/getBaseAndAuthStatus", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookInfoAndAuthStatusDTO>> getBaseAndAuthStatus(@RequestParam(value = "bookId") Long bookId, @RequestParam(value = "channelId") Long channelId,@RequestParam(value = "adviserId") Long adviserId)
throws BizException;
@ApiOperation("根据书名或isbn编号查询书")
@RequestMapping(value = "/getIdsByNameOrISBN", method = RequestMethod.GET)
ResponseEntity<ResponseDto<List<Long>>> getIdsByNameOrISBN(
@RequestParam(value = "keyword") String keyword,
@RequestParam(value = "adviserId") Long adviserId
) throws BizException;
}
package com.pcloud.book.copyright.dto;
import com.pcloud.common.dto.BaseDto;
import java.util.Date;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lihao
* @date 2019/9/3 17:02
*/
@ApiModel
public class CheckUserAuthDTO extends BaseDto {
private static final long serialVersionUID = -2646713544720373882L;
@ApiModelProperty("图书标识")
private Long bookId;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("微信用户列表")
private List<Long> wechatUserIds;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
public List<Long> getWechatUserIds() {
return wechatUserIds;
}
public void setWechatUserIds(List<Long> wechatUserIds) {
this.wechatUserIds = wechatUserIds;
}
@Override
public String toString() {
return "CheckUserAuthDTO{" +
"bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", wechatUserIds=" + wechatUserIds +
'}';
}
}
......@@ -2,6 +2,7 @@ package com.pcloud.book.copyright.service;
import com.pcloud.book.copyright.dto.BookAuthInfoCountDTO;
import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import io.swagger.annotations.Api;
......@@ -26,13 +27,13 @@ public interface BookAuthInfoService {
@ApiOperation(value = "获取图书授权金价格", httpMethod = "GET")
@RequestMapping(value = "/getBookAuthPrice", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BigDecimal>> getBookAuthPrice(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId)
throws BizException;
ResponseEntity<ResponseDto<BigDecimal>> getBookAuthPrice(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId) throws BizException;
@ApiOperation(value = "获取图书授权统计信息", httpMethod = "GET")
@RequestMapping(value = "/getBookAuthInfoCount", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId, @RequestParam("monthDate") String monthDate)
throws BizException;
ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId, @RequestParam("monthDate") String monthDate) throws BizException;
@ApiOperation(value = "获取图书授权总统计信息", httpMethod = "GET")
@RequestMapping(value = "/getBookAuthTotalCount", method = RequestMethod.GET)
......@@ -41,4 +42,15 @@ public interface BookAuthInfoService {
@ApiOperation(value = "根据获取图书授权总统计信息", httpMethod = "POST")
@RequestMapping(value = "/getBookAuthTotalCount4Adviser", method = RequestMethod.POST)
ResponseEntity<ResponseDto<BookAuthTotalCountDTO>> getBookAuthTotalCount4Adviser(@RequestBody List<Long> adviserIds) throws BizException;
@ApiOperation(value = "校验用户是否授权过(进群)", httpMethod = "POST")
@RequestMapping(value = "/checkUserIsHaveAuth", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Boolean>> checkUserIsHaveAuth(@RequestBody CheckUserAuthDTO checkUserAuthDTO) throws BizException;
@ApiOperation(value = "获取社群书授权金价格", httpMethod = "GET")
@RequestMapping(value = "/getGroupBookAuthPrice", method = RequestMethod.GET)
ResponseEntity<ResponseDto<BigDecimal>> getGroupBookAuthPrice(@RequestParam("bookId") Long bookId, @RequestParam("channelId")Long channelId,
@RequestParam("adviserId")Long adviserId) throws BizException;
}
......@@ -21,14 +21,8 @@ import com.pcloud.book.advertising.dao.AdvertisingPlanGroupDao;
import com.pcloud.book.advertising.dao.AdvertisingPutDao;
import com.pcloud.book.advertising.dao.AdvertisingSettlementMethodDao;
import com.pcloud.book.advertising.dao.AdvertisingSpaceDao;
import com.pcloud.book.advertising.dto.AdvertisingDistributionDTO;
import com.pcloud.book.advertising.dto.AdvertisingMasterDTO;
import com.pcloud.book.advertising.dto.AdvertisingSettlementMethodDTO;
import com.pcloud.book.advertising.dto.AdvertisingSpaceDTO;
import com.pcloud.book.advertising.dto.QrcodeAdvertisingSpaceCountDTO;
import com.pcloud.book.advertising.dto.WechatGroupClickUserDTO;
import com.pcloud.book.advertising.dto.WeixinClassifyInfoDTO;
import com.pcloud.book.advertising.dto.*;
import com.pcloud.book.advertising.entity.AdvertisingAdviserPermission;
import com.pcloud.book.advertising.entity.AdvertisingAgentPermission;
import com.pcloud.book.advertising.entity.AdvertisingBrowseRecord;
......@@ -930,6 +924,24 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
advertisingAdviserPermissionDao.update(adviserPermission);
}
} else {
if (!ListUtils.isEmpty(adviserPermission.getBookAndChannelDTOS())) {
//一个一个更新
for (BookAndChannelDTO bookAndChannelDTO : adviserPermission.getBookAndChannelDTOS()) {
if (bookAndChannelDTO != null && bookAndChannelDTO.getBookId() != null && bookAndChannelDTO.getChannelId() != null) {
paramMap.put("bookId", bookAndChannelDTO.getBookId());
paramMap.put("channelId", bookAndChannelDTO.getChannelId());
AdvertisingAdviserPermission permission = (AdvertisingAdviserPermission) advertisingAdviserPermissionDao.getBy(paramMap, "getByAdviserId");
if (null == permission) {
adviserPermission.setBookId(bookAndChannelDTO.getBookId());
adviserPermission.setChannelId(bookAndChannelDTO.getChannelId());
advertisingAdviserPermissionDao.insert(adviserPermission);
} else {
adviserPermission.setId(permission.getId());
advertisingAdviserPermissionDao.update(adviserPermission);
}
}
}
} else {
// 删除编辑所有数据
advertisingAdviserPermissionDao.deleteByAdviserId(adviserPermission.getAdviserId());
List<BookDto> bookList = bookDao.listBookIdAndChannelId4Adviser(paramMap);
......@@ -947,6 +959,7 @@ public class AdvertisingSpaceBizImpl implements AdvertisingSpaceBiz {
}
}
}
}
/**
* 编辑端获取书刊列表
......
package com.pcloud.book.advertising.dto;
import java.io.Serializable;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/8/19 9:49
**/
public class BookAndChannelDTO implements Serializable {
private Long bookId;
private Long channelId;
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
}
package com.pcloud.book.advertising.entity;
import java.util.Date;
import java.util.List;
import com.pcloud.book.advertising.dto.BookAndChannelDTO;
import com.pcloud.common.entity.BaseEntity;
/**
......@@ -50,6 +53,11 @@ public class AdvertisingAdviserPermission extends BaseEntity {
*/
private Boolean isBatchOperation;
/**
* bookId和channelId集合
*/
private List<BookAndChannelDTO> bookAndChannelDTOS;
@Override
public Long getId() {
return id;
......@@ -120,6 +128,14 @@ public class AdvertisingAdviserPermission extends BaseEntity {
this.isBatchOperation = isBatchOperation;
}
public List<BookAndChannelDTO> getBookAndChannelDTOS() {
return bookAndChannelDTOS;
}
public void setBookAndChannelDTOS(List<BookAndChannelDTO> bookAndChannelDTOS) {
this.bookAndChannelDTOS = bookAndChannelDTOS;
}
@Override
public String toString() {
return "AdvertisingAdviserPermission{" +
......@@ -128,9 +144,10 @@ public class AdvertisingAdviserPermission extends BaseEntity {
", bookId=" + bookId +
", channelId=" + channelId +
", isOpen=" + isOpen +
", isBatchOperation=" + isBatchOperation +
", createTime=" + createTime +
", updateTime=" + updateTime +
", isBatchOperation=" + isBatchOperation +
", bookAndChannelDTOS=" + bookAndChannelDTOS +
"} " + super.toString();
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import com.pcloud.book.book.dto.BookInfoAnalysicsDTO;
import com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
......@@ -550,7 +551,20 @@ public interface BookBiz {
PageBeanNew listNoAuthBook(ListNoAuthBookParam listNoAuthBookParam, Long adviserId);
/**
* 获取未设置授权的社群书
* @param listNoAuthGroupBookParam
* @param adviserId
* @return
*/
PageBeanNew listNoAuthGroupBook(ListNoAuthGroupBookParam listNoAuthGroupBookParam, Long adviserId);
/**
* 获取图书基本信息与授权状态
*/
BookInfoAndAuthStatusDTO getBaseAndAuthStatus(Long bookId, Long channelId, Long adviserId);
/**
* 根据书名或ISBN编号获取书id集合
*/
List<Long> getIdsByNameOrISBN(String keyword, Long adviserId);
}
......@@ -39,6 +39,7 @@ import com.pcloud.book.book.entity.BookAdviser;
import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.book.tools.BookTools;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.book.consumer.analysisengine.SceneRecordConsr;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
......@@ -1673,6 +1674,28 @@ public class BookBizImpl implements BookBiz {
}
@Override
@ParamLog("未设置版权保护的社群书")
public PageBeanNew listNoAuthGroupBook(ListNoAuthGroupBookParam listNoAuthGroupBookParam, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("channelId", listNoAuthGroupBookParam.getChannelId());
paramMap.put("name", listNoAuthGroupBookParam.getName() != null && "".equals(listNoAuthGroupBookParam.getName().trim()) ? null : listNoAuthGroupBookParam.getName());
paramMap.put("typeCode", listNoAuthGroupBookParam.getTypeCode() != null && "".equals(listNoAuthGroupBookParam.getTypeCode().trim()) ? null : listNoAuthGroupBookParam.getTypeCode());
paramMap.put("templetId", listNoAuthGroupBookParam.getTempletId());
paramMap.put("secondTempletIds", Optional.ofNullable(listNoAuthGroupBookParam.getSecondTempletId()).map(Lists::newArrayList).orElse(Lists.newArrayList()));
PageParam pageParam = new PageParam(listNoAuthGroupBookParam.getCurrentPage(), listNoAuthGroupBookParam.getNumPerPage());
PageBeanNew pageBean = bookDao.listPageNew(pageParam, paramMap, "listNoAuthGroupBook");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew(listNoAuthGroupBookParam.getCurrentPage(), listNoAuthGroupBookParam.getNumPerPage(), new ArrayList<>());
}
//设置类型名称
bookSet.setTempletNames(pageBean.getRecordList());
//设置运营平台名称
bookSet.setChannelName(pageBean.getRecordList());
return pageBean;
}
@Override
@ParamLog("获取图书基本信息与授权状态")
public BookInfoAndAuthStatusDTO getBaseAndAuthStatus(Long bookId, Long channelId, Long adviserId) {
BookDto book = getBaseById(bookId);
......@@ -1683,11 +1706,38 @@ public class BookBizImpl implements BookBiz {
BookInfoAndAuthStatusDTO bookInfoAndAuthStatusDTO = new BookInfoAndAuthStatusDTO();
BeanUtils.copyProperties(book, bookInfoAndAuthStatusDTO);
//获取授权状态
BookAuthInfoVO infoByBook = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId);
BookAuthInfoVO infoByBook = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId, null);
if (infoByBook != null) {
BeanUtils.copyProperties(infoByBook, bookInfoAndAuthStatusDTO);
}
bookInfoAndAuthStatusDTO.setIsDelete(bookAdviser == null ? BookStatusEnum.BookDeleteStatus.DELETE.value : bookAdviser.getIsDelete());
return bookInfoAndAuthStatusDTO;
}
@ParamLog("根据书名或ISBN编号获取书id集合")
@Override
public List<Long> getIdsByNameOrISBN(String keyword, Long adviserId) {
LOGGER.info("【书籍顾问】根据书名或ISBN编号获取书id集合,<START>.[keyword|adviserId]=" + keyword + "|" + adviserId);
if (StringUtil.isEmpty(keyword)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请输入关键词");
}
if (adviserId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请输入编辑ID");
}
List<Long> bookIds ;
try {
Map<String, Object> paramMap = new HashMap<String, Object>();
paramMap.put("keyword", keyword);
paramMap.put("adviserId", adviserId);
bookIds = bookDao.getIdsByNameOrISBN(paramMap);
if (bookIds == null) {
bookIds = Lists.newArrayList();
}
} catch (Exception e) {
LOGGER.error("【书籍-顾问】根据书名或ISBN编号获取书id集合,<ERROR>.[getIdsByNameOrISBN]:" + e.getMessage(), e);
throw BizException.DB_SELECT_IS_FAIL;
}
LOGGER.info("【书籍顾问】根据书名或ISBN编号获取书id集合,<END>");
return bookIds;
}
}
......@@ -305,4 +305,9 @@ public interface BookDao extends BaseDao<Book> {
* @return
*/
List<BookDto> listBookGroup4Adviser(Map<String, Object> paramMap);
/**
* 根据书名或ISBN获取书id
*/
List<Long> getIdsByNameOrISBN(Map<String,Object> paramMap);
}
......@@ -290,4 +290,9 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
public List<BookDto> listBookGroup4Adviser(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(getStatement("listBookGroup4Adviser"),paramMap);
}
@Override
public List<Long> getIdsByNameOrISBN(Map<String, Object> paramMap) {
return super.getSqlSession().selectList(super.getStatement("getIdsByNameOrISBN"), paramMap);
}
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.book.dto.BookAssocCount;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
......@@ -560,4 +561,9 @@ public interface BookFacade {
@ApiOperation(value = "获取未设置正版授权的图书", httpMethod = "POST")
ResponseDto<PageBeanNew> listNoAuthBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthBookParam listNoAuthBookParam) throws PermissionException;
@RequestMapping(value = "listNoAuthGroupBook", method = RequestMethod.POST)
@ApiOperation(value = "获取未设置正版授权的社群书", httpMethod = "POST")
ResponseDto<PageBeanNew> listNoAuthGroupBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthGroupBookParam listNoAuthGroupBookParam) throws PermissionException;
}
......@@ -11,6 +11,7 @@ import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.facade.BookFacade;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.page.PageBean;
......@@ -746,4 +747,14 @@ public class BookFacadeImpl implements BookFacade {
PageBeanNew pageBeanNew = bookBiz.listNoAuthBook(listNoAuthBookParam, adviserId);
return new ResponseDto<PageBeanNew>(null == pageBeanNew ? new PageBeanNew():pageBeanNew);
}
@Override
@RequestMapping(value = "listNoAuthGroupBook", method = RequestMethod.POST)
public ResponseDto<PageBeanNew> listNoAuthGroupBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthGroupBookParam listNoAuthGroupBookParam)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew pageBeanNew = bookBiz.listNoAuthGroupBook(listNoAuthGroupBookParam, adviserId);
return new ResponseDto<PageBeanNew>(null == pageBeanNew ? new PageBeanNew():pageBeanNew);
}
}
......@@ -14,6 +14,7 @@ import com.pcloud.book.book.service.BookService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ResponseHandleUtil;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -190,4 +191,14 @@ public class BookServiceImpl implements BookService {
@RequestParam("adviserId") Long adviserId) throws BizException {
return ResponseHandleUtil.toResponse(bookBiz.getBaseAndAuthStatus(bookId, channelId, adviserId));
}
@ApiOperation("根据书名或isbn编号查询书")
@RequestMapping(value = "/getIdsByNameOrISBN", method = RequestMethod.GET)
@Override
public ResponseEntity<ResponseDto<List<Long>>> getIdsByNameOrISBN(
@RequestParam(value = "keyword") String keyword,
@RequestParam(value = "adviserId") Long adviserId
) throws BizException {
return ResponseHandleUtil.toResponse(bookBiz.getIdsByNameOrISBN(keyword, adviserId));
}
}
package com.pcloud.book.book.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lily
* @date 2018/12/3 20:35
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListNoAuthGroupBookParam implements Serializable {
@ApiModelProperty("isbn/issn/图书名称")
private String name;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("图书类型标识")
private Long templetId;
@ApiModelProperty("图书类型标识")
private Long secondTempletId;
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页条数")
private Integer numPerPage;
@ApiModelProperty("类型")
private String typeCode;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getTempletId() {
return templetId;
}
public Long getSecondTempletId() {
return secondTempletId;
}
public void setSecondTempletId(Long secondTempletId) {
this.secondTempletId = secondTempletId;
}
public void setTempletId(Long templetId) {
this.templetId = templetId;
}
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 getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
@Override
public String toString() {
return "ListNoAuthBookParam{" +
"name='" + name + '\'' +
", channelId=" + channelId +
", templetId=" + templetId +
", secondTempletId=" + secondTempletId +
", currentPage=" + currentPage +
", numPerPage=" + numPerPage +
", typeCode='" + typeCode + '\'' +
'}';
}
}
......@@ -28,7 +28,7 @@ public interface BookAuthCodeBiz {
/**
* 获取最大批次号
*/
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId);
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 校验验证码
......@@ -53,7 +53,7 @@ public interface BookAuthCodeBiz {
* @Desr:获取导入记录
* @Date:2019/5/22 18:02
*/
PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer currentPage, Integer numPerPage);
PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer authBookType, Integer currentPage, Integer numPerPage);
/**
* 获取正版授权码
......@@ -64,7 +64,7 @@ public interface BookAuthCodeBiz {
* @param pageParam
* @return
*/
PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, PageParam pageParam);
PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam);
/**
* 批量删除正版授权码
......@@ -82,5 +82,5 @@ public interface BookAuthCodeBiz {
* @param partyId
* @return
*/
Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status, String systemCode, Long partyId);
Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status, String systemCode, Long partyId, Integer authBookType);
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetLocationDescVO;
......@@ -44,12 +45,12 @@ public interface BookAuthInfoBiz {
/**
* 获取图书正版授权基本信息
*/
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId);
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 获取图书正版授权基本信息
*/
BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId);
BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 获取设置够正版授权图书信息
......@@ -58,9 +59,15 @@ public interface BookAuthInfoBiz {
PageBeanNew listHaveSetAuthBook(ListHaveAuthBookParam listHaveAuthBookParam, Long adviserId);
/**
* 获取设置够正版授权社群书信息
* @return
*/
PageBeanNew listHaveSetAuthGroupBook(ListHaveAuthGroupBookParam listHaveAuthGroupBookParam, Long adviserId);
/**
* 获取正版授权金价格
*/
BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId);
BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 获取图书授权信息
......@@ -70,7 +77,7 @@ public interface BookAuthInfoBiz {
/**
* 获取图书授权基本信息
*/
BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId);
BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId, Integer authBookType);
/**
* 获取图书授权统计
......
package com.pcloud.book.copyright.biz;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
......@@ -17,7 +18,7 @@ public interface BookAuthUserBiz {
/**
* 获取授权用户数量
*/
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId);
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 根据月份获取授权用户数量
......@@ -27,12 +28,12 @@ public interface BookAuthUserBiz {
/**
* 最近30天趋势图
*/
List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province);
List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType);
/**
* 最近6个月趋势图
*/
List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province);
List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType);
/**
* 新增用户授权记录
......@@ -42,7 +43,7 @@ public interface BookAuthUserBiz {
/**
* 校验用户是否已经授权
*/
Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId);
Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType);
/**
* 获取授权信息总的统计数据
......@@ -58,4 +59,9 @@ public interface BookAuthUserBiz {
* 省份排名前10
*/
List<ProvinceTop10VO> listTop10ByBook(Long bookId, Long channelId, Long adviserId, Integer type);
/**
* 校验用户是否授权(进群)
*/
Boolean checkUserIsHaveAuth(CheckUserAuthDTO checkUserAuthDTO);
}
......@@ -20,6 +20,7 @@ import com.pcloud.book.copyright.dto.BookAuthCodeDTO;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.entity.BookAuthCodeImportRecord;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.book.copyright.tools.ExcelUtil;
import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.CheckCodeParam;
......@@ -128,8 +129,8 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
}
@Override
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId) {
Integer batchNum = bookAuthCodeDao.getMaxBatchNum(bookId, channelId, adviserId);
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Integer batchNum = bookAuthCodeDao.getMaxBatchNum(bookId, channelId, adviserId, authBookType);
return batchNum;
}
......@@ -137,29 +138,30 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
@Transactional(rollbackFor = Exception.class)
public Integer checkCode(CheckCodeParam checkCodeParam, Long channelId, Long wechatUserId) {
String code = checkCodeParam.getCode();
Integer authBookType = checkCodeParam.getAuthBookType();
if (StringUtils.isEmpty(code) || code.length() != 15) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "此码错误,请重新验证");
}
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkCodeParam.getBookId(), channelId, checkCodeParam.getAdviserId(), checkCodeParam.getSceneId());
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkCodeParam.getBookId(), channelId, checkCodeParam.getAdviserId(), checkCodeParam.getSceneId(), authBookType);
if (authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())) {
return BookStatusEnum.CodeUseTypeEnum.RIGHT.value;
}
Long bookId = authBookInfo.getBookId();
Long adviserId = authBookInfo.getAdviserId();
//校验用户是否已经授权过
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId, authBookType);
if (isHaveAuth) {
return BookStatusEnum.CodeUseTypeEnum.RIGHT.value;
}
Boolean isHaveCode = bookAuthCodeDao.getIsHaveCode(bookId, channelId, adviserId, code);
Integer count = bookAuthCodeDao.updateUseCount(bookId, channelId, adviserId, code, authBookInfo.getCodeUseCount());
Boolean isHaveCode = bookAuthCodeDao.getIsHaveCode(bookId, channelId, adviserId, code, authBookType);
Integer count = bookAuthCodeDao.updateUseCount(bookId, channelId, adviserId, code, authBookInfo.getCodeUseCount(), authBookType);
if (count < 1 && isHaveCode) {
return BookStatusEnum.CodeUseTypeEnum.HAVE_USE.value;
} else if (count < 1 && !isHaveCode) {
return BookStatusEnum.CodeUseTypeEnum.NOT_RIGHT.value;
} else {
//新增一条校验成功记录
addUserRecord(bookId, channelId, adviserId, wechatUserId);
addUserRecord(bookId, channelId, adviserId, wechatUserId, authBookType);
return BookStatusEnum.CodeUseTypeEnum.RIGHT.value;
}
}
......@@ -173,7 +175,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择要进入的服务");
}
//校验图书是否开启保护
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkIsAuthServeParam.getBookId(), channelId, checkIsAuthServeParam.getAdviserId(), checkIsAuthServeParam.getSceneId());
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(checkIsAuthServeParam.getBookId(), channelId, checkIsAuthServeParam.getAdviserId(), checkIsAuthServeParam.getSceneId(),null);
if (authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())) {
return false;
}
......@@ -191,7 +193,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
return false;
}
//校验用户是否已经授权过
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId,null);
if (isHaveAuth) {
return false;
} else {
......@@ -210,6 +212,14 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
bookAuthCodeImportRecord.setCreateUser(adviserId);
bookAuthCodeImportRecord.setFileName(fileVO.getFileName());
bookAuthCodeImportRecord.setFileUrl(fileVO.getFileUrl());
Integer authBookType = fileVO.getAuthBookType();
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthCodeImportRecord.setIsPaperBook(1);
bookAuthCodeImportRecord.setIsGroupBook(0);
} else {
bookAuthCodeImportRecord.setIsPaperBook(0);
bookAuthCodeImportRecord.setIsGroupBook(1);
}
bookAuthCodeImportRecordDao.insert(bookAuthCodeImportRecord);
ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> {
Integer isFinish = 1;
......@@ -219,6 +229,13 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
List<BookAuthCode> bookAuthCodes = new ArrayList<>();
for (int i = 0, size = data.length; i < size; i++) {
BookAuthCode bookAuthCode = new BookAuthCode();
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthCode.setIsPaperBook(1);
bookAuthCode.setIsGroupBook(0);
} else {
bookAuthCode.setIsPaperBook(0);
bookAuthCode.setIsGroupBook(1);
}
bookAuthCode.setBookId(fileVO.getBookId());
bookAuthCode.setChannelId(fileVO.getChannelId());
bookAuthCode.setAdviserId(adviserId);
......@@ -272,17 +289,22 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
@Override
@ParamLog("导入记录")
public PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer currentPage, Integer numPerPage) {
public PageBeanNew<ImportRecordVO> importCodeRecord(Long bookId, Long channelId, Long adviserId, Integer authBookType, Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
PageParam pageParam = new PageParam(currentPage, numPerPage);
return bookAuthCodeImportRecordDao.listPageNew(pageParam, paramMap, "importCodeRecord");
}
@ParamLog("新增一条授权成功记录")
private void addUserRecord(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
private void addUserRecord(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
BookAuthUser bookAuthUser = new BookAuthUser();
bookAuthUser.setBookId(bookId);
bookAuthUser.setChannelId(channelId);
......@@ -292,6 +314,13 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
WechatUser wechatUser = readerConsr.getWechatUser(wechatUserId);
bookAuthUser.setProvince(wechatUser == null || StringUtil.isEmpty(wechatUser.getWechatUserProvince()) ? "未知" : wechatUser.getWechatUserProvince());
bookAuthUser.setCity(wechatUser == null || StringUtil.isEmpty(wechatUser.getWechatUserCity()) ? "未知" : wechatUser.getWechatUserCity());
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthUser.setIsPaperBook(1);
bookAuthUser.setIsGroupBook(0);
} else {
bookAuthUser.setIsGroupBook(1);
bookAuthUser.setIsPaperBook(0);
}
bookAuthUserBiz.insert(bookAuthUser);
}
......@@ -306,13 +335,18 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
*/
@Override
@ParamLog("获取正版授权码")
public PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, PageParam pageParam) {
public PageBeanNew<BookAuthCodeDTO> getCodeList(Long bookId, Long channelId, Long adviserId, String keyword, Integer state, Integer authBookType, PageParam pageParam) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("keyword",StringUtil.isEmpty(keyword)?null:keyword);
paramMap.put("state",state);
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)){
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return bookAuthCodeDao.listPageNew(pageParam,paramMap,"getCodeList");
}
......@@ -328,7 +362,8 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
@Override
@ParamLog("导出授权码")
public Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status, String systemCode, Long partyId) {
public Map<String, Object> getCodeExcel(Long bookId, String codeIds, Long channelId, Long status,
String systemCode, Long partyId, Integer authBookType) {
//获取书的基本信息
BookDto bookDto = bookBiz.getBaseById(bookId);
if (null == bookDto || null == bookDto.getBookId()){
......@@ -342,7 +377,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
//不管是全部导出还是导出部分,都使用异步处理
if (status == 0) {
EXECUTOR_SERVICE.execute(() -> {
String filePath = this.exportAllFreeCode(finalTitle, rowsName, bookId, channelId, partyId);
String filePath = this.exportAllFreeCode(finalTitle, rowsName, bookId, channelId, partyId, authBookType);
//发送站内信
SendNotifyDto sendNotifyDto = new SendNotifyDto();
sendNotifyDto.setCreatedTime(new Date());
......@@ -432,7 +467,7 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
* @param partyId
* @return
*/
private String exportAllFreeCode(String title, String[] rowsName, Long bookId, Long channelId, Long partyId) {
private String exportAllFreeCode(String title, String[] rowsName, Long bookId, Long channelId, Long partyId, Integer authBookType) {
SXSSFWorkbook wb = new SXSSFWorkbook(200);
int columnNum = rowsName.length;
int rowIndex = 0;
......@@ -463,6 +498,11 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", partyId);
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
int k = 1;
//分批导出
......
......@@ -23,6 +23,7 @@ import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.entity.BookAuthInfo;
import com.pcloud.book.copyright.entity.BookExportRecord;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.book.copyright.tools.CopyrightTools;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookAuthInfoAndServesVO;
......@@ -30,6 +31,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.ServeVO;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
......@@ -107,10 +109,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Transactional(rollbackFor = Exception.class)
public void setBookAuthOpen(SetAuthOpenParam setAuthOpenParam, Long adviserId) {
checkIsCanExport(setAuthOpenParam, adviserId);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId,
setAuthOpenParam.getAuthBookType());
BookAuthInfo bookAuthInfo = new BookAuthInfo();
BeanUtils.copyProperties(setAuthOpenParam, bookAuthInfo);
if (bookAuthInfoVO == null) {
this.setAuthBookType(bookAuthInfo, setAuthOpenParam.getAuthBookType());
bookAuthInfo.setAdviserId(adviserId);
try {
bookAuthInfoDao.insert(bookAuthInfo);
......@@ -123,12 +127,15 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
bookAuthInfo.setAdviserId(adviserId);
bookAuthInfoDao.updateBaseInfo(bookAuthInfo);
}
//设置图书服务
if(setAuthOpenParam.getAuthBookType() == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(setAuthOpenParam.getAuthBookType())) {
//设置图书服务(现代纸书)
bookAuthServeBiz.setBookAuthServes(setAuthOpenParam.getServes(), setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
}
//异步生成条形码并导出
asynExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId, setAuthOpenParam.getCodeCount(), setAuthOpenParam.getIsHaveBarCode());
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId;
BookAuthInfoVO bookAuth = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
asynExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId, setAuthOpenParam.getCodeCount(), setAuthOpenParam.getIsHaveBarCode(),setAuthOpenParam.getAuthBookType());
Integer authBookType = setAuthOpenParam.getAuthBookType() == null ? 0 : setAuthOpenParam.getAuthBookType();
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
BookAuthInfoVO bookAuth = bookAuthInfoDao.getInfoByBook(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId, setAuthOpenParam.getAuthBookType());
JedisClusterUtils.setJson(key, bookAuth);
}
......@@ -140,14 +147,14 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
if (codeCount == null || codeCount == 0) {
return;
}
Boolean isHaveExport = isHaveExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);
Boolean isHaveExport = isHaveExport(setAuthOpenParam.getBookId(), setAuthOpenParam.getChannelId(), adviserId);// TODO
if (isHaveExport) {
throw new BookBizException(BookBizException.ERROR, "您有正在导出的授权码,请不要重复点击导出。导出之后系统会有站内信通知,请留意下右上角的消息中心!");
}
}
@ParamLog("异步导出")
private void asynExport(Long bookId, Long channelId, Long adviserId, Integer codeCount, Integer isHaveBarCode) {
private void asynExport(Long bookId, Long channelId, Long adviserId, Integer codeCount, Integer isHaveBarCode, Integer authBookType) {
ThreadPoolUtils.EXPORT_THREAD_POOL.execute(() -> {
String commitTime = DateUtils.formatDate(new Date());
String num = "";
......@@ -156,7 +163,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
return;
}
//获取批次号
Integer batchNum = bookAuthCodeBiz.getMaxBatchNum(bookId, channelId, adviserId);
Integer batchNum = bookAuthCodeBiz.getMaxBatchNum(bookId, channelId, adviserId, authBookType);// TODO
num = String.format("%04d", batchNum);
//新增导出记录
insertExportRecord(bookId, channelId, adviserId, num);
......@@ -170,6 +177,13 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
List<BookAuthCode> bookAuthCodes = new ArrayList<>();
for (String uuid : uuids) {
BookAuthCode bookAuthCode = new BookAuthCode();
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthCode.setIsPaperBook(1);
bookAuthCode.setIsGroupBook(0);
} else {
bookAuthCode.setIsPaperBook(0);
bookAuthCode.setIsGroupBook(1);
}
bookAuthCode.setAdviserId(adviserId);
bookAuthCode.setChannelId(channelId);
bookAuthCode.setBookId(bookId);
......@@ -201,7 +215,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
LOGGER.info("url" + noticeUrl);
} catch (Exception e) {
LOGGER.error("导出条形码失败" + e.getMessage(), e);
updateExportRecord(bookId, channelId, adviserId, num, BookStatusEnum.BookExportStatus.FAIL.value);
updateExportRecord(bookId, channelId, adviserId, num, BookStatusEnum.BookExportStatus.FAIL.value); //TODO
}
});
}
......@@ -348,16 +362,20 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
Long bookId = setAuthStatusParam.getBookId();
Long channelId = setAuthStatusParam.getChannelId();
Integer bookStatus = setAuthStatusParam.getBookStatus();
Integer authBookType = setAuthStatusParam.getAuthBookType();
if (bookId == null || channelId == null || adviserId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书不存在");
}
BookAuthInfoVO bookAuthInfo = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId);
BookAuthInfoVO bookAuthInfo = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId, authBookType);
if (bookAuthInfo == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书未开启版权保护");
}
bookAuthInfo.setBookStatus(bookStatus);
bookAuthInfoDao.updateBookStatus(bookAuthInfo.getId(), bookStatus, adviserId);
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId;
if(authBookType == null) {
authBookType = 0;
}
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
JedisClusterUtils.setJson(key, bookAuthInfo);
}
......@@ -366,10 +384,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
public void setBookLocationDesc(SetLocationDescVO setLocationDesc, Long adviserId) {
BookAuthInfo bookAuthInfo = new BookAuthInfo();
BeanUtils.copyProperties(setLocationDesc, bookAuthInfo);
this.setAuthBookType(bookAuthInfo, setLocationDesc.getAuthBookType());
bookAuthInfo.setAdviserId(adviserId);
bookAuthInfoDao.updateLocationDesc(bookAuthInfo);
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId;
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookAuthInfo.getBookId(), bookAuthInfo.getChannelId(), adviserId);
Integer authBookType = setLocationDesc.getAuthBookType() == null ? 0 : setLocationDesc.getAuthBookType();
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookAuthInfo.getBookId(), bookAuthInfo.getChannelId(), adviserId, setLocationDesc.getAuthBookType());
JedisClusterUtils.setJson(key, bookAuthInfoVO);
}
......@@ -382,27 +402,31 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Override
@ParamLog("获取正版授权书基本信息(REDIS)")
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId) {
String key = CopyrightConstants.BOOK_AUTH_INFO + bookId + "-" + channelId + "-" + adviserId;
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
if(authBookType == null) {
authBookType = 0;
}
String key = CopyrightConstants.BOOK_AUTH_INFO + bookId + "-" + channelId + "-" + adviserId + "-" + authBookType;
BookAuthInfoVO bookAuthInfoVO = JedisClusterUtils.getJson(key, BookAuthInfoVO.class);
if (bookAuthInfoVO == null) {
bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId);
bookAuthInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId, authBookType);
JedisClusterUtils.setJson(key, bookAuthInfoVO);
}
return bookAuthInfoVO;
}
@Override
@ParamLog("获取正版授权书基本信息与服务")
public BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId) {
BookAuthInfoVO bookAuthInfoVO = getInfoByBook(bookId, channelId, adviserId);
public BookAuthInfoAndServesVO getInfoAndServesByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
BookAuthInfoVO bookAuthInfoVO = getInfoByBook(bookId, channelId, adviserId, authBookType);
BookAuthInfoAndServesVO bookAuthInfoAndServesVO = new BookAuthInfoAndServesVO();
BeanUtils.copyProperties(bookAuthInfoVO, bookAuthInfoAndServesVO);
if(authBookType == null || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
//获取配置得服务
List<ServeVO> serves = bookAuthServeBiz.listServesByBook(bookId, channelId, adviserId);
removeNotInbook(serves, bookId, channelId, adviserId);
bookAuthInfoAndServesVO.setServes(serves);
}
return bookAuthInfoAndServesVO;
}
......@@ -436,6 +460,10 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
paramMap.put("isFundSupport", listHaveAuthBookParam.getIsFundSupport());
paramMap.put("channelId", listHaveAuthBookParam.getChannelId());
paramMap.put("name", listHaveAuthBookParam.getName() != null && "".equals(listHaveAuthBookParam.getName().trim()) ? null : listHaveAuthBookParam.getName());
if(!StringUtil.isEmpty(listHaveAuthBookParam.getName())){
String [] nameList = listHaveAuthBookParam.getName().trim().split("\\s+");
paramMap.put("nameList", Lists.newArrayList(nameList));
}
paramMap.put("typeCode", listHaveAuthBookParam.getTypeCode() != null && "".equals(listHaveAuthBookParam.getTypeCode().trim()) ? null : listHaveAuthBookParam.getTypeCode());
paramMap.put("templetId", listHaveAuthBookParam.getTempletId());
paramMap.put("secondTempletIds", Optional.ofNullable(listHaveAuthBookParam.getSecondTempletId()).map(Lists::newArrayList).orElse(Lists.newArrayList()));
......@@ -448,8 +476,29 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
@Override
public BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId) {
BookAuthInfoVO authInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId);
@ParamLog("获取设置过正版授权的社群书")
public PageBeanNew listHaveSetAuthGroupBook(ListHaveAuthGroupBookParam listHaveAuthGroupBookParam, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("bookStatus", listHaveAuthGroupBookParam.getBookStatus());
paramMap.put("channelId", listHaveAuthGroupBookParam.getChannelId());
paramMap.put("name", listHaveAuthGroupBookParam.getName() != null && "".equals(listHaveAuthGroupBookParam.getName().trim()) ? null : listHaveAuthGroupBookParam.getName());
paramMap.put("typeCode", listHaveAuthGroupBookParam.getTypeCode() != null && "".equals(listHaveAuthGroupBookParam.getTypeCode().trim()) ? null : listHaveAuthGroupBookParam.getTypeCode());
paramMap.put("templetId", listHaveAuthGroupBookParam.getTempletId());
paramMap.put("secondTempletIds", Optional.ofNullable(listHaveAuthGroupBookParam.getSecondTempletId()).map(Lists::newArrayList).orElse(Lists.newArrayList()));
PageParam pageParam = new PageParam(listHaveAuthGroupBookParam.getCurrentPage(), listHaveAuthGroupBookParam.getNumPerPage());
PageBeanNew pageBean = bookAuthInfoDao.listPageNew(pageParam, paramMap, "listHaveSetAuthGroupBook");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBeanNew(listHaveAuthGroupBookParam.getCurrentPage(), listHaveAuthGroupBookParam.getNumPerPage(), new ArrayList<>());
}
return pageBean;
}
@Override
@ParamLog("获取设置过版权保护书刊的价格")
public BigDecimal getBookAuthPrice(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
BookAuthInfoVO authInfoVO = bookAuthInfoDao.getInfoByBook(bookId, channelId, adviserId, authBookType);
if (authInfoVO != null) {
return authInfoVO.getPrice();
}
......@@ -457,12 +506,13 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
@Override
@ParamLog("获取授权图书信息(客户端)")
public BookAuthInfoWechatVO getInfoByBook4Wechat(GetAuthInfoParam getAuthInfoParam, Long channelId) {
BookAuthInfoWechatVO bookAuthInfoWechatVO = new BookAuthInfoWechatVO();
Long bookId =getAuthInfoParam.getBookId();
Long adviserId = getAuthInfoParam.getAdviserId();
Long sceneId = getAuthInfoParam.getSceneId();
BookAuthInfoVO authBookInfo = getAuthBookInfo(bookId, channelId, adviserId, sceneId);
BookAuthInfoVO authBookInfo = getAuthBookInfo(bookId, channelId, adviserId, sceneId, getAuthInfoParam.getAuthBookType());
if (authBookInfo != null) {
BeanUtils.copyProperties(authBookInfo, bookAuthInfoWechatVO);
//获取图书基本信息
......@@ -475,7 +525,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Override
@ParamLog("获取授权图书信息")
public BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId){
public BookAuthInfoVO getAuthBookInfo(Long bookId, Long channelId, Long adviserId, Long sceneId, Integer authBookType){
if(bookId == null && adviserId == null && sceneId == null){
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书不存在");
}
......@@ -491,13 +541,12 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
if(bookId == null){
return null;
}
BookAuthInfoVO infoByBook = getInfoByBook(bookId, channelId, adviserId);
return infoByBook;
return getInfoByBook(bookId, channelId, adviserId, authBookType);
}
@Override
public BookAuthInfoCountDTO getBookAuthInfoCount(Long bookId, Long channelId, Long adviserId, String monthDate) {
BookAuthInfoCountDTO bookAuthInfoCountDTO = bookAuthInfoDao.getBookAuthCount(bookId, channelId, adviserId);
BookAuthInfoCountDTO bookAuthInfoCountDTO = bookAuthInfoDao.getBookAuthCount(bookId, channelId, adviserId); //TODO
if (bookAuthInfoCountDTO == null) {
return null;
}
......@@ -509,7 +558,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
}
@Override
public BookAuthTotalCountDTO getBookAuthTotalCount(List<Long> adviserIds) {
public BookAuthTotalCountDTO getBookAuthTotalCount(List<Long> adviserIds) { //TODO
//获取出版社下的编辑
PartyIdListVO partyIdList4Test = partyConsr.getPartyIdList4Test();
List<Long> removeAdviserIds = partyIdList4Test == null ? null : partyIdList4Test.getAdviserIds();
......@@ -535,7 +584,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
@Override
@ParamLog("是否有正在导出的")
public Boolean isHaveExport(Long bookId, Long channelId, Long adviserId) {
Boolean isCanExport = bookExportRecordBiz.isHaveExport(bookId, channelId, adviserId);
Boolean isCanExport = bookExportRecordBiz.isHaveExport(bookId, channelId, adviserId);//TODO
return isCanExport;
}
......@@ -546,4 +595,14 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
bookAuthTotalCountDTO.setTotalCount(0);
bookAuthTotalCountDTO.setClickBuyCount(0);
}
private void setAuthBookType(BookAuthInfo bookAuthInfo, Integer authBookType) {
if(null == authBookType || AuthBookTypeEnum.PAPER_BOOK.value.equals(authBookType)) {
bookAuthInfo.setIsPaperBook(1);
bookAuthInfo.setIsGroupBook(0);
} else {
bookAuthInfo.setIsPaperBook(0);
bookAuthInfo.setIsGroupBook(1);
}
}
}
......@@ -52,6 +52,13 @@ public class BookAuthOrderBizImpl implements BookAuthOrderBiz {
bookAuthOrder.setMoney(genuine.getMoney());
bookAuthOrder.setAccountSettingId(genuine.getOfficialAccountId());
bookAuthOrder.setOrderNum(genuine.getOrderFormMainId().toString());
if(genuine.getIsGroupBook() != null && genuine.getIsGroupBook() .equals(1)) {
bookAuthOrder.setIsGroupBook(1);
bookAuthOrder.setIsPaperBook(0);
} else {
bookAuthOrder.setIsGroupBook(0);
bookAuthOrder.setIsPaperBook(1);
}
bookAuthOrderDao.insert(bookAuthOrder);
//新增用户授权记录
BookAuthUser bookAuthUser = new BookAuthUser();
......
......@@ -4,9 +4,11 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.dao.BookAuthUserDao;
import com.pcloud.book.copyright.dao.BookClickBuyRecordDao;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.copyright.dto.DateDTO;
import com.pcloud.book.copyright.entity.BookAuthUser;
import com.pcloud.book.copyright.entity.BookClickBuyRecord;
import com.pcloud.book.copyright.enums.AuthBookTypeEnum;
import com.pcloud.book.copyright.tools.CopyrightTools;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
......@@ -47,11 +49,11 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@ParamLog(value = "获取授权用户数量")
@Override
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId) {
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
if (bookId == null || channelId == null || adviserId == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书不存在");
}
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserDao.getAuthUserCount(bookId, channelId, adviserId);
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserDao.getAuthUserCount(bookId, channelId, adviserId, authBookType);
if (bookAuthCodeUserVO != null) {
bookAuthCodeUserVO.setCodeUserCount(bookAuthCodeUserVO.getTotalCount() - bookAuthCodeUserVO.getPayUserCount());
} else {
......@@ -75,7 +77,7 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
}
@Override
public List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province) {
public List<ThirtyDayCountVO> listThirtyDay(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType) {
DateDTO date = CopyrightTools.getDateByType(30L);
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("startDate", date.getStartTime());
......@@ -84,6 +86,11 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("province", province);
if(authBookType == null || authBookType.equals(AuthBookTypeEnum.PAPER_BOOK.value)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
List<ThirtyDayCountVO> thirtyDayCountVOS = bookAuthUserDao.listThirtyDay(paramMap);
setZoreRecord(thirtyDayCountVOS, date.getStartTime(), date.getEndTime());
return thirtyDayCountVOS;
......@@ -118,13 +125,18 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
}
@Override
public List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province) {
public List<SixMonthCountVO> listSixMonth(Long bookId, Long channelId, Long adviserId, String province, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("province", province);
paramMap.put("months", CopyrightTools.getLast6Months());
if(authBookType == null || authBookType.equals(AuthBookTypeEnum.PAPER_BOOK.value)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
List<SixMonthCountVO> sixMonthCountVOS = bookAuthUserDao.listSixMonth(paramMap);
setZoreRecord(sixMonthCountVOS);
return sixMonthCountVOS;
......@@ -139,8 +151,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
@Override
@ParamLog("校验用户是否已经授权")
public Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
return bookAuthUserDao.getIsHaveAuth(bookId, channelId, adviserId, wechatUserId);
public Boolean checkIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
return bookAuthUserDao.getIsHaveAuth(bookId, channelId, adviserId, wechatUserId, authBookType);
}
@Override
......@@ -194,6 +206,25 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
return top10ByBook;
}
@Override
@ParamLog("校验用户是否授权(进群)")
public Boolean checkUserIsHaveAuth(CheckUserAuthDTO checkUserAuthDTO) {
Long bookId = checkUserAuthDTO.getBookId();
Long channelId = checkUserAuthDTO.getChannelId();
Long adviserId = checkUserAuthDTO.getAdviserId();
List<Long> wechatUserIds = checkUserAuthDTO.getWechatUserIds();
if(null == bookId || null == channelId || null == adviserId || ListUtils.isEmpty(wechatUserIds)) {
LOGGER.error("参数缺失!");
return false;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
paramMap.put("wechatUserIds", wechatUserIds);
return bookAuthUserDao.checkUserIsHaveAuth(paramMap);
}
/**
* 设置最近6月为空得书
*/
......
......@@ -17,17 +17,17 @@ public interface BookAuthCodeDao extends BaseDao<BookAuthCode> {
/**
* 获取最大批次号
*/
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId);
Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 更新使用次数
*/
Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount);
Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount, Integer authBookType);
/**
* 获取码数量
*/
Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code);
Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code, Integer authBookType);
/**
* 批量删除正版授权码
......
......@@ -27,7 +27,7 @@ public interface BookAuthInfoDao extends BaseDao<BookAuthInfo> {
/**
* 获取图书正版授权信息
*/
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId);
BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 更新图书版权状态
......
......@@ -18,7 +18,7 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
/**
* 获取授权用户总数
*/
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId);
BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType);
/**
* 30天趋势图
......@@ -34,7 +34,7 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
/**
* 校验是否已经授权
*/
Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId);
Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType);
/**
* 根据月份获取授权用户信息
......@@ -50,4 +50,9 @@ public interface BookAuthUserDao extends BaseDao<BookAuthUser> {
* 获取top10的图书
*/
List<ProvinceTop10VO> listTop10ByBook(Map<String, Object> paramMap);
/**
* 校验用户是否授权
*/
Boolean checkUserIsHaveAuth(Map<String, Object> paramMap);
}
......@@ -19,32 +19,47 @@ import java.util.Map;
public class BookAuthCodeDaoImpl extends BaseDaoImpl<BookAuthCode> implements BookAuthCodeDao {
@Override
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId) {
public Integer getMaxBatchNum(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getMaxBatchNum"), paramMap);
}
@Override
public Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount) {
public Integer updateUseCount(Long bookId, Long channelId, Long adviserId, String code, Integer codeUseCount, Integer authBookType) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("codeUseCount",codeUseCount);
paramMap.put("code",code);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().update(this.getStatement("updateUseCount"), paramMap);
}
@Override
public Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code) {
public Boolean getIsHaveCode(Long bookId, Long channelId, Long adviserId, String code, Integer authBookType) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("code",code);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getIsHaveCode"), paramMap);
}
......
......@@ -31,11 +31,18 @@ public class BookAuthInfoDaoImpl extends BaseDaoImpl<BookAuthInfo> implements Bo
}
@Override
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId) {
public BookAuthInfoVO getInfoByBook(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId", adviserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
paramMap.put("isGroupBook", 0);
} else {
paramMap.put("isPaperBook", 0);
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getInfoByBook"), paramMap);
}
......
......@@ -25,11 +25,16 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
* 根据类型获取授权用户总数
*/
@Override
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId) {
public BookAuthCodeUserVO getAuthUserCount(Long bookId, Long channelId, Long adviserId, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId",adviserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getAuthUserCount"), paramMap);
}
......@@ -44,12 +49,17 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
}
@Override
public Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId) {
public Boolean getIsHaveAuth(Long bookId, Long channelId, Long adviserId, Long wechatUserId, Integer authBookType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookId", bookId);
paramMap.put("channelId", channelId);
paramMap.put("adviserId",adviserId);
paramMap.put("wechatUserId",wechatUserId);
if(authBookType == null || authBookType.equals(0)) {
paramMap.put("isPaperBook", 1);
} else {
paramMap.put("isGroupBook", 1);
}
return this.getSqlSession().selectOne(this.getStatement("getIsHaveAuth"), paramMap);
}
......@@ -78,4 +88,9 @@ public class BookAuthUserDaoImpl extends BaseDaoImpl<BookAuthUser> implements Bo
return this.getSqlSession().selectList(this.getStatement("listTop10ByBook"), paramMap);
}
@Override
public Boolean checkUserIsHaveAuth(Map<String, Object> paramMap) {
return this.getSqlSession().selectOne(this.getStatement("checkUserIsHaveAuth"), paramMap);
}
}
......@@ -51,6 +51,12 @@ public class BookAuthCode extends BaseEntity {
@ApiModelProperty("最后修改时间")
private Date lastModifiedDate;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
public String getFullCode() {
return fullCode;
}
......@@ -157,6 +163,22 @@ public class BookAuthCode extends BaseEntity {
this.lastModifiedDate = lastModifiedDate;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthCode{" +
......@@ -173,6 +195,8 @@ public class BookAuthCode extends BaseEntity {
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -4,6 +4,8 @@ import com.pcloud.common.entity.BaseEntity;
import org.springframework.stereotype.Component;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lily
* @date 2019/5/21 17:39
......@@ -24,6 +26,12 @@ public class BookAuthCodeImportRecord extends BaseEntity {
private Long createUser;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
public Long getBookId() {
return bookId;
}
......@@ -82,6 +90,22 @@ public class BookAuthCodeImportRecord extends BaseEntity {
this.id = id;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthCodeImportRecord{" +
......@@ -92,6 +116,8 @@ public class BookAuthCodeImportRecord extends BaseEntity {
", fileName='" + fileName + '\'' +
", fileUrl='" + fileUrl + '\'' +
", createUser=" + createUser +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -60,6 +60,13 @@ public class BookAuthInfo extends BaseEntity {
@ApiModelProperty("最近关闭时间")
private Date closeTime;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
......@@ -190,6 +197,22 @@ public class BookAuthInfo extends BaseEntity {
this.closeTime = closeTime;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthInfo{" +
......@@ -209,6 +232,8 @@ public class BookAuthInfo extends BaseEntity {
", lastModifiedDate=" + lastModifiedDate +
", openTime=" + openTime +
", closeTime=" + closeTime +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -45,6 +45,12 @@ public class BookAuthOrder extends BaseEntity {
@ApiModelProperty("创建时间")
private Date createdDate;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
......@@ -135,6 +141,22 @@ public class BookAuthOrder extends BaseEntity {
this.paymentSource = paymentSource;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthOrder{" +
......@@ -149,6 +171,8 @@ public class BookAuthOrder extends BaseEntity {
", paymentSource=" + paymentSource +
", createdUser=" + createdUser +
", createdDate=" + createdDate +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -54,6 +54,12 @@ public class BookAuthUser extends BaseEntity {
@ApiModelProperty("最后修改时间")
private Date lastModifiedDate;
@ApiModelProperty("是否是现代纸书")
private Integer isPaperBook;
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
......@@ -168,6 +174,22 @@ public class BookAuthUser extends BaseEntity {
this.city = city;
}
public Integer getIsPaperBook() {
return isPaperBook;
}
public void setIsPaperBook(Integer isPaperBook) {
this.isPaperBook = isPaperBook;
}
public Integer getIsGroupBook() {
return isGroupBook;
}
public void setIsGroupBook(Integer isGroupBook) {
this.isGroupBook = isGroupBook;
}
@Override
public String toString() {
return "BookAuthUser{" +
......@@ -185,6 +207,8 @@ public class BookAuthUser extends BaseEntity {
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
package com.pcloud.book.copyright.enums;
public enum AuthBookTypeEnum {
/**
* 现代纸书
*/
PAPER_BOOK(0),
/**
* 社群书
*/
GROUP_BOOK(1);
public final Integer value;
AuthBookTypeEnum(Integer value) {
this.value = value;
}
}
......@@ -49,7 +49,9 @@ public interface BookAuthCodeFacade {
@ApiOperation(value = "授权码导入记录", httpMethod = "GET")
@RequestMapping(value = "importCodeRecord", method = RequestMethod.GET)
ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage)
ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType,
@RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage)
throws PermissionException, BizException;
@ApiOperation(value = "获取授权码列表", httpMethod = "GET")
......@@ -59,6 +61,7 @@ public interface BookAuthCodeFacade {
@RequestParam("channelId") Long channelId,
@RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage)
throws PermissionException, BizException;
......@@ -95,6 +98,7 @@ public interface BookAuthCodeFacade {
@RequestParam(required = false, value ="bookId") Long bookId,
@RequestParam(required = false, value ="codeIds") String codeIds,
@RequestParam(required = false, value ="channelId") Long channelId,
@RequestParam(required = false, value ="status") Long status )
@RequestParam(required = false, value ="status") Long status,
@RequestParam(required = false,value = "authBookType")Integer authBookType)
throws PermissionException, JsonParseException,BizException;
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetLocationDescVO;
......@@ -50,7 +51,8 @@ public interface BookAuthInfoFacade {
@ApiOperation(value = "获取正版授权信息", httpMethod = "GET")
@RequestMapping(value = "getInfoByBook", method = RequestMethod.GET)
ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "获取正版授权信息(客户端)", httpMethod = "POST")
......@@ -60,7 +62,8 @@ public interface BookAuthInfoFacade {
@ApiOperation(value = "获取正版授权信息", httpMethod = "GET")
@RequestMapping(value = "getInfoAndServesByBook", method = RequestMethod.GET)
ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
......@@ -69,9 +72,15 @@ public interface BookAuthInfoFacade {
ResponseDto<PageBeanNew> listHaveSetAuthBook(@RequestHeader("token") String token, @RequestBody ListHaveAuthBookParam listHaveAuthBookParam)
throws PermissionException, BizException;
@ApiOperation(value = "获取设置过的版权保护社群书信息", httpMethod = "POST")
@RequestMapping(value = "listHaveSetAuthGroupBook", method = RequestMethod.POST)
ResponseDto<PageBeanNew> listHaveSetAuthGroupBook(@RequestHeader("token") String token, @RequestBody ListHaveAuthGroupBookParam listHaveAuthGroupBookParam)
throws PermissionException, BizException;
@ApiOperation(value = "是否有可以导出的", httpMethod = "GET")
@RequestMapping(value = "isHaveExport", method = RequestMethod.GET)
ResponseDto<Boolean> isHaveExport(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<Boolean> isHaveExport(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId)
throws PermissionException, BizException;
}
......@@ -2,14 +2,14 @@ package com.pcloud.book.copyright.facade;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
import com.pcloud.book.copyright.vo.CheckUserParam;
import com.pcloud.book.copyright.vo.ProvinceTop10VO;
import com.pcloud.book.copyright.vo.SixMonthCountVO;
import com.pcloud.book.copyright.vo.ThirtyDayCountVO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -20,6 +20,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
/**
* @author lily
* @date 2018/12/3 10:59
......@@ -29,23 +32,28 @@ public interface BookAuthUserFacade {
@ApiOperation(value = "获取正版授权总人数", httpMethod = "GET")
@RequestMapping(value = "getAuthUserCount", method = RequestMethod.GET)
ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "获取30天趋势图", httpMethod = "GET")
@RequestMapping(value = "listThirtyDay", method = RequestMethod.GET)
ResponseDto<List<ThirtyDayCountVO>> listThirtyDay(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam(value = "province", required = false) String province)
ResponseDto<List<ThirtyDayCountVO>> listThirtyDay(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "province", required = false) String province,
@RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "6个月趋势图", httpMethod = "GET")
@RequestMapping(value = "listSixMonth", method = RequestMethod.GET)
ResponseDto<List<SixMonthCountVO>> listSixMonth(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam(value = "province", required = false) String province)
ResponseDto<List<SixMonthCountVO>> listSixMonth(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "province", required = false) String province, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException;
@ApiOperation(value = "省份排名前10(6个月/30天)", httpMethod = "GET")
@RequestMapping(value = "listTop10ByBook", method = RequestMethod.GET)
ResponseDto<List<ProvinceTop10VO>> listTop10ByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam(value = "type", required = false) Integer type)
ResponseDto<List<ProvinceTop10VO>> listTop10ByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "type", required = false) Integer type)
throws PermissionException, BizException;
......@@ -53,4 +61,9 @@ public interface BookAuthUserFacade {
@ApiOperation("新增点击购买链接记录")
ResponseDto<?> insertClickBuyRecord(@CookieValue("userInfo") String userInfo, @RequestBody BookClickBuyRecordParam bookClickBuyRecordParam)
throws BizException;
@PostMapping("checkIsHaveAuth")
@ApiOperation("校验用户是否授权过")
ResponseDto<?> checkIsHaveAuth(@CookieValue("userInfo") String userInfo, @RequestBody CheckUserParam checkUserParam)
throws BizException;
}
......@@ -81,9 +81,11 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@Override
@GetMapping("importCodeRecord")
public ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token")String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage) throws PermissionException, BizException {
public ResponseDto<PageBeanNew<ImportRecordVO>> importCodeRecord(@RequestHeader("token")String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType,
@RequestParam("currentPage") Integer currenPage, @RequestParam("numPerPage") Integer numPerPage) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew<ImportRecordVO> pageBean = bookAuthCodeBiz.importCodeRecord(bookId, channelId, adviserId, currenPage, numPerPage);
PageBeanNew<ImportRecordVO> pageBean = bookAuthCodeBiz.importCodeRecord(bookId, channelId, adviserId, authBookType, currenPage, numPerPage);
return new ResponseDto<>(pageBean);
}
......@@ -94,6 +96,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@RequestParam(required = false,value = "channelId")Long channelId,
@RequestParam(required = false,value = "keyword")String keyword,
@RequestParam(required = false,value = "state")Integer state,
@RequestParam(required = false,value = "authBookType")Integer authBookType,
@RequestParam(required = false,value = "currentPage")Integer currentPage,
@RequestParam(required = false,value = "numPerPage")Integer numPerPage) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......@@ -104,7 +107,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!");
}
PageParam pageParam = new PageParam(currentPage,numPerPage);
return new ResponseDto<>(bookAuthCodeBiz.getCodeList(bookId,channelId,adviserId,keyword,state,pageParam));
return new ResponseDto<>(bookAuthCodeBiz.getCodeList(bookId,channelId,adviserId,keyword,state, authBookType, pageParam));
}
/**
......@@ -131,7 +134,8 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@RequestParam(required = false, value ="bookId") Long bookId,
@RequestParam(required = false, value ="codeIds") String codeIds,
@RequestParam(required = false, value ="channelId") Long channelId,
@RequestParam(required = false, value ="status") Long status )
@RequestParam(required = false, value ="status") Long status,
@RequestParam(required = false,value = "authBookType")Integer authBookType)
throws PermissionException, JsonParseException, BizException {
String systemCode = (String) SessionUtil.getVlaue(token, SessionUtil.SYSTEM_CODE);
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
......@@ -139,7 +143,7 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
if (null == status || null == bookId || null == channelId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数错误");
}
Map<String, Object> map = bookAuthCodeBiz.getCodeExcel(bookId,codeIds, channelId, status, systemCode, partyId);
Map<String, Object> map = bookAuthCodeBiz.getCodeExcel(bookId,codeIds, channelId, status, systemCode, partyId, authBookType);
return new ResponseDto<>(map);
}
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.copyright.vo.BookAuthInfoVO;
import com.pcloud.book.copyright.vo.BookAuthInfoWechatVO;
import com.pcloud.book.copyright.vo.GetAuthInfoParam;
import com.pcloud.book.copyright.vo.ListHaveAuthBookParam;
import com.pcloud.book.copyright.vo.ListHaveAuthGroupBookParam;
import com.pcloud.book.copyright.vo.SetAuthStatusParam;
import com.pcloud.book.copyright.vo.SetAuthOpenParam;
import com.pcloud.book.copyright.vo.SetLocationDescVO;
......@@ -23,6 +24,7 @@ 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 org.springframework.web.bind.annotation.RestController;
......@@ -71,9 +73,10 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
@Override
@GetMapping("getInfoByBook")
public ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId) throws PermissionException, BizException {
public ResponseDto<BookAuthInfoVO> getInfoByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam(value = "authBookType", required = false) Integer authBookType) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId);
BookAuthInfoVO bookAuthInfoVO = bookAuthInfoBiz.getInfoByBook(bookId, channelId, adviserId, authBookType);
return new ResponseDto<>(bookAuthInfoVO);
}
......@@ -87,9 +90,10 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
@Override
@GetMapping("getInfoAndServesByBook")
public ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId) throws PermissionException, BizException {
public ResponseDto<BookAuthInfoAndServesVO> getInfoAndServesByBook(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
BookAuthInfoAndServesVO bookAuthInfoAndServesVO = bookAuthInfoBiz.getInfoAndServesByBook(bookId, channelId, adviserId);
BookAuthInfoAndServesVO bookAuthInfoAndServesVO = bookAuthInfoBiz.getInfoAndServesByBook(bookId, channelId, adviserId, authBookType);
return new ResponseDto<>(bookAuthInfoAndServesVO);
}
......@@ -103,6 +107,15 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
}
@Override
@RequestMapping(value = "listHaveSetAuthGroupBook", method = RequestMethod.POST)
public ResponseDto<PageBeanNew> listHaveSetAuthGroupBook(@RequestHeader("token") String token, @RequestBody ListHaveAuthGroupBookParam listHaveAuthGroupBookParam)
throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
PageBeanNew pageBeanNew = bookAuthInfoBiz.listHaveSetAuthGroupBook(listHaveAuthGroupBookParam, adviserId) ;
return new ResponseDto<>(pageBeanNew);
}
@Override
@GetMapping("isHaveExport")
public ResponseDto<Boolean> isHaveExport(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId)
throws PermissionException, BizException {
......
......@@ -4,6 +4,7 @@ import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.facade.BookAuthUserFacade;
import com.pcloud.book.copyright.vo.BookAuthCodeUserVO;
import com.pcloud.book.copyright.vo.BookClickBuyRecordParam;
import com.pcloud.book.copyright.vo.CheckUserParam;
import com.pcloud.book.copyright.vo.ProvinceTop10VO;
import com.pcloud.book.copyright.vo.SixMonthCountVO;
import com.pcloud.book.copyright.vo.ThirtyDayCountVO;
......@@ -38,28 +39,30 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade {
@Override
@ApiOperation(value = "获取正版授权总人数", httpMethod = "GET")
@RequestMapping(value = "getAuthUserCount", method = RequestMethod.GET)
public ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId) throws PermissionException, BizException {
public ResponseDto<BookAuthCodeUserVO> getAuthUserCount(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId,
@RequestParam("channelId") Long channelId, @RequestParam(value = "authBookType", required = false) Integer authBookType) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserBiz.getAuthUserCount(bookId, channelId, adviserId);
BookAuthCodeUserVO bookAuthCodeUserVO = bookAuthUserBiz.getAuthUserCount(bookId, channelId, adviserId, authBookType);
return new ResponseDto<>(bookAuthCodeUserVO);
}
@Override
@RequestMapping(value = "listThirtyDay", method = RequestMethod.GET)
public ResponseDto<List<ThirtyDayCountVO>> listThirtyDay(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId
, @RequestParam(value = "province", required = false) String province) throws PermissionException, BizException {
, @RequestParam(value = "province", required = false) String province, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
List<ThirtyDayCountVO> thirtyDayCountVOS = bookAuthUserBiz.listThirtyDay(bookId, channelId, adviserId, province);
List<ThirtyDayCountVO> thirtyDayCountVOS = bookAuthUserBiz.listThirtyDay(bookId, channelId, adviserId, province, authBookType);
return new ResponseDto<>(thirtyDayCountVOS);
}
@Override
@RequestMapping(value = "listSixMonth", method = RequestMethod.GET)
public ResponseDto<List<SixMonthCountVO>> listSixMonth(@RequestHeader("token") String token, @RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId
, @RequestParam(value = "province", required = false) String province)
, @RequestParam(value = "province", required = false) String province, @RequestParam(value = "authBookType", required = false) Integer authBookType)
throws PermissionException, BizException{
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
List<SixMonthCountVO> sixMonthCountVOS = bookAuthUserBiz.listSixMonth(bookId, channelId, adviserId, province);
List<SixMonthCountVO> sixMonthCountVOS = bookAuthUserBiz.listSixMonth(bookId, channelId, adviserId, province, authBookType);
return new ResponseDto<>(sixMonthCountVOS);
}
......@@ -79,4 +82,18 @@ public class BookAuthUserFacadeImpl implements BookAuthUserFacade {
bookAuthUserBiz.insertClickBuyRecord(bookClickBuyRecordParam, channelId, wechatUserId);
return new ResponseDto<>();
}
@PostMapping("checkIsHaveAuth")
public ResponseDto<?> checkIsHaveAuth(@CookieValue("userInfo") String userInfo, @RequestBody CheckUserParam checkUserParam)
throws BizException{
Long bookId = checkUserParam.getBookId();
Long adviserId = checkUserParam.getAdviserId();
Long channelId = checkUserParam.getChannelId();
if(null == channelId) {
channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Boolean result = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId, 1);
return new ResponseDto<>(result);
}
}
package com.pcloud.book.copyright.service.impl;
import com.pcloud.book.copyright.biz.BookAuthInfoBiz;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.dto.BookAuthInfoCountDTO;
import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.copyright.service.BookAuthInfoService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
......@@ -27,17 +29,20 @@ import java.util.List;
public class BookAuthInfoServiceImpl implements BookAuthInfoService {
@Autowired
private BookAuthInfoBiz bookAuthInfoBiz;
@Autowired
private BookAuthUserBiz bookAuthUserBiz;
@Override
@RequestMapping(value = "/getBookAuthPrice", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BigDecimal>> getBookAuthPrice(@RequestParam("bookId") Long bookId,
@RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId) throws BizException {
return ResponseHandleUtil.toResponse(bookAuthInfoBiz.getBookAuthPrice(bookId, channelId, adviserId));
return ResponseHandleUtil.toResponse(bookAuthInfoBiz.getBookAuthPrice(bookId, channelId, adviserId, null));
}
@Override
@RequestMapping(value = "/getBookAuthInfoCount", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId, @RequestParam("adviserId") Long adviserId, @RequestParam(value = "monthDate", required = false) String monthDate) throws BizException {
public ResponseEntity<ResponseDto<BookAuthInfoCountDTO>> getBookAuthInfoCount(@RequestParam("bookId") Long bookId, @RequestParam("channelId") Long channelId,
@RequestParam("adviserId") Long adviserId, @RequestParam(value = "monthDate", required = false) String monthDate) throws BizException {
BookAuthInfoCountDTO bookAuthInfoCountDTO = bookAuthInfoBiz.getBookAuthInfoCount(bookId, channelId, adviserId, monthDate);
return ResponseHandleUtil.toResponse(bookAuthInfoCountDTO);
}
......@@ -55,4 +60,17 @@ public class BookAuthInfoServiceImpl implements BookAuthInfoService {
BookAuthTotalCountDTO bookAuthTotalCountDTO = bookAuthInfoBiz.getBookAuthTotalCount(adviserIds);
return ResponseHandleUtil.toResponse(bookAuthTotalCountDTO);
}
@Override
@RequestMapping(value = "/checkUserIsHaveAuth", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Boolean>> checkUserIsHaveAuth(@RequestBody CheckUserAuthDTO checkUserAuthDTO) throws BizException {
return ResponseHandleUtil.toResponse(bookAuthUserBiz.checkUserIsHaveAuth(checkUserAuthDTO));
}
@Override
@RequestMapping(value = "/getGroupBookAuthPrice", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<BigDecimal>> getGroupBookAuthPrice(@RequestParam("bookId") Long bookId,
@RequestParam("channelId")Long channelId, @RequestParam("adviserId")Long adviserId) throws BizException {
return ResponseHandleUtil.toResponse(bookAuthInfoBiz.getBookAuthPrice(bookId, channelId, adviserId, 1));
}
}
......@@ -30,6 +30,9 @@ public class CheckCodeParam implements Serializable {
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Long getChannelId() {
return channelId;
}
......@@ -69,6 +72,14 @@ public class CheckCodeParam implements Serializable {
this.adviserId = adviserId;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "CheckCodeParam{" +
......@@ -76,6 +87,8 @@ public class CheckCodeParam implements Serializable {
", sceneId=" + sceneId +
", bookId=" + bookId +
", adviserId=" + adviserId +
", channelId=" + channelId +
", authBookType=" + authBookType +
'}';
}
}
package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lily
* @date 2018/12/5 14:08
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CheckUserParam implements Serializable {
@ApiModelProperty("图书标识")
private Long bookId;
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("运营标识")
private Long channelId;
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getAdviserId() {
return adviserId;
}
public void setAdviserId(Long adviserId) {
this.adviserId = adviserId;
}
@Override
public String toString() {
return "CheckCodeParam{" +
", bookId=" + bookId +
", adviserId=" + adviserId +
", channelId=" + channelId +
'}';
}
}
......@@ -15,6 +15,8 @@ public class FileVO implements Serializable {
private String fileName;
private Integer authBookType;
public String getFileName() {
return fileName;
}
......@@ -47,12 +49,22 @@ public class FileVO implements Serializable {
this.fileUrl = fileUrl;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "FileVO{" +
"fileUrl='" + fileUrl + '\'' +
", bookId=" + bookId +
", channelId=" + channelId +
", fileName='" + fileName + '\'' +
", authBookType=" + authBookType +
'}';
}
}
......@@ -22,6 +22,9 @@ public class GetAuthInfoParam implements Serializable {
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Long getSceneId() {
return sceneId;
}
......@@ -46,12 +49,21 @@ public class GetAuthInfoParam implements Serializable {
this.adviserId = adviserId;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "GetAuthInfoParam{" +
"sceneId=" + sceneId +
", bookId=" + bookId +
", adviserId=" + adviserId +
", authBookType=" + authBookType +
'}';
}
}
package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @author lihao
* @date 2018/8/26 14:27
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListHaveAuthGroupBookParam implements Serializable {
@ApiModelProperty("isbn/issn/图书名称")
private String name;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("图书类型标识")
private Long templetId;
@ApiModelProperty("第二级图书类型标识")
private Long secondTempletId;
@ApiModelProperty("当前页")
private Integer currentPage;
@ApiModelProperty("每页条数")
private Integer numPerPage;
@ApiModelProperty("类型")
private String typeCode;
@ApiModelProperty("社群书状态")
private Integer bookStatus;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getTempletId() {
return templetId;
}
public void setTempletId(Long templetId) {
this.templetId = templetId;
}
public Long getSecondTempletId() {
return secondTempletId;
}
public void setSecondTempletId(Long secondTempletId) {
this.secondTempletId = secondTempletId;
}
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 getTypeCode() {
return typeCode;
}
public void setTypeCode(String typeCode) {
this.typeCode = typeCode;
}
public Integer getBookStatus() {
return bookStatus;
}
public void setBookStatus(Integer bookStatus) {
this.bookStatus = bookStatus;
}
@Override
public String toString() {
return "ListHaveAuthGroupBookParam{" +
"name='" + name + '\'' +
", channelId=" + channelId +
", templetId=" + templetId +
", secondTempletId=" + secondTempletId +
", currentPage=" + currentPage +
", numPerPage=" + numPerPage +
", typeCode='" + typeCode + '\'' +
", bookStatus=" + bookStatus +
'}';
}
}
......@@ -46,6 +46,9 @@ public class SetAuthOpenParam implements Serializable {
@ApiModelProperty("是否包含条形码 C1001121 添加二维码,故该字段2为二维码")
private Integer isHaveBarCode;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public List<ServeVO> getServes() {
return serves;
}
......@@ -126,9 +129,17 @@ public class SetAuthOpenParam implements Serializable {
this.isHaveBarCode = isHaveBarCode;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetAuthOpenVO{" +
return "SetAuthOpenParam{" +
"bookId=" + bookId +
", channelId=" + channelId +
", price=" + price +
......@@ -138,6 +149,8 @@ public class SetAuthOpenParam implements Serializable {
", bookStatus=" + bookStatus +
", checkType=" + checkType +
", serves=" + serves +
", isHaveBarCode=" + isHaveBarCode +
", authBookType=" + authBookType +
'}';
}
}
......@@ -25,6 +25,9 @@ public class SetAuthStatusParam implements Serializable {
@ApiModelProperty("图书状态")
private Integer bookStatus;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Integer getBookStatus() {
return bookStatus;
}
......@@ -49,12 +52,21 @@ public class SetAuthStatusParam implements Serializable {
this.channelId = channelId;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetAuthStatusParam{" +
"bookId=" + bookId +
", channelId=" + channelId +
", bookStatus=" + bookStatus +
", authBookType=" + authBookType +
'}';
}
}
......@@ -23,6 +23,9 @@ public class SetLocationDescVO implements Serializable {
@ApiModelProperty("位置描述")
private String locationDesc;
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public Long getBookId() {
return bookId;
}
......@@ -47,12 +50,21 @@ public class SetLocationDescVO implements Serializable {
this.locationDesc = locationDesc;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetLocationDesc{" +
return "SetLocationDescVO{" +
"bookId=" + bookId +
", channelId=" + channelId +
", locationDesc='" + locationDesc + '\'' +
", authBookType=" + authBookType +
'}';
}
}
package com.pcloud.book.group.biz;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookClassifyDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.ClassifyLearningReportDto;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.vo.AddClassifyVO;
import com.pcloud.book.group.vo.AdviserClassifyParam;
......@@ -12,6 +19,7 @@ import com.pcloud.book.group.vo.ClassifyAndUserCountVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO;
import com.pcloud.book.group.vo.ListClassify4WechatVO;
import com.pcloud.book.group.vo.ListClassifyVO;
......@@ -144,7 +152,7 @@ public interface BookGroupClassifyBiz {
/**
* 用户获取具体进群id
*/
String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId);
GroupQrcodeBaseInfoVO getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId);
/**
* @Author:lili
......
......@@ -10,6 +10,7 @@ import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.settlement.SettlementConsr;
import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupAnnouncementBiz;
......@@ -21,7 +22,21 @@ import com.pcloud.book.group.dao.BookQrcodeUserDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dao.LearningReportBrowseRecordDao;
import com.pcloud.book.group.dao.LearningReportTouchRecordDao;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookClassifyDTO;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupStatisticDTO;
import com.pcloud.book.group.dto.BookWxQrcodeDTO;
import com.pcloud.book.group.dto.ClassifyDTO;
import com.pcloud.book.group.dto.ClassifyLearningCountDto;
import com.pcloud.book.group.dto.ClassifyLearningReportDto;
import com.pcloud.book.group.dto.GroupAndUserNumberDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupNameAndMaxSeqDTO;
import com.pcloud.book.group.dto.GroupQrcodeBaseDTO;
import com.pcloud.book.group.dto.GroupQrcodeInfoDTO;
import com.pcloud.book.group.dto.ProAssocGroupAndUserNumberDTO;
import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.WeixinQrcodeDTO;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookQrcodeUser;
import com.pcloud.book.group.entity.GroupQrcode;
......@@ -146,6 +161,9 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
@Autowired
private JoinGroupCipherDao joinGroupCipherDao;
@Autowired
private BookAuthUserBiz bookAuthUserBiz;
@Override
@ParamLog("新增分类")
......@@ -181,12 +199,10 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
log.info("[新增分类] : 可用微信群数量:{}个", wechatGroupNum);
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群二维码数量不足,您可以明天再创建群。");
}
}
Integer generation = null;
if (new Integer(2).equals(qrcodeNameAndProId.getJoinGroupType())) {
generation = 3;
}
WeixinQrcodeDTO oneQrcode = weixinQrcodeBiz.getOneQrcode(generation);
if (oneQrcode == null) {
......@@ -544,12 +560,16 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "社群码不存在,请刷新后重试");
}
if (new BigDecimal(0).compareTo(classify.getPrice()) < 0) {
//校验用户是否正版授权
Boolean isAuth = bookAuthUserBiz.checkIsHaveAuth(classify.getBookId(), classify.getChannelId(), classify.getCreateUser(), wechatUserId, 1);
if(!isAuth) {
//校验用户是否购买
Boolean isBuy = bookClassifyBuyRecordDao.checkUserBuy(wechatUserId, classifyId);
if (!isBuy) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "您还未购买,请购买后使用!");
}
}
}
//获取用户是否分配过二维码
GroupQrcode4ClassifyVO groupQrcode4ClassifyVO = bookQrcodeUserDao.getUserQrcode(classifyId, wechatUserId);
......@@ -579,7 +599,8 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@Override
public String getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId) {
@ParamLog("[getWxGroupIdByClassifyIdAndWechatId]")
public GroupQrcodeBaseInfoVO getWxGroupIdByClassifyIdAndWechatId(Long classifyId, Long wechatUserId) {
if(null == classifyId || null == wechatUserId) {
return null;
}
......@@ -588,7 +609,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return null;
}
final GroupQrcodeBaseInfoVO baseById = this.groupQrcodeBiz.getBaseById(wechat.getGroupQrcodeId());
return (null == baseById) ? null : baseById.getWeixinGroupId();
return baseById;
}
@ParamLog("获取备用二维码")
......@@ -1053,10 +1074,6 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@Override
public BigDecimal getPayPrice(Long qrcodeId, String wxId) {
return joinGroupCipherDao.getPayPrice(wxId, qrcodeId);
}
@ParamLog("拖动排序")
@Transactional(rollbackFor = Exception.class)
......@@ -1069,6 +1086,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
}
@Override
public BigDecimal getPayPrice(Long qrcodeId, String wxId) {
return joinGroupCipherDao.getPayPrice(wxId, qrcodeId);
}
@Override
public void clickClassify(Long wechatUserId, Long bookGroupId, Long classifyId) {
bookGroupClassifyDao.addClickClassify(wechatUserId,bookGroupId,classifyId);
}
......@@ -1081,7 +1103,7 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
return new ArrayList<>();
}
return classifyVOS;
}
}
......@@ -51,6 +51,9 @@ public class ClassifyVO implements Serializable {
@ApiModelProperty("排序")
private Integer rank;
@ApiModelProperty("创建人")
private Long createUser;
public Integer getRank() {
return rank;
}
......@@ -147,6 +150,14 @@ public class ClassifyVO implements Serializable {
this.productSpecId = productSpecId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override
public String toString() {
return "ClassifyVO{" +
......@@ -162,6 +173,7 @@ public class ClassifyVO implements Serializable {
", productId=" + productId +
", productSpecId=" + productSpecId +
", rank=" + rank +
", createUser=" + createUser +
'}';
}
}
......@@ -27,4 +27,7 @@ public class GroupQrcodeBaseInfoVO implements Serializable {
@ApiModelProperty(value = "二维码地址", hidden = true)
private String weixinGroupId;
@ApiModelProperty(value = "当前群人数", hidden = true)
private Integer userNumber;
}
......@@ -2,9 +2,6 @@ package com.pcloud.book.keywords.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.clock.check.BookClockCheck;
import com.pcloud.book.clock.dao.BookClockKeywordDao;
import com.pcloud.book.clock.dto.BookClockKeywordDTO;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
......@@ -15,7 +12,11 @@ import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
import com.pcloud.book.group.dao.JoinGroupCipherDao;
import com.pcloud.book.group.dto.*;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.GroupClassifyQrcodeDTO;
import com.pcloud.book.group.dto.GroupQrcodeDTO;
import com.pcloud.book.group.dto.JoinGroupCipherDTO;
import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.TouchTypeEnum;
......@@ -38,7 +39,6 @@ import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO;
import com.pcloud.book.keywords.vo.SetGuideVO;
import com.pcloud.book.keywords.vo.UpdateGuideVO;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
......@@ -47,7 +47,6 @@ import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.wechatgroup.message.dto.AgreeAddUserDTO;
import com.sdk.wxgroup.AddToGroupVO;
import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.SendMessageTypeEnum;
import com.sdk.wxgroup.SendTextMessageVO;
......@@ -94,10 +93,6 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Autowired
private AppTouchRecordDao appTouchRecordDao;
@Autowired
private BookClockCheck bookClockCheck;
@Autowired
private BookClockKeywordDao bookClockKeywordDao;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Autowired
private BookGroupClassifyDao bookGroupClassifyDao;
......@@ -125,7 +120,12 @@ public class BookGuideBizImpl implements BookGuideBiz {
}
final JoinGroupCipherDTO dto = joinGroupCipherDao.getDTOByCipher(cipher);
//获取群
final String wxGroupId = bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId(dto.getClassifyId(), dto.getWechatUserId());
final GroupQrcodeBaseInfoVO wxGroup = bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId(dto.getClassifyId(), dto.getWechatUserId());
if (null == wxGroup) {
log.error("[同意加好友发送欢迎语] : bookGroupClassifyBiz.getWxGroupIdByClassifyIdAndWechatId dto:{}");
throw new BookBizException(BookBizException.ID_NOT_EXIST, "群不存在");
}
String wxGroupId = wxGroup.getWeixinGroupId();
if (agreeAddUserDTO.getFirst() != null && agreeAddUserDTO.getFirst()) {
// 如果是第一次就只发欢迎文案
SendTextMessageVO vo = new SendTextMessageVO();
......@@ -147,17 +147,18 @@ public class BookGuideBizImpl implements BookGuideBiz {
//发关键词列表
SendWeixinRequestTools.sendKeywordsInfoToSelf(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
// 拉群
final Integer peopleCounts = WxGroupSDK.getPeopleCounts(wxGroupId, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getIp());
// final Integer peopleCounts = wxGroup.getUserNumber();
// 邀请好友进群有次数限制,目前测试为每天只能拉30-40人就操作频繁,所以在此加判断,超过30人或者群人数超过30人就发送邀请链接
final String num = JedisClusterUtils.get(BookConstant.WXGROUP_ADD_USER_NUM + agreeAddUserDTO.getRobotWxId());
log.info("[同意加好友发送欢迎语] 拉群 agreeAddUserDTO:{}, wxGroupId:{}, peopleCounts:{}, num:{}", agreeAddUserDTO, wxGroupId, peopleCounts, num);
log.info("[同意加好友发送欢迎语] 拉群 agreeAddUserDTO:{}, wxGroup:{}, num:{}", agreeAddUserDTO, wxGroup, num);
if (StringUtil.isBlank(wxGroupId)) {
log.info("[同意加好友发送欢迎语] 拉群 没有找到群 bookGroupClassifyBiz.getGroupQrcode4ClassifyWechat JoinGroupCipherDTO :{}", dto);
return;
}
// 1001666 刘娜需求-1v1客服机器人,不直接拉人,30人以下也发邀请链接
// 生产环境限制30,其它5和10,全部使用群链接
final boolean isPro = "pro".equalsIgnoreCase(BookProps.getSystemEnv());
if ((!StringUtil.isBlank(num) && Integer.parseInt(num) >= (isPro ? 30 : 5)) || peopleCounts >= (isPro ? 30 : 10)) {
// final boolean isPro = "pro".equalsIgnoreCase(BookProps.getSystemEnv());
// if ((!StringUtil.isBlank(num) && Integer.parseInt(num) >= (isPro ? 30 : 5)) || peopleCounts >= (isPro ? 30 : 10)) {
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
sendGroupInviteVO.setAltId(agreeAddUserDTO.getRobotWxId());
sendGroupInviteVO.setWxId(agreeAddUserDTO.getUserWxId());
......@@ -166,16 +167,16 @@ public class BookGuideBizImpl implements BookGuideBiz {
WxGroupSDK.sendGroupInvite(sendGroupInviteVO);
log.info("[同意加好友发送欢迎语] 发送进群链接 sendGroupInviteVO:{}", sendGroupInviteVO);
// 进群之后更新群qrCodeId
updateQrcodeForCipher(wxGroupId, cipher, agreeAddUserDTO.getUserWxId());
return;
}
AddToGroupVO vo1 = new AddToGroupVO();
vo1.setWxGroupId(wxGroupId);
vo1.setWxId(agreeAddUserDTO.getUserWxId());
vo1.setAltId(agreeAddUserDTO.getRobotWxId());
vo1.setIp(agreeAddUserDTO.getIp());
log.info("[同意加好友发送欢迎语 拉群] AddToGroupVO :{}", vo1);
WxGroupSDK.addToGroup(vo1);
// updateQrcodeForCipher(wxGroupId, cipher, agreeAddUserDTO.getUserWxId());
// return;
// }
// AddToGroupVO vo1 = new AddToGroupVO();
// vo1.setWxGroupId(wxGroupId);
// vo1.setWxId(agreeAddUserDTO.getUserWxId());
// vo1.setAltId(agreeAddUserDTO.getRobotWxId());
// vo1.setIp(agreeAddUserDTO.getIp());
// log.info("[同意加好友发送欢迎语 拉群] AddToGroupVO :{}", vo1);
// WxGroupSDK.addToGroup(vo1);
// 进群之后更新群qrCodeId
updateQrcodeForCipher(wxGroupId, cipher, agreeAddUserDTO.getUserWxId());
// 拉一次+1
......
......@@ -65,8 +65,6 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Value("${system.env}")
private String envStr;
@Autowired
private RiddleDao riddleDao;
@Autowired
......@@ -271,7 +269,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
//发送规则
String reply = getRandomReply(RiddleReplyTypeEnum.rule.getCode());
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
reply = reply + "\n" + "目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。";
reply = reply + "\n" + "目前本群总共猜对" + correctCount + "题,所有微信群中本群排名第" + ranking + "名,大家加油。";
sendWeixinTextMessage(wxId, wxGroupId, reply, ip, null);
//发送题目,保存该题目
if (null != currentRiddle) {//发送上次题目
......@@ -301,7 +299,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
public void endGame(RiddleRecord insertRecord, String wxGroupId, String wxId, String ip, Integer grade, Integer finishCount) {
Integer correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, finishCount);
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
String text = "好嘞,再见,爱你们哦。目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。";
String text = "好嘞,再见,爱你们哦。目前本群总共猜对" + correctCount + "题,所有微信群中本群排名第" + ranking + "名,大家加油。";
//发送结束语
sendWeixinTextMessage(wxId, wxGroupId, text, ip, null);
//保存结束记录
......@@ -426,7 +424,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
Integer correctCount = riddleRecordDao.getCorrectCountByGroup(wxGroupId, riddleRecord.getFinishCount());
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
String reply = getRandomReply(RiddleReplyTypeEnum.no_reply_end.getCode());
String text = reply + "目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。";
String text = reply + "目前本群总共猜对" + correctCount + "题,所有微信群中本群排名第" + ranking + "名,大家加油。";
if (!text.contains("关键词")) {
text = text + "想玩记得回复关键词“猜谜语”就可以召唤我啦。";
}
......@@ -523,33 +521,16 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
public void sendCouponLink(String wxId, String wxGroupId, String ip) {
try {
Thread.sleep(1000);
}catch (InterruptedException e){
} catch (InterruptedException e) {
logger.error("线程休眠失败");
}
String link = "https://wechat666." + getDomain(envStr) + "/groupGuessing/guessing?wxGroupId=" + wxGroupId;
logger.info("wechatGroupLinkPrefix="+wechatGroupLinkPrefix);
String link = wechatGroupLinkPrefix + "/groupGuessing/guessing?wxGroupId=" + wxGroupId;
link = UrlUtils.getShortUrl4Own(wechatGroupLinkPrefix + "/link?url=" + URLEncoder.encode(link));
String content = "优惠券领取链接(@所有人均可领取哦):\n" + link;
sendWeixinTextMessage(wxId, wxGroupId, content, ip, null);
}
private String getDomain(String envStr) {
String domain = "5rs.me";
switch (envStr) {
case "dev":
domain = "chubanyun.me";
break;
case "test":
domain = "raysgo.com";
break;
case "uat":
domain = "raysyun.com";
break;
case "pro":
domain = "5rs.me";
break;
}
return domain;
}
/**
* 发送成绩单并结束游戏
* @param wxId
......@@ -568,7 +549,7 @@ public class RiddleRecordBizImpl implements RiddleRecordBiz {
String correctContent = "给你点赞,答对本轮游戏最后一题,现在发成绩单咯,下一轮游戏我们不见不散哦。";
sendWeixinTextMessage(wxId, wxGroupId, correctContent, ip, wxUserId);
Integer ranking = riddleRecordDao.getGroupRanking(wxGroupId);
String before = "目前本群总共猜对" + correctCount + "题,群排名第" + ranking + "名,大家加油。\n" +
String before = "目前本群总共猜对" + correctCount + "题,所有微信群中本群排名第" + ranking + "名,大家加油。\n" +
"--------------------------------\n本轮成绩如下:\n";
List<UserRankingDTO> rankingDTOS = riddleRecordDao.getUserRanking(wxGroupId, startTime);
if (ListUtils.isEmpty(rankingDTOS)) {
......
......@@ -1640,7 +1640,7 @@
LEFT JOIN
BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
</if>
LEFT JOIN book_auth_info I ON I.BOOK_ID = B.BOOK_ID AND I.ADVISER_ID = #{adviserId}
LEFT JOIN book_auth_info I ON I.BOOK_ID = B.BOOK_ID AND I.ADVISER_ID = #{adviserId} AND I.is_paper_book = 1
WHERE
I.ID IS NULL
<if test="typeCode!=null">
......@@ -1679,4 +1679,72 @@
A.LAST_MODIFIED_DATE DESC , A.BOOK_ADVISER_ID DESC
</select>
<!-- 根据名称或ISBN获取ID -->
<select id="getIdsByNameOrISBN" resultType="long" parameterType="map">
SELECT
A.BOOK_ID
FROM
BOOK_ADVISER A
INNER JOIN
BOOK B
ON
A.BOOK_ID = B.BOOK_ID AND A.ADVISER_ID = #{adviserId} AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
WHERE
B.BOOK_NAME LIKE CONCAT('%',#{keyword},'%') or B.ISBN LIKE CONCAT('%',#{keyword},'%')
</select>
<select id="listNoAuthGroupBook" resultType="noAuthBookVO" parameterType="map">
SELECT
A.book_id AS bookId,
A.channel_id AS channelId,
A.adviser_id AS adviserId,
B.type_code AS typeCode,
T.type_name AS typeName,
B.isbn,
B.book_name AS bookName,
B.cover_img AS coverImg,
B.serial_number AS serialNumber,
A.templet_id AS templetId
FROM
book_group G
INNER JOIN book B ON G.book_id = B.book_id
AND G.create_user = #{adviserId}
AND G.is_delete = 0
AND B.is_delete = 0
INNER JOIN BOOK_ADVISER A ON A.BOOK_ID = B.BOOK_ID
AND A.ADVISER_ID = #{adviserId}
AND A.IS_DELETE = 0
AND B.IS_DELETE = 0
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN book_auth_info I ON I.BOOK_ID = B.BOOK_ID
AND I.ADVISER_ID = #{adviserId} AND I.is_group_book = 1
WHERE
I.ID IS NULL
<if test="typeCode!=null">
AND
B.TYPE_CODE = #{typeCode}
</if>
<if test="channelId!=null">
AND
G.CHANNEL_ID = #{channelId}
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
</if>
<if test="templetId != null">
AND
A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds!=null and secondTempletIds.size()>0">
AND
A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
GROUP BY G.book_id, G.channel_id
ORDER BY
G.update_time DESC , G.id DESC
</select>
</mapper>
\ No newline at end of file
......@@ -4,13 +4,14 @@
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
INSERT INTO BOOK_AUTH_CODE (
BOOK_ID, CHANNEL_ID,ADVISER_ID,BATCH_NUM,AUTH_CODE,FULL_CODE,CREATE_TYPE,CREATED_USER, CREATED_DATE
BOOK_ID, CHANNEL_ID,ADVISER_ID,BATCH_NUM,AUTH_CODE,FULL_CODE,CREATE_TYPE,CREATED_USER, CREATED_DATE,IS_PAPER_BOOK,IS_GROUP_BOOK
)
VALUES
<foreach collection="list" item="item" index="index" separator="," >
(#{item.bookId,jdbcType=BIGINT}, #{item.channelId,jdbcType=BIGINT}, #{item.adviserId,jdbcType=BIGINT},
#{item.batchNum,jdbcType=VARCHAR},#{item.authCode,jdbcType=VARCHAR},#{item.fullCode,jdbcType=VARCHAR},
#{item.createType,jdbcType=TINYINT},#{item.adviserId,jdbcType=BIGINT}, NOW())
#{item.createType,jdbcType=TINYINT},#{item.adviserId,jdbcType=BIGINT}, NOW(),#{item.isPaperBook,jdbcType=TINYINT},
#{item.isGroupBook,jdbcType=TINYINT})
</foreach>
</insert>
......@@ -26,6 +27,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<update id="updateUseCount" parameterType="map" flushCache="true">
......@@ -44,6 +53,14 @@
FULL_CODE = #{code}
AND
use_count <![CDATA[ < ]]> #{codeUseCount}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</update>
<select id="getIsHaveCode" resultType="Boolean" parameterType="map">
......@@ -59,6 +76,14 @@
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
FULL_CODE = #{code}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<select id="getCodeList" parameterType="map" resultType="com.pcloud.book.copyright.dto.BookAuthCodeDTO">
......@@ -92,6 +117,14 @@
</otherwise>
</choose>
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
order by created_date desc
</select>
......@@ -117,6 +150,14 @@
created_date createdDate
from book_auth_code
where book_id= #{bookId,jdbcType=BIGINT} and channel_id = #{channelId} and adviser_id = #{adviserId}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
LIMIT #{currentPage},#{numPerPage}
</select>
......
......@@ -4,12 +4,12 @@
<insert id="insert" useGeneratedKeys="true" keyProperty="id" parameterType="BookAuthCodeImportRecord">
INSERT INTO BOOK_AUTH_CODE_IMPORT_RECORD (
BOOK_ID, CHANNEL_ID,ADVISER_ID,FILE_NAME,FILE_URL,CREATE_USER, CREATE_TIME
BOOK_ID, CHANNEL_ID,ADVISER_ID,FILE_NAME,FILE_URL,CREATE_USER, CREATE_TIME, is_paper_book, is_group_book
)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{fileName,jdbcType=VARCHAR},#{fileUrl,jdbcType=VARCHAR},#{createUser,jdbcType=BIGINT},
NOW())
NOW(), #{isPaperBook}, #{isGroupBook})
</insert>
<select id="importCodeRecord" resultType="importRecordVO" parameterType="map">
......@@ -23,6 +23,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<update id="updateState" parameterType="map">
......
......@@ -17,12 +17,14 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthInfo">
INSERT INTO BOOK_AUTH_INFO(
BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE, CREATED_USER, CREATED_DATE,LAST_MODIFIED_DATE,OPEN_TIME
BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE, CREATED_USER, CREATED_DATE,LAST_MODIFIED_DATE,OPEN_TIME,
is_paper_book, is_group_book
)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{price}, #{codeUseCount,jdbcType=BIGINT}, #{buyUrl}, #{checkType},
#{adviserId,jdbcType=BIGINT}, NOW(), NOW(), NOW())
#{adviserId,jdbcType=BIGINT}, NOW(), NOW(), NOW(),
#{isPaperBook}, #{isGroupBook})
</insert>
<select id="getInfoByBook" resultMap="BookAuthInfoMap" parameterType="map">
......@@ -36,6 +38,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<select id="getIsHaveAuthBook" resultType="Boolean" parameterType="Long">
......@@ -49,6 +59,7 @@
ADVISER_ID = #{_parameter, jdbcType=BIGINT}
</select>
<!-- 获取设置过正版授权的图书 -->
<select id="listHaveSetAuthBook" resultType="haveSetAuthBook" parameterType="map">
SELECT
I.ID,A.BOOK_ID as bookId,
......@@ -68,7 +79,7 @@
<if test="isFundSupport != null">
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
</if>
WHERE 1=1
WHERE I.is_paper_book = 1
<if test="typeCode!=null">
AND
B.TYPE_CODE = #{typeCode}
......@@ -83,7 +94,14 @@
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
((B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
<if test="nameList != null and nameList.size > 0">
<foreach collection="nameList" close=" " separator=" " open=" " item="item">
OR
(B.BOOK_NAME LIKE CONCAT('%', '${item}', '%') OR B.ISBN LIKE CONCAT('${item}','%'))
</foreach>
</if>
)
</if>
<if test="isMainEditor != null">
AND
......@@ -108,6 +126,65 @@
I.LAST_MODIFIED_DATE DESC
</select>
<!-- 获取设置过正版授权的社群书 -->
<select id="listHaveSetAuthGroupBook" resultType="haveSetAuthBook" parameterType="map">
SELECT
I.id,
I.book_id AS bookId,
I.channel_id AS channelId,
I.price,
I.adviser_id AS adviserId,
I.book_status AS bookStatus,
B.isbn,
B.book_name AS bookName,
B.cover_img AS coverImg,
B.serial_number AS serialNumber
FROM
book_auth_info I
INNER JOIN book_adviser A ON A.book_id = I.book_id
AND A.channel_id = I.channel_id
AND A.created_user = I.adviser_id
AND A.is_delete = 0
INNER JOIN book_group G ON G.book_id = I.book_id
AND G.channel_id = I.channel_id
AND G.create_user = I.adviser_id
AND G.is_delete = 0
INNER JOIN book B ON I.book_id = B.book_id
AND B.is_delete = 0
WHERE I.is_group_book = 1
AND I.adviser_id = #{adviserId}
<if test="typeCode!=null">
AND
B.type_code = #{typeCode}
</if>
<if test="bookStatus!=null">
AND
I.book_status = #{bookStatus}
</if>
<if test="channelId!=null">
AND
I.channel_id = #{channelId}
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR B.ISBN LIKE CONCAT(#{name},'%'))
</if>
<if test="templetId != null">
AND
A.TEMPLET_ID = #{templetId}
</if>
<if test="secondTempletIds != null and secondTempletIds.size() > 0">
AND
A.SECOND_TEMPLET_ID in
<foreach collection="secondTempletIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
GROUP BY A.BOOK_ID, A.CHANNEL_ID
ORDER BY
I.LAST_MODIFIED_DATE DESC
</select>
<update id="updateBookStatus" parameterType="map" flushCache="true">
UPDATE BOOK_AUTH_INFO
SET
......@@ -131,7 +208,18 @@
LAST_MODIFIED_DATE = NOW(),
LAST_MODIFIED_USER = #{adviserId}
WHERE
BOOK_ID = #{bookId} AND CHANNEL_ID = #{channelId} AND ADVISER_ID = #{adviserId}
BOOK_ID = #{bookId}
AND CHANNEL_ID = #{channelId}
AND ADVISER_ID = #{adviserId}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</update>
<update id="updateBaseInfo" parameterType="bookAuthInfo" flushCache="true">
UPDATE BOOK_AUTH_INFO
......@@ -167,6 +255,8 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
is_paper_book = 1
</select>
<select id="getTotalNum" resultType="Integer" parameterType="map">
......
......@@ -4,9 +4,9 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthOrder">
INSERT INTO BOOK_AUTH_ORDER(
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONEY,ACCOUNT_SETTING_ID,ORDER_NUM,PAYMENT_SOURCE, CREATED_USER, CREATED_DATE)
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONEY,ACCOUNT_SETTING_ID,ORDER_NUM,PAYMENT_SOURCE, CREATED_USER, CREATED_DATE, is_paper_book, is_group_book)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{wechatUserId}, #{money}, #{accountSettingId}, #{orderNum}, #{paymentSource}, #{adviserId}, NOW())
#{wechatUserId}, #{money}, #{accountSettingId}, #{orderNum}, #{paymentSource}, #{adviserId}, NOW(), #{isPaperBook}, #{isGroupBook})
</insert>
</mapper>
\ No newline at end of file
......@@ -4,10 +4,10 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthUser">
INSERT INTO BOOK_AUTH_USER(
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONTHS,province,city,IS_AUTH_CODE, CREATED_DATE,CREATED_USER, CREATED_TIME)
BOOK_ID, CHANNEL_ID,ADVISER_ID,WECHAT_USER_ID,MONTHS,province,city,IS_AUTH_CODE, CREATED_DATE,CREATED_USER, CREATED_TIME, is_paper_book, is_group_book)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{wechatUserId}, #{months}, #{province}, #{city}, #{isAuthCode},NOW(), #{adviserId}, NOW())
#{wechatUserId}, #{months}, #{province}, #{city}, #{isAuthCode},NOW(), #{adviserId}, NOW(), #{isPaperBook}, #{isGroupBook})
</insert>
<select id="getAuthUserCount" resultType="bookAuthCodeUserVO" parameterType="map">
......@@ -22,6 +22,14 @@
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
<select id="getAuthUserCountByMonth" resultType="bookAuthCodeUserVO" parameterType="map">
......@@ -39,7 +47,6 @@
<if test="monthDate!=null">
AND MONTHS = #{monthDate}
</if>
</select>
......@@ -56,6 +63,14 @@
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
WECHAT_USER_ID = #{wechatUserId}
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
</select>
......@@ -76,6 +91,14 @@
<if test="province!=null">
AND PROVINCE = #{province}
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
GROUP BY created_date
</select>
......@@ -146,7 +169,35 @@
<if test="province!=null">
AND PROVINCE = #{province}
</if>
<if test="isPaperBook != null">
AND
is_paper_book = #{isPaperBook}
</if>
<if test="isGroupBook!=null">
AND
is_group_book = #{isGroupBook}
</if>
GROUP BY months
</select>
<select id="checkUserIsHaveAuth" resultType="Boolean" parameterType="map">
SELECT
COUNT(1)
FROM
BOOK_AUTH_USER
WHERE
is_group_book = 1
AND
BOOK_ID = #{bookId, jdbcType=BIGINT}
AND
CHANNEL_ID = #{channelId, jdbcType=BIGINT}
AND
ADVISER_ID = #{adviserId, jdbcType=BIGINT}
AND
WECHAT_USER_ID IN
<foreach collection="wechatUserIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -176,7 +176,7 @@
classify_introduce classifyIntroduce,
price,
change_number changeNumber,
create_user
create_user createUser
from
book_group_classify
where
......
......@@ -180,9 +180,9 @@
and id=#{id}
</select>
<select id="getBaseById" parameterType="Long" resultType="GroupQrcodeBaseInfoVO">
<select id="getBaseById" parameterType="Long" resultType="com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO">
select
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl, weixin_group_id as weixinGroupId
id groupQrcodeId, group_name groupName,qrcode_url qrcodeUrl, weixin_group_id as weixinGroupId, user_number userNumber
from
book_group_qrcode
where
......
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