Commit e48f52ab by 吴博

Merge branch 'feature/1009365' into 'master'

feat: [1009365] 抖音魔方项目(邹慕白图书)

See merge request rays/pcloud-book!1718
parents 3b86e1cc b25f4680
......@@ -349,4 +349,10 @@ public interface BookService {
*/
@PostMapping("getServeListWithBookId")
ResponseEntity<ResponseDto<Map<Long,List<ListBookResourceDto>>>> getServeListWithBookId (@RequestBody List<Long> sceneIds);
/**
* 获取魔方书刊列表
*/
@GetMapping("getMoFangBookIds")
ResponseEntity<ResponseDto<List<Long>>> getMoFangBookIds (@RequestParam(value = "mofangId") Long mofangId);
}
......@@ -19,6 +19,8 @@ import com.pcloud.common.page.PageBean;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.util.List;
import java.util.Map;
......@@ -841,11 +843,19 @@ public interface BookBiz {
/**
* 查询魔方书刊
*/
PageBeanNew<MoFangBookDto> listMoFangBook(String keyWords,Integer currentPage,Integer numPerPage);
PageBeanNew<MoFangBookDto> listMoFangBook(String keyWords, Integer currentPage, Integer numPerPage, Integer type);
/**
* 魔方二维码
*/
Map<Long,String> listMoFangScene();
/**
* 导入魔方邹慕白数据
*/
void importZouMuBai(MultipartFile multipartFile);
MoFangSceneVO getMoFangScene(Long sceneId);
List<Long> getMoFangBookIds(Long mofangId);
}
......@@ -9,9 +9,13 @@ import com.pcloud.book.book.dto.BookInfo4AnlysicsDTO;
import com.pcloud.book.book.dto.BookInfoAnalysicsDTO;
import com.pcloud.book.book.dto.MoFangSceneDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.entity.MofangZmb;
import com.pcloud.book.book.vo.BookSaleVO;
import com.pcloud.book.book.vo.MoFangBookDto;
import com.pcloud.book.book.vo.MoFangSceneVO;
import com.pcloud.book.book.vo.SearchBookVO;
import com.pcloud.book.book.dto.BookUniqueNumberDTO;
import com.pcloud.book.book.vo.ZouMuBaiVO;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.common.core.dao.BaseDao;
import com.pcloud.common.page.PageBean;
......@@ -399,4 +403,16 @@ public interface BookDao extends BaseDao<Book> {
Integer getListPage4AdviserCount(Map<String, Object> paramMap);
List<MoFangSceneDto> listMoFangScene();
void insertMofangBook(ZouMuBaiVO vo);
void insertMofangZmb(List<MofangZmb> zmbList);
List<MofangZmb> getZmbBook(List<Long> mofangIds);
MoFangSceneVO getMoFangScene(Long sceneId);
MoFangBookDto getMoFangBookById(Long mofangId);
List<Long> getZmbBookIds(Long mofangId);
}
......@@ -12,9 +12,13 @@ import com.pcloud.book.book.dto.BookInfo4AnlysicsDTO;
import com.pcloud.book.book.dto.BookInfoAnalysicsDTO;
import com.pcloud.book.book.dto.MoFangSceneDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.entity.MofangZmb;
import com.pcloud.book.book.vo.BookSaleVO;
import com.pcloud.book.book.vo.MoFangBookDto;
import com.pcloud.book.book.vo.MoFangSceneVO;
import com.pcloud.book.book.vo.SearchBookVO;
import com.pcloud.book.book.dto.BookUniqueNumberDTO;
import com.pcloud.book.book.vo.ZouMuBaiVO;
import com.pcloud.book.es.entity.ESBookAndAdviser;
import com.pcloud.common.core.dao.BaseDaoImpl;
import com.pcloud.common.page.PageBean;
......@@ -506,4 +510,42 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
public List<MoFangSceneDto> listMoFangScene() {
return getSessionTemplate().selectList(getStatement("listMoFangScene"));
}
@Override
public void insertMofangBook(ZouMuBaiVO vo) {
getSessionTemplate().insert(getStatement("insertMofangBook"),vo);
}
@Override
public void insertMofangZmb(List<MofangZmb> list) {
getSessionTemplate().insert(getStatement("insertMofangZmb"),list);
}
@Override
public List<MofangZmb> getZmbBook(List<Long> mofangIds) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("mofangIds", mofangIds);
return getSessionTemplate().selectList(getStatement("getZmbBook"), paramMap);
}
@Override
public MoFangSceneVO getMoFangScene(Long sceneId) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("sceneId", sceneId);
return getSessionTemplate().selectOne(getStatement("getMoFangScene"), paramMap);
}
@Override
public MoFangBookDto getMoFangBookById(Long mofangId) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("mofangId", mofangId);
return getSessionTemplate().selectOne(getStatement("getMoFangBookById"), paramMap);
}
@Override
public List<Long> getZmbBookIds(Long mofangId) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("mofangId", mofangId);
return getSessionTemplate().selectList(getStatement("getZmbBookIds"), paramMap);
}
}
package com.pcloud.book.book.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @ClassName com.pcloud.book.book.entity.MofangZmb
* @Author David
* @Description
* @Date 2023/1/5 11:09
* @Version 1.0
**/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class MofangZmb {
private Long id;
private Long mofangId;
private Long bookId;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("修改时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
}
......@@ -50,6 +50,7 @@ import com.pcloud.wechatgroup.message.enums.IsSystem;
import org.codehaus.jackson.JsonParseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -60,6 +61,8 @@ 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;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
......@@ -1548,10 +1551,11 @@ public class BookFacadeImpl implements BookFacade {
*/
@RequestMapping(value = "listMoFangBook", method = RequestMethod.GET)
public ResponseDto<?> listMoFangBook(@RequestParam(value = "keyWords", required = false) String keyWords,
@RequestParam(value = "type", required = false) Integer type,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException {
return new ResponseDto<>(bookBiz.listMoFangBook(keyWords, currentPage, numPerPage));
return new ResponseDto<>(bookBiz.listMoFangBook(keyWords, currentPage, numPerPage,type));
}
/**
......@@ -1563,4 +1567,29 @@ public class BookFacadeImpl implements BookFacade {
return new ResponseDto<>(bookBiz.listMoFangScene());
}
/**
* 导入魔方邹慕白数据
*/
@RequestMapping(value = "importZouMuBai", method = RequestMethod.POST)
public void importZouMuBai(MultipartHttpServletRequest request) throws Exception {
List<MultipartFile> files = request.getFiles("file");
if (files.size() == 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "上传内容为空!");
}
MultipartFile multipartFile = files.get(0);
if (multipartFile == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "数据包内容为空!");
}
bookBiz.importZouMuBai(multipartFile);
}
/**
* 魔方二维码
*/
@RequestMapping(value = "getMoFangScene", method = RequestMethod.GET)
public ResponseDto<?> getMoFangScene(@RequestParam(value = "sceneId") Long sceneId)
throws BizException, PermissionException {
return new ResponseDto<>(bookBiz.getMoFangScene(sceneId));
}
}
......@@ -330,4 +330,10 @@ public class BookServiceImpl implements BookService {
public ResponseEntity<ResponseDto<Map<Long, List<ListBookResourceDto>>>> getServeListWithBookId(@RequestBody List<Long> sceneIds) {
return ResponseHandleUtil.toResponse(resourcePageBiz.getServeListWithBookId(sceneIds));
}
@Override
@GetMapping("getMoFangBookIds")
public ResponseEntity<ResponseDto<List<Long>>> getMoFangBookIds(@RequestParam(value = "mofangId") Long mofangId) {
return ResponseHandleUtil.toResponse(bookBiz.getMoFangBookIds(mofangId));
}
}
......@@ -47,4 +47,8 @@ public class MoFangBookDto extends BaseDto {
* rays码列表
*/
private List<QrcodeSceneDto> sceneList;
private Integer type;
private Long id;
}
/**
*
*/
package com.pcloud.book.book.vo;
import lombok.Data;
/**
* 魔方书刊
*/
@Data
public class MoFangSceneVO {
private Long sceneId;
private String linkUrl;
private Integer type;
}
package com.pcloud.book.book.vo;
import lombok.Data;
/**
* 邹慕白书刊
*/
@Data
public class ZouMuBaiVO {
private Long id;
private String bookName;
private String coverImg;
private String bookIds;
private Integer type;
}
\ No newline at end of file
......@@ -3441,16 +3441,21 @@
<select id="listMoFangBook" parameterType="map" resultType="com.pcloud.book.book.vo.MoFangBookDto">
select
id id,
book_id bookId,
resource_count resourceCount,
jump_url jumpUrl,
book_name bookName,
cover_img coverImg
cover_img coverImg,
type type
from mofang_book
where 1=1
<if test="keyWords !=null and keyWords!=''">
and book_name like concat('%',#{keyWords},'%')
</if>
<if test="type !=null">
and type = #{type}
</if>
</select>
<select id="listMoFangScene" resultType="com.pcloud.book.book.dto.MoFangSceneDto">
......@@ -3459,4 +3464,56 @@
link_url linkUrl
from mofang_scene
</select>
<insert id="insertMofangBook" parameterType="com.pcloud.book.book.vo.ZouMuBaiVO" useGeneratedKeys="true" keyProperty="id" >
insert into
mofang_book (book_name,cover_img,type,create_time,update_time)
values
(#{bookName}, #{coverImg}, #{type}, now(), now())
</insert>
<insert id="insertMofangZmb" parameterType="java.util.List">
insert into
mofang_zmb (mofang_id,book_id,create_time,update_time)
values
<foreach collection="list" index="index" item="item" separator=",">
(#{item.mofangId}, #{item.bookId}, now(), now())
</foreach>
</insert>
<select id="getZmbBook" parameterType="map" resultType="com.pcloud.book.book.entity.MofangZmb">
select
mofang_id mofangId,
book_id bookId
from mofang_zmb
where mofang_id in
<foreach collection="mofangIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="getMoFangScene" parameterType="map" resultType="com.pcloud.book.book.vo.MoFangSceneVO">
select
scene_id sceneId,
link_url linkUrl,
type type
from mofang_scene
where scene_id=#{sceneId}
limit 1
</select>
<select id="getMoFangBookById" parameterType="map" resultType="com.pcloud.book.book.vo.MoFangBookDto">
select
book_id bookId,
type type
from mofang_book
where id = #{mofangId}
</select>
<select id="getZmbBookIds" parameterType="map" resultType="Long">
select
book_id
from mofang_zmb
where mofang_id = #{mofangId}
</select>
</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