Commit c113eb6c by 阮思源

Merge branch 'wh-1002111' into 'master'

1002111运营需求:编辑端也支持个人号读者群发

See merge request rays/pcloud-book!313
parents 22e9627f e2d79d94
......@@ -583,9 +583,10 @@ public interface BookBiz {
* @param currentPage
* @param numPerPage
* @param name
* @param adviserId
* @return
*/
PageBeanNew<AdviserBookInfoDTO> getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name);
PageBeanNew<AdviserBookInfoDTO> getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name,Long adviserId);
/**
* 获取书籍标签
......@@ -602,4 +603,5 @@ public interface BookBiz {
* 导出书刊收益--出版端
*/
void exportBookIncomeDetail(Map<String, Object> paramMap, Long agentId, Long partyId, String systemCode);
}
......@@ -1777,11 +1777,14 @@ public class BookBizImpl implements BookBiz {
}
@Override
public PageBeanNew<AdviserBookInfoDTO> getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name) {
public PageBeanNew<AdviserBookInfoDTO> getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name,Long adviserId) {
Map<String, Object> paramMap = new HashMap<>();
if (!StringUtil.isEmpty(name)) {
paramMap.put("name", name);
}
if (adviserId != null) {
paramMap.put("adviserId", adviserId);
}
paramMap.put("joinGroupType", JoinGroupTypeEnum.ROBOT.getCode());
PageBeanNew<AdviserBookInfoDTO> pageBean = bookDao.listPageNew(new PageParam(currentPage, numPerPage), paramMap, "getListPage4BookGroup");
if (null == pageBean || ListUtils.isEmpty(pageBean.getRecordList())) {
......
......@@ -588,7 +588,7 @@ public interface BookFacade {
ResponseDto<PageBeanNew> listNoAuthGroupBook(@RequestHeader("token") String token,
@RequestBody ListNoAuthGroupBookParam listNoAuthGroupBookParam) throws PermissionException;
@ApiOperation("获取1v1社群书书刊列表")
@ApiOperation("平台端 获取1v1社群书书刊列表")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "currentPage", value = "当前页数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query"),
......@@ -651,4 +651,18 @@ public interface BookFacade {
@RequestParam(value = "templetId", required = false) Long templetId,
@RequestParam(value = "secondTempletId", required = false) Long secondTempletId)
throws PermissionException, BizException;
@ApiOperation("编辑端 获取1v1社群书书刊列表")
@ApiImplicitParams({@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "name",value = "书刊名称",dataType = "String",paramType = "query"),
@ApiImplicitParam(name = "currentPage", value = "当前页数", dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "numPerPage", value = "每页条数", dataType = "int", paramType = "query")
})
@RequestMapping(value = "getListPage4SelfBookGroupByAdvise", method = RequestMethod.GET)
public ResponseDto<PageBeanNew<AdviserBookInfoDTO>> getListPage4SelfBookGroupByAdvise(
@RequestHeader("token") String token,
@RequestParam(value = "name",required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
}
......@@ -824,7 +824,23 @@ public class BookFacadeImpl implements BookFacade {
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
PageBeanNew<AdviserBookInfoDTO> pageBean = bookBiz.getListPage4SelfBookGroup(currentPage, numPerPage, name);
PageBeanNew<AdviserBookInfoDTO> pageBean = bookBiz.getListPage4SelfBookGroup(currentPage, numPerPage, name,null);
return new ResponseDto<>(null == pageBean ? new PageBeanNew<>() : pageBean);
}
@Override
@RequestMapping(value = "getListPage4SelfBookGroupByAdvise", method = RequestMethod.GET)
public ResponseDto<PageBeanNew<AdviserBookInfoDTO>> getListPage4SelfBookGroupByAdvise(
@RequestHeader("token") String token,
@RequestParam(value = "name",required = false) String name,
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
if (currentPage == null || numPerPage == null || currentPage < 0 || numPerPage < 0) {
throw BookBizException.PAGE_PARAM_DELETION;
}
PageBeanNew<AdviserBookInfoDTO> pageBean = bookBiz.getListPage4SelfBookGroup(currentPage, numPerPage, name,adviserId);
return new ResponseDto<>(null == pageBean ? new PageBeanNew<>() : pageBean);
}
......
......@@ -643,13 +643,21 @@ public interface BookGroupBiz {
List<AltAndCountDTO> getAltAndCountDTOListByAgentId(Long agentId);
/**
* 个人号群发用户查询
* 平台端 个人号群发用户查询
* @param userSelectParamDTO
* @return
*/
PageBeanNew<UserBookInfoVO> listUser4SelfPush(UserSelectParamDTO userSelectParamDTO);
/**
* 编辑端 个人号群发用户查询
* @param userSelectParam
* @return
*/
PageBeanNew<UserBookInfoVO> listUser4SelfPushByAdvise(Map<String,Object> userSelectParam);
/**
* 根据类型获取社群书id集合
*/
List<Long> getBookGroupIdsByJoinGroupType(Integer joinGroupType);
......
......@@ -3779,6 +3779,33 @@ public class BookGroupBizImpl implements BookGroupBiz {
return new PageBeanNew<>(currentPage, numPerPage, countlist.size(), list);
}
@Override
public PageBeanNew<UserBookInfoVO> listUser4SelfPushByAdvise(Map<String,Object> userSelectParam) {
Integer currentPage = (Integer) userSelectParam.get("currentPage");
Integer numPerPage = (Integer) userSelectParam.get("numPerPage");
Map<String, Object> map = new HashMap<>();
//用户昵称id模糊查询
if (!StringUtil.isEmpty((CharSequence) userSelectParam.get("userQuery"))) {
List<String> wxUserIds = wechatGroupConsr.getByUserQuery((String) userSelectParam.get("userQuery"));
if (!ListUtils.isEmpty(wxUserIds)) {
map.put("wxUserIds", wxUserIds);
} else {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
}
map.put("bookId",userSelectParam.get("bookId"));
List<UserBookInfoVO> countlist = bookGroupCipherUserDao.listUser4SelfPushByAdvise(map);
if (ListUtils.isEmpty(countlist)) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
}
map.put("pageNum", currentPage * numPerPage);
map.put("numPerPage", numPerPage);
List<UserBookInfoVO> list = bookGroupCipherUserDao.listUser4SelfPushByAdvise(map);
//填充个人号群发用户信息、扫码书刊信息
groupSet.setUserBookInfo4SelfPush(list);
return new PageBeanNew<>(currentPage, numPerPage, countlist.size(), list);
}
@ParamLog("根据类型获取社群书id集合")
@Override
public List<Long> getBookGroupIdsByJoinGroupType(Integer joinGroupType) {
......
......@@ -134,6 +134,7 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> {
*/
public List<UserBookInfoVO> listUser4SelfPush(Map<String,Object> map);
public List<UserBookInfoVO> listUser4SelfPushByAdvise(Map<String,Object> map);
/**
* 查小号的好友id
* @param altId
......
......@@ -153,6 +153,11 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser>
}
@Override
public List<UserBookInfoVO> listUser4SelfPushByAdvise(Map<String, Object> map) {
return getSessionTemplate().selectList(getStatement("listUser4SelfPushByBookGroupId"),map);
}
@Override
public List<String> getFriendIdListByBookAndRobot(String altId, List<Long> bookIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookIds", bookIds);
......
......@@ -43,4 +43,9 @@ public class UserSelectParamDTO {
* 深度标签id
*/
private Long depLabelId;
/**
* 单本图书id
*/
private Long bookGroupId;
}
......@@ -601,6 +601,15 @@ public interface BookGroupFacade {
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4SelfPush(
@RequestHeader("token") String token, @RequestBody @ApiParam UserSelectParamDTO userSelectParamDTO) throws PermissionException;
@ApiOperation(value = "编辑端,个人号群发-用户列表查询",httpMethod = "GET")
@GetMapping("listUser4SelfPushByAdvise")
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4SelfPushByAdvise(
@RequestHeader("token") String token,
@RequestParam(value = "userQuery", required = false) String userQuery,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("bookId") Long bookId) throws PermissionException;
@ApiOperation("获取随机码")
@GetMapping("getRandomCode")
ResponseDto<?> getRandomCode(
......
......@@ -950,6 +950,35 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
return new ResponseDto<>(pageBeanNew);
}
@ApiOperation(value = "编辑端,个人号群发-用户列表查询",httpMethod = "GET")
@GetMapping("listUser4SelfPushByAdvise")
@Override
public ResponseDto<PageBeanNew<UserBookInfoVO>> listUser4SelfPushByAdvise(@RequestHeader("token") String token,
@RequestParam(value = "userQuery", required = false) String userQuery,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage,
@RequestParam("bookId") Long bookId) throws PermissionException {
SessionUtil.getToken4Redis(token);
if ( null == currentPage || null == numPerPage) {
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL, "缺少参数");
}
if (null == bookId){
throw new WechatGroupBizException(WechatGroupBizException.PARAM_IS_NULL,"缺少图书Id");
}
Map<String,Object> userSelectParam = new HashMap<>();
userSelectParam.put("currentPage",currentPage);
userSelectParam.put("numPerPage",numPerPage);
userSelectParam.put("bookId",bookId);
if (!StringUtil.isEmpty(userQuery)){
userSelectParam.put("userQuery",userQuery);
}
PageBeanNew<UserBookInfoVO> pageBeanNew = bookGroupBiz.listUser4SelfPushByAdvise(userSelectParam);
return new ResponseDto<>(pageBeanNew);
}
@ApiOperation("获取随机码")
@GetMapping("getRandomCode")
@Override
......
......@@ -34,7 +34,7 @@ public interface SelfPushBiz {
* @param endTime
* @return
*/
PageBeanNew<SelfPushRecordDTO> listSelfPushRecord(Integer currentPage, Integer numPerPage, String startTime, String endTime, Integer status);
PageBeanNew<SelfPushRecordDTO> listSelfPushRecord(Integer currentPage, Integer numPerPage, String startTime, String endTime, Integer status,Long partyId);
/**
* 定时任务触发群发
......
......@@ -263,11 +263,12 @@ public class SelfPushBizImpl implements SelfPushBiz {
}
@Override
public PageBeanNew<SelfPushRecordDTO> listSelfPushRecord(Integer currentPage, Integer numPerPage, String startTime, String endTime, Integer status) {
public PageBeanNew<SelfPushRecordDTO> listSelfPushRecord(Integer currentPage, Integer numPerPage, String startTime, String endTime, Integer status,Long partyId) {
Map<String, Object> map = new HashMap<>();
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("pushStatus", status);
map.put("partyId", partyId);
PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushItemDao.listPageNew(new PageParam(currentPage, numPerPage), map, "listSelfPushRecord");
if (null == pageBeanNew || ListUtils.isEmpty(pageBeanNew.getRecordList())) {
return new PageBeanNew<>(currentPage, numPerPage, 0, new ArrayList<>());
......
......@@ -297,8 +297,8 @@ public class PushCheck {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "自定义发送时间设置有误");
}
}
if (StringUtil.isEmpty(addParamDTO.getAltId()) || ListUtils.isEmpty(addParamDTO.getUserIdList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "个人号或群发好友为空");
if (ListUtils.isEmpty(addParamDTO.getUserIdList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "群发好友为空");
}
if (ListUtils.isEmpty(addParamDTO.getPushItemList())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "发送消息为空");
......
......@@ -6,6 +6,7 @@ import com.pcloud.book.push.biz.SelfPushBiz;
import com.pcloud.book.push.check.PushCheck;
import com.pcloud.book.push.dto.SelfPushAddParamDTO;
import com.pcloud.book.push.dto.SelfPushRecordDTO;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
......@@ -47,9 +48,11 @@ public class SelfPushFacade {
pushCheck.selfPushParamCheck(addParamDTO);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
if ("0".equals(isSystem)) {
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
if (partyId == 0){
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
if ("0".equals(isSystem)) {
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
}
}
selfPushBiz.createSelfPush(partyId, addParamDTO);
return new ResponseDto<>();
......@@ -80,11 +83,18 @@ public class SelfPushFacade {
@RequestParam(value = "startTime", required = false) @ApiParam("开始时间") String startTime,
@RequestParam(value = "endTime", required = false) @ApiParam("结束时间") String endTime,
@RequestParam(value = "status", required = false) @ApiParam("发送状态(1发送中2发送成功3发送失败)") Integer status) throws PermissionException {
SessionUtil.getToken4Redis(token);
Map<String, Object> map = SessionUtil.getToken4Redis(token);
if (null == currentPage || null == numPerPage) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "缺少分页参数");
}
PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushBiz.listSelfPushRecord(currentPage, numPerPage, startTime, endTime, status);
Long partyId = (Long) map.get(SessionUtil.PARTY_ID);
if (partyId == 0){
String isSystem = (String) map.get(SessionUtil.IS_SYSTEM);
if ("0".equals(isSystem)) {
partyId = (Long) map.get(SessionUtil.MEMBER_ID);
}
}
PageBeanNew<SelfPushRecordDTO> pageBeanNew = selfPushBiz.listSelfPushRecord(currentPage, numPerPage, startTime, endTime, status,partyId);
return new ResponseDto<>(pageBeanNew);
}
}
......@@ -1838,6 +1838,9 @@
AND
(b.BOOK_NAME LIKE CONCAT('%', #{name},'%') OR b.ISBN LIKE CONCAT(#{name},'%'))
</if>
<if test="adviserId!=null">
AND a.ADVISER_ID = #{adviserId}
</if>
ORDER BY
g.create_time DESC
</select>
......
......@@ -422,6 +422,31 @@
</if>
</select>
<select id="listUser4SelfPushByBookGroupId" resultType="com.pcloud.book.group.vo.UserBookInfoVO" parameterType="map">
SELECT
u.wx_user_id wxUserId,
u.alt_id altId
FROM
book_group_cipher_user u
LEFT JOIN book_group g ON u.book_group_id = g.id
WHERE
g.book_id = #{bookId}
<if test="wxUserIds != null and wxUserIds.size>0">
AND u.wx_user_id IN
<foreach collection="wxUserIds" open="(" close=")" item="item" separator=",">
#{item}
</foreach>
</if>
GROUP BY
u.wx_user_id
ORDER BY
u.create_time DESC,
u.id DESC
<if test="pageNum>=0 and numPerPage>0">
LIMIT #{pageNum}, #{numPerPage}
</if>
</select>
<select id="getScanBookInfoByUser" parameterType="map" resultType="com.pcloud.book.group.vo.UserBookInfoItemVO">
SELECT
u.book_group_id bookGroupId,
......
......@@ -123,6 +123,7 @@
<if test="pushStatus != null">
AND i.push_status = #{pushStatus}
</if>
AND p.create_user = #{partyId}
ORDER BY
i.create_time DESC, i.id DESC
</select>
......
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