Commit a66b081d by zx1234zxcv2022

feat[1009576] 抖音书店新增山东新鑫

parent b92064df
...@@ -24,7 +24,12 @@ public enum MofangBookTypeEnum { ...@@ -24,7 +24,12 @@ public enum MofangBookTypeEnum {
/** /**
* 4-万有文化 * 4-万有文化
*/ */
WYWH(4) WYWH(4),
/**
* 山东新鑫
*/
SDXX(6)
; ;
public final Integer value; public final Integer value;
......
...@@ -355,4 +355,10 @@ public interface BookService { ...@@ -355,4 +355,10 @@ public interface BookService {
*/ */
@GetMapping("getMoFangBookIds") @GetMapping("getMoFangBookIds")
ResponseEntity<ResponseDto<List<Long>>> getMoFangBookIds (@RequestParam(value = "mofangId") Long mofangId); ResponseEntity<ResponseDto<List<Long>>> getMoFangBookIds (@RequestParam(value = "mofangId") Long mofangId);
@GetMapping("getMoFangSceneIds")
ResponseEntity<ResponseDto<List<Long>>> getMoFangSceneIds (@RequestParam(value = "mofangId") Long mofangId);
@GetMapping("getMoFangSceneIdsByType")
ResponseEntity<ResponseDto<List<Long>>> getMoFangSceneIdsByType (@RequestParam(value = "type") Integer type);
} }
...@@ -859,8 +859,12 @@ public interface BookBiz { ...@@ -859,8 +859,12 @@ public interface BookBiz {
List<Long> getMoFangBookIds(Long mofangId); List<Long> getMoFangBookIds(Long mofangId);
List<Long> getMoFangSceneIds(Long mofangId);
/** /**
* 魔方新华书店列表 * 魔方新华书店列表
*/ */
PageBeanNew<MoFangBookStoreDto> listBookStore(String keyWords, Integer currentPage, Integer numPerPage, Integer type, String ip); PageBeanNew<MoFangBookStoreDto> listBookStore(String keyWords, Integer currentPage, Integer numPerPage, Integer type, String ip);
List<Long> getMoFangSceneIdsByType(Integer type);
} }
...@@ -408,7 +408,7 @@ public class BookBizImpl implements BookBiz { ...@@ -408,7 +408,7 @@ public class BookBizImpl implements BookBiz {
@Autowired @Autowired
private BookBrowseRecordBiz bookBrowseRecordBiz; private BookBrowseRecordBiz bookBrowseRecordBiz;
private static final List<Integer> zouMuBaiTypeList = CollUtil.toList(3,4); private static final List<Integer> zouMuBaiTypeList = CollUtil.toList(3,4,6);
/** /**
* 创建书籍,同时建立与编辑的推广关系 * 创建书籍,同时建立与编辑的推广关系
...@@ -4820,6 +4820,39 @@ public class BookBizImpl implements BookBiz { ...@@ -4820,6 +4820,39 @@ public class BookBizImpl implements BookBiz {
if(MofangBookTypeEnum.zmbType.contains(type)){ if(MofangBookTypeEnum.zmbType.contains(type)){
dealZmb(list); dealZmb(list);
} }
if (MofangBookTypeEnum.SDXX.value.equals(type)) {
dealSDXX(list);
}
}
/**
* 山东新鑫
* @param list
*/
private void dealSDXX(List<MoFangBookDto> list) {
List<Long> sceneIds = new ArrayList<>();
Map<Long, List<Long>> zmbBookMap = new HashMap<>();
List<Long> mofangIds = list.stream().map(a -> a.getId()).collect(Collectors.toList());
List<MofangZmb> zmbBook = bookDao.getZmbBook(mofangIds);
if (CollUtil.isNotEmpty(zmbBook)) {
zmbBookMap = zmbBook.stream().collect(Collectors.groupingBy(a -> a.getMofangId(), Collectors.mapping(a -> a.getBookId(), Collectors.toList())));
sceneIds = zmbBook.stream().map(a -> a.getSceneId()).distinct().collect(Collectors.toList());
}
Map<Long, List<QrcodeSceneDto>> sceneMap = channelConsr.listRaysCodeBySceneIds(sceneIds);
for (MoFangBookDto dto : list) {
if (CollUtil.isNotEmpty(zmbBookMap) && null != dto.getId() && zmbBookMap.containsKey(dto.getId())) {
List<Long> zmbBookIds = zmbBookMap.get(dto.getId());
List<QrcodeSceneDto> qrcodeSceneDtos = new ArrayList<>();
for (Long zmbBookId : zmbBookIds) {
if (CollUtil.isNotEmpty(sceneMap.get(zmbBookId))) {
qrcodeSceneDtos.addAll(sceneMap.get(zmbBookId));
}
}
dealUrl(qrcodeSceneDtos);
dto.setSceneList(qrcodeSceneDtos);
}
}
} }
/** /**
...@@ -4937,6 +4970,15 @@ public class BookBizImpl implements BookBiz { ...@@ -4937,6 +4970,15 @@ public class BookBizImpl implements BookBiz {
return new ArrayList<>(); return new ArrayList<>();
} }
@Override
public List<Long> getMoFangSceneIds(Long mofangId) {
MoFangBookDto mofangBook = bookDao.getMoFangBookById(mofangId);
if(null!=mofangBook.getType() && zouMuBaiTypeList.contains(mofangBook.getType())){
return bookDao.getZmbSceneIds(mofangId);
}
return new ArrayList<>();
}
/** /**
* 魔方新华书店列表 * 魔方新华书店列表
*/ */
...@@ -4955,4 +4997,11 @@ public class BookBizImpl implements BookBiz { ...@@ -4955,4 +4997,11 @@ public class BookBizImpl implements BookBiz {
} }
return listPageNew; return listPageNew;
} }
@Override
public List<Long> getMoFangSceneIdsByType(Integer type) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("type",type);
return bookDao.getMoFangSceneIdsByType(type);
}
} }
...@@ -415,4 +415,8 @@ public interface BookDao extends BaseDao<Book> { ...@@ -415,4 +415,8 @@ public interface BookDao extends BaseDao<Book> {
MoFangBookDto getMoFangBookById(Long mofangId); MoFangBookDto getMoFangBookById(Long mofangId);
List<Long> getZmbBookIds(Long mofangId); List<Long> getZmbBookIds(Long mofangId);
List<Long> getZmbSceneIds(Long mofangId);
List<Long> getMoFangSceneIdsByType(Integer type);
} }
...@@ -548,4 +548,18 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao { ...@@ -548,4 +548,18 @@ public class BookDaoImpl extends BaseDaoImpl<Book> implements BookDao {
paramMap.put("mofangId", mofangId); paramMap.put("mofangId", mofangId);
return getSessionTemplate().selectList(getStatement("getZmbBookIds"), paramMap); return getSessionTemplate().selectList(getStatement("getZmbBookIds"), paramMap);
} }
@Override
public List<Long> getZmbSceneIds(Long mofangId) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("mofangId", mofangId);
return getSessionTemplate().selectList(getStatement("getZmbSceneIds"), paramMap);
}
@Override
public List<Long> getMoFangSceneIdsByType(Integer type) {
Map<String, Object> paramMap = Maps.newHashMap();
paramMap.put("type", type);
return getSessionTemplate().selectList(getStatement("getMoFangSceneIdsByType"), paramMap);
}
} }
...@@ -27,6 +27,8 @@ public class MofangZmb { ...@@ -27,6 +27,8 @@ public class MofangZmb {
private Long mofangId; private Long mofangId;
private Long bookId; private Long bookId;
private Long sceneId;
@ApiModelProperty("创建时间") @ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime; private Date createTime;
......
...@@ -336,4 +336,14 @@ public class BookServiceImpl implements BookService { ...@@ -336,4 +336,14 @@ public class BookServiceImpl implements BookService {
public ResponseEntity<ResponseDto<List<Long>>> getMoFangBookIds(@RequestParam(value = "mofangId") Long mofangId) { public ResponseEntity<ResponseDto<List<Long>>> getMoFangBookIds(@RequestParam(value = "mofangId") Long mofangId) {
return ResponseHandleUtil.toResponse(bookBiz.getMoFangBookIds(mofangId)); return ResponseHandleUtil.toResponse(bookBiz.getMoFangBookIds(mofangId));
} }
@Override
public ResponseEntity<ResponseDto<List<Long>>> getMoFangSceneIds(Long mofangId) {
return ResponseHandleUtil.toResponse(bookBiz.getMoFangSceneIds(mofangId));
}
@Override
public ResponseEntity<ResponseDto<List<Long>>> getMoFangSceneIdsByType(Integer type) {
return ResponseHandleUtil.toResponse(bookBiz.getMoFangSceneIdsByType(type));
}
} }
...@@ -440,4 +440,18 @@ public class ChannelConsr { ...@@ -440,4 +440,18 @@ public class ChannelConsr {
} }
return result; return result;
} }
public Map<Long, List<QrcodeSceneDto>> listRaysCodeBySceneIds(List<Long> sceneIds) {
if (ListUtils.isEmpty(sceneIds)) {
return new HashMap<>();
}
Map<Long, List<QrcodeSceneDto>> result = new HashMap<>();
try {
result = ResponseHandleUtil.parseMapList(qrcodeSceneService.listRaysCodeBySceneIds(sceneIds), Long.class,
QrcodeSceneDto.class);
} catch (Exception e) {
LOGGER.error("【渠道用户(消)】根据sceneIds获取书刊下的rays码列表,<ERROR>.[getNamesByIdList]:" + e.getMessage(), e);
}
return result;
}
} }
...@@ -3484,7 +3484,8 @@ ...@@ -3484,7 +3484,8 @@
<select id="getZmbBook" parameterType="map" resultType="com.pcloud.book.book.entity.MofangZmb"> <select id="getZmbBook" parameterType="map" resultType="com.pcloud.book.book.entity.MofangZmb">
select select
mofang_id mofangId, mofang_id mofangId,
book_id bookId book_id bookId,
scene_id sceneId
from mofang_zmb from mofang_zmb
where mofang_id in where mofang_id in
<foreach collection="mofangIds" item="item" open="(" separator="," close=")"> <foreach collection="mofangIds" item="item" open="(" separator="," close=")">
...@@ -3517,6 +3518,13 @@ ...@@ -3517,6 +3518,13 @@
where mofang_id = #{mofangId} where mofang_id = #{mofangId}
</select> </select>
<select id="getZmbSceneIds" parameterType="map" resultType="Long">
select
scene_id
from mofang_zmb
where mofang_id = #{mofangId}
</select>
<select id="listBookStore" resultType="com.pcloud.book.book.vo.MoFangBookStoreDto"> <select id="listBookStore" resultType="com.pcloud.book.book.vo.MoFangBookStoreDto">
select select
id id, id id,
...@@ -3531,4 +3539,11 @@ ...@@ -3531,4 +3539,11 @@
</if> </if>
ORDER BY checked DESC,id ASC ORDER BY checked DESC,id ASC
</select> </select>
<select id="getMoFangSceneIdsByType" parameterType="map" resultType="Long">
select
a.scene_id
from mofang_zmb a inner join mofang_book b on a.mofang_id = b.id
where b.type = #{type}
</select>
</mapper> </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