Commit 3923f065 by 朱亚洁

feat:[1003105]小睿独立管理端3期

parent 7705553f
......@@ -64,5 +64,5 @@ public class AppletOuterBookDTO extends BaseDto {
)
private Date createTime;
private Long agentId;
}
\ No newline at end of file
......@@ -36,6 +36,7 @@ public class CreateTaskDto implements Serializable {
private Long proLabelId;
private Long agentId;
}
......@@ -39,4 +39,6 @@ public class TaskCompletedDto implements Serializable {
//1按天发送 2按周发送
private Integer sendType;
private Long agentId;
}
......@@ -54,4 +54,6 @@ public class TaskDto implements Serializable {
//1按天发送 2按周发送
private Integer sendType;
private Long agentId;
}
......@@ -51,4 +51,5 @@ public class TaskItemSendDto implements Serializable {
private String serialNumber;
private Long agentId;
}
......@@ -180,14 +180,14 @@ public interface AppletBooklistBiz {
* * @param null
*/
PageBeanNew<AppletOuterBookDTO> listPageOuterBook(Integer currentPage, Integer numPerPage, String publish,
String name);
String name, Long agentId);
/**
* 外部书刊出版社列表
* @author:zhuyajie
* @date:2020/8/11 13:53
* * @param null
*/
List<String> getOuterBookPublish();
List<String> getOuterBookPublish(Long agentId);
/**
* 删除外部书刊
* @author:zhuyajie
......@@ -217,14 +217,14 @@ public interface AppletBooklistBiz {
* * @param null
*/
PageBeanNew<AppletOuterBooklistDTO> listPageOuterBooklist(Integer currentPage, Integer numPerPage, String publish,
String name);
String name, Long agentId);
/**
* 外部书单出版社列表
* @author:zhuyajie
* @date:2020/8/11 15:16
* * @param null
*/
List<String> getOuterBooklistPublish();
List<String> getOuterBooklistPublish(Long agentId);
/**
* 删除外部书单
* @author:zhuyajie
......
package com.pcloud.book.applet.biz;
import com.pcloud.book.applet.dto.AppletStatisticDTO;
import com.pcloud.book.applet.entity.AppletUser;
public interface AppletStatisticBiz {
/**
* 小程序用户埋点
* @author:zhuyajie
* @date:2020/7/28 18:55
* * @param null
*/
void addRecord(AppletUser appletUser);
/**
* 小睿管理端小程序统计数据
* @author:zhuyajie
* @date:2020/7/28 18:55
* * @param null
*/
AppletStatisticDTO getStatisticByAgentAndTime(Long agentId, String startTime, String endTime);
/**
* 小睿管理端小程序统计数据(累计数据)
* @author:zhuyajie
* @date:2020/7/29 10:36
* * @param null
*/
AppletStatisticDTO getStatisticByAgent(Long agentId);
}
......@@ -427,17 +427,18 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public PageBeanNew<AppletOuterBookDTO> listPageOuterBook(Integer currentPage, Integer numPerPage, String publish, String name) {
public PageBeanNew<AppletOuterBookDTO> listPageOuterBook(Integer currentPage, Integer numPerPage, String publish, String name, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("publish", publish);
map.put("name", name);
map.put("agentId", agentId);
PageBeanNew<AppletOuterBookDTO> pageBeanNew = appletOuterBookDao.listPageNew(new PageParam(currentPage,numPerPage), map,"listPageOuterBook");
return pageBeanNew;
}
@Override
public List<String> getOuterBookPublish() {
return appletOuterBookDao.getAllPublish();
public List<String> getOuterBookPublish(Long agentId) {
return appletOuterBookDao.getAllPublish(agentId);
}
@Override
......@@ -505,17 +506,18 @@ public class AppletBooklistBizImpl implements AppletBooklistBiz {
}
@Override
public PageBeanNew<AppletOuterBooklistDTO> listPageOuterBooklist(Integer currentPage, Integer numPerPage, String publish, String name) {
public PageBeanNew<AppletOuterBooklistDTO> listPageOuterBooklist(Integer currentPage, Integer numPerPage, String publish, String name, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("publish", publish);
map.put("name", name);
map.put("agentId", agentId);
PageBeanNew<AppletOuterBooklistDTO> pageBeanNew = appletOuterBooklistDao.listPageNew(new PageParam(currentPage,numPerPage), map,"listPageOuterBooklist");
return pageBeanNew;
}
@Override
public List<String> getOuterBooklistPublish() {
return appletOuterBooklistDao.getOuterBooklistPublish();
public List<String> getOuterBooklistPublish(Long agentId) {
return appletOuterBooklistDao.getOuterBooklistPublish(agentId);
}
@Override
......
package com.pcloud.book.applet.biz.impl;
import com.pcloud.book.applet.biz.AppletStatisticBiz;
import com.pcloud.book.applet.contants.AppletConstants;
import com.pcloud.book.applet.dao.AppletUserDao;
import com.pcloud.book.applet.dto.AppletStatisticDTO;
import com.pcloud.book.applet.dto.AppletUserCountDTO;
import com.pcloud.book.applet.entity.AppletUser;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.group.biz.BookGroupBiz;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @ClassName com.pcloud.book.applet.biz.impl.AppletStatisticBizImpl
* @Author zhuyajie
* @Description 小程序数据统计
* @Date 2020/7/28 17:28
* @Version 1.0
**/
@Component
public class AppletStatisticBizImpl implements AppletStatisticBiz{
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private AppletUserDao appletUserDao;
@Autowired
private BookAdviserBiz bookAdviserBiz;
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private ReaderConsr readerConsr;
@Override
public void addRecord(AppletUser appletUser) {
if (null == appletUser.getWechatUserId() || null == appletUser.getAccountSettingId()){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"参数缺失");
}
appletUserDao.insert(appletUser);
}
@Override
public AppletStatisticDTO getStatisticByAgentAndTime(Long agentId, String startTime, String endTime) {
AppletStatisticDTO appletStatisticDTO = new AppletStatisticDTO();
Long accountSettingId = qrcodeSceneConsr.getAccountSettingIdByAgentId(agentId);
if (null == accountSettingId) {
return new AppletStatisticDTO();
}
//扫小程序码次数/人数
AppletUserCountDTO userCountDTO = appletUserDao.getUserCount(startTime, endTime, accountSettingId);
appletStatisticDTO.setScanCount(userCountDTO.getCount());
appletStatisticDTO.setScanUserCount(userCountDTO.getUserCount());
//出版社下书刊数量
Integer bookCount = bookAdviserBiz.getBookCountByAgentAndTime(agentId, startTime, endTime);
appletStatisticDTO.setBookCount(bookCount);
//小程序用户数量
Integer userCount = readerConsr.getAccountUserCountByTime(accountSettingId, startTime, endTime);
appletStatisticDTO.setUserCount(userCount);
return appletStatisticDTO;
}
@Override
public AppletStatisticDTO getStatisticByAgent(Long agentId) {
Long accountSettingId = qrcodeSceneConsr.getAccountSettingIdByAgentId(agentId);
if (null == accountSettingId) {
return new AppletStatisticDTO();
}
AppletStatisticDTO appletStatisticDTO = JedisClusterUtils.hgetJson2Class(AppletConstants.APPLET_AGENT_STATISTIC, agentId.toString(), AppletStatisticDTO.class);
if (null != appletStatisticDTO) {
return appletStatisticDTO;
}
appletStatisticDTO = new AppletStatisticDTO();
//扫小程序码次数/人数
AppletUserCountDTO userCountDTO = appletUserDao.getUserCount(null, null, accountSettingId);
appletStatisticDTO.setScanCount(userCountDTO.getCount());
appletStatisticDTO.setScanUserCount(userCountDTO.getUserCount());
//出版社下书刊数量
Integer bookCount = bookAdviserBiz.getBookCount(agentId);
appletStatisticDTO.setBookCount(bookCount);
//出版社小睿书数量
Integer rayBookCount = bookGroupBiz.getBookGroupCountByAgent(JoinGroupTypeEnum.XIAORUI.getCode(), agentId);
appletStatisticDTO.setRaysBookCount(rayBookCount);
//小程序用户数量
Integer userCount = readerConsr.getAccountUserCountByTime(accountSettingId, null, null);
appletStatisticDTO.setUserCount(userCount);
JedisClusterUtils.hset2Json(AppletConstants.APPLET_AGENT_STATISTIC, agentId.toString(), appletStatisticDTO);
JedisClusterUtils.expire(AppletConstants.APPLET_AGENT_STATISTIC, 10 * 60);
return appletStatisticDTO;
}
}
......@@ -48,4 +48,9 @@ public class AppletConstants {
* 推荐书单-外部书单列表中的书
*/
public static final String OUTER_BOOKLIST_BOOK = CacheConstant.BOOK+"APPLET:RightSettingBooklist4Wechat";
/**
* 小睿独立管理端数据统计
*/
public static final String APPLET_AGENT_STATISTIC = CacheConstant.BOOK +"APPLET:applet_agent_statistic";
}
......@@ -16,7 +16,7 @@ import java.util.List;
public interface AppletOuterBookDao extends BaseDao<AppletOuterBook>{
List<String> getAllPublish();
List<String> getAllPublish(Long agentId);
List<AppletOuterBookDTO> listPageOuterBookByBooklistId(Long booklistId, Integer limit);
}
\ No newline at end of file
......@@ -56,7 +56,7 @@ public interface AppletOuterBooklistDao extends BaseDao<AppletOuterBooklist>{
* @date:2020/8/11 16:13
* * @param null
*/
List<String> getOuterBooklistPublish();
List<String> getOuterBooklistPublish(Long agentId);
/**
* 根据书单id查询图书
......
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletUserCountDTO;
import com.pcloud.book.applet.entity.AppletUser;
import com.pcloud.common.core.dao.BaseDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 识别小程序用户(AppletUser)表数据库访问层
*
* @author makejava
* @since 2020-07-28 17:35:00
*/
public interface AppletUserDao extends BaseDao<AppletUser>{
AppletUserCountDTO getUserCount(String startTime, String endTime, Long accountSettingId);
}
\ No newline at end of file
......@@ -21,8 +21,10 @@ import java.util.Map;
@Component
public class AppletOuterBookDaoImpl extends BaseDaoImpl<AppletOuterBook> implements AppletOuterBookDao {
@Override
public List<String> getAllPublish() {
return getSessionTemplate().selectList(getStatement("getAllPublish"));
public List<String> getAllPublish(Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getAllPublish"), map);
}
@Override
......
......@@ -9,6 +9,7 @@ import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -43,8 +44,10 @@ public class AppletOuterBooklistDaoImpl extends BaseDaoImpl<AppletOuterBooklist>
}
@Override
public List<String> getOuterBooklistPublish() {
return getSessionTemplate().selectList(getStatement("getOuterBooklistPublish"));
public List<String> getOuterBooklistPublish(Long agentId) {
Map<String,Object>map = new HashMap<>();
map.put("agentId", agentId);
return getSessionTemplate().selectList(getStatement("getOuterBooklistPublish"), map);
}
@Override
......
package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletUserDao;
import com.pcloud.book.applet.dto.AppletUserCountDTO;
import com.pcloud.book.applet.entity.AppletUser;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @ClassName com.pcloud.book.applet.dao.impl.AppletUserDaoImpl
* @Author zhuyajie
* @Description 小程序用户
* @Date 2020/7/28 17:36
* @Version 1.0
**/
@Component
public class AppletUserDaoImpl extends BaseDaoImpl<AppletUser> implements AppletUserDao {
@Override
public AppletUserCountDTO getUserCount(String startTime, String endTime, Long accountSettingId) {
Map<String,Object> map = new HashMap<>();
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("accountSettingId", accountSettingId);
return getSessionTemplate().selectOne(getStatement("getUserCount"), map);
}
}
......@@ -59,4 +59,6 @@ public class AppletOuterBooklistDTO extends BaseDto {
* 外部书刊列表
*/
private List<AppletOuterBookDTO> outerBookDTOS;
private Long agentId;
}
\ No newline at end of file
package com.pcloud.book.applet.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
/**
* @ClassName com.pcloud.book.applet.dto.AppletStatisticDTO
* @Author zhuyajie
* @Description 小程序统计数据
* @Date 2020/7/28 17:51
* @Version 1.0
**/
@Data
public class AppletStatisticDTO extends BaseDto {
/**
* 用户数量
*/
private Integer userCount;
/**
* 识别小程序用户数量
*/
private Integer scanUserCount;
/**
* 识别小程序次数
*/
private Integer scanCount;
/**
* 书刊数量
*/
private Integer bookCount;
/**
* 小睿书书刊数量
*/
private Integer raysBookCount;
}
package com.pcloud.book.applet.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
/**
* @ClassName com.pcloud.book.applet.dto.AppletUserCountDTO
* @Author zhuyajie
* @Description 小程序扫码用户数
* @Date 2020/7/28 17:43
* @Version 1.0
**/
@Data
public class AppletUserCountDTO extends BaseDto {
/**
* 用户数量
*/
private Integer userCount;
/**
* 次数
*/
private Integer count;
}
......@@ -65,5 +65,6 @@ public class AppletOuterBook extends BaseEntity {
)
private Date createTime;
private Long agentId;
}
\ No newline at end of file
......@@ -48,6 +48,7 @@ public class AppletOuterBooklist extends BaseEntity {
)
private Date createTime;
private Long agentId;
}
\ No newline at end of file
package com.pcloud.book.applet.entity;
import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import java.io.Serializable;
import lombok.Data;
/**
* 识别小程序用户(AppletUser)实体类
*
* @author makejava
* @since 2020-07-28 17:35:00
*/
@Data
public class AppletUser extends BaseEntity {
private static final long serialVersionUID = -36042053466648302L;
/**
* 小程序id
*/
private String appletId;
/**
* 公众号id
*/
private Long accountSettingId;
/**
* 用户id
*/
private Long wechatUserId;
}
\ No newline at end of file
......@@ -3,6 +3,7 @@ package com.pcloud.book.applet.facade;
import com.pcloud.book.applet.biz.AppletBannerBiz;
import com.pcloud.book.applet.biz.AppletBooklistBiz;
import com.pcloud.book.applet.biz.AppletNewsBiz;
import com.pcloud.book.applet.biz.AppletStatisticBiz;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.dto.AddBookParamDTO;
import com.pcloud.book.applet.dto.AppletBannerDTO;
......@@ -24,6 +25,7 @@ import com.pcloud.book.applet.entity.AppletNews;
import com.pcloud.book.applet.entity.AppletNewsClassify;
import com.pcloud.book.applet.entity.AppletNewsComment;
import com.pcloud.book.applet.entity.AppletNewsCustomTag;
import com.pcloud.book.applet.entity.AppletUser;
import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord;
import com.pcloud.book.applet.vo.AppletNewsClassifyVO;
......@@ -72,6 +74,8 @@ public class AppletHomeFacade {
private AppletUserBookcaseBiz appletUserBookcaseBiz;
@Autowired
private PcloudGroupActivityBiz pcloudGroupActivityBiz;
@Autowired
private AppletStatisticBiz appletStatisticBiz;
@ApiOperation("批量名片上下架")
@PostMapping("batchUpdateCardShowState")
......@@ -968,7 +972,9 @@ public class AppletHomeFacade {
@ApiOperation("添加/修改外部书刊")
@PostMapping("addOuterBook")
public ResponseDto<?> addOuterBook(@RequestHeader("token") String token, @RequestBody AppletOuterBookDTO appletOuterBookDTO) {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
appletOuterBookDTO.setAgentId(agentId==null?0L:agentId);
return new ResponseDto<>(appletBooklistBiz.addOuterBook(appletOuterBookDTO));
}
......@@ -986,15 +992,17 @@ public class AppletHomeFacade {
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "publish", required = false) String publish,
@RequestParam(value = "name", required = false) String name) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletBooklistBiz.listPageOuterBook(currentPage, numPerPage, publish, name));
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletBooklistBiz.listPageOuterBook(currentPage, numPerPage, publish, name, agentId));
}
@ApiOperation("外部书刊出版社列表")
@GetMapping("getOuterBookPublish")
public ResponseDto<?> getAllPublish(@RequestHeader("token") String token) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletBooklistBiz.getOuterBookPublish());
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletBooklistBiz.getOuterBookPublish(agentId));
}
@ApiOperation("删除外部书刊")
......@@ -1008,7 +1016,9 @@ public class AppletHomeFacade {
@ApiOperation("创建外部书单")
@PostMapping("addOuterBooklist")
public ResponseDto<?> addOuterBooklist(@RequestHeader("token") String token, @RequestBody AppletOuterBooklistDTO appletOuterBooklistDTO) {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
appletOuterBooklistDTO.setAgentId(agentId==null?0L:agentId);
return new ResponseDto<>(appletBooklistBiz.addOuterBooklist(appletOuterBooklistDTO));
}
......@@ -1026,15 +1036,17 @@ public class AppletHomeFacade {
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "publish", required = false) String publish,
@RequestParam(value = "name", required = false) String name) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletBooklistBiz.listPageOuterBooklist(currentPage, numPerPage, publish, name));
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletBooklistBiz.listPageOuterBooklist(currentPage, numPerPage, publish, name, agentId));
}
@ApiOperation("外部书单出版社列表")
@GetMapping("getOuterBooklistPublish")
public ResponseDto<?> getOuterBooklistPublish(@RequestHeader("token") String token) {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletBooklistBiz.getOuterBooklistPublish());
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletBooklistBiz.getOuterBooklistPublish(agentId));
}
@ApiOperation("删除外部书单")
......@@ -1068,6 +1080,29 @@ public class AppletHomeFacade {
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(appletBooklistBiz.listPageOuterBookByBooklistId(currentPage, numPerPage, booklistId));
}
@ApiOperation("小程序用户埋点")
@PostMapping("addRecord")
public ResponseDto<?> addRecord(@RequestBody @ApiParam AppletUser appletUser) {
appletStatisticBiz.addRecord(appletUser);
return new ResponseDto<>();
}
@ApiOperation("小睿管理端小程序统计数据")
@GetMapping("getStatisticByTime4AppletAgent")
public ResponseDto<?> getStatisticByTime4AppletAgent(@RequestHeader("token") String token,
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime) {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletStatisticBiz.getStatisticByAgentAndTime(agentId, startTime, endTime));
}
@ApiOperation("小睿管理端小程序统计数据(累计数据)")
@GetMapping("getStatistic4AppletAgent")
public ResponseDto<?> getStatistic4AppletAgent(@RequestHeader("token") String token) {
Long agentId = (Long) SessionUtil.getVlaue(token, SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(appletStatisticBiz.getStatisticByAgent(agentId));
}
}
......
......@@ -232,4 +232,12 @@ public interface BookAdviserBiz {
* @return
*/
Map<String, BookDataStatisticsDTO> mapBookDataStatistics(List<Long> adviserIds, List<Long> bookIds, List<Long> channelIds);
/**
* 出版社下图书数量
* @author:zhuyajie
* @date:2020/7/29 10:48
* * @param null
*/
Integer getBookCountByAgentAndTime(Long agentId, String startTime, String endTime);
}
......@@ -43,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.book.base.dto.CountDto;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookAdviserBiz;
......@@ -1166,4 +1167,14 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
}
return resultMap;
}
@Override
public Integer getBookCountByAgentAndTime(Long agentId, String startTime, String endTime) {
List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
Integer bookCount = 0;
if (!ListUtils.isEmpty(adviserIds)) {
bookCount = bookAdviserDao.getBookCountByTime(adviserIds, startTime, endTime);
}
return bookCount;
}
}
......@@ -271,4 +271,12 @@ public interface BookAdviserDao extends BaseDao<BookAdviser> {
Map<Long, BookAdviserDto> getByBookAdviserIds(List<Long> bookAdviserIds);
BookAdviserDto getByBookGroupId(Long bookGroupId);
/**
* 查书刊数量
* @author:zhuyajie
* @date:2020/7/29 10:49
* * @param null
*/
Integer getBookCountByTime(List<Long> adviserIds, String startTime, String endTime);
}
......@@ -274,4 +274,13 @@ public class BookAdviserDaoImpl extends BaseDaoImpl<BookAdviser> implements Book
public BookAdviserDto getByBookGroupId(Long bookGroupId) {
return getSessionTemplate().selectOne(getStatement("getByBookGroupId"),bookGroupId);
}
@Override
public Integer getBookCountByTime(List<Long> adviserIds, String startTime, String endTime) {
Map<String, Object> map = new HashMap<>();
map.put("adviserIds", adviserIds);
map.put("startTime", startTime);
map.put("endTime", endTime);
return getSessionTemplate().selectOne(getStatement("getBookCountByTime"), map);
}
}
......@@ -421,5 +421,16 @@ public class QrcodeSceneConsr {
return specialUsers;
}
@ParamLog("根据出版社获取小程序公众号id")
public Long getAccountSettingIdByAgentId(Long agentId) {
Long accountSettingId = null;
try {
accountSettingId = ResponseHandleUtil.parseResponse(accountSettingService.getAccountSettingIdByAgentId(agentId),Long.class);
}catch (Exception e){
LOGGER.error("根据出版社获取小程序公众号id失败" + e.getMessage(),e);
}
return accountSettingId;
}
}
......@@ -136,7 +136,8 @@ public class ErpConsr {
return jsonObject.getLong("data");
} catch (Exception e){
LOGGER.error("通过项目id获取bookId[projectService.getBookIdByProjectId]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_CONTENT_ERROR, "通过项目id获取bookId 错误");
// throw new BookBizException(BookBizException.INVOKE_CONTENT_ERROR, "通过项目id获取bookId 错误");
return null;
}
}
}
......@@ -235,6 +235,17 @@ public class ReaderConsr {
throw new BizException(e.getCode(), e.getMessage());
}
}
@ParamLog("公众号用户数量")
public Integer getAccountUserCountByTime(Long officialAccountsId, String startTime, String endTime){
Integer count = 0;
try {
count = ResponseHandleUtil.parseResponse(wechatUserService.getAccountUserCountByTime(officialAccountsId, startTime, endTime),Integer.class);
}catch (Exception e){
LOGGER.error("调用getAccountUserCountByTime失败"+e.getMessage(),e);
}
return count;
}
}
......@@ -199,4 +199,6 @@ public class ChannelConsr {
}
return accountSettingId;
}
}
......@@ -18,7 +18,7 @@ public interface CultivateNotifyBiz {
void createNotify(CultivateNotifyDTO cultivateNotifyDTO);
void sendAppletTemplateMessage(List<CultivateNotifySend> list);
void sendAppletTemplateMessage(List<CultivateNotifySend> list, Long agnetId);
PageBeanNew<CultivateNotifyPageDTO> listPage4CultivateNotify(SearchNotifyDTO searchNotifyDTO);
......@@ -31,4 +31,6 @@ public interface CultivateNotifyBiz {
PageBeanNew<MiniUserDto> listPage4SendUser(SearchSendUserDTO searchSendUserDTO);
PageBeanNew<AdviserBookInfoDTO> listPage4SearchBook(SearchSendUserDTO searchSendUserDTO);
void batchSendMiniUser(List<CultivateNotifySend> list);
}
......@@ -5,6 +5,7 @@ import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dao.SearchRecordDao;
import com.pcloud.book.book.dto.AdviserBookInfoDTO;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.content.ResourceConsr;
import com.pcloud.book.consumer.message.TemplateConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
......@@ -76,9 +77,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
private AdviserConsr adviserConsr;
@Autowired
private TemplateConsr templateConsr;
@Value("${mini.official.account.id}")
private Long accountSettingId;
@Autowired
private QrcodeSceneConsr qrcodeSceneConsr;
private final Integer SEND_BATCH_NUM=100;
......@@ -91,6 +91,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotify.setMessageType(cultivateNotifyDTO.getMessageType());
cultivateNotify.setTitle(cultivateNotifyDTO.getTitle());
cultivateNotify.setSendType(cultivateNotifyDTO.getSendType());
cultivateNotify.setAgentId(null==cultivateNotifyDTO.getAgentId()?0L:cultivateNotifyDTO.getAgentId());
cultivateNotifyDao.insert(cultivateNotify);
cultivateNotifyDTO.getCultivateNotifyItems().forEach(a->a.setMessageId(cultivateNotify.getMessageId()));
cultivateNotifyItemDao.insert(cultivateNotifyDTO.getCultivateNotifyItems());
......@@ -195,7 +196,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
list.add(cultivateNotifySend);
}
cultivateNotifySendDao.insert(list);
sendAppletTemplateMessage(list);
sendAppletTemplateMessage(list, cultivateNotify.getAgentId());
}
//分类用户发送
if (NotifySendTypeEnum.CLASSIFY_USER.value.equals(cultivateNotifyDTO.getSendType())) {
......@@ -231,7 +232,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotifySendList.add(cultivateNotifySend);
}
cultivateNotifySendDao.insert(cultivateNotifySendList);
sendAppletTemplateMessage(cultivateNotifySendList);
sendAppletTemplateMessage(cultivateNotifySendList, cultivateNotify.getAgentId());
}
}
}
......@@ -241,6 +242,8 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
readerMessageDto.setMessageId(cultivateNotify.getMessageId());
readerMessageDto.setSendType(cultivateNotifyDTO.getSendType());
readerMessageDto.setMessageType(cultivateNotifyDTO.getMessageType());
Long accountSettingId = qrcodeSceneConsr.getAccountSettingIdByAgentId(cultivateNotify.getAgentId());
readerMessageDto.setOfficialAccountsId(accountSettingId);
readerConsr.sendNotifyMiniUser(readerMessageDto);
}
}
......@@ -249,9 +252,11 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
* 发送小程序模板消息
* @param list
*/
public void sendAppletTemplateMessage(List<CultivateNotifySend> list) {
@Override
public void sendAppletTemplateMessage(List<CultivateNotifySend> list, Long agentId) {
AppletTemplateMessageDto appletTemplateMessage;
Map<String, String> tempMap;
Long accountSettingId = qrcodeSceneConsr.getAccountSettingIdByAgentId(agentId);
for (CultivateNotifySend cultivateNotifySend : list) {
if(cultivateNotifySend.getMessageType() == 1){ continue;}
appletTemplateMessage = new AppletTemplateMessageDto();
......@@ -278,6 +283,7 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
map.put("keyword",searchNotifyDTO.getKeyword());
map.put("sendType",searchNotifyDTO.getSendType());
map.put("messageType",searchNotifyDTO.getMessageType());
map.put("agentId", searchNotifyDTO.getAgentId());
PageBeanNew<CultivateNotifyPageDTO> pageBeanNew= cultivateNotifySendDao.listPageNew(new PageParam(searchNotifyDTO.getPageNum(), searchNotifyDTO.getNumPerPage()), map, "listPage4CultivateNotify");
if(null==pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())){
return new PageBeanNew<>(searchNotifyDTO.getPageNum(), searchNotifyDTO.getNumPerPage(),pageBeanNew.getTotalCount(), new ArrayList<>());
......@@ -347,4 +353,17 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
return new PageBeanNew<>(searchSendUserDTO.getCurrentPage(), searchSendUserDTO.getNumPerPage(),count, infos);
}
@Override
public void batchSendMiniUser(List<CultivateNotifySend> list) {
if (ListUtils.isEmpty(list)){
return;
}
cultivateNotifySendDao.insert(list);
CultivateNotify cultivateNotify = cultivateNotifyDao.getById(list.get(0).getMessageId());
if (null == cultivateNotify){
return;
}
this.sendAppletTemplateMessage(list, cultivateNotify.getAgentId());
}
}
......@@ -42,4 +42,7 @@ public class CultivateNotifyDTO {
@ApiModelProperty("用户id")
private List<WechatUserDTO> wechatUserDTOS;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -17,4 +17,6 @@ public class SearchNotifyDTO extends PageParam {
@ApiModelProperty("消息类型(1-系统消息,2-通知消息,3-提醒消息,4-活动消息)")
private Integer messageType;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -22,4 +22,6 @@ public class CultivateNotify extends BaseEntity {
@ApiModelProperty("发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息)")
private Integer sendType;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -8,6 +8,7 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.NumberUtil;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -15,10 +16,13 @@ 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;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -35,8 +39,12 @@ public class CultivateNotifyFacade {
@ApiOperation("新增站内信")
@PostMapping("/createCultivateNotify")
public ResponseDto<?> createCultivate(
@RequestHeader("token") String token,
@RequestBody CultivateNotifyDTO cultivateNotifyDTO
) throws BizException, PermissionException {
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
cultivateNotifyDTO.setAgentId(agentId);
cultivateNotifyBiz.createNotify(cultivateNotifyDTO);
return new ResponseDto<>();
}
......@@ -44,8 +52,12 @@ public class CultivateNotifyFacade {
@ApiOperation("站内信列表")
@PostMapping("/listPage4CultivateNotify")
public ResponseDto<?> listPage4CultivateNotify(
@RequestHeader("token") String token,
@RequestBody SearchNotifyDTO searchNotifyDTO
) throws BizException, PermissionException {
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
searchNotifyDTO.setAgentId(agentId);
return new ResponseDto<>(cultivateNotifyBiz.listPage4CultivateNotify(searchNotifyDTO));
}
......
package com.pcloud.book.cultivate.service.impl;
import com.pcloud.book.cultivate.biz.CultivateNotifyBiz;
import com.pcloud.book.cultivate.dao.CultivateNotifySendDao;
import com.pcloud.book.cultivate.entity.CultivateNotifySend;
import com.pcloud.book.cultivate.service.CultivateNotifyService;
import com.pcloud.book.timecontrol.biz.TaskBiz;
import com.pcloud.book.timecontrol.biz.TaskSubscribeBiz;
import com.pcloud.book.timecontrol.dto.BookTaskBindingDto;
import com.pcloud.book.timecontrol.dto.LabelDto;
import com.pcloud.book.timecontrol.dto.TaskDto;
import com.pcloud.book.timecontrol.mapper.TimeControlTaskMapper;
import com.pcloud.book.timecontrol.service.TimeControlTaskService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
@RestController("cultivateNotifyService")
......@@ -36,15 +21,12 @@ public class CultivateNotifyServiceImpl implements CultivateNotifyService {
@Autowired
private CultivateNotifyBiz cultivateNotifyBiz;
@Autowired
private CultivateNotifySendDao cultivateNotifySendDao;
@Override
@RequestMapping(value = "/batchSendMiniUser", method = RequestMethod.POST)
public void batchSendMiniUser(@RequestBody List<CultivateNotifySend> list) throws BizException {
if(!ListUtils.isEmpty(list)){
cultivateNotifySendDao.insert(list);
cultivateNotifyBiz.sendAppletTemplateMessage(list);
}
if (!ListUtils.isEmpty(list)) {
cultivateNotifyBiz.batchSendMiniUser(list);
}
}
}
......@@ -21,13 +21,13 @@ public interface CustomPlanBiz {
void deleteCustomPlanById(Integer planId);
PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState,
Integer hasPdf,Integer robotType, Integer readType, String erpBookName);
Integer hasPdf,Integer robotType, Integer readType, String erpBookName, Long agentId);
void editCustomPlanModule(EditCustomPlanModuleVO editCustomPlanModuleVO);
List<CustomPlanModuleVO> getCustomPlanModule(Integer planId);
PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content);
PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content, Long agentId);
Map<String, Object> getShortLinkUrl(Long appId, Long productId, String linkUrl);
......
......@@ -10,7 +10,7 @@ public interface CustomReadPlanBiz {
void deleteCustomReadPlan(Long customReadPlanId);
PageBeanNew<CustomReadPlan> getCustomReadPlanList(Integer currentPage, Integer numPerPage, Integer robotType);
PageBeanNew<CustomReadPlan> getCustomReadPlanList(Integer currentPage, Integer numPerPage, Integer robotType, Long agentId);
CustomReadPlan getCustomReadPlanById(Long customReadPlanId);
......
......@@ -259,14 +259,14 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
@Override
public PageBeanNew<CustomPlan> listCustomPlanByPage(Integer currentPage, Integer numPerPage, String content, Integer useState,
Integer hasPdf, Integer robotType, Integer readType, String erpBookName) {
Integer hasPdf, Integer robotType, Integer readType, String erpBookName, Long agentId) {
List<Long> projectIds = erpConsr.getIdsByBookName(erpBookName);
int count = customPlanMapper.getCustomPlanCount(content, useState, hasPdf,robotType, readType, projectIds);
int count = customPlanMapper.getCustomPlanCount(content, useState, hasPdf,robotType, readType, projectIds, agentId);
if(count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
}
List<CustomPlan> customPlanList = customPlanMapper.listCustomPlanByPage(currentPage * numPerPage,
numPerPage, content, useState, hasPdf, robotType, readType, projectIds);
numPerPage, content, useState, hasPdf, robotType, readType, projectIds, agentId);
List<Long> bookIds = customPlanList.stream().filter(a -> null != a.getBookId()).map(a -> a.getBookId()).distinct().collect(Collectors.toList());
Map<Long, String> bookNameMap = new HashMap<>();
if(!ListUtils.isEmpty(bookIds)){
......@@ -396,7 +396,7 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
}
@Override
public PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content) {
public PageBeanNew<CustomPlanPaperVO> listPlanPaperByPage(Integer currentPage, Integer numPerPage, Integer paperState, String content, Long agentId) {
List<Long> paperIds = new ArrayList<>();
if(paperState != null) {
paperIds = feedbackConsr.getPaperIdsByState(paperState);
......@@ -404,6 +404,7 @@ public class CustomPlanBizImpl implements CustomPlanBiz {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("paperIds", paperIds);
paramMap.put("content", content);
paramMap.put("agentId", agentId);
int count = customPlanMapper.getPlanPaperCount(paramMap);
if(count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, new ArrayList<>());
......
......@@ -63,12 +63,13 @@ public class CustomReadPlanBizImpl implements CustomReadPlanBiz {
@ParamLog("获取阅读计划列表")
@Override
public PageBeanNew<CustomReadPlan> getCustomReadPlanList(Integer currentPage, Integer numPerPage, Integer robotType) {
public PageBeanNew<CustomReadPlan> getCustomReadPlanList(Integer currentPage, Integer numPerPage, Integer robotType, Long agentId) {
if (currentPage==null||currentPage<0||numPerPage==null||numPerPage<=0){
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"分页参数有误!");
}
Map<String,Object> map=new HashMap<>();
map.put("robotType",robotType);
map.put("agentId", agentId);
PageBeanNew<CustomReadPlan> pageNew = customReadPlanDao.listPageNew(new PageParam(currentPage, numPerPage), map , "getCustomReadPlanList");
if (ListUtils.isEmpty(pageNew.getRecordList())){
return pageNew;
......@@ -126,6 +127,7 @@ public class CustomReadPlanBizImpl implements CustomReadPlanBiz {
newCus.setRobotType(customReadPlan.getRobotType());
newCus.setDetail(customReadPlan.getDetail());
newCus.setName(customReadPlan.getName());
newCus.setAgentId(customReadPlan.getAgentId());
newCus.setCustomReadPlanPeriods(customReadPlan.getCustomReadPlanPeriods());
addCustomReadPlan(newCus);
return customReadPlan.getId();
......
......@@ -75,4 +75,7 @@ public class CustomPlan {
@ApiModelProperty("读书计划id")
private Integer pcloudSkillId;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -26,4 +26,6 @@ public class CustomReadPlan extends BaseEntity {
@ApiModelProperty("周期集合")
private List<CustomReadPlanPeriod> customReadPlanPeriods;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -49,6 +49,9 @@ public class CustomPlanFacade {
@ApiOperation("创建定制方案")
@PostMapping("createCustomPlan")
ResponseDto<?> createCustomPlan(@RequestHeader String token, @RequestBody CustomPlan customPlan) {
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
customPlan.setAgentId(agentId==null?0L:agentId);
return new ResponseDto<>(customPlanBiz.createCustomPlan(customPlan));
}
......@@ -93,7 +96,9 @@ public class CustomPlanFacade {
@RequestParam(value = "robotType", required = false) Integer robotType,
@RequestParam(value = "readType", required = false) Integer readType,
@RequestParam(value = "erpBookName", required = false) String erpBookName) {
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState, hasPdf,robotType, readType, erpBookName));
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(customPlanBiz.listCustomPlanByPage(currentPage, numPerPage, content, useState, hasPdf,robotType, readType, erpBookName, agentId));
}
@ApiOperation("编辑方案模块")
......@@ -120,7 +125,9 @@ public class CustomPlanFacade {
ResponseDto<?> listPlanPaperByPage(@RequestHeader String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "paperState", required = false) Integer paperState,
@RequestParam(value = "content", required = false) String content) {
return new ResponseDto<>(customPlanBiz.listPlanPaperByPage(currentPage, numPerPage, paperState, content));
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(customPlanBiz.listPlanPaperByPage(currentPage, numPerPage, paperState, content, agentId));
}
@ApiOperation("作品或应用链接转短链")
......@@ -212,7 +219,9 @@ public class CustomPlanFacade {
@RequestHeader("token") String token,
@RequestBody CustomReadPlan customReadPlan
)throws BizException, PermissionException{
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
customReadPlan.setAgentId(agentId==null?0L:agentId);
return new ResponseDto<>(customReadPlanBiz.addCustomReadPlan(customReadPlan));
}
......@@ -246,8 +255,9 @@ public class CustomPlanFacade {
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam(value = "robotType",required = false) Integer robotType
)throws BizException, PermissionException{
SessionUtil.getToken4Redis(token);
return new ResponseDto<>(customReadPlanBiz.getCustomReadPlanList(currentPage,numPerPage,robotType));
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(customReadPlanBiz.getCustomReadPlanList(currentPage,numPerPage,robotType,agentId));
}
@ApiOperation("根据id获取阅读计划")
......
......@@ -22,11 +22,14 @@ public interface CustomPlanMapper {
void deleteById(@Param("id") Integer id);
int getCustomPlanCount(@Param("content") String content, @Param("useState") Integer useState, @Param("hasPdf") Integer hasPdf,
@Param("robotType") Integer robotType, @Param("readType") Integer readType,@Param("projectIds") List<Long> projectIds);
@Param("robotType") Integer robotType, @Param("readType") Integer readType,@Param("projectIds") List<Long> projectIds,
@Param("agentId") Long agentId);
List<CustomPlan> listCustomPlanByPage(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("content") String content, @Param("useState") Integer useState,
List<CustomPlan> listCustomPlanByPage(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage,
@Param("content") String content, @Param("useState") Integer useState,
@Param("hasPdf") Integer hasPdf, @Param("robotType") Integer robotType,
@Param("readType") Integer readType,@Param("projectIds") List<Long> projectIds);
@Param("readType") Integer readType,@Param("projectIds") List<Long> projectIds,
@Param("agentId") Long agentId);
int getPlanPaperCount(Map<String, Object> paramMap);
......
......@@ -26,4 +26,6 @@ public class CustomPlanPaperVO {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private Long agentId;
}
\ No newline at end of file
......@@ -947,4 +947,13 @@ public interface BookGroupBiz {
* * @param null
*/
public Long getAccountSettingByAdviser(Long adviserId);
String getGroupNewsMaterialById(Long bookGroupQrcodeId, Long classifyId);
/**
* 出版社社群书数量
* @author:zhuyajie
* @date:2020/7/29 10:40
* * @param null
*/
Integer getBookGroupCountByAgent(Integer joinGroupType, Long agentId);
}
......@@ -4908,7 +4908,7 @@ public class BookGroupBizImpl implements BookGroupBiz {
}
@Override
public BookGroupDTO getByAppletScene( Long wechatUserId, String scene ) {
public BookGroupDTO getByAppletScene( Long wechatUserId, String scene) {
BookGroupDTO dto = new BookGroupDTO();
BookAppletScene bookAppletScene = bookAppletSceneDao.getByAppletId(scene);
if (null == bookAppletScene) {
......@@ -5525,6 +5525,11 @@ public class BookGroupBizImpl implements BookGroupBiz {
return accountSettingId;
}
@Override
public Integer getBookGroupCountByAgent(Integer joinGroupType, Long agentId) {
return bookGroupDao.getBookGroupCountByAgent(joinGroupType,agentId);
}
@Override
public BookGroupDTO getMaxScanCountBookGroup(Long agentId, Integer joinGroupType) {
......
......@@ -354,4 +354,12 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* * @param null
*/
List<BookGroupDTO> getBookGroupByAdviser(Long adviserId, Integer joinGroupType);
/**
* 出版社下社群书数量
* @author:zhuyajie
* @date:2020/7/29 10:42
* * @param null
*/
Integer getBookGroupCountByAgent(Integer joinGroupType, Long agentId);
}
......@@ -446,4 +446,12 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
map.put("joinGroupType", joinGroupType);
return getSessionTemplate().selectList(getStatement("getBookGroupByAdviser"), map);
}
@Override
public Integer getBookGroupCountByAgent(Integer joinGroupType, Long agentId) {
Map<String,Object> map = new HashMap<>();
map.put("agentId", agentId);
map.put("joinGroupType", joinGroupType);
return getSessionTemplate().selectOne(getStatement("getBookGroupCountByAgent"), map);
}
}
......@@ -17,9 +17,9 @@ public interface BookBrowseRecordBiz {
void addBookRecord4BookId(BookBrowseRecord bookBrowseRecord);
List<BookMapStatistics> getBookCount4Country(String regionCode);
List<BookMapStatistics> getBookCount4Country(String regionCode, Long agentId);
AreaStatistics getAreaStatistics(String regionCode, Integer areaCode);
AreaStatistics getAreaStatistics(String regionCode, Integer areaCode, Long agentId);
PageBeanNew<BookDetail> getBookDetail(String regionCode, Integer areaCode, PageParam pageParam,
String bookName, Long agentId, Long bookClassifyId);
......
......@@ -161,18 +161,26 @@ public class BookBrowseRecordBizImpl implements BookBrowseRecordBiz {
@Override
@ParamLog("获取全国的书刊统计数据")
public List<BookMapStatistics> getBookCount4Country(String regionCode) {
return bookBrowseRecordDAO.getBookCount4Country(regionCode);
public List<BookMapStatistics> getBookCount4Country(String regionCode, Long agentId) {
List<Long> adviserIds = new ArrayList<>();
if (null != agentId && agentId>0){
adviserIds = adviserConsr.getByAgentId(agentId);
}
return bookBrowseRecordDAO.getBookCount4Country(regionCode, adviserIds);
}
@Override
@ParamLog("获取某个地区的分类统计信息")
public AreaStatistics getAreaStatistics(String regionCode, Integer areaCode) {
AreaStatistics areaStatistics = bookBrowseRecordDAO.getAreaStatistics(regionCode, areaCode);
public AreaStatistics getAreaStatistics(String regionCode, Integer areaCode, Long agentId) {
List<Long> adviserIds = new ArrayList<>();
if (null != agentId && agentId>0){
adviserIds = adviserConsr.getByAgentId(agentId);
}
AreaStatistics areaStatistics = bookBrowseRecordDAO.getAreaStatistics(regionCode, areaCode, adviserIds);
if (null == areaStatistics) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR,"数据库没有数据");
}
List<ClassifyStatistics> classifyStatisticsList = bookBrowseRecordDAO.getClassifyStatistics(regionCode, areaCode);
List<ClassifyStatistics> classifyStatisticsList = bookBrowseRecordDAO.getClassifyStatistics(regionCode, areaCode, adviserIds);
areaStatistics.setClassifyStatisticsList(classifyStatisticsList);
return areaStatistics;
}
......
......@@ -21,11 +21,11 @@ public interface BookBrowseRecordDAO extends BaseDao<BookBrowseRecord> {
int updateByPrimaryKey(BookBrowseRecord record);
List<BookMapStatistics> getBookCount4Country(String regionCode);
List<BookMapStatistics> getBookCount4Country(String regionCode, List<Long> adviserIds);
AreaStatistics getAreaStatistics(String regionCode, Integer areaCode);
AreaStatistics getAreaStatistics(String regionCode, Integer areaCode, List<Long> adviserIds);
List<ClassifyStatistics> getClassifyStatistics(String regionCode, Integer areaCode);
List<ClassifyStatistics> getClassifyStatistics(String regionCode, Integer areaCode, List<Long> adviserIds);
void getBookDetail(Map<String, Object> paramMap);
}
......@@ -48,23 +48,28 @@ public class BookBrowseRecordDAOImpl extends BaseDaoImpl<BookBrowseRecord> imple
}
@Override
public List<BookMapStatistics> getBookCount4Country(String regionCode) {
return getSessionTemplate().selectList(getStatement("getBookCount4Country"), regionCode);
public List<BookMapStatistics> getBookCount4Country(String regionCode, List<Long> adviserIds) {
Map<String,Object> map = new HashMap<>();
map.put("regionCode", regionCode);
map.put("adviserIds", adviserIds);
return getSessionTemplate().selectList(getStatement("getBookCount4Country"), map);
}
@Override
public AreaStatistics getAreaStatistics(String regionCode, Integer areaCode) {
public AreaStatistics getAreaStatistics(String regionCode, Integer areaCode, List<Long> adviserIds) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("regionCode", regionCode);
paramMap.put("areaCode", areaCode);
paramMap.put("adviserIds", adviserIds);
return getSessionTemplate().selectOne(getStatement("getAreaStatistics"), paramMap);
}
@Override
public List<ClassifyStatistics> getClassifyStatistics(String regionCode, Integer areaCode) {
public List<ClassifyStatistics> getClassifyStatistics(String regionCode, Integer areaCode, List<Long> adviserIds) {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("regionCode", regionCode);
paramMap.put("areaCode", areaCode);
paramMap.put("adviserIds", adviserIds);
return getSessionTemplate().selectList(getStatement("getClassifyStatistics"), paramMap);
}
......
......@@ -45,23 +45,25 @@ public class BookBrowseRecordFacade {
@GetMapping("getBookCount")
public ResponseDto<List<BookMapStatistics>> getBookCount4Country(@RequestHeader("token") String token,
@RequestParam(value = "regionCode",required = false) String regionCode) {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (Objects.equals(BookConstant.countryRegionCode, regionCode)){
regionCode = null;
}
return new ResponseDto<List<BookMapStatistics>>(bookBrowseRecordBiz.getBookCount4Country(regionCode));
return new ResponseDto<List<BookMapStatistics>>(bookBrowseRecordBiz.getBookCount4Country(regionCode, agentId));
}
@GetMapping("getAreaStatistics")
public ResponseDto<AreaStatistics> getAreaStatistics(@RequestHeader("token") String token,
@RequestParam(value = "regionCode" ,required = false) String regionCode,
@RequestParam("areaCode") Integer areaCode) {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
if (Objects.equals(BookConstant.countryRegionCode, regionCode)){
areaCode = BookConstant.countryAreaCode;
regionCode = null;
}
return new ResponseDto<AreaStatistics>(bookBrowseRecordBiz.getAreaStatistics(regionCode, areaCode));
return new ResponseDto<AreaStatistics>(bookBrowseRecordBiz.getAreaStatistics(regionCode, areaCode, agentId));
}
@GetMapping("getBookDetail")
......
......@@ -34,6 +34,7 @@ import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.erp.ErpConsr;
import com.pcloud.book.consumer.reader.ReaderConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.book.cultivate.enums.ReadTypeEnum;
import com.pcloud.book.custom.biz.CustomPlanBiz;
import com.pcloud.book.custom.entity.CustomPlan;
......@@ -206,6 +207,8 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
private PersonalAppletsDao personalAppletsDao;
@Autowired
private AppletBooklistBiz appletBooklistBiz;
@Autowired
private AdviserConsr adviserConsr;
@Override
@ParamLog("新增权益设置")
......@@ -1536,6 +1539,13 @@ public class RightsSettingBizImpl implements RightsSettingBiz {
PageBeanNew<RightsSettingDto> rightsSettingDtoPageBeanNew;
if (rightsSetting.getRightsSettingType() == 2) {//书刊权益
paramMap.put("bookQuery", rightsSetting.getBookQuery());
Long agentId = rightsSetting.getAgentId();
if (null != agentId && agentId>0){
List<Long> adviserIds = adviserConsr.getByAgentId(agentId);
if (!ListUtils.isEmpty(adviserIds)){
paramMap.put("adviserIds", adviserIds);
}
}
rightsSettingDtoPageBeanNew = rightsSettingDAO
.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "listBookRightsSettingPage");
} else {
......
......@@ -34,4 +34,6 @@ public class RightsSettingDto extends RightsSetting {
private String volLabelContent;
private String verLabelContent;
private Long agentId;
}
......@@ -150,6 +150,9 @@ public class RightsSetting extends BaseTempletClassify {
@ApiModelProperty("上下架状态")
private Boolean showState;
private Long agentId;
public RightsSetting() {
......
......@@ -47,7 +47,9 @@ public class RightsSettingFacede {
@PostMapping("addRightsSetting")
public ResponseDto<Long> addRightsSetting( @RequestHeader("token") String token,
@RequestBody @Validated RightsSetting rightsSetting ) throws PermissionException {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
rightsSetting.setAgentId(agentId==null?0L:agentId);
return new ResponseDto<Long>(rightsSettingBiz.addRightsSetting(rightsSetting));
}
......@@ -87,7 +89,8 @@ public class RightsSettingFacede {
@RequestParam(value = "verLabelId", required = false) Long verLabelId
) throws PermissionException {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
RightsSetting rightsSetting = new RightsSetting();
rightsSetting.setFirstClassify(firstClassify);
rightsSetting.setSecondClassify(secondClassify);
......@@ -96,6 +99,7 @@ public class RightsSettingFacede {
rightsSetting.setRightsSettingType(rightsSettingType);
rightsSetting.setBookQuery(bookQuery);
rightsSetting.setVolLabelId(volLabelId);
rightsSetting.setAgentId(agentId);
rightsSetting.setVerLabelId(verLabelId);
return new ResponseDto<PageBeanNew<RightsSettingDto>>(rightsSettingBiz.listRightsSettingPage(currentPage, numPerPage, rightsSetting));
}
......
......@@ -10,7 +10,7 @@ public interface PcloudSkillBiz {
PcloudSkill getPcloudSkill(Long id);
PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name, String taskName);
PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name, String taskName, Long agentId);
void deletePcloudSkill(Long id);
......
......@@ -124,7 +124,7 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
@ParamLog("获取技能列表")
@Override
public PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name, String taskName) {
public PageBeanNew<PcloudSkill> getPcloudSkillList(Integer skillType, Integer currentPage, Integer numPerPage, String name, String taskName, Long agentId) {
if (currentPage == null || currentPage < 0) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "当前页不能为空且不能小于0!");
}
......@@ -135,6 +135,7 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
map.put("skillType",skillType);
map.put("name", name);
map.put("taskName", taskName);
map.put("agentId", agentId);
PageBeanNew<PcloudSkill> page = pcloudSkillDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getPcloudSkillList");
if (ListUtils.isEmpty(page.getRecordList())){
return page;
......
......@@ -41,4 +41,6 @@ public class PcloudSkill extends BaseEntity {
@ApiModelProperty("技能简介文字")
private String detailString;
@ApiModelProperty("出版社id")
private Long agentId;
}
......@@ -12,6 +12,8 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Map;
@Api("技能")
@RestController("pcloudSkillFacade")
@RequestMapping("pcloudSkill")
......@@ -26,7 +28,9 @@ public class PcloudSkillFacade {
@RequestHeader("token") @ApiParam("token信息") String token,
@RequestBody @ApiParam("技能模型") PcloudSkill pcloudSkill
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
pcloudSkill.setAgentId(agentId == null?0L:agentId);
pcloudSkillBiz.createPcloudSkill(pcloudSkill);
return new ResponseDto<>();
}
......@@ -62,8 +66,9 @@ public class PcloudSkillFacade {
@RequestParam(value = "name", required = false) @ApiParam("名称搜索")String name,
@RequestParam(value = "taskName", required = false) @ApiParam("任务名搜索")String taskName
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage,name, taskName));
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
return new ResponseDto<>(pcloudSkillBiz.getPcloudSkillList(skillType,currentPage,numPerPage,name, taskName, agentId));
}
@ApiOperation("获取技能列表-关联关键词选择")
......
......@@ -32,7 +32,7 @@ public interface TaskBiz {
TaskDto getTaskById(Integer taskId);
PageBeanNew<TaskDto> listTask4Pcloud(Integer currentPage, Integer numPerPage, String search);
PageBeanNew<TaskDto> listTask4Pcloud(Integer currentPage, Integer numPerPage, String search, Long agentId);
Integer createTaskItem(CreateTaskItemDto createTaskItemDto);
......
......@@ -14,17 +14,17 @@ import java.util.List;
*/
public interface TaskCompletedBiz {
PageBeanNew<TaskCompletedDto> listTaskCompleted4Pcloud(Integer currentPage, Integer numPerPage, String taskName, Integer proLabelId, Integer depLabelId, Integer purLabelId);
PageBeanNew<TaskCompletedDto> listTaskCompleted4Pcloud(Integer currentPage, Integer numPerPage, String taskName, Integer proLabelId, Integer depLabelId, Integer purLabelId,Long agentId);
PageBeanNew<SubscribeTaskUserDTO> listTaskSubscribeUser4Pcloud(Integer currentPage, Integer numPerPage, String search, Integer taskId,Integer subscribeType);
PageBeanNew<TaskItemSendDto> listTaskItemSendRecord4Pcloud(Integer currentPage, Integer numPerPage, String startTime, String endTime, String robotWxId, String taskName, String sendContent, String search);
PageBeanNew<TaskItemSendDto> listTaskItemSendRecord4Pcloud(Integer currentPage, Integer numPerPage, String startTime, String endTime, String robotWxId, String taskName, String sendContent, String search, Long agentId);
PageBeanNew<TaskSendUserDto> listTaskItemSendUser4Pcloud(Integer currentPage, Integer numPerPage, Integer taskItemId, String search, String robotWxId, String startTime, String endTime);
TodayTaskSendDto getTodayTaskSend();
TodayTaskSendDto getTodayTaskSend(Long agentId);
List<String> getTaskSendDateList(String date);
List<String> getTaskSendDateList(String date, Long agentId);
TaskProgressDTO getUserTaskProgress(Integer taskId, String wxUserId) throws BizException;
}
......@@ -207,13 +207,13 @@ public class TaskBizImpl implements TaskBiz {
}
@Override
public PageBeanNew<TaskDto> listTask4Pcloud(Integer currentPage, Integer numPerPage, String search) {
public PageBeanNew<TaskDto> listTask4Pcloud(Integer currentPage, Integer numPerPage, String search, Long agentId) {
List<TaskDto> list = new ArrayList<>();
Integer count = taskMapper.getTaskCount(search);
Integer count = taskMapper.getTaskCount(search, agentId);
if (count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, list);
}
list = taskMapper.listTask4Pcloud(currentPage * numPerPage, numPerPage, search);
list = taskMapper.listTask4Pcloud(currentPage * numPerPage, numPerPage, search, agentId);
// 封装标签 统计数据
Set<Long> labelSet = new HashSet<>();
......
......@@ -84,14 +84,14 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
@Override
public PageBeanNew<TaskCompletedDto> listTaskCompleted4Pcloud(Integer currentPage, Integer numPerPage, String taskName, Integer proLabelId, Integer depLabelId, Integer purLabelId) {
public PageBeanNew<TaskCompletedDto> listTaskCompleted4Pcloud(Integer currentPage, Integer numPerPage, String taskName, Integer proLabelId, Integer depLabelId, Integer purLabelId, Long agentId) {
List<TaskCompletedDto> list = new ArrayList<>();
Integer count = taskMapper.getTaskCompletedCount(taskName, proLabelId, depLabelId, purLabelId);
Integer count = taskMapper.getTaskCompletedCount(taskName, proLabelId, depLabelId, purLabelId, agentId);
if (count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
list = taskMapper.listTaskCompleted4Pcloud(currentPage * numPerPage, numPerPage,taskName, proLabelId, depLabelId, purLabelId);
list = taskMapper.listTaskCompleted4Pcloud(currentPage * numPerPage, numPerPage,taskName, proLabelId, depLabelId, purLabelId, agentId);
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
......@@ -150,14 +150,14 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
}
@Override
public PageBeanNew<TaskItemSendDto> listTaskItemSendRecord4Pcloud(Integer currentPage, Integer numPerPage, String startTime, String endTime, String robotWxId, String taskName, String sendContent, String search) {
public PageBeanNew<TaskItemSendDto> listTaskItemSendRecord4Pcloud(Integer currentPage, Integer numPerPage, String startTime, String endTime, String robotWxId, String taskName, String sendContent, String search, Long agentId) {
List<TaskItemSendDto> list = new ArrayList<>();
Integer count = timeControlTaskSendDetailMapper.getTaskItemSendCount(startTime,endTime,robotWxId,taskName,sendContent);
Integer count = timeControlTaskSendDetailMapper.getTaskItemSendCount(startTime,endTime,robotWxId,taskName,sendContent, agentId);
if (count <= 0) {
return new PageBeanNew<>(currentPage, numPerPage, count, list);
}
list = timeControlTaskSendDetailMapper.listTaskItemSendRecord4Pcloud(currentPage * numPerPage, numPerPage,startTime,endTime,robotWxId,taskName,sendContent);
list = timeControlTaskSendDetailMapper.listTaskItemSendRecord4Pcloud(currentPage * numPerPage, numPerPage,startTime,endTime,robotWxId,taskName,sendContent, agentId);
log.info("发送记录查询条数="+list.size());
if(ListUtils.isEmpty(list)){
return new PageBeanNew<>(currentPage, numPerPage, count, list);
......@@ -248,18 +248,18 @@ public class TaskCompletedBizImpl implements TaskCompletedBiz {
}
@Override
public TodayTaskSendDto getTodayTaskSend() {
public TodayTaskSendDto getTodayTaskSend(Long agentId) {
TodayTaskSendDto todayTaskSendDto=new TodayTaskSendDto();
Integer todayTaskSendCount = timeControlTaskSendDetailMapper.todayTaskSendCount();
Integer todayTaskNotSendCount = timeControlTaskSendMapper.todayTaskNotSendCount();
Integer todayTaskSendCount = timeControlTaskSendDetailMapper.todayTaskSendCount(agentId);
Integer todayTaskNotSendCount = timeControlTaskSendMapper.todayTaskNotSendCount(agentId);
todayTaskSendDto.setTodaySendCount(todayTaskSendCount);
todayTaskSendDto.setTodayNotSendCount(todayTaskNotSendCount);
return todayTaskSendDto;
}
@Override
public List<String> getTaskSendDateList(String date) {
List<String> taskSendDateList = timeControlTaskSendDetailMapper.getTaskSendDateList(date);
public List<String> getTaskSendDateList(String date, Long agentId) {
List<String> taskSendDateList = timeControlTaskSendDetailMapper.getTaskSendDateList(date, agentId);
/* //获取sendType=1的时间集合
List<String> taskSendDateList = timeControlTaskSendMapper.getTaskSendDateList(date);
if(ListUtils.isEmpty(taskSendDateList)){
......
......@@ -35,4 +35,5 @@ public class TimeControlTask {
//1按天发送 2按周发送
private Integer sendType;
private Long agentId;
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @date: 2020年02月07日 12:52
......@@ -51,8 +52,9 @@ public class TimeControlStatisFacadeImpl {
@RequestParam(value = "proLabelId", required = false) Integer proLabelId,
@RequestParam(value = "depLabelId", required = false) Integer depLabelId,
@RequestParam(value = "purLabelId", required = false) Integer purLabelId) throws PermissionException {
SessionUtil.getToken4Redis(token);
PageBeanNew<TaskCompletedDto> pageResult = taskCompletedBiz.listTaskCompleted4Pcloud(currentPage, numPerPage, taskName,proLabelId,depLabelId,purLabelId);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
PageBeanNew<TaskCompletedDto> pageResult = taskCompletedBiz.listTaskCompleted4Pcloud(currentPage, numPerPage, taskName,proLabelId,depLabelId,purLabelId,agentId);
return new ResponseDto<>(pageResult);
}
......@@ -72,8 +74,9 @@ public class TimeControlStatisFacadeImpl {
@GetMapping("getTodayTaskSend")
@ApiOperation(value = "获取今日消息发送信息", httpMethod = "GET")
ResponseDto<TodayTaskSendDto> getTodayTaskSend(@RequestHeader("token") String token) throws PermissionException {
SessionUtil.getToken4Redis(token);
TodayTaskSendDto todayTaskSendDto=taskCompletedBiz.getTodayTaskSend();
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
TodayTaskSendDto todayTaskSendDto=taskCompletedBiz.getTodayTaskSend(agentId);
return new ResponseDto<>(todayTaskSendDto);
}
......@@ -81,8 +84,9 @@ public class TimeControlStatisFacadeImpl {
@ApiOperation(value = "获取有发送任务的日期集合", httpMethod = "GET")
ResponseDto<List<String>> getTaskSendDateList(@RequestHeader("token") String token,
@RequestParam(value = "date") String date) throws PermissionException {
SessionUtil.getToken4Redis(token);
List<String> taskSendDateList=taskCompletedBiz.getTaskSendDateList(date);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
List<String> taskSendDateList=taskCompletedBiz.getTaskSendDateList(date, agentId);
return new ResponseDto<>(taskSendDateList);
}
......@@ -97,8 +101,9 @@ public class TimeControlStatisFacadeImpl {
@RequestParam(value = "taskName", required = false) String taskName,
@RequestParam(value = "sendContent", required = false) String sendContent,
@RequestParam(value = "search", required = false) String search) throws PermissionException {
SessionUtil.getToken4Redis(token);
PageBeanNew<TaskItemSendDto> pageResult = taskCompletedBiz.listTaskItemSendRecord4Pcloud(currentPage, numPerPage, startTime, endTime,robotWxId,taskName,sendContent,search);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
PageBeanNew<TaskItemSendDto> pageResult = taskCompletedBiz.listTaskItemSendRecord4Pcloud(currentPage, numPerPage, startTime, endTime,robotWxId,taskName,sendContent,search, agentId);
return new ResponseDto<>(pageResult);
}
......
......@@ -29,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;
/**
* @date: 2020年01月30日 11:29
......@@ -48,7 +49,9 @@ public class TimeControlTaskFacadeImpl {
@PostMapping("createTask")
@ApiOperation(value = "创建任务模板", httpMethod = "POST")
ResponseDto<Integer> createTask(@RequestHeader("token") String token, @RequestBody CreateTaskDto createTaskDto) throws PermissionException {
SessionUtil.getToken4Redis(token);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
createTaskDto.setAgentId(agentId==null?0L:agentId);
return new ResponseDto<>(taskBiz.createTask(createTaskDto));
}
......@@ -79,8 +82,10 @@ public class TimeControlTaskFacadeImpl {
@ApiOperation(value = "平台端查询任务列表", httpMethod = "GET")
ResponseDto<PageBeanNew<TaskDto>> listTask4Pcloud(@RequestHeader("token") String token, @RequestParam Integer currentPage, @RequestParam Integer numPerPage,
@RequestParam(value = "search", required = false) String search) throws PermissionException {
SessionUtil.getToken4Redis(token);
PageBeanNew<TaskDto> pageResult = taskBiz.listTask4Pcloud(currentPage, numPerPage, search);
Map<String,Object> map = SessionUtil.getToken4Redis(token);
Long agentId = (Long) map.get(SessionUtil.RAY_AGENT_ID);
PageBeanNew<TaskDto> pageResult = taskBiz.listTask4Pcloud(currentPage, numPerPage, search, agentId);
return new ResponseDto<>(pageResult);
}
......
......@@ -25,9 +25,10 @@ public interface TimeControlTaskMapper {
void updateTask(TimeControlTask timeControlTask);
Integer getTaskCount(@Param("search") String search);
Integer getTaskCount(@Param("search") String search, @Param("agentId") Long agentId);
List<TaskDto> listTask4Pcloud(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("search") String search);
List<TaskDto> listTask4Pcloud(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("search") String search,
@Param("agentId") Long agentId);
/**
* 根据 专业/深度/目的 标签查询任务模板集合
......@@ -53,11 +54,10 @@ public interface TimeControlTaskMapper {
TaskDto getTaskByIdAndWxUserId(@Param("relSkillId")Integer relSkillId, @Param("wxUserId")String wxUserId);
Integer getSubscribeState(@Param("relSkillId")Integer relSkillId, @Param("wxUserId")String wxUserId);
Integer getTaskCompletedCount(@Param("taskName") String taskName,@Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId, @Param("agentId") Long agentId);
Integer getTaskCompletedCount(@Param("taskName") String taskName,@Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId);
List<TaskCompletedDto> listTaskCompleted4Pcloud(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("taskName") String taskName, @Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId);
List<TaskCompletedDto> listTaskCompleted4Pcloud(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage, @Param("taskName") String taskName, @Param("proLabelId") Integer proLabelId, @Param("depLabelId") Integer depLabelId, @Param("purLabelId") Integer purLabelId,
@Param("agentId") Long agentId);
Integer getSubscribeCount(@Param("search") String search,@Param("taskId") Integer taskId,@Param("subscribeType") Integer subscribeType,@Param("wxIds") List<String> wxIds);
......
......@@ -21,11 +21,12 @@ public interface TimeControlTaskSendDetailMapper {
void batchInsert(List<TimeControlTaskSend> taskSendList);
Integer getTaskItemSendCount(@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("robotWxId") String robotWxId, @Param("taskName") String taskName, @Param("sendContent") String sendContent);
@Param("robotWxId") String robotWxId, @Param("taskName") String taskName, @Param("sendContent") String sendContent,
@Param("agentId") Long agentId);
List<TaskItemSendDto> listTaskItemSendRecord4Pcloud(@Param("pageNum") Integer pageNum, @Param("numPerPage") Integer numPerPage,
@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("robotWxId") String robotWxId,
@Param("taskName") String taskName, @Param("sendContent") String sendContent);
@Param("taskName") String taskName, @Param("sendContent") String sendContent, @Param("agentId") Long agentId);
Integer getTaskItemSendUserCount(@Param("wxIds") List<String> wxIds, @Param("taskItemId") Integer taskItemId,
@Param("robotWxId") String robotWxId,
......@@ -49,7 +50,7 @@ public interface TimeControlTaskSendDetailMapper {
void addSendCount(Integer id);
Integer todayTaskSendCount();
Integer todayTaskSendCount(@Param("agentId") Long agentId);
List<String> getTaskSendDateList(String date);
List<String> getTaskSendDateList(@Param("date") String date,@Param("agentId") Long agentId);
}
......@@ -43,7 +43,7 @@ public interface TimeControlTaskSendMapper {
Integer todayTaskSendCount();
Integer todayTaskNotSendCount();
Integer todayTaskNotSendCount(@Param("agentId") Long agentId);
List<String> getTaskSendDateList(@Param("date") String date);
......
......@@ -15,10 +15,11 @@
<result property="linkUrl" column="link_url" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="agentId" column="agent_id" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
id, cover_img, book_name, publish, author, isbn, remark, price, link_type, link_url, create_time, update_time
id, cover_img, book_name, publish, author, isbn, remark, price, link_type, link_url, create_time, update_time, agent_id
</sql>
<!--查询单个-->
......@@ -32,8 +33,9 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_outer_book(cover_img, book_name, publish, author, isbn, remark, price, link_type, link_url, create_time, update_time)
values (#{coverImg}, #{bookName}, #{publish}, #{author}, #{isbn}, #{remark}, #{price}, #{linkType}, #{linkUrl}, now(), now())
insert into book.applet_outer_book(cover_img, book_name, publish, author, isbn, remark, price, link_type, link_url, create_time, update_time, agent_id)
values (#{coverImg}, #{bookName}, #{publish}, #{author}, #{isbn}, #{remark}, #{price}, #{linkType}, #{linkUrl}, now(), now(),
#{agentId})
</insert>
<!--通过主键修改数据-->
......@@ -86,14 +88,30 @@
book_name like concat("%",#{name},"%") or isbn like concat("%",#{name},"%")
)
</if>
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
order by create_time desc
</select>
<select id="getAllPublish" resultType="string">
<select id="getAllPublish" resultType="string" parameterType="map">
SELECT DISTINCT publish
FROM book.applet_outer_book
WHERE
publish IS NOT NULL
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
</select>
<select id="listPageOuterBookByBooklistId" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletOuterBookDTO">
......
......@@ -11,10 +11,11 @@
<result property="publish" column="publish" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="agentId" column="agent_id" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
id, booklist_name, user_name, digest, display_pic, publish, create_time, update_time
id, booklist_name, user_name, digest, display_pic, publish, create_time, update_time, agent_id
</sql>
<!--查询单个-->
<select id="getById" resultMap="AppletOuterBooklistMap">
......@@ -26,8 +27,8 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_outer_booklist(booklist_name, user_name, digest, display_pic, publish, create_time, update_time)
values (#{booklistName}, #{userName}, #{digest}, #{displayPic}, #{publish}, now(), now())
insert into book.applet_outer_booklist(booklist_name, user_name, digest, display_pic, publish, create_time, update_time, agent_id)
values (#{booklistName}, #{userName}, #{digest}, #{displayPic}, #{publish}, now(), now(), #{agentId})
</insert>
<!--通过主键修改数据-->
......@@ -90,6 +91,14 @@
<if test="name != null">
AND b.booklist_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.create_time DESC
......@@ -103,11 +112,19 @@
SELECT COUNT(1) from applet_outer_booklist_config WHERE outer_book_id=#{outerBookId}
</select>
<select id="getOuterBooklistPublish" resultType="string">
<select id="getOuterBooklistPublish" resultType="string" parameterType="map">
SELECT DISTINCT publish
FROM applet_outer_booklist
WHERE
publish IS NOT NULL
<choose>
<when test="agentId != null">
and agent_id = #{agentId}
</when>
<otherwise>
and agent_id = 0
</otherwise>
</choose>
</select>
<select id="getBookListByBooklistId" parameterType="long" resultType="com.pcloud.book.applet.dto.AppletOuterBookDTO">
......
<?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.AppletUserDaoImpl">
<resultMap type="com.pcloud.book.applet.entity.AppletUser" id="AppletUserMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="appletId" column="applet_id" jdbcType="VARCHAR"/>
<result property="accountSettingId" column="account_setting_id" jdbcType="INTEGER"/>
<result property="wechatUserId" column="wechat_user_id" jdbcType="INTEGER"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
</resultMap>
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into book.applet_user(applet_id, account_setting_id, wechat_user_id, create_time)
values (#{appletId}, #{accountSettingId}, #{wechatUserId}, now())
</insert>
<select id="getUserCount" parameterType="map" resultType="com.pcloud.book.applet.dto.AppletUserCountDTO">
SELECT
COUNT(id) count,
COUNT(DISTINCT wechat_user_id) userCount
FROM
applet_user
WHERE
account_setting_id = #{accountSettingId}
<if test="startTime != null">
AND create_time >= #{startTime}
</if>
<if test="endTime != null">
AND create_time &lt;= #{endTime}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -730,4 +730,27 @@
GROUP BY BOOK_ID
</select>
<select id="getBookCountByTime" parameterType="map" resultType="integer">
SELECT
COUNT(DISTINCT A.BOOK_ID, A.CHANNEL_ID)
FROM
BOOK_ADVISER A
INNER JOIN
BOOK B
ON
A.BOOK_ID = B.BOOK_ID AND A.IS_DELETE = 0 AND B.IS_DELETE = 0
AND
ADVISER_ID IN
<foreach collection="adviserIds" index="i" item="item" open="(" separator="," close=")">
${item}
</foreach>
<if test="startTime != null">
AND A.CREATED_DATE >= #{startTime}
</if>
<if test="endTime != null">
AND A.CREATED_DATE &lt;= #{endTime}
</if>
AND A.IS_MAIN_EDITOR = 1
</select>
</mapper>
\ No newline at end of file
......@@ -8,10 +8,11 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="send_type" property="sendType" jdbcType="INTEGER" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List" >
message_id, message_type, title, create_time,update_time,send_type
message_id, message_type, title, create_time,update_time,send_type,agent_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.cultivate.entity.CultivateNotify" useGeneratedKeys="true" keyProperty="messageId">
......@@ -21,14 +22,16 @@
title,
create_time,
update_time,
send_type
send_type,
agent_id
)
values (
#{messageType},
#{title},
NOW(),
NOW(),
#{sendType}
#{sendType},
#{agentId}
)
</insert>
......
......@@ -130,6 +130,14 @@
<if test="keyword !=null">
and b.content like concat('%',#{keyword},'%')
</if>
<choose>
<when test="agentId != null">
and a.agent_id = #{agentId}
</when>
<otherwise>
and a.agent_id = 0
</otherwise>
</choose>
order by a.create_time DESC
</select>
......
......@@ -26,13 +26,14 @@
<result column="button_name" jdbcType="VARCHAR" property="buttonName" />
<result column="custom_time_control_id" jdbcType="INTEGER" property="customTimeControlId" />
<result column="pcloud_skill_id" property="pcloudSkillId" jdbcType="BIGINT"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<sql id="Base_Column_List">
id, plan_number, plan_name, create_user_name, description, open_feedback, paper_id,
paper_title, paper_desc, use_state, pdf_url, h5_url, preview_qrcode_url, create_time,
update_time, confirm_feedback_reply,robot_type,book_id,read_type,rights_pic,button_name,
custom_time_control_id,pcloud_skill_id
custom_time_control_id,pcloud_skill_id,agent_id
</sql>
<insert id="insert" parameterType="CustomPlan" useGeneratedKeys="true" keyProperty="id">
......@@ -41,12 +42,14 @@
paper_title, paper_desc, use_state,
pdf_url, h5_url, preview_qrcode_url,
create_time, update_time, confirm_feedback_reply,robot_type,
book_id,read_type,rights_pic,button_name,custom_time_control_id,pcloud_skill_id)
book_id,read_type,rights_pic,button_name,custom_time_control_id,pcloud_skill_id,
agent_id)
values (#{planNumber,jdbcType=VARCHAR}, #{planName,jdbcType=VARCHAR}, #{createUserName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{openFeedback,jdbcType=INTEGER}, #{paperId,jdbcType=INTEGER},
#{paperTitle,jdbcType=VARCHAR}, #{paperDesc,jdbcType=VARCHAR}, #{useState,jdbcType=INTEGER},
#{pdfUrl,jdbcType=VARCHAR}, #{h5Url,jdbcType=VARCHAR}, #{previewQrcodeUrl,jdbcType=VARCHAR},
NOW(), NOW(), #{confirmFeedbackReply},#{robotType},#{bookId},#{readType},#{rightsPic},#{buttonName},#{customTimeControlId},#{pcloudSkillId})
NOW(), NOW(), #{confirmFeedbackReply},#{robotType},#{bookId},#{readType},#{rightsPic},#{buttonName},#{customTimeControlId},#{pcloudSkillId},
#{agentId})
</insert>
<update id="update" parameterType="CustomPlan">
......@@ -158,13 +161,17 @@
${item}
</foreach>
</if>
<if test="agentId != null">
AND a.agent_id = #{agentId}
</if>
</select>
<select id="listCustomPlanByPage" resultMap="BaseResultMap">
select
a.id, plan_number, plan_name, create_user_name, description, a.open_feedback,
use_state, pdf_url, h5_url, preview_qrcode_url, a.create_time, COUNT(DISTINCT b.batch_id) suggestion_count,
a.robot_type,t.classify_name robotTypeName, a.read_type,a.book_id ,a.rights_pic ,a.button_name
a.robot_type,t.classify_name robotTypeName, a.read_type,a.book_id ,a.rights_pic ,a.button_name,
a.agent_id
from custom_plan a left join custom_plan_module_suggestion b
on a.id = b.plan_id
left join pcloud_robot_classify t on a.robot_type = t.id
......@@ -192,6 +199,9 @@
${item}
</foreach>
</if>
<if test="agentId != null">
AND a.agent_id = #{agentId}
</if>
GROUP BY a.id
ORDER BY a.update_time DESC
LIMIT #{pageNum}, #{numPerPage}
......@@ -213,6 +223,9 @@
${item}
</foreach>
</if>
<if test="agentId != null">
AND agent_id = #{agentId}
</if>
</select>
<select id="listPlanPaperByPage" parameterType="map" resultType="CustomPlanPaperVO">
......@@ -222,7 +235,8 @@
plan_name planName,
paper_id paperId,
paper_title paperTitle,
create_time createTime
create_time createTime,
agent_id agentId
from custom_plan
where open_feedback = 1
and paper_id is not null
......@@ -236,6 +250,9 @@
${item}
</foreach>
</if>
<if test="agentId != null">
AND agent_id = #{agentId}
</if>
ORDER BY update_time DESC
LIMIT #{pageNum}, #{numPerPage}
</select>
......
......@@ -8,17 +8,18 @@
<result column="detail" property="detail" jdbcType="VARCHAR" />
<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, robot_type,name,detail,create_time,update_time
id, robot_type,name,detail,create_time,update_time,agent_id
</sql>
<insert id="insert" parameterType="com.pcloud.book.custom.entity.CustomReadPlan" useGeneratedKeys="true" keyProperty="id">
insert into custom_read_plan
(robot_type,name,detail,create_time,update_time)
(robot_type,name,detail,create_time,update_time,agent_id)
values
(#{robotType},#{name},#{detail},now(),now())
(#{robotType},#{name},#{detail},now(),now(),#{agentId})
</insert>
<update id="update" parameterType="com.pcloud.book.custom.entity.CustomReadPlan">
......@@ -57,12 +58,16 @@
t1.name,
t1.detail,
t1.create_time,
t1.update_time
t1.update_time,
t1.agent_id
from custom_read_plan t1
where 1=1
<if test="robotType!=null">
and t1.robot_type=#{robotType}
</if>
<if test="agentId != null">
and t1.agent_id = #{agentId}
</if>
order by t1.create_time desc
</select>
......
......@@ -1105,4 +1105,17 @@
ORDER BY create_time DESC, id DESC
</select>
<select id="getBookGroupCountByAgent" resultType="integer" parameterType="map">
SELECT
COUNT(1)
FROM
book_group
WHERE
is_delete = 0
AND agent_id = #{agentId}
<if test="joinGroupType != null">
AND join_group_type = #{joinGroupType}
</if>
</select>
</mapper>
......@@ -32,7 +32,7 @@
from book_browse_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getBookCount4Country" resultType="com.pcloud.book.record.entity.BookMapStatistics" parameterType="string">
<select id="getBookCount4Country" resultType="com.pcloud.book.record.entity.BookMapStatistics" parameterType="map">
select
count((book_adviser_id)) bookCount,
province,
......@@ -41,9 +41,16 @@
city_code cityCode
from
book_browse_record
where 1=1
<if test="adviserIds != null and adviserIds.size>0">
AND adviser_id in
<foreach collection="adviserIds" item="item" index="index" separator="," close=")" open="(">
${item}
</foreach>
</if>
<choose>
<when test="_parameter != null">
where province_code = #{_parameter}
<when test="regionCode != null">
AND province_code = #{regionCode}
group by city_code
order by bookCount desc, city_code asc
</when>
......@@ -68,6 +75,12 @@
city_code = #{regionCode}
</when>
</choose>
<if test="adviserIds != null and adviserIds.size>0">
AND adviser_id in
<foreach collection="adviserIds" item="item" index="index" separator="," close=")" open="(">
${item}
</foreach>
</if>
</where>
</select>
<select id="getClassifyStatistics" resultType="com.pcloud.book.record.entity.ClassifyStatistics" parameterType="map">
......@@ -88,6 +101,12 @@
city_code = #{regionCode}
</when>
</choose>
<if test="adviserIds != null and adviserIds.size>0">
AND adviser_id in
<foreach collection="adviserIds" item="item" index="index" separator="," close=")" open="(">
${item}
</foreach>
</if>
</where>
group by book_classify_id
order by bookCount desc
......
......@@ -28,6 +28,7 @@
<result column="guide_pic" property="guidePic" jdbcType="VARCHAR" />
<result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" />
<result column="show_state" property="showState" jdbcType="BOOLEAN"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="DtoResultMap" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto">
......@@ -53,6 +54,7 @@
<result column="vol_label_id" property="volLabelId" jdbcType="BIGINT" />
<result column="ver_label_id" property="verLabelId" jdbcType="BIGINT" />
<result column="show_state" property="showState" jdbcType="BOOLEAN" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="DtoResultMap4Book" type="com.pcloud.book.rightsSetting.dto.RightsSettingDto" extends="DtoResultMap">
......@@ -64,7 +66,7 @@
id,rights_number, introduce, detail, count, first_classify, second_classify, grade_label_id, subject_label_id,
create_time, update_time, enable_group_service, rights_setting_type, book_id
,online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, show_state, agent_id
</sql>
<sql id="Base_Column_List_own" >
......@@ -95,13 +97,13 @@
grade_label_id, subject_label_id, create_time,
update_time, enable_group_service, rights_setting_type, book_id,
online_course_open,learning_tool_open,draw_open,read_type_title, vol_label_id,
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id)
reading_guide,guide_title,guide_type,guide_id,guide_pic,ver_label_id, agent_id)
values ( #{rightsNumber,jdbcType=VARCHAR}, #{introduce,jdbcType=VARCHAR}, #{detail,jdbcType=VARCHAR},
#{count,jdbcType=INTEGER}, #{firstClassify,jdbcType=BIGINT}, #{secondClassify,jdbcType=BIGINT},
#{gradeLabelId,jdbcType=BIGINT}, #{subjectLabelId,jdbcType=BIGINT}, now(),
#{updateTime,jdbcType=TIMESTAMP}, #{enableGroupService}, #{rightsSettingType}, #{bookId},
#{onlineCourseOpen},#{learningToolOpen},#{drawNowOpen},#{readTypeTitle}, #{volLabelId},
#{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic}, #{verLabelId})
#{guideIsOpen},#{guideTitle},#{guideType},#{guideId},#{guidePic}, #{verLabelId}, #{agentId})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.rightsSetting.entity.RightsSetting" >
update rights_setting
......@@ -263,11 +265,18 @@
rights_setting r
left join rights_setting_book_relation s on r.id = s.rights_setting_id
LEFT JOIN book b ON s.book_id=b.BOOK_ID
INNER JOIN book_adviser a ON b.BOOK_ID=a.BOOK_ID AND a.IS_DELETE=0
WHERE
r.rights_setting_type = 2
<if test="bookQuery !=null">
AND (b.BOOK_NAME LIKE CONCAT("%",#{bookQuery},"%") OR b.ISBN LIKE CONCAT("%",#{bookQuery},"%"))
</if>
<if test="adviserIds != null and adviserIds.size>0">
AND a.ADVISER_ID in
<foreach collection="adviserIds" item="item" index="index" separator="," open="(" close=")">
${item}
</foreach>
</if>
group by r.id
order by r.create_time desc
</select>
......
......@@ -8,10 +8,11 @@
<result column="skill_fuse_reply" property="skillFuseReply" jdbcType="VARCHAR"/>
<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, skill_type, rel_skill_id, skill_fuse_reply, seq_num, create_time
id, skill_type, rel_skill_id, skill_fuse_reply, seq_num, create_time, agent_id
</sql>
<sql id="Column_List_Skill">
......@@ -37,14 +38,16 @@
rel_skill_id,
skill_fuse_reply,
seq_num,
create_time
create_time,
agent_id
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{skillType,jdbcType=INTEGER},
#{relSkillId,jdbcType=BIGINT},
#{skillFuseReply,jdbcType=VARCHAR},
#{seqNum,jdbcType=INTEGER},
NOW()
NOW(),
#{agentId}
</trim>
</insert>
......@@ -74,7 +77,8 @@
s.rel_skill_id,
s.skill_fuse_reply,
s.seq_num,
s.create_time
s.create_time,
s.agent_id
FROM
pcloud_skill s
LEFT JOIN time_control_task t ON s.rel_skill_id = t.task_id
......@@ -97,6 +101,9 @@
<if test="taskName != null">
and t.task_name like concat('%', #{taskName}, '%')
</if>
<if test="agentId != null">
and s.agent_id = #{agentId}
</if>
order by s.seq_num DESC,s.create_time DESC
</select>
......
......@@ -16,6 +16,7 @@
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="send_type" property="sendType" jdbcType="TINYINT" />
<result column="agent_id" property="agentId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="TaskDtoMap" type="com.pcloud.book.timecontrol.dto.TaskDto" >
......@@ -31,7 +32,7 @@
</resultMap>
<sql id="Base_Column_List" >
task_id, task_name, task_introduce, task_key_word, subscribe_word, advanced_setting,
create_time, update_time, pro_label_id, dep_label_id, pur_label_id, success_subscribe_word, success_unsubscribe_word,send_type
create_time, update_time, pro_label_id, dep_label_id, pur_label_id, success_subscribe_word, success_unsubscribe_word,send_type, agent_id
</sql>
<update id="updateTask" parameterType="com.pcloud.book.timecontrol.entity.TimeControlTask">
......@@ -64,6 +65,9 @@
<if test="search != null">
and task_name like concat('%', #{search}, '%')
</if>
<if test="agentId != null">
and agent_id = #{agentId}
</if>
</select>
<select id="listTask4Pcloud" resultType="com.pcloud.book.timecontrol.dto.TaskDto">
......@@ -75,7 +79,8 @@
a.pur_label_id purLabelId,
a.pro_label_id proLabelId,
a.dep_label_id depLabelId,
a.send_type sendType
a.send_type sendType,
a.agent_id agentId
FROM
time_control_task a
LEFT JOIN time_control_task_item b ON a.task_id = b.task_id
......@@ -83,6 +88,9 @@
<if test="search != null">
and task_name like concat('%', #{search}, '%')
</if>
<if test="agentId != null">
and a.agent_id = #{agentId}
</if>
GROUP BY
a.task_id
order by a.create_time desc
......@@ -238,10 +246,12 @@
insert into time_control_task (task_name, task_introduce,
task_key_word, subscribe_word, advanced_setting,
create_time, update_time, pro_label_id, dep_label_id, pur_label_id, success_subscribe_word,
success_unsubscribe_word,send_type)
success_unsubscribe_word,send_type,
agent_id)
values (#{taskName,jdbcType=VARCHAR}, #{taskIntroduce,jdbcType=VARCHAR},
#{taskKeyWord,jdbcType=VARCHAR}, #{subscribeWord,jdbcType=VARCHAR}, #{advancedSetting,jdbcType=INTEGER},
now(), now(), #{proLabelId}, #{depLabelId}, #{purLabelId}, #{successSubscribeWord}, #{successUnSubscribeWord}, ifnull(#{sendType},2))
now(), now(), #{proLabelId}, #{depLabelId}, #{purLabelId}, #{successSubscribeWord}, #{successUnSubscribeWord}, ifnull(#{sendType},2),
#{agentId})
</insert>
<select id="getTaskCompletedCount" resultType="java.lang.Integer">
......@@ -260,6 +270,9 @@
<if test="purLabelId != null">
AND a.pur_label_id = #{purLabelId}
</if>
<if test="agentId != null">
and a.agent_id = #{agentId}
</if>
</select>
<select id="listTaskCompleted4Pcloud" resultType="com.pcloud.book.timecontrol.dto.TaskCompletedDto">
......@@ -268,7 +281,8 @@
a.task_name taskName,
a.send_type sendType,
COUNT(distinct c.id) taskItemCount,
COUNT(DISTINCT d.wx_user_id) subscribePersonCount
COUNT(DISTINCT d.wx_user_id) subscribePersonCount,
a.agent_id agentId
FROM time_control_task a
LEFT JOIN time_control_task_item c ON a.task_id = c.task_id
LEFT JOIN time_control_task_subscribe d on a.task_id=d.task_id
......@@ -285,6 +299,9 @@
<if test="purLabelId != null">
AND a.pur_label_id = #{purLabelId}
</if>
<if test="agentId != null">
and a.agent_id = #{agentId}
</if>
GROUP BY
a.task_id
<if test="pageNum != null">
......
......@@ -61,6 +61,9 @@
<if test="sendContent !=null">
and d.content like concat('%', #{sendContent}, '%')
</if>
<if test="agentId != null">
and b.agent_id = #{agentId}
</if>
group by
a.task_item_id,c.robot_wx_id
)s
......@@ -73,7 +76,8 @@
a.task_item_id taskItemId,
c.robot_wx_id robotWxId,
ifnull(count(DISTINCT a.wx_user_id),0) sendPersonCount,
e.create_time createTime
e.create_time createTime,
b.agent_id agentId
from
time_control_task_send_detail a LEFT JOIN
time_control_task b on a.task_id=b.task_id
......@@ -96,6 +100,9 @@
<if test="sendContent !=null">
and d.content like concat('%', #{sendContent}, '%')
</if>
<if test="agentId != null">
and b.agent_id = #{agentId}
</if>
GROUP BY
a.task_item_id,c.robot_wx_id
<if test="pageNum != null">
......@@ -243,8 +250,17 @@
</select>
<select id="todayTaskSendCount" resultType="java.lang.Integer">
SELECT ifnull(COUNT(1),0) FROM time_control_task_send_detail WHERE send_state = 1
AND send_day =DATE_FORMAT(NOW(), '%Y-%m-%d')
SELECT
ifnull(COUNT(d.id), 0)
FROM
time_control_task_send_detail d
LEFT JOIN time_control_task t ON d.task_id = t.task_id
WHERE
d.send_state = 1
<if test="agentId != null">
AND t.agent_id = #{agentId}
</if>
AND d.send_day = DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
<update id="addSendCount" parameterType="integer">
......@@ -257,7 +273,17 @@
</update>
<select id="getTaskSendDateList" resultType="java.lang.String">
SELECT DISTINCT send_day from time_control_task_send_detail where SUBSTRING_INDEX(send_day,"-",2)=#{date}
ORDER BY send_day
SELECT DISTINCT
s.send_day
FROM
time_control_task_send_detail s
LEFT JOIN time_control_task t ON s.task_id = t.task_id
WHERE
SUBSTRING_INDEX(s.send_day, "-", 2) = #{date}
<if test="agentId != null">
AND t.agent_id = #{agentId}
</if>
ORDER BY
s.send_day
</select>
</mapper>
\ No newline at end of file
......@@ -108,8 +108,17 @@
</select>
<select id="todayTaskNotSendCount" resultType="java.lang.Integer">
SELECT ifnull(COUNT(1),0) FROM time_control_task_send WHERE send_state = 0
AND send_day =DATE_FORMAT(NOW(), '%Y-%m-%d')
SELECT
ifnull(COUNT(s.id), 0)
FROM
time_control_task_send s
LEFT JOIN time_control_task t ON s.task_id = t.task_id
WHERE
s.send_state = 0
<if test="agentId != null">
AND t.agent_id = #{agentId}
</if>
AND s.send_day = DATE_FORMAT(NOW(), '%Y-%m-%d')
</select>
<select id="getTaskSendDateList" resultType="java.lang.String">
......
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