Commit bd620e1f by 田超

Merge branch 'feature/1005196' into 'master'

feat: [1005196] 视频课作品与题库支持版权保护通过后,通过开关控制收费

See merge request rays/pcloud-book!1380
parents 2ef92ec1 05f160be
......@@ -3,6 +3,7 @@ package com.pcloud.book.book.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
......@@ -10,6 +11,7 @@ import java.io.Serializable;
* @author lily
* @date 2018/12/5 20:51
*/
@Data
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookInfoAndAuthStatusDTO implements Serializable {
......@@ -35,71 +37,6 @@ public class BookInfoAndAuthStatusDTO implements Serializable {
@ApiModelProperty("书刊作者")
private String author;
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public String getBookName() {
return bookName;
}
public void setBookName(String bookName) {
this.bookName = bookName;
}
public String getCoverImg() {
return coverImg;
}
public void setCoverImg(String coverImg) {
this.coverImg = coverImg;
}
public Integer getBookStatus() {
return bookStatus;
}
public void setBookStatus(Integer bookStatus) {
this.bookStatus = bookStatus;
}
public String getPublish() {
return publish;
}
public void setPublish(String publish) {
this.publish = publish;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
@Override
public String toString() {
return "BookInfoAndAuthStatusDTO{" +
"bookId=" + bookId +
", bookName='" + bookName + '\'' +
", coverImg='" + coverImg + '\'' +
", bookStatus=" + bookStatus +
", publish='" + publish + '\'' +
", isDelete=" + isDelete +
'}';
}
@ApiModelProperty("授权后还需付费")
private Integer isAuthorizedPay;
}
......@@ -40,4 +40,9 @@ public interface BookAuthServeService {
ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4ServeIdsAndBookId(@RequestBody BookAuthServerDTO bookAuthServerDTO)
throws BizException;
@ApiOperation(value = "获取应用是否开启授权后仍需付费", httpMethod = "POST")
@PostMapping("listIsOpen4AuthorizedFree")
ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4AuthorizedPay(@RequestBody BookAuthServerDTO bookAuthServerDTO)
throws BizException;
}
......@@ -28,6 +28,11 @@ public interface BookAuthInfoBiz {
void setBookAuthOpen(SetAuthOpenParam setAuthOpenParam, Long adviserId);
/**
* 设置授权后付费查看
*/
void setBookAuthPay(SetAuthStatusParam setAuthStatusParam, Long adviserId);
/**
* 设置图书版权状态
*/
void setAuthStatus(SetAuthStatusParam setAuthStatusParam, Long adviserId);
......
......@@ -23,6 +23,12 @@ public interface BookAuthServeBiz {
Map<String, Boolean> isSetServeAuth(Long bookId, Long channelId, Long adviserId, List<Long> serveIds) ;
/**
* 服务是否开启版权保护,以及授权后仍付费
* @return
*/
Map<String, Boolean> isSetServeAuthPay(Long bookId, Long channelId, Long adviserId, List<Long> serveIds) ;
/**
* 获取图书配置得服务
* @return
*/
......@@ -44,4 +50,9 @@ public interface BookAuthServeBiz {
* 获取图书是否开启版权保护
*/
Map<String,Boolean> listIsOpen4ServeIdsAndBookId(Long bookId, Long adviserId, Long channelId, List<Long> serveIds);
/**
* 获取图书是否开启授权后仍需付费
*/
Map<String, Boolean> listIsOpen4AuthorizedPay(Long bookId, Long adviserId, Long channelId, List<Long> serveIds);
}
......@@ -362,6 +362,28 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
// return zipUrlInfo != null ? zipUrlInfo.getUrl() : null;
// }
@Override
@ParamLog("设置授权后付费查看")
public void setBookAuthPay(SetAuthStatusParam setAuthStatusParam, Long adviserId) {
Long bookId = setAuthStatusParam.getBookId();
Long channelId = setAuthStatusParam.getChannelId();
Integer isAuthorizedPay = setAuthStatusParam.getIsAuthorizedPay();
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, authBookType);
if (bookAuthInfo == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "图书未开启版权保护");
}
bookAuthInfo.setIsAuthorizedPay(isAuthorizedPay);
bookAuthInfoDao.updateAuthorizedPay(bookAuthInfo.getId(), isAuthorizedPay, adviserId);
if(authBookType == null) {
authBookType = 0;
}
String key = CopyrightConstants.BOOK_AUTH_INFO + bookAuthInfo.getBookId() + "-" + bookAuthInfo.getChannelId() + "-" + adviserId + "-" + authBookType;
JedisClusterUtils.setJson(key, bookAuthInfo);
}
@Override
@ParamLog("设置版权保护状态")
......
package com.pcloud.book.copyright.biz.impl;
import cn.hutool.core.collection.CollUtil;
import com.pcloud.book.base.enums.BookStatusEnum;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO;
import com.pcloud.book.consumer.app.AppConsr;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.copyright.biz.BookAuthServeBiz;
import com.pcloud.book.copyright.dao.BookAuthServeDao;
import com.pcloud.book.copyright.dto.ServeDTO;
......@@ -14,6 +17,8 @@ import com.pcloud.channelcenter.qrcode.dto.QrcodeSceneDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.message.common.enums.YesNoEnums;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -35,6 +40,10 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private BookBiz bookBiz;
@Autowired
private AppConsr appConsr;
@Autowired
private ProductConsr productConsr;
@Override
@ParamLog("设置图书授权服务")
......@@ -70,6 +79,36 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
}
@Override
@ParamLog("服务是否开启版权保护,以及授权后仍付费")
public Map<String, Boolean> isSetServeAuthPay(Long bookId, Long channelId, Long adviserId, List<Long> serveIds) {
if (bookId == null || channelId == null || adviserId == null || ListUtils.isEmpty(serveIds)) {
return null;
}
List<ServeDTO> serveDTOS = bookAuthServeDao.isSetServeAuth(bookId, channelId, adviserId, serveIds);
if (ListUtils.isEmpty(serveDTOS)) {
return null;
}
Map<String, Boolean> isSetServesMap = new HashMap<>();
List<Long> productIds = CollUtil.toList();
for (ServeDTO serveDTO : serveDTOS) {
if(serveDTO.getServeType().equalsIgnoreCase("product")){
productIds.add(serveDTO.getServeId());
}
}
// TAPD:1005196 目前只支持视频、题库等作品
List<String> openAuthPayProductTypeCodeList = CollUtil.toList("VIDEO", "PRETEST");
Map<Long, ProductDto> productMap = productConsr.getProBasesByIds(productIds);
if(CollUtil.isNotEmpty(productMap)){
for (ProductDto productDto : productMap.values()) {
if(productDto.getProductTypeDto() != null && openAuthPayProductTypeCodeList.contains(productDto.getProductTypeDto().getTypeCode())){
isSetServesMap.put("PRODUCT" + productDto.getProductId(), true);
}
}
}
return isSetServesMap;
}
@Override
public List<ServeVO> listServesByBook(Long bookId, Long channelId, Long adviserId) {
return bookAuthServeDao.listServesByBook(bookId, channelId, adviserId);
}
......@@ -132,4 +171,15 @@ public class BookAuthServeBizImpl implements BookAuthServeBiz {
bookAuthServeDao.deleteServes(ids);
}
@Override
public Map<String, Boolean> listIsOpen4AuthorizedPay(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())
&& YesNoEnums.YES.code.equals(baseAndAuthStatus.getIsAuthorizedPay());
if (boo) {
return isSetServeAuthPay(bookId, channelId, adviserId, serveIds);
}
return null;
}
}
package com.pcloud.book.copyright.biz.impl;
import cn.hutool.core.collection.CollUtil;
import com.google.common.collect.Lists;
import com.pcloud.book.base.exception.BookBizException;
......@@ -7,6 +8,7 @@ import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.live.LiveCons;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.copyright.biz.BookAuthServeBiz;
import com.pcloud.book.copyright.biz.BookAuthUserBiz;
import com.pcloud.book.copyright.dao.BookAuthServeDao;
import com.pcloud.book.copyright.dao.BookAuthUserDao;
......@@ -70,6 +72,8 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
private ProductConsr productConsr;
@Autowired
private ReaderConsr readerConsr;
@Autowired
private BookAuthServeBiz bookAuthServeBiz;
@ParamLog(value = "获取授权用户数量")
......@@ -217,13 +221,23 @@ public class BookAuthUserBizImpl implements BookAuthUserBiz {
List<Long> serverIds = new ArrayList<>();
serverIds.add(serverId);
List<ServeDTO> serveDTOS = bookAuthServeDao.isSetServeAuth(bookId, channelId, adviserId, serverIds);
// 用户被授权, 且指定的应用也被版权保护时, 返回true
return !ListUtils.isEmpty(serveDTOS);
// 获取授权后是否仍需付费
Boolean isAuthorizedPay = checkIsAuthorizedPay(bookId, channelId, adviserId, serverId);
// 用户被授权, 指定的应用也被版权保护,且授权后不需要付费,则返回true
return !ListUtils.isEmpty(serveDTOS) && !isAuthorizedPay;
}
// 其余情况都是false
return false;
}
private Boolean checkIsAuthorizedPay(Long bookId, Long channelId, Long adviserId, Long serverId) {
Map<String, Boolean> authorizedPayMap = bookAuthServeBiz.listIsOpen4AuthorizedPay(bookId, channelId, adviserId, CollUtil.toList(serverId));
if(CollUtil.isEmpty(authorizedPayMap)){
return false;
}
return authorizedPayMap.getOrDefault("PRODUCT" + serverId, false);
}
// 判断是否为超级作者的商品
private Boolean checkIsSuperProduct(Long serverId) {
Map<Long, Boolean> map = productConsr.getIsSuperByProductIdList(Lists.newArrayList(serverId));
......
......@@ -38,6 +38,11 @@ public interface BookAuthInfoDao extends BaseDao<BookAuthInfo> {
void updateBookStatus(Long id, Integer bookStatus, Long adviserId);
/**
* 更新图书授权付费
*/
void updateAuthorizedPay(Long id, Integer isAuthorizedPay, Long adviserId);
/**
* 更新图书版权基本信息
*/
void updateBaseInfo(BookAuthInfo bookAuthInfo);
......
......@@ -66,6 +66,15 @@ public class BookAuthInfoDaoImpl extends BaseDaoImpl<BookAuthInfo> implements Bo
}
@Override
public void updateAuthorizedPay(Long id, Integer isAuthorizedPay, Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("id", id);
paramMap.put("isAuthorizedPay", isAuthorizedPay);
paramMap.put("adviserId", adviserId);
this.getSqlSession().update(this.getStatement("updateAuthorizedPay"), paramMap);
}
@Override
public void updateBaseInfo(BookAuthInfo bookAuthInfo) {
this.getSqlSession().update(this.getStatement("updateBaseInfo"), bookAuthInfo);
}
......
......@@ -3,6 +3,7 @@ package com.pcloud.book.copyright.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
......@@ -11,6 +12,7 @@ import java.util.Date;
* @author lily
* @date 2018/12/3 11:14
*/
@Data
@ApiModel
public class BookAuthInfo extends BaseEntity {
@ApiModelProperty("图书授权信息标识")
......@@ -67,173 +69,7 @@ public class BookAuthInfo extends BaseEntity {
@ApiModelProperty("是否是社群书")
private Integer isGroupBook;
@Override
public Long getId() {
return id;
}
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
@Override
public void setId(Long id) {
this.id = id;
}
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 BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getCodeUseCount() {
return codeUseCount;
}
public void setCodeUseCount(Integer codeUseCount) {
this.codeUseCount = codeUseCount;
}
public String getBuyUrl() {
return buyUrl;
}
public void setBuyUrl(String buyUrl) {
this.buyUrl = buyUrl;
}
public Integer getBookStatus() {
return bookStatus;
}
public void setBookStatus(Integer bookStatus) {
this.bookStatus = bookStatus;
}
public String getLocationDesc() {
return locationDesc;
}
public void setLocationDesc(String locationDesc) {
this.locationDesc = locationDesc;
}
public Long getCreatedUser() {
return createdUser;
}
public void setCreatedUser(Long createdUser) {
this.createdUser = createdUser;
}
public Date getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
this.createdDate = createdDate;
}
public Long getLastModifiedUser() {
return lastModifiedUser;
}
public void setLastModifiedUser(Long lastModifiedUser) {
this.lastModifiedUser = lastModifiedUser;
}
public Date getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Date lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public Integer getCheckType() {
return checkType;
}
public void setCheckType(Integer checkType) {
this.checkType = checkType;
}
public Date getOpenTime() {
return openTime;
}
public void setOpenTime(Date openTime) {
this.openTime = openTime;
}
public Date getCloseTime() {
return closeTime;
}
public void setCloseTime(Date closeTime) {
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{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", price=" + price +
", codeUseCount=" + codeUseCount +
", buyUrl='" + buyUrl + '\'' +
", bookStatus=" + bookStatus +
", locationDesc='" + locationDesc + '\'' +
", checkType=" + checkType +
", createdUser=" + createdUser +
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", openTime=" + openTime +
", closeTime=" + closeTime +
", isPaperBook=" + isPaperBook +
", isGroupBook=" + isGroupBook +
'}';
}
}
......@@ -17,6 +17,7 @@ import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -47,6 +48,14 @@ public class BookAuthInfoFacadeImpl implements BookAuthInfoFacade {
return new ResponseDto<>();
}
@ApiOperation("设置授权后付费查看")
@PostMapping("setBookAuthPay")
public ResponseDto<?> setBookAuthPay(@RequestHeader("token") String token, @RequestBody SetAuthStatusParam setAuthStatusParam) throws PermissionException, BizException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookAuthInfoBiz.setBookAuthPay(setAuthStatusParam, adviserId);
return new ResponseDto<>();
}
@Override
@PostMapping("setAuthStatus")
public ResponseDto<?> setAuthStatus(@RequestHeader("token") String token, @RequestBody SetAuthStatusParam setAuthStatusParam) throws PermissionException, BizException {
......
......@@ -58,4 +58,14 @@ public class BookAuthServeServiceImpl implements BookAuthServeService {
}
return ResponseHandleUtil.toResponse(isOpen4ServeIds);
}
@Override
@PostMapping("listIsOpen4AuthorizedPay")
public ResponseEntity<ResponseDto<Map<String, Boolean>>> listIsOpen4AuthorizedPay(@RequestBody BookAuthServerDTO bookAuthServerDTO) throws BizException {
Map<String, Boolean> isOpen4ServeIds = null;
if (bookAuthServerDTO != null && !bookAuthServerDTO.check()) {
isOpen4ServeIds = bookAuthServeBiz.listIsOpen4AuthorizedPay(bookAuthServerDTO.getBookId(), bookAuthServerDTO.getAdviserId(), bookAuthServerDTO.getChannelId(), bookAuthServerDTO.getServeIds());
}
return ResponseHandleUtil.toResponse(isOpen4ServeIds);
}
}
......@@ -52,6 +52,9 @@ public class BookAuthInfoAndServesVO implements Serializable {
@ApiModelProperty("是否有使用过的授权码")
private Boolean haveUsedAuthCode;
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
public Long getId() {
return id;
......@@ -149,6 +152,14 @@ public class BookAuthInfoAndServesVO implements Serializable {
this.haveUsedAuthCode = haveUsedAuthCode;
}
public Integer getIsAuthorizedPay() {
return isAuthorizedPay;
}
public void setIsAuthorizedPay(Integer isAuthorizedPay) {
this.isAuthorizedPay = isAuthorizedPay;
}
@Override
public String toString() {
return "BookAuthInfoAndServesVO{" +
......
......@@ -3,6 +3,7 @@ package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -11,6 +12,7 @@ import java.math.BigDecimal;
* @author lily
* @date 2018/12/4 11:50
*/
@Data
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookAuthInfoVO implements Serializable {
......@@ -45,100 +47,7 @@ public class BookAuthInfoVO implements Serializable {
@ApiModelProperty("位置描述")
private String locationDesc;
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
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 BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getCodeUseCount() {
return codeUseCount;
}
public void setCodeUseCount(Integer codeUseCount) {
this.codeUseCount = codeUseCount;
}
public String getBuyUrl() {
return buyUrl;
}
public void setBuyUrl(String buyUrl) {
this.buyUrl = buyUrl;
}
public Integer getBookStatus() {
return bookStatus;
}
public void setBookStatus(Integer bookStatus) {
this.bookStatus = bookStatus;
}
public Integer getCheckType() {
return checkType;
}
public void setCheckType(Integer checkType) {
this.checkType = checkType;
}
public String getLocationDesc() {
return locationDesc;
}
public void setLocationDesc(String locationDesc) {
this.locationDesc = locationDesc;
}
@Override
public String toString() {
return "BookAuthInfoVO{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", price=" + price +
", codeUseCount=" + codeUseCount +
", buyUrl='" + buyUrl + '\'' +
", bookStatus=" + bookStatus +
", checkType=" + checkType +
", locationDesc='" + locationDesc + '\'' +
'}';
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.copyright.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
......@@ -12,6 +13,7 @@ import java.util.List;
* @author lily
* @date 2018/12/3 11:26
*/
@Data
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SetAuthOpenParam implements Serializable {
......@@ -49,108 +51,7 @@ public class SetAuthOpenParam implements Serializable {
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
public List<ServeVO> getServes() {
return serves;
}
public void setServes(List<ServeVO> serves) {
this.serves = serves;
}
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 Integer getBookStatus() {
return bookStatus;
}
public void setBookStatus(Integer bookStatus) {
this.bookStatus = bookStatus;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
public Integer getCodeUseCount() {
return codeUseCount;
}
public void setCodeUseCount(Integer codeUseCount) {
this.codeUseCount = codeUseCount;
}
public Integer getCodeCount() {
return codeCount;
}
public void setCodeCount(Integer codeCount) {
this.codeCount = codeCount;
}
public String getBuyUrl() {
return buyUrl;
}
public void setBuyUrl(String buyUrl) {
this.buyUrl = buyUrl;
}
public Integer getCheckType() {
return checkType;
}
public void setCheckType(Integer checkType) {
this.checkType = checkType;
}
public Integer getIsHaveBarCode() {
return isHaveBarCode;
}
public void setIsHaveBarCode(Integer isHaveBarCode) {
this.isHaveBarCode = isHaveBarCode;
}
public Integer getAuthBookType() {
return authBookType;
}
public void setAuthBookType(Integer authBookType) {
this.authBookType = authBookType;
}
@Override
public String toString() {
return "SetAuthOpenParam{" +
"bookId=" + bookId +
", channelId=" + channelId +
", price=" + price +
", codeUseCount=" + codeUseCount +
", codeCount=" + codeCount +
", buyUrl='" + buyUrl + '\'' +
", bookStatus=" + bookStatus +
", checkType=" + checkType +
", serves=" + serves +
", isHaveBarCode=" + isHaveBarCode +
", authBookType=" + authBookType +
'}';
}
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
}
......@@ -28,6 +28,9 @@ public class SetAuthStatusParam implements Serializable {
@ApiModelProperty("书刊类型:0-现代纸书 1-社群书")
private Integer authBookType;
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
public Integer getBookStatus() {
return bookStatus;
}
......@@ -60,6 +63,14 @@ public class SetAuthStatusParam implements Serializable {
this.authBookType = authBookType;
}
public Integer getIsAuthorizedPay() {
return isAuthorizedPay;
}
public void setIsAuthorizedPay(Integer isAuthorizedPay) {
this.isAuthorizedPay = isAuthorizedPay;
}
@Override
public String toString() {
return "SetAuthStatusParam{" +
......
......@@ -13,23 +13,24 @@
<result column="LOCATION_DESC" property="locationDesc" jdbcType="VARCHAR" />
<result column="BOOK_STATUS" property="bookStatus" jdbcType="TINYINT" />
<result column="check_type" property="checkType" jdbcType="TINYINT" />
<result column="is_authorized_pay" property="isAuthorizedPay" jdbcType="TINYINT" />
</resultMap>
<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,
is_paper_book, is_group_book
is_paper_book, is_group_book, is_authorized_pay
)
VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{price}, #{codeUseCount,jdbcType=BIGINT}, #{buyUrl}, #{checkType},
#{adviserId,jdbcType=BIGINT}, NOW(), NOW(), NOW(),
#{isPaperBook}, #{isGroupBook})
#{isPaperBook}, #{isGroupBook}, IFNULL(#{isAuthorizedPay},0))
</insert>
<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
ID, BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE,BOOK_STATUS,LOCATION_DESC, is_authorized_pay
FROM
BOOK_AUTH_INFO
WHERE
......@@ -215,6 +216,16 @@
ID = #{id}
</update>
<update id="updateAuthorizedPay" parameterType="map" flushCache="true">
UPDATE BOOK_AUTH_INFO
SET
is_authorized_pay = #{isAuthorizedPay},
LAST_MODIFIED_DATE = NOW(),
LAST_MODIFIED_USER = #{adviserId}
WHERE
ID = #{id}
</update>
<update id="updateLocationDesc" parameterType="bookAuthInfo" flushCache="true">
UPDATE BOOK_AUTH_INFO
SET
......@@ -253,6 +264,9 @@
<if test="lastModifiedUser != null">
LAST_MODIFIED_USER = #{lastModifiedUser, jdbcType=BIGINT},
</if>
<if test="isAuthorizedPay != null">
is_authorized_pay = #{isAuthorizedPay},
</if>
LAST_MODIFIED_DATE = NOW()
WHERE
ID = #{id}
......@@ -294,4 +308,4 @@
</if>
</select>
</mapper>
\ No newline at end of file
</mapper>
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