Commit 3923f065 by 朱亚洁

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

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