Commit 27a0dec2 by 李传峰

Merge remote-tracking branch 'remotes/origin/master' into 3.x

# Conflicts:
#	pcloud-service-book/src/main/java/com/pcloud/book/group/biz/ResourcePageBiz.java
#	pcloud-service-book/src/main/java/com/pcloud/book/group/biz/impl/ResourcePageBizImpl.java
#	pcloud-service-book/src/main/java/com/pcloud/book/group/constant/ResourcePageConstants.java
#	pcloud-service-book/src/main/java/com/pcloud/book/group/facade/impl/ResourcePageFacade.java
parents 08858847 98cb038e
......@@ -449,4 +449,9 @@ public class BookConstant {
public static String IGNOR_BOOK_KEY = CacheConstant.BOOK + "ignorBookKey";
/**
* qq公众号
*/
public static final Long QQ_ACCOUNT_SETTING_ID = 999L;
}
......@@ -43,6 +43,8 @@ import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import static com.pcloud.book.book.constant.BookConstant.QQ_ACCOUNT_SETTING_ID;
/**
* @ClassName com.pcloud.book.applet.biz.impl.AnswerSubscribeBizImpl
* @Author zhuyajie
......@@ -294,6 +296,10 @@ public class AnswerSubscribeBizImpl implements AnswerSubscribeBiz {
@Override
public AnswerSubscribeDTO getSubscribeQrcodeState(Long wechatUserId, Long accountSettingId) {
AnswerSubscribeDTO dto = new AnswerSubscribeDTO();
if (QQ_ACCOUNT_SETTING_ID.equals(accountSettingId)) {
return dto;
}
String openId = readerConsr.getOpenIdByWechatUserIdAndOfficialAccountsId(wechatUserId, accountSettingId);
WechatUserOfficialAccounts accounts = readerConsr.getOfficialAccounts(accountSettingId, openId, wechatUserId);
Boolean isSubscribe = false;
......@@ -301,7 +307,6 @@ public class AnswerSubscribeBizImpl implements AnswerSubscribeBiz {
isSubscribe = accounts.getIsSubscribe() == 1 ? true : false;
}
GroupQrcodeVO groupQrcodeVO = qrcodeSceneConsr.getSubscribeQrcode(accountSettingId);
AnswerSubscribeDTO dto = new AnswerSubscribeDTO();
dto.setQrcodeUrl(groupQrcodeVO.getQrcodeUrl());
dto.setIsSubscribe(isSubscribe);
return dto;
......
......@@ -91,7 +91,8 @@ public class AppletThirdResourcesStaticBizImpl implements AppletThirdResourcesSt
@Override
@ParamLog("获取跟谁学统计数据")
public void getAppletThirdResourceStatic(Integer isAll) {
PageBeanNew pageBeanNew = null;
//20210831 接口调用不通 ,暂停调用
/*PageBeanNew pageBeanNew = null;
//PageBeanNew pageBeanNew = appletThirdResourcesStaticDao.listPageNew(new PageParam(0, 10), null, "getList");
if (null != pageBeanNew && !ListUtils.isEmpty(pageBeanNew.getRecordList()) && YesOrNoEnums.YES.getValue().equals(isAll)) {
throw new BookBizException(BookBizException.ERROR, "当统计数据表不为空时不能导入全部数据只能导入昨日数据");
......@@ -134,7 +135,7 @@ public class AppletThirdResourcesStaticBizImpl implements AppletThirdResourcesSt
} catch (ParseException e) {
LOGGER.error("获取跟谁学统计数据失败", e);
}
}
}*/
}
......
......@@ -1608,7 +1608,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
Map<String, BookAdviserDto> bookAdviserDtoMap = new HashMap<>();
try {
bookAdviserDtoMap = bookAdviserSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT, TimeUnit.SECONDS);
bookAdviserDtoMap = bookAdviserSubmit.get(ThreadPoolUtils.REMOTE_TIME_OUT_LONG, TimeUnit.SECONDS);
} catch (InterruptedException | ExecutionException | TimeoutException e) {
LOGGER.error("获取现代纸书是否小睿流程错误: {}==", e);
}
......@@ -2736,6 +2736,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
String key = CacheConstant.BOOK + "BOOKIDS4AGENT:" + agentId+"_"+month;
if (StringUtil.isEmpty(JedisClusterUtils.get(key))) {
List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
if (CollUtil.isEmpty(adviserIds)) {
return new ArrayList<>();
}
List<ERPPublishNumDTO> erpPublishNumQueryParams = bookAdviserDao.getErpPublishNumQueryParamsByMonth(adviserIds,month);
if (ListUtils.isEmpty(erpPublishNumQueryParams)) {
return new ArrayList<>();
......
......@@ -118,6 +118,7 @@ import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import com.pcloud.usercenter.party.agent.dto.SaleAgentDTO;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -2740,6 +2741,9 @@ public class BookBizImpl implements BookBiz {
if (null != agentId) {
adviserIds = adviserConsr.getByAgentId(agentId);
}
if (!StringUtil.isEmpty(keyword)) {
keyword = QueryParser.escape(keyword);
}
Page<ESBookAndAdviser> esPage = esBookAndAdviserBiz.getESAdviserBooks4AppletV2(grayStatus, keyword, templetIds, graLabelIds, subLabelIds,
currentPage, numPerPage,scecondTempletIds, adviserIds, agentId);
......
......@@ -72,4 +72,6 @@ public class BookAuthInfo extends BaseEntity {
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
@ApiModelProperty("打开支付功能;0:关闭;1:开启;")
private Integer openPay;
}
......@@ -55,6 +55,8 @@ public class BookAuthInfoAndServesVO implements Serializable {
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
@ApiModelProperty("打开支付功能;0:关闭;1:开启;")
private Integer openPay;
public Long getId() {
return id;
......@@ -160,6 +162,14 @@ public class BookAuthInfoAndServesVO implements Serializable {
this.isAuthorizedPay = isAuthorizedPay;
}
public Integer getOpenPay() {
return openPay;
}
public void setOpenPay(Integer openPay) {
this.openPay = openPay;
}
@Override
public String toString() {
return "BookAuthInfoAndServesVO{" +
......
......@@ -50,4 +50,7 @@ public class BookAuthInfoVO implements Serializable {
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
@ApiModelProperty("打开支付功能;0:关闭;1:开启;")
private Integer openPay;
}
......@@ -51,6 +51,9 @@ public class BookAuthInfoWechatVO implements Serializable {
@ApiModelProperty("coverImg")
private String coverImg;
@ApiModelProperty("打开支付功能;0:关闭;1:开启;")
private Integer openPay;
public Long getId() {
return id;
}
......@@ -147,6 +150,14 @@ public class BookAuthInfoWechatVO implements Serializable {
this.coverImg = coverImg;
}
public Integer getOpenPay() {
return openPay;
}
public void setOpenPay(Integer openPay) {
this.openPay = openPay;
}
@Override
public String toString() {
return "BookAuthInfoWechatVO{" +
......
......@@ -54,4 +54,7 @@ public class SetAuthOpenParam implements Serializable {
@ApiModelProperty("授权后仍需付费")
private Integer isAuthorizedPay;
@ApiModelProperty("打开支付功能;0:关闭;1:开启;")
private Integer openPay;
}
......@@ -5,11 +5,13 @@ import com.pcloud.book.group.dto.AddBookGroupServeDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.NavigationParamDTO;
import com.pcloud.book.group.dto.ResourcePageCourseDTO;
import com.pcloud.book.group.dto.ResourcePageDTO;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.ResourcePage;
import com.pcloud.book.group.entity.ResourcePageCollect;
import com.pcloud.book.group.entity.ResourcePagePic;
import com.pcloud.book.group.entity.ResourcePageTool;
import com.pcloud.book.group.entity.ResourceRecomManage;
import com.pcloud.book.group.vo.ResourceColumnAndServeVO;
......@@ -64,7 +66,7 @@ public interface ResourcePageBiz {
* @date:2021/3/29 11:49
* * @param null
*/
List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId, Integer enableAdverting);
List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId, Integer enableAdverting, Long navigationId);
/**
* 根据书刊查资源页基本配置
* @author:zhuyajie
......@@ -404,6 +406,43 @@ public interface ResourcePageBiz {
List<BookServeDTO> getBookAllServeIdsIncludeUrl(Long adviserId, Long bookId, Long channelId);
/**
* 保存导航
* @author:zhuyajie
* @date:2021/8/17 16:42
* * @param null
*/
void saveNavigation(NavigationParamDTO navigationParamDTO);
/**
* 添加导航图片到图片库
* @author:zhuyajie
* @date:2021/8/24 14:46
* * @param null
*/
void addNavigationPic(ResourcePagePic resourcePagePic);
/**
* 删除导航图片库图片
* @author:zhuyajie
* @date:2021/8/24 14:50
* * @param null
*/
void deleteNavigationPic(Long id);
/**
* 查询导航图片库图片
* @author:zhuyajie
* @date:2021/8/24 14:51
* * @param null
*/
PageBeanNew<ResourcePagePic> listNavigationPic(Long adviserId, Integer currentPage, Integer numPerPage);
/**
* 批量更新栏目排序
* @author:zhuyajie
* @date:2021/8/27 19:35
* * @param null
*/
void batchUpdateColumnSeq(List<Long> navigationIds);
/**
* 客户端-根据页面id查要弹出的二维码
* @author:zhuyajie
* @date:2021/8/23 17:31
......
package com.pcloud.book.group.biz;
import com.pcloud.book.group.entity.ResourcePageBookstore;
import com.pcloud.book.group.vo.ResourcePageBookstoreVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* 实体书购买(ResourcePageBookstore)表服务接口
*
* @author makejava
* @since 2021-08-16 14:40:27
*/
public interface ResourcePageBookstoreBiz {
/**
* 通过ID查询单条数据
*/
ResourcePageBookstore getById(Long id);
/**
* 分页查询
*/
PageBeanNew getList(Integer currentPage, Integer numPerPage);
/**
* 新增数据
*/
Long insert(ResourcePageBookstore resourcePageBookstore);
/**
* 新增数据
*/
void insert(List<ResourcePageBookstore> list);
/**
* 修改数据
*/
void update(ResourcePageBookstore resourcePageBookstore);
/**
* 通过主键删除数据
*/
void deleteById(Long id);
void deleteByResourcePageId(Long resourcePageId);
List<ResourcePageBookstoreVO> getByResourcePageId(Long resourcePageId, Long channelId);
}
......@@ -5103,11 +5103,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
Long raysClassifyId = null;
BookAdviserDto bookAdviserDto = bookAdviserDao.getBase(bookId, channelId, adviserId);
if (null != bookAdviserDto) {
if (null != bookAdviserDto && null != bookAdviserDto.getTempletId()) {
raysClassifyId = bookRaysClassifyDao.getClassifyIdByBookTemplateId(bookAdviserDto.getTempletId());
}
if (null == raysClassifyId) {
LOGGER.error("书刊分类没有对应的小睿分类" + bookGroupId);
LOGGER.warn("书刊分类没有对应的小睿分类" + bookGroupId);
}
}
String page = null;//小程序跳转页 todo
String appletId = createOneAppletId();
......
......@@ -35,6 +35,7 @@ import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.es.biz.ESBookAndAdviserBiz;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.biz.ResourcePageBookstoreBiz;
import com.pcloud.book.group.constant.ResourcePageConstants;
import com.pcloud.book.group.dao.BookAppletSceneDao;
import com.pcloud.book.group.dao.BookGroupDao;
......@@ -43,6 +44,8 @@ import com.pcloud.book.group.dao.ResourcePageColumnDao;
import com.pcloud.book.group.dao.ResourcePageCourseDao;
import com.pcloud.book.group.dao.ResourcePageDao;
import com.pcloud.book.group.dao.ResourcePageItemDao;
import com.pcloud.book.group.dao.ResourcePageNavigationDao;
import com.pcloud.book.group.dao.ResourcePagePicDao;
import com.pcloud.book.group.dao.ResourcePageToolDao;
import com.pcloud.book.group.dao.ResourceRecomManageDao;
import com.pcloud.book.group.dto.AddBookGroupServeDTO;
......@@ -50,6 +53,7 @@ import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.dto.BookGroupServeCountDTO;
import com.pcloud.book.group.dto.BookGroupServeDTO;
import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.dto.NavigationParamDTO;
import com.pcloud.book.group.dto.ResourcePageCourseDTO;
import com.pcloud.book.group.dto.ResourcePageDTO;
import com.pcloud.book.group.dto.ResourcePageUrlDTO;
......@@ -57,14 +61,18 @@ import com.pcloud.book.group.entity.BookAppletScene;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.ResourcePage;
import com.pcloud.book.group.entity.ResourcePageBookstore;
import com.pcloud.book.group.entity.ResourcePageCollect;
import com.pcloud.book.group.entity.ResourcePageColumn;
import com.pcloud.book.group.entity.ResourcePageCourse;
import com.pcloud.book.group.entity.ResourcePageItem;
import com.pcloud.book.group.entity.ResourcePageNavigation;
import com.pcloud.book.group.entity.ResourcePagePic;
import com.pcloud.book.group.entity.ResourcePageTool;
import com.pcloud.book.group.entity.ResourceRecomManage;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.ResourceColumnAndServeVO;
import com.pcloud.book.group.vo.ResourcePageBookstoreVO;
import com.pcloud.book.group.vo.ResourcePageItemVO;
import com.pcloud.book.group.vo.ResourcePageOneServe;
import com.pcloud.book.group.vo.ResourcePageVO;
......@@ -203,6 +211,12 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
private AppletRecordAggrStatisBiz appletRecordAggrStatisBiz;
@Autowired
private ResourceRecomManageDao resourceRecomManageDao;
@Autowired
private ResourcePageBookstoreBiz resourcePageBookstoreBiz;
@Autowired
private ResourcePageNavigationDao resourcePageNavigationDao;
@Autowired
private ResourcePagePicDao resourcePagePicDao;
@Override
public Long updateResourcePage(UpdateResourcePageVO updateResourcePageVO) {
......@@ -273,7 +287,13 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
//同一本书其他码下关闭小睿流程
resourcePageDao.setOtherPageRaysClose(resourcePage.getBookId(), resourcePage.getChannelId(), resourcePage.getCreateUser(), sceneId, null);
//添加小程序默认导航
this.addDefaultAppletNavigation(resourcePage.getId());
} else {
//删除小程序默认导航
this.deleteAppletDefaultNavigation(resourcePage.getId());
//导航重新排序
this.updateNavigationSeq4Batch(resourcePage.getId());
}
esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(resourcePage.getBookId()));
return resourcePage.getId();
......@@ -332,6 +352,13 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
//同一本书其他码下关闭小睿流程
resourcePageDao.setOtherPageRaysClose(resourcePage.getBookId(), resourcePage.getChannelId(), resourcePage.getCreateUser(), null, bookGroupId);
//添加小程序默认导航
this.addDefaultAppletNavigation(resourcePage.getId());
} else {
//删除小程序默认导航
this.deleteAppletDefaultNavigation(resourcePage.getId());
//导航重新排序
this.updateNavigationSeq4Batch(resourcePage.getId());
}
esBookAndAdviserBiz.updateBookAndAdviserToES(Collections.singletonList(resourcePage.getBookId()));
return resourcePage.getId();
......@@ -361,6 +388,11 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePage.setChannelId(null == qrcodeSceneDto?null:qrcodeSceneDto.getChannelPartyId());
}
resourcePageDao.insert(resourcePage);
//添加默认导航
this.addDefaultBookServeNavigation(resourcePage.getId());
if (openRays == 1) {
this.addDefaultAppletNavigation(resourcePage.getId());
}
return resourcePage;
}
......@@ -456,9 +488,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
BeanUtils.copyProperties(updateResourceColumnVO, resourcePageColumn);
if (null == updateResourceColumnVO.getResourcePageColumnId()) {
if (null == resourcePageColumn.getColumnSeq()) {
Integer maxSeq = resourcePageColumnDao.getMaxSeq(updateResourceColumnVO.getResourcePageId());
Integer maxSeq = resourcePageColumnDao.getMaxSeq(updateResourceColumnVO.getResourcePageId(), updateResourceColumnVO.getNavigationId());
resourcePageColumn.setColumnSeq(maxSeq + 1);
}
//默认导航
if (null == updateResourceColumnVO.getNavigationId()) {
ResourcePageNavigation navigation = resourcePageNavigationDao.getByType(updateResourceColumnVO.getResourcePageId(),ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getCode());
resourcePageColumn.setNavigationId(navigation.getId());
}
resourcePageColumnDao.insert(resourcePageColumn);
} else {
resourcePageColumn.setId(updateResourceColumnVO.getResourcePageColumnId());
......@@ -676,12 +713,27 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
if (!MapUtils.isEmpty(agentMap)) {
resourcePageVO.setAgentName(agentMap.get(adviserId).getAgentName());
}
// 加载实体书购买
this.fillBookStore(resourcePageVO);
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageVO.getId());
resourcePageVO.setNavigationList(navigations);
return resourcePageVO;
}
/**
* 加载实体书购买
*/
private void fillBookStore(ResourcePageVO resourcePageVO) {
if(resourcePageVO == null || resourcePageVO.getId() == null){
return;
}
List<ResourcePageBookstoreVO> resourcePageBookstoreList = resourcePageBookstoreBiz.getByResourcePageId(resourcePageVO.getId(), resourcePageVO.getChannelId());
resourcePageVO.setResourcePageBookstoreList(resourcePageBookstoreList);
}
@Override
public List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId, Integer enableAdverting) {
List<ResourceColumnAndServeVO> serveVOS = resourcePageColumnDao.getColumnListByPageId(resourcePageId);
public List<ResourceColumnAndServeVO> getColumnAndServeListByPageId(Long resourcePageId, Boolean isWechat, Long bookId, Long adviserId, Long channelId, Integer enableAdverting, Long navigationId) {
List<ResourceColumnAndServeVO> serveVOS = resourcePageColumnDao.getColumnListByPageId(resourcePageId, navigationId);
if (CollUtil.isNotEmpty(serveVOS)) {
List<ResourcePageItemVO> itemVOList;
if (isWechat) {
......@@ -949,6 +1001,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
AccountSetting accountSetting = qrcodeSceneConsr.getAppInfo(accountSettingId);
itemVO.setAccountSettingName(null == accountSetting?null:accountSetting.getBaseAppName());
if (BookProps.getOperateOfficalId().equals(accountSettingId)) {
itemVO.setLinkUrl(accountSetting.getQrcodeUrl());
}
}
}
if (!ListUtils.isEmpty(removeList)) {
......@@ -1157,6 +1212,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
resourcePageVO.setChannelId(channelId);
}
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageVO.getId());
resourcePageVO.setNavigationList(navigations);
return resourcePageVO;
}
......@@ -1209,8 +1266,9 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
Long resourcePageId = resourcePageColumn.getResourcePageId();
Integer columnSeq = resourcePageColumn.getColumnSeq();
Long navigationId = resourcePageColumn.getNavigationId();
//获取要调换的栏目
ResourcePageColumn column = resourcePageColumnDao.getColumByMoveType(moveType, resourcePageId, columnSeq);
ResourcePageColumn column = resourcePageColumnDao.getColumByMoveType(moveType, resourcePageId, columnSeq, navigationId);
if (null == column) {
return;
}
......@@ -1238,7 +1296,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
//删除栏目
resourcePageColumnDao.deleteById(resourcePageColumnId);
//栏目重新排序
this.updateSeq4Batch(column.getResourcePageId());
this.updateSeq4Batch(column.getResourcePageId(), column.getNavigationId());
//同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(()->{
ResourcePage resourcePage = resourcePageDao.getPageByColumnId(resourcePageColumnId);
......@@ -1271,6 +1329,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "弹窗式公众号只能配置一个");
}
}
//栏目资源
resourcePageItemDao.deleteByPageId(resourcePageId);
for (UpdateResourceColumnVO columnVO : list) {
this.updateResourceColumn(columnVO);
}
......@@ -1295,6 +1355,16 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
}
// 更新实体书购买
List<ResourcePageBookstore> resourcePageBookstoreList = updateResourcePageVO.getResourcePageBookstoreList();
resourcePageBookstoreBiz.deleteByResourcePageId(resourcePageId);
if(CollUtil.isNotEmpty(resourcePageBookstoreList)){
for (ResourcePageBookstore bookstore : resourcePageBookstoreList) {
bookstore.setResourcePageId(resourcePageId);
}
resourcePageBookstoreBiz.insert(resourcePageBookstoreList);
}
//发送编辑任务queue
adviserTaskConsr.sendAdviserTaskQueue(updateResourcePageVO.getCreateUser(), AdviserTaskConstants.TargetTypeEnum.QRCODE.getValue(),
page.getBookGroupId() == null ? page.getSceneId() : page.getBookGroupId(),
......@@ -1321,10 +1391,14 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
//查收藏状态
ResourcePageCollect collect = resourcePageCollectDao.getCollectRecordByUser(wechatUserId, resourcePageVO.getId());
resourcePageVO.setCollectState(null == collect ? 0 : 1);
// 实体店铺
resourcePageVO.setResourcePageBookstoreList(resourcePageBookstoreBiz.getByResourcePageId(resourcePageVO.getId(), resourcePageVO.getChannelId()));
}
if (null != resourcePageVO.getAdviserId()) {
resourcePageVO.setPushTextOpenStatus(qrcodeSceneConsr.getPushTextOpenStatus(resourcePageVO.getAdviserId()));
}
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageVO.getId());
resourcePageVO.setNavigationList(navigations);
return resourcePageVO;
}
......@@ -1360,6 +1434,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageVO.setId(resourcePage.getId());
resourcePageVO.setBookCover(resourcePage.getBookCover());
resourcePageVO.setBackgroundImg(resourcePage.getBackgroundImg());
resourcePageVO.setNavigationColor(resourcePage.getNavigationColor());
resourcePageVO.setNavigationFormat(resourcePage.getNavigationFormat());
}
return resourcePageVO;
}
......@@ -1399,6 +1475,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
resourcePageVO.setId(resourcePage.getId());
resourcePageVO.setBookCover(resourcePage.getBookCover());
resourcePageVO.setBackgroundImg(resourcePage.getBackgroundImg());
resourcePageVO.setNavigationColor(resourcePage.getNavigationColor());
resourcePageVO.setNavigationFormat(resourcePage.getNavigationFormat());
}
return resourcePageVO;
}
......@@ -1409,8 +1487,8 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
* @date:2021/4/14 10:37
* * @param null
*/
private void updateSeq4Batch(Long resourcePageId) {
List<ResourceColumnAndServeVO> serveVOS = resourcePageColumnDao.getColumnListByPageId(resourcePageId);
private void updateSeq4Batch(Long resourcePageId, Long navigationId) {
List<ResourceColumnAndServeVO> serveVOS = resourcePageColumnDao.getColumnListByPageId(resourcePageId, navigationId);
if (ListUtils.isEmpty(serveVOS)) {
return;
}
......@@ -1674,12 +1752,27 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
Long resourcePageId = resourcePage.getId();
// 配置资源支持指定栏目
Integer columnType = Optional.ofNullable(addBookGroupServeDTO.getColumnType()).orElse(ResourcePageConstants.ColumnTypeEnum.APP_PRODUCT.getCode());
//是否有应用栏目
List<ResourcePageColumn> columns = resourcePageColumnDao.getByColumnTypeAndPage(resourcePageId, columnType);
//第一个可配置资源的导航
Long navigationId=null;
List<Integer> navigationTypes = Arrays.asList(ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getCode(),
ResourcePageConstants.NavigationTypeEnum.CUSTOM.getCode());
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageId);
for (ResourcePageNavigation navigation:navigations) {
if (navigationTypes.contains(navigation.getNavigationType())) {
navigationId = navigation.getId();
break;
}
}
if (null == navigationId) {
navigationId = this.addDefaultBookServeNavigation(resourcePageId);
}
//获取该导航最后一个应用作品栏目
List<ResourcePageColumn> columnList = resourcePageColumnDao.getByNavigation(navigationId);
List<ResourcePageColumn> columns = columnList.stream().filter(s->columnType.equals(s.getColumnType())).collect(Collectors.toList());
ResourcePageColumn column = null;
List<ResourcePageItemVO> itemVOS = new ArrayList<>();
if (!ListUtils.isEmpty(columns)) {
column = columns.get(0);
column = columns.get(columns.size()-1);
itemVOS = resourcePageItemDao.getResourcePageItemByColumnId(column.getId());
}
//资源
......@@ -1701,6 +1794,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
columnVO.setCreateUser(adviserId);
columnVO.setItemVOList(itemVOS);
columnVO.setResourcePageId(resourcePageId);
columnVO.setNavigationId(navigationId);
this.updateResourceColumn(columnVO);
}
......@@ -1711,7 +1805,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
columnVO.setColumnName("RAYS工具");
} else {
columnVO.setColumnFormat(1);
columnVO.setColumnName("本书配套资源服务");
columnVO.setColumnName("应用作品");
}
columnVO.setShowMore(false);
return columnVO;
......@@ -2160,13 +2254,260 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
}
}
/**
* 删除小程序默认导航
* @author:zhuyajie
* @date:2021/8/27 16:01
* * @param null
*/
private void deleteAppletDefaultNavigation(Long resourcePageId) {
//书友互助、阅读打卡
List<Integer> types = ResourcePageConstants.APPLET_DEFAULT_NAVIGATIONS;
for (Integer type :types){
resourcePageNavigationDao.deleteNavigation(resourcePageId, type);
}
}
/**
* 添加小程序默认导航(互助、打卡)
* @author:zhuyajie
* @date:2021/8/16 14:39
* * @param null
*/
private void addDefaultAppletNavigation(Long resourcePageId) {
ResourcePage resourcePage = resourcePageDao.getById(resourcePageId);
if (null == resourcePage) {
return;
}
//书友互助、阅读打卡
List<Integer> types = ResourcePageConstants.APPLET_DEFAULT_NAVIGATIONS;
Integer maxSeq = resourcePageNavigationDao.getMaxSeq(resourcePageId);
Integer addSeq = 0;
List<ResourcePageNavigation> navigations = new ArrayList<>();
for (Integer type :types){
ResourcePageNavigation resourcePageNavigation = resourcePageNavigationDao.getByType(resourcePageId,type);
if (null != resourcePageNavigation) {
continue;
}
addSeq = addSeq + 1;
ResourcePageNavigation navigation = new ResourcePageNavigation();
navigation.setCreateUser(resourcePage.getCreateUser());
navigation.setNavigationName(ResourcePageConstants.NavigationTypeEnum.getNameByCode(type));
navigation.setNavigationSeq(maxSeq+addSeq);
navigation.setNavigationType(type);
navigation.setResourcePageId(resourcePageId);
navigations.add(navigation);
}
if (!ListUtils.isEmpty(navigations)) {
resourcePageNavigationDao.insert(navigations);
}
}
/**
* 添加本书配套导航
* @author:zhuyajie
* @date:2021/8/16 14:40
* * @param null
*/
private Long addDefaultBookServeNavigation(Long resourcePageId) {
ResourcePageNavigation resourcePageNavigation = resourcePageNavigationDao.getByType(resourcePageId,ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getCode());
if (null != resourcePageNavigation) {
return null;
}
ResourcePage resourcePage = resourcePageDao.getById(resourcePageId);
if (null == resourcePage) {
return null;
}
ResourcePageNavigation navigation = new ResourcePageNavigation();
navigation.setCreateUser(resourcePage.getCreateUser());
navigation.setNavigationName(ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getName());
navigation.setNavigationSeq(1);
navigation.setNavigationType(ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getCode());
navigation.setResourcePageId(resourcePageId);
resourcePageNavigationDao.insert(navigation);
return navigation.getId();
}
/**
* 删除导航
* @author:zhuyajie
* @date:2021/8/17 17:15
* * @param null
*/
private void deleteNavigation(Long navigationId) {
ResourcePageNavigation resourcePageNavigation = resourcePageNavigationDao.getById(navigationId);
if (null == resourcePageNavigation) {
return;
}
List<Integer> types = Arrays.asList(ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getCode(),ResourcePageConstants.NavigationTypeEnum.APPLET_QA.getCode());
if (types.contains(resourcePageNavigation.getNavigationType())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"该导航不能删除");
}
resourcePageNavigationDao.deleteById(navigationId);
//栏目
List<ResourcePageColumn> resourcePageColumns = resourcePageColumnDao.getByNavigation(navigationId);
if (!ListUtils.isEmpty(resourcePageColumns)) {
for (ResourcePageColumn resourcePageColumn:resourcePageColumns) {
//删除资源配置
resourcePageItemDao.deleteByPageColumnId(resourcePageColumn.getId());
//删除栏目
resourcePageColumnDao.deleteById(resourcePageColumn.getId());
}
}
}
/**
* 导航重新排序
* @author:zhuyajie
* @date:2021/8/16 17:54
* * @param null
*/
private void updateNavigationSeq4Batch(Long resourcePageId) {
List<ResourcePageNavigation> navigations = resourcePageNavigationDao.getByPageId(resourcePageId);
if (ListUtils.isEmpty(navigations)) {
return;
}
for (ResourcePageNavigation navigation : navigations) {
navigation.setNavigationSeq(navigations.indexOf(navigation) + 1);
}
resourcePageNavigationDao.updateSeq4Batch(navigations);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void saveNavigation(NavigationParamDTO navigationParamDTO) {
//参数校验
this.checkNavigationList(navigationParamDTO);
List<ResourcePageNavigation> originNavigationList = resourcePageNavigationDao.getByPageId(navigationParamDTO.getResourcePageId());
//待删除导航
List<Long> ids4Remove = ListUtils.isEmpty(originNavigationList) ? new ArrayList<>() : originNavigationList.stream().map(ResourcePageNavigation::getId).collect(Collectors.toList());
for (ResourcePageNavigation navigation : navigationParamDTO.getNavigationList()) {
if (null != navigation.getId()) {
//修改
resourcePageNavigationDao.update(navigation);
if (!ListUtils.isEmpty(ids4Remove)) {
ids4Remove.remove(navigation.getId());
}
} else {
//新增
resourcePageNavigationDao.insert(navigation);
}
}
//需要删除的导航
if (!ListUtils.isEmpty(ids4Remove)) {
for (Long navigationId : ids4Remove) {
this.deleteNavigation(navigationId);
}
//同步RAYS码资源配置
ThreadPoolUtils.OTHER_POOL.execute(() -> {
ResourcePage resourcePage = resourcePageDao.getById(navigationParamDTO.getResourcePageId());
this.updateOwnMessage4Qr(null == resourcePage ? null : resourcePage.getSceneId());
});
}
//修改导航样式,版式
resourcePageDao.updateNavigationFormat(navigationParamDTO.getResourcePageId(), navigationParamDTO.getNavigationColor(),navigationParamDTO.getNavigationFormat());
}
private void checkNavigationList(NavigationParamDTO navigationParamDTO) {
if (null == navigationParamDTO) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数缺失");
}
if (null == navigationParamDTO.getResourcePageId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少resourcePageId");
}
if (ListUtils.isEmpty(navigationParamDTO.getNavigationList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少导航");
}
List<String> names = new ArrayList<>();
for (ResourcePageNavigation navigation:navigationParamDTO.getNavigationList()){
navigation.setCreateUser(navigationParamDTO.getCreateUser());
navigation.setResourcePageId(navigationParamDTO.getResourcePageId());
this.checkNavigation(navigation);
names.add(navigation.getNavigationName().trim());
}
if (names.size()<navigationParamDTO.getNavigationList().size()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"导航名称重复");
}
}
private void checkNavigation(ResourcePageNavigation navigation) {
if (null == navigation) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数缺失");
}
if (StringUtil.isEmpty(navigation.getNavigationName().trim())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少导航名称");
}
if (null == navigation.getResourcePageId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少resourcePageId");
}
if (null == navigation.getNavigationSeq()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少排序值");
}
if (null == navigation.getNavigationType()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少导航类型");
}
List<Integer> types = Arrays.asList(ResourcePageConstants.NavigationTypeEnum.BOOK_SERVE.getCode(),ResourcePageConstants.NavigationTypeEnum.APPLET_QA.getCode());
if (types.contains(navigation.getNavigationType()) && null == navigation.getId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少导航id");
}
}
@Override
public void addNavigationPic(ResourcePagePic resourcePagePic) {
if (StringUtil.isEmpty(resourcePagePic.getPicUrl())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少图片");
}
if (null == resourcePagePic.getAdviserId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少编辑id");
}
resourcePagePic.setIsDefault(0);
resourcePagePic.setType(1);
resourcePagePicDao.insert(resourcePagePic);
}
@Override
public void deleteNavigationPic(Long id) {
ResourcePagePic resourcePagePic = resourcePagePicDao.getById(id);
if (null == resourcePagePic) {
return;
}
if (1 == resourcePagePic.getIsDefault()) {
throw new BookBizException(BookBizException.ERROR,"默认图片不能删除");
}
resourcePagePicDao.deleteById(id);
}
@Override
public PageBeanNew<ResourcePagePic> listNavigationPic(Long adviserId, Integer currentPage, Integer numPerPage) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("type", 1);
return resourcePagePicDao.listPageNew(new PageParam(currentPage,numPerPage), paramMap,"getByType");
}
@Override
public void batchUpdateColumnSeq(List<Long> navigationIds) {
if (ListUtils.isEmpty(navigationIds)) {
return;
}
for (Long navigationId:navigationIds){
ResourcePageNavigation navigation = resourcePageNavigationDao.getById(navigationId);
if (null != navigation) {
this.updateSeq4Batch(navigation.getResourcePageId(), navigationId);
}
}
}
@Override
public ResourcePageItemVO getPopupQrcode4Wechat(Long resourcePageId, Long wechatUserId) {
Boolean popupState = false;
ResourcePageItemVO pageItemVO = resourcePageItemDao.getPopupQrcodeItem(resourcePageId);
if (null == pageItemVO) {
pageItemVO = new ResourcePageItemVO();
pageItemVO.setPopupState(popupState);
return new ResourcePageItemVO();
return pageItemVO;
}
String logoUrl = pageItemVO.getLogoUrl();
Long accountSettingId = pageItemVO.getAccountSettingId();
......@@ -2176,7 +2517,7 @@ public class ResourcePageBizImpl implements ResourcePageBiz {
QrcodeTemp qrcodeTemp = new QrcodeTemp();
qrcodeTemp.setAccountSettingId(accountSettingId);
qrcodeTemp.setCreatedUser(wechatUserId);
// qrcodeTemp.setPageId(resourcePageId);
qrcodeTemp.setPageId(resourcePageId);
String qrcodeUrl = qrcodeSceneConsr.createTempQrcode4H5(qrcodeTemp);
if (!StringUtil.isEmpty(qrcodeUrl) && !StringUtil.isEmpty(logoUrl)) {
//添加Logo
......
package com.pcloud.book.group.biz.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.pcloud.appcenter.app.dto.AppDto;
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.group.entity.ResourcePageBookstore;
import com.pcloud.book.group.dao.ResourcePageBookstoreDao;
import com.pcloud.book.group.biz.ResourcePageBookstoreBiz;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.ResourcePageBookstoreVO;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 实体书购买(ResourcePageBookstore)表服务实现类
*
* @author makejava
* @since 2021-08-16 14:40:27
*/
@Service("resourcePageBookstoreBiz")
public class ResourcePageBookstoreBizImpl implements ResourcePageBookstoreBiz {
private static final Logger LOGGER = LoggerFactory.getLogger(ResourcePageBookstoreBizImpl.class);
@Autowired
private ResourcePageBookstoreDao resourcePageBookstoreDao;
@Autowired
private AppConsr appConsr;
@Autowired
private ProductConsr productConsr;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Override
public ResourcePageBookstore getById(Long id) {
return resourcePageBookstoreDao.getById(id);
}
@Override
public PageBeanNew getList(Integer currentPage, Integer numPerPage) {
PageBeanNew pageBeanNew = resourcePageBookstoreDao.listPageNew(new PageParam(currentPage, numPerPage), null, "getList");
List recordList = pageBeanNew.getRecordList();
if (ListUtils.isEmpty(recordList)){
return pageBeanNew;
}
// 加载其它数据
return pageBeanNew;
}
@Override
public Long insert(ResourcePageBookstore resourcePageBookstore) {
resourcePageBookstoreDao.insert(resourcePageBookstore);
return resourcePageBookstore.getId();
}
@Override
public void insert(List<ResourcePageBookstore> list) {
resourcePageBookstoreDao.insert(list);
}
@Override
public void update(ResourcePageBookstore resourcePageBookstore) {
if(resourcePageBookstore == null || !NumberUtil.isNumber(resourcePageBookstore.getId())){
throw BizException.PARAM_DELETION;
}
resourcePageBookstoreDao.update(resourcePageBookstore);
}
@Override
public void deleteById(Long id) {
resourcePageBookstoreDao.deleteById(id);
}
@Override
public void deleteByResourcePageId(Long resourcePageId) {
resourcePageBookstoreDao.deleteByResourcePageId(resourcePageId);
}
@Override
public List<ResourcePageBookstoreVO> getByResourcePageId(Long resourcePageId, Long channelId) {
List<ResourcePageBookstoreVO> list = resourcePageBookstoreDao.getByResourcePageId(resourcePageId);
if(CollUtil.isEmpty(list) || channelId == null){
return CollUtil.toList();
}
List<Long> appIds = list.stream().filter(x -> ObjectUtil.equal(x.getServeType(), "APP")).map(x -> x.getServeId()).collect(Collectors.toList());
List<Long> productIds = list.stream().filter(x -> ObjectUtil.equal(x.getServeType(), "PRODUCT")).map(x -> x.getServeId()).collect(Collectors.toList());
Map<Long, AppDto> appDtoMap = appConsr.getBaseByIds(appIds);
Map<Long, ProductDto> productDtoMap = productConsr.getProBasesByIds(productIds);
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(channelId);
if (null == accountSettingDto) {
LOGGER.info("未配置公众号");
return CollUtil.toList();
}
for (ResourcePageBookstoreVO vo : list) {
if(ObjectUtil.equal(vo.getServeType(), "APP")){
AppDto appDto = appDtoMap.get(vo.getServeId());
if(appDto == null){
continue;
}
vo.setServeName(appDto.getTitle());
vo.setServePic(appDto.getSquareImg());
vo.setServeTypeCode(appDto.getTypeCode());
vo.setServeTypeName(appDto.getTypeName());
vo.setResultUrl(SendWeixinRequestTools.splitUrl(accountSettingDto, vo.getLinkUrl()));
}
if(ObjectUtil.equal(vo.getServeType(), "PRODUCT")){
ProductDto productDto = productDtoMap.get(vo.getServeId());
if(productDto == null){
continue;
}
vo.setServeName(productDto.getProductName());
vo.setServePic(productDto.getCoverImg());
if (productDto.getProductTypeDto() != null){
vo.setServeTypeCode(productDto.getProductTypeDto().getTypeCode());
vo.setServeTypeName(productDto.getProductTypeDto().getTypeName());
}
vo.setResultUrl(SendWeixinRequestTools.splitUrl(accountSettingDto, vo.getLinkUrl()));
}
}
return list;
}
}
......@@ -331,6 +331,54 @@ public class ResourcePageConstants {
}
/**
* 导航类型
* @author:zhuyajie
* @date:2021/8/16 11:59
* * @param null
*/
public enum NavigationTypeEnum{
BOOK_SERVE(1,"本书配套"),
APPLET_QA(2,"书友互助"),
CUSTOM(3,"自定义"),
CLOCK(4,"阅读打卡");
private Integer code;
private String name;
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
NavigationTypeEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static String getNameByCode(Integer code) {
for (NavigationTypeEnum navigationTypeEnum:NavigationTypeEnum.values()){
if (navigationTypeEnum.code.equals(code)){
return navigationTypeEnum.name;
}
}
return null;
}
}
//小程序默认导航,书友互助、阅读打卡
public static List<Integer> APPLET_DEFAULT_NAVIGATIONS = Arrays.asList(ResourcePageConstants.NavigationTypeEnum.APPLET_QA.getCode(),
ResourcePageConstants.NavigationTypeEnum.CLOCK.getCode());
/**
* H5-公众号二维码展示方式
* @author:zhuyajie
* @date:2021/8/23 15:14
......
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.ResourcePageBookstore;
import com.pcloud.book.group.vo.ResourcePageBookstoreVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 实体书购买(ResourcePageBookstore)表数据库访问层
*
* @author makejava
* @since 2021-08-16 14:40:27
*/
public interface ResourcePageBookstoreDao extends BaseDao<ResourcePageBookstore> {
Integer deleteByResourcePageId(Long resourcePageId);
List<ResourcePageBookstoreVO> getByResourcePageId(Long resourcePageId);
}
......@@ -21,7 +21,7 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
* @date:2021/3/29 13:45
* * @param null
*/
Integer getMaxSeq(Long resourcePageId);
Integer getMaxSeq(Long resourcePageId, Long navigationId);
/**
*栏目和资源列表
......@@ -29,7 +29,7 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
* @date:2021/3/29 13:45
* * @param null
*/
List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId);
List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId, Long navigationId);
/**
* 根据类型查询
......@@ -53,7 +53,7 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
* @date:2021/4/2 16:18
* * @param null
*/
ResourcePageColumn getColumByMoveType(String moveType, Long resourcePageId, Integer columnSeq);
ResourcePageColumn getColumByMoveType(String moveType, Long resourcePageId, Integer columnSeq, Long navigationId);
/**
* 批量更新序号
* @author:zhuyajie
......@@ -63,4 +63,8 @@ public interface ResourcePageColumnDao extends BaseDao<ResourcePageColumn> {
void updateSeq4Batch(List<ResourceColumnAndServeVO> list);
void deleteByPageId(Long resourcePageId);
void updateNavigationId(Long navigationId, Long resourcePageId);
List<ResourcePageColumn> getByNavigation(Long navigationId);
}
\ No newline at end of file
......@@ -113,4 +113,12 @@ public interface ResourcePageDao extends BaseDao<ResourcePage>{
List<ResourcePageVO> getAllBook4OpenFood();
void updateBookIdBySceneId(Long bookId, Long sceneId);
/**
* 修改导航样式
* @author:zhuyajie
* @date:2021/8/18 16:46
* * @param null
*/
void updateNavigationFormat(Long resourcePageId, Integer navigationColor, Integer navigationFormat);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.ResourcePageNavigation;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 自有码H5页面导航(ResourcePageNavigation)表数据库访问层
*
* @author makejava
* @since 2021-08-16 10:43:21
*/
public interface ResourcePageNavigationDao extends BaseDao<ResourcePageNavigation>{
List<ResourcePageNavigation> getByPageId(Long resourcePageId);
List<Long> getNoNavigationPages(Integer openRays);
ResourcePageNavigation getByType(Long resourcePageId, Integer type);
Integer getMaxSeq(Long resourcePageId);
void deleteNavigation(Long resourcePageId, Integer type);
ResourcePageNavigation getByName(Long resourcePageId, String navigationName);
void updateSeq4Batch(List<ResourcePageNavigation> navigations);
ResourcePageNavigation getNavigationByMoveType(String moveType, Long resourcePageId, Integer navigationSeq);
void updateNavigationSeqNum(Long navigationId, Integer navigationSeq);
}
\ No newline at end of file
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.ResourcePagePic;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* 资源页图片库(ResourcePagePic)表数据库访问层
*
* @author makejava
* @since 2021-08-24 14:36:56
*/
public interface ResourcePagePicDao extends BaseDao<ResourcePagePic>{
List<ResourcePagePic> getByType(Integer type, Long adviserId);
}
\ No newline at end of file
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.entity.ResourcePageBookstore;
import com.pcloud.book.group.dao.ResourcePageBookstoreDao;
import com.pcloud.book.group.vo.ResourcePageBookstoreVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 实体书购买(ResourcePageBookstore)表数据库访问层
*
* @author makejava
* @since 2021-08-16 14:40:27
*/
@Repository("resourcePageBookstoreDaoImpl")
public class ResourcePageBookstoreDaoImpl extends BaseDaoImpl<ResourcePageBookstore> implements ResourcePageBookstoreDao {
@Override
public Integer deleteByResourcePageId(Long resourcePageId) {
return super.sqlSessionTemplate.delete(getStatement("deleteByResourcePageId"), resourcePageId);
}
@Override
public List<ResourcePageBookstoreVO> getByResourcePageId(Long resourcePageId) {
return super.sqlSessionTemplate.selectList(getStatement("getByResourcePageId"), resourcePageId);
}
}
......@@ -21,13 +21,19 @@ import java.util.Map;
@Component
public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> implements ResourcePageColumnDao {
@Override
public Integer getMaxSeq(Long resourcePageId) {
return getSessionTemplate().selectOne(getStatement("getMaxSeq"),resourcePageId);
public Integer getMaxSeq(Long resourcePageId, Long navigationId) {
Map<String, Object> map = new HashMap<>();
map.put("navigationId", navigationId);
map.put("resourcePageId", resourcePageId);
return getSessionTemplate().selectOne(getStatement("getMaxSeq"), map);
}
@Override
public List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId) {
return getSessionTemplate().selectList(getStatement("getColumnListByPageId"), resourcePageId);
public List<ResourceColumnAndServeVO> getColumnListByPageId(Long resourcePageId, Long navigationId) {
Map<String, Object> map = new HashMap<>();
map.put("navigationId", navigationId);
map.put("resourcePageId", resourcePageId);
return getSessionTemplate().selectList(getStatement("getColumnListByPageId"), map);
}
@Override
......@@ -47,11 +53,12 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i
}
@Override
public ResourcePageColumn getColumByMoveType(String moveType, Long resourcePageId, Integer columnSeq) {
public ResourcePageColumn getColumByMoveType(String moveType, Long resourcePageId, Integer columnSeq, Long navigationId) {
Map<String, Object> map = new HashMap<>();
map.put("moveType", moveType);
map.put("resourcePageId", resourcePageId);
map.put("columnSeq", columnSeq);
map.put("navigationId", navigationId);
return getSessionTemplate().selectOne(getStatement("getColumByMoveType"), map);
}
......@@ -64,4 +71,17 @@ public class ResourcePageColumnDaoImpl extends BaseDaoImpl<ResourcePageColumn> i
public void deleteByPageId(Long resourcePageId) {
getSessionTemplate().delete(getStatement("deleteByPageId"), resourcePageId);
}
@Override
public void updateNavigationId(Long navigationId, Long resourcePageId) {
Map<String, Object> map = new HashMap<>();
map.put("navigationId", navigationId);
map.put("resourcePageId", resourcePageId);
getSessionTemplate().update(getStatement("updateNavigationId"), map);
}
@Override
public List<ResourcePageColumn> getByNavigation(Long navigationId) {
return getSessionTemplate().selectList(getStatement("getByNavigation"), navigationId);
}
}
......@@ -138,4 +138,13 @@ public class ResourcePageDaoImpl extends BaseDaoImpl<ResourcePage> implements Re
map.put("sceneId", sceneId);
getSessionTemplate().update(getStatement("updateBookIdBySceneId"), map);
}
@Override
public void updateNavigationFormat(Long resourcePageId, Integer navigationColor, Integer navigationFormat) {
Map<String, Object> map = new HashMap<>();
map.put("id", resourcePageId);
map.put("navigationColor", navigationColor);
map.put("navigationFormat", navigationFormat);
getSessionTemplate().update(getStatement("updateNavigationFormat"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePageNavigationDao;
import com.pcloud.book.group.entity.ResourcePageNavigation;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName com.pcloud.book.group.dao.impl.ResourcePageNavigationDaoImpl
* @Author zhuyajie
* @Description 资源页导航
* @Date 2021/8/16 10:45
* @Version 1.0
**/
@Component
public class ResourcePageNavigationDaoImpl extends BaseDaoImpl<ResourcePageNavigation> implements ResourcePageNavigationDao {
@Override
public List<ResourcePageNavigation> getByPageId(Long resourcePageId) {
return getSessionTemplate().selectList(getStatement("getByPageId"), resourcePageId);
}
@Override
public List<Long> getNoNavigationPages(Integer openRays) {
Map<String, Object> map = new HashMap<>();
map.put("openRays", openRays);
return getSessionTemplate().selectList(getStatement("getNoNavigationPages"), map);
}
@Override
public ResourcePageNavigation getByType(Long resourcePageId, Integer type) {
Map<String, Object> map = new HashMap<>();
map.put("resourcePageId", resourcePageId);
map.put("navigationType", type);
return getSessionTemplate().selectOne(getStatement("getByType"), map);
}
@Override
public Integer getMaxSeq(Long resourcePageId) {
return getSessionTemplate().selectOne(getStatement("getMaxSeq"), resourcePageId);
}
@Override
public void deleteNavigation(Long resourcePageId, Integer type) {
Map<String, Object> map = new HashMap<>();
map.put("resourcePageId", resourcePageId);
map.put("navigationType", type);
getSessionTemplate().delete(getStatement("deleteNavigation"), map);
}
@Override
public ResourcePageNavigation getByName(Long resourcePageId, String navigationName) {
Map<String, Object> map = new HashMap<>();
map.put("resourcePageId", resourcePageId);
map.put("navigationName", navigationName.trim());
return getSessionTemplate().selectOne(getStatement("getByName"), map);
}
@Override
public void updateSeq4Batch(List<ResourcePageNavigation> list) {
getSessionTemplate().update(getStatement("updateSeq4Batch"), list);
}
@Override
public ResourcePageNavigation getNavigationByMoveType(String moveType, Long resourcePageId, Integer navigationSeq) {
Map<String, Object> map = new HashMap<>();
map.put("resourcePageId", resourcePageId);
map.put("moveType", moveType);
map.put("navigationSeq", navigationSeq);
return getSessionTemplate().selectOne(getStatement("getNavigationByMoveType"), map);
}
@Override
public void updateNavigationSeqNum(Long navigationId, Integer navigationSeq) {
Map<String, Object> map = new HashMap<>();
map.put("id", navigationId);
map.put("navigationSeq", navigationSeq);
getSessionTemplate().update(getStatement("updateNavigationSeqNum"), map);
}
}
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.ResourcePagePicDao;
import com.pcloud.book.group.entity.ResourcePagePic;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName com.pcloud.book.group.dao.impl.ResourcePagePicDaoImpl
* @Author zhuyajie
* @Description 图片库
* @Date 2021/8/24 14:39
* @Version 1.0
**/
@Component
public class ResourcePagePicDaoImpl extends BaseDaoImpl<ResourcePagePic> implements ResourcePagePicDao {
@Override
public List<ResourcePagePic> getByType(Integer type, Long adviserId) {
Map<String, Object> map = new HashMap<>();
map.put("type", type);
map.put("adviserId", adviserId);
return getSessionTemplate().selectList(getStatement("getByType"), map);
}
}
package com.pcloud.book.group.dto;
import com.pcloud.book.group.entity.ResourcePageNavigation;
import java.util.List;
import lombok.Data;
/**
* @ClassName com.pcloud.book.group.dto.NavigationParamDTO
* @Author zhuyajie
* @Description H5导航参数
* @Date 2021/8/17 16:39
* @Version 1.0
**/
@Data
public class NavigationParamDTO {
/**
* 资源页id
*/
private Long resourcePageId;
/**
* 导航列表
*/
private List<ResourcePageNavigation> navigationList;
/**
* 创建人
*/
private Long createUser;
/**
* 导航颜色样式
*/
private Integer navigationColor;
/**
* 导航版式
*/
private Integer navigationFormat;
}
......@@ -66,4 +66,12 @@ public class ResourcePage extends BaseEntity {
* 背景图
*/
private String backgroundImg;
/**
* 导航颜色样式
*/
private Integer navigationColor;
/**
* 导航版式
*/
private Integer navigationFormat;
}
package com.pcloud.book.group.entity;
import java.util.Date;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 实体书购买(ResourcePageBookstore)实体类
*
* @author makejava
* @since 2021-08-16 14:40:27
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResourcePageBookstore extends BaseEntity {
private static final long serialVersionUID = 537657968168101067L;
@ApiModelProperty("实体书购买id")
private Long id;
@ApiModelProperty("资源页id")
private Long resourcePageId;
@ApiModelProperty("服务id")
private Long serveId;
@ApiModelProperty("服务类型;APP/PRODUCT")
private String serveType;
@ApiModelProperty("应用作品相对链接")
private String linkUrl;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
......@@ -52,4 +52,8 @@ public class ResourcePageColumn extends BaseEntity {
* 标签图标
*/
private String labelIcon;
/**
* 导航id
*/
private Long navigationId;
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import lombok.Data;
/**
* 自有码H5页面导航(ResourcePageNavigation)实体类
*
* @author makejava
* @since 2021-08-16 10:43:21
*/
@Data
public class ResourcePageNavigation extends BaseEntity {
private static final long serialVersionUID = 211236647765087489L;
/**
* 资源页id
*/
private Long resourcePageId;
/**
* 类型(1本书配套2书友社区3自定义)
*/
private Integer navigationType;
/**
* 导航名称
*/
private String navigationName;
/**
* 图标
*/
private String navigationIcon;
/**
* 排序值
*/
private Integer navigationSeq;
/**
* 创建人
*/
private Long createUser;
}
\ No newline at end of file
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
/**
* 资源页图片库(ResourcePagePic)实体类
*
* @author makejava
* @since 2021-08-24 14:36:56
*/
@Data
public class ResourcePagePic extends BaseEntity {
private static final long serialVersionUID = -64480926548650160L;
/**
* 图片地址
*/
private String picUrl;
/**
* 是否默认图片
*/
private Integer isDefault;
/**
* 图片类型(1导航标签)
*/
private Integer type;
/**
* 编辑id
*/
private Long adviserId;
}
\ No newline at end of file
package com.pcloud.book.group.facade.impl;
import com.pcloud.book.group.biz.ResourcePageBiz;
import com.pcloud.book.group.dto.NavigationParamDTO;
import com.pcloud.book.group.entity.ResourcePageCollect;
import com.pcloud.book.group.entity.ResourcePagePic;
import com.pcloud.book.group.entity.ResourceRecomManage;
import com.pcloud.book.group.vo.ResourcePageVO;
import com.pcloud.book.group.vo.UpdateResourceColumnVO;
......@@ -70,9 +72,10 @@ public class ResourcePageFacade {
@ApiOperation("编辑端-根据页面id查资源页栏目及资源")
@GetMapping("getColumnAndServeListByPageId")
public ResponseDto<?> getColumnAndServeListByPageId(@RequestHeader("token") String token,
@RequestParam("resourcePageId") Long resourcePageId){
@RequestParam("resourcePageId") Long resourcePageId,
@RequestParam(value = "navigationId", required = false) Long navigationId){
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, false, null, null, null, null));
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, false, null, null, null, null, navigationId));
}
@ApiOperation("客户端-根据书刊查资源页基本配置")
......@@ -92,9 +95,10 @@ public class ResourcePageFacade {
@RequestParam(value = "bookId", required = false) Long bookId,
@RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "channelId", required = false) Long channelId,
@RequestParam(value = "enableAdverting", required = false) Integer enableAdverting){
@RequestParam(value = "enableAdverting", required = false) Integer enableAdverting,
@RequestParam(value = "navigationId", required = false) Long navigationId){
Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, true, bookId, adviserId, channelId, enableAdverting));
return new ResponseDto<>(resourcePageBiz.getColumnAndServeListByPageId(resourcePageId, true, bookId, adviserId, channelId, enableAdverting, navigationId));
}
@ApiOperation("客户端分页查栏目资源")
......@@ -279,6 +283,51 @@ public class ResourcePageFacade {
return new ResponseDto<>();
}
@ApiOperation("保存导航")
@PostMapping("saveNavigation")
public ResponseDto<?> saveNavigation(@RequestHeader("token") String token,
@RequestBody NavigationParamDTO navigationParamDTO) {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
navigationParamDTO.setCreateUser(partyId);
resourcePageBiz.saveNavigation(navigationParamDTO);
return new ResponseDto<>();
}
@ApiOperation("添加导航图片到图片库")
@PostMapping("addNavigationPic")
public ResponseDto<?> addNavigationPic(@RequestHeader("token") String token,
@RequestBody ResourcePagePic resourcePagePic) {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
resourcePagePic.setAdviserId(partyId);
resourcePageBiz.addNavigationPic(resourcePagePic);
return new ResponseDto<>();
}
@ApiOperation("删除导航图片库图片")
@GetMapping("deleteNavigationPic")
public ResponseDto<?> deleteNavigationPic(@RequestHeader("token") String token,
@RequestParam("id") Long id) {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
resourcePageBiz.deleteNavigationPic(id);
return new ResponseDto<>();
}
@ApiOperation("查询导航图片库图片")
@GetMapping("listNavigationPic")
public ResponseDto<?> listNavigationPic(@RequestHeader("token") String token,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage) {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(resourcePageBiz.listNavigationPic(partyId, currentPage, numPerPage));
}
@ApiOperation("栏目重新排序")
@PostMapping("batchUpdateColumnSeq")
public ResponseDto<?> batchUpdateColumnSeq(@RequestBody List<Long> navigationIds) {
resourcePageBiz.batchUpdateColumnSeq(navigationIds);
return new ResponseDto<>();
}
@ApiOperation("客户端-根据页面id查要弹出的二维码")
@GetMapping("getPopupQrcode4Wechat")
public ResponseDto<?> getPopupQrcode4Wechat(@CookieValue("userInfo") String userInfo,
......
......@@ -92,4 +92,9 @@ public class ResourceColumnAndServeVO extends BaseDto{
@ApiModelProperty("广告配置项信息")
private List<AdvertisingSpaceItemDTO> advertisingItemList;
/**
* 导航id
*/
private Long navigationId;
}
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* 实体书购买(ResourcePageBookstore)实体类
*
* @author makejava
* @since 2021-08-16 14:40:27
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResourcePageBookstoreVO {
@ApiModelProperty("实体书购买id")
private Long id;
@ApiModelProperty("资源页id")
private Long resourcePageId;
@ApiModelProperty("服务id")
private Long serveId;
@ApiModelProperty("相对链接")
private String linkUrl;
@ApiModelProperty("跳转结果页链接")
private String resultUrl;
@ApiModelProperty("服务类型;APP/PRODUCT")
private String serveType;
@ApiModelProperty("服务名称")
private String serveName;
@ApiModelProperty("图片")
private String servePic;
@ApiModelProperty("服务类型")
private String serveTypeCode;
@ApiModelProperty("服务类型名称")
private String serveTypeName;
@ApiModelProperty("创建时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
}
package com.pcloud.book.group.vo;
import com.pcloud.book.group.entity.ResourcePageNavigation;
import com.pcloud.common.dto.BaseDto;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import lombok.Data;
/**
......@@ -88,4 +92,19 @@ public class ResourcePageVO extends BaseDto {
* 背景图
*/
private String backgroundImg;
@ApiModelProperty("实体书购买")
private List<ResourcePageBookstoreVO> resourcePageBookstoreList;
/**
* 导航
*/
private List<ResourcePageNavigation> navigationList;
/**
* 导航颜色样式
*/
private Integer navigationColor;
/**
* 导航版式
*/
private Integer navigationFormat;
}
......@@ -66,4 +66,8 @@ public class UpdateResourceColumnVO {
* 标签图标
*/
private String labelIcon;
/**
* 导航id
*/
private Long navigationId;
}
......@@ -4,6 +4,7 @@ import java.util.List;
import javax.validation.constraints.NotNull;
import com.pcloud.book.group.entity.ResourcePageBookstore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -58,4 +59,7 @@ public class UpdateResourcePageVO {
* 背景图
*/
private String backgroundImg;
@ApiModelProperty("实体书购买")
private List<ResourcePageBookstore> resourcePageBookstoreList;
}
......@@ -322,7 +322,7 @@ public class PushBizImpl implements PushBiz {
//获取群信息
GroupQrcode groupQrcode = groupQrcodeDao.getById(pushGroup.getBookGroupQrcodeId());
if (groupQrcode == null) {
LOGGER.error("未找到群信息!qrcodeId=" + pushGroup.getBookGroupQrcodeId());
LOGGER.warn("未找到群信息!qrcodeId=" + pushGroup.getBookGroupQrcodeId());
continue;
}
//获取机器人微信号
......@@ -334,9 +334,8 @@ public class PushBizImpl implements PushBiz {
LOGGER.info("发送一个群里的一个消息结束,休眠1秒pushGroup=" + pushGroup.toString() + "pushItem=" + pushItem.toString() + "altId=" + altId);
Thread.sleep(1000);
} catch (InterruptedException e) {
LOGGER.error("发消息休眠1秒出错", e);
LOGGER.warn("发消息休眠1秒出错");
}
}
}
}
......@@ -349,8 +348,7 @@ public class PushBizImpl implements PushBiz {
//获取群信息
GroupQrcode groupQrcode = groupQrcodeDao.getById(pushGroup.getBookGroupQrcodeId());
if (groupQrcode == null) {
LOGGER.error("未找到群信息!");
return;
throw new BookBizException(BookBizException.PARAM_IS_NULL, "未找到群信息");
}
String groupId = groupQrcode.getWeixinGroupId();
ClassifyDTO classifyDTO = bookGroupClassifyDao.getById(groupQrcode.getClassifyId());
......
......@@ -1201,7 +1201,7 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
if (null == resourcePageVO || null == resourcePageVO.getId()) {
return;
}
List<ResourceColumnAndServeVO> serveVOList = resourcePageBiz.getColumnAndServeListByPageId(resourcePageVO.getId(), false, null, null, null, null);
List<ResourceColumnAndServeVO> serveVOList = resourcePageBiz.getColumnAndServeListByPageId(resourcePageVO.getId(), false, null, null, null, null, null);
UpdateResourceColumnVO columnVO = new UpdateResourceColumnVO();
columnVO.setColumnFormat(3);
columnVO.setColumnName("精品资讯");
......
......@@ -14,6 +14,11 @@ public class ThreadPoolUtils {
*/
public static final int REMOTE_TIME_OUT = 5;
/**
* 远程调用超时时间(单位:秒)
*/
public static final int REMOTE_TIME_OUT_LONG = 30;
/**
* 异步导出线程池
......
......@@ -14,23 +14,24 @@
<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" />
<result column="open_pay" property="openPay" 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_authorized_pay
is_paper_book, is_group_book, is_authorized_pay, open_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}, IFNULL(#{isAuthorizedPay},0))
#{isPaperBook}, #{isGroupBook}, IFNULL(#{isAuthorizedPay},0), IFNULL(#{openPay},1))
</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, is_authorized_pay
ID, BOOK_ID, CHANNEL_ID,ADVISER_ID,PRICE,CODE_USE_COUNT,BUY_URL,CHECK_TYPE,BOOK_STATUS,LOCATION_DESC, is_authorized_pay, open_pay
FROM
BOOK_AUTH_INFO
WHERE
......@@ -267,6 +268,9 @@
<if test="isAuthorizedPay != null">
is_authorized_pay = #{isAuthorizedPay},
</if>
<if test="openPay != null">
open_pay = #{openPay},
</if>
LAST_MODIFIED_DATE = NOW()
WHERE
ID = #{id}
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.group.dao.impl.ResourcePageBookstoreDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.ResourcePageBookstore">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="resource_page_id" property="resourcePageId" jdbcType="BIGINT"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="link_url" property="linkUrl" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<resultMap id="BaseDtoResultMap" extends="BaseResultMap" type="com.pcloud.book.group.vo.ResourcePageBookstoreVO">
</resultMap>
<sql id="Base_Column_List">
id, resource_page_id, serve_id, serve_type, link_url, create_time
</sql>
<select id="getById" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM resource_page_bookstore
WHERE id = #{id}
</select>
<select id="getByResourcePageId" resultMap="BaseDtoResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM resource_page_bookstore
WHERE resource_page_id = #{resourcePageId}
</select>
<select id="getList" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM resource_page_bookstore
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO resource_page_bookstore(
resource_page_id,
serve_id,
serve_type,
link_url,
create_time
) VALUES (
#{resourcePageId, jdbcType=BIGINT},
#{serveId, jdbcType=BIGINT},
#{serveType, jdbcType=VARCHAR},
#{linkUrl, jdbcType=VARCHAR},
NOW()
)
</insert>
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
INSERT INTO resource_page_bookstore (
resource_page_id,
serve_id,
serve_type,
link_url,
create_time
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.resourcePageId, jdbcType=BIGINT},
#{item.serveId, jdbcType=BIGINT},
#{item.serveType, jdbcType=VARCHAR},
#{item.linkUrl, jdbcType=VARCHAR},
NOW()
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
UPDATE resource_page_bookstore
<set>
<if test="resourcePageId != null">
resource_page_id = #{resourcePageId},
</if>
<if test="serveId != null">
serve_id = #{serveId},
</if>
<if test="serveType != null and serveType != ''">
serve_type = #{serveType},
</if>
<if test="linkUrl != null and linkUrl != ''">
link_url = #{linkUrl},
</if>
</set>
WHERE id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
DELETE FROM resource_page_bookstore WHERE id = #{id}
</delete>
<!--通过主键删除-->
<delete id="deleteByResourcePageId">
DELETE FROM resource_page_bookstore WHERE resource_page_id = #{resourcePageId}
</delete>
</mapper>
......@@ -15,6 +15,7 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="createUser" column="create_user" jdbcType="INTEGER"/>
<result property="labelIcon" column="label_icon" jdbcType="VARCHAR"/>
<result property="navigationId" column="navigation_id" jdbcType="INTEGER"/>
</resultMap>
<resultMap id="ResourceColumnAndServe" type="com.pcloud.book.group.vo.ResourceColumnAndServeVO">
......@@ -27,12 +28,13 @@
<result property="showCount" column="show_count" jdbcType="INTEGER"/>
<result property="showMore" column="show_more" jdbcType="BOOLEAN"/>
<result property="labelIcon" column="label_icon" jdbcType="VARCHAR"/>
<result property="navigationId" column="navigation_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="getById" resultMap="ResourcePageColumnMap">
select
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more,show_count, create_time, label_icon
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more,show_count, create_time, label_icon, navigation_id
from book.resource_page_column
where id = #{id}
</select>
......@@ -40,9 +42,9 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.resource_page_column(resource_page_id, column_type, column_name, column_format, column_seq,
show_more, show_count, create_time, update_time, create_user, label_icon)
show_more, show_count, create_time, update_time, create_user, label_icon, navigation_id)
values (#{resourcePageId}, #{columnType}, #{columnName}, #{columnFormat}, #{columnSeq},
#{showMore}, #{showCount}, now(), now(), #{createUser}, #{labelIcon})
#{showMore}, #{showCount}, now(), now(), #{createUser}, #{labelIcon}, #{navigationId})
</insert>
<!--通过主键修改数据-->
......@@ -69,6 +71,9 @@
</if>
label_icon = #{labelIcon},
update_time = now(),
<if test="navigationId != null">
navigation_id = #{navigationId},
</if>
</set>
where id = #{id}
</update>
......@@ -78,15 +83,18 @@
delete from book.resource_page_column where id = #{id}
</delete>
<select id="getMaxSeq" parameterType="long" resultType="integer">
<select id="getMaxSeq" parameterType="map" resultType="integer">
SELECT
IFNULL(MAX(column_seq), 0)
FROM
book.resource_page_column
where resource_page_id = #{resourcePageId}
<if test="navigationId != null">
and navigation_id = #{navigationId}
</if>
</select>
<select id="getColumnListByPageId" resultMap="ResourceColumnAndServe" parameterType="long">
<select id="getColumnListByPageId" resultMap="ResourceColumnAndServe" parameterType="map">
SELECT
resource_page_id,
id,
......@@ -96,11 +104,15 @@
column_seq,
show_count,
show_more,
label_icon
label_icon,
navigation_id
FROM
resource_page_column
WHERE
resource_page_id = #{resourcePageId}
<if test="navigationId != null">
and navigation_id = #{navigationId}
</if>
ORDER BY
column_seq ASC,
id ASC
......@@ -108,7 +120,7 @@
<select id="getByColumnTypeAndPage" parameterType="map" resultMap="ResourcePageColumnMap">
select
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id
from book.resource_page_column
where resource_page_id = #{resourcePageId}
and column_type = #{columnType}
......@@ -123,11 +135,12 @@
<select id="getColumByMoveType" parameterType="map" resultMap="ResourcePageColumnMap">
SELECT
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more, show_count, create_time, navigation_id
FROM
book.resource_page_column
WHERE
resource_page_id = #{resourcePageId}
AND navigation_id = #{navigationId}
<choose>
<when test="moveType == 'UP'">
AND column_seq &lt; #{columnSeq}
......@@ -157,4 +170,18 @@
<delete id="deleteByPageId" parameterType="long">
delete from book.resource_page_column where resource_page_id = #{resourcePageId}
</delete>
<update id="updateNavigationId" parameterType="map">
update book.resource_page_column
set navigation_id = #{navigationId}
where resource_page_id = #{resourcePageId}
</update>
<select id="getByNavigation" resultMap="ResourcePageColumnMap" parameterType="long">
select
id, resource_page_id, column_type, column_name, column_format, column_seq, show_more,show_count, create_time, label_icon, navigation_id
from book.resource_page_column
where navigation_id = #{navigationId}
</select>
</mapper>
\ No newline at end of file
......@@ -19,11 +19,13 @@
<result property="bookId" column="book_id" jdbcType="INTEGER"/>
<result property="channelId" column="channel_id" jdbcType="INTEGER"/>
<result property="backgroundImg" column="background_img" jdbcType="VARCHAR"/>
<result property="navigationColor" column="navigation_color" jdbcType="INTEGER"/>
<result property="navigationFormat" column="navigation_format" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, book_group_id, style, show_book, open_rays, open_food, create_time, update_time, create_user, qrcode_url, scene_id, official_scene_id,
book_cover, book_id, channel_id, background_img
book_cover, book_id, channel_id, background_img, navigation_color, navigation_format
</sql>
<!--查询单个-->
......@@ -88,8 +90,7 @@
<select id="getByBookGroupId" parameterType="long" resultMap="ResourcePageMap">
select
id, book_group_id, style, show_book, open_rays, open_food, qrcode_url, official_scene_id, book_cover, book_id, channel_id, create_user,
background_img
<include refid="Base_Column_List"/>
from book.resource_page
where book_group_id = #{bookGroupId}
limit 1
......@@ -105,7 +106,9 @@
p.open_rays,
p.open_food,
p.scene_id,
p.background_img
p.background_img,
p.navigation_color,
p.navigation_format
FROM
resource_page p
LEFT JOIN resource_page_item i ON p.id = i.resource_page_id
......@@ -134,8 +137,7 @@
<select id="getBySceneId" parameterType="long" resultMap="ResourcePageMap">
select
id, book_group_id, style, show_book, open_rays, open_food, qrcode_url, scene_id, official_scene_id, book_cover,book_id, channel_id, create_user,
background_img
<include refid="Base_Column_List"/>
from book.resource_page
where scene_id = #{sceneId}
limit 1
......@@ -281,4 +283,18 @@
scene_id = #{sceneId}
</update>
<select id="updateNavigationFormat" parameterType="map">
UPDATE resource_page
<set>
<if test="navigationColor != null">
navigation_color = #{navigationColor},
</if>
<if test="navigationFormat != null">
navigation_format = #{navigationFormat},
</if>
update_time = NOW(),
</set>
where id = #{id}
</select>
</mapper>
......@@ -197,6 +197,7 @@
resource_page_item i
LEFT JOIN resource_page p ON i.resource_page_id = p.id
LEFT JOIN resource_page_column c ON i.resource_page_column_id = c.id
LEFT JOIN resource_page_navigation n ON c.navigation_id = n.id
WHERE
p.scene_id IN
<foreach collection="list" index="index" separator="," open="(" close=")" item="item">
......@@ -204,7 +205,7 @@
</foreach>
AND i.serve_type IN ('APP', 'PRODUCT')
ORDER BY
c.column_seq ASC, i.seq_num ASC, i.id ASC
n.navigation_seq ASC, c.column_seq ASC, i.seq_num ASC, i.id ASC
</select>
<!--只配置了1个应用作品,且不开启小睿-->
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.group.dao.impl.ResourcePageNavigationDaoImpl">
<resultMap type="com.pcloud.book.group.entity.ResourcePageNavigation" id="ResourcePageNavigationMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="resourcePageId" column="resource_page_id" jdbcType="INTEGER"/>
<result property="navigationType" column="navigation_type" jdbcType="INTEGER"/>
<result property="navigationName" column="navigation_name" jdbcType="VARCHAR"/>
<result property="navigationIcon" column="navigation_icon" jdbcType="VARCHAR"/>
<result property="navigationSeq" column="navigation_seq" jdbcType="INTEGER"/>
<result property="createUser" column="create_user" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, resource_page_id, navigation_type, navigation_name, navigation_icon, navigation_seq
</sql>
<!--查询单个-->
<select id="getById" resultMap="ResourcePageNavigationMap">
select
<include refid="Base_Column_List"/>
from book.resource_page_navigation
where id = #{id}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.resource_page_navigation(resource_page_id, navigation_type, navigation_name, navigation_icon, navigation_seq, create_user, create_time, update_time)
values (#{resourcePageId}, #{navigationType}, #{navigationName}, #{navigationIcon}, #{navigationSeq}, #{createUser}, now(), now())
</insert>
<insert id="batchInsert" keyProperty="id" useGeneratedKeys="true">
insert into book.resource_page_navigation(resource_page_id, navigation_type, navigation_name, navigation_icon, navigation_seq, create_user, create_time, update_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.resourcePageId}, #{item.navigationType}, #{item.navigationName}, #{item.navigationIcon}, #{item.navigationSeq}, #{item.createUser}, now(), now())
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="update">
update book.resource_page_navigation
<set>
<if test="navigationName != null and navigationName != ''">
navigation_name = #{navigationName},
</if>
navigation_icon = #{navigationIcon},
<if test="navigationSeq != null">
navigation_seq = #{navigationSeq},
</if>
update_time = now(),
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from book.resource_page_navigation where id = #{id}
</delete>
<select id="getByPageId" parameterType="long" resultMap="ResourcePageNavigationMap">
select
<include refid="Base_Column_List"/>
from book.resource_page_navigation
where resource_page_id = #{resourcePageId}
order by navigation_seq asc, id asc
</select>
<select id="getNoNavigationPages" resultType="long" parameterType="map">
SELECT
r.id
FROM
resource_page r
LEFT JOIN resource_page_navigation n ON r.id = n.resource_page_id
<if test="openRays != null and openRays == 1">
AND n.navigation_type = 2
</if>
WHERE
n.id IS NULL
<if test="openRays != null and openRays == 1">
AND r.open_rays = #{openRays}
</if>
</select>
<select id="getByType" parameterType="map" resultMap="ResourcePageNavigationMap">
select
<include refid="Base_Column_List"/>
from book.resource_page_navigation
where resource_page_id = #{resourcePageId}
and navigation_type = #{navigationType}
limit 1
</select>
<select id="getMaxSeq" parameterType="long" resultType="integer">
SELECT
IFNULL(MAX(navigation_seq), 0)
FROM
book.resource_page_navigation
where resource_page_id = #{resourcePageId}
</select>
<delete id="deleteNavigation" parameterType="map">
DELETE
from book.resource_page_navigation
where resource_page_id = #{resourcePageId}
and navigation_type = #{navigationType}
</delete>
<select id="getByName" parameterType="map" resultMap="ResourcePageNavigationMap">
select
<include refid="Base_Column_List"/>
from book.resource_page_navigation
where resource_page_id = #{resourcePageId}
and navigation_name = #{navigationName}
limit 1
</select>
<update id="updateSeq4Batch" parameterType="list">
update book.resource_page_navigation set navigation_seq =
<foreach collection="list" open="CASE" separator=" " close="END" item="item">
WHEN id = #{item.id} THEN #{item.navigationSeq}
</foreach>
where id IN
<foreach collection="list" item="item" close=")" separator="," open="(">
${item.id}
</foreach>
</update>
<select id="getNavigationByMoveType" parameterType="map" resultMap="ResourcePageNavigationMap">
SELECT
<include refid="Base_Column_List"/>
FROM
book.resource_page_navigation
WHERE
resource_page_id = #{resourcePageId}
<choose>
<when test="moveType == 'UP'">
AND navigation_seq &lt; #{navigationSeq}
ORDER BY
navigation_seq DESC
</when>
<otherwise>
AND navigation_seq > #{navigationSeq}
ORDER BY
navigation_seq ASC
</otherwise>
</choose>
LIMIT 1
</select>
<update id="updateNavigationSeqNum" parameterType="map">
update resource_page_navigation
set navigation_seq = #{navigationSeq},
update_time = now()
where id = #{id}
</update>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pcloud.book.group.dao.impl.ResourcePagePicDaoImpl">
<resultMap type="com.pcloud.book.group.entity.ResourcePagePic" id="ResourcePagePicMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="picUrl" column="pic_url" jdbcType="VARCHAR"/>
<result property="isDefault" column="is_default" jdbcType="INTEGER"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="adviserId" column="adviser_id" jdbcType="INTEGER"/>
</resultMap>
<!--查询单个-->
<select id="getById" resultMap="ResourcePagePicMap">
select
id, pic_url, is_default, type, create_time, adviser_id
from resource_page_pic
where id = #{id}
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into resource_page_pic(pic_url, is_default, type, create_time, adviser_id)
values (#{picUrl}, #{isDefault}, #{type}, now(), #{adviserId})
</insert>
<!--通过主键修改数据-->
<update id="update">
update resource_page_pic
<set>
<if test="picUrl != null and picUrl != ''">
pic_url = #{picUrl},
</if>
<if test="isDefault != null">
is_default = #{isDefault},
</if>
<if test="type != null">
type = #{type},
</if>
<if test="createTime != null">
create_time = #{createTime},
</if>
<if test="adviserId != null">
adviser_id = #{adviserId},
</if>
</set>
where id = #{id}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from resource_page_pic where id = #{id}
</delete>
<select id="getByType" parameterType="map" resultMap="ResourcePagePicMap">
select
id, pic_url, is_default, type, create_time
from resource_page_pic
WHERE (adviser_id = #{adviserId} OR is_default=1)
<if test="type != null">
AND type = #{type}
</if>
ORDER BY is_default ASC, id DESC
</select>
</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