Commit 68a4c438 by 吴博

feat: [1004746] 小程序改版

parent e73bd2e4
package com.pcloud.book.applet.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class BaseTempletClassifyDTO {
@ApiModelProperty("第一级类型标识")
private Long firstClassify;
@ApiModelProperty("第二级类型标识")
private Long secondClassify;
@ApiModelProperty("第三级类型标识")
private Long thirdClassify;
@ApiModelProperty("年级标签id")
private Long gradeLabelId;
@ApiModelProperty("科目标签id")
private Long subjectLabelId;
@ApiModelProperty("上下册标签id")
private Long volLabelId;
@ApiModelProperty("版本标签")
private Long verLabelId;
@ApiModelProperty("agentId")
private Long agentId;
}
......@@ -24,7 +24,9 @@ public enum AppletRecordTypeEnum {
WX_WORK_TEACHER(10, "微信客服"),
//第三方资源
THIRD_RESOURCE(11, "第三方资源");
THIRD_RESOURCE(11, "第三方资源"),
RAISE_QUESTION(20,"小睿互助问题");
public Integer value;
......
......@@ -7,15 +7,18 @@ import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.dto.AppletOuterBookDTO;
import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
import com.pcloud.book.applet.dto.BaseTempletClassifyDTO;
import com.pcloud.book.applet.dto.PcloudGroupActivityDTO;
import com.pcloud.book.applet.dto.ServeCollectDTO;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.utils.ResponseHandleUtil;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import io.swagger.annotations.Api;
......@@ -134,4 +137,11 @@ public interface AppletService {
@GetMapping("getThirdResourceById")
ResponseEntity<ResponseDto<AppletThirdResourcesDTO>> getThirdResourceById(@RequestParam("thirdResourcesId") Long thirdResourcesId);
@RequestMapping("getLastReadBookInfo")
ResponseEntity<ResponseDto<BaseTempletClassifyDTO>> getLastReadBookInfo(@RequestBody List<Long> wechatUserIds);
@RequestMapping("getSameClassifyUserIds")
ResponseEntity<ResponseDto<List<Long>>> getSameClassifyUserIds(@RequestBody List<Long> wechatUserIds);
}
package com.pcloud.book.cultivate.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.util.Date;
@Data
@Builder
public class AppletNotifySendDTO {
@ApiModelProperty("用户微信id")
private Long wechatUserId;
@ApiModelProperty("发送类型(1-指定用户,2-分类用户,3-按书籍查询,4-全局公告消息)")
private Integer sendType;
@ApiModelProperty("消息类型(1-系统消息,2-通知消息,3-提醒消息,4-活动消息)")
private Integer messageType;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("问题id")
private Long fromId;
}
package com.pcloud.book.cultivate.enums;
public enum NotifyMessageType {
//消息类型(1-系统消息,2-通知消息,3-提醒消息,4-活动消息
SYSTEM(1,"系统消息"),
NOTICE(2, "通知消息"),
REMEMBER(3,"提醒消息"),
ACTIVITY(4,"活动消息"),
MORE(5,"更多消息");
public Integer code;
public String desc;
NotifyMessageType(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
public static NotifyMessageType geTypeByCode(Integer code) {
if (null == code) {
return null;
}
for (NotifyMessageType result : NotifyMessageType.values()) {
if (result.code.equals(code)) {
return result;
}
}
return null;
}
}
package com.pcloud.book.cultivate.enums;
public enum NotifySendTypeEnum {
/**
* 指定用户
*/
APPOINT_USER(1),
/**
* 分类用户
*/
CLASSIFY_USER(2),
/**
* 书籍查询
*/
BOOK_USER(3),
/**
* 全局公告消息
*/
ALL_USER(4),
/**
*用户画像
*/
USER_PROFILE(5),
/**
* 提出问题
*/
RAISE_QUESTIOIN(6);
public final Integer value;
NotifySendTypeEnum(Integer value) {
this.value = value;
}
}
......@@ -3,6 +3,7 @@ package com.pcloud.book.cultivate.service;
import com.pcloud.book.copyright.dto.BookAuthInfoCountDTO;
import com.pcloud.book.copyright.dto.BookAuthTotalCountDTO;
import com.pcloud.book.copyright.dto.CheckUserAuthDTO;
import com.pcloud.book.cultivate.entity.AppletNotifySendDTO;
import com.pcloud.book.cultivate.entity.CultivateNotifySend;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
......@@ -33,4 +34,12 @@ public interface CultivateNotifyService {
void batchSendMiniUser(@RequestBody List<CultivateNotifySend> list) throws BizException;
@ApiOperation(value = "小睿互助发送站内信消息", httpMethod = "POST")
@RequestMapping(value = "sendAppletUserNotify", method = RequestMethod.POST)
void sendAppletUserNotify(@RequestBody List<CultivateNotifySend> list) throws BizException;
@ApiOperation(value = "小睿互助创建站内信消息", httpMethod = "POST")
@RequestMapping(value = "createNotify4Question", method = RequestMethod.POST)
ResponseEntity<ResponseDto<Long>> createNotify4Question(@RequestBody AppletNotifySendDTO newSendDTO) throws BizException;
}
......@@ -3,6 +3,8 @@ package com.pcloud.book.applet.biz;
import com.pcloud.book.applet.entity.AppletRecordServe;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
/**
* (AppletRecordServe)表服务接口
*
......@@ -47,4 +49,11 @@ public interface AppletRecordServeBiz {
*/
void deleteById(Long id);
/**
* 根据类型获取用户足迹列表
* @param wechatUserId
* @param recordType
* @return
*/
List<AppletRecordServe> getUserRecordListByType(Long wechatUserId, Integer recordType);
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.pcloud.book.applet.biz;
import com.pcloud.book.applet.dto.AppletTaskDTO;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.BaseTempletClassifyDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord;
......@@ -99,4 +100,8 @@ public interface AppletUserBookcaseBiz {
AppletUserBookcaseDTO getUserBookInfoByWechatUserId(Long bookId,Long channelId,Long adviserId,Long rightsSettingId);
String getResources4Books(MultipartHttpServletRequest request);
BaseTempletClassifyDTO getLastReadBookInfo(List<Long> wechatUserIds);
List<Long> getSameClassifyUserIds(List<Long> wechatUserIds);
}
......@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -70,4 +71,13 @@ public class AppletRecordServeBizImpl implements AppletRecordServeBiz {
public void deleteById(Long id) {
appletRecordServeDao.deleteById(id);
}
@Override
public List<AppletRecordServe> getUserRecordListByType(Long wechatUserId, Integer recordType) {
List<AppletRecordServe> appletRecordServes = appletRecordServeDao.getUserRecordListByType(wechatUserId, recordType);
if (ListUtils.isEmpty(appletRecordServes)) {
appletRecordServes = new ArrayList<>();
}
return appletRecordServes;
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ import com.pcloud.book.applet.dto.AppletNewsDTO;
import com.pcloud.book.applet.dto.AppletNewsServeDTO;
import com.pcloud.book.applet.dto.AppletTaskDTO;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.BaseTempletClassifyDTO;
import com.pcloud.book.applet.dto.BookResourceExcelDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletThirdResources;
......@@ -627,6 +628,24 @@ public class AppletUserBookcaseBizImpl implements AppletUserBookcaseBiz {
return excelUrl;
}
@Override
public BaseTempletClassifyDTO getLastReadBookInfo(List<Long> wechatUserIds) {
return appletUserBookcaseDao.getLastReadBookInfoByUsers(wechatUserIds);
}
@Override
public List<Long> getSameClassifyUserIds(List<Long> wechatUserIds) {
if (ListUtils.isEmpty(wechatUserIds)) {
return new ArrayList<>();
}
BaseTempletClassifyDTO baseTempletClassifyDTO = appletUserBookcaseDao.getLastReadBookInfoByUsers(wechatUserIds);
if (null == baseTempletClassifyDTO || null == baseTempletClassifyDTO.getFirstClassify()) {
return new ArrayList<>();
}
List<Long> wechatUserId = appletUserBookcaseDao.getSameClassifyUserIds(baseTempletClassifyDTO);
return wechatUserId;
}
private String getExcelUrl4Resource(List<BookResourceExcelDTO> bookResourceDTOList4ResourceExcel, String fileName) {
// 字段名
String[] rowsName = {"书籍id", "编辑id", "渠道id", "书籍名称", "书籍二维码","资源id", "资源名称", "资源类型", "资源具体类型", "资源类型名称", "资源价格", "是否小睿书"};
......
......@@ -23,4 +23,6 @@ public interface AppletRecordServeDao extends BaseDao<AppletRecordServe> {
List<AppletRecordDTO> getAppletRecordCatalogue(Map<String, Object> paramMap);
void batchUpdate(List<AppletRecordDTO> recordList);
List<AppletRecordServe> getUserRecordListByType(Long wechatUserId, Integer recordType);
}
\ No newline at end of file
package com.pcloud.book.applet.dao;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.BaseTempletClassifyDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord;
......@@ -107,4 +108,8 @@ public interface AppletUserBookcaseDao extends BaseDao<AppletUserBookcase> {
BaseTempletClassify getLastReadBookInfo(Long wechatUserId);
UserLastBookReDTO getUserLastGroupBook(Long wechatUserId);
BaseTempletClassifyDTO getLastReadBookInfoByUsers(List<Long> wechatUserIds);
List<Long> getSameClassifyUserIds(BaseTempletClassifyDTO baseTempletClassifyDTO);
}
......@@ -43,4 +43,12 @@ public class AppletRecordServeDaoImpl extends BaseDaoImpl<AppletRecordServe> imp
public void batchUpdate(List<AppletRecordDTO> recordList) {
getSessionTemplate().update(getStatement("batchUpdate"), recordList);
}
@Override
public List<AppletRecordServe> getUserRecordListByType(Long wechatUserId, Integer recordType) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("wechatUserId", wechatUserId);
paramMap.put("recordType", recordType);
return getSessionTemplate().selectList(getStatement("getUserRecordListByType"), paramMap);
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.pcloud.book.applet.dao.impl;
import com.pcloud.book.applet.dao.AppletUserBookcaseDao;
import com.pcloud.book.applet.dto.AppletUserBookcaseDTO;
import com.pcloud.book.applet.dto.BaseTempletClassifyDTO;
import com.pcloud.book.applet.dto.UserLastBookReDTO;
import com.pcloud.book.applet.entity.AppletUserBookcase;
import com.pcloud.book.applet.entity.AppletUserClickRecord;
......@@ -153,4 +154,14 @@ public class AppletUserBookcaseDaoImpl extends BaseDaoImpl<AppletUserBookcase> i
public UserLastBookReDTO getUserLastGroupBook(Long wechatUserId) {
return getSessionTemplate().selectOne(getStatement("getUserLastGroupBook"),wechatUserId);
}
@Override
public BaseTempletClassifyDTO getLastReadBookInfoByUsers(List<Long> wechatUserIds) {
return getSessionTemplate().selectOne(getStatement("getLastReadBookInfoByUsers"),wechatUserIds);
}
@Override
public List<Long> getSameClassifyUserIds(BaseTempletClassifyDTO baseTempletClassifyDTO) {
return getSessionTemplate().selectList(getStatement("getSameClassifyUserIds"), baseTempletClassifyDTO);
}
}
......@@ -7,8 +7,10 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -17,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* (AppletRecordServe)表控制层
*
......@@ -75,4 +79,15 @@ public class AppletRecordServeFacade {
return new ResponseDto<>();
}
@ApiOperation("根据类型获取用户足迹数据")
@GetMapping("getUserRecordListByType")
public ResponseDto<?> getUserRecordListByType(@CookieValue("userInfo") String userInfo,
@RequestParam(value = "recordType",required = false) Integer recordType) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
List<AppletRecordServe> appletRecordServeList = appletRecordServeBiz.getUserRecordListByType(wechatUserId, recordType);
return new ResponseDto<>(appletRecordServeList);
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.pcloud.book.applet.biz.AppletRecordBiz;
import com.pcloud.book.applet.biz.AppletRecordStatisBiz;
import com.pcloud.book.applet.biz.AppletRecordAggrStatisBiz;
import com.pcloud.book.applet.biz.AppletThirdResourcesStaticBiz;
import com.pcloud.book.applet.biz.AppletUserBookcaseBiz;
import com.pcloud.book.applet.biz.ReadBookRecordBiz;
import com.pcloud.book.applet.biz.ServeCollectBiz;
import com.pcloud.book.applet.dto.AppletAppOrProductDTO;
......@@ -18,6 +19,7 @@ import com.pcloud.book.applet.dto.AppletNewsVO;
import com.pcloud.book.applet.dto.AppletOuterBookDTO;
import com.pcloud.book.applet.dto.AppletOuterBooklistDTO;
import com.pcloud.book.applet.dto.AppletThirdResourcesDTO;
import com.pcloud.book.applet.dto.BaseTempletClassifyDTO;
import com.pcloud.book.applet.dto.PcloudGroupActivityDTO;
import com.pcloud.book.applet.dto.ServeCollectDTO;
import com.pcloud.book.applet.entity.ServeCollect;
......@@ -39,6 +41,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiParam;
......@@ -85,6 +88,8 @@ public class AppletServiceImpl implements AppletService {
private AppletBannerBiz appletBannerBiz;
@Autowired
private ReadBookRecordBiz readBookRecordBiz;
@Autowired
private AppletUserBookcaseBiz appletUserBookcaseBiz;
@Override
......@@ -242,4 +247,16 @@ public class AppletServiceImpl implements AppletService {
AppletThirdResourcesDTO appletThirdResourcesDTO = appletNewsBiz.getThirdResourceById(thirdResourcesId);
return ResponseHandleUtil.toResponse(appletThirdResourcesDTO);
}
@Override
@RequestMapping("getLastReadBookInfo")
public ResponseEntity<ResponseDto<BaseTempletClassifyDTO>> getLastReadBookInfo(@RequestBody List<Long> wechatUserIds) {
return ResponseHandleUtil.toResponse(appletUserBookcaseBiz.getLastReadBookInfo(wechatUserIds));
}
@RequestMapping("getSameClassifyUserIds")
@Override
public ResponseEntity<ResponseDto<List<Long>>> getSameClassifyUserIds(@RequestBody List<Long> wechatUserIds){
return ResponseHandleUtil.toResponse(appletUserBookcaseBiz.getSameClassifyUserIds(wechatUserIds));
}
}
......@@ -65,4 +65,11 @@ public interface BookLabelBiz {
* * @param null
*/
List<BookLabelVO> getLabelByIds(List<Long> labelIds);
/**
* 根据类型获取已经通过审核的标签
* @param labelType
* @return
*/
List<BookLabel> getBookLabelsByType(Integer labelType);
}
......@@ -8,12 +8,14 @@ import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.book.enums.BookLabelAuditState;
import com.pcloud.book.book.vo.BookLabelVO;
import com.pcloud.book.consumer.user.AdviserConsr;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.cache.redis.JedisClusterUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.resourcecenter.base.enums.AuditStateEnum;
import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import org.apache.commons.collections.MapUtils;
......@@ -28,6 +30,8 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import static com.pcloud.book.book.constant.BookConstant.BOOK_CACHE_SECOUND;
@Component("bookLabelBiz")
public class BookLabelBizImpl implements BookLabelBiz {
......@@ -39,7 +43,7 @@ public class BookLabelBizImpl implements BookLabelBiz {
@Override
public void applyBookLabel(BookLabel bookLabel, String systemCode) {
List<BookLabel> labels = bookLabelDao.getListByType(bookLabel.getType());
List<BookLabel> labels = bookLabelDao.getListByType(bookLabel.getType(), null);
List<String> names = labels.stream().filter(s->s.getName()!=null).map(BookLabel::getName).collect(Collectors.toList());
if (names.contains(bookLabel.getName())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"标签名称重复或已申请");
......@@ -67,7 +71,7 @@ public class BookLabelBizImpl implements BookLabelBiz {
updateLabel.setId(bookLabelVO.getLabelId());
updateLabel.setAuditState(bookLabelVO.getAuditState());
if (BookLabelAuditState.update_pass.code.equals(bookLabelVO.getAuditState())){//修改后入库
List<BookLabel> labels = bookLabelDao.getListByType(bookLabelVO.getType());
List<BookLabel> labels = bookLabelDao.getListByType(bookLabelVO.getType(), null);
List<String> names = labels.stream().filter(s->s.getName()!=null).map(BookLabel::getName).collect(Collectors.toList());
if (names.contains(bookLabelVO.getName())){
throw new BookBizException(BookBizException.PARAM_IS_NULL,"标签名称重复或已申请");
......@@ -172,4 +176,19 @@ public class BookLabelBizImpl implements BookLabelBiz {
}
return labelVOS;
}
@Override
@ParamLog("根据类型获取已经通过审核的标签")
public List<BookLabel> getBookLabelsByType(Integer labelType) {
List<BookLabel> bookLabels = new ArrayList<>();
String labelKey = BookConstant.BOOK_LABEL_CACHE + "RAYS_QUESTION";
bookLabels = JedisClusterUtils.getJsonList(labelKey, BookLabel.class);
if (ListUtils.isEmpty(bookLabels)) {
bookLabels = bookLabelDao.getListByType(labelType, AuditStateEnum.AUDIT_SUCCESS.value);
if (!ListUtils.isEmpty(bookLabels)) {
JedisClusterUtils.setJsonList(labelKey, bookLabels, BOOK_CACHE_SECOUND);
}
}
return ListUtils.isEmpty(bookLabels) ? new ArrayList<>() : bookLabels;
}
}
......@@ -8,7 +8,7 @@ import java.util.Map;
public interface BookLabelDao extends BaseDao<BookLabel> {
List<BookLabel> getListByType(Integer type);
List<BookLabel> getListByType(Integer type, Long value);
List<BookLabel> getAll(Long partyId);
......@@ -19,4 +19,5 @@ public interface BookLabelDao extends BaseDao<BookLabel> {
Long getByNameType(String name,Integer type);
Integer getMaxSeqByType(Integer type);
}
......@@ -19,8 +19,11 @@ public class BookLabelDaoImpl extends BaseDaoImpl<BookLabel> implements BookLabe
@Override
public List<BookLabel> getListByType(Integer type) {
return super.getSqlSession().selectList(super.getStatement("getListByType"), type);
public List<BookLabel> getListByType(Integer type, Long auditState) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("type", type);
paramMap.put("auditState", auditState);
return super.getSqlSession().selectList(super.getStatement("getListByType"), paramMap);
}
@Override
......
......@@ -10,6 +10,7 @@ import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.permission.PermissionException;
import com.pcloud.common.utils.SessionUtil;
import com.pcloud.common.utils.cookie.Cookie;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.usercenter.common.exception.BookcaseException;
import io.swagger.annotations.Api;
......@@ -19,6 +20,7 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@Api("书刊标签")
......@@ -130,4 +132,12 @@ public class BookLabelFacadeImpl {
return new ResponseDto<>(pageBeanNew);
}
@GetMapping("getBookLabelsByType")
public ResponseDto<List<BookLabel>> getBookLabelsByType(@CookieValue("userInfo") String userInfo,
@RequestParam(value = "labelType", required = false) @ApiParam("标签类型:1年级,2科目,3版本,4地域") Integer labelType) {
Cookie.getUserInfo(userInfo);
List<BookLabel> bookLabels = bookLabelBiz.getBookLabelsByType(labelType);
return new ResponseDto<>(bookLabels);
}
}
......@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
import com.pcloud.book.applet.dto.SpecialBookDTO;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.channelcenter.base.exceptions.ChannelBizException;
import com.pcloud.readercenter.applet.entity.AppletQuestion;
import com.pcloud.readercenter.applet.service.AppletUserService;
import com.pcloud.readercenter.rmall.entity.RmallBookMoneyRecord;
import com.pcloud.readercenter.rmall.service.RmallBookMoneyRecordService;
import com.pcloud.readercenter.wechat.dto.NickNameAndOpenIdDto;
......@@ -58,6 +60,8 @@ public class ReaderConsr {
private AgentService agentService;
@Autowired
private RmallBookMoneyRecordService rmallBookMoneyRecordService;
@Autowired
private AppletUserService appletUserService;
public WechatUser getWechatUser(Long wechatUserId) throws BizException {
if (wechatUserId == null) {
......@@ -361,6 +365,19 @@ public class ReaderConsr {
}
return result;
}
public Map<Long, AppletQuestion> getQuestionMap(List<Long> list) {
if (CollUtil.isEmpty(list)) {
return null;
}
Map<Long, AppletQuestion> appletQuestionMap = new HashMap<>();
try {
appletQuestionMap = ResponseHandleUtil.parseMap(appletUserService.getQuestionMap(list), Long.class, AppletQuestion.class);
} catch (Exception e) {
LOGGER.error("根据问题获取问题详情失败:" + e.getMessage(), e);
}
return appletQuestionMap;
}
}
......@@ -6,6 +6,7 @@ import com.pcloud.book.cultivate.dto.CultivateNotifyPageDTO;
import com.pcloud.book.cultivate.dto.SearchNotifyDTO;
import com.pcloud.book.cultivate.dto.SearchSendUserDTO;
import com.pcloud.book.cultivate.dto.SendUserDetailDto;
import com.pcloud.book.cultivate.entity.AppletNotifySendDTO;
import com.pcloud.book.cultivate.entity.CultivateNotifySend;
import com.pcloud.common.page.PageBeanNew;
......@@ -33,4 +34,10 @@ public interface CultivateNotifyBiz {
PageBeanNew<AdviserBookInfoDTO> listPage4SearchBook(SearchSendUserDTO searchSendUserDTO);
void batchSendMiniUser(List<CultivateNotifySend> list);
void sendAppletUserNotify(List<CultivateNotifySend> list);
Long createNotify4Question(AppletNotifySendDTO newSendDTO);
PageBeanNew<CultivateNotifyDTO> getLatestNotifyList(Long wechatUserId, Integer currentPage, Integer numPerPage);
}
......@@ -2,6 +2,7 @@ package com.pcloud.book.cultivate.biz.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.applet.biz.AppletNewsBiz;
......@@ -32,6 +33,7 @@ import com.pcloud.book.cultivate.dto.CultivateNotifyTypeDTO;
import com.pcloud.book.cultivate.dto.SearchNotifyDTO;
import com.pcloud.book.cultivate.dto.SearchSendUserDTO;
import com.pcloud.book.cultivate.dto.WechatUserDTO;
import com.pcloud.book.cultivate.entity.AppletNotifySendDTO;
import com.pcloud.book.cultivate.entity.CultivateNotify;
import com.pcloud.book.cultivate.entity.CultivateNotifyItem;
import com.pcloud.book.cultivate.entity.CultivateNotifySend;
......@@ -39,13 +41,16 @@ import com.pcloud.book.cultivate.enums.NotifySendTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.util.common.ThreadPoolUtils;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.dto.AppletTemplateMessageDto;
import com.pcloud.common.page.PageBeanNew;
import com.pcloud.common.page.PageParam;
import com.pcloud.common.utils.DateUtils;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ServeLinkUtils;
import com.pcloud.common.utils.string.StringUtil;
import com.pcloud.contentcenter.resource.dto.ResourceDTO;
import com.pcloud.readercenter.applet.entity.AppletQuestion;
import com.pcloud.readercenter.wechat.dto.MiniUserDto;
import com.pcloud.readercenter.wechat.dto.ReaderMessageDto;
import com.pcloud.resourcecenter.product.dto.ProductDto;
......@@ -53,6 +58,7 @@ import com.pcloud.usercenter.party.adviser.dto.AdviserBaseInfoDto;
import com.pcloud.wechatgroup.selfrobot.dto.SendMessageDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
......@@ -162,14 +168,16 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
cultivateNotifyDTO.setCultivateNotifyItems(list1);
cultivateNotifyItemList.addAll(list1);
}
//批量更新消息已读未读
List<CultivateNotifySend> notifySends=cultivateNotifySendDao.getNotifySendsByType(wechatUserId,messageType);
for (CultivateNotifySend notifySend:notifySends) {
notifySend.setIsRead(true);
notifySend.setReadTime(new Date());
notifySend.setUpdateTime(new Date());
cultivateNotifySendDao.update(notifySend);
}
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> {
//批量更新消息已读未读
List<CultivateNotifySend> notifySends=cultivateNotifySendDao.getNotifySendsByType(wechatUserId,messageType);
for (CultivateNotifySend notifySend:notifySends) {
notifySend.setIsRead(true);
notifySend.setReadTime(new Date());
notifySend.setUpdateTime(new Date());
cultivateNotifySendDao.update(notifySend);
}
});
//填充资讯应用作品
fillAppOrProduct4Notify(cultivateNotifyItemList);
return pageBeanNew;
......@@ -421,8 +429,21 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
});
// 获取问题
Map<Long, AppletQuestion> questionMap = new HashMap<>();
CompletableFuture<List<Long>> questionFuture = CompletableFuture.supplyAsync(() -> cultivateNotifyItems.stream()
.filter(x -> Objects.nonNull(x) && Objects.equals(x.getServeType(), AppletRecordTypeEnum.RAISE_QUESTION.value))
.map(CultivateNotifyItem::getServeId).distinct().collect(Collectors.toList())).whenComplete((list, throwable) -> {
if (Objects.nonNull(throwable)) {
log.error("[fillServeInfo] 填充小睿互助问题信息失败,err:{}", throwable.getMessage(), throwable);
} else {
Map<Long, AppletQuestion> appletQuestionMap = !ListUtils.isEmpty(list) ? readerConsr.getQuestionMap(list) : new HashMap<>();
questionMap.putAll(appletQuestionMap);
}
});
try {
CompletableFuture.allOf(newsBannerFuture, appBannerFuture, productBannerFuture).get();
CompletableFuture.allOf(newsBannerFuture, appBannerFuture, productBannerFuture, questionFuture).get();
} catch (InterruptedException | ExecutionException e) {
log.error("[fillServeInfo] banner 填充信息失败,err:{}", e.getMessage(), e);
}
......@@ -464,6 +485,10 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
.resultUrl(resultLinkUrl).hasThirdLink(StrUtil.isNotBlank(productDto.getSkipUrl()))
.serveTypeName(productDto.getShortName()).build();
banner.setAppItem(build);
} else if (Objects.equals(serveType, AppletRecordTypeEnum.RAISE_QUESTION.value) && Objects.nonNull(questionMap.get(banner.getServeId()))) {
if (MapUtils.isNotEmpty(questionMap) && null != questionMap.get(banner.getServeId())) {
banner.setAppletQuestion(questionMap.get(banner.getServeId()));
}
}
}
}
......@@ -520,4 +545,51 @@ public class CultivateNotifyBizImpl implements CultivateNotifyBiz {
}
this.sendAppletTemplateMessage(list, cultivateNotify.getAgentId());
}
@Override
public void sendAppletUserNotify(List<CultivateNotifySend> list) {
if (ListUtils.isEmpty(list)){
return;
}
cultivateNotifySendDao.insert(list);
}
@Override
@ParamLog("小睿互助新增站内信")
public Long createNotify4Question(AppletNotifySendDTO newSendDTO) {
if (null == newSendDTO || null == newSendDTO.getSendType() || null == newSendDTO.getMessageType() || StringUtil.isEmpty(newSendDTO.getTitle())) {
throw new BookBizException(BookBizException.PARAM_IS_NULL,"新建站内信消息参数为空");
}
CultivateNotify cultivateNotify=new CultivateNotify();
cultivateNotify.setMessageType(newSendDTO.getMessageType());
cultivateNotify.setTitle(newSendDTO.getTitle());
cultivateNotify.setSendType(newSendDTO.getSendType());
cultivateNotify.setAgentId(0L);
cultivateNotifyDao.insert(cultivateNotify);
CultivateNotifyItem cultivateNotifyItem = new CultivateNotifyItem();
cultivateNotifyItem.setMessageId(cultivateNotify.getMessageId());
cultivateNotifyItem.setContentType(4);
cultivateNotifyItem.setServeId(newSendDTO.getFromId());
cultivateNotifyItem.setServeType(AppletRecordTypeEnum.RAISE_QUESTION.value);
cultivateNotifyItemDao.insert(Lists.newArrayList(cultivateNotifyItem));
return cultivateNotify.getMessageId();
}
@Override
@ParamLog("获取最近消息列表")
public PageBeanNew<CultivateNotifyDTO> getLatestNotifyList(Long wechatUserId, Integer currentPage, Integer numPerPage) {
Map<String,Object> map=new HashMap<>();
map.put("wechatUserId",wechatUserId);
PageBeanNew<CultivateNotifyDTO> pageBeanNew= cultivateNotifySendDao.listPageNew(new PageParam(currentPage, numPerPage), map, "getNotifyListByType");
List<CultivateNotifyItem> cultivateNotifyItemList = new ArrayList<>();
for (CultivateNotifyDTO cultivateNotifyDTO:pageBeanNew.getRecordList()) {
List<CultivateNotifyItem> list1=cultivateNotifyItemDao.getNotifyItemsByMessageId(cultivateNotifyDTO.getMessageId());
fillResource(list1);
cultivateNotifyDTO.setCultivateNotifyItems(list1);
cultivateNotifyItemList.addAll(list1);
}
//填充资讯应用作品问题
fillAppOrProduct4Notify(cultivateNotifyItemList);
return pageBeanNew;
}
}
......@@ -6,6 +6,7 @@ import com.pcloud.book.applet.dto.ServeItemInfoDTO;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
import com.pcloud.readercenter.applet.entity.AppletQuestion;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -21,7 +22,7 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("消息id")
private Long messageId;
@ApiModelProperty("发送内容(1-文本,2-图片,3-音频, 4-链接)")
@ApiModelProperty("发送内容(1-文本,2-图片,3-音频, 4-链接,5 问题)")
private Integer contentType;
@ApiModelProperty("文字内容")
......@@ -84,6 +85,9 @@ public class CultivateNotifyItem extends BaseEntity {
@ApiModelProperty("咨询具体信息")
private ServeItemInfoDTO appItem;
@ApiModelProperty("小睿互助问题")
private AppletQuestion appletQuestion;
......
......@@ -109,6 +109,18 @@ public class CultivateNotifyFacade {
return new ResponseDto<>(cultivateNotifyBiz.getNotifyListByType(wechatUserId,messageType,currentPage,numPerPage));
}
@ApiOperation("获取最新信息里列表")
@GetMapping("getLatestNotifyList")
public ResponseDto<?> getLatestNotifyList(@CookieValue(value = "userInfo", required = false) String userInfo,
@RequestParam(value = "currentPage") Integer currentPage,
@RequestParam(value = "numPerPage") Integer numPerPage) {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
if (!NumberUtil.isNumber(wechatUserId)) {
throw new BizException(BizException.PARAM_IS_NULL.getCode(), "wechatUserId 不能为空");
}
return new ResponseDto<>(cultivateNotifyBiz.getLatestNotifyList(wechatUserId, currentPage, numPerPage));
}
......
package com.pcloud.book.cultivate.service.impl;
import com.pcloud.book.cultivate.biz.CultivateNotifyBiz;
import com.pcloud.book.cultivate.entity.AppletNotifySendDTO;
import com.pcloud.book.cultivate.entity.CultivateNotifySend;
import com.pcloud.book.cultivate.service.CultivateNotifyService;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.common.utils.bean.ResponesUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
......@@ -29,4 +35,18 @@ public class CultivateNotifyServiceImpl implements CultivateNotifyService {
cultivateNotifyBiz.batchSendMiniUser(list);
}
}
@Override
@RequestMapping(value = "sendAppletUserNotify", method = RequestMethod.POST)
public void sendAppletUserNotify(@RequestBody List<CultivateNotifySend> list) throws BizException{
if (!ListUtils.isEmpty(list)) {
cultivateNotifyBiz.sendAppletUserNotify(list);
}
}
@Override
@RequestMapping(value = "createNotify4Question", method = RequestMethod.POST)
public ResponseEntity<ResponseDto<Long>> createNotify4Question(@RequestBody AppletNotifySendDTO newSendDTO) throws BizException{
return ResponseHandleUtil.toResponse(cultivateNotifyBiz.createNotify4Question(newSendDTO));
}
}
......@@ -268,4 +268,20 @@
</foreach>
</where>
</update>
<select id="getUserRecordListByType" parameterType="map" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from
applet_record_serve
where
wechat_user_id = #{wechatUserId}
<if test="recordType != null">
and
record_type = #{recordType}
</if>
and
is_delete = 0
order by create_time desc
</select>
</mapper>
\ No newline at end of file
......@@ -359,4 +359,39 @@
LIMIT 1
</select>
<select id="getLastReadBookInfoByUsers" parameterType="list" resultType="com.pcloud.book.applet.dto.BaseTempletClassifyDTO">
SELECT b.TEMPLET_ID firstClassify,
b.SECOND_TEMPLET_ID secondClassify,
b.third_TEMPLET_ID thirdClassify,
b.GRA_LABEL_ID gradeLabelId,
b.SUB_LABEL_ID subjectLabelId,
b.vol_label_id volLabelId
FROM applet_user_bookcase a
LEFT JOIN book_adviser b ON a.book_id = b.BOOK_ID
AND a.channel_id = b.CHANNEL_ID
AND a.adviser_id = b.ADVISER_ID
WHERE b.IS_DELETE = 0
AND a.wechat_user_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
ORDER BY a.create_time DESC
LIMIT 1
</select>
<select id="getSameClassifyUserIds" parameterType="com.pcloud.book.applet.dto.BaseTempletClassifyDTO" resultType="long">
SELECT
DISTINCT
A.wechat_user_id
FROM
`applet_user_bookcase` a
LEFT JOIN book_adviser b ON a.book_id = b.BOOK_ID
WHERE
b.IS_DELETE = 0
AND b.IS_MAIN_EDITOR = 1
AND b.TEMPLET_ID = #{firstClassify}
AND b.SECOND_TEMPLET_ID = #{secondClassify}
AND B.third_templet_id = #{thirdClassify};
</select>
</mapper>
\ No newline at end of file
......@@ -60,12 +60,16 @@
SELECT MAX(seq) FROM book_label WHERE type=#{type}
</select>
<select id="getListByType" parameterType="integer" resultMap="BaseResultMap">
<select id="getListByType" parameterType="map" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
book_label
where type=#{type}
<if test="auditState != null">
and audit_state = #{auditState}
</if>
and is_ray = 1
</select>
<!--获取全部-->
......
......@@ -96,7 +96,9 @@
select a.message_id messageId ,a.title,a.message_type messageType ,c.create_time sendTime from cultivate_notify a, cultivate_notify_send c
where a.message_id=c.message_id
and c.wechat_user_id=#{wechatUserId}
and c.message_type=#{messageType}
<if test="messageType != null">
and c.message_type=#{messageType}
</if>
order by c.create_time 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