Commit 55b1a1a7 by Administrator

Merge branch 'feature/1004716' into 'master'

feat: [1004716] 编辑运营优化需求

See merge request rays/pcloud-book!1301
parents 0358c48d 5d58b3c8
...@@ -49,4 +49,8 @@ public interface BookResourceService { ...@@ -49,4 +49,8 @@ public interface BookResourceService {
@RequestMapping(value = "/listByResourceId", method = RequestMethod.GET) @RequestMapping(value = "/listByResourceId", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<List<Long>>> listByResourceId(@RequestParam("resourceId") Long resourceId); public ResponseEntity<ResponseDto<List<Long>>> listByResourceId(@RequestParam("resourceId") Long resourceId);
@ApiOperation(value = "获取资源关联的图书", httpMethod = "GET")
@RequestMapping(value = "/getSceneIdsByResourceId", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<List<Long>>> getSceneIdsByResourceId(@RequestParam("resourceId") Long resourceId);
} }
...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.pcloud.book.book.biz.BookResourceBiz; import com.pcloud.book.book.biz.BookResourceBiz;
import com.pcloud.book.book.dto.BookResourceDto; import com.pcloud.book.book.dto.BookResourceDto;
import com.pcloud.book.book.service.BookResourceService; import com.pcloud.book.book.service.BookResourceService;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.ResponseHandleUtil; import com.pcloud.common.utils.ResponseHandleUtil;
...@@ -29,6 +30,8 @@ public class BookResourceServiceImpl implements BookResourceService { ...@@ -29,6 +30,8 @@ public class BookResourceServiceImpl implements BookResourceService {
@Autowired @Autowired
private BookResourceBiz bookResourceBiz; private BookResourceBiz bookResourceBiz;
@Autowired
private ResourcePageBiz resourcePageBiz;
/** /**
* 获取图书关联资源 * 获取图书关联资源
...@@ -50,4 +53,13 @@ public class BookResourceServiceImpl implements BookResourceService { ...@@ -50,4 +53,13 @@ public class BookResourceServiceImpl implements BookResourceService {
public ResponseEntity<ResponseDto<List<Long>>> listByResourceId(@RequestParam("resourceId") Long resourceId) { public ResponseEntity<ResponseDto<List<Long>>> listByResourceId(@RequestParam("resourceId") Long resourceId) {
return ResponseHandleUtil.toResponse(bookResourceBiz.listByResourceId(resourceId)); return ResponseHandleUtil.toResponse(bookResourceBiz.listByResourceId(resourceId));
} }
/**
* 获取h5页面配了这个资源的二维码集合
*/
@Override
@RequestMapping(value = "/getSceneIdsByResourceId", method = RequestMethod.GET)
public ResponseEntity<ResponseDto<List<Long>>> getSceneIdsByResourceId(@RequestParam("resourceId") Long resourceId) {
return ResponseHandleUtil.toResponse(resourcePageBiz.getSceneIdsByResourceId(resourceId));
}
} }
package com.pcloud.book.copyright.biz; package com.pcloud.book.copyright.biz;
import com.pcloud.book.copyright.dto.BookExportRecordDTO;
import com.pcloud.book.copyright.entity.BookExportRecord; import com.pcloud.book.copyright.entity.BookExportRecord;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
/** /**
* @author lily * @author lily
...@@ -29,4 +32,10 @@ public interface BookExportRecordBiz { ...@@ -29,4 +32,10 @@ public interface BookExportRecordBiz {
void updateRecord(BookExportRecord bookExportRecord); void updateRecord(BookExportRecord bookExportRecord);
void handleExportFail(); void handleExportFail();
/**
* 查看授权码生成记录
*/
PageBeanNew<BookExportRecordDTO> getGenerateCodeHistory(Long bookId, Long adviserId, Long channelId, PageParam pageParam);
} }
...@@ -171,7 +171,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz { ...@@ -171,7 +171,7 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
Integer batchNum = bookAuthCodeBiz.getMaxBatchNum(bookId, channelId, adviserId, authBookType);// TODO Integer batchNum = bookAuthCodeBiz.getMaxBatchNum(bookId, channelId, adviserId, authBookType);// TODO
num = String.format("%04d", batchNum); num = String.format("%04d", batchNum);
//新增导出记录 //新增导出记录
insertExportRecord(bookId, channelId, adviserId, num); insertExportRecord(bookId, channelId, adviserId, num,codeCount,isHaveBarCode);
//获取图书名称 //获取图书名称
BookDto bookDto = bookBiz.getBaseById(bookId); BookDto bookDto = bookBiz.getBaseById(bookId);
if (bookDto == null) { if (bookDto == null) {
...@@ -260,12 +260,14 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz { ...@@ -260,12 +260,14 @@ public class BookAuthInfoBizImpl implements BookAuthInfoBiz {
} }
@ParamLog("新增导出记录") @ParamLog("新增导出记录")
private void insertExportRecord(Long bookId, Long channelId, Long adviserId, String num) { private void insertExportRecord(Long bookId, Long channelId, Long adviserId, String num,Integer codeCount, Integer isHaveBarCode) {
BookExportRecord bookExportRecord = new BookExportRecord(); BookExportRecord bookExportRecord = new BookExportRecord();
bookExportRecord.setBookId(bookId); bookExportRecord.setBookId(bookId);
bookExportRecord.setAdviserId(adviserId); bookExportRecord.setAdviserId(adviserId);
bookExportRecord.setChannelId(channelId); bookExportRecord.setChannelId(channelId);
bookExportRecord.setBatchNum(num); bookExportRecord.setBatchNum(num);
bookExportRecord.setCodeCount(codeCount);
bookExportRecord.setIsHaveBarCode(isHaveBarCode);
bookExportRecordBiz.insertRecord(bookExportRecord); bookExportRecordBiz.insertRecord(bookExportRecord);
} }
......
...@@ -2,10 +2,18 @@ package com.pcloud.book.copyright.biz.impl; ...@@ -2,10 +2,18 @@ package com.pcloud.book.copyright.biz.impl;
import com.pcloud.book.copyright.biz.BookExportRecordBiz; import com.pcloud.book.copyright.biz.BookExportRecordBiz;
import com.pcloud.book.copyright.dao.BookExportRecordDao; import com.pcloud.book.copyright.dao.BookExportRecordDao;
import com.pcloud.book.copyright.dto.BookExportRecordDTO;
import com.pcloud.book.copyright.entity.BookExportRecord; import com.pcloud.book.copyright.entity.BookExportRecord;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/** /**
* @author lily * @author lily
* @date 2018/12/4 19:14 * @date 2018/12/4 19:14
...@@ -41,4 +49,37 @@ public class BookExportRecordBizImpl implements BookExportRecordBiz { ...@@ -41,4 +49,37 @@ public class BookExportRecordBizImpl implements BookExportRecordBiz {
public void handleExportFail() { public void handleExportFail() {
bookExportRecordDao.handleExportFail(); bookExportRecordDao.handleExportFail();
} }
@Override
public PageBeanNew<BookExportRecordDTO> getGenerateCodeHistory(Long bookId, Long adviserId, Long channelId, PageParam pageParam) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("bookId",bookId);
paramMap.put("channelId",channelId);
paramMap.put("adviserId",adviserId);
PageBeanNew<BookExportRecordDTO> pageBeanNew = bookExportRecordDao.listPageNew(pageParam, paramMap, "getGenerateCodeHistory");
if(pageBeanNew == null || CollectionUtils.isEmpty(pageBeanNew.getRecordList())){
return pageBeanNew;
}
//填充导出格式
pageBeanNew.getRecordList().forEach(e->{
e.setImportType(getImportType(e.getIsHaveBarCode()));
});
return pageBeanNew;
}
private String getImportType(Integer type){
if(null==type){
return "";
}
switch (type){
case 0:
return "正版授权码+条形码";
case 1:
return "正版授权码";
case 2:
return "二维码";
default: return "";
}
}
} }
package com.pcloud.book.copyright.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2018/12/4 19:21
*/
@ApiModel
@Data
public class BookExportRecordDTO extends BaseEntity {
@ApiModelProperty("下载地址")
private String downloadUrl;
@ApiModelProperty("生成码数量")
private Integer codeCount;
@ApiModelProperty("导出格式")
private Integer isHaveBarCode;
@ApiModelProperty("导出格式中文")
private String importType;
@ApiModelProperty("最后修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date lastModifiedDate;
}
...@@ -3,6 +3,7 @@ package com.pcloud.book.copyright.entity; ...@@ -3,6 +3,7 @@ package com.pcloud.book.copyright.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date; import java.util.Date;
...@@ -11,6 +12,7 @@ import java.util.Date; ...@@ -11,6 +12,7 @@ import java.util.Date;
* @date 2018/12/4 19:21 * @date 2018/12/4 19:21
*/ */
@ApiModel @ApiModel
@Data
public class BookExportRecord extends BaseEntity { public class BookExportRecord extends BaseEntity {
private Long id; private Long id;
...@@ -44,110 +46,11 @@ public class BookExportRecord extends BaseEntity { ...@@ -44,110 +46,11 @@ public class BookExportRecord extends BaseEntity {
@ApiModelProperty("导出状态") @ApiModelProperty("导出状态")
private Integer exportStatus; private Integer exportStatus;
@Override
public Long getId() { @ApiModelProperty("生成码数量")
return id; private Integer codeCount;
}
@ApiModelProperty("导出格式")
@Override private Integer isHaveBarCode;
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 String getBatchNum() {
return batchNum;
}
public void setBatchNum(String batchNum) {
this.batchNum = batchNum;
}
public String getDownloadUrl() {
return downloadUrl;
}
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
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 getExportStatus() {
return exportStatus;
}
public void setExportStatus(Integer exportStatus) {
this.exportStatus = exportStatus;
}
@Override
public String toString() {
return "BookExportRecord{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", adviserId=" + adviserId +
", batchNum='" + batchNum + '\'' +
", downloadUrl='" + downloadUrl + '\'' +
", createdUser=" + createdUser +
", createdDate=" + createdDate +
", lastModifiedUser=" + lastModifiedUser +
", lastModifiedDate=" + lastModifiedDate +
", exportStatus=" + exportStatus +
'}';
}
} }
...@@ -2,8 +2,11 @@ package com.pcloud.book.copyright.facade.impl; ...@@ -2,8 +2,11 @@ package com.pcloud.book.copyright.facade.impl;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.copyright.biz.BookAuthCodeBiz; import com.pcloud.book.copyright.biz.BookAuthCodeBiz;
import com.pcloud.book.copyright.biz.BookExportRecordBiz;
import com.pcloud.book.copyright.dto.BookAuthCodeDTO; import com.pcloud.book.copyright.dto.BookAuthCodeDTO;
import com.pcloud.book.copyright.dto.BookExportRecordDTO;
import com.pcloud.book.copyright.dto.DeleteAuthCodeDTO; 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.facade.BookAuthCodeFacade;
import com.pcloud.book.copyright.vo.CheckCodeParam; import com.pcloud.book.copyright.vo.CheckCodeParam;
import com.pcloud.book.copyright.vo.CheckIsAuthServeParam; import com.pcloud.book.copyright.vo.CheckIsAuthServeParam;
...@@ -46,6 +49,9 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade { ...@@ -46,6 +49,9 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
@Autowired @Autowired
private BookAuthCodeBiz bookAuthCodeBiz; private BookAuthCodeBiz bookAuthCodeBiz;
@Autowired
private BookExportRecordBiz bookExportRecordBiz;
@Override @Override
@RequestMapping(value = "checkCode", method = RequestMethod.POST) @RequestMapping(value = "checkCode", method = RequestMethod.POST)
public ResponseDto<CodeUseStatusVO> checkCode(@CookieValue("userInfo") String userInfo, @RequestBody CheckCodeParam checkCodeParam) throws PermissionException, BizException { public ResponseDto<CodeUseStatusVO> checkCode(@CookieValue("userInfo") String userInfo, @RequestBody CheckCodeParam checkCodeParam) throws PermissionException, BizException {
...@@ -161,4 +167,19 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade { ...@@ -161,4 +167,19 @@ public class BookAuthCodeFacadeImpl implements BookAuthCodeFacade {
bookAuthCodeBiz.deleteNoUsedAuthCode(deleteAuthCodeDTO,adviserId); bookAuthCodeBiz.deleteNoUsedAuthCode(deleteAuthCodeDTO,adviserId);
return new ResponseDto<>(); return new ResponseDto<>();
} }
/**
* 查看授权码生成记录
*/
@GetMapping("getGenerateCodeHistory")
public ResponseDto<?> getGenerateCodeHistory(@RequestHeader("token")String token,
@RequestParam(required = false, value ="bookId") Long bookId,
@RequestParam(required = false, value ="channelId") Long channelId,
@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);
PageParam pageParam = new PageParam(currentPage,numPerPage);
PageBeanNew<BookExportRecordDTO> result=bookExportRecordBiz.getGenerateCodeHistory(bookId,adviserId,channelId,pageParam);
return new ResponseDto<>(result);
}
} }
...@@ -211,4 +211,9 @@ public interface ResourcePageBiz { ...@@ -211,4 +211,9 @@ public interface ResourcePageBiz {
* * @param null * * @param null
*/ */
void batchUpdateSceneIdByBookGroup(List<AddBookGroupServeDTO> list); void batchUpdateSceneIdByBookGroup(List<AddBookGroupServeDTO> list);
/**
* 获取h5页面配了这个资源的二维码集合
*/
List<Long> getSceneIdsByResourceId(Long resourceId);
} }
\ No newline at end of file
...@@ -100,6 +100,7 @@ import java.util.concurrent.CompletableFuture; ...@@ -100,6 +100,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import cn.hutool.core.collection.CollectionUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -1353,4 +1354,16 @@ public class ResourcePageBizImpl implements ResourcePageBiz { ...@@ -1353,4 +1354,16 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
} }
resourcePageDao.batchUpdateSceneIdByBookGroup(list); resourcePageDao.batchUpdateSceneIdByBookGroup(list);
} }
@Override
public List<Long> getSceneIdsByResourceId(Long resourceId) {
//慎用。这个接口是给删除作品的时候用的
//获取的同时。会删掉配置的资源。
List<Long> result=resourcePageDao.getSceneIdsByResourceId(resourceId);
if(CollectionUtil.isNotEmpty(result)){
//删除配置的资源
resourcePageItemDao.deleteByServeId(resourceId);
}
return result;
}
} }
...@@ -95,4 +95,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{ ...@@ -95,4 +95,6 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
* * @param null * * @param null
*/ */
ResourcePage getPageByColumnId(Long resourcePageColumnId); ResourcePage getPageByColumnId(Long resourcePageColumnId);
List<Long> getSceneIdsByResourceId(Long resourceId);
} }
\ No newline at end of file
...@@ -74,4 +74,6 @@ public interface ResourcePageItemDao extends BaseDao<ResourcePageItem>{ ...@@ -74,4 +74,6 @@ public interface ResourcePageItemDao extends BaseDao<ResourcePageItem>{
* * @param null * * @param null
*/ */
ResourcePageItemVO checkOneServeItemByPageId(Long resourcePageId); ResourcePageItemVO checkOneServeItemByPageId(Long resourcePageId);
void deleteByServeId(Long resourceId);
} }
\ No newline at end of file
...@@ -73,4 +73,9 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re ...@@ -73,4 +73,9 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
public ResourcePage getPageByColumnId(Long resourcePageColumnId) { public ResourcePage getPageByColumnId(Long resourcePageColumnId) {
return getSessionTemplate().selectOne(getStatement("getPageByColumnId"), resourcePageColumnId); return getSessionTemplate().selectOne(getStatement("getPageByColumnId"), resourcePageColumnId);
} }
@Override
public List<Long> getSceneIdsByResourceId(Long resourceId) {
return getSessionTemplate().selectList(getStatement("getSceneIdsByResourceId"), resourceId);
}
} }
...@@ -71,4 +71,9 @@ public class ResourcePageItemDaoImpl extends BaseDaoImpl<ResourcePageItem> imple ...@@ -71,4 +71,9 @@ public class ResourcePageItemDaoImpl extends BaseDaoImpl<ResourcePageItem> imple
public ResourcePageItemVO checkOneServeItemByPageId(Long resourcePageId) { public ResourcePageItemVO checkOneServeItemByPageId(Long resourcePageId) {
return getSessionTemplate().selectOne(getStatement("checkOneServeItemByPageId"), resourcePageId); return getSessionTemplate().selectOne(getStatement("checkOneServeItemByPageId"), resourcePageId);
} }
@Override
public void deleteByServeId(Long resourceId) {
getSessionTemplate().delete(getStatement("deleteByServeId"), resourceId);
}
} }
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
<insert id="insert" useGeneratedKeys="true" parameterType="bookExportRecord"> <insert id="insert" useGeneratedKeys="true" parameterType="bookExportRecord">
INSERT INTO BOOK_EXPORT_RECORD( INSERT INTO BOOK_EXPORT_RECORD(
BOOK_ID, CHANNEL_ID,ADVISER_ID, BATCH_NUM, CREATED_USER, CREATED_DATE) BOOK_ID, CHANNEL_ID,ADVISER_ID, BATCH_NUM, CREATED_USER, CREATED_DATE,code_count,is_have_bar_code)
VALUES VALUES
(#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},#{batchNum}, (#{bookId,jdbcType=BIGINT}, #{channelId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},#{batchNum},
#{adviserId}, NOW()) #{adviserId}, NOW(),#{codeCount},#{isHaveBarCode})
</insert> </insert>
<update id="updateRecordStatus" parameterType="bookAuthInfo" flushCache="true"> <update id="updateRecordStatus" parameterType="bookAuthInfo" flushCache="true">
...@@ -51,6 +51,19 @@ ...@@ -51,6 +51,19 @@
WHERE EXPORT_STATUS = 0 WHERE EXPORT_STATUS = 0
</update> </update>
<select id="getGenerateCodeHistory" parameterType="map" resultType="com.pcloud.book.copyright.dto.BookExportRecordDTO">
SELECT
download_url downloadUrl,
code_count codeCount,
is_have_bar_code isHaveBarCode,
last_modified_date lastModifiedDate
FROM
BOOK_EXPORT_RECORD
WHERE
book_id = #{bookId}
AND channel_id = #{channelId}
AND adviser_id = #{adviserId}
order by created_date desc
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -188,4 +188,15 @@ ...@@ -188,4 +188,15 @@
c.id = #{resourcePageColumnId} c.id = #{resourcePageColumnId}
</select> </select>
<select id="getSceneIdsByResourceId" resultType="Long" parameterType="long">
SELECT DISTINCT
b.scene_id
FROM
resource_page_item a
INNER JOIN resource_page b ON a.resource_page_id = b.id
WHERE
a.serve_type = "PRODUCT"
AND a.serve_id = #{resourceId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -211,4 +211,8 @@ ...@@ -211,4 +211,8 @@
COUNT(i.id) = 1 COUNT(i.id) = 1
AND i.serve_type IN ("APP", "PRODUCT") AND i.serve_type IN ("APP", "PRODUCT")
</select> </select>
</mapper>
<delete id="deleteByServeId" parameterType="long">
delete from book.resource_page_item where serve_id = #{resourceId} and serve_type="PRODUCT"
</delete>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment