Commit a38092b1 by 裴大威

获取图书是否开启保护

parent 9e24a4d6
package com.pcloud.book.copyright.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.util.CollectionUtils;
import java.io.Serializable;
import java.util.List;
/**
* @author lily
* @date 2018/12/26 15:35
*/
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookAuthServerDTO implements Serializable {
private static final long serialVersionUID = 9178152999605620185L;
@ApiModelProperty("图书id")
private Long bookId;
@ApiModelProperty("运营标识")
private Long channelId;
@ApiModelProperty("编辑标识")
private Long adviserId;
@ApiModelProperty("服务标识")
private List<Long> serveIds;
public Boolean check(){
return null == bookId || null == channelId || null == adviserId || CollectionUtils.isEmpty(serveIds);
}
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> getServeIds() {
return serveIds;
}
public void setServeIds(List<Long> serveIds) {
this.serveIds = serveIds;
}
@Override
public String toString() {
return "BookAuthServerDTO{" +
"bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", serveIds=" + serveIds +
'}';
}
}
package com.pcloud.book.copyright.service; package com.pcloud.book.copyright.service;
import com.pcloud.book.book.dto.BookAuthServeStatusParam; import com.pcloud.book.book.dto.BookAuthServeStatusParam;
import com.pcloud.book.copyright.dto.BookAuthServerDTO;
import com.pcloud.book.copyright.dto.QrcodeAuthServeDTO; import com.pcloud.book.copyright.dto.QrcodeAuthServeDTO;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -33,4 +34,9 @@ public interface BookAuthServeService { ...@@ -33,4 +34,9 @@ public interface BookAuthServeService {
ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndQrcode(@RequestBody QrcodeAuthServeDTO qrcodeAuthServeDTO) ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndQrcode(@RequestBody QrcodeAuthServeDTO qrcodeAuthServeDTO)
throws BizException; throws BizException;
@ApiOperation(value = "获取应用是否开启版权保护", httpMethod = "POST")
@RequestMapping(value = "/listIsOpen4ServeIdsAndBookId", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndBookId(@RequestBody BookAuthServerDTO bookAuthServerDTO)
throws BizException;
} }
...@@ -39,4 +39,9 @@ public interface BookAuthServeBiz { ...@@ -39,4 +39,9 @@ public interface BookAuthServeBiz {
* @return * @return
*/ */
Map<String,Boolean> listIsOpen4ServeIdsAndQrcode(Long sceneId, List<Long> serveIds); Map<String,Boolean> listIsOpen4ServeIdsAndQrcode(Long sceneId, List<Long> serveIds);
/**
* 获取图书是否开启版权保护
*/
Map<String,Boolean> listIsOpen4ServeIdsAndBookId(Long bookId, Long adviserId, Long channelId, List<Long> serveIds);
} }
...@@ -55,6 +55,7 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz { ...@@ -55,6 +55,7 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
/** /**
* 是否设置应用授权 return key : typeCode_serveId * 是否设置应用授权 return key : typeCode_serveId
*/ */
@Override
@ParamLog("是否设置应用授权") @ParamLog("是否设置应用授权")
public Map<String, Boolean> isSetServeAuth(Long bookId, Long channelId, Long adviserId, List<Long> serveIds) { public Map<String, Boolean> isSetServeAuth(Long bookId, Long channelId, Long adviserId, List<Long> serveIds) {
if (bookId == null || channelId == null || adviserId == null || ListUtils.isEmpty(serveIds)) { if (bookId == null || channelId == null || adviserId == null || ListUtils.isEmpty(serveIds)) {
...@@ -98,6 +99,18 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz { ...@@ -98,6 +99,18 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
return null; return null;
} }
@Override
@ParamLog("listIsOpen4ServeIdsAndBookId")
public Map<String, Boolean> listIsOpen4ServeIdsAndBookId(Long bookId,Long adviserId, Long channelId, List<Long> serveIds) {
BookInfoAndAuthStatusDTO baseAndAuthStatus = bookBiz.getBaseAndAuthStatus(bookId, channelId, adviserId);
final boolean boo = baseAndAuthStatus != null && BookStatusEnum.PROTECT.value.equals(baseAndAuthStatus.getBookStatus())
&& BookStatusEnum.BookDeleteStatus.NOT_DELETE.value.equals(baseAndAuthStatus.getIsDelete());
if (boo) {
return isSetServeAuth(bookId, channelId, adviserId, serveIds);
}
return null;
}
private List<BookAuthServe> changeToBookAuthServe(List<ServeVO> serves, Long bookId, Long channelId, Long adviserId) { private List<BookAuthServe> changeToBookAuthServe(List<ServeVO> serves, Long bookId, Long channelId, Long adviserId) {
List<BookAuthServe> bookAuthServes = new ArrayList<>(); List<BookAuthServe> bookAuthServes = new ArrayList<>();
......
...@@ -2,8 +2,8 @@ package com.pcloud.book.copyright.service.impl; ...@@ -2,8 +2,8 @@ package com.pcloud.book.copyright.service.impl;
import com.pcloud.book.book.dto.BookAuthServeStatusParam; import com.pcloud.book.book.dto.BookAuthServeStatusParam;
import com.pcloud.book.copyright.biz.BookAuthServeBiz; import com.pcloud.book.copyright.biz.BookAuthServeBiz;
import com.pcloud.book.copyright.dto.BookAuthServerDTO;
import com.pcloud.book.copyright.dto.QrcodeAuthServeDTO; import com.pcloud.book.copyright.dto.QrcodeAuthServeDTO;
import com.pcloud.book.copyright.entity.BookAuthServe;
import com.pcloud.book.copyright.service.BookAuthServeService; import com.pcloud.book.copyright.service.BookAuthServeService;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException; import com.pcloud.common.exceptions.BizException;
...@@ -32,7 +32,7 @@ public class BookAuthServeServiceImpl implements BookAuthServeService { ...@@ -32,7 +32,7 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
@PostMapping("listIsOpen4ServeIds") @PostMapping("listIsOpen4ServeIds")
public ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIds(@RequestBody BookAuthServeStatusParam bookAuthServeStatusParam) throws BizException { public ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIds(@RequestBody BookAuthServeStatusParam bookAuthServeStatusParam) throws BizException {
Map<String, Boolean> isOpen4ServeIds = null; Map<String, Boolean> isOpen4ServeIds = null;
if(bookAuthServeStatusParam != null) { if (bookAuthServeStatusParam != null) {
isOpen4ServeIds = bookAuthServeBiz.isSetServeAuth(bookAuthServeStatusParam.getBookId(), bookAuthServeStatusParam.getChannelId(), bookAuthServeStatusParam.getAdviserId(), bookAuthServeStatusParam.getServeIds()); isOpen4ServeIds = bookAuthServeBiz.isSetServeAuth(bookAuthServeStatusParam.getBookId(), bookAuthServeStatusParam.getChannelId(), bookAuthServeStatusParam.getAdviserId(), bookAuthServeStatusParam.getServeIds());
} }
return ResponseHandleUtil.toResponse(isOpen4ServeIds); return ResponseHandleUtil.toResponse(isOpen4ServeIds);
...@@ -42,8 +42,18 @@ public class BookAuthServeServiceImpl implements BookAuthServeService { ...@@ -42,8 +42,18 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
@PostMapping("listIsOpen4ServeIdsAndQrcode") @PostMapping("listIsOpen4ServeIdsAndQrcode")
public ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndQrcode(@RequestBody QrcodeAuthServeDTO qrcodeAuthServeDTO) throws BizException { public ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndQrcode(@RequestBody QrcodeAuthServeDTO qrcodeAuthServeDTO) throws BizException {
Map<String, Boolean> isOpen4ServeIds = null; Map<String, Boolean> isOpen4ServeIds = null;
if(qrcodeAuthServeDTO != null) { if (qrcodeAuthServeDTO != null) {
isOpen4ServeIds = bookAuthServeBiz.listIsOpen4ServeIdsAndQrcode(qrcodeAuthServeDTO.getSceneId(),qrcodeAuthServeDTO.getServeIds()); isOpen4ServeIds = bookAuthServeBiz.listIsOpen4ServeIdsAndQrcode(qrcodeAuthServeDTO.getSceneId(), qrcodeAuthServeDTO.getServeIds());
}
return ResponseHandleUtil.toResponse(isOpen4ServeIds);
}
@Override
@PostMapping("listIsOpen4ServeIdsAndBookId")
public ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndBookId(BookAuthServerDTO bookAuthServerDTO) throws BizException {
Map<String, Boolean> isOpen4ServeIds = null;
if (bookAuthServerDTO != null && !bookAuthServerDTO.check()) {
isOpen4ServeIds = bookAuthServeBiz.listIsOpen4ServeIdsAndBookId(bookAuthServerDTO.getBookId(), bookAuthServerDTO.getAdviserId(), bookAuthServerDTO.getChannelId(), bookAuthServerDTO.getServeIds());
} }
return ResponseHandleUtil.toResponse(isOpen4ServeIds); return ResponseHandleUtil.toResponse(isOpen4ServeIds);
} }
......
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