Commit c22cef68 by 郑勇

feat: [1006018] 视频应用单个资源二维码支持输入版权保护码

parent dd7cc2f5
......@@ -3,6 +3,7 @@
*/
package com.pcloud.book.consumer.channel;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.pcloud.book.base.exception.BookBizException;
......@@ -20,6 +21,8 @@ import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrAskVO;
import com.pcloud.channelcenter.qrcode.vo.BookAssocLastQrVO;
import com.pcloud.channelcenter.qrcode.vo.BookAssocQRcountRequestVO;
import com.pcloud.channelcenter.qrcode.vo.BookQrcodeVO;
import com.pcloud.channelcenter.qrcode.vo.MessageAssocBookAskInfoVO;
import com.pcloud.channelcenter.qrcode.vo.MessageAssocBookInfoVO;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.channelcenter.wechat.dto.AdviserBookResourceNumReqDTO;
import com.pcloud.channelcenter.wechat.dto.AdviserBookResourceNumRespDTO;
......@@ -644,4 +647,22 @@ public class QrcodeSceneConsr {
}
return qrcode;
}
/**
* 获取最近关联图书相关信息
* @param messageAssocBookAskInfoVOS
* @return
*/
public Map<String, MessageAssocBookInfoVO> getLastBookInfoByServe(List<MessageAssocBookAskInfoVO> messageAssocBookAskInfoVOS) {
Map<String, MessageAssocBookInfoVO> result=new HashMap<>();
if (CollUtil.isEmpty(messageAssocBookAskInfoVOS)) {
return result;
}
try {
result = ResponseHandleUtil.parseMap(qrcodeSceneService.getLastBookInfoByServe(messageAssocBookAskInfoVOS), String.class,MessageAssocBookInfoVO.class);
} catch (Exception e) {
LOGGER.error("获取最近关联图书相关信息失败"+e.getMessage(), e);
}
return result;
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.copyright.biz;
import com.pcloud.book.copyright.dto.BookAuthCodeDTO;
import com.pcloud.book.copyright.dto.DeleteAuthCodeDTO;
import com.pcloud.book.copyright.entity.BookAuthCode;
import com.pcloud.book.copyright.vo.CheckAppServeVO;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
import com.pcloud.book.copyright.vo.FileVO;
......@@ -89,4 +90,9 @@ public interface BookAuthCodeBiz {
* 一键清空未使用的授权码
*/
void deleteNoUsedAuthCode(DeleteAuthCodeDTO deleteAuthCodeDTO, Long adviserId);
/**
* 扫应用里面单个资源码也要版权保护
*/
CheckAppServeVO checkAppServe(CheckIsAuthServeParam checkIsAuthServeParam, Long channelId, Long wechatUserId);
}
......@@ -26,11 +26,14 @@ 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.CheckAppServeVO;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
import com.pcloud.book.copyright.vo.FileVO;
import com.pcloud.book.copyright.vo.ImportRecordVO;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.qrcode.vo.MessageAssocBookAskInfoVO;
import com.pcloud.channelcenter.qrcode.vo.MessageAssocBookInfoVO;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.biz.MessageBiz;
import com.pcloud.common.core.constant.SystemCode;
......@@ -81,6 +84,9 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.stream.Collectors;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import static com.pcloud.book.util.common.ExcelUtils.getColumnTopStyle;
import static com.pcloud.book.util.common.ExcelUtils.getDataStyle;
......@@ -594,4 +600,66 @@ public class BookAuthCodeBizImpl implements BookAuthCodeBiz {
}
this.batchDeleteCode(codeIds);
}
@Override
public CheckAppServeVO checkAppServe(CheckIsAuthServeParam checkIsAuthServeParam, Long channelId, Long wechatUserId) {
if (ObjectUtil.hasEmpty(checkIsAuthServeParam,checkIsAuthServeParam.getServeId(),checkIsAuthServeParam.getServeType())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "请选择要进入的服务");
}
CheckAppServeVO result=new CheckAppServeVO();
Long serveId = checkIsAuthServeParam.getServeId();
String serveType = checkIsAuthServeParam.getServeType();
Long adviserId=checkIsAuthServeParam.getAdviserId();
//1。先根据应用信息找到最近挂的一本书
MessageAssocBookAskInfoVO vo=new MessageAssocBookAskInfoVO();
vo.setAdviserId(adviserId);
vo.setFromId(serveId);
vo.setTypeCode(serveType);
Map<String, MessageAssocBookInfoVO> infoByServe = qrcodeSceneConsr.getLastBookInfoByServe(Lists.newArrayList(vo));
Long bookId=null;
Long sceneId=null;
String key = serveType + serveId;
if(CollUtil.isNotEmpty(infoByServe) && infoByServe.containsKey(key)){
MessageAssocBookInfoVO messageAssocBookInfoVO = infoByServe.get(key);
if(null!=messageAssocBookInfoVO){
bookId=messageAssocBookInfoVO.getBookId();
channelId=messageAssocBookInfoVO.getChannelId();
sceneId=messageAssocBookInfoVO.getSceneId();
}
}
//校验图书是否开启保护
BookAuthInfoVO authBookInfo = bookAuthInfoBiz.getAuthBookInfo(bookId, channelId, adviserId, null,null);
if (authBookInfo == null || BookStatusEnum.NO_SET.value.equals(authBookInfo.getBookStatus())) {
result.setNeedCheck(false);
return result;
}
//升级版的版权保护不需要验证
if (null!=authBookInfo.getAuthType() && 2==authBookInfo.getAuthType()) {
result.setNeedCheck(false);
return result;
}
bookId = authBookInfo.getBookId();
adviserId = authBookInfo.getAdviserId();
List<Long> serveIds = new ArrayList<>();
serveIds.add(serveId);
Map<String, Boolean> isHaveServe = qrcodeSceneConsr.listIsInBook(bookId, channelId, adviserId, serveIds);
if (isHaveServe == null) {
result.setNeedCheck(false);
return result;
}
//校验服务是否需要授权
Boolean isNeedAuth = bookAuthServeBiz.checkIsNeedAuth(bookId, channelId, adviserId, serveId, serveType);
if (!isNeedAuth) {
result.setNeedCheck(false);
return result;
}
//校验用户是否已经授权过
Boolean isHaveAuth = bookAuthUserBiz.checkIsHaveAuth(bookId, channelId, adviserId, wechatUserId,null,null,null);
result.setNeedCheck(!isHaveAuth);
result.setAdviserId(adviserId);
result.setChannelId(channelId);
result.setBookId(bookId);
result.setSceneId(sceneId);
return result;
}
}
......@@ -10,6 +10,7 @@ import com.pcloud.book.copyright.dto.DeleteAuthCodeDTO;
import com.pcloud.book.copyright.entity.BookExportRecord;
import com.pcloud.book.copyright.facade.BookAuthCodeFacade;
import com.pcloud.book.copyright.vo.AuthOpenVO;
import com.pcloud.book.copyright.vo.CheckAppServeVO;
import com.pcloud.book.copyright.vo.CheckAuthCodeVO;
import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
......@@ -294,4 +295,19 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
Map<String, Object> map = bookSceneAuthBiz.exportSceneAuthCode(bookId,codeIds, channelId,sceneId, status, systemCode, partyId, authBookType);
return new ResponseDto<>(map);
}
/**
* 扫应用里面单个资源码也要版权保护
*/
@RequestMapping(value = "/checkAppServe", method = RequestMethod.POST)
public ResponseDto<?> checkAppServe(@CookieValue("userInfo") String userInfo, @RequestBody CheckIsAuthServeParam checkIsAuthServeParam)
throws PermissionException, JsonParseException, BizException {
Long channelId = checkIsAuthServeParam.getChannelId();
if(channelId == null){
channelId = Cookie.getId(userInfo, Cookie._CHANNEL_ID);
}
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
CheckAppServeVO result = bookAuthCodeBiz.checkAppServe(checkIsAuthServeParam, channelId, wechatUserId);
return new ResponseDto<>(result);
}
}
......@@ -53,4 +53,7 @@ public class BookAuthInfoVO implements Serializable {
@ApiModelProperty("打开支付功能;0:关闭;1:开启;")
private Integer openPay;
@ApiModelProperty("授权类型(1-旧版-二维码+授权码,2-升级,二维码)")
private Integer authType;
}
package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import java.math.BigDecimal;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2018/12/4 11:50
*/
@Data
@ApiModel
public class CheckAppServeVO {
@ApiModelProperty("图书标识")
private Long bookId;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("二维码id")
private Long sceneId;
@ApiModelProperty("是否需要版权保护")
private Boolean needCheck;
}
......@@ -15,6 +15,7 @@
<result column="check_type" property="checkType" jdbcType="TINYINT" />
<result column="is_authorized_pay" property="isAuthorizedPay" jdbcType="TINYINT" />
<result column="open_pay" property="openPay" jdbcType="TINYINT" />
<result column="auth_type" property="authType" jdbcType="TINYINT" />
</resultMap>
<insert id="insert" useGeneratedKeys="true" parameterType="bookAuthInfo">
......@@ -31,7 +32,7 @@
<select id="getInfoByBook" resultMap="BookAuthInfoMap" parameterType="map">
SELECT
ID, BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE,BOOK_STATUS,LOCATION_DESC, is_authorized_pay, open_pay
ID, BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE,BOOK_STATUS,LOCATION_DESC, is_authorized_pay, open_pay,auth_type
FROM
BOOK_AUTH_INFO
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