Commit 93e0d7fa by 裴大威

Merge branch 'feat-1002780' into 'master'

1002780+1002786

See merge request rays/pcloud-book!647
parents fc8825e0 a77419a6
...@@ -111,4 +111,15 @@ public interface AppletNewsBiz { ...@@ -111,4 +111,15 @@ public interface AppletNewsBiz {
* @param appletNews * @param appletNews
*/ */
void updateNewsShowState(AppletNews appletNews); void updateNewsShowState(AppletNews appletNews);
/**
* 根据书刊分类标签权益分类查询
* @param firstClassify
* @param secondClassify
* @param gradeLabelId
* @param subjectLabelId
* @param rightsType
* @return
*/
List<AppletNewsDTO> getNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType);
} }
package com.pcloud.book.applet.biz; package com.pcloud.book.applet.biz;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO; import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
...@@ -40,4 +41,7 @@ public interface AppletUserBookcaseBiz { ...@@ -40,4 +41,7 @@ public interface AppletUserBookcaseBiz {
* @return * @return
*/ */
Map<String,Object> getUserClickStatistic(Long wechatUserId, Long bookId, Long channelId, Long adviserId); Map<String,Object> getUserClickStatistic(Long wechatUserId, Long bookId, Long channelId, Long adviserId);
UserLastBookReDTO getUserLastBookRe(Long wechatUserId);
} }
...@@ -14,6 +14,8 @@ import com.pcloud.book.applet.entity.AppletNewsComment; ...@@ -14,6 +14,8 @@ import com.pcloud.book.applet.entity.AppletNewsComment;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr; import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.reader.ReaderConsr; import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils; import com.pcloud.common.utils.ListUtils;
...@@ -46,6 +48,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -46,6 +48,8 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
private AppletNewsCommentDao appletNewsCommentDao; private AppletNewsCommentDao appletNewsCommentDao;
@Autowired @Autowired
private ReaderConsr readerConsr; private ReaderConsr readerConsr;
@Autowired
private RightsSettingBiz rightsSettingBiz;
@Override @Override
public Long addAppletNewsClassify(AppletNewsClassify appletNewsClassify) { public Long addAppletNewsClassify(AppletNewsClassify appletNewsClassify) {
...@@ -85,6 +89,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -85,6 +89,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
@Override @Override
public Long addAppletNews(AppletNews appletNews) { public Long addAppletNews(AppletNews appletNews) {
appletNews.setShowState(false); appletNews.setShowState(false);
rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.insert(appletNews); appletNewsDao.insert(appletNews);
return appletNews.getId(); return appletNews.getId();
} }
...@@ -94,6 +99,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -94,6 +99,7 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
if (null == appletNews.getId()){ if (null == appletNews.getId()){
throw new BookBizException(BookBizException.ERROR,"id为空"); throw new BookBizException(BookBizException.ERROR,"id为空");
} }
rightsSettingBiz.setClassifyAndLabel(appletNews);
appletNewsDao.update(appletNews); appletNewsDao.update(appletNews);
} }
...@@ -222,4 +228,17 @@ public class AppletNewsBizImpl implements AppletNewsBiz { ...@@ -222,4 +228,17 @@ public class AppletNewsBizImpl implements AppletNewsBiz {
public void updateNewsShowState(AppletNews appletNews) { public void updateNewsShowState(AppletNews appletNews) {
appletNewsDao.updateNewsShowState(appletNews); appletNewsDao.updateNewsShowState(appletNews);
} }
@Override
public List<AppletNewsDTO> getNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType) {
BaseTempletClassify classify = new BaseTempletClassify();
classify.setFirstClassify(firstClassify);
classify.setSecondClassify(secondClassify);
classify.setGradeLabelId(gradeLabelId);
classify.setSubjectLabelId(subjectLabelId);
rightsSettingBiz.setClassifyAndLabel(classify);
List<AppletNewsDTO> list = new ArrayList<>();
list=appletNewsDao.getByNewsByTempletLabel(classify.getFirstClassify(),classify.getSecondClassify(),classify.getGradeLabelId(),classify.getSubjectLabelId(),rightsType);
return list;
}
} }
...@@ -4,8 +4,10 @@ import com.pcloud.appcenter.assist.dto.AssistTempletDTO; ...@@ -4,8 +4,10 @@ import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz; import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO; import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.dao.BookRaysClassifyDao; import com.pcloud.book.book.dao.BookRaysClassifyDao;
import com.pcloud.book.book.entity.BookRaysClassify; import com.pcloud.book.book.entity.BookRaysClassify;
import com.pcloud.book.consumer.app.AssistTempletConsr; import com.pcloud.book.consumer.app.AssistTempletConsr;
...@@ -13,6 +15,9 @@ import com.pcloud.book.consumer.user.AdviserConsr; ...@@ -13,6 +15,9 @@ import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.group.biz.BookGroupBiz; import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.dto.BookServeDTO; import com.pcloud.book.group.dto.BookServeDTO;
import com.pcloud.book.group.enums.JoinGroupTypeEnum; import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils; import com.pcloud.common.utils.DateUtils;
...@@ -48,6 +53,8 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { ...@@ -48,6 +53,8 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
private BookGroupBiz bookGroupBiz; private BookGroupBiz bookGroupBiz;
@Autowired @Autowired
private BookRaysClassifyDao bookRaysClassifyDao; private BookRaysClassifyDao bookRaysClassifyDao;
@Autowired
private RightsSettingBiz rightsSettingBiz;
@Override @Override
public void addUserBook(AppletUserBookcase appletUserBookcase) { public void addUserBook(AppletUserBookcase appletUserBookcase) {
...@@ -168,4 +175,39 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz { ...@@ -168,4 +175,39 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
} }
@ParamLog("获取用户最后一次点击的书(有社群书的取最后一次社群书,没有的取现代纸书)")
@Override
public UserLastBookReDTO getUserLastBookRe(Long wechatUserId) {
if (wechatUserId==null){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误!");
}
//查询最后一本社群书
UserLastBookReDTO lastBookRe = appletUserBookcaseDao.getUserLastGroupBookRe(wechatUserId);
if (lastBookRe!=null){
lastBookRe.setHasBook(true);
lastBookRe.setBookGroup(true);
RightsSettingDto rightsSettingDto = rightsSettingBiz.getRightsSettingByBookId4AppletHome(lastBookRe.getBookId(), lastBookRe.getAdviserId(), lastBookRe.getChannelId());
if (rightsSettingDto!=null){
lastBookRe.setRightSettingId(rightsSettingDto.getId());
}
return lastBookRe;
}else {
//查询最后一本书
UserLastBookReDTO userLastRe = appletUserBookcaseDao.getUserLastRe(wechatUserId);
if (userLastRe!=null){
userLastRe.setBookGroup(false);
userLastRe.setHasBook(true);
RightsSettingDto rightsSettingDto = rightsSettingBiz.getRightsSettingByBookId4AppletHome(userLastRe.getBookId(), userLastRe.getAdviserId(), userLastRe.getChannelId());
if (rightsSettingDto!=null){
userLastRe.setRightSettingId(rightsSettingDto.getId());
}
return userLastRe;
}else {
lastBookRe=new UserLastBookReDTO();
lastBookRe.setHasBook(false);
return lastBookRe;
}
}
}
} }
package com.pcloud.book.applet.dao; package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List; import java.util.List;
...@@ -23,4 +24,17 @@ public interface AppletNewsDao extends BaseDao<AppletNews> { ...@@ -23,4 +24,17 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* @param appletNews * @param appletNews
*/ */
void updateNewsShowState(AppletNews appletNews); void updateNewsShowState(AppletNews appletNews);
/**
* 根据分类标签查资讯
* @param firstClassify
* @param secondClassify
* @param gradeLabelId
* @param subjectLabelId
* @param rightsType
* @return
*/
List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType);
List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long rightsClassifyId, Integer top);
} }
package com.pcloud.book.applet.dao; package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO; import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -43,4 +44,8 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> { ...@@ -43,4 +44,8 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
* @param appletUserBookcase * @param appletUserBookcase
*/ */
void deleteByBookIdUserId(AppletUserBookcase appletUserBookcase); void deleteByBookIdUserId(AppletUserBookcase appletUserBookcase);
UserLastBookReDTO getUserLastGroupBookRe(Long wechatUserId);
UserLastBookReDTO getUserLastRe(Long wechatUserId);
} }
package com.pcloud.book.applet.dao.impl; package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletNewsDao; import com.pcloud.book.applet.dao.AppletNewsDao;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.entity.AppletNews; import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 小程序资讯 * 小程序资讯
...@@ -22,4 +25,26 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet ...@@ -22,4 +25,26 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
public void updateNewsShowState(AppletNews appletNews) { public void updateNewsShowState(AppletNews appletNews) {
getSessionTemplate().update(getStatement("updateNewsShowState"),appletNews); getSessionTemplate().update(getStatement("updateNewsShowState"),appletNews);
} }
@Override
public List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType) {
Map<String,Object> map = new HashMap<>();
map.put("firstClassify", firstClassify);
map.put("secondClassify", secondClassify);
map.put("gradeLabelId",gradeLabelId);
map.put("subjectLabelId", subjectLabelId);
map.put("rightsType",rightsType);
return getSessionTemplate().selectList(getStatement("getByNewsByTempletLabel"),map);
}
@Override
public List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long rightsClassifyId, Integer top) {
Map<String,Object> map = new HashMap<>();
map.put("firstClassify", firstClassify);
map.put("secondClassify", secondClassify);
map.put("rightsClassifyId",rightsClassifyId);
map.put("top", top);
return getSessionTemplate().selectList(getStatement("getByTempletAndClassify"),map);
}
} }
package com.pcloud.book.applet.dao.impl; package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao; import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -50,4 +51,14 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i ...@@ -50,4 +51,14 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
public void deleteByBookIdUserId(AppletUserBookcase appletUserBookcase) { public void deleteByBookIdUserId(AppletUserBookcase appletUserBookcase) {
getSessionTemplate().delete(getStatement("deleteByBookIdUserId"),appletUserBookcase); getSessionTemplate().delete(getStatement("deleteByBookIdUserId"),appletUserBookcase);
} }
@Override
public UserLastBookReDTO getUserLastGroupBookRe(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getUserLastGroupBookRe"),wechatUserId);
}
@Override
public UserLastBookReDTO getUserLastRe(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getUserLastRe"),wechatUserId);
}
} }
...@@ -53,4 +53,16 @@ public class AppletNewsDTO extends BaseDto { ...@@ -53,4 +53,16 @@ public class AppletNewsDTO extends BaseDto {
timezone = "GMT+8" timezone = "GMT+8"
) )
protected Date createTime; protected Date createTime;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("权益分类id")
private Long rightsClassifyId;
} }
package com.pcloud.book.applet.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/20 11:00
**/
@Data
public class UserLastBookReDTO {
@ApiModelProperty("是否有书")
private Boolean hasBook;
@ApiModelProperty("书id")
private Long bookId;
@ApiModelProperty("是否社群书")
private Boolean bookGroup;
@ApiModelProperty("编辑id")
private Long adviserId;
@ApiModelProperty("运营Id")
private Long channelId;
@ApiModelProperty("权益id")
private Long rightSettingId;
}
package com.pcloud.book.applet.entity; package com.pcloud.book.applet.entity;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
...@@ -7,7 +8,7 @@ import lombok.Data; ...@@ -7,7 +8,7 @@ import lombok.Data;
@Data @Data
@ApiModel("小程序资讯") @ApiModel("小程序资讯")
public class AppletNews extends BaseEntity { public class AppletNews extends BaseTempletClassify {
@ApiModelProperty("资讯") @ApiModelProperty("资讯")
private String newsName; private String newsName;
...@@ -35,4 +36,14 @@ public class AppletNews extends BaseEntity { ...@@ -35,4 +36,14 @@ public class AppletNews extends BaseEntity {
private String content; private String content;
@ApiModelProperty("是否展示") @ApiModelProperty("是否展示")
private Boolean showState; private Boolean showState;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("权益分类id")
private Long rightsClassifyId;
} }
...@@ -22,6 +22,7 @@ import com.pcloud.book.applet.entity.AppletNewsComment; ...@@ -22,6 +22,7 @@ import com.pcloud.book.applet.entity.AppletNewsComment;
import com.pcloud.book.applet.entity.AppletUserBookcase; import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord; import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
...@@ -58,6 +59,8 @@ public class AppletHomeFacade { ...@@ -58,6 +59,8 @@ public class AppletHomeFacade {
private AppletNewsBiz appletNewsBiz; private AppletNewsBiz appletNewsBiz;
@Autowired @Autowired
private AppletUserBookcaseBiz appletUserBookcaseBiz; private AppletUserBookcaseBiz appletUserBookcaseBiz;
@Autowired
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
@ApiOperation("新增书单栏目") @ApiOperation("新增书单栏目")
@PostMapping("addBooklistClassify") @PostMapping("addBooklistClassify")
...@@ -572,6 +575,32 @@ public class AppletHomeFacade { ...@@ -572,6 +575,32 @@ public class AppletHomeFacade {
appletNewsBiz.updateNewsShowState(appletNews); appletNewsBiz.updateNewsShowState(appletNews);
return new ResponseDto<>(); return new ResponseDto<>();
} }
@ApiOperation("获取用户最后一次点击的书(有社群书的取最后一次社群书,没有的取现代纸书)")
@GetMapping("getUserLastBookRe")
public ResponseDto<?> getUserLastBookRe(
@CookieValue("userInfo") String userInfo
) throws PermissionException{
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
return new ResponseDto<>(appletUserBookcaseBiz.getUserLastBookRe(wechatUserId));
}
@ApiOperation("获取社群共读")
@GetMapping("getGroupActivity4Applet")
public ResponseDto<?> getGroupActivity4Applet(
@CookieValue("userInfo") String userInfo,
@RequestParam(value = "firstClassify", required = true) Long firstClassify,
@RequestParam(value = "secondClassify", required = false) Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId
) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null == wechatUserId){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"缺少参数");
}
return new ResponseDto<>(pcloudGroupActivityBiz.getGroupActivity4Applet(firstClassify, secondClassify, gradeLabelId, subjectLabelId));
}
} }
......
...@@ -205,4 +205,10 @@ public interface BookAdviserBiz { ...@@ -205,4 +205,10 @@ public interface BookAdviserBiz {
* @return * @return
*/ */
BookRightsSettingDTO getBookRightsSetting(Long bookId, Long channelId, Long adviserId); BookRightsSettingDTO getBookRightsSetting(Long bookId, Long channelId, Long adviserId);
/**
* 主编辑其中一本
* @param bookId
* @return
*/
BookAdviserDto getOneMainBook(Long bookId);
} }
...@@ -856,4 +856,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz { ...@@ -856,4 +856,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
} }
return bookRightsSettingDTO; return bookRightsSettingDTO;
} }
@Override
public BookAdviserDto getOneMainBook(Long bookId) {
return bookAdviserDao.getOneMainBook(bookId);
}
} }
...@@ -254,4 +254,11 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> { ...@@ -254,4 +254,11 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
long setIsPrint(BookAdviser bookAdviser); long setIsPrint(BookAdviser bookAdviser);
List<Long> getBookIdsByTempletId(Long templetId); List<Long> getBookIdsByTempletId(Long templetId);
/**
* 主编辑其中一本
* @param bookId
* @return
*/
BookAdviserDto getOneMainBook(Long bookId);
} }
...@@ -258,4 +258,9 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book ...@@ -258,4 +258,9 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
map.put("templetId",templetId); map.put("templetId",templetId);
return getSqlSession().selectList(getStatement("getBookIdsByTempletId"),map); return getSqlSession().selectList(getStatement("getBookIdsByTempletId"),map);
} }
@Override
public BookAdviserDto getOneMainBook(Long bookId) {
return getSessionTemplate().selectOne(getStatement("getOneMainBook"),bookId);
}
} }
...@@ -31,4 +31,7 @@ public class HotBook extends BaseEntity { ...@@ -31,4 +31,7 @@ public class HotBook extends BaseEntity {
@ApiModelProperty("搜索次数") @ApiModelProperty("搜索次数")
private Integer searchCount; private Integer searchCount;
@ApiModelProperty("书封面")
private String coverImg;
} }
...@@ -3,6 +3,9 @@ package com.pcloud.book.giftcoupon.dao; ...@@ -3,6 +3,9 @@ package com.pcloud.book.giftcoupon.dao;
import com.pcloud.book.giftcoupon.entity.GiftCouponPackage; import com.pcloud.book.giftcoupon.entity.GiftCouponPackage;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
/** /**
* 专享礼券包表(GiftCouponPackage)表数据库访问层 * 专享礼券包表(GiftCouponPackage)表数据库访问层
...@@ -13,5 +16,5 @@ import com.pcloud.common.core.dao.BaseDao; ...@@ -13,5 +16,5 @@ import com.pcloud.common.core.dao.BaseDao;
public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> { public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
Map<Long,GiftCouponPackage> getMapByIds(List<Long> list);
} }
\ No newline at end of file
...@@ -30,5 +30,7 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> { ...@@ -30,5 +30,7 @@ public interface GiftReceiveDao extends BaseDao<GiftReceive> {
List<Long> getUserReceiveGiftId(Long wechatUserId);
} }
\ No newline at end of file
...@@ -6,8 +6,15 @@ import com.pcloud.common.core.dao.BaseDaoImpl; ...@@ -6,8 +6,15 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component("giftCouponPackageDao") @Component("giftCouponPackageDao")
public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> implements GiftCouponPackageDao { public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> implements GiftCouponPackageDao {
@Override
public Map<Long,GiftCouponPackage> getMapByIds(List<Long> list) {
return super.getSqlSession().selectMap(super.getStatement("getMapByIds"), list, "id");
}
} }
...@@ -38,4 +38,9 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift ...@@ -38,4 +38,9 @@ public class GiftReceiveDaoImpl extends BaseDaoImpl<GiftReceive> implements Gift
map.put("giftPackageIds",giftPackageIds); map.put("giftPackageIds",giftPackageIds);
return super.getSessionTemplate().selectList(getStatement("getGiftReceiveNumList"),map); return super.getSessionTemplate().selectList(getStatement("getGiftReceiveNumList"),map);
} }
@Override
public List<Long> getUserReceiveGiftId(Long wechatUserId) {
return super.getSessionTemplate().selectList(getStatement("getUserReceiveGiftId"),wechatUserId);
}
} }
...@@ -829,4 +829,13 @@ public interface BookGroupBiz { ...@@ -829,4 +829,13 @@ public interface BookGroupBiz {
* @return * @return
*/ */
List<BookServeDTO> getBookAndBookGroupServeIds(Long adviserId, Long bookId, Long channelId); List<BookServeDTO> getBookAndBookGroupServeIds(Long adviserId, Long bookId, Long channelId);
/**
* 获取图书信息-首页
* @param adviserId
* @param channelId
* @param bookId
* @return
*/
Map<String,Object> getBookBaseInfo4Applet(Long adviserId, Long channelId, Long bookId);
} }
...@@ -4704,6 +4704,7 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -4704,6 +4704,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
return serveDTOList; return serveDTOList;
} }
private void fillBookServe(List<BookServeDTO> serveDTOList) { private void fillBookServe(List<BookServeDTO> serveDTOList) {
if (ListUtils.isEmpty(serveDTOList)){ if (ListUtils.isEmpty(serveDTOList)){
return; return;
...@@ -4743,4 +4744,21 @@ public class BookGroupBizImpl implements BookGroupBiz { ...@@ -4743,4 +4744,21 @@ public class BookGroupBizImpl implements BookGroupBiz {
} }
} }
@Override
public Map<String, Object> getBookBaseInfo4Applet(Long adviserId, Long channelId, Long bookId) {
Map<String,Object> map = new HashMap<>();
BookAdviserDto adviserDto = bookAdviserDao.getBase(bookId,channelId,adviserId);
if (null!=adviserDto){
Long raysClassifyId = bookRaysClassifyDao.getClassifyIdByBookTemplateId(adviserDto.getTempletId());
if (null!=raysClassifyId){
map.put("raysClassifyId",raysClassifyId);
}
}
BookDto bookDto = bookBiz.getBaseById(bookId);
if (null != bookDto) {
map.put("bookName", bookDto.getBookName());
}
return map;
}
} }
...@@ -716,4 +716,8 @@ public interface BookGroupFacade { ...@@ -716,4 +716,8 @@ public interface BookGroupFacade {
ResponseDto<?> getBookAndBookGroupServeList( ResponseDto<?> getBookAndBookGroupServeList(
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId); @RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId);
@ApiOperation("获取图书基本信息-小程序首页")
@GetMapping("getBookBaseInfo4Applet")
ResponseDto<?> getBookBaseInfo4Applet(
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId);
} }
...@@ -1153,4 +1153,14 @@ public class BookGroupFacadeImpl implements BookGroupFacade { ...@@ -1153,4 +1153,14 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(bookGroupBiz.getBookAndBookGroupServeList(adviserId,bookId,channelId)); return new ResponseDto<>(bookGroupBiz.getBookAndBookGroupServeList(adviserId,bookId,channelId));
} }
@Override
@GetMapping("getBookBaseInfo4Applet")
public ResponseDto<?> getBookBaseInfo4Applet(
@RequestParam("adviserId") Long adviserId, @RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId){
if (null==adviserId||null==bookId||null==channelId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(bookGroupBiz.getBookBaseInfo4Applet(adviserId,channelId,bookId));
}
} }
package com.pcloud.book.rightsSetting.biz; package com.pcloud.book.rightsSetting.biz;
import com.pcloud.book.rightsSetting.dto.FillRightsSettingAppletsDTO;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import java.util.List;
public interface RightsSettingBiz { public interface RightsSettingBiz {
Long addRightsSetting(RightsSetting rightsSetting); Long addRightsSetting(RightsSetting rightsSetting);
void setClassifyAndLabel(BaseTempletClassify baseTempletClassify);
void deleteRightsSetting(Long id); void deleteRightsSetting(Long id);
void updateRightsSetting(RightsSetting rightsSetting); void updateRightsSetting(RightsSetting rightsSetting);
...@@ -19,4 +27,59 @@ public interface RightsSettingBiz { ...@@ -19,4 +27,59 @@ public interface RightsSettingBiz {
RightsSettingDto getByLabel(Long firstClassify,Long secondClassify,Long gradeLabelId,Long subjectLabelId); RightsSettingDto getByLabel(Long firstClassify,Long secondClassify,Long gradeLabelId,Long subjectLabelId);
Integer getUserCount(); Integer getUserCount();
/**
* 批量新增每周/长期权益
* @param rightsSettingItemList
* @param rightsSettingId
*/
void batchInsertRightsSettingItem(List<RightsSettingItem> rightsSettingItemList, Long rightsSettingId,String rightsType);
/**
* 每周/长期权益查询
* @param rightsSettingId
* @param rightsType
* @return
*/
List<RightsSettingItem> getItemsByRightsSettingId(Long rightsSettingId, String rightsType);
/**
* 小程序首页权益查询
* @param bookId
* @param adviserId
* @param channelId
* @return
*/
RightsSettingDto getRightsSettingByBookId4AppletHome(Long bookId, Long adviserId, Long channelId);
/**
* 小程序首页本周/长期权益查询
* @param rightsSettingId
* @param wechatUserId
* @param rightsType
* @return
*/
RightsSettingDto getItemByRightsSettingId4AppletHome(Long rightsSettingId, Long wechatUserId, String rightsType);
/**
* 每周/长期权益查询--小程序
* @param rightsSettingId
* @param rightsType
* @param wechatUserId
* @return
*/
List<RightsSettingItem> getItemsByRightsSettingId4Applet(Long rightsSettingId, String rightsType, Long wechatUserId);
/**
* 查所有权益分类
* @param rightsType
* @return
*/
List<RightsSettingClassify>getAllRightsClassify(String rightsType);
RightsSetting getRightsSettingRightsNowItems(Long rightsSettingId, Long wechatUserId);
RightsSetting getRightsSettingGiftCoupons(Long rightsSettingId, Long wechatUserId);
FillRightsSettingAppletsDTO getFillRightsSettingApplets(Long rightsSettingId, Long wechatUserId);
} }
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 17:44
**/
public interface RightsNowItemDao extends BaseDao<RightsNowItem> {
Integer batchInsert(List<RightsNowItem> list);
void deleteByRightsSettingId(Long rightsSettingId);
List<RightsNowItem> getListByRightsSettingId(Long rightsSettingId,List<Integer> types);
List<RightsNowItem> getGiftCouponListByRightsSettingId(Long id);
}
...@@ -4,6 +4,9 @@ import com.pcloud.book.rightsSetting.dto.RightsSettingDto; ...@@ -4,6 +4,9 @@ import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
public interface RightsSettingDAO extends BaseDao<RightsSetting> { public interface RightsSettingDAO extends BaseDao<RightsSetting> {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
...@@ -14,4 +17,8 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> { ...@@ -14,4 +17,8 @@ public interface RightsSettingDAO extends BaseDao<RightsSetting> {
int updateByPrimaryKey(RightsSetting record); int updateByPrimaryKey(RightsSetting record);
RightsSettingDto getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId); RightsSettingDto getByLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId);
RightsSettingDto getByBookId(Long bookId);
List<RightsSettingDto> listRightsSettingPage(Map<String,Object> map);
} }
package com.pcloud.book.rightsSetting.dao;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.core.dao.BaseDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 每周/长期权益(RightsSettingItem)表数据库访问层
*
* @author zhuyajie
* @since 2020-04-19 17:11:38
*/
public interface RightsSettingItemDao extends BaseDao<RightsSettingItem>{
/**
* 通过实体作为筛选条件查询
*
* @param rightsSettingItem 实例对象
* @return 对象列表
*/
List<RightsSettingItem> queryAll(RightsSettingItem rightsSettingItem);
/**
* 通过权益主键删除数据
*
* @param rightsSettingId 权益主键
* @return 影响行数
*/
int deleteByRightsSettingId(Long rightsSettingId, String rightsType);
/**
* 查所有权益分类
* @param rightsType
* @return
*/
List<RightsSettingClassify>getAllRightsClassify(String rightsType);
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.dao.check; package com.pcloud.book.rightsSetting.dao.check;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List;
@Component("权益设置参数校验") @Component("权益设置参数校验")
@Slf4j @Slf4j
public class RightsSettingCheck { public class RightsSettingCheck {
...@@ -16,7 +20,7 @@ public class RightsSettingCheck { ...@@ -16,7 +20,7 @@ public class RightsSettingCheck {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数为空!");
} }
if (StringUtil.isEmpty(rightsSetting.getIntroduce())){ if (StringUtil.isEmpty(rightsSetting.getIntroduce())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益介绍为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益简介为空!");
} }
if (StringUtil.isEmpty(rightsSetting.getDetail())){ if (StringUtil.isEmpty(rightsSetting.getDetail())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益详情为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益详情为空!");
...@@ -24,8 +28,48 @@ public class RightsSettingCheck { ...@@ -24,8 +28,48 @@ public class RightsSettingCheck {
if (null == rightsSetting.getCount()){ if (null == rightsSetting.getCount()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益个数为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益个数为空!");
} }
if (null == rightsSetting.getFirstClassify()){ if (null==rightsSetting.getRightsSettingType()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"权益类型为空!");
}
if (rightsSetting.getRightsSettingType()==2 && null==rightsSetting.getBookId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"bookId为空!");
}
if (rightsSetting.getRightsSettingType()==1 && null == rightsSetting.getFirstClassify()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"分类为空!"); throw new BookBizException(BookBizException.PARAM_IS_NULL,"分类为空!");
} }
checkRightNowItem(rightsSetting);
}
private void checkRightNowItem(RightsSetting rightsSetting){
if (rightsSetting == null) {
return;
}
checkRightNowItemApp(rightsSetting.getOnlineCourseNowItems());
checkRightNowItemApp(rightsSetting.getLearningToolNowItems());
checkRightNowItemApp(rightsSetting.getDrawNowItems());
if (!ListUtils.isEmpty(rightsSetting.getGiftCouponPackageNowItems())){
for (RightsNowItem item : rightsSetting.getGiftCouponPackageNowItems()) {
if (item.getGiftCouponPackageId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "专享礼包券id为空!");
}
}
}
}
private void checkRightNowItemApp(List<RightsNowItem> onlineCourseNowItems) {
if (ListUtils.isEmpty(onlineCourseNowItems)){
return;
}
for (RightsNowItem item : onlineCourseNowItems) {
if (item.getServeId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "作品或应用id为空!");
}
if (StringUtil.isEmpty(item.getServeType())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "作品或应用类型为空!");
}
if (StringUtil.isEmpty(item.getLinkUrl())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "作品或应用链接为空!");
}
}
} }
} }
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsNowItemDao;
import com.pcloud.book.rightsSetting.entity.RightsNowItem;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 17:44
**/
@Component("rightsNowItemDao")
public class RightsNowItemDaoImpl extends BaseDaoImpl<RightsNowItem> implements RightsNowItemDao {
@Override
public Integer batchInsert(List<RightsNowItem> list) {
return super.getSqlSession().insert(getStatement("batchInsert"),list);
}
@Override
public void deleteByRightsSettingId(Long rightsSettingId) {
super.getSqlSession().delete(getStatement("deleteByRightsSettingId"),rightsSettingId);
}
@Override
public List<RightsNowItem> getListByRightsSettingId(Long rightsSettingId,List<Integer> types) {
Map<String,Object> map=new HashMap<>();
map.put("rightsSettingId",rightsSettingId);
map.put("types",types);
return super.getSqlSession().selectList(getStatement("getListByRightsSettingId"),map);
}
@Override
public List<RightsNowItem> getGiftCouponListByRightsSettingId(Long rightsSettingId) {
Map<String,Object> map=new HashMap<>();
map.put("rightsSettingId",rightsSettingId);
return super.getSqlSession().selectList(getStatement("getGiftCouponListByRightsSettingId"),map);
}
}
...@@ -7,6 +7,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl; ...@@ -7,6 +7,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
@Component @Component
...@@ -40,4 +41,14 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement ...@@ -40,4 +41,14 @@ public class RightsSettingDAOImpl extends BaseDaoImpl<RightsSetting> implement
paramMap.put("subjectLabelId",subjectLabelId); paramMap.put("subjectLabelId",subjectLabelId);
return getSessionTemplate().selectOne(getStatement("getByLabel"),paramMap); return getSessionTemplate().selectOne(getStatement("getByLabel"),paramMap);
} }
@Override
public RightsSettingDto getByBookId(Long bookId) {
return getSessionTemplate().selectOne(getStatement("getByBookId"), bookId);
}
@Override
public List<RightsSettingDto> listRightsSettingPage(Map<String, Object> map) {
return getSessionTemplate().selectList(getStatement("listRightsSettingPage"),map);
}
} }
package com.pcloud.book.rightsSetting.dao.impl;
import com.pcloud.book.rightsSetting.dao.RightsSettingItemDao;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @描述:每周/长期权益(RightsSettingItem)表数据库访问层
* @作者:zhuyajie
* @创建时间:17:19 2020/4/19
* @版本:1.0
*/
@Component
public class RightsSettingItemDaoImpl extends BaseDaoImpl<RightsSettingItem> implements RightsSettingItemDao {
@Override
public List<RightsSettingItem> queryAll(RightsSettingItem rightsSettingItem) {
return getSessionTemplate().selectList(getStatement("queryAll"), rightsSettingItem);
}
@Override
public int deleteByRightsSettingId(Long rightsSettingId,String rightsType) {
Map<String,Object> map = new HashMap<>();
map.put("rightsSettingId",rightsSettingId);
map.put("rightsType", rightsType);
return getSessionTemplate().delete(getStatement("deleteByRightsSettingId"), map);
}
@Override
public List<RightsSettingClassify> getAllRightsClassify(String rightsType) {
Map<String,Object> map = new HashMap<>();
map.put("rightsType",rightsType);
return getSessionTemplate().selectList(getStatement("getAllRightsClassify"), map);
}
}
package com.pcloud.book.rightsSetting.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 23:09
**/
@Data
public class FillRightsSettingAppletItemDTO {
@ApiModelProperty("资讯id")
private Long appletNewsId;
@ApiModelProperty("资讯图片")
private String picUrl;
@ApiModelProperty("资讯名称")
private String newsName;
}
package com.pcloud.book.rightsSetting.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 23:07
**/
@Data
public class FillRightsSettingAppletsDTO {
@ApiModelProperty("补充配置资源")
private List<FillRightsSettingAppletItemDTO> fillServes;
@ApiModelProperty("补充配置资源")
private List<FillRightsSettingAppletItemDTO> fillOnlineCourses;
@ApiModelProperty("补充学习工具")
private List<FillRightsSettingAppletItemDTO> fillLearningTools;
@ApiModelProperty("补充抽奖")
private List<FillRightsSettingAppletItemDTO> fillDraws;
@ApiModelProperty("补充专享礼包券")
private List<FillRightsSettingAppletItemDTO> fillGiftCouponPackages;
@ApiModelProperty("补充社群共读")
private List<FillRightsSettingAppletItemDTO> fillGroups;
}
...@@ -12,4 +12,13 @@ public class RightsSettingDto extends RightsSetting { ...@@ -12,4 +12,13 @@ public class RightsSettingDto extends RightsSetting {
private String gradeLabelIdContent; private String gradeLabelIdContent;
private String subjectLabelIdContent; private String subjectLabelIdContent;
/**
* 权益分类
*/
private String rightsClassify;
/**
* 书名
*/
private String bookName;
} }
package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2020/4/19 21:10
*/
@Data
public class BaseTempletClassify extends BaseEntity {
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
}
package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2020/4/19 17:41
**/
@Data
public class RightsNowItem extends BaseEntity {
@ApiModelProperty("权益id")
private Long rightsSettingId;
@ApiModelProperty("应用或作品id")
private Long serveId;
@ApiModelProperty("应用或作品类型")
private String serveType;
@ApiModelProperty("链接url")
private String linkUrl;
@ApiModelProperty("类型(1线上网课,2学习工具,3抽奖,4专享礼包券)")
private Integer type;
@ApiModelProperty("专享礼包券id")
private Long giftCouponPackageId;
@ApiModelProperty("应用或作品图片")
private String servePic;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用或作品类型编码")
private String serveTypeCode;
@ApiModelProperty("结果链接")
private String resultUrl;
@ApiModelProperty("专享礼包券名称")
private String giftCouponTitle;
@ApiModelProperty("专享礼包券有效期开始时间")
private String giftCouponValidDateBegin;
@ApiModelProperty("专享礼包券有效期结束时间")
private String giftCouponValidDateEnd;
@ApiModelProperty("专享礼包券面额")
private Integer giftCouponDenomination;
@ApiModelProperty("专享礼包券封面图")
private String giftCouponCoverPic;
@ApiModelProperty("专享礼包券领取状态")
private Boolean userGiftReceive;
}
package com.pcloud.book.rightsSetting.entity; package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import lombok.Data; import lombok.Data;
@Data @Data
public class RightsSetting extends BaseEntity { public class RightsSetting extends BaseTempletClassify {
private String introduce; private String introduce;
...@@ -20,5 +24,43 @@ public class RightsSetting extends BaseEntity { ...@@ -20,5 +24,43 @@ public class RightsSetting extends BaseEntity {
private Long subjectLabelId; private Long subjectLabelId;
@ApiModelProperty("线上网课集合")
private List<RightsNowItem> onlineCourseNowItems;
@ApiModelProperty("学习工具集合")
private List<RightsNowItem> learningToolNowItems;
@ApiModelProperty("抽奖集合")
private List<RightsNowItem> drawNowItems;
@ApiModelProperty("专享礼包券集合")
private List<RightsNowItem> giftCouponPackageNowItems;
@ApiModelProperty("启用专享社群服务")
private Integer enableGroupService = 0;
@ApiModelProperty("权益类型;【1分类权益、2书刊权益】")
private Integer rightsSettingType = 1;
@ApiModelProperty("书刊id")
private Long bookId;
/**
* 书或isbn查询
*/
private String bookQuery;
/**
* 书名
*/
private String bookName;
/**
* 每周权益
*/
private List<RightsSettingItem> rightsSettingWeekItems;
/**
* 长期权益
*/
private List<RightsSettingItem> rightsSettingLongTermItems;
} }
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity;
import com.pcloud.common.entity.BaseEntity;
import java.io.Serializable;
import lombok.Data;
/**
* 权益分类(RightsSettingClassify)实体类
*
* @author zhuyajie
* @since 2020-04-19 20:39:21
*/
@Data
public class RightsSettingClassify extends BaseEntity {
private static final long serialVersionUID = 838526167996305709L;
private Long id;
/**
* 权益分类
*/
private String classify;
/**
* 权益类型(每周WEEK/长期LONG_TERM)
*/
private String rightsType;
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* 每周/长期权益(RightsSettingItem)实体类
*
* @author zhuyajie
* @since 2020-04-19 17:11:38
*/
@Data
public class RightsSettingItem extends BaseEntity {
private static final long serialVersionUID = -10992603018190329L;
private Long id;
/**
* 权益id
*/
private Long rightsSettingId;
/**
* 权益类型(每周WEEK/长期LONG_TERM)
*/
private String rightsType;
/**
* 权益分类
*/
private Long rightsClassifyId;
/**
* 权益描述
*/
private String description;
/**
* 创建时间
*/
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss",
timezone = "GMT+8"
)
private Date createTime;
/**
* 权益标题
*/
private String title;
/**
* 资讯
*/
private List<AppletNewsDTO> appletNewsDTOS;
}
\ No newline at end of file
package com.pcloud.book.rightsSetting.enums;
public enum RightsNowItemType {
/**
* 1线上网课
*/
ONLINE_COURSE(1),
/**
* 2学习工具
*/
LEARNING_TOOL(2),
/**
* 3抽奖
*/
DRAW(3),
/**
* 4专享礼包券
*/
GIFT_COUPON_PACKAGE(4);
/**
* 值
*/
public final Integer value;
RightsNowItemType(Integer value) {
this.value = value;
}
}
package com.pcloud.book.rightsSetting.enums;
/**
* @描述:权益类型
* @作者:zhuyajie
* @创建时间:17:36 2020/4/19
* @版本:1.0
*/
public enum RightsTypeEnum {
/**
* 每周
*/
WEEK("WEEK"),
/**
* 长期
*/
LONG_TERM("LONG_TERM");
public String value;
RightsTypeEnum(String value) {
this.value = value;
}
}
package com.pcloud.book.rightsSetting.facade; package com.pcloud.book.rightsSetting.facade;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz; import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.rightsSetting.dto.RightsSettingDto; import com.pcloud.book.rightsSetting.dto.RightsSettingDto;
import com.pcloud.book.rightsSetting.entity.RightsSetting; import com.pcloud.book.rightsSetting.entity.RightsSetting;
import com.pcloud.book.rightsSetting.entity.RightsSettingClassify;
import com.pcloud.book.rightsSetting.entity.RightsSettingItem;
import com.pcloud.common.dto.ResponseDto; import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException; import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil; import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -17,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -17,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RequestMapping("rightsSetting") @RequestMapping("rightsSetting")
@RestController("rightsSettingFacede") @RestController("rightsSettingFacede")
public class RightsSettingFacede { public class RightsSettingFacede {
...@@ -57,13 +66,18 @@ public class RightsSettingFacede { ...@@ -57,13 +66,18 @@ public class RightsSettingFacede {
@RequestParam(value = "firstClassify", required = false) Long firstClassify, @RequestParam(value = "firstClassify", required = false) Long firstClassify,
@RequestParam(value = "secondClassify", required = false) Long secondClassify, @RequestParam(value = "secondClassify", required = false) Long secondClassify,
@RequestParam(value = "gradeLabelId", required = false) Long gradeLabelId, @RequestParam(value = "gradeLabelId", required = false) Long gradeLabelId,
@RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId) throws PermissionException { @RequestParam(value = "subjectLabelId", required = false) Long subjectLabelId, @RequestParam(value = "rightsSettingType", required = false, defaultValue = "1") Integer rightsSettingType,
@RequestParam(value = "bookQuery", required = false) String bookQuery
) throws PermissionException {
SessionUtil.getToken4Redis(token); SessionUtil.getToken4Redis(token);
RightsSetting rightsSetting = new RightsSetting(); RightsSetting rightsSetting = new RightsSetting();
rightsSetting.setFirstClassify(firstClassify); rightsSetting.setFirstClassify(firstClassify);
rightsSetting.setSecondClassify(secondClassify); rightsSetting.setSecondClassify(secondClassify);
rightsSetting.setGradeLabelId(gradeLabelId); rightsSetting.setGradeLabelId(gradeLabelId);
rightsSetting.setSubjectLabelId(subjectLabelId); rightsSetting.setSubjectLabelId(subjectLabelId);
rightsSetting.setRightsSettingType(rightsSettingType);
rightsSetting.setBookQuery(bookQuery);
return new ResponseDto<PageBeanNew<RightsSettingDto>>(rightsSettingBiz.listRightsSettingPage(currentPage, numPerPage, rightsSetting)); return new ResponseDto<PageBeanNew<RightsSettingDto>>(rightsSettingBiz.listRightsSettingPage(currentPage, numPerPage, rightsSetting));
} }
...@@ -72,4 +86,85 @@ public class RightsSettingFacede { ...@@ -72,4 +86,85 @@ public class RightsSettingFacede {
public ResponseDto<Integer> getUserCount(){ public ResponseDto<Integer> getUserCount(){
return new ResponseDto<>(rightsSettingBiz.getUserCount()); return new ResponseDto<>(rightsSettingBiz.getUserCount());
} }
@ApiOperation("新增每周/长期权益")
@PostMapping("addRightsSettingItem")
public ResponseDto<?> addRightsSettingItem(@RequestBody List<RightsSettingItem> rightsSettingItems,
@RequestParam("rightsSettingId") Long rightsSettingId, @RequestParam("rightsType") String rightsType){
rightsSettingBiz.batchInsertRightsSettingItem(rightsSettingItems,rightsSettingId,rightsType);
return new ResponseDto<>();
}
@ApiOperation("小程序首页权益基本信息查询")
@GetMapping("getRightsSettingByBookId4AppletHome")
public ResponseDto<?> getRightsSettingByBookId4AppletHome(
@CookieValue("userInfo")String userInfo, @RequestParam("adviserId") Long adviserId,
@RequestParam("bookId")Long bookId, @RequestParam("channelId")Long channelId){
Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null==adviserId||null==bookId||null==channelId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getRightsSettingByBookId4AppletHome(bookId, adviserId, channelId));
}
@ApiOperation("小程序首页本周/长期权益查询")
@GetMapping("getItemByRightsSettingId4AppletHome")
public ResponseDto<?> getItemByRightsSettingId4AppletHome(
@CookieValue("userInfo")String userInfo,
@RequestParam("rightsSettingId") Long rightsSettingId,
@RequestParam(value = "rightsType",required = false) String rightsType){
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null==rightsSettingId || StringUtil.isEmpty(rightsType)){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getItemByRightsSettingId4AppletHome(rightsSettingId, wechatUserId, rightsType));
}
@ApiOperation("所有权益分类")
@GetMapping("getAllRightsClassify")
public ResponseDto<List<RightsSettingClassify>>getAllRightsClassify(
@RequestParam(value = "rightsType", required = false) String rightsType){
return new ResponseDto<>(rightsSettingBiz.getAllRightsClassify(rightsType));
}
@ApiOperation("根据权益id获取即享权益项")
@GetMapping("getRightsSettingRightsNowItems")
public ResponseDto<RightsSetting> getRightsSettingRightsNowItems(
@CookieValue("userInfo")String userInfo,
@RequestParam("rightsSettingId") Long rightsSettingId
) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null==rightsSettingId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getRightsSettingRightsNowItems(rightsSettingId,wechatUserId));
}
@ApiOperation("根据权益id获取即享权益项专享礼包")
@GetMapping("getRightsSettingGiftCoupons")
public ResponseDto<RightsSetting> getRightsSettingGiftCoupons(
@CookieValue("userInfo")String userInfo,
@RequestParam("rightsSettingId") Long rightsSettingId
) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null==rightsSettingId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getRightsSettingGiftCoupons(rightsSettingId,wechatUserId));
}
@ApiOperation("根据权益id获取即享权益项补充咨询")
@GetMapping("getFillRightsSettingApplets")
public ResponseDto<?> getFillRightsSettingApplets(
@CookieValue("userInfo")String userInfo,
@RequestParam("rightsSettingId") Long rightsSettingId
) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo,Cookie._WECHAT_USER_ID);
if (null==rightsSettingId){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getFillRightsSettingApplets(rightsSettingId,wechatUserId));
}
} }
\ No newline at end of file
package com.pcloud.book.skill.biz; package com.pcloud.book.skill.biz;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.facade.request.QueryGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.QueryGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.SaveGroupActivityRequestVO;
import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO; import com.pcloud.book.skill.facade.request.UpdateGroupActivityRequestVO;
...@@ -35,4 +36,13 @@ public interface PcloudGroupActivityBiz { ...@@ -35,4 +36,13 @@ public interface PcloudGroupActivityBiz {
*/ */
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Integer numPerPage, Integer currentPage); PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Integer numPerPage, Integer currentPage);
/**
* 根据分类获取社群共读
* @param firstClassify
* @param secondClassify
* @param gradeLabelId
* @param subjectLabelId
* @return
*/
GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId);
} }
...@@ -6,13 +6,16 @@ import com.google.common.collect.Maps; ...@@ -6,13 +6,16 @@ import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr; import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr; import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.GroupQrcodeBiz; import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.reading.biz.ReadingActivityBiz; import com.pcloud.book.reading.biz.ReadingActivityBiz;
import com.pcloud.book.rightsSetting.biz.RightsSettingBiz;
import com.pcloud.book.skill.biz.PcloudGroupActivityBiz; import com.pcloud.book.skill.biz.PcloudGroupActivityBiz;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao; import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.dao.PcloudSkillDao; import com.pcloud.book.skill.dao.PcloudSkillDao;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.entity.PcloudSkill; import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.book.skill.enums.SkillTypeEnum; import com.pcloud.book.skill.enums.SkillTypeEnum;
...@@ -22,12 +25,15 @@ import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO; ...@@ -22,12 +25,15 @@ import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.page.PageBeanNew; import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam; import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtilParent; import com.pcloud.common.utils.string.StringUtilParent;
import com.sdk.wxgroup.RobotProcessTypeEnum; import com.sdk.wxgroup.RobotProcessTypeEnum;
import com.sdk.wxgroup.SendGroupInviteVO; import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.SendPicMessageVO; import com.sdk.wxgroup.SendPicMessageVO;
import com.sdk.wxgroup.WxGroupSDK; import com.sdk.wxgroup.WxGroupSDK;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -46,6 +52,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -46,6 +52,8 @@ import lombok.extern.slf4j.Slf4j;
@Service @Service
public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
private static final String GROUP_HEAD_URL_REDIS="BOOK:APPLET:pcloudGroupActivityBizImpl_groupHeadUrl";
@Resource @Resource
private PcloudSkillDao pcloudSkillDao; private PcloudSkillDao pcloudSkillDao;
@Resource @Resource
...@@ -58,6 +66,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -58,6 +66,10 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
private LabelConsr labelConsr; private LabelConsr labelConsr;
@Autowired @Autowired
private WechatGroupConsr wechatGroupConsr; private WechatGroupConsr wechatGroupConsr;
@Autowired
private RightsSettingBiz rightsSettingBiz;
@Autowired
private ReaderConsr readerConsr;
@ParamLog("保存共读活动") @ParamLog("保存共读活动")
@Override @Override
...@@ -70,6 +82,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -70,6 +82,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
entity.setUpdateUser(vo.getUserId()); entity.setUpdateUser(vo.getUserId());
entity.setUpdateTime(now); entity.setUpdateTime(now);
entity.setIsDelete(0); entity.setIsDelete(0);
rightsSettingBiz.setClassifyAndLabel(entity);
pcloudGroupActivityDao.insert(entity); pcloudGroupActivityDao.insert(entity);
} }
...@@ -85,6 +98,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -85,6 +98,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
Date now = new Date(); Date now = new Date();
entity.setUpdateUser(vo.getUserId()); entity.setUpdateUser(vo.getUserId());
entity.setUpdateTime(now); entity.setUpdateTime(now);
rightsSettingBiz.setClassifyAndLabel(entity);
pcloudGroupActivityDao.updateByPrimaryKeySelective(entity); pcloudGroupActivityDao.updateByPrimaryKeySelective(entity);
} }
...@@ -179,4 +193,32 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz { ...@@ -179,4 +193,32 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
return queryGroupActivity; return queryGroupActivity;
} }
@Override
public GroupActivity4AppletDTO getGroupActivity4Applet(Long firstClassify, Long secondClassify,
Long gradeLabelId, Long subjectLabelId) {
Map<String, Object> map = new HashMap<>();
map.put("firstClassify", firstClassify);
map.put("secondClassify", secondClassify);
map.put("gradeLabelId", gradeLabelId);
map.put("subjectLabelId", subjectLabelId);
GroupActivity4AppletDTO groupActivity4AppletDTO = pcloudGroupActivityDao.getGroupActivity4Applet(map);
if(groupActivity4AppletDTO == null){
return new GroupActivity4AppletDTO();
}
String filterStr = StringUtilParent.replaceHtml(groupActivity4AppletDTO.getDesc());
String subStr = filterStr.length() > 60 ? filterStr.substring(0, 60) + "..." : filterStr;
groupActivity4AppletDTO.setCutDesc(subStr);
//头像列表从缓存里取
List<String> headUrlList = JedisClusterUtils.hgetJson2List(GROUP_HEAD_URL_REDIS,groupActivity4AppletDTO.getGroupActivityId().toString(),String.class);
//缓存为空或数量不一致,重新获取
if (ListUtils.isEmpty(headUrlList) ||
(headUrlList.size()<9 && !groupActivity4AppletDTO.getUserNumber().equals(headUrlList.size()))){
headUrlList = readerConsr.getRandomHeadUrlList(groupActivity4AppletDTO.getUserNumber()>9 ? 9:groupActivity4AppletDTO.getUserNumber());
JedisClusterUtils.hset2Json(GROUP_HEAD_URL_REDIS,groupActivity4AppletDTO.getGroupActivityId().toString(),headUrlList);
JedisClusterUtils.expire(GROUP_HEAD_URL_REDIS,3600);
}
groupActivity4AppletDTO.setHeadUrlList(headUrlList);
return groupActivity4AppletDTO;
}
} }
package com.pcloud.book.skill.dao; package com.pcloud.book.skill.dao;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.core.dao.BaseDao; import com.pcloud.common.core.dao.BaseDao;
...@@ -10,4 +11,6 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> { ...@@ -10,4 +11,6 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
Map<Long, PcloudGroupActivity> mayByIds(List<Long> ids); Map<Long, PcloudGroupActivity> mayByIds(List<Long> ids);
void updateByPrimaryKeySelective(PcloudGroupActivity entity); void updateByPrimaryKeySelective(PcloudGroupActivity entity);
GroupActivity4AppletDTO getGroupActivity4Applet(Map<String, Object> map);
} }
\ No newline at end of file
package com.pcloud.book.skill.dao.impl; package com.pcloud.book.skill.dao.impl;
import com.pcloud.book.skill.dao.PcloudGroupActivityDao; import com.pcloud.book.skill.dao.PcloudGroupActivityDao;
import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
...@@ -22,4 +23,9 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity> ...@@ -22,4 +23,9 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity>
this.getSqlSession().update("com.pcloud.book.skill.dao.impl.PcloudGroupActivityDaoImpl.updateByPrimaryKeySelective", entity); this.getSqlSession().update("com.pcloud.book.skill.dao.impl.PcloudGroupActivityDaoImpl.updateByPrimaryKeySelective", entity);
} }
@Override
public GroupActivity4AppletDTO getGroupActivity4Applet(Map<String, Object> map) {
return super.getSqlSession().selectOne(getStatement("getGroupActivity4Applet"), map);
}
} }
package com.pcloud.book.skill.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
import lombok.Data;
/**
* @author zhengyongqiang
* @date 2020/4/20 10:49
*/
@Data
@JsonInclude(Include.NON_NULL)
public class GroupActivity4AppletDTO implements Serializable {
private Long id;
@ApiModelProperty("共读活动id")
private Long groupActivityId;
@ApiModelProperty("共度名称")
private String name;
@ApiModelProperty("描述")
private String desc;
@ApiModelProperty("描述")
private String cutDesc;
@ApiModelProperty("群图片,加群方式为图片时有效")
private String groupPic;
@ApiModelProperty("社群码id")
private Long bookGroupQrcodeId;
@ApiModelProperty("社群码名称")
private String groupName;
@ApiModelProperty("群人数")
private Integer userNumber;
@ApiModelProperty("群分类id")
private Long classifyId;
@ApiModelProperty("群id")
private Long bookGroupId;
@ApiModelProperty("头像列表")
private List<String> headUrlList;
}
package com.pcloud.book.skill.entity; package com.pcloud.book.skill.entity;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.common.entity.BaseEntity; import com.pcloud.common.entity.BaseEntity;
import java.util.Date; import java.util.Date;
public class PcloudGroupActivity extends BaseEntity { public class PcloudGroupActivity extends BaseTempletClassify {
private static final long serialVersionUID = -2579070770051745966L; private static final long serialVersionUID = -2579070770051745966L;
private String name; private String name;
......
package com.pcloud.book.skill.facade.request; package com.pcloud.book.skill.facade.request;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.entity.BaseRequestVO; import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
...@@ -21,7 +22,7 @@ import lombok.EqualsAndHashCode; ...@@ -21,7 +22,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@ApiModel("新增共读活动") @ApiModel("新增共读活动")
public class SaveGroupActivityRequestVO extends BaseRequestVO { public class SaveGroupActivityRequestVO extends BaseTempletClassify {
private static final long serialVersionUID = -5370056714391879364L; private static final long serialVersionUID = -5370056714391879364L;
......
package com.pcloud.book.skill.facade.request; package com.pcloud.book.skill.facade.request;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.common.entity.BaseRequestVO; import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.string.StringUtil; import com.pcloud.common.utils.string.StringUtil;
...@@ -18,7 +19,7 @@ import lombok.EqualsAndHashCode; ...@@ -18,7 +19,7 @@ import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
@Data @Data
@ApiModel("修改共读活动") @ApiModel("修改共读活动")
public class UpdateGroupActivityRequestVO extends BaseRequestVO { public class UpdateGroupActivityRequestVO extends BaseTempletClassify {
private static final long serialVersionUID = 3642060073527485455L; private static final long serialVersionUID = 3642060073527485455L;
......
package com.pcloud.book.skill.facade.response; package com.pcloud.book.skill.facade.response;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -48,4 +49,13 @@ public class QueryGroupActivityResponseVO { ...@@ -48,4 +49,13 @@ public class QueryGroupActivityResponseVO {
@ApiModelProperty("目的标签") @ApiModelProperty("目的标签")
private String purLabelName; private String purLabelName;
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
} }
...@@ -18,21 +18,27 @@ ...@@ -18,21 +18,27 @@
<result column="show_state" property="showState" jdbcType="BOOLEAN" /> <result column="show_state" property="showState" jdbcType="BOOLEAN" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="first_classify" property="firstClassify" jdbcType="BIGINT" />
<result column="second_classify" property="secondClassify" jdbcType="BIGINT" />
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
<result column="rights_classify_id" property="rightsClassifyId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest, id, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest,
pic1, pic2, pic3, content, show_state, create_time, update_time pic1, pic2, pic3, content, show_state, create_time, update_time, first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNews" useGeneratedKeys="true" keyProperty="id"> <insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNews" useGeneratedKeys="true" keyProperty="id">
insert into applet_news( insert into applet_news(
news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest, news_name, source, news_classify_id, pro_label_id, dep_label_id, pur_label_id, type, digest,
pic1, pic2, pic3, content, show_state, create_time, update_time pic1, pic2, pic3, content, show_state, create_time, update_time , first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id
) )
values ( values (
#{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest}, #{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest},
#{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW() #{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{rightsClassifyId,jdbcType=BIGINT}
) )
</insert> </insert>
...@@ -73,6 +79,11 @@ ...@@ -73,6 +79,11 @@
<if test="showState != null"> <if test="showState != null">
show_state = #{showState,jdbcType=BOOLEAN}, show_state = #{showState,jdbcType=BOOLEAN},
</if> </if>
first_classify = #{firstClassify,jdbcType=BIGINT},
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
rights_classify_id = #{rightsClassifyId,jdbcType=BIGINT},
update_time=NOW() update_time=NOW()
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -112,7 +123,12 @@ ...@@ -112,7 +123,12 @@
n.content, n.content,
n.show_state showState, n.show_state showState,
c.news_classify newsClassify, c.news_classify newsClassify,
n.create_time createTime n.create_time createTime,
n.first_classify firstClassify,
n.second_classify secondClassify,
n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId
FROM applet_news n LEFT JOIN applet_news_classify c ON FROM applet_news n LEFT JOIN applet_news_classify c ON
n.news_classify_id=c.id n.news_classify_id=c.id
WHERE 1=1 WHERE 1=1
...@@ -135,5 +151,72 @@ ...@@ -135,5 +151,72 @@
where news_classify_id=#{newsClassifyId} where news_classify_id=#{newsClassifyId}
</select> </select>
<select id="getByNewsByTempletLabel" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsDTO">
SELECT
n.id,
n.news_name newsName,
n.source,
n.news_classify_id newsClassifyId,
n.pro_label_id proLabelId,
n.dep_label_id depLabelId,
n.pur_label_id purLabelId,
n.type,
n.digest,
n.pic1,
n.pic2,
n.pic3,
n.content,
n.show_state showState,
n.create_time createTime,
n.first_classify firstClassify,
n.second_classify secondClassify,
n.grade_label_id gradeLabelId,
n.subject_label_id subjectLabelId,
n.rights_classify_id rightsClassifyId
FROM applet_news n
WHERE 1=1
and n.show_state = 1
<if test="firstClassify != null">
and n.first_classify = #{firstClassify}
</if>
<if test="secondClassify != null">
and n.second_classify = #{secondClassify}
</if>
<if test="gradeLabelId != null">
and n.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
and n.subject_label_id = #{subjectLabelId}
</if>
AND n.rights_classify_id IN(
SELECT id FROM rights_setting_classify WHERE 1=1
<if test="rightsType != null" >
AND rights_type = #{rightsType}
</if>
)
ORDER BY n.create_time DESC
</select>
<select id="getByTempletAndClassify" parameterType="map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
applet_news t
WHERE
t.show_state = 1
<if test="firstClassify!=null">
AND t.first_classify =#{firstClassify}
</if>
<if test="secondClassify!=null">
AND t.second_classify =#{secondClassify}
</if>
<if test="rightsClassifyId!=null">
AND t.rights_classify_id =#{rightsClassifyId}
</if>
ORDER BY
t.create_time DESC
LIMIT #{top}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -92,5 +92,39 @@ ...@@ -92,5 +92,39 @@
AND adviser_id=#{adviserId} AND adviser_id=#{adviserId}
</delete> </delete>
<select id="getUserLastGroupBookRe" parameterType="long" resultType="com.pcloud.book.applet.dto.UserLastBookReDTO">
SELECT
t.book_id bookId,
t.adviser_id adviserId,
t.channel_id channelId
FROM
applet_user_bookcase t
INNER JOIN book_group t1 ON t.book_id = t1.book_id
AND t1.join_group_type = 4
AND t1.is_delete = 0
WHERE
t.channel_id >= 1
AND t.adviser_id >= 1
AND t.wechat_user_id = #{wechatUserId}
ORDER BY
t.create_time DESC
LIMIT 1
</select>
<select id="getUserLastRe" parameterType="long" resultType="com.pcloud.book.applet.dto.UserLastBookReDTO" >
SELECT
t.book_id bookId,
t.adviser_id adviserId,
t.channel_id channelId
FROM
applet_user_bookcase t
WHERE
t.channel_id >= 1
AND t.adviser_id >= 1
AND t.wechat_user_id = #{wechatUserId}
ORDER BY
t.create_time DESC
LIMIT 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -641,4 +641,15 @@ ...@@ -641,4 +641,15 @@
WHERE WHERE
TEMPLET_ID = #{templetId} TEMPLET_ID = #{templetId}
</select> </select>
<select id="getOneMainBook" parameterType="long" resultMap="bookAdviserMap">
SELECT
BOOK_ADVISER_ID, BOOK_ID, TEMPLET_ID, CHANNEL_ID, ADVISER_ID, IS_DELETE,
TEMPLET_ID,SECOND_TEMPLET_ID,
GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID
FROM book_adviser
WHERE BOOK_ID=#{bookId}
AND IS_MAIN_EDITOR=1 AND IS_DELETE=0
LIMIT 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
h.seq_num seqNum, h.seq_num seqNum,
h.create_time createTime, h.create_time createTime,
b.BOOK_NAME bookName, b.BOOK_NAME bookName,
b.COVER_IMG coverImg,
a.ADVISER_ID adviserId, a.ADVISER_ID adviserId,
count(r.id) searchCount count(r.id) searchCount
from hot_book h from hot_book h
......
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
</resultMap> </resultMap>
<sql id="Base_Column_List">
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete
</sql>
<!--查询单个--> <!--查询单个-->
<select id="getById" resultMap="GiftCouplePackageMap"> <select id="getById" resultMap="GiftCouplePackageMap">
select select
...@@ -148,6 +152,16 @@ ...@@ -148,6 +152,16 @@
</select> </select>
<select id="getMapByIds" parameterType="list" resultMap="GiftCouplePackageMap">
select <include refid="Base_Column_List"/>
from gift_coupon_package
where is_delete=0
and id in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -137,4 +137,10 @@ ...@@ -137,4 +137,10 @@
group by gift_package_id group by gift_package_id
</select> </select>
<select id="getUserReceiveGiftId" parameterType="long" resultType="long">
select distinct gift_package_id
from gift_receive
where wechat_user_id=#{wechatUserId}
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.rightsSetting.dao.impl.RightsNowItemDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.rightsSetting.entity.RightsNowItem">
<id property="id" column="id" jdbcType="BIGINT"/>
<result property="rightsSettingId" column="rights_setting_id" jdbcType="BIGINT"/>
<result property="serveId" column="serve_id" jdbcType="BIGINT"/>
<result property="serveType" column="serve_type" jdbcType="VARCHAR"/>
<result property="linkUrl" column="link_url" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="BIGINT"/>
<result property="giftCouponPackageId" column="gift_coupon_package_id" jdbcType="BIGINT"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List"/>
from rights_now_item
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteById" parameterType="long">
delete from rights_now_item
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsNowItem" useGeneratedKeys="true" keyProperty="id">
insert into rights_now_item
<trim prefix="(" suffix=")" suffixOverrides=",">
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{rightsSettingId,jdbcType=BIGINT},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{giftCouponPackageId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<insert id="batchInsert" parameterType="com.pcloud.book.rightsSetting.entity.RightsNowItem" useGeneratedKeys="true" keyProperty="id">
insert into rights_now_item (
rights_setting_id, serve_id, serve_type, link_url, type, gift_coupon_package_id, create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.rightsSettingId,jdbcType=BIGINT},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.type,jdbcType=INTEGER},
#{item.giftCouponPackageId,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete id="deleteByRightsSettingId" parameterType="long">
delete from rights_now_item
where rights_setting_id=#{rightsSettingId}
</delete>
<select id="getListByRightsSettingId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from
rights_now_item
where rights_setting_id=#{rightsSettingId}
<if test="types!=null and types.size()>0">
and type in
<foreach collection="types" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</select>
<select id="getGiftCouponListByRightsSettingId" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsNowItem">
SELECT
t.id,
t.rights_setting_id rightsSettingId,
t.serve_id serveId,
t.serve_type serveType,
t.link_url linkUrl,
t.type,
t.gift_coupon_package_id giftCouponPackageId,
t.create_time createTime,
t1.title giftCouponTitle,
t1.cover_pic giftCouponCoverPic,
t1.denomination giftCouponDenomination,
t1.valid_date_begin giftCouponValidDateBegin,
t1.valid_date_end giftCouponValidDateEnd
FROM
rights_now_item t
INNER JOIN gift_coupon_package t1 ON t.gift_coupon_package_id = t1.id
WHERE
t1.is_delete = 0
AND t.rights_setting_id = #{rightsSettingId}
</select>
</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.rightsSetting.dao.impl.RightsSettingItemDaoImpl">
<resultMap type="com.pcloud.book.rightsSetting.entity.RightsSettingItem" id="RightsSettingItemMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="rightsSettingId" column="rights_setting_id" jdbcType="INTEGER"/>
<result property="rightsType" column="rights_type" jdbcType="VARCHAR"/>
<result property="rightsClassifyId" column="rights_classify_id" jdbcType="INTEGER"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
</resultMap>
<!--通过实体作为筛选条件查询-->
<select id="queryAll" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingItem" >
select
i.id, i.rights_setting_id rightsSettingId,
i.rights_type rightsType, i.rights_classify_id rightsClassifyId,
i.description, i.create_time createTime, i.title
from book.rights_setting_item i
<where>
<if test="id != null">
and i.id = #{id}
</if>
<if test="rightsSettingId != null">
and i.rights_setting_id = #{rightsSettingId}
</if>
<if test="rightsType != null and rightsType != ''">
and i.rights_type = #{rightsType}
</if>
<if test="rightsClassifyId != null ">
and i.rights_classify_id = #{rightsClassifyId}
</if>
</where>
order by i.id asc
</select>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.rights_setting_item(rights_setting_id, rights_type, rights_classify_id, description, create_time,title)
values (#{rightsSettingId}, #{rightsType}, #{rightsClassifyId}, #{description}, NOW(), #{title})
</insert>
<!--通过权益主键删除-->
<delete id="deleteByRightsSettingId" parameterType="map">
delete from book.rights_setting_item
where rights_setting_id = #{rightsSettingId}
<if test="rightsType!=null">
and rights_type = #{rightsType}
</if>
</delete>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into book.rights_setting_item (
rights_setting_id, rights_type, rights_classify_id, description, create_time,title
)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.rightsSettingId},
#{item.rightsType,jdbcType=VARCHAR},
#{item.rightsClassifyId,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
NOW(),
#{item.title}
)
</foreach>
</insert>
<select id="getAllRightsClassify" parameterType="map" resultType="com.pcloud.book.rightsSetting.entity.RightsSettingClassify">
SELECT id, classify, rights_type rightsType
FROM rights_setting_classify
WHERE 1=1
<if test="rightsType!=null">
and rights_type=#{rightsType}
</if>
</select>
</mapper>
\ No newline at end of file
...@@ -12,6 +12,9 @@ ...@@ -12,6 +12,9 @@
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" /> <result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="enable_group_service" property="enableGroupService" jdbcType="INTEGER" />
<result column="rights_setting_type" property="rightsSettingType" jdbcType="INTEGER" />
<result column="book_id" property="bookId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto"> <resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
...@@ -25,10 +28,14 @@ ...@@ -25,10 +28,14 @@
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" /> <result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" /> <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="enable_group_service" property="enableGroupService" jdbcType="INTEGER" />
<result column="rights_setting_type" property="rightsSettingType" jdbcType="INTEGER" />
<result column="book_id" property="bookId" jdbcType="BIGINT" />
<result column="BOOK_NAME" property="bookName" jdbcType="VARCHAR" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id, id, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
create_time, update_time create_time, update_time, enable_group_service, rights_setting_type, book_id
</sql> </sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" > <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select select
...@@ -40,15 +47,15 @@ ...@@ -40,15 +47,15 @@
delete from rights_setting delete from rights_setting
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</delete> </delete>
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" > <insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" useGeneratedKeys="true" keyProperty="id">
insert into rights_setting (id, introduce, detail, insert into rights_setting (introduce, detail,
count, first_classify, second_classify, count, first_classify, second_classify,
grade_label_id, subject_label_id, create_time, grade_label_id, subject_label_id, create_time,
update_time) update_time, enable_group_service, rights_setting_type, book_id)
values (#{id,jdbcType=BIGINT}, #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR}, values ( #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT}, #{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(), #{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{updateTime,jdbcType=TIMESTAMP}) #{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId})
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" >
update rights_setting update rights_setting
...@@ -80,6 +87,15 @@ ...@@ -80,6 +87,15 @@
<if test="updateTime != null" > <if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="enableGroupService != null" >
enable_group_service = #{enableGroupService},
</if>
<if test="rightsSettingType != null" >
rights_setting_type = #{rightsSettingType},
</if>
<if test="bookId != null" >
book_id = #{bookId},
</if>
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -92,7 +108,9 @@ ...@@ -92,7 +108,9 @@
second_classify = #{secondClassify,jdbcType=BIGINT}, second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT}, grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT}, subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP},
enable_group_service = #{enableGroupService},
book_id = #{bookId}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
...@@ -114,15 +132,40 @@ ...@@ -114,15 +132,40 @@
<if test="subjectLabelId != null"> <if test="subjectLabelId != null">
and subject_label_id = #{subjectLabelId} and subject_label_id = #{subjectLabelId}
</if> </if>
<if test="rightsSettingType !=null">
and rights_setting_type = #{rightsSettingType}
</if>
<if test="bookId!=null">
and book_id=#{bookId}
</if>
<if test="exceptId!=null">
and id != #{exceptId}
</if>
</where> </where>
order by create_time desc order by create_time desc
</select> </select>
<select id="listBookRightsSettingPage" parameterType="map" resultMap="DtoResultMap">
select
r.id, r.introduce, r.detail, r.count, r.first_classify, r.second_classify, r.grade_label_id, r.subject_label_id,
r.create_time, r.update_time, r.enable_group_service, r.rights_setting_type, r.book_id, b.BOOK_NAME
from
rights_setting r LEFT JOIN book b ON r.book_id=b.BOOK_ID
WHERE
r.rights_setting_type = 2
<if test="bookQuery !=null">
AND (b.BOOK_NAME LIKE CONCAT("%",#{bookQuery},"%") OR b.ISBN LIKE CONCAT("%",#{bookQuery},"%"))
</if>
order by r.create_time desc
</select>
<select id="getByLabel" parameterType="map" resultMap="DtoResultMap"> <select id="getByLabel" parameterType="map" resultMap="DtoResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from from
rights_setting rights_setting
where 1=1 where
rights_setting_type = 1
<if test="firstClassify != null"> <if test="firstClassify != null">
and first_classify = #{firstClassify} and first_classify = #{firstClassify}
</if> </if>
...@@ -138,4 +181,14 @@ ...@@ -138,4 +181,14 @@
limit 1 limit 1
</select> </select>
<select id="getByBookId" parameterType="map" resultMap="DtoResultMap">
select
<include refid="Base_Column_List"/>
from
rights_setting
WHERE book_id = #{bookId}
and rights_setting_type = 2
limit 1
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -17,11 +17,16 @@ ...@@ -17,11 +17,16 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" /> <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="update_user" property="updateUser" jdbcType="INTEGER" /> <result column="update_user" property="updateUser" jdbcType="INTEGER" />
<result column="is_delete" property="isDelete" jdbcType="BIT" /> <result column="is_delete" property="isDelete" jdbcType="BIT" />
<result column="first_classify" property="firstClassify" jdbcType="BIGINT" />
<result column="second_classify" property="secondClassify" jdbcType="BIGINT" />
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, name, description, join_type, group_pic, pro_label_id, dep_label_id, id, name, description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_qrcode_id, pur_label_id, book_group_qrcode_id,
create_time, create_user, update_time, update_user, is_delete create_time, create_user, update_time, update_user, is_delete,
first_classify, second_classify, grade_label_id, subject_label_id
</sql> </sql>
<update id="deleteById" parameterType="long"> <update id="deleteById" parameterType="long">
...@@ -39,7 +44,11 @@ ...@@ -39,7 +44,11 @@
a.pro_label_id AS proLabelId, a.pro_label_id AS proLabelId,
a.dep_label_id AS depLabelId, a.dep_label_id AS depLabelId,
a.pur_label_id AS purLabelId, a.pur_label_id AS purLabelId,
b.group_name AS groupName b.group_name AS groupName,
a.first_classify AS firstClassify,
a.second_classify AS secondClassify,
a.grade_label_id AS gradeLabelId,
a.subject_label_id AS subjectLabelId
FROM FROM
pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id
WHERE WHERE
...@@ -65,21 +74,63 @@ ...@@ -65,21 +74,63 @@
select select
a.id, a.name, a.description, a.join_type, a.group_pic, a.pro_label_id, a.dep_label_id, a.id, a.name, a.description, a.join_type, a.group_pic, a.pro_label_id, a.dep_label_id,
a.pur_label_id, a.book_group_qrcode_id, a.pur_label_id, a.book_group_qrcode_id,
a.create_time, a.create_user, a.update_time, a.update_user, a.is_delete, b.group_name a.create_time, a.create_user, a.update_time, a.update_user, a.is_delete, b.group_name,
a.first_classify, a.second_classify, a.grade_label_id, a.subject_label_id
from pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id from pcloud_group_activity a left join book_group_qrcode b on a.book_group_qrcode_id = b.id
where a.id = #{id,jdbcType=INTEGER} where a.id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="getGroupActivity4Applet" resultType="com.pcloud.book.skill.dto.GroupActivity4AppletDTO" parameterType="map">
SELECT
a.id,
a.id groupActivityId,
a.`name`,
a.description as `desc`,
a.join_type AS joinType,
a.group_pic AS groupPic,
a.book_group_qrcode_id AS bookGroupQrcodeId,
b.group_name AS groupName,
b.user_number userNumber,
b.classify_id classifyId,
c.book_group_id bookGroupId,
a.first_classify AS firstClassify,
a.second_classify AS secondClassify,
a.grade_label_id AS gradeLabelId,
a.subject_label_id AS subjectLabelId
FROM
pcloud_group_activity a
INNER JOIN book_group_qrcode b on a.book_group_qrcode_id = b.id AND b.is_delete = 0
INNER JOIN book_group_classify c ON b.classify_id = c.id AND c.is_delete = 0
WHERE
a.is_delete = 0
<if test="firstClassify != null">
and a.first_classify = #{firstClassify}
</if>
<if test="secondClassify != null">
and a.second_classify = #{secondClassify}
</if>
<if test="gradeLabelId != null">
and a.grade_label_id = #{gradeLabelId}
</if>
<if test="subjectLabelId != null">
and a.subject_label_id = #{subjectLabelId}
</if>
ORDER BY id DESC
LIMIT 1
</select>
<insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" > <insert id="insert" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" >
insert into pcloud_group_activity (id, name, insert into pcloud_group_activity (id, name,
description, join_type, group_pic, pro_label_id, dep_label_id, description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_qrcode_id, create_time, pur_label_id, book_group_qrcode_id, create_time,
create_user, update_time, update_user, create_user, update_time, update_user,
is_delete) is_delete, first_classify, second_classify, grade_label_id, subject_label_id)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{desc,jdbcType=VARCHAR}, #{joinType,jdbcType=INTEGER}, #{groupPic,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER}, #{desc,jdbcType=VARCHAR}, #{joinType,jdbcType=INTEGER}, #{groupPic,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER},
#{purLabelId,jdbcType=INTEGER}, #{bookGroupQrcodeId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{purLabelId,jdbcType=INTEGER}, #{bookGroupQrcodeId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
#{isDelete,jdbcType=BIT}) #{isDelete,jdbcType=BIT}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT})
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" > <update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" >
update pcloud_group_activity update pcloud_group_activity
...@@ -123,6 +174,10 @@ ...@@ -123,6 +174,10 @@
<if test="isDelete != null" > <if test="isDelete != null" >
is_delete = #{isDelete,jdbcType=BIT}, is_delete = #{isDelete,jdbcType=BIT},
</if> </if>
first_classify = #{firstClassify,jdbcType=BIGINT},
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT},
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
...@@ -140,7 +195,11 @@ ...@@ -140,7 +195,11 @@
create_user = #{createUser,jdbcType=INTEGER}, create_user = #{createUser,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=INTEGER}, update_user = #{updateUser,jdbcType=INTEGER},
is_delete = #{isDelete,jdbcType=BIT} is_delete = #{isDelete,jdbcType=BIT},
first_classify = #{firstClassify,jdbcType=BIGINT},
second_classify = #{secondClassify,jdbcType=BIGINT},
grade_label_id = #{gradeLabelId,jdbcType=BIGINT},
subject_label_id = #{subjectLabelId,jdbcType=BIGINT}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
......
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