Commit 7705553f by 田超

Merge branch 'feature/1003104' into 'master'

feat: [1003104] 小睿小程序独立管理端2期

See merge request rays/pcloud-book!922
parents 3520223e 72f1c22a
......@@ -40,4 +40,7 @@ public class AppletUserLabelDTO {
return appletUserLabel;
}
@ApiModelProperty("出版社id")
private Long agentId;
}
\ No newline at end of file
......@@ -15,4 +15,5 @@ public class AppletUserLabel {
private Date updateTime;
private Long agentId;
}
\ No newline at end of file
......@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@FeignClient(value = "pcloud-service-book", qualifier = "appletServiceCloud", path = "book/v1.0/appletService")
@Api(description = "小程序内部接口")
......@@ -32,4 +33,8 @@ public interface AppletService {
@GetMapping("getOuterBookById")
public ResponseEntity<ResponseDto<AppletOuterBookDTO>> getOuterBookById(@RequestParam("outerBookId") Long outerBookId);
@ApiOperation("给出版分配小睿基本书刊分类")
@GetMapping("createBaseClassifysToAgent")
void createBaseClassifysToAgent(@RequestParam("agentId") @ApiParam Long agentId);
}
......@@ -41,5 +41,13 @@ public interface AppletBannerBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletBannerDTO> listBanner(Integer currentPage, Integer numPerPage, Boolean showState);
PageBeanNew<AppletBannerDTO> listBanner(Integer currentPage, Integer numPerPage, Boolean showState, Long agentId);
/**
* 客户端banner列表
* @author:zhuyajie
* @date:2020/7/17 16:03
* * @param null
*/
PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId);
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.AppletBookClassifyDTO;
import com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO;
import com.pcloud.book.applet.dto.AppletUserLabelDTO;
import com.pcloud.book.applet.entity.AppletBookClassify;
import com.pcloud.book.applet.entity.AppletBookClassifyAgent;
import com.pcloud.book.applet.entity.AppletUserLabelRelation;
import java.util.List;
......@@ -75,18 +76,18 @@ public interface AppletBookClassifyBiz {
void deleteUserLabel(Long id);
/**
* 客户端标签列表
* 平台端设置的客户端标签列表
* @param appletBookClassifyId
* @return
*/
List<AppletUserLabelDTO> listUserLabel(Long appletBookClassifyId);
List<AppletUserLabelDTO> listUserLabel(Long appletBookClassifyId, Long agentId);
/**
* 获取书刊分类列表及其标签
* @author:zhuyajie
* @date:2020/5/18 16:14
* * @param null
*/
List<AppletBookClassifyDTO> getAllBookClassifyAndLabel(String grayStatus);
List<AppletBookClassifyDTO> getAllBookClassifyAndLabel4Wechat(String grayStatus, Long officialAccountsId);
/**
* 查关联书刊分类
......@@ -121,4 +122,43 @@ public interface AppletBookClassifyBiz {
Long getAppletBookClassifyId(Long firstClassifyId);
Map<Long, AppletBookClassifyDTO> getBookClassifyByIds(List<Long> bookAdviserIds);
/**
* 给出版分配小睿基本书刊分类
* @author:zhuyajie
* @date:2020/7/17 17:01
* * @param null
*/
void createBaseClassifysToAgent(Long agentId);
/**
* 出版社修改客户端分类展示状态、名称
* @author:zhuyajie
* @date:2020/7/17 17:10
* * @param null
*/
void updateBaseInfoByAgent(AppletBookClassifyAgent appletBookClassifyAgent);
/**
* 小睿出版管理端书刊分类查询
* @author:zhuyajie
* @date:2020/7/17 19:10
* * @param null
*/
List<AppletBookClassifyDTO> getAppletBookClassifyListByAgent(Long agentId, Boolean showState);
/**
* 客户端书刊分类查询
* @author:zhuyajie
* @date:2020/7/20 9:46
* * @param null
*/
List<AppletBookClassifyDTO> getAppletBookClassifyList4Wechat(Long officialAccountsId, Boolean showState);
/**
* 客户端标签列表
* @author:zhuyajie
* @date:2020/7/22 15:27
* * @param null
*/
List<AppletUserLabelDTO> listUserLabel4Wechat(Long appletBookClassifyId, Long officialAccountsId);
}
......@@ -42,7 +42,7 @@ public interface AppletBooklistBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletBooklistClassifyDTO> listBooklistClassify(Integer currentPage, Integer numPerPage, String name);
PageBeanNew<AppletBooklistClassifyDTO> listBooklistClassify(Integer currentPage, Integer numPerPage, String name, Long agentId);
/**
* 新增书单
......@@ -74,7 +74,7 @@ public interface AppletBooklistBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId);
PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId);
/**
* 书单添加图书
......@@ -101,7 +101,7 @@ public interface AppletBooklistBiz {
* 获取所有书单栏目
* @return
*/
List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState);
List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState, Long agentId);
/**
* 客户端获取书单列表
......@@ -110,7 +110,7 @@ public interface AppletBooklistBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletBooklistDTO> listBooklist4Wechat(Long classifyId, Integer currentPage, Integer numPerPage, Long wechatUserId);
PageBeanNew<AppletBooklistDTO> listBooklist4Wechat(Long classifyId, Integer currentPage, Integer numPerPage, Long wechatUserId, Long officialAccountsId);
/**
* 客户端根据id获取书单
......@@ -134,21 +134,29 @@ public interface AppletBooklistBiz {
* @date:2020/5/14 11:21
* * @param null
*/
void addUserBooklistClassify(List<Long> classifyIds, Long wechatUserId);
void addUserBooklistClassify(List<Long> classifyIds, Long wechatUserId, Long officialAccountsId);
/**
* 所有书单栏目列表+用户选择的书单栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List<AppletBooklistClassifyDTO> getAllBooklistClassify4Wechat(Long wechatUserId);
List<AppletBooklistClassifyDTO> getAllBooklistClassify4Wechat(Long wechatUserId, Long officialAccountsId);
/**
* 用户选择的书单栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List<AppletBooklistClassifyDTO> getBooklistClassifyByUser(Long wechatUserId);
List<AppletBooklistClassifyDTO> getBooklistClassifyByUser(Long wechatUserId, Long officialAccountsId);
/**
* 添加默认书单推荐栏目
* @author:zhuyajie
* @date:2020/8/5 10:59
* * @param null
*/
void addDefaultBooklistClassify(Long agentId);
/**
* 添加外部书刊
* @author:zhuyajie
......
......@@ -24,7 +24,7 @@ public interface AppletGroupManageBiz {
/**
* 分页查询
*/
PageBeanNew getList(String name, Integer currentPage, Integer numPerPage);
PageBeanNew getList(String name, Integer currentPage, Integer numPerPage, Long agentId);
/**
* 任意门
......@@ -35,7 +35,7 @@ public interface AppletGroupManageBiz {
* @param numPerPage
* @return
*/
PageBeanNew getList4Applet(Long wechatUserId, Integer recommend, Integer currentPage, Integer numPerPage);
PageBeanNew getList4Applet(Long wechatUserId, Integer recommend, Integer currentPage, Integer numPerPage,Long officialAccountsId);
/**
* 新增数据
......@@ -43,7 +43,7 @@ public interface AppletGroupManageBiz {
* @param groupActivityIds
* @return 主键
*/
void insert(List<Long> groupActivityIds);
void insert(List<Long> groupActivityIds, Long agentId);
/**
* 修改数据
......
......@@ -26,7 +26,7 @@ public interface AppletGroupSearchRecordBiz {
/**
* 分页查询
*/
PageBeanNew getList(Long wechatUserId, Integer isMore, Integer currentPage, Integer numPerPage);
PageBeanNew getList(Long wechatUserId, Integer isMore, Integer currentPage, Integer numPerPage, Long agentId);
/**
* 新增数据
......@@ -53,7 +53,7 @@ public interface AppletGroupSearchRecordBiz {
void deleteByIds(List<Long> ids);
List<GroupActivity4AppletDTO> getTishBookSchoolList(Long wechatUserId, Long bookGroupId);
List<GroupActivity4AppletDTO> getTishBookSchoolList(Long wechatUserId, Long bookGroupId, Long officialAccountsId);
/**
* 群对话随机组装
......@@ -84,6 +84,6 @@ public interface AppletGroupSearchRecordBiz {
* @date:2020/6/8 14:45
* * @param null
*/
PageBeanNew<AppletGroupManageDTO> getGroupList4AppletHome(Long wechatUserId, Integer currentPage, Integer numPerPage);
PageBeanNew<AppletGroupManageDTO> getGroupList4AppletHome(Long wechatUserId, Integer currentPage, Integer numPerPage, Long officialAccountsId);
}
\ No newline at end of file
......@@ -54,7 +54,7 @@ public interface AppletNewsBiz {
* @param numPerPage
* @return
*/
PageBeanNew<AppletNewsClassifyDTO> listNewsClassify(Integer currentPage, Integer numPerPage, String name);
PageBeanNew<AppletNewsClassifyDTO> listNewsClassify(Integer currentPage, Integer numPerPage, String name, Long agentId);
/**
* 添加资讯
......@@ -86,13 +86,13 @@ public interface AppletNewsBiz {
PageBeanNew<AppletNewsDTO> listAppletNews(Integer currentPage, Integer numPerPage, String name,
Long firstClassify, Long secondClassify, Long gradeLabelId,
Long subjectLabelId, Long rightsClassifyId, String source, Integer showState, Long newsClassifyId,
Long customTagId, String cityCode);
Long customTagId, String cityCode,Long agentId);
/**
* 获取所有资讯栏目
* @return
*/
List<AppletNewsClassifyDTO> getAllNewsClassify(Boolean showState);
List<AppletNewsClassifyDTO> getAllNewsClassify(Boolean showState, Long agentId);
/**
* 客户端资讯列表
......@@ -101,7 +101,7 @@ public interface AppletNewsBiz {
* @param newsClassifyId
* @return
*/
PageBeanNew<AppletNewsDTO> listAppletNews4Wechat(Integer currentPage, Integer numPerPage, Long newsClassifyId, Long wechatUserId);
PageBeanNew<AppletNewsDTO> listAppletNews4Wechat(Integer currentPage, Integer numPerPage, Long newsClassifyId, Long wechatUserId, Long officialAccountsId);
/**
* 添加资讯评论
......@@ -139,7 +139,7 @@ public interface AppletNewsBiz {
* @param rightsType
* @return
*/
List<AppletNewsDTO> getNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType);
List<AppletNewsDTO> getNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType, Long agentId);
/**
* 批量修改分类
......@@ -166,7 +166,7 @@ public interface AppletNewsBiz {
* @date:2020/4/27 14:46
* * @param null
*/
List<String> getNewsSourceList();
List<String> getNewsSourceList(Long agentId);
/**
......@@ -182,28 +182,28 @@ public interface AppletNewsBiz {
* @date:2020/5/11 17:39
* * @param null
*/
String getUrlNumberByUrl(String jumpUrl);
String getUrlNumberByUrl(String jumpUrl, Long agentId);
/**
* 用户选择资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
void addUserNewsClassify(List<Long> newsClassifyIds, Long wechatUserId);
void addUserNewsClassify(List<Long> newsClassifyIds, Long wechatUserId, Long officialAccountsId);
/**
* 所有资讯栏目列表+用户选择的资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List<AppletNewsClassifyDTO> getAllNewsClassify4Wechat(Long wechatUserId);
List<AppletNewsClassifyDTO> getAllNewsClassify4Wechat(Long wechatUserId, Long officialAccountsId);
/**
* 用户选择的资讯栏目
* @author:zhuyajie
* @date:2020/5/14 11:21
* * @param null
*/
List<AppletNewsClassifyDTO> getNewsClassifyByUser(Long wechatUserId);
List<AppletNewsClassifyDTO> getNewsClassifyByUser(Long wechatUserId, Long officialAccountsId);
/**
* 资讯统计分析
......@@ -214,7 +214,7 @@ public interface AppletNewsBiz {
PageBeanNew<AppletNewsDTO> listAppletNews4Analysis(Integer currentPage, Integer numPerPage, String name,
Long firstClassify,Long secondClassify,Long gradeLabelId,
Long subjectLabelId,Integer linkOnly,Long rightsClassifyId,
String source,Integer browseQty,Integer clickQty);
String source,Integer browseQty,Integer clickQty, Long agentId);
/**
*
......@@ -237,7 +237,7 @@ public interface AppletNewsBiz {
* @date:2020/6/9 17:52
* * @param null
*/
void batchUpdateCustomTagId(List<Long> ids, Long customTagId, String customTag);
void batchUpdateCustomTagId(List<Long> ids, Long customTagId, String customTag, Long agentId);
/**
* 新增自定义标识
* @author:zhuyajie
......@@ -258,7 +258,7 @@ public interface AppletNewsBiz {
* @date:2020/6/9 17:52
* * @param null
*/
List<AppletNewsCustomTagDTO> getCustomTagList();
List<AppletNewsCustomTagDTO> getCustomTagList(Long agentId);
/**
* 根据标识id查资讯id列表
* @author:zhuyajie
......@@ -286,4 +286,20 @@ public interface AppletNewsBiz {
void updateCardShowState(AppletNews appletNews);
AppletNewsDTO getNewsById4Applet(Long newsId);
/**
* 根据公众号id获取出版社id
* @author:zhuyajie
* @date:2020/7/20 15:38
* * @param null
*/
Long getAgentIdByAccountId(Long officialAccountsId);
/**
* 添加默认推荐资讯栏目
* @author:zhuyajie
* @date:2020/8/5 10:53
* * @param null
*/
void addDefaultAppletNewsClassify(Long agentId);
}
package com.pcloud.book.applet.biz.impl;
import com.pcloud.book.applet.biz.AppletBannerBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dao.AppletBannerDao;
import com.pcloud.book.applet.dto.AppletBannerDTO;
import com.pcloud.book.applet.entity.AppletBanner;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.wechat.entity.AccountSetting;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -22,11 +27,16 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
@Autowired
private AppletBannerDao appletBannerDao;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Override
public Long addBanner(AppletBanner appletBanner) {
Integer seq = appletBannerDao.getMaxSeq();
if (null == appletBanner.getAgentId()){
appletBanner.setAgentId(0L);
}
Integer seq = appletBannerDao.getMaxSeq(appletBanner.getAgentId());
appletBanner.setSeq(seq+1);
appletBanner.setShowState(false);
appletBannerDao.insert(appletBanner);
......@@ -57,11 +67,18 @@ public class AppletBannerBizImpl implements AppletBannerBiz {
}
@Override
public PageBeanNew<AppletBannerDTO> listBanner(Integer currentPage, Integer numPerPage, Boolean showState) {
public PageBeanNew<AppletBannerDTO> listBanner(Integer currentPage, Integer numPerPage, Boolean showState, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("showState", showState);
map.put("agentId", agentId);
PageBeanNew<AppletBannerDTO> pageBeanNew = appletBannerDao.listPageNew(
new PageParam(currentPage,numPerPage), map, "listBanner");
return pageBeanNew;
}
@Override
public PageBeanNew<AppletBannerDTO> listBanner4Wechat(Integer currentPage, Integer numPerPage, Boolean showState, Long officialAccountsId) {
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
return listBanner(currentPage, numPerPage, showState, agentId);
}
}
......@@ -2,12 +2,19 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletBookClassifyBiz;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dao.AppletBookClassifyAgentDao;
import com.pcloud.book.applet.dao.AppletBookClassifyDao;
import com.pcloud.book.applet.dto.AppletBookClassifyDTO;
import com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO;
import com.pcloud.book.applet.dto.AppletBooklistClassifyDTO;
import com.pcloud.book.applet.dto.AppletLabelDTO;
import com.pcloud.book.applet.dto.AppletNewsClassifyDTO;
import com.pcloud.book.applet.dto.AppletUserLabelDTO;
import com.pcloud.book.applet.entity.AppletBookClassify;
import com.pcloud.book.applet.entity.AppletBookClassifyAgent;
import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletUserLabel;
import com.pcloud.book.applet.entity.AppletUserLabelRelation;
import com.pcloud.book.applet.enums.LabelTypeEnum;
......@@ -17,7 +24,10 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.dao.BookLabelDao;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.util.common.YesOrNoEnums;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.wechat.entity.AccountSetting;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.utils.ListUtils;
......@@ -54,9 +64,14 @@ public class AppletBookClassifyBizImpl implements AppletBookClassifyBiz {
private AppletUserLabelRelationMapper relationMapper;
@Autowired
private AssistTempletConsr assistTempletConsr;
@Autowired
private BookLabelDao bookLabelDao;
@Autowired
private AppletBookClassifyAgentDao appletBookClassifyAgentDao;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private AppletBooklistBiz appletBooklistBiz;
@Override
......@@ -86,6 +101,9 @@ public class AppletBookClassifyBizImpl implements AppletBookClassifyBiz {
@ParamLog("平台端新增客户端标签")
public void addUserLabel(AppletUserLabelDTO appletUserLabelDTO) {
AppletUserLabel appletUserLabel = appletUserLabelDTO.DTOToEntity();
if (null == appletUserLabel.getAgentId()){
appletUserLabel.setAgentId(0L);
}
appletUserLabelMapper.insert(appletUserLabel);
List<AppletUserLabelRelation> appletUserLabelRelations = appletUserLabelDTO.getAppletUserLabelRelations();
if (ListUtils.isEmpty(appletUserLabelRelations)){
......@@ -155,9 +173,9 @@ public class AppletBookClassifyBizImpl implements AppletBookClassifyBiz {
}
@Override
@ParamLog("客户端标签列表")
public List<AppletUserLabelDTO> listUserLabel(Long appletBookClassifyId) {
List<AppletUserLabelDTO> appletUserLabelDTOS = appletUserLabelMapper.listUserLabel(appletBookClassifyId);
@ParamLog("平台端设置的客户端标签列表")
public List<AppletUserLabelDTO> listUserLabel(Long appletBookClassifyId, Long agentId) {
List<AppletUserLabelDTO> appletUserLabelDTOS = appletUserLabelMapper.listUserLabel(appletBookClassifyId, agentId);
if (ListUtils.isEmpty(appletUserLabelDTOS)) {
return new ArrayList<>();
}
......@@ -227,8 +245,8 @@ public class AppletBookClassifyBizImpl implements AppletBookClassifyBiz {
@Override
public List<AppletBookClassifyDTO> getAllBookClassifyAndLabel(String grayStatus) {
List<AppletBookClassifyDTO> classifyAndLabelDTOS = appletBookClassifyDao.queryAll(true);
public List<AppletBookClassifyDTO> getAllBookClassifyAndLabel4Wechat(String grayStatus, Long officialAccountsId) {
List<AppletBookClassifyDTO> classifyAndLabelDTOS = getAppletBookClassifyList4Wechat(officialAccountsId, true);
if (ListUtils.isEmpty(classifyAndLabelDTOS)) {
return new ArrayList<>();
}
......@@ -240,7 +258,8 @@ public class AppletBookClassifyBizImpl implements AppletBookClassifyBiz {
}
}
}
List<AppletLabelDTO> userLabelDTOS = appletUserLabelMapper.getBookClassifyAndLabel();
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
List<AppletLabelDTO> userLabelDTOS = appletUserLabelMapper.getBookClassifyAndLabel(agentId);
if (ListUtils.isEmpty(userLabelDTOS)) {
return classifyAndLabelDTOS;
}
......@@ -283,4 +302,67 @@ public class AppletBookClassifyBizImpl implements AppletBookClassifyBiz {
return appletBookClassifyDao.getBookClassifyByIds(bookAdviserIds);
}
@Override
public void createBaseClassifysToAgent(Long agentId) {
//书刊分类
List<AppletBookClassifyDTO> list = appletBookClassifyDao.queryAll(null);
if (!ListUtils.isEmpty(list)) {
List<AppletBookClassifyAgent> agents = appletBookClassifyAgentDao.getByAgent(agentId);
if (ListUtils.isEmpty(agents)){
List<AppletBookClassifyAgent> bookClassifyAgents = new ArrayList<>();
for (AppletBookClassifyDTO classifyDTO : list) {
AppletBookClassifyAgent classifyAgent = new AppletBookClassifyAgent();
classifyAgent.setAppletBookClassifyId(classifyDTO.getId());
classifyAgent.setAgentId(agentId);
classifyAgent.setShowState(true);
classifyAgent.setClassifyName(classifyDTO.getClassify());
classifyAgent.setSeq(classifyDTO.getSeq());
classifyAgent.setPic(classifyDTO.getPic());
bookClassifyAgents.add(classifyAgent);
}
appletBookClassifyAgentDao.insert(bookClassifyAgents);
}
}
//资讯推荐栏目
List<AppletNewsClassifyDTO> newsClassify = appletNewsBiz.getAllNewsClassify(null, agentId);
if (ListUtils.isEmpty(newsClassify)){
appletNewsBiz.addDefaultAppletNewsClassify(agentId);
}
//书单推荐栏目
List<AppletBooklistClassifyDTO> booklistClassify = appletBooklistBiz.getAllBooklistClassify(null, agentId);
if (ListUtils.isEmpty(booklistClassify)){
appletBooklistBiz.addDefaultBooklistClassify(agentId);
}
}
@Override
public void updateBaseInfoByAgent(AppletBookClassifyAgent appletBookClassifyAgent) {
if (null == appletBookClassifyAgent || null == appletBookClassifyAgent.getAgentId()
|| null == appletBookClassifyAgent.getAppletBookClassifyId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "参数缺失");
}
appletBookClassifyAgentDao.updateBaseInfoByAgent(appletBookClassifyAgent);
}
@Override
public List<AppletBookClassifyDTO> getAppletBookClassifyListByAgent(Long agentId, Boolean showState) {
return appletBookClassifyAgentDao.listClassifyByAgent(agentId, showState);
}
@Override
public List<AppletBookClassifyDTO> getAppletBookClassifyList4Wechat(Long officialAccountsId, Boolean showState) {
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
if (null == agentId){
return getAppletBookClassifyList(showState);
}else {
return getAppletBookClassifyListByAgent(agentId, showState);
}
}
@Override
public List<AppletUserLabelDTO> listUserLabel4Wechat(Long appletBookClassifyId, Long officialAccountsId) {
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
return listUserLabel(appletBookClassifyId, agentId);
}
}
......@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletBooklistClassifyDao;
import com.pcloud.book.applet.dao.AppletBooklistDao;
......@@ -14,6 +15,7 @@ import com.pcloud.book.applet.dto.AppletOuterBookDTO;
import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.BookDTO4Booklist;
import com.pcloud.book.applet.dto.OuterBooklistAddDTO;
import com.pcloud.book.applet.entity.AppletBookClassify;
import com.pcloud.book.applet.entity.AppletBooklist;
import com.pcloud.book.applet.entity.AppletBooklistClassify;
import com.pcloud.book.applet.entity.AppletBooklistClassifyUser;
......@@ -24,6 +26,9 @@ import com.pcloud.book.book.biz.BookBiz;
import com.pcloud.book.book.dao.BookRaysClassifyDao;
import com.pcloud.book.consumer.app.AssistTempletConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.util.properties.BookProps;
import com.pcloud.channelcenter.wechat.entity.AccountSetting;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
......@@ -66,6 +71,8 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
@Autowired
private BookRaysClassifyDao bookRaysClassifyDao;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private AppletOuterBookDao appletOuterBookDao;
@Autowired
private AppletOuterBooklistDao appletOuterBooklistDao;
......@@ -73,7 +80,10 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
@Override
public Long addBooklistClassify(AppletBooklistClassify appletBooklistClassify) {
Integer seq = appletBooklistClassifyDao.getMaxSeq();
if (null == appletBooklistClassify.getAgentId()){
appletBooklistClassify.setAgentId(0L);
}
Integer seq = appletBooklistClassifyDao.getMaxSeq(appletBooklistClassify.getAgentId());
appletBooklistClassify.setSeq(seq+1);
appletBooklistClassify.setShowState(false);
appletBooklistClassifyDao.insert(appletBooklistClassify);
......@@ -99,11 +109,12 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public PageBeanNew<AppletBooklistClassifyDTO> listBooklistClassify(Integer currentPage, Integer numPerPage, String name) {
public PageBeanNew<AppletBooklistClassifyDTO> listBooklistClassify(Integer currentPage, Integer numPerPage, String name, Long agentId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("name", name);
paramMap.put("agentId", agentId);
PageBeanNew<AppletBooklistClassifyDTO> pageBeanNew = appletBooklistClassifyDao.listPageNew(
new PageParam(currentPage,numPerPage) ,paramMap,"listBooklistClassify");
new PageParam(currentPage,numPerPage), paramMap,"listBooklistClassify");
return pageBeanNew;
}
......@@ -141,10 +152,11 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId) {
public PageBeanNew<AppletBooklistDTO> listBooklist(Integer currentPage, Integer numPerPage, String name, Long classifyId, Long agentId) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("name", name);
paramMap.put("classifyId", classifyId);
paramMap.put("agentId", agentId);
PageBeanNew<AppletBooklistDTO> pageBeanNew = appletBooklistDao.listPageNew(
new PageParam(currentPage,numPerPage), paramMap,"listBooklist");
if(null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
......@@ -233,18 +245,19 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState){
return appletBooklistClassifyDao.getAllBooklistClassify(showState);
public List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState, Long agentId){
return appletBooklistClassifyDao.getAllBooklistClassify(showState, agentId);
}
@Override
public PageBeanNew<AppletBooklistDTO> listBooklist4Wechat(Long classifyId, Integer currentPage, Integer numPerPage, Long wechatUserId) {
public PageBeanNew<AppletBooklistDTO> listBooklist4Wechat(Long classifyId, Integer currentPage, Integer numPerPage, Long wechatUserId, Long officialAccountsId) {
PageBeanNew<AppletBooklistDTO> pageBeanNew = new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
Map<String, Object> map = new HashMap<>();
if (null == classifyId) {//首页书单推荐
List<Long> classifyIds = appletBooklistClassifyDao.getClassifyIdsByUserId(wechatUserId);
if (ListUtils.isEmpty(classifyIds)) {//没有栏目id取第一个
List<AppletBooklistClassifyDTO> classifyDTOS = getAllBooklistClassify(true);
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
List<AppletBooklistClassifyDTO> classifyDTOS = getAllBooklistClassify(true, agentId);
if (ListUtils.isEmpty(classifyDTOS)) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
......@@ -311,13 +324,14 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public void addUserBooklistClassify(List<Long> classifyIds, Long wechatUserId) {
public void addUserBooklistClassify(List<Long> classifyIds, Long wechatUserId, Long officialAccountsId) {
if (null == wechatUserId){
return;
}
appletBooklistClassifyDao.deleteClassifyByWechatUesrId(wechatUserId);
if (ListUtils.isEmpty(classifyIds)){
List<AppletBooklistClassifyDTO> classifyDTOS = getAllBooklistClassify(true);
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
List<AppletBooklistClassifyDTO> classifyDTOS = getAllBooklistClassify(true, agentId);
if (ListUtils.isEmpty(classifyDTOS)){
return;
}
......@@ -334,8 +348,9 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public List<AppletBooklistClassifyDTO> getAllBooklistClassify4Wechat(Long wechatUserId) {
List<AppletBooklistClassifyDTO> list = appletBooklistClassifyDao.getAllBooklistClassify(true);
public List<AppletBooklistClassifyDTO> getAllBooklistClassify4Wechat(Long wechatUserId, Long officialAccountsId) {
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
List<AppletBooklistClassifyDTO> list = appletBooklistClassifyDao.getAllBooklistClassify(true, agentId);
if (ListUtils.isEmpty(list)) {
return new ArrayList<>();
}
......@@ -354,10 +369,11 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public List<AppletBooklistClassifyDTO> getBooklistClassifyByUser(Long wechatUserId) {
public List<AppletBooklistClassifyDTO> getBooklistClassifyByUser(Long wechatUserId, Long officialAccountsId) {
List<AppletBooklistClassifyDTO> list = appletBooklistClassifyDao.getClassifysByUserId(wechatUserId);
if (ListUtils.isEmpty(list)){
List<AppletBooklistClassifyDTO> allBooklistClassify = appletBooklistClassifyDao.getAllBooklistClassify(true);
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
List<AppletBooklistClassifyDTO> allBooklistClassify = appletBooklistClassifyDao.getAllBooklistClassify(true, agentId);
if (ListUtils.isEmpty(allBooklistClassify)){
return new ArrayList<>();
}
......@@ -553,4 +569,17 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
PageBeanNew<AppletOuterBookDTO> pageBeanNew = appletOuterBookDao.listPageNew(new PageParam(currentPage,numPerPage), map,"listPageOuterBookByBooklistId");
return pageBeanNew;
}
@Override
public void addDefaultBooklistClassify(Long agentId) {
AppletBooklistClassify appletBooklistClassify = new AppletBooklistClassify();
appletBooklistClassify.setSeq(0);
appletBooklistClassify.setAgentId(agentId);
appletBooklistClassify.setClassifyName("推荐");
appletBooklistClassify.setPic("https://file.5rs.me/oss/uploadfe/png/30ac33d2ecd19649fd86250065a58e42.png");
appletBooklistClassify.setShowState(false);
appletBooklistClassifyDao.insert(appletBooklistClassify);
}
}
......@@ -3,11 +3,13 @@ package com.pcloud.book.applet.biz.impl;
import com.google.common.collect.Lists;
import com.pcloud.book.applet.biz.AppletGroupManageBiz;
import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dao.AppletGroupManageDao;
import com.pcloud.book.applet.dto.AppletGroupManageDTO;
import com.pcloud.book.applet.dto.AppletGroupStatementDTO;
import com.pcloud.book.applet.dto.UpdateAppletGroupManageDTO;
import com.pcloud.book.applet.entity.AppletGroupManage;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.consumer.label.LabelConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
......@@ -60,6 +62,8 @@ public class AppletGroupManageBizImpl implements AppletGroupManageBiz {
private BookQrcodeUserDao bookQrcodeUserDao;
@Autowired
private BookClassifyBuyRecordDao bookClassifyBuyRecordDao;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Override
public AppletGroupManage getById(Long id) {
......@@ -67,9 +71,10 @@ public class AppletGroupManageBizImpl implements AppletGroupManageBiz {
}
@Override
public PageBeanNew getList(String name, Integer currentPage, Integer numPerPage) {
public PageBeanNew getList(String name, Integer currentPage, Integer numPerPage, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("name", name);
map.put("agentId", agentId);
PageBeanNew<AppletGroupManageDTO> recordList = appletGroupManageDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getList");
if (null == recordList || CollectionUtils.isEmpty(recordList.getRecordList())) {
return recordList;
......@@ -111,9 +116,11 @@ public class AppletGroupManageBizImpl implements AppletGroupManageBiz {
}
@Override
public PageBeanNew getList4Applet(Long wechatUserId, Integer recommend, Integer currentPage, Integer numPerPage) {
public PageBeanNew getList4Applet(Long wechatUserId, Integer recommend, Integer currentPage, Integer numPerPage, Long officialAccountsId) {
Map<String,Object> map = new HashMap<>();
map.put("recommend", recommend);
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
map.put("agentId", agentId);
PageBeanNew<AppletGroupManageDTO> recordList = appletGroupManageDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getList4Applet");
if (null == recordList || CollectionUtils.isEmpty(recordList.getRecordList())) {
return recordList;
......@@ -158,10 +165,13 @@ public class AppletGroupManageBizImpl implements AppletGroupManageBiz {
@Override
@Transactional(rollbackFor = Exception.class)
public void insert(List<Long> groupActivityIds) {
public void insert(List<Long> groupActivityIds, Long agentId) {
if (null == agentId){
agentId = 0L;
}
if(!ListUtils.isEmpty(groupActivityIds)){
List<AppletGroupManage> list = Lists.newArrayList();
Integer maxSeqNum = appletGroupManageDao.getMaxSeqNum();
Integer maxSeqNum = appletGroupManageDao.getMaxSeqNum(agentId);
AppletGroupManage appletGroupManage;
for (Long groupActivityId : groupActivityIds) {
appletGroupManage = new AppletGroupManage();
......@@ -169,12 +179,13 @@ public class AppletGroupManageBizImpl implements AppletGroupManageBiz {
appletGroupManage.setRecommend(0);
appletGroupManage.setEnable(1);
appletGroupManage.setSeqNum((maxSeqNum + groupActivityIds.indexOf(groupActivityId) + 1));
appletGroupManage.setAgentId(agentId);
list.add(appletGroupManage);
}
try {
appletGroupManageDao.insert(list);
} catch (DuplicateKeyException e){
throw new BizException("请勿添加重复数据");
throw new BookBizException(BookBizException.ERROR,"请勿添加重复数据");
}
}
}
......@@ -182,7 +193,7 @@ public class AppletGroupManageBizImpl implements AppletGroupManageBiz {
@Override
public void update(UpdateAppletGroupManageDTO updateAppletGroupManageDTO) {
if(updateAppletGroupManageDTO == null || !NumberUtil.isNumber(updateAppletGroupManageDTO.getId())){
throw BizException.PARAM_IS_NULL;
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数缺失");
}
AppletGroupManage appletGroupManage = new AppletGroupManage();
BeanUtils.copyProperties(updateAppletGroupManageDTO, appletGroupManage);
......
......@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletGroupSearchRecordDao;
......@@ -99,6 +100,8 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
private BookClassifyBuyRecordDao bookClassifyBuyRecordDao;
@Autowired
private GroupQrcodeBiz groupQrcodeBiz;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Override
@ParamLog("通过ID查询单条数据")
......@@ -108,9 +111,10 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
@Override
@ParamLog("查询多条数据")
public PageBeanNew getList(Long wechatUserId, Integer isMore, Integer currentPage, Integer numPerPage) {
public PageBeanNew getList(Long wechatUserId, Integer isMore, Integer currentPage, Integer numPerPage, Long agentId) {
Map<String, Object> map = new HashMap<>();
map.put("wechatUserId", wechatUserId);
map.put("agentId", agentId);
PageBeanNew pageBeanNew = appletGroupSearchRecordDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getList");
List<AppletGroupSearchRecordDTO> recordList = pageBeanNew.getRecordList();
if (ListUtils.isEmpty(recordList)) {
......@@ -192,7 +196,7 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
}
@Override
public List<GroupActivity4AppletDTO> getTishBookSchoolList(Long wechatUserId, Long bookGroupId) {
public List<GroupActivity4AppletDTO> getTishBookSchoolList(Long wechatUserId, Long bookGroupId, Long officialAccountsId) {
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(bookGroupId);
List<GroupActivity4AppletDTO> tishBookSchoolList = new ArrayList<>();
//本书自带社群
......@@ -240,11 +244,13 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
baseTempletClassify.setSubjectLabelId(bookAdviser.getSubLabelId());
// 部分分类需要忽略二级分类
rightsSettingBiz.setClassifyAndLabel(baseTempletClassify);
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
Map<String, Object> paraMap = Maps.newHashMap();
paraMap.put("firstClassify", baseTempletClassify.getFirstClassify());
paraMap.put("secondClassify", baseTempletClassify.getSecondClassify());
paraMap.put("gradeLabelId", baseTempletClassify.getGradeLabelId());
paraMap.put("subjectLabelId", baseTempletClassify.getSubjectLabelId());
paraMap.put("agentId", agentId);
List<Long> classifyIds = pcloudGroupActivityDao.getGroupClassifyIds(paraMap);
List<Long> collect = tishBookSchoolList.stream().map(GroupActivity4AppletDTO::getClassifyId).distinct().collect(Collectors.toList());
classifyIds.removeAll(collect);
......@@ -333,7 +339,7 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
}
@Override
public PageBeanNew<AppletGroupManageDTO> getGroupList4AppletHome(Long wechatUserId, Integer currentPage, Integer numPerPage) {
public PageBeanNew<AppletGroupManageDTO> getGroupList4AppletHome(Long wechatUserId, Integer currentPage, Integer numPerPage, Long officialAccountsId) {
//用户最近读的书
PageBeanNew<AppletUserBookcaseDTO> bookcaseDTOPageBeanNew = appletUserBookcaseBiz.listByWechatUserId(wechatUserId, currentPage, 1);
if (null == bookcaseDTOPageBeanNew || ListUtils.isEmpty(bookcaseDTOPageBeanNew.getRecordList())) {
......@@ -343,7 +349,8 @@ public class AppletGroupSearchRecordBizImpl implements AppletGroupSearchRecordBi
if (null == bookcaseDTO) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
PageBeanNew<AppletGroupManageDTO> pageBeanNew = pcloudGroupActivityBiz.getGroupListByBookTemplet(wechatUserId, bookcaseDTO.getTempletId(), bookcaseDTO.getSecondTempletId(), bookcaseDTO.getGradeLabelId(), bookcaseDTO.getSubjectLabelId(), currentPage, numPerPage);
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
PageBeanNew<AppletGroupManageDTO> pageBeanNew = pcloudGroupActivityBiz.getGroupListByBookTemplet(wechatUserId, bookcaseDTO.getTempletId(), bookcaseDTO.getSecondTempletId(), bookcaseDTO.getGradeLabelId(), bookcaseDTO.getSubjectLabelId(), currentPage, numPerPage, agentId);
return pageBeanNew;
}
......
......@@ -9,5 +9,5 @@ public interface AppletBannerDao extends BaseDao<AppletBanner> {
* 获取最大排序值
* @return
*/
Integer getMaxSeq();
Integer getMaxSeq(Long agentId);
}
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletBookClassifyDTO;
import com.pcloud.book.applet.entity.AppletBookClassifyAgent;
import com.pcloud.common.core.dao.BaseDao;
import com.pcloud.common.entity.BaseEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 出版社小程序分类菜单权限(AppletBookClassifyAgent)表数据库访问层
*
* @author makejava
* @since 2020-07-17 16:49:50
*/
public interface AppletBookClassifyAgentDao extends BaseDao<AppletBookClassifyAgent>{
void updateBaseInfoByAgent(AppletBookClassifyAgent appletBookClassifyAgent);
List<AppletBookClassifyAgent> getByAgent(Long agentId);
List<AppletBookClassifyDTO> listClassifyByAgent(Long agentId, Boolean showState);
}
\ No newline at end of file
......@@ -13,12 +13,12 @@ public interface AppletBooklistClassifyDao extends BaseDao<AppletBooklistClassif
* 获取最大排序值
* @return
*/
Integer getMaxSeq();
Integer getMaxSeq(Long agentId);
/**
* 获取所有书单栏目
* @return
*/
List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState);
List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState, Long agentId);
/**
* 用户选择书单栏目
......
......@@ -12,5 +12,5 @@ import java.util.List;
*/
public interface AppletGroupManageDao extends BaseDao<AppletGroupManage> {
Integer getMaxSeqNum();
Integer getMaxSeqNum(Long agentId);
}
\ No newline at end of file
......@@ -13,13 +13,13 @@ public interface AppletNewsClassifyDao extends BaseDao<AppletNewsClassify> {
* 获取最大排序值
* @return
*/
Integer getMaxSeq();
Integer getMaxSeq(Long agentId);
/**
* 获取所有书单栏目
* @return
*/
List<AppletNewsClassifyDTO> getAllNewsClassify(Boolean showState);
List<AppletNewsClassifyDTO> getAllNewsClassify(Boolean showState, Long agentId);
/**
* 用户选择资讯栏目
* @author:zhuyajie
......
......@@ -47,30 +47,31 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* @param rightsType
* @return
*/
List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType);
List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType, Long agentId);
List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Long rightsClassifyId, Integer top);
List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Long rightsClassifyId, Integer top,
Long agentId);
/**
*新增资讯来源
*/
int insertSource(String source);
void insertSource(String source, Long agentId);
/**
*资讯来源列表
*/
List<String> getNewsSourceList();
List<String> getNewsSourceList(Long agentId);
/**
*资讯来源数量
*/
Integer getAppletNewsSourceCount(String source);
Integer getAppletNewsSourceCount(String source, Long agentId);
/**
*删除资讯来源
*/
void deleteSource(String source);
void deleteSource(String source, Long agentId);
/**
*来源是否存在
*/
Boolean newsSourceExist(String source);
Boolean newsSourceExist(String source, Long agentId);
void batchUpdateClassify(AppletNewsClassifyVO appletNewsClassifyVO);
......@@ -84,14 +85,14 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* @date:2020/5/11 17:39
* * @param null
*/
String getUrlNumberByJumpUrl(String jumpUrl);
String getUrlNumberByJumpUrl(String jumpUrl, Long agentId);
/**
* 链接编号是否存在
* @author:zhuyajie
* @date:2020/5/11 18:43
* * @param null
*/
Boolean urlNumberExist(String urlNumber, Long id);
Boolean urlNumberExist(String urlNumber, Long id, Long agentId);
Map<Long, AppletNewsDTO> getByIds(List<Long> appletNewsIds);
......@@ -130,14 +131,14 @@ public interface AppletNewsDao extends BaseDao<AppletNews> {
* @date:2020/6/9 17:52
* * @param null
*/
List<AppletNewsCustomTagDTO> getCustomTagList();
List<AppletNewsCustomTagDTO> getCustomTagList(Long agentId);
/**
* 标识是否存在
* @author:zhuyajie
* @date:2020/6/9 18:12
* * @param null
*/
Boolean customTagExist(String customTag);
Boolean customTagExist(String customTag, Long agentId);
/**
* 根据标识id查资讯id列表
* @author:zhuyajie
......
......@@ -5,11 +5,16 @@ import com.pcloud.book.applet.entity.AppletBanner;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
@Component
public class AppletBannerDaoImpl extends BaseDaoImpl<AppletBanner> implements AppletBannerDao {
@Override
public Integer getMaxSeq() {
return getSessionTemplate().selectOne(getStatement("getMaxSeq"));
public Integer getMaxSeq(Long agentId) {
Map<String, Object>map = new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("getMaxSeq"), map);
}
}
package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletBookClassifyAgentDao;
import com.pcloud.book.applet.dto.AppletBookClassifyDTO;
import com.pcloud.book.applet.entity.AppletBookClassifyAgent;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletBookClassifyAgentDaoImpl
* @Author zhuyajie
* @Description
* @Date 2020/7/17 16:51
* @Version 1.0
**/
@Component
public class AppletBookClassifyAgentDaoImpl extends BaseDaoImpl<AppletBookClassifyAgent> implements AppletBookClassifyAgentDao {
@Override
public void updateBaseInfoByAgent(AppletBookClassifyAgent appletBookClassifyAgent) {
getSessionTemplate().update(getStatement("updateBaseInfoByAgent"), appletBookClassifyAgent);
}
@Override
public List<AppletBookClassifyAgent> getByAgent(Long agentId) {
return getSessionTemplate().selectList(getStatement("getByAgent"), agentId);
}
@Override
public List<AppletBookClassifyDTO> listClassifyByAgent(Long agentId, Boolean showState) {
Map<String,Object> map = new HashMap<>();
map.put("agentId", agentId);
map.put("showState", showState);
return getSessionTemplate().selectList(getStatement("listClassifyByAgent"), map);
}
}
......@@ -17,14 +17,17 @@ import java.util.Map;
public class AppletBooklistClassifyDaoImpl extends BaseDaoImpl<AppletBooklistClassify> implements AppletBooklistClassifyDao {
@Override
public Integer getMaxSeq() {
return getSessionTemplate().selectOne(getStatement("getMaxSeq"));
public Integer getMaxSeq(Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("getMaxSeq"), map);
}
@Override
public List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState) {
public List<AppletBooklistClassifyDTO> getAllBooklistClassify(Boolean showState, Long agentId) {
Map<String,Object>map=new HashMap<>();
map.put("showState", showState);
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getAllBooklistClassify"), map);
}
......
......@@ -17,7 +17,7 @@ import java.util.List;
public class AppletGroupManageDaoImpl extends BaseDaoImpl<AppletGroupManage> implements AppletGroupManageDao {
@Override
public Integer getMaxSeqNum() {
return super.sqlSessionTemplate.selectOne(getStatement("getMaxSeqNum"));
public Integer getMaxSeqNum(Long agentId) {
return super.sqlSessionTemplate.selectOne(getStatement("getMaxSeqNum"), agentId);
}
}
\ No newline at end of file
......@@ -15,14 +15,17 @@ import java.util.Map;
@Component
public class AppletNewsClassifyDaoImpl extends BaseDaoImpl<AppletNewsClassify> implements AppletNewsClassifyDao {
@Override
public Integer getMaxSeq() {
return getSessionTemplate().selectOne(getStatement("getMaxSeq"));
public Integer getMaxSeq(Long agentId) {
Map<String,Object> map=new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("getMaxSeq"), map);
}
@Override
public List<AppletNewsClassifyDTO> getAllNewsClassify(Boolean showState) {
public List<AppletNewsClassifyDTO> getAllNewsClassify(Boolean showState, Long agentId) {
Map<String,Object> map=new HashMap<>();
map.put("showState", showState);
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getAllNewsClassify"), map);
}
......
......@@ -40,19 +40,24 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
}
@Override
public List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType) {
public List<AppletNewsDTO> getByNewsByTempletLabel(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, String rightsType, Long agentId) {
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);
if (null == agentId){
agentId = 0L;
}
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getByNewsByTempletLabel"),map);
}
@Override
public List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Long rightsClassifyId, Integer top) {
public List<AppletNews> getByTempletAndClassify(Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Long rightsClassifyId, Integer top,
Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("firstClassify", firstClassify);
map.put("secondClassify", secondClassify);
......@@ -60,32 +65,56 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
map.put("subjectLabelId", subjectLabelId);
map.put("rightsClassifyId",rightsClassifyId);
map.put("top", top);
if (null == agentId){
agentId = 0L;
}
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getByTempletAndClassify"),map);
}
@Override
public int insertSource(String source) {
return getSessionTemplate().insert(getStatement("insertSource"),source);
public void insertSource(String source, Long agentId) {
if (null == agentId) {
agentId = 0L;
}
Map<String, Object> map = new HashMap<>();
map.put("agentId", agentId);
map.put("source", source);
getSessionTemplate().insert(getStatement("insertSource"), map);
}
@Override
public List<String> getNewsSourceList() {
return getSessionTemplate().selectList(getStatement("getNewsSourceList"));
public List<String> getNewsSourceList(Long agentId) {
Map<String,Object>map = new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getNewsSourceList"), map);
}
@Override
public Integer getAppletNewsSourceCount(String source) {
return getSessionTemplate().selectOne(getStatement("getAppletNewsSourceCount"),source);
public Integer getAppletNewsSourceCount(String source, Long agentId) {
Map<String,Object>map = new HashMap<>();
map.put("agentId", agentId);
map.put("source", source);
return getSessionTemplate().selectOne(getStatement("getAppletNewsSourceCount"), map);
}
@Override
public void deleteSource(String source) {
getSessionTemplate().delete(getStatement("deleteSource"),source);
public void deleteSource(String source, Long agentId) {
if (null == agentId){
agentId = 0L;
}
Map<String,Object>map = new HashMap<>();
map.put("agentId", agentId);
map.put("source", source);
getSessionTemplate().delete(getStatement("deleteSource"), map);
}
@Override
public Boolean newsSourceExist(String source) {
return getSessionTemplate().selectOne(getStatement("newsSourceExist"),source);
public Boolean newsSourceExist(String source, Long agentId) {
Map<String,Object>map = new HashMap<>();
map.put("agentId", agentId);
map.put("source", source);
return getSessionTemplate().selectOne(getStatement("newsSourceExist"), map);
}
@Override
......@@ -116,15 +145,22 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
}
@Override
public String getUrlNumberByJumpUrl(String jumpUrl) {
public String getUrlNumberByJumpUrl(String jumpUrl, Long agentId) {
if (null == agentId){
agentId = 0L;
}
Map<String, Object> map = new HashMap<>();
map.put("jumpUrl", jumpUrl);
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("getUrlNumberByJumpUrl"), jumpUrl);
}
@Override
public Boolean urlNumberExist(String urlNumber, Long id) {
public Boolean urlNumberExist(String urlNumber, Long id, Long agentId) {
Map<String, Object> map = new HashMap<>();
map.put("urlNumber", urlNumber);
map.put("id", id);
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("urlNumberExist"), map);
}
......@@ -160,13 +196,18 @@ public class AppletNewsDaoImpl extends BaseDaoImpl<AppletNews> implements Applet
}
@Override
public List<AppletNewsCustomTagDTO> getCustomTagList() {
return getSessionTemplate().selectList(getStatement("getCustomTagList"));
public List<AppletNewsCustomTagDTO> getCustomTagList(Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getCustomTagList"), map);
}
@Override
public Boolean customTagExist(String customTag) {
return getSessionTemplate().selectOne(getStatement("customTagExist"), customTag);
public Boolean customTagExist(String customTag, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("customTag", customTag);
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("customTagExist"), map);
}
@Override
......
package com.pcloud.book.applet.dto;
import com.pcloud.common.dto.BaseDto;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @ClassName com.pcloud.book.applet.dto.AddAppletGroupDTO
* @Author zhuyajie
* @Description 添加学舍群
* @Date 2020/7/21 16:23
* @Version 1.0
**/
@Data
@ApiModel("添加学舍群")
public class AddAppletGroupDTO extends BaseDto {
@ApiModelProperty("共读模板id")
private List<Long> groupActivityIds;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -21,5 +21,7 @@ public class AppletNewsCustomTagDTO extends BaseDto {
@ApiModelProperty("资讯ids")
private List<Long> newsIds;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -23,4 +23,7 @@ public class AppletBanner extends BaseEntity {
@ApiModelProperty("是否展示")
private Boolean showState;
@ApiModelProperty("出版社id")
private Long agentId;
}
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* 出版社小程序分类菜单权限(AppletBookClassifyAgent)实体类
*
* @author makejava
* @since 2020-07-17 16:49:50
*/
@Data
public class AppletBookClassifyAgent extends BaseEntity {
private static final long serialVersionUID = -75605877443800137L;
/**
* 小程序书刊分类id
*/
private Long appletBookClassifyId;
/**
* 出版社id
*/
private Long agentId;
/**
* 客户端是否展示
*/
private Boolean showState;
/**
* 分类名称
*/
private String classifyName;
/** 排序值
*/
private Integer seq;
/**
* 图标
*/
private String pic;
}
\ No newline at end of file
......@@ -20,4 +20,7 @@ public class AppletBooklistClassify extends BaseEntity {
@ApiModelProperty("图标")
private String pic;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -34,5 +34,7 @@ public class AppletGroupManage extends BaseEntity {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@ApiModelProperty("出版社id")
private Long agentId;
}
\ No newline at end of file
......@@ -101,6 +101,8 @@ public class AppletNews extends BaseTempletClassify {
@ApiModelProperty("城市")
private String city;
@ApiModelProperty("出版社id")
private Long agentId;
@ApiModelProperty("选取的服务")
List<AppletNewsServe> appletNewsServeList;
......
......@@ -20,4 +20,7 @@ public class AppletNewsClassify extends BaseEntity {
@ApiModelProperty("图标")
private String pic;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -13,4 +13,6 @@ public class AppletNewsCustomTag extends BaseEntity {
@ApiModelProperty("自定义标识")
private String customTag;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -6,12 +6,15 @@ import com.pcloud.book.applet.dto.AppletBookClassifyDTO;
import com.pcloud.book.applet.dto.AppletBookClassifyRelationDTO;
import com.pcloud.book.applet.dto.AppletUserLabelDTO;
import com.pcloud.book.applet.entity.AppletBookClassify;
import com.pcloud.book.applet.entity.AppletBookClassifyAgent;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -65,7 +69,9 @@ public class AppletBookClassifyFacade {
public ResponseDto<?> addUserLabel(
@RequestHeader("token") String token,
@RequestBody @ApiParam("客户端的标签") @Validated AppletUserLabelDTO appletUserLabelDTO) {
SessionUtil.getToken4Redis(token);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
appletUserLabelDTO.setAgentId(agentId);
appletBookClassifyBiz.addUserLabel(appletUserLabelDTO);
return new ResponseDto<>();
}
......@@ -108,16 +114,29 @@ public class AppletBookClassifyFacade {
@GetMapping("listUserLabel")
public ResponseDto<List<AppletUserLabelDTO>> listUserLabel(
@RequestHeader("token") String token, @RequestParam("appletBookClassifyId") Long appletBookClassifyId) {
SessionUtil.getToken4Redis(token);
List<AppletUserLabelDTO> appletUserLabelDTOS = appletBookClassifyBiz.listUserLabel(appletBookClassifyId);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
List<AppletUserLabelDTO> appletUserLabelDTOS = appletBookClassifyBiz.listUserLabel(appletBookClassifyId, agentId);
return new ResponseDto<>(appletUserLabelDTOS);
}
@ApiOperation("获取书刊分类列表及其标签")
@GetMapping("getAllBookClassifyAndLabel4Wechat")
public ResponseDto<List<AppletBookClassifyDTO>> getAllBookClassifyAndLabel4Wechat(@RequestParam(value = "grayStatus",required = false) String grayStatus){
return new ResponseDto<>(appletBookClassifyBiz.getAllBookClassifyAndLabel(grayStatus));
public ResponseDto<List<AppletBookClassifyDTO>> getAllBookClassifyAndLabel4Wechat(
@CookieValue("userInfo") String userInfo,
@RequestParam(value = "grayStatus",required = false) String grayStatus){
Long officialAccountsId = Cookie.getId(userInfo,Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(appletBookClassifyBiz.getAllBookClassifyAndLabel4Wechat(grayStatus, officialAccountsId));
}
@ApiOperation("客户端标签列表")
@GetMapping("listUserLabel4Wechat")
public ResponseDto<List<AppletUserLabelDTO>> listUserLabel4Wechat(
@CookieValue("userInfo") String userInfo, @RequestParam("appletBookClassifyId") Long appletBookClassifyId) {
Long officialAccountsId = Cookie.getId(userInfo,Cookie._OFFICIAL_ACCOUNTS_ID);
List<AppletUserLabelDTO> appletUserLabelDTOS = appletBookClassifyBiz.listUserLabel4Wechat(appletBookClassifyId, officialAccountsId);
return new ResponseDto<>(appletUserLabelDTOS);
}
@ApiOperation("平台端获取二级分类")
......@@ -127,4 +146,33 @@ public class AppletBookClassifyFacade {
List<AssistTempletDTO> list = appletBookClassifyBiz.getChildTempletList(appletBookClassifyId);
return new ResponseDto<>(list);
}
@ApiOperation("小睿出版社修改客户端分类展示状态、名称")
@PostMapping("updateBaseInfoByAgent")
public ResponseDto<?> updateBaseInfoByAgent(@RequestHeader("token") String token, @RequestBody @ApiParam AppletBookClassifyAgent appletBookClassifyAgent){
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
appletBookClassifyAgent.setAgentId(agentId);
appletBookClassifyBiz.updateBaseInfoByAgent(appletBookClassifyAgent);
return new ResponseDto<>();
}
@ApiOperation("小睿出版管理端书刊分类查询")
@GetMapping("getAppletBookClassifyListByAgent")
public ResponseDto<List<AppletBookClassifyDTO>> getAppletBookClassifyListByAgent(
@RequestHeader("token") String token,
@RequestParam(value = "showState", required = false) Boolean showState) {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletBookClassifyBiz.getAppletBookClassifyListByAgent(agentId, showState));
}
@ApiOperation("客户端书刊分类查询")
@GetMapping("getAppletBookClassifyList4Wechat")
public ResponseDto<List<AppletBookClassifyDTO>> getAppletBookClassifyList4Wechat(
@CookieValue("userInfo") String userInfo,
@RequestParam(value = "showState", required = false) Boolean showState) {
Long officialAccountsId = Cookie.getId(userInfo,Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(appletBookClassifyBiz.getAppletBookClassifyList4Wechat(officialAccountsId, showState));
}
}
package com.pcloud.book.applet.facade;
import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
import com.pcloud.book.applet.dto.AddAppletGroupDTO;
import com.pcloud.book.applet.dto.UpdateAppletGroupManageDTO;
import com.pcloud.book.applet.biz.AppletGroupManageBiz;
import com.pcloud.book.applet.entity.AppletGroupSearchRecord;
......@@ -8,6 +9,7 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
......@@ -17,6 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
/**
* 学舍群管理(AppletGroupManage)表控制层
......@@ -39,10 +42,11 @@ public class AppletGroupManageFacade {
public ResponseDto<?> getList(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "currentPage", defaultValue = "0") Integer currentPage,
@RequestParam(value = "numPerPage", defaultValue = "10") Integer numPerPage)
@RequestParam(value = "numPerPage", defaultValue = "10") Integer numPerPage)
throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletGroupManageBiz.getList(name, currentPage, numPerPage));
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletGroupManageBiz.getList(name, currentPage, numPerPage, agentId));
}
@ApiOperation("社群任意门Applet")
......@@ -53,10 +57,11 @@ public class AppletGroupManageFacade {
@RequestParam(value = "numPerPage", defaultValue = "5") Integer numPerPage)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw BookBizException.PARAM_DELETION;
}
return new ResponseDto<>(appletGroupManageBiz.getList4Applet(wechatUserId, recommend, currentPage, numPerPage));
return new ResponseDto<>(appletGroupManageBiz.getList4Applet(wechatUserId, recommend, currentPage, numPerPage,officialAccountsId));
}
@ApiOperation("新增社群")
......@@ -64,7 +69,22 @@ public class AppletGroupManageFacade {
public ResponseDto<?> insert(@RequestHeader("token") String token, @RequestBody List<Long> groupActivityIds)
throws BizException, PermissionException {
SessionUtil.getToken4Redis(token);
appletGroupManageBiz.insert(groupActivityIds);
appletGroupManageBiz.insert(groupActivityIds,0L);
return new ResponseDto<>();
}
@ApiOperation("小睿小程序管理端新增社群")
@PostMapping("insertByAgent")
public ResponseDto<?> insertByAgent(@RequestHeader("token") String token, @RequestBody AddAppletGroupDTO addAppletGroupDTO)
throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
addAppletGroupDTO.setAgentId(agentId);
if (null == addAppletGroupDTO || ListUtils.isEmpty(addAppletGroupDTO.getGroupActivityIds())
|| null ==addAppletGroupDTO.getAgentId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数缺失");
}
appletGroupManageBiz.insert(addAppletGroupDTO.getGroupActivityIds(), addAppletGroupDTO.getAgentId());
return new ResponseDto<>();
}
......@@ -110,7 +130,7 @@ public class AppletGroupManageFacade {
if(!NumberUtil.isNumber(wechatUserId)){
throw BookBizException.PARAM_DELETION;
}
return new ResponseDto<>(appletGroupSearchRecordBiz.getList(wechatUserId, isMore, currentPage, numPerPage));
return new ResponseDto<>(appletGroupSearchRecordBiz.getList(wechatUserId, isMore, currentPage, numPerPage, null));
}
@ApiOperation("删除共读社群记录")
......@@ -131,10 +151,11 @@ public class AppletGroupManageFacade {
)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw BookBizException.PARAM_DELETION;
}
return new ResponseDto<>(appletGroupSearchRecordBiz.getTishBookSchoolList(wechatUserId, bookGroupId));
return new ResponseDto<>(appletGroupSearchRecordBiz.getTishBookSchoolList(wechatUserId, bookGroupId, officialAccountsId));
}
@ApiOperation("用户社群书记录id列表")
......@@ -155,9 +176,10 @@ public class AppletGroupManageFacade {
@RequestParam("currentPage") Integer currentPage)
throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if(!NumberUtil.isNumber(wechatUserId)){
throw BookBizException.PARAM_DELETION;
}
return new ResponseDto<>(appletGroupSearchRecordBiz.getGroupList4AppletHome(wechatUserId,currentPage,numPerPage));
return new ResponseDto<>(appletGroupSearchRecordBiz.getGroupList4AppletHome(wechatUserId,currentPage,numPerPage,officialAccountsId));
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.pcloud.book.applet.dto.AppletUserLabelDTO;
import com.pcloud.book.applet.entity.AppletUserLabel;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -22,7 +23,7 @@ public interface AppletUserLabelMapper {
int updateByPrimaryKey(AppletUserLabel record);
List<AppletLabelDTO> getBookClassifyAndLabel();
List<AppletLabelDTO> getBookClassifyAndLabel(@Param("agentId") Long agentId);
List<AppletUserLabelDTO> listUserLabel(Long appletBookClassifyId);
List<AppletUserLabelDTO> listUserLabel(@Param("appletBookClassifyId") Long appletBookClassifyId, @Param("agentId") Long agentId);
}
\ No newline at end of file
package com.pcloud.book.applet.service.impl;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.biz.AppletBookClassifyBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.dto.AppletOuterBookDTO;
......@@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiParam;
/**
* @ClassName com.pcloud.book.applet.service.impl.AppletServiceImpl
* @Author zhuyajie
......@@ -37,6 +40,8 @@ public class AppletServiceImpl implements AppletService {
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
@Autowired
private AppletBooklistBiz appletBooklistBiz;
@Autowired
private AppletBookClassifyBiz appletBookClassifyBiz;
@Override
......@@ -59,4 +64,10 @@ public class AppletServiceImpl implements AppletService {
public ResponseEntity<ResponseDto<AppletOuterBookDTO>> getOuterBookById(@RequestParam("outerBookId") Long outerBookId){
return ResponseHandleUtil.toResponse(appletBooklistBiz.getOuterBookById(outerBookId));
}
@Override
@GetMapping("createBaseClassifysToAgent")
public void createBaseClassifysToAgent(@RequestParam("agentId") @ApiParam Long agentId){
appletBookClassifyBiz.createBaseClassifysToAgent(agentId);
}
}
......@@ -2339,6 +2339,7 @@ public class BookBizImpl implements BookBiz {
Long raysClassifyId = bookRaysClassifyDao.getClassifyIdByBookTemplateId(bookAdviserDto.getTempletId());
String page=null;//小程序跳转页 todo
List<BookAppletScene> list=new ArrayList<>();
Long accoutnSettingId = bookGroupBiz.getAccountSettingByAdviser(adviserId);
for (Long sceneId:sceneIds){
//通过sceneId查询是否已经存在,如果已经存在就不创建
BookAppletScene appletScene = bookAppletSceneDao.getBySceneId(sceneId);
......@@ -2351,12 +2352,13 @@ public class BookBizImpl implements BookBiz {
appletId = createOneAppletId();
applet = bookAppletSceneDao.getByAppletId(appletId);
}
String url = wechatConsr.create4MiniApp(777L, appletId, null, page);
String url = wechatConsr.create4MiniApp(accoutnSettingId, appletId, null, page);
BookAppletScene bookAppletScene = new BookAppletScene();
bookAppletScene.setRaysClassifyId(raysClassifyId);
bookAppletScene.setAppletId(appletId);
bookAppletScene.setAppletUrl(url);
bookAppletScene.setSceneId(sceneId);
bookAppletScene.setAccountSettingId(accoutnSettingId);
list.add(bookAppletScene);
}
bookAppletSceneDao.insert(list);
......
......@@ -883,7 +883,11 @@ public class BookFacadeImpl implements BookFacade {
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long rayAgentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (null != rayAgentId && rayAgentId > 0) {
agentId = rayAgentId;
}
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
......
......@@ -7,7 +7,10 @@ import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.channelcenter.qrcode.dto.MapResourceCountDTO;
import com.pcloud.channelcenter.qrcode.dto.QrcodeMessageDTO;
import com.pcloud.channelcenter.qrcode.service.QrcodeSceneService;
import com.pcloud.channelcenter.wechat.entity.AccountSetting;
import com.pcloud.channelcenter.wechat.service.AccountSettingService;
import com.pcloud.channelcenter.wechat.service.MessageService;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
......@@ -39,6 +42,8 @@ public class ChannelConsr {
private MessageService messageService;
@Autowired
private QrcodeSceneService qrcodeSceneService;
@Autowired
private AccountSettingService accountSettingService;
/**
* 获取渠道名称
......@@ -170,4 +175,28 @@ public class ChannelConsr {
Map<String, QrcodeMessageDTO> mapQrcodeMessage = ResponseHandleUtil.parseMap(qrcodeSceneService.mapResourceCount(mapResourceCountDTO), String.class, QrcodeMessageDTO.class);
return mapQrcodeMessage;
}
@ParamLog("获取公众号基本信息")
public AccountSetting getAppInfo(Long officialAccountsId){
AccountSetting accountSetting = new AccountSetting();
try {
accountSetting = ResponseHandleUtil.parseResponse(accountSettingService.getAppInfo(officialAccountsId), AccountSetting.class);
}catch (Exception e){
LOGGER.error("调用accountSettingService.getAppInfo失败" + e.getMessage(), e);
}
return accountSetting;
}
@ParamLog("获取出版社对应的小程序公众号id")
public Long getAccountSettingIdByAgentId(Long agentId) {
Long accountSettingId = null;
try {
accountSettingId = ResponseHandleUtil.parseResponse(accountSettingService.getAccountSettingIdByAgentId(agentId), Long.class);
}catch (Exception e){
LOGGER.error("调用getAccountSettingIdByAgentId失败"+e.getMessage(),e);
}
return accountSettingId;
}
}
......@@ -18,7 +18,7 @@ public interface GiftCouponPackageBiz {
void createGiftReceive(GiftReceive giftReceive);
PageBeanNew<GiftPackageDTO> list4GiftPackage(String title, Integer state,Integer couponType, Integer currentPage, Integer numPerPage);
PageBeanNew<GiftPackageDTO> list4GiftPackage(String title, Integer state,Integer couponType, Integer currentPage, Integer numPerPage, Long agentId);
PageBeanNew<MyGiftPackageDTO> list4MyGiftPackage(Integer state,Long wechatUserId,Integer currentPage, Integer numPerPage);
......@@ -32,7 +32,7 @@ public interface GiftCouponPackageBiz {
* @date:2020/5/11 17:48
* * @param null
*/
String getUrlNumberByUrl(String url);
String getUrlNumberByUrl(String url, Long agentId);
/**
* 兑换券使用分析
......@@ -40,5 +40,5 @@ public interface GiftCouponPackageBiz {
* @date:2020/5/11 19:29
* * @param null
*/
PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty);
PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty, Long agentId);
}
......@@ -52,6 +52,9 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
@Override
public void createGiftPackage(GiftCouponPackage giftCouponPackage) {
giftParamCheck.checkGiftAddParam(giftCouponPackage);
if (null == giftCouponPackage.getAgentId()){
giftCouponPackage.setAgentId(0L);
}
if (urlNumberExist(giftCouponPackage)){
throw new BookBizException(BookBizException.ERROR,"链接编号重复");
}
......@@ -66,6 +69,11 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
@Override
public void updateGiftPackage(GiftCouponPackage giftCouponPackage) {
giftParamCheck.checkGiftAddParam(giftCouponPackage);
if (null == giftCouponPackage.getId()){
throw new BookBizException(BookBizException.ERROR,"id为空");
}
GiftCouponPackage couponPackage = giftCouponPackageDao.getById(giftCouponPackage.getId());
giftCouponPackage.setAgentId(couponPackage.getAgentId());
if (urlNumberExist(giftCouponPackage)){
throw new BookBizException(BookBizException.ERROR,"链接编号重复");
}
......@@ -87,11 +95,12 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
@Override
public PageBeanNew<GiftPackageDTO> list4GiftPackage(String title, Integer state, Integer couponType,Integer currentPage, Integer numPerPage) {
public PageBeanNew<GiftPackageDTO> list4GiftPackage(String title, Integer state, Integer couponType,Integer currentPage, Integer numPerPage, Long agentId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("title", title);
paramMap.put("state", state);
paramMap.put("couponType", couponType);
paramMap.put("agentId", agentId);
PageBeanNew<GiftPackageDTO> pageBeanNew=giftCouponPackageDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "list4GiftPackage");
if (pageBeanNew == null || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
......@@ -204,20 +213,21 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
}
@Override
public String getUrlNumberByUrl(String url) {
public String getUrlNumberByUrl(String url, Long agentId) {
if (StringUtil.isEmpty(url)){
return "";
}
return giftCouponPackageDao.getUrlNumberByAddress(url);
return giftCouponPackageDao.getUrlNumberByAddress(url, agentId);
}
@Override
public PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty) {
public PageBeanNew<GiftPackageDTO> listGiftPackage4Analysis(String title, Integer state, Integer couponType, Integer currentPage, Integer numPerPage, Integer linkOnly,Integer clickQty, Long agentId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("title", title);
paramMap.put("state", state);
paramMap.put("couponType", couponType);
paramMap.put("linkOnly",linkOnly);
paramMap.put("agentId", agentId);
PageBeanNew<GiftPackageDTO> pageBeanNew=giftCouponPackageDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listGiftPackage4Analysis");
if (pageBeanNew == null || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
......@@ -272,7 +282,7 @@ public class GiftCouponPackageBizImpl implements GiftCouponPackageBiz {
return exist;
}
if (!StringUtil.isEmpty(giftCouponPackage.getExchangeAddress()) && !StringUtil.isEmpty(giftCouponPackage.getUrlNumber())) {
exist = giftCouponPackageDao.urlNumberExist(giftCouponPackage.getExchangeAddress(), giftCouponPackage.getUrlNumber(), giftCouponPackage.getId());
exist = giftCouponPackageDao.urlNumberExist(giftCouponPackage.getExchangeAddress(), giftCouponPackage.getUrlNumber(), giftCouponPackage.getId(), giftCouponPackage.getAgentId());
}
return exist;
}
......
......@@ -71,7 +71,7 @@ public class GiftParamCheck {
if (giftCouponPackage.getReceiveLimit()<COUPON_MIN_RECEIVE) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "领取上限最低"+COUPON_MIN_RECEIVE+"张");
}
if (null == giftCouponPackage.getValidDateBegin() || null==giftCouponPackage.getValidDateEnd()) {
if (StringUtil.isEmpty(giftCouponPackage.getValidDateBegin()) || StringUtil.isEmpty(giftCouponPackage.getValidDateEnd())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "有效期为空");
}
if (DateUtils.getDateByStr(giftCouponPackage.getValidDateBegin()).after(DateUtils.getDateByStr((giftCouponPackage.getValidDateEnd())))) {
......
......@@ -26,7 +26,7 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
void reduceStockBatch(List<Long> packageIds);
String getUrlNumberByAddress(String exchangeAddress);
String getUrlNumberByAddress(String exchangeAddress, Long agentId);
/**
* 链接编号是否存在
......@@ -34,5 +34,5 @@ public interface GiftCouponPackageDao extends BaseDao<GiftCouponPackage> {
* @date:2020/5/11 18:43
* * @param null
*/
Boolean urlNumberExist(String exchangeAddress, String urlNumber, Long id);
Boolean urlNumberExist(String exchangeAddress, String urlNumber, Long id, Long agentId);
}
\ No newline at end of file
......@@ -48,16 +48,20 @@ public class GiftCouponPackageDaoImpl extends BaseDaoImpl<GiftCouponPackage> imp
}
@Override
public String getUrlNumberByAddress(String exchangeAddress) {
return getSessionTemplate().selectOne(getStatement("getUrlNumberByAddress"), exchangeAddress);
public String getUrlNumberByAddress(String exchangeAddress, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("agentId", agentId);
map.put("exchangeAddress", exchangeAddress);
return getSessionTemplate().selectOne(getStatement("getUrlNumberByAddress"), map);
}
@Override
public Boolean urlNumberExist(String exchangeAddress, String urlNumber, Long id) {
public Boolean urlNumberExist(String exchangeAddress, String urlNumber, Long id, Long agentId) {
Map<String, Object> map = new HashMap<>();
map.put("exchangeAddress", exchangeAddress);
map.put("urlNumber", urlNumber);
map.put("id", id);
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("urlNumberExist"), map);
}
}
......@@ -63,4 +63,5 @@ public class GiftCouponPackage extends BaseEntity {
*/
private String urlNumber;
private Long agentId;
}
\ No newline at end of file
......@@ -37,6 +37,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
import javax.ws.rs.POST;
......@@ -56,8 +57,12 @@ public class GiftCouponPackageFacade {
@ApiOperation("新增礼券包")
@PostMapping("/createGiftPackage")
public ResponseDto<?> createGiftPackage(
@RequestHeader("token") String token,
@RequestBody GiftCouponPackage giftCouponPackage
) throws BizException, PermissionException {
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
giftCouponPackage.setAgentId(agentId);
giftCouponPackageBiz.createGiftPackage(giftCouponPackage);
return new ResponseDto<>();
}
......@@ -91,13 +96,16 @@ public class GiftCouponPackageFacade {
@ApiOperation("礼券包列表")
@GetMapping("/list4GiftPackage")
public ResponseDto<PageBeanNew<GiftPackageDTO>> list4GiftPackage(
@RequestHeader("token") String token,
@RequestParam(value = "title",required = false) @ApiParam("礼包券名称") String title,
@RequestParam(value = "state",required = false) @ApiParam("状态") Integer state,
@RequestParam(value = "couponType",required = false) @ApiParam("券类型") Integer couponType,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage
) throws BizException, PermissionException {
return new ResponseDto<>(giftCouponPackageBiz.list4GiftPackage(title,state,couponType,currentPage,numPerPage));
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(giftCouponPackageBiz.list4GiftPackage(title,state,couponType,currentPage,numPerPage,agentId));
}
@ApiOperation("新增礼券包领取")
......@@ -148,9 +156,11 @@ public class GiftCouponPackageFacade {
@ApiOperation("根据链接地址获取外链编号")
@GetMapping("getUrlNumberByUrl")
public ResponseDto<String> getUrlNumberByUrl(@RequestHeader("token") String token, @RequestParam(value = "url",required = false) String url){
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(giftCouponPackageBiz.getUrlNumberByUrl(url));
public ResponseDto<String> getUrlNumberByUrl(
@RequestHeader("token") String token, @RequestParam(value = "url",required = false) String url){
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(giftCouponPackageBiz.getUrlNumberByUrl(url,agentId));
}
@ApiOperation("兑换券使用分析")
......@@ -165,8 +175,9 @@ public class GiftCouponPackageFacade {
@RequestParam(value = "clickQty", required = false) @ApiParam("点击量") Integer clickQty,
@RequestParam(value = "linkOnly",required = false) @ApiParam("只看第三方") Integer linkOnly
) throws BizException, PermissionException {
SessionUtil.getInfoToken4Redis(token);
return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Analysis(title, state, couponType, currentPage, numPerPage, linkOnly,clickQty));
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(giftCouponPackageBiz.listGiftPackage4Analysis(title, state, couponType, currentPage, numPerPage, linkOnly,clickQty, agentId));
}
}
......@@ -931,4 +931,20 @@ public interface BookGroupBiz {
* * @param null
*/
BookGroupDTO getMaxScanCountBookGroup(Long agentId, Integer joinGroupType);
/**
* 获取小睿社群书列表(小睿独立管理端)
* @author:zhuyajie
* @date:2020/7/22 11:06
* * @param null
*/
PageBean listBookGroup4AppletAgent(Map<String, Object> paramMap, PageParam pageParam);
/**
* 根据编辑获取对应的小程序
* @author:zhuyajie
* @date:2020/7/28 16:29
* * @param null
*/
public Long getAccountSettingByAdviser(Long adviserId);
}
......@@ -258,4 +258,5 @@ public interface GroupQrcodeBiz {
List<String> migrateMaterial(MaterialMigrateDTO migrateDTO);
void syncGroupMaterial(Map<String, Long> accountMap);
PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage, Long officialAccountsId);
}
......@@ -39,6 +39,7 @@ import com.pcloud.book.consumer.settlement.SettlementConsr;
import com.pcloud.book.consumer.trade.TradeConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.consumer.user.AgentConsr;
import com.pcloud.book.consumer.user.ChannelConsr;
import com.pcloud.book.consumer.wechat.WechatConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
import com.pcloud.book.group.biz.BookGroupAppBiz;
......@@ -432,6 +433,8 @@ public class BookGroupBizImpl implements BookGroupBiz {
private BizMaterialMapper bizMaterialMapper;
@Autowired
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
@Autowired
private ChannelConsr channelConsr;
private static final ThreadPoolExecutor PLATFORM_STATISTICS_EXPORT_THREAD = new ThreadPoolExecutor(2, 2,
0, TimeUnit.SECONDS, new LinkedBlockingQueue<>(),
......@@ -4822,25 +4825,28 @@ public class BookGroupBizImpl implements BookGroupBiz {
appletId = createOneAppletId();
applet = bookAppletSceneDao.getByAppletId(appletId);
}
String url = wechatConsr.create4MiniApp(777L, appletId, null, page);
Long accoutnSettingId = getAccountSettingByAdviser(adviserId);
String url = wechatConsr.create4MiniApp(accoutnSettingId, appletId, null, page);
BookAppletScene bookAppletScene = new BookAppletScene();
bookAppletScene.setBookGroupId(bookGroupId);
bookAppletScene.setRaysClassifyId(raysClassifyId);
bookAppletScene.setAppletId(appletId);
bookAppletScene.setAppletUrl(url);
bookAppletScene.setAccountSettingId(accoutnSettingId);
bookAppletSceneDao.insert(bookAppletScene);
}
@ParamLog("生成一个小程序id")
private String createOneAppletId() {
Random random = new Random();
/*Random random = new Random();
String charStr = "0123456789abcdefghijklmnopqrstuvwxyz";
String s = "";
for (int i = 0; i < 20; i++) {
int index = random.nextInt(charStr.length());
s = s + charStr.charAt(index);
}
return s;
return s;*/
return UUIDUitl.generateString(20);
}
@Override
......@@ -5460,6 +5466,65 @@ public class BookGroupBizImpl implements BookGroupBiz {
return null;
}
@Override
public PageBean listBookGroup4AppletAgent(Map<String, Object> paramMap, PageParam pageParam) {
PageBean pageBean = bookDao.listPage(pageParam, paramMap, "listBookGroup4AppletAgent");
if (pageBean == null || ListUtils.isEmpty(pageBean.getRecordList())) {
return new PageBean(0, 0, new ArrayList<>());
}
//填充社群书数据
List<Long> relatedGroupIds = new ArrayList<>();
List<Long> adviserIds = new ArrayList<>();
pageBean.getRecordList().forEach(obj -> {
BookDto bookDto = (BookDto) obj;
if (null != bookDto.getRelatedBookGroupId() && !relatedGroupIds.contains(bookDto.getRelatedBookGroupId())) {
relatedGroupIds.add(bookDto.getRelatedBookGroupId());
}
if (null != bookDto.getAdviserId() && !adviserIds.contains(bookDto.getAdviserId())){
adviserIds.add(bookDto.getAdviserId());
}
});
Map<Long, BookGroupDTO> relatedBookGroupMap = new HashMap<>();
Map<Long, AdviserBaseInfoDto> adviserMap = new HashMap();
if (!ListUtils.isEmpty(relatedGroupIds)){
relatedBookGroupMap = bookGroupDao.mapDTOByIds(relatedGroupIds);
}
if (!ListUtils.isEmpty(adviserIds)){
adviserMap = adviserConsr.getAdviserId2AdviserInfoDtoMap(adviserIds);
}
for (Object object : pageBean.getRecordList()) {
BookDto bookDto = (BookDto) object;
Long bookGroupId = bookDto.getBookGroupId();
bookDto.setGroupQrcodeLink(bookGroupQrcodeDomain + "/" + bookGroupId);
bookDto.setBookName(null != bookDto.getBookName() ? StringUtil.addBracket(bookDto.getBookName()) : null);
if (!MapUtils.isEmpty(relatedBookGroupMap) && relatedBookGroupMap.containsKey(bookDto.getRelatedBookGroupId())) {
BookGroupDTO relatedBookGroup = relatedBookGroupMap.get(bookDto.getRelatedBookGroupId());
relatedBookGroup.setGroupQrcodeLink(bookGroupQrcodeDomain + "/" + bookDto.getRelatedBookGroupId());
bookDto.setRelatedBookGroup(relatedBookGroup);
}
if (!MapUtils.isEmpty(adviserMap) && adviserMap.containsKey(bookDto.getAdviserId())){
AdviserBaseInfoDto adviserBaseInfoDto = adviserMap.get(bookDto.getAdviserId());
bookDto.setAdviserName(adviserBaseInfoDto.getPartyName());
bookDto.setPhone(adviserBaseInfoDto.getPhoneNum());
}
}
return pageBean;
}
@Override
public Long getAccountSettingByAdviser(Long adviserId) {
Long accountSettingId = BookProps.getMiniOfficialAccountsId();
if (null == adviserId || adviserId == 0L) {
return accountSettingId;
}
Long agentId = adviserConsr.getAgentIdByAdviser(adviserId);
Long accountSetting = channelConsr.getAccountSettingIdByAgentId(agentId);
if (null != accountSetting) {
return accountSetting;
}
return accountSettingId;
}
@Override
public BookGroupDTO getMaxScanCountBookGroup(Long agentId, Integer joinGroupType) {
......
......@@ -1028,12 +1028,12 @@ public class GroupQrcodeBizImpl implements GroupQrcodeBiz {
@Override
@ParamLog(value = "获取微信用户的位置相关社群", isAfterReturn = false)
public PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage) {
public PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage, Long officialAccountsId) {
if (currentPage == null || currentPage < 0 || numPerPage == null || numPerPage <= 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "分页参数错误!");
}
PageBeanNew<AppletGroupManageDTO> appletGroupManageDTOPageBeanNew = pcloudGroupActivityBiz.getLocalGroup(wechatUserId, numPerPage
, currentPage);
, currentPage, officialAccountsId);
return appletGroupManageDTOPageBeanNew;
}
......
......@@ -49,5 +49,8 @@ public class BookAppletSceneDTO extends BaseDto {
*权益数量
*/
private Integer rightsSettingCount;
/**
* 小程序公众号id
*/
private Long accountSettingId;
}
......@@ -50,4 +50,8 @@ public class BookAppletScene extends BaseEntity {
* 现代纸书自建码的id
*/
private Long sceneId;
/**
* 小程序公众号id
*/
private Long accountSettingId;
}
......@@ -767,4 +767,22 @@ public interface BookGroupFacade {
ResponseDto<?>updateBookServeTypeCode();
@ApiOperation(value = "获取小睿社群书列表(小睿独立管理端)", httpMethod = "GET")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "string", paramType = "header"),
@ApiImplicitParam(name = "name", value = "书刊/isbn", dataType = "string", paramType = "query"),
@ApiImplicitParam(name = "adviserId", value = "编辑id", dataType = "long", paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "listBookGroup4AppletAgent", method = RequestMethod.GET)
ResponseDto<PageBean> listBookGroup4AppletAgent(
@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
}
......@@ -9,7 +9,25 @@ import com.pcloud.book.group.dto.GroupQrcode4ClassifyDTO;
import com.pcloud.book.group.dto.ListBookGroup4HealsDTO;
import com.pcloud.book.group.dto.ListClassify4WechatDTO;
import com.pcloud.book.group.facade.BookGroupClassifyFacade;
import com.pcloud.book.group.vo.*;
import com.pcloud.book.group.vo.AddClassifyVO;
import com.pcloud.book.group.vo.AdviserClassifyParam;
import com.pcloud.book.group.vo.AdviserClassifyVO;
import com.pcloud.book.group.vo.BookGroupClassifyVO;
import com.pcloud.book.group.vo.BookGroupQrcodeStatisticVO;
import com.pcloud.book.group.vo.ClassifyAndGroupCountVO;
import com.pcloud.book.group.vo.ClassifyAndUserCountVO;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.ListBookGroupQrcodeExportParamVO;
import com.pcloud.book.group.vo.ListBookGroupQrcodeParamVO;
import com.pcloud.book.group.vo.ListClassify4WechatVO;
import com.pcloud.book.group.vo.ListClassifyVO;
import com.pcloud.book.group.vo.ListGroupClassifyParam;
import com.pcloud.book.group.vo.PcloudBookGroupClassifyVO;
import com.pcloud.book.group.vo.StatisticVO;
import com.pcloud.book.group.vo.UpdateClassifyVO;
import com.pcloud.book.group.vo.UpdateRankVO;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
......@@ -20,8 +38,6 @@ import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -37,6 +53,9 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
* @author lily
* @date 2019/4/16 21:02
......@@ -321,7 +340,11 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "cityCode",required = false) String cityCode
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long rayAgentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (null != rayAgentId && rayAgentId > 0) {
agentId = rayAgentId;
}
return new ResponseDto<>(bookGroupClassifyBiz.listGroupClassify4Pcloud(name, proLabelId, depLabelId, purLabelId,
firstClassifyId, gradeLabelId, subjectLabelId, agentId,adviserId,currentPage, numPerPage,cityCode));
}
......@@ -378,10 +401,11 @@ public class BookGroupClassifyFacadeImpl implements BookGroupClassifyFacade {
@RequestParam("currentPage") Integer currentPage) throws BizException,
PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if (!NumberUtil.isNumber(wechatUserId)) {
throw new PermissionException("wechatUseId为空");
}
return new ResponseDto<PageBeanNew<AppletGroupManageDTO>>(groupQrcodeBiz.getLocalGroup(wechatUserId, numPerPage, currentPage));
return new ResponseDto<PageBeanNew<AppletGroupManageDTO>>(groupQrcodeBiz.getLocalGroup(wechatUserId, numPerPage, currentPage, officialAccountsId));
}
}
......@@ -1266,4 +1266,27 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(map);
}
@Override
@RequestMapping(value = "listBookGroup4AppletAgent", method = RequestMethod.GET)
public ResponseDto<PageBean> listBookGroup4AppletAgent(
@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "adviserId", required = false) Long adviserId,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException{
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("adviserId", adviserId);
paramMap.put("name", name != null && "".equals(name.trim()) ? null : name);
paramMap.put("joinGroupType", JoinGroupTypeEnum.XIAORUI.getCode());
paramMap.put("agentId", agentId);
PageBean pageBean = bookGroupBiz.listBookGroup4AppletAgent(paramMap, new PageParam(currentPage, numPerPage));
return new ResponseDto<>(pageBean);
}
}
......@@ -70,7 +70,7 @@ public interface RightsSettingBiz {
* @param numPerPage
* @return
*/
RightsSettingDto getItemByRightsSettingId4AppletHome(Long rightsSettingId, Long wechatUserId, String rightsType, Integer readType, Long bookId, Long adviserId, Long channelId, Integer currentPage, Integer numPerPage);
RightsSettingDto getItemByRightsSettingId4AppletHome(Long rightsSettingId, Long wechatUserId, String rightsType, Integer readType, Long bookId, Long adviserId, Long channelId, Integer currentPage, Integer numPerPage,Long officialAccountsId);
/**
* 每周/长期权益查询--小程序
......@@ -82,7 +82,7 @@ public interface RightsSettingBiz {
* @param numPerPage
* @return
*/
List<RightsSettingItem> getItemsByRightsSettingId4Applet(Long rightsSettingId, String rightsType, Long wechatUserId, Integer readType, Long bookId, Long adviserId, Long channelId, String cityCode, Integer currentPage, Integer numPerPage);
List<RightsSettingItem> getItemsByRightsSettingId4Applet(Long rightsSettingId, String rightsType, Long wechatUserId, Integer readType, Long bookId, Long adviserId, Long channelId, String cityCode, Integer currentPage, Integer numPerPage,Long agentId);
/**
* 查所有权益分类
......@@ -108,12 +108,12 @@ public interface RightsSettingBiz {
* @Param [rightsSettingId, wechatUserId, type]
* @return com.pcloud.book.rightsSetting.entity.RightsSetting
**/
RightsSetting getRightsSettingRightsNowItemsByType(Long rightsSettingId, Long wechatUserId, Integer type, Long adviserId, Long bookId, Long channelId, Integer readType, Integer currentPage, Integer numPerPage);
RightsSetting getRightsSettingRightsNowItemsByType(Long rightsSettingId, Long wechatUserId, Integer type, Long adviserId, Long bookId, Long channelId, Integer readType, Integer currentPage, Integer numPerPage,Long officialAccountsId);
RightsSetting getRightsSettingGiftCoupons(Long rightsSettingId, Long wechatUserId, Integer readType);
FillRightsSettingAppletsDTO getFillRightsSettingApplets(Long rightsSettingId, Long wechatUserId, Long rightsClassifyId,
Integer top, Long bookId);
Integer top, Long bookId, Long officialAccountsId);
List<RightsItemGroup> getRightsItemGroups(Long rightsSettingId, Long adviserId, Long bookId, Long channelId, Boolean removeCanNotBuy, Integer readType);
......@@ -123,7 +123,7 @@ public interface RightsSettingBiz {
void addRightsNowPic(RightsNowPic rightsNowPic);
PageBeanNew<RightsNowPic> getRightsNowPics(Integer currentPage, Integer numPerPage, Integer type);
PageBeanNew<RightsNowPic> getRightsNowPics(Integer currentPage, Integer numPerPage, Integer type, Long agentId);
void deleteRightsNowPic(Long rightsNowPicId);
......
......@@ -23,4 +23,6 @@ public class BaseTempletClassify extends BaseEntity {
private Long volLabelId;
@ApiModelProperty("版本标签")
private Long verLabelId;
@ApiModelProperty("agentId")
private Long agentId;
}
......@@ -24,4 +24,7 @@ public class RightsNowPic extends BaseEntity {
@ApiModelProperty("图片库类型(1立享权益2资讯3书单4书刊分类)")
private Integer type;
@ApiModelProperty("出版社id")
private Long agentId;
}
\ No newline at end of file
......@@ -149,7 +149,8 @@ public class RightsSetting extends BaseTempletClassify {
@ApiModelProperty("上下架状态")
private Boolean showState;
public RightsSetting() {
}
......
......@@ -31,6 +31,9 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;
import javax.validation.constraints.Min;
import java.util.List;
......@@ -136,10 +139,11 @@ public class RightsSettingFacede {
@RequestParam(value = "currentPage",required = false) Integer currentPage,
@RequestParam(value = "numPerPage",required = false) Integer numPerPage) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if (null == rightsSettingId || StringUtil.isEmpty(rightsType)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getItemByRightsSettingId4AppletHome(rightsSettingId, wechatUserId, rightsType, readType, bookId, adviserId, channelId, currentPage, numPerPage));
return new ResponseDto<>(rightsSettingBiz.getItemByRightsSettingId4AppletHome(rightsSettingId, wechatUserId, rightsType, readType, bookId, adviserId, channelId, currentPage, numPerPage,officialAccountsId));
}
@ApiOperation("所有权益分类")
......@@ -178,7 +182,8 @@ public class RightsSettingFacede {
@RequestParam(value = "currentPage", required = false) Integer currentPage
) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
return new ResponseDto<>(rightsSettingBiz.getRightsSettingRightsNowItemsByType(rightsSettingId, wechatUserId, rightsSettingType, adviserId, bookId, channelId, readType, currentPage, numPerPage));
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
return new ResponseDto<>(rightsSettingBiz.getRightsSettingRightsNowItemsByType(rightsSettingId, wechatUserId, rightsSettingType, adviserId, bookId, channelId, readType, currentPage, numPerPage,officialAccountsId));
}
@ApiOperation("根据权益id获取即享权益项专享礼包")
......@@ -202,10 +207,11 @@ public class RightsSettingFacede {
@RequestParam("rightsSettingId") Long rightsSettingId
) throws PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
Long officialAccountsId = Cookie.getId(userInfo, Cookie._OFFICIAL_ACCOUNTS_ID);
if (null == rightsSettingId) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数缺失!");
}
return new ResponseDto<>(rightsSettingBiz.getFillRightsSettingApplets(rightsSettingId, wechatUserId, null, null, null));
return new ResponseDto<>(rightsSettingBiz.getFillRightsSettingApplets(rightsSettingId, wechatUserId, null, null, null, officialAccountsId));
}
@ApiOperation("根据权益id获取即享权益配套资料分组集合")
......@@ -253,7 +259,9 @@ public class RightsSettingFacede {
@RequestHeader("token") String token,
@RequestBody RightsNowPic rightsNowPic
) throws PermissionException {
SessionUtil.getToken4Redis(token);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
rightsNowPic.setAgentId(agentId);
rightsSettingBiz.addRightsNowPic(rightsNowPic);
return new ResponseDto<>();
}
......@@ -266,8 +274,9 @@ public class RightsSettingFacede {
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "type", required = false) @ApiParam("图片类型(1立享权益2资讯3书单4书刊分类)") Integer type
) throws PermissionException {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(rightsSettingBiz.getRightsNowPics(currentPage,numPerPage,type));
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(rightsSettingBiz.getRightsNowPics(currentPage,numPerPage,type, agentId));
}
@ApiOperation("删除即享权益图片")
......
......@@ -66,7 +66,7 @@ public interface PcloudGroupActivityBiz {
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Long firstClassify,
Long secondClassify,
Long gradeLabelId,
Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode);
Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode, Long agentId);
/**
* 获取共读活动列表(弹窗)
......@@ -76,7 +76,7 @@ public interface PcloudGroupActivityBiz {
* @param currentPage
* @return
*/
PageBeanNew<ListGroupActivityResponseVO> listGroupActivity(String name, Integer joinType, Integer numPerPage, Integer currentPage);
PageBeanNew<ListGroupActivityResponseVO> listGroupActivity(String name, Integer joinType, Integer numPerPage, Integer currentPage, Long agentId);
/**
* 根据分类获取社群共读
* @return
......@@ -95,7 +95,7 @@ public interface PcloudGroupActivityBiz {
* @date:2020/6/8 10:49
* * @param null
*/
PageBeanNew<AppletGroupManageDTO> getGroupListByBookTemplet(Long wechatUserId, Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer currentPage, Integer numPerPage);
PageBeanNew<AppletGroupManageDTO> getGroupListByBookTemplet(Long wechatUserId, Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer currentPage, Integer numPerPage, Long agentId);
List<GroupActivity4AppletDTO> getTishBookSchoolListWrap(BaseTempletClassify baseTempletClassify, Integer limit);
......@@ -105,7 +105,9 @@ public interface PcloudGroupActivityBiz {
Map<Long, GroupActivity4AppletDTO> getByIds4Now(List<Long> groupIds);
PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage);
PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage, Long officialAccountsId);
void updateMediaId(PcloudGroupActivity pcloudGroupActivity);
QueryGroupActivityResponseVO getByActivityId(Long id);
}
......@@ -6,6 +6,7 @@ import com.google.common.collect.Maps;
import com.pcloud.appcenter.assist.dto.AssistTempletDTO;
import com.pcloud.book.applet.biz.AppletGroupSearchRecordBiz;
import com.pcloud.book.applet.dao.AppletLinkClickDao;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.dto.AppletGroupManageDTO;
import com.pcloud.book.applet.dto.AppletGroupStatementDTO;
import com.pcloud.book.base.exception.BookBizException;
......@@ -65,9 +66,12 @@ import com.pcloud.usercenter.party.agent.service.AgentService;
import com.sdk.wxgroup.RobotProcessTypeEnum;
import com.sdk.wxgroup.SendGroupInviteVO;
import com.sdk.wxgroup.SendPicMessageVO;
import java.util.Arrays;
import java.util.Iterator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -135,6 +139,8 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private AppletNewsBiz appletNewsBiz;
@Autowired
private AppletLinkClickDao appletLinkClickDao;
@ParamLog("批量分类")
......@@ -172,9 +178,12 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
@ParamLog("保存共读活动")
@Override
public void saveGroupActivity(SaveGroupActivityRequestVO vo) {
if (null == vo.getAgentId()){
vo.setAgentId(0L);
}
//校验编号是否重复
if(!StringUtil.isEmpty(vo.getNumber())){
Integer count = pcloudGroupActivityDao.getCountByNumber(vo.getNumber());
Integer count = pcloudGroupActivityDao.getCountByNumber(vo.getNumber(),vo.getAgentId());
if (count>0){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"参数有误,编号已存在!");
}
......@@ -188,6 +197,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
entity.setUpdateUser(vo.getUserId());
entity.setUpdateTime(now);
entity.setIsDelete(0);
entity.setAgentId(vo.getAgentId());
rightsSettingBiz.setClassifyAndLabel(entity);
pcloudGroupActivityDao.insert(entity);
......@@ -204,7 +214,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
//校验编号是否重复
if(!StringUtil.isEmpty(vo.getNumber())){
Integer count = pcloudGroupActivityDao.getCountByNumber(vo.getNumber());
Integer count = pcloudGroupActivityDao.getCountByNumber(vo.getNumber(),activity.getAgentId());
if (count > 0 && (!vo.getNumber().equals(activity.getNumber()))) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "参数有误,编号已存在!");
}
......@@ -286,7 +296,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
public PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity(String name, Long proLabelId, Long purLabelId, Long depLabelId, Integer joinType, Long firstClassify,
Long secondClassify,
Long gradeLabelId,
Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode) {
Long subjectLabelId, Integer numPerPage, Integer currentPage, String cityCode,Long agentId) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
BaseTempletClassify baseTempletClassify =new BaseTempletClassify();
......@@ -308,6 +318,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
paraMap.put("gradeLabelId", baseTempletClassify.getGradeLabelId());
paraMap.put("subjectLabelId", baseTempletClassify.getSubjectLabelId());
paraMap.put("cityCode", cityCode);
paraMap.put("agentId", agentId);
PageBeanNew<QueryGroupActivityResponseVO> queryGroupActivity = pcloudGroupActivityDao.listPageNew(pageParam, paraMap, "queryGroupActivity");
if (null == queryGroupActivity || CollectionUtils.isEmpty(queryGroupActivity.getRecordList())) {
return queryGroupActivity;
......@@ -414,7 +425,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
}
@Override
public PageBeanNew<ListGroupActivityResponseVO> listGroupActivity(String name, Integer joinType, Integer numPerPage, Integer currentPage) {
public PageBeanNew<ListGroupActivityResponseVO> listGroupActivity(String name, Integer joinType, Integer numPerPage, Integer currentPage,Long agentId) {
PageParam pageParam = new PageParam(currentPage, numPerPage);
// 根据数命查bookid
List<Long> bookIds = new ArrayList<>();
......@@ -425,6 +436,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
paraMap.put("name", StringUtil.isEmpty(name) ? null : name);
paraMap.put("bookIds", bookIds);
paraMap.put("joinType", joinType);
paraMap.put("agentId", agentId);
PageBeanNew<ListGroupActivityResponseVO> listGroupActivity = pcloudGroupActivityDao.listPageNew(pageParam, paraMap, "listGroupActivity");
if (null == listGroupActivity || CollectionUtils.isEmpty(listGroupActivity.getRecordList())) {
return listGroupActivity;
......@@ -545,7 +557,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
}
@Override
public PageBeanNew<AppletGroupManageDTO> getGroupListByBookTemplet(Long wechatUserId, Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer currentPage, Integer numPerPage) {
public PageBeanNew<AppletGroupManageDTO> getGroupListByBookTemplet(Long wechatUserId, Long firstClassify, Long secondClassify, Long gradeLabelId, Long subjectLabelId, Integer currentPage, Integer numPerPage, Long agentId) {
// 处理分类和标签
if (null == firstClassify && null == secondClassify && null == gradeLabelId && null == subjectLabelId) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
......@@ -561,6 +573,7 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
map.put("secondClassify", baseTempletClassify.getSecondClassify());
map.put("gradeLabelId", baseTempletClassify.getGradeLabelId());
map.put("subjectLabelId", baseTempletClassify.getSubjectLabelId());
map.put("agentId", agentId);
PageBeanNew<AppletGroupManageDTO> list = pcloudGroupActivityDao.listPageNew(new PageParam(currentPage,numPerPage),map,"getGroupListByBookTemplet");
if (null == list || ListUtils.isEmpty(list.getRecordList())) {
return new PageBeanNew<>(currentPage,numPerPage,0,new ArrayList<>());
......@@ -656,13 +669,15 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
@Override
public PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage) {
public PageBeanNew<AppletGroupManageDTO> getLocalGroup(Long wechatUserId, Integer numPerPage, Integer currentPage, Long officialAccountsId) {
String cityCode = readerConsr.getCityCodeByWechatUserId(wechatUserId);
if (StringUtil.isEmpty(cityCode)) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
Long agentId = appletNewsBiz.getAgentIdByAccountId(officialAccountsId);
Map<String, Object> map = new HashMap<>();
map.put("cityCode", cityCode);
map.put("agentId", agentId);
PageBeanNew<AppletGroupManageDTO> pageBeanNew = pcloudGroupActivityDao
.listPageNew(new PageParam(currentPage, numPerPage), map, "getLocalGroup");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
......@@ -697,4 +712,23 @@ public class PcloudGroupActivityBizImpl implements PcloudGroupActivityBiz {
public void updateMediaId(PcloudGroupActivity pcloudGroupActivity) {
pcloudGroupActivityDao.updateByPrimaryKeySelective(pcloudGroupActivity);
}
@Override
public QueryGroupActivityResponseVO getByActivityId(Long id) {
QueryGroupActivityResponseVO responseVO = pcloudGroupActivityDao.getByActivityId(id);
// 组装标签名称
List<Long> labelId = Lists.newArrayList();
labelId.add(responseVO.getProLabelId());
labelId.add(responseVO.getPurLabelId());
labelId.add(responseVO.getDepLabelId());
Map<Long, String> labelName = labelConsr.getLabelName(labelId);
if (!MapUtils.isEmpty(labelName)){
responseVO.setPurLabelName(labelName.get(responseVO.getPurLabelId()));
responseVO.setProLabelName(labelName.get(responseVO.getProLabelId()));
responseVO.setDepLabelName(labelName.get(responseVO.getDepLabelId()));
}
//设置分类名称
setLabelContent(Arrays.asList(responseVO));
return responseVO;
}
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO;
import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
......@@ -12,7 +13,7 @@ import java.util.Map;
public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
Integer getCountByNumber(String number);
Integer getCountByNumber(String number, Long agentId);
void batchUpdateShowState(GroupActivityClassifyVO groupActivityClassifyVO);
......@@ -38,4 +39,5 @@ public interface PcloudGroupActivityDao extends BaseDao<PcloudGroupActivity> {
PcloudGroupActivity getById(Long id);
QueryGroupActivityResponseVO getByActivityId(Long id);
}
......@@ -6,6 +6,7 @@ import com.pcloud.book.skill.dto.GroupActivity4AppletDTO;
import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.facade.request.GroupActivityClassifyVO;
import com.pcloud.book.skill.facade.request.GroupActivityShowStateVO;
import com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
......@@ -18,8 +19,11 @@ import java.util.Map;
public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity> implements PcloudGroupActivityDao {
@Override
public Integer getCountByNumber(String number){
return getSessionTemplate().selectOne(getStatement("getCountByNumber"), number);
public Integer getCountByNumber(String number, Long agentId){
Map<String,Object> map = new HashMap<>();
map.put("number", number);
map.put("agentId", agentId);
return getSessionTemplate().selectOne(getStatement("getCountByNumber"), map);
}
@Override
......@@ -74,6 +78,7 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity>
map.put("gradeLabelId", baseTempletClassify.getGradeLabelId());
map.put("subjectLabelId", baseTempletClassify.getSubjectLabelId());
map.put("limit", (limit != null ? limit :10));
map.put("agentId",baseTempletClassify.getAgentId()==null?0L:baseTempletClassify.getAgentId());
return super.getSqlSession().selectList(getStatement("getTishBookSchoolList"), map);
}
......@@ -105,6 +110,10 @@ public class PcloudGroupActivityDaoImpl extends BaseDaoImpl<PcloudGroupActivity>
return super.getSqlSession().selectOne(getStatement("getById"),id);
}
@Override
public QueryGroupActivityResponseVO getByActivityId(Long id) {
return getSessionTemplate().selectOne(getStatement("getByActivityId"), id);
}
}
......@@ -2,6 +2,9 @@ package com.pcloud.book.skill.entity;
import com.pcloud.book.rightsSetting.entity.BaseTempletClassify;
import lombok.Data;
@Data
public class PcloudGroupActivity extends BaseTempletClassify {
private static final long serialVersionUID = -2579070770051745966L;
......@@ -40,139 +43,6 @@ public class PcloudGroupActivity extends BaseTempletClassify {
//微信素材id
private String mediaId;
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public Integer getIsShow() {
return isShow;
}
public void setIsShow(Integer isShow) {
this.isShow = isShow;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getGroupPic() {
return groupPic;
}
public void setGroupPic(String groupPic) {
this.groupPic = groupPic;
}
public Integer getJoinType() {
return joinType;
}
public void setJoinType(Integer joinType) {
this.joinType = joinType;
}
public Long getProLabelId() {
return proLabelId;
}
public void setProLabelId(Long proLabelId) {
this.proLabelId = proLabelId;
}
public Long getDepLabelId() {
return depLabelId;
}
public void setDepLabelId(Long depLabelId) {
this.depLabelId = depLabelId;
}
public Long getPurLabelId() {
return purLabelId;
}
public void setPurLabelId(Long purLabelId) {
this.purLabelId = purLabelId;
}
public Long getBookGroupClassifyId() {
return bookGroupClassifyId;
}
public void setBookGroupClassifyId(Long bookGroupClassifyId) {
this.bookGroupClassifyId = bookGroupClassifyId;
}
public String getGroupName() {
return groupName;
}
public void setGroupName(String groupName) {
this.groupName = groupName;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public String getGroupExtLink() {
return groupExtLink;
}
public void setGroupExtLink(String groupExtLink) {
this.groupExtLink = groupExtLink;
}
public Integer getGroupType() {
return groupType;
}
private Long agentId;
public void setGroupType(Integer groupType) {
this.groupType = groupType;
}
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@RestController
......@@ -71,7 +72,10 @@ public class PcloudGroupActivityFacade {
@PostMapping("saveGroupActivity")
public ResponseDto<Void> saveGroupActivity(@RequestHeader("token") String token, @RequestBody SaveGroupActivityRequestVO vo) throws PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
vo.setAgentId(agentId);
vo.setUserId(partyId);
pcloudGroupActivityBiz.saveGroupActivity(vo);
return new ResponseDto<>();
......@@ -93,7 +97,8 @@ public class PcloudGroupActivityFacade {
}
@GetMapping("queryGroupActivity")
public ResponseDto<PageBeanNew<QueryGroupActivityResponseVO>> queryGroupActivity(@RequestParam(value = "name", required = false) String name,
public ResponseDto<PageBeanNew<QueryGroupActivityResponseVO>> queryGroupActivity(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "proLabelId", required = false) Long proLabelId,
@RequestParam(value = "purLabelId", required = false) Long purLabelId,
@RequestParam(value = "depLabelId", required = false) Long depLabelId,
......@@ -105,16 +110,21 @@ public class PcloudGroupActivityFacade {
@RequestParam(value = "cityCode", required = false) String cityCode,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("currentPage") Integer currentPage){
return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, joinType,firstClassify,secondClassify, gradeLabelId,subjectLabelId,numPerPage, currentPage, cityCode));
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(pcloudGroupActivityBiz.queryGroupActivity(name, proLabelId, purLabelId, depLabelId, joinType,firstClassify,secondClassify, gradeLabelId,subjectLabelId,numPerPage, currentPage,cityCode, agentId));
}
@ApiOperation("获取共读活动列表(弹窗)")
@GetMapping("listGroupActivity")
public ResponseDto<PageBeanNew<ListGroupActivityResponseVO>> listGroupActivity(@RequestParam(value = "name", required = false) String name,
public ResponseDto<PageBeanNew<ListGroupActivityResponseVO>> listGroupActivity(@RequestHeader("token") String token,
@RequestParam(value = "name", required = false) String name,
@RequestParam(value = "joinType", required = false) Integer joinType,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("currentPage") Integer currentPage){
return new ResponseDto<>(pcloudGroupActivityBiz.listGroupActivity(name, joinType, numPerPage, currentPage));
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(pcloudGroupActivityBiz.listGroupActivity(name, joinType, numPerPage, currentPage, agentId));
}
@PostMapping("updateActivityShowState")
......@@ -124,4 +134,11 @@ public class PcloudGroupActivityFacade {
return new ResponseDto<>();
}
@ApiOperation("根据id查询")
@GetMapping("getByActivityId")
public ResponseDto<?> getByActivityId(@RequestHeader("token") String token, @RequestParam("id") Long id){
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(pcloudGroupActivityBiz.getByActivityId(id));
}
}
......@@ -55,6 +55,9 @@ public class SaveGroupActivityRequestVO extends BaseTempletClassify {
@ApiModelProperty("群分类id")
private Long bookGroupClassifyId;
@ApiModelProperty("出版社id")
private Long agentId;
public void checkParam() {
if (StringUtil.isBlank(this.getName())
|| null == this.getProLabelId() || null == this.getDepLabelId()
......
......@@ -38,6 +38,11 @@ public class BookProps {
private static String wechatDomain;
/**
* 小程序公众号id 777
*/
private static Long miniOfficialAccountsId;
public static String getJisuAppKey() {
return jisuAppKey;
}
......@@ -123,4 +128,13 @@ public class BookProps {
public void setHealsAdviserId(Long healsAdviserId) {
BookProps.healsAdviserId = healsAdviserId;
}
public static Long getMiniOfficialAccountsId() {
return miniOfficialAccountsId;
}
@Value("${mini.official.account.id}")
public void setMiniOfficialAccountsId(Long miniOfficialAccountsId) {
BookProps.miniOfficialAccountsId = miniOfficialAccountsId;
}
}
......@@ -10,18 +10,19 @@
<result column="show_state" property="showState" jdbcType="BOOLEAN" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
id, banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time
id, banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time, agent_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletBanner" useGeneratedKeys="true" keyProperty="id">
insert into applet_banner(
banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time
banner_pic, jump_type, jump_url, seq, show_state, create_time, update_time, agent_id
)
values (
#{bannerPic}, #{jumpType}, #{jumpUrl}, #{seq}, #{showState}, NOW(), NOW()
#{bannerPic}, #{jumpType}, #{jumpUrl}, #{seq}, #{showState}, NOW(), NOW(), #{agentId}
)
</insert>
......@@ -72,11 +73,20 @@
<if test="showState != null">
and show_state = #{showState}
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
ORDER BY seq ASC
</select>
<select id="getMaxSeq" resultType="Integer">
<select id="getMaxSeq" resultType="Integer" parameterType="map">
SELECT IFNULL(MAX(seq),0) FROM applet_banner
WHERE agent_id = #{agentId}
</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.applet.dao.impl.AppletBookClassifyAgentDaoImpl">
<resultMap type="com.pcloud.book.applet.entity.AppletBookClassifyAgent" id="AppletBookClassifyAgentMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="appletBookClassifyId" column="applet_book_classify_id" jdbcType="INTEGER"/>
<result property="agentId" column="agent_id" jdbcType="INTEGER"/>
<result property="showState" column="show_state" jdbcType="BOOLEAN"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="classifyName" column="classify_name" jdbcType="VARCHAR"/>
<result property="seq" column="seq" jdbcType="INTEGER"/>
<result property="pic" column="pic" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List" >
id, applet_book_classify_id, agent_id, show_state, create_time, update_time, classify_name,seq,pic
</sql>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_book_classify_agent(applet_book_classify_id, agent_id, show_state, create_time, update_time, classify_name,seq, pic)
values (#{appletBookClassifyId}, #{agentId}, #{showState}, NOW(), NOW(), #{classifyName}, #{seq}, #{pic})
</insert>
<!--批量新增-->
<insert id="batchInsert" useGeneratedKeys="true" parameterType="java.util.List">
insert into book.applet_book_classify_agent(applet_book_classify_id, agent_id, show_state, create_time, update_time, classify_name, seq, pic)
values
<foreach collection="list" item="item" index="index" separator="," >
(
#{item.appletBookClassifyId,jdbcType=INTEGER},
#{item.agentId,jdbcType=INTEGER},
#{item.showState},
NOW(),
NOW(),
#{item.classifyName},
#{item.seq},
#{item.pic}
)
</foreach>
</insert>
<!--通过主键修改数据-->
<update id="updateBaseInfoByAgent" parameterType="com.pcloud.book.applet.entity.AppletBookClassifyAgent">
update book.applet_book_classify_agent
<set>
<if test="classifyName != null and classifyName != ''">
classify_name = #{classifyName},
</if>
<if test="seq != null">
seq = #{seq},
</if>
<if test="pic != null and pic != ''">
pic = #{pic},
</if>
<if test="showState != null">
show_state = #{showState},
</if>
update_time = now(),
</set>
where
applet_book_classify_id = #{appletBookClassifyId}
and agent_id = #{agentId}
</update>
<!--通过主键删除-->
<delete id="deleteById">
delete from book.applet_book_classify_agent where id = #{id}
</delete>
<select id="getByAgent" parameterType="long" resultMap="AppletBookClassifyAgentMap">
SELECT <include refid="Base_Column_List"/>
FROM applet_book_classify_agent
WHERE agent_id = #{agentId}
</select>
<select id="listClassifyByAgent" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletBookClassifyDTO">
select
c.id, c.classify, a.classify_name classifyName, a.seq, a.pic, a.show_state showState
from applet_book_classify c
LEFT JOIN applet_book_classify_agent a ON c.id = a.applet_book_classify_id
WHERE
a.agent_id = #{agentId}
<if test="showState != null">
AND a.show_state = #{showState}
</if>
order by a.seq asc, a.id asc
</select>
</mapper>
\ No newline at end of file
......@@ -106,6 +106,14 @@
<if test="classifyId >0">
AND b.classify_id= #{classifyId}
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
GROUP BY b.id
order by b.create_time desc
</select>
......
......@@ -9,19 +9,19 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="pic" property="pic" jdbcType="VARCHAR" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
id, classify_name, seq, show_state, create_time,update_time,pic
id, classify_name, seq, show_state, create_time,update_time,pic, agent_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletBooklistClassify" useGeneratedKeys="true" keyProperty="id">
insert into applet_booklist_classify (
classify_name, seq, show_state, create_time, update_time, pic
classify_name, seq, show_state, create_time, update_time, pic, agent_id
)
values (
#{classifyName}, #{seq}, #{showState}, NOW(), NOW(), #{pic}
#{classifyName}, #{seq}, #{showState}, NOW(), NOW(), #{pic}, #{agentId}
)
</insert>
......@@ -70,13 +70,22 @@
<if test="name != null">
AND b.classify_name LIKE CONCAT("%",#{name},"%")
</if>
<choose>
<when test="agentId != null">
and b.agent_id = #{agentId}
</when>
<otherwise>
and b.agent_id = 0
</otherwise>
</choose>
GROUP BY b.id
order by b.seq asc
</select>
<select id="getMaxSeq" resultType="Integer">
<select id="getMaxSeq" resultType="Integer" parameterType="map">
SELECT IFNULL(MAX(seq),0) FROM applet_booklist_classify
WHERE agent_id = #{agentId}
</select>
<select id="getAllBooklistClassify" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletBooklistClassifyDTO">
......@@ -87,6 +96,14 @@
<if test="showState != null">
AND show_state = #{showState}
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
ORDER BY seq ASC, id asc
</select>
......
......@@ -9,10 +9,11 @@
<result column="recommend" property="recommend" jdbcType="INTEGER"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
id, group_activity_id, enable, recommend, seq_num, create_time
id, group_activity_id, enable, recommend, seq_num, create_time, agent_id
</sql>
<select id="getById" resultMap="BaseResultMap">
......@@ -50,6 +51,14 @@
<if test="recommend!=null">
AND a.recommend=#{recommend}
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
ORDER BY a.seq_num, a.id DESC
</select>
......@@ -79,6 +88,14 @@
<if test="name!=null">
AND b.name like concat('%',#{name},'%')
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
ORDER BY a.id DESC
</select>
......@@ -86,6 +103,7 @@
SELECT
IFNULL(MAX(seq_num), 0)
FROM applet_group_manage
WHERE agent_id = #{agentId}
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
......@@ -94,13 +112,15 @@
enable,
recommend,
seq_num,
create_time
create_time,
agent_id
) VALUES (
#{groupActivityId, jdbcType=BIGINT},
#{enable, jdbcType=INTEGER},
#{recommend, jdbcType=INTEGER},
#{seqNum, jdbcType=INTEGER},
NOW()
NOW(),
#{agentId}
)
</insert>
......@@ -110,7 +130,8 @@
enable,
recommend,
seq_num,
create_time
create_time,
agent_id
) VALUES
<foreach collection="list" item="item" separator=",">
(
......@@ -118,7 +139,8 @@
#{item.enable, jdbcType=INTEGER},
#{item.recommend, jdbcType=INTEGER},
#{item.seqNum, jdbcType=INTEGER},
NOW()
NOW(),
#{item.agentId, jdbcType=BIGINT}
)
</foreach>
</insert>
......
......@@ -33,12 +33,13 @@
<result column="business_card_type" property="businessCardType" jdbcType="TINYINT" />
<result column="business_card_isOpen" property="businessCardIsOpen" jdbcType="TINYINT" />
<result column="city_code" property="cityCode" jdbcType="VARCHAR" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
news.id, news.news_name, news.source, news.news_classify_id, news.pro_label_id, news.dep_label_id, news.pur_label_id, news.type, news.digest,
pic1, pic2, pic3, news.content, show_state, news.create_time, news.update_time, news.first_classify, news.second_classify, news.grade_label_id, news.subject_label_id, news.rights_classify_id,
news.jump_type, news.jump_url, news.url_number, news.custom_tag_id, news.show_source, news.show_link,news.business_card_id,news.business_card_type,news.business_card_isOpen,city_code
news.jump_type, news.jump_url, news.url_number, news.custom_tag_id, news.show_source, news.show_link,news.business_card_id,news.business_card_type,news.business_card_isOpen,city_code,agent_id
</sql>
<sql id="sql_news">
m.id,
......@@ -73,13 +74,13 @@
insert into applet_news(
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 , first_classify, second_classify, grade_label_id, subject_label_id, rights_classify_id,
jump_type, jump_url,url_number, custom_tag_id, show_source, show_link,business_card_id,business_card_type,business_card_isOpen,city_code
jump_type, jump_url,url_number, custom_tag_id, show_source, show_link,business_card_id,business_card_type,business_card_isOpen,city_code, agent_id
)
values (
#{newsName}, #{source}, #{newsClassifyId}, #{proLabelId}, #{depLabelId}, #{purLabelId}, #{type}, #{digest},
#{pic1}, #{pic2}, #{pic3}, #{content}, #{showState}, NOW(), NOW(), #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{rightsClassifyId,jdbcType=BIGINT},
#{jumpType}, #{jumpUrl}, #{urlNumber}, #{customTagId}, #{showSource}, #{showLink}, #{businessCardId}, #{businessCardType}, #{businessCardIsOpen}, #{cityCode}
#{jumpType}, #{jumpUrl}, #{urlNumber}, #{customTagId}, #{showSource}, #{showLink}, #{businessCardId}, #{businessCardType}, #{businessCardIsOpen}, #{cityCode}, #{agentId}
)
</insert>
......@@ -259,6 +260,14 @@
<if test="customTagId != null">
AND n.custom_tag_id = #{customTagId}
</if>
<choose>
<when test="agentId != null">
and n.agent_id = #{agentId}
</when>
<otherwise>
and n.agent_id = 0
</otherwise>
</choose>
<if test="classifySelect == 1">
<if test="firstClassify!=null">
AND category.first_classify =#{firstClassify}
......@@ -274,7 +283,7 @@
</if>
GROUP BY n.id
</if>
ORDER BY n.update_time DESC
ORDER BY n.update_time DESC
</select>
<select id="getCountByBusinessCardId" parameterType="long" resultType="long">
......@@ -340,10 +349,19 @@
AND rights_type = #{rightsType}
</if>
)
<choose>
<when test="agentId >0">
and n.agent_id in (#{agentId} ,0)
</when>
<otherwise>
and n.agent_id = 0
</otherwise>
</choose>
group by n.id
ORDER BY n.update_time DESC
ORDER BY n.agent_id desc, n.create_time DESC
</select>
<select id="getByTempletAndClassify" parameterType="map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
......@@ -367,11 +385,18 @@
<if test="rightsClassifyId!=null">
AND news.rights_classify_id =#{rightsClassifyId}
</if>
<choose>
<when test="agentId >0">
and news.agent_id in (#{agentId} ,0)
</when>
<otherwise>
and news.agent_id = 0
</otherwise>
</choose>
group by news.id
ORDER BY
news.update_time DESC
ORDER BY news.agent_id desc, news.update_time DESC
LIMIT #{top}
</select>
</select>
<update id="batchUpdateClassify" parameterType="map">
UPDATE applet_news
......@@ -418,34 +443,62 @@
</foreach>
</delete>
<select id="insertSource" parameterType="string" resultType="int">
INSERT INTO applet_news_source (source) VALUES (#{source})
</select>
<insert id="insertSource" parameterType="map">
INSERT INTO applet_news_source (source, agent_id, create_time) VALUES (#{source}, #{agentId}, now())
</insert>
<select id="getNewsSourceList" resultType="string">
<select id="getNewsSourceList" resultType="string" parameterType="map">
SELECT source FROM applet_news_source
WHERE 1=1
<choose>
<when test="agentId != null">
AND agent_id = #{agentId}
</when>
<otherwise>
AND agent_id = 0
</otherwise>
</choose>
</select>
<select id="getAppletNewsSourceCount" resultType="integer" parameterType="string">
SELECT COUNT(1) FROM applet_news WHERE source = #{source}
<select id="getAppletNewsSourceCount" resultType="integer" parameterType="map">
SELECT COUNT(1) FROM applet_news
WHERE source = #{source}
<choose>
<when test="agentId != null">
AND agent_id = #{agentId}
</when>
<otherwise>
AND agent_id = 0
</otherwise>
</choose>
</select>
<delete id="deleteSource" parameterType="string">
DELETE FROM applet_news_source WHERE source = #{source}
<delete id="deleteSource" parameterType="map">
DELETE FROM applet_news_source WHERE source = #{source} and agent_id = #{agentId}
</delete>
<select id="newsSourceExist" parameterType="string" resultType="boolean">
<select id="newsSourceExist" parameterType="map" resultType="boolean">
SELECT EXISTS(
SELECT id FROM applet_news_source WHERE source=#{source}
SELECT id FROM applet_news_source
WHERE source=#{source}
<choose>
<when test="agentId != null">
AND agent_id = #{agentId}
</when>
<otherwise>
AND agent_id = 0
</otherwise>
</choose>
)
</select>
<select id="getUrlNumberByJumpUrl" parameterType="string" resultType="string">
<select id="getUrlNumberByJumpUrl" parameterType="map" resultType="string">
SELECT url_number
FROM applet_news
WHERE jump_url = #{jumpUrl}
AND jump_type = 2
AND url_number IS NOT NULL
AND agent_id = #{agentId}
LIMIT 1
</select>
......@@ -458,6 +511,14 @@
<if test="id>0">
AND id != #{id}
</if>
<choose>
<when test="agentId != null">
AND agent_id = #{agentId}
</when>
<otherwise>
AND agent_id = 0
</otherwise>
</choose>
)
</select>
......@@ -519,6 +580,14 @@
<if test="source!=null">
AND n.source =#{source}
</if>
<choose>
<when test="agentId != null">
and n.agent_id = #{agentId}
</when>
<otherwise>
and n.agent_id = 0
</otherwise>
</choose>
group by n.id
ORDER BY n.update_time DESC
</select>
......@@ -640,7 +709,7 @@
</update>
<insert id="insertCustomTag" parameterType="com.pcloud.book.applet.entity.AppletNewsCustomTag" useGeneratedKeys="true" keyProperty="id">
INSERT INTO applet_news_custom_tag(custom_tag, create_time) VALUES (#{customTag}, now())
INSERT INTO applet_news_custom_tag(custom_tag, create_time, agent_id) VALUES (#{customTag}, now(), #{agentId})
</insert>
<update id="updateCustomTag" parameterType="com.pcloud.book.applet.entity.AppletNewsCustomTag">
......@@ -648,12 +717,22 @@
where id = #{id}
</update>
<select id="getCustomTagList" resultType="com.pcloud.book.applet.dto.AppletNewsCustomTagDTO">
<select id="getCustomTagList" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsCustomTagDTO">
SELECT
id customTagId,
custom_tag customTag
custom_tag customTag,
agent_id agentId
FROM
applet_news_custom_tag
WHERE 1=1
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
ORDER BY
create_time DESC, id DESC
</select>
......@@ -664,6 +743,7 @@
FROM applet_news_custom_tag
WHERE
custom_tag = #{customTag}
and agent_id = #{agentId}
)
</select>
......
......@@ -9,18 +9,19 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="pic" property="pic" jdbcType="VARCHAR" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
id, news_classify, seq, show_state, create_time,update_time, pic
id, news_classify, seq, show_state, create_time,update_time, pic, agent_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletNewsClassify" useGeneratedKeys="true" keyProperty="id">
insert into applet_news_classify (
news_classify, seq, show_state, create_time, update_time, pic
news_classify, seq, show_state, create_time, update_time, pic, agent_id
)
values (
#{newsClassify}, #{seq}, #{showState}, NOW(), NOW(), #{pic}
#{newsClassify}, #{seq}, #{showState}, NOW(), NOW(), #{pic}, #{agentId}
)
</insert>
......@@ -69,13 +70,22 @@
<if test="name != null">
AND b.news_classify LIKE CONCAT("%",#{name},"%")
</if>
<choose>
<when test="agentId != null">
and b.agent_id = #{agentId}
</when>
<otherwise>
and b.agent_id = 0
</otherwise>
</choose>
GROUP BY b.id
order by b.seq asc
order by b.seq asc,b.id ASC
</select>
<select id="getMaxSeq" resultType="Integer">
<select id="getMaxSeq" resultType="Integer" parameterType="map">
SELECT IFNULL(MAX(seq),0) FROM applet_news_classify
WHERE agent_id = #{agentId}
</select>
<select id="getAllNewsClassify" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletNewsClassifyDTO">
......@@ -86,6 +96,14 @@
<if test="showState != null">
AND show_state = #{showState}
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
ORDER BY seq ASC, id asc
</select>
......
......@@ -7,12 +7,14 @@
<result column="applet_book_classify_id" jdbcType="BIGINT" property="appletBookClassifyId" />
<result column="creat_time" jdbcType="TIMESTAMP" property="creatTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="DTOResultMap" type="com.pcloud.book.applet.dto.AppletUserLabelDTO">
<id column="aid" jdbcType="BIGINT" property="id" />
<result column="label_name" jdbcType="VARCHAR" property="labelName" />
<result column="applet_book_classify_id" jdbcType="BIGINT" property="appletBookClassifyId" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
<collection property="appletUserLabelRelations" ofType="com.pcloud.book.applet.entity.AppletUserLabelRelation">
<id column="arid" property="id" jdbcType="BIGINT"/>
<id column="aid" property="appletUserLabelId" jdbcType="BIGINT"/>
......@@ -22,7 +24,7 @@
</resultMap>
<sql id="Base_Column_List">
id, label_name, applet_book_classify_id, creat_time, update_time
id, label_name, applet_book_classify_id, creat_time, update_time, agent_id
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
......@@ -31,16 +33,24 @@
where id = #{id,jdbcType=BIGINT}
</select>
<select id="listUserLabel" resultMap="DTOResultMap" parameterType="long">
<select id="listUserLabel" resultMap="DTOResultMap" parameterType="map">
select
a.id aid, label_name, applet_book_classify_id,
ar.id arid, ar.book_label_id, ar.label_type
ar.id arid, ar.book_label_id, ar.label_type, a.agent_id
from
applet_user_label a
left join applet_user_label_relation ar on a.id = ar.applet_user_label_id
where
a.applet_book_classify_id = #{appletBookClassifyId}
order by create_time desc
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
order by a.creat_time desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
......@@ -49,9 +59,9 @@
</delete>
<insert id="insert" parameterType="com.pcloud.book.applet.entity.AppletUserLabel" useGeneratedKeys="true" keyProperty="id">
insert into applet_user_label (id, label_name, applet_book_classify_id,
creat_time, update_time)
creat_time, update_time, agent_id)
values (#{id,jdbcType=BIGINT}, #{labelName,jdbcType=VARCHAR}, #{appletBookClassifyId,jdbcType=BIGINT},
now(), now())
now(), now(), #{agentId})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.applet.entity.AppletUserLabel">
insert into applet_user_label
......@@ -124,6 +134,15 @@
FROM
applet_user_label l
LEFT JOIN applet_book_classify c ON l.applet_book_classify_id = c.id
WHERE 1=1
<choose>
<when test="agentId != null">
and l.agent_id = #{agentId}
</when>
<otherwise>
and l.agent_id = 0
</otherwise>
</choose>
ORDER BY l.creat_time DESC
</select>
......
......@@ -2114,7 +2114,7 @@
COUNT(1)
FROM
BOOK_ADVISER A
LEFT JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
WHERE
A.IS_MAIN_EDITOR = 1 AND A.IS_DELETE = 0
<if test="typeCode!=null">
......@@ -2473,4 +2473,41 @@
where book_id = #{item.bookId}
</foreach>
</update>
<!-- 获取社群书列表(小睿独立管理端) -->
<select id="listBookGroup4AppletAgent" resultMap="bookMap" parameterType="map">
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, a.is_open_robot_process, B.ISBN, B.BOOK_NAME, B.REMARK,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber,
G.update_time LAST_MODIFIED_DATE, G.create_time CREATED_DATE, G.id BOOK_GROUP_ID, G.group_qrcode_url groupQrcodeUrl,
G.group_qrcode_name groupQrcodeName, G.dep_label_id bookGroupDepLabelId, G.join_group_type,
G.related_book_group_id relatedBookGroupId, A.IS_PRINT isPrint
FROM
book_group G
INNER JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID
WHERE
G.agent_id = #{agentId}
AND G.is_delete = 0
AND A.IS_DELETE = 0
AND B.IS_DELETE = 0
<if test="adviserId != null">
AND G.create_user = #{adviserId}
</if>
<if test="name != null">
AND
(B.BOOK_NAME LIKE CONCAT('%', #{name}, '%') OR G.group_qrcode_name LIKE CONCAT('%', #{name}, '%')
OR B.ISBN LIKE CONCAT(#{name},'%') OR CONCAT('BK',A.BOOK_ID) = #{name}
)
</if>
<if test="joinGroupType != null">
AND G.join_group_type = #{joinGroupType}
</if>
GROUP BY B.BOOK_ID
ORDER BY
G.UPDATE_TIME DESC
</select>
</mapper>
\ No newline at end of file
......@@ -18,18 +18,18 @@
<result property="useType" column="use_type" jdbcType="INTEGER"/>
<result property="exchangeAddress" column="exchange_address" jdbcType="VARCHAR"/>
<result property="urlNumber" column="url_number" jdbcType="VARCHAR" />
<result property="agentId" column="agent_id" jdbcType="BIGINT" />
</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,
coupon_type,instructions,use_type,exchange_address, url_number
coupon_type,instructions,use_type,exchange_address, url_number, agent_id
</sql>
<!--查询单个-->
<select id="getById" resultMap="GiftCouplePackageMap">
select
id, cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address,url_number
<include refid="Base_Column_List"/>
from book.gift_coupon_package
where id = #{id}
and is_delete=0
......@@ -90,9 +90,9 @@
<!--新增所有列-->
<insert id="insert" parameterType="com.pcloud.book.giftcoupon.entity.GiftCouponPackage" keyProperty="id" useGeneratedKeys="true">
insert into book.gift_coupon_package(cover_pic, title, valid_date_begin, valid_date_end, denomination, stock, receive_limit, create_time, update_time, is_delete,
coupon_type,instructions,use_type,exchange_address,url_number)
coupon_type,instructions,use_type,exchange_address,url_number, agent_id)
values (#{coverPic}, #{title}, #{validDateBegin}, #{validDateEnd}, #{denomination}, #{stock}, #{receiveLimit}, now(), now(), 0,
#{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber})
#{couponType},#{instructions},#{useType},#{exchangeAddress}, #{urlNumber}, #{agentId})
</insert>
<!--通过主键修改数据-->
......@@ -187,6 +187,14 @@
and a.coupon_type=#{couponType}
</if>
and a.receive_limit>0
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
GROUP BY a.id
order by a.update_time desc
......@@ -236,7 +244,7 @@
and stock<![CDATA[ <= ]]>0
</select>
<select id="getUrlNumberByAddress" parameterType="string" resultType="string">
<select id="getUrlNumberByAddress" parameterType="map" resultType="string">
SELECT
url_number
FROM
......@@ -246,6 +254,14 @@
AND coupon_type = 1
AND use_type = 1
AND url_number IS NOT NULL
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
LIMIT 1
</select>
......@@ -263,6 +279,14 @@
<if test="id>0">
AND id != #{id}
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
)
</select>
......@@ -308,6 +332,14 @@
and a.coupon_type = 1
</if>
and a.receive_limit>0
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
order by a.update_time desc
</select>
......
......@@ -11,11 +11,12 @@
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="is_delete" property="isDelete" jdbcType="BIT"/>
<result column="scene_id" property="sceneId" jdbcType="BIGINT"/>
<result column="account_setting_id" property="accountSettingId" jdbcType="BIGINT"/>
</resultMap>
<sql id="Base_Column_List">
id, book_group_id, rays_classify_id, applet_id, applet_url, create_time, update_time, is_delete,scene_id
id, book_group_id, rays_classify_id, applet_id, applet_url, create_time, update_time, is_delete,scene_id,account_setting_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.BookAppletScene" useGeneratedKeys="true"
......@@ -28,7 +29,8 @@
applet_url,
create_time,
update_time,
is_delete
is_delete,
account_setting_id
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookGroupId,jdbcType=BIGINT},
......@@ -37,7 +39,8 @@
#{appletUrl,jdbcType=VARCHAR},
NOW(),
NOW(),
0
0,
#{accountSettingId}
</trim>
</insert>
......@@ -50,7 +53,8 @@
create_time,
update_time,
is_delete,
scene_id
scene_id,
account_setting_id
) values
<foreach collection="list" item="item" index="index"
separator=",">
......@@ -60,7 +64,9 @@
NOW(),
NOW(),
0,
#{item.sceneId,jdbcType=BIGINT})
#{item.sceneId,jdbcType=BIGINT},
#{item.accountSettingId}
)
</foreach>
</insert>
......
......@@ -8,6 +8,7 @@
<result property="defaultPic" column="default_pic" jdbcType="BOOLEAN"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="type" column="type" jdbcType="INTEGER"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
......@@ -29,13 +30,14 @@
<insert id="insert" parameterType="com.pcloud.book.rightsSetting.entity.RightsNowPic" useGeneratedKeys="true" keyProperty="id">
insert into rights_now_pic
<trim prefix="(" suffix=")" suffixOverrides=",">
pic_url, default_pic, create_time, type
pic_url, default_pic, create_time, type, agent_id
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{picUrl,jdbcType=VARCHAR},
#{defaultPic,jdbcType=BOOLEAN},
NOW(),
#{type}
#{type},
#{agentId}
</trim>
</insert>
......@@ -69,6 +71,14 @@
<if test="type != null">
and type = #{type}
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
order by create_time desc
</select>
......
......@@ -25,12 +25,13 @@
<result column="grade_label_id" property="gradeLabelId" jdbcType="BIGINT" />
<result column="subject_label_id" property="subjectLabelId" jdbcType="BIGINT" />
<result column="media_id" property="mediaId" jdbcType="VARCHAR"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
id, name, description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_classify_id,
create_time, create_user, update_time, update_user, is_delete,
first_classify, second_classify, grade_label_id, subject_label_id,media_id
first_classify, second_classify, grade_label_id, subject_label_id,media_id, agent_id
</sql>
<update id="batchUpdateClassify" parameterType="map">
......@@ -51,6 +52,14 @@
select count(1)
from pcloud_group_activity
where number=#{number}
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
and is_delete = 0
</select>
......@@ -94,6 +103,14 @@
<if test="subjectLabelId != null">
and subject_label_id = #{subjectLabelId}
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
order by id desc
</select>
......@@ -152,6 +169,14 @@
and b.city_code = #{cityCode}
and a.group_type != 1
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
order by a.id desc
</select>
......@@ -198,6 +223,14 @@
AND a.join_type = #{joinType}
</if>
AND a.is_delete = 0
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
</where>
GROUP BY a.id
ORDER BY a.create_time DESC
......@@ -244,8 +277,16 @@
<if test="subjectLabelId != null">
and a.subject_label_id = #{subjectLabelId}
</if>
<choose>
<when test="agentId >0">
and a.agent_id in (#{agentId} ,0)
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
GROUP BY a.id
ORDER BY a.id DESC
ORDER BY a.agent_id desc, a.id DESC
LIMIT #{limit}
</select>
......@@ -273,7 +314,8 @@
a.number,
a.group_extLink,
a.group_type,
a.media_id
a.media_id,
a.agent_id
FROM pcloud_group_activity a LEFT JOIN book_group_classify b ON a.book_group_classify_id = b.id
WHERE a.id = #{id,jdbcType=INTEGER} and a.is_delete = 0
</select>
......@@ -427,13 +469,15 @@
description, join_type, group_pic, pro_label_id, dep_label_id,
pur_label_id, book_group_classify_id, create_time,
create_user, update_time, update_user,
is_delete, first_classify, second_classify, grade_label_id, subject_label_id,number,group_type,group_extLink)
is_delete, first_classify, second_classify, grade_label_id, subject_label_id,number,
group_type,group_extLink, agent_id)
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR},
#{desc,jdbcType=VARCHAR}, #{joinType,jdbcType=INTEGER}, #{groupPic,jdbcType=VARCHAR}, #{proLabelId,jdbcType=INTEGER}, #{depLabelId,jdbcType=INTEGER},
#{purLabelId,jdbcType=INTEGER}, #{bookGroupClassifyId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{createUser,jdbcType=INTEGER}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
#{isDelete,jdbcType=BIT}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{number,jdbcType=BIGINT}, #{groupType,jdbcType=BIGINT}, #{groupExtLink,jdbcType=VARCHAR})
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, #{number,jdbcType=BIGINT},
#{groupType,jdbcType=BIGINT}, #{groupExtLink,jdbcType=VARCHAR}, #{agentId})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.skill.entity.PcloudGroupActivity" >
update pcloud_group_activity
......@@ -575,6 +619,14 @@
<if test="subjectLabelId != null">
and a.subject_label_id = #{subjectLabelId}
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
GROUP BY a.id
ORDER BY a.id DESC
</select>
......@@ -608,8 +660,41 @@
a.is_delete = 0 AND a.is_show = 1 AND IFNULL(b.is_delete,0) = 0
and c.city_code = #{cityCode}
and a.group_type != 1
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
GROUP BY a.id
ORDER BY a.id DESC
</select>
<select id="getByActivityId" resultType="com.pcloud.book.skill.facade.response.QueryGroupActivityResponseVO" parameterType="long" >
SELECT
a.id,
a.`name`,
a.description as `desc`,
a.join_type AS joinType,
a.book_group_classify_id AS bookGroupClassifyId,
a.pro_label_id AS proLabelId,
a.dep_label_id AS depLabelId,
a.pur_label_id AS purLabelId,
b.classify AS classifyName,
a.first_classify AS firstClassify,
a.second_classify AS secondClassify,
a.grade_label_id AS gradeLabelId,
a.subject_label_id AS subjectLabelId,
a.number,
a.group_extLink as groupExtLink,
a.group_type as groupType,
is_show AS isShow
FROM
pcloud_group_activity a left join book_group_classify b on a.book_group_classify_id = b.id
WHERE
a.id = #{id}
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment