Commit 7cb56b0c by 阮思源

1002140新版个人号1.0

parent d275579c
......@@ -577,6 +577,32 @@ public class BookDto extends BaseDto {
*/
private Boolean hasServe;
/**
* 书籍简称
*/
private String shortBookName;
/**
* 年级标签id
*/
private Long graLabelId;
/**
* 科目标签id
*/
private Long subLabelId;
/**
* 版本标签id
*/
private Long verLabelId;
/**
* 地域标签id
*/
private Long areaLabelId;
public String getQrRemark() {
return qrRemark;
}
......@@ -1541,6 +1567,46 @@ public class BookDto extends BaseDto {
this.hasServe = hasServe;
}
public String getShortBookName() {
return shortBookName;
}
public void setShortBookName(String shortBookName) {
this.shortBookName = shortBookName;
}
public Long getGraLabelId() {
return graLabelId;
}
public void setGraLabelId(Long graLabelId) {
this.graLabelId = graLabelId;
}
public Long getSubLabelId() {
return subLabelId;
}
public void setSubLabelId(Long subLabelId) {
this.subLabelId = subLabelId;
}
public Long getVerLabelId() {
return verLabelId;
}
public void setVerLabelId(Long verLabelId) {
this.verLabelId = verLabelId;
}
public Long getAreaLabelId() {
return areaLabelId;
}
public void setAreaLabelId(Long areaLabelId) {
this.areaLabelId = areaLabelId;
}
@Override
public String toString() {
return "BookDto{" +
......@@ -1657,6 +1723,11 @@ public class BookDto extends BaseDto {
", friendsCount=" + friendsCount +
", bookGroupCipher='" + bookGroupCipher + '\'' +
", hasServe=" + hasServe +
", shortBookName='" + shortBookName + '\'' +
", graLabelId=" + graLabelId +
", subLabelId=" + subLabelId +
", verLabelId=" + verLabelId +
", areaLabelId=" + areaLabelId +
"} " + super.toString();
}
}
......@@ -202,6 +202,26 @@ public class Book extends BaseEntity {
*/
private String secondTypeCode;
/**
* 年级标签id
*/
private Long graLabelId;
/**
* 科目标签id
*/
private Long subLabelId;
/**
* 版本标签id
*/
private Long verLabelId;
/**
* 地域标签id
*/
private Long areaLabelId;
public Long getBookId() {
return bookId;
}
......@@ -498,6 +518,38 @@ public class Book extends BaseEntity {
this.secondTypeCode = secondTypeCode;
}
public Long getGraLabelId() {
return graLabelId;
}
public void setGraLabelId(Long graLabelId) {
this.graLabelId = graLabelId;
}
public Long getSubLabelId() {
return subLabelId;
}
public void setSubLabelId(Long subLabelId) {
this.subLabelId = subLabelId;
}
public Long getVerLabelId() {
return verLabelId;
}
public void setVerLabelId(Long verLabelId) {
this.verLabelId = verLabelId;
}
public Long getAreaLabelId() {
return areaLabelId;
}
public void setAreaLabelId(Long areaLabelId) {
this.areaLabelId = areaLabelId;
}
@Override
public String toString() {
return "Book{" +
......@@ -538,6 +590,10 @@ public class Book extends BaseEntity {
", bookGroupId=" + bookGroupId +
", secondTempletId=" + secondTempletId +
", secondTypeCode='" + secondTypeCode + '\'' +
'}';
", graLabelId=" + graLabelId +
", subLabelId=" + subLabelId +
", verLabelId=" + verLabelId +
", areaLabelId=" + areaLabelId +
"} " + super.toString();
}
}
......@@ -68,6 +68,26 @@ public class BookAdviser extends BaseEntity {
*/
private Long secondTempletId;
/**
* 年级标签id
*/
private Long graLabelId;
/**
* 科目标签id
*/
private Long subLabelId;
/**
* 版本标签id
*/
private Long verLabelId;
/**
* 地域标签id
*/
private Long areaLabelId;
public Long getTempletId() {
return templetId;
}
......@@ -148,6 +168,38 @@ public class BookAdviser extends BaseEntity {
this.secondTempletId = secondTempletId;
}
public Long getGraLabelId() {
return graLabelId;
}
public void setGraLabelId(Long graLabelId) {
this.graLabelId = graLabelId;
}
public Long getSubLabelId() {
return subLabelId;
}
public void setSubLabelId(Long subLabelId) {
this.subLabelId = subLabelId;
}
public Long getVerLabelId() {
return verLabelId;
}
public void setVerLabelId(Long verLabelId) {
this.verLabelId = verLabelId;
}
public Long getAreaLabelId() {
return areaLabelId;
}
public void setAreaLabelId(Long areaLabelId) {
this.areaLabelId = areaLabelId;
}
@Override
public String toString() {
return "BookAdviser{" +
......@@ -161,8 +213,10 @@ public class BookAdviser extends BaseEntity {
", isMainEditor=" + isMainEditor +
", isDelete=" + isDelete +
", secondTempletId=" + secondTempletId +
", createTime=" + createTime +
", updateTime=" + updateTime +
'}';
", graLabelId=" + graLabelId +
", subLabelId=" + subLabelId +
", verLabelId=" + verLabelId +
", areaLabelId=" + areaLabelId +
"} " + super.toString();
}
}
package com.pcloud.book.group.dto;
import com.pcloud.common.dto.BaseDto;
import lombok.Data;
/**
* @描述:个人号用户社群书信息
* @作者:zhuyajie
* @创建时间:15:31 2020/1/2
* @版本:1.0
*/
@Data
public class SelfRobotBookGroupDTO extends BaseDto {
/**
* 小号名称
*/
private String wxId;
/**
* 小号昵称
*/
private String wxNickName;
/**
* 社群书id
*/
private Long bookGroupId;
/**
* 社群码名称
*/
private String groupQrcodeName;
/**
* 书刊id
*/
private Long bookId;
/**
* 编辑id
*/
private Long adviserId;
}
......@@ -14,7 +14,12 @@ public enum JoinGroupTypeEnum {
/**
* 客服机器人
*/
ROBOT(2, "客服机器人");
ROBOT(2, "客服机器人"),
/**
* AI客服机器人
*/
AI_ROBOT(3, "AI客服机器人");
private final Integer code;
......
......@@ -9,6 +9,7 @@ import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QueryByBookAdviserDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
import com.pcloud.book.group.dto.SelfRobotBookGroupDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.dto.SelfRobtParamDTO;
import com.pcloud.common.dto.ResponseDto;
......@@ -195,4 +196,8 @@ public interface BookGroupService {
@ApiOperation("获取作品或应用关联的社群书数量")
@PostMapping("getAssocBookGroupCount")
ResponseEntity<ResponseDto<List<BookGroupCountDTO>>> getAssocBookGroupCount(@RequestBody List<BookGroupCountDTO> bookGroupCountDTOS);
@ApiOperation("根据用户和社群书id获取个人号信息")
@GetMapping("getSelfRobotBookGroupInfoByUser")
ResponseEntity<ResponseDto<SelfRobotBookGroupDTO>> getSelfRobotBookGroupInfoByUser(@RequestParam("wxUserId") String wxUserId, @RequestParam("bookGroupId") Long bookGroupId);
}
......@@ -5,6 +5,7 @@ package com.pcloud.book.book.biz;
import com.pcloud.book.base.dto.CountDto;
import com.pcloud.book.book.dto.*;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.entity.BookAdviser;
import com.pcloud.common.exceptions.BizException;
......@@ -138,13 +139,8 @@ public interface BookAdviserBiz {
/**
* 更新模板
* @param bookId 图书标识
* @param channelId 运营标识
* @param adviserId 标识
* @param templetId 模板标识
* @param secondTempletId 第二级列表
*/
public void updateBookTemplet(Long bookId, Long channelId, Long adviserId, Long templetId, Long secondTempletId);
public void updateBookTemplet(Book book);
/**
* 获取图书每日新增个数-出版
......@@ -168,7 +164,7 @@ public interface BookAdviserBiz {
* @param templetId 模板标识
* @param secondTempletId 模板第二阶级标识
*/
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId, Boolean recoverScene);
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId, Long graLabelId, Long subLabelId, Long verLabelId, Long areaLabelId, Boolean recoverScene);
/**
* 获取编辑的图书总数
......
......@@ -12,6 +12,7 @@ import com.pcloud.book.book.dto.BookInfo4AnlysicsDTO;
import com.pcloud.book.book.dto.BookInfoAnalysicsDTO;
import com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
import com.pcloud.book.book.vo.ListNoAuthGroupBookParam;
import com.pcloud.common.exceptions.BizException;
......@@ -584,4 +585,10 @@ public interface BookBiz {
* @return
*/
PageBeanNew<AdviserBookInfoDTO> getListPage4SelfBookGroup(Integer currentPage, Integer numPerPage, String name);
/**
* 获取书籍标签
*/
Map<Integer,List<BookLabel>> getBookLabels();
}
......@@ -17,6 +17,7 @@ import com.pcloud.book.book.dto.BookCountAndAdviserIdDTO;
import com.pcloud.book.book.dto.BookCountByAdvisersDto;
import com.pcloud.book.book.dto.BookCountDto;
import com.pcloud.book.book.dto.BookDto;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.entity.BookAdviser;
import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
......@@ -138,7 +139,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
if (bookAdviserDto != null && BookConstant.BOOK_ADVISER_DELETE.equals(bookAdviserDto.getIsDelete())) { // 编辑之前设置过,但是已经删除,走恢复流程
// 20190723-刘娜【ID1001264】社群书删除后,再创建时不要自动恢复
recoverBook4Adviser(bookAdviser.getBookId(), bookAdviser.getAdviserId(), bookAdviser.getChannelId(),
bookAdviser.getTempletId(),bookAdviser.getSecondTempletId(), false);
bookAdviser.getTempletId(), bookAdviser.getSecondTempletId(),
bookAdviser.getGraLabelId(), bookAdviser.getSubLabelId(), bookAdviser.getVerLabelId(), bookAdviser.getAreaLabelId(),
false);
} else {
// 判断是否配置过该书籍推广信息
checkIsHaveOtherAdviser(bookAdviser.getBookId(), bookAdviser.getChannelId(), bookAdviser.getAdviserId());
......@@ -530,16 +533,20 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
/**
* 更新图书模板
*/
@ParamLog("更新图书模板")
@Override
@Transactional(rollbackFor = Exception.class)
public void updateBookTemplet(Long bookId, Long channelId, Long adviserId, Long templetId, Long secondTempletId) {
LOGGER.info("更新图书模板,<START>.[bookId]=" + bookId + "channelId=" + channelId + "adviserId=" + adviserId + "templetId="+templetId+"secondTempletId="+secondTempletId);
public void updateBookTemplet(Book book) {
BookAdviser bookAdviser = new BookAdviser();
bookAdviser.setBookId(bookId);
bookAdviser.setTempletId(templetId);
bookAdviser.setAdviserId(adviserId);
bookAdviser.setChannelId(channelId);
bookAdviser.setSecondTempletId(secondTempletId);
bookAdviser.setBookId(book.getBookId());
bookAdviser.setTempletId(book.getTempletId());
bookAdviser.setAdviserId(book.getLastModifiedUser());
bookAdviser.setChannelId(book.getChannelId());
bookAdviser.setSecondTempletId(book.getSecondTempletId());
bookAdviser.setGraLabelId(book.getGraLabelId());
bookAdviser.setSubLabelId(book.getSubLabelId());
bookAdviser.setAreaLabelId(book.getAreaLabelId());
bookAdviser.setVerLabelId(book.getVerLabelId());
bookAdviserDao.updateBookTemplet(bookAdviser);
}
......@@ -635,7 +642,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
// 删除图书关联二维码
qrcodeSceneConsr.deleteByBook(bookId, channelId, null);
// 删除书籍编辑的状态
updateBookAdviserStatus(bookId, null, channelId, null,null, BookConstant.BOOK_ADVISER_DELETE, null);
updateBookAdviserStatus(bookId, null, channelId, null,null, null, null, null, null, BookConstant.BOOK_ADVISER_DELETE, null);
// 删除读者端的书架的书籍
bookcaseConsr.deleteBookForAdviser(bookId, channelId, adviserId);
}
......@@ -657,7 +664,7 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
// 删除图书关联二维码
qrcodeSceneConsr.deleteByBook(bookId, channelId, adviserId);
// 删除书籍编辑的状态
updateBookAdviserStatus(bookId, adviserId, channelId, null,null, BookConstant.BOOK_ADVISER_DELETE, null);
updateBookAdviserStatus(bookId, adviserId, channelId, null,null, null, null, null, null, BookConstant.BOOK_ADVISER_DELETE, null);
// 删除读者端的书架的书籍
bookcaseConsr.deleteBookForAdviser(bookId, channelId, adviserId);
}
......@@ -667,11 +674,13 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId, Boolean recoverScene) {
public void recoverBook4Adviser(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId,
Long graLabelId, Long subLabelId, Long verLabelId, Long areaLabelId,
Boolean recoverScene) {
LOGGER.info("恢复书籍-编辑 <START>.[bookId]=" + bookId + ",adviserId=" + adviserId + ",channelId=" + channelId + " templetId= " + templetId + "secondTempletId=" + secondTempletId);
checkIsHaveOtherAdviser(bookId, channelId, adviserId);
// 恢复书籍编辑的状态
updateBookAdviserStatus(bookId, adviserId, channelId, templetId, secondTempletId, BookConstant.BOOK_ADVISER_NO_DELETE,BookConstant.MAIN_ADVISER);
updateBookAdviserStatus(bookId, adviserId, channelId, templetId, secondTempletId, graLabelId, subLabelId, verLabelId, areaLabelId, BookConstant.BOOK_ADVISER_NO_DELETE,BookConstant.MAIN_ADVISER);
// 恢复图书关联的二维码 20190723-刘娜【ID1001264】社群书删除后,再创建时不要自动恢复
if (recoverScene) {
bookGroupBiz.recoverByBookId(bookId, channelId, adviserId);
......@@ -689,7 +698,9 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
* @param isMainAdviser
* @param secondTempletId 第二级标题id
*/
private void updateBookAdviserStatus(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId, Integer deleteStatus, Integer isMainAdviser) {
private void updateBookAdviserStatus(Long bookId, Long adviserId, Long channelId, Long templetId,Long secondTempletId,
Long graLabelId, Long subLabelId, Long verLabelId, Long areaLabelId,
Integer deleteStatus, Integer isMainAdviser) {
LOGGER.info("修改书籍编辑的状态(删除或者恢复) <START>.[bookId]=" + bookId + ",adviserId=" + adviserId + ",channelId="
+ channelId + ",deleteStatus=" + deleteStatus+",isMainAdviser="+isMainAdviser+"templetId"+templetId);
Map<String, Object> paramMap = new HashMap<>();
......@@ -700,6 +711,10 @@ public class BookAdviserBizImpl implements BookAdviserBiz {
paramMap.put("status", deleteStatus);
paramMap.put("templetId", templetId);
paramMap.put("secondTempletId",secondTempletId);
paramMap.put("graLabelId",graLabelId);
paramMap.put("subLabelId",subLabelId);
paramMap.put("verLabelId",verLabelId);
paramMap.put("areaLabelId",areaLabelId);
bookAdviserDao.updateBook4Adviser(paramMap);
if (BookConstant.BOOK_ADVISER_DELETE.equals(deleteStatus)) {
bookGroupBiz.deleteByBookId(bookId, channelId, adviserId);
......
......@@ -22,6 +22,7 @@ import com.pcloud.book.book.biz.BookResourceBiz;
import com.pcloud.book.book.cache.BookCache;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.dao.BookDao;
import com.pcloud.book.book.dao.BookLabelDao;
import com.pcloud.book.book.dto.AdviserBookInfoDTO;
import com.pcloud.book.book.dto.BookAdviserDto;
import com.pcloud.book.book.dto.BookAdviserUpdateTimeDTO;
......@@ -37,6 +38,7 @@ import com.pcloud.book.book.dto.BookInfoAndAuthStatusDTO;
import com.pcloud.book.book.dto.BookNameUpdateDTO;
import com.pcloud.book.book.entity.Book;
import com.pcloud.book.book.entity.BookAdviser;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.book.book.set.BookSet;
import com.pcloud.book.book.tools.BookTools;
import com.pcloud.book.book.vo.ListNoAuthBookParam;
......@@ -147,6 +149,8 @@ public class BookBizImpl implements BookBiz {
private MainLineConsr mainLineConsr;
@Autowired
private BookGroupBiz bookGroupBiz;
@Autowired
private BookLabelDao bookLabelDao;
/**
......@@ -1504,7 +1508,7 @@ public class BookBizImpl implements BookBiz {
// 清除redis中数据
bookCache.clearRedisByBook(book.getBookId(), book.getIsbn(), book.getSerialNumber());
//修改图书类型
bookAdviserBiz.updateBookTemplet(book.getBookId(), book.getChannelId(), book.getLastModifiedUser(), book.getTempletId(), book.getSecondTempletId());
bookAdviserBiz.updateBookTemplet(book);
LOGGER.info("修改图书基本信息与类型[END]");
}
......@@ -1520,6 +1524,10 @@ public class BookBizImpl implements BookBiz {
bookAdviser.setCreatedUser(book.getCreatedUser());
bookAdviser.setTempletId(book.getTempletId());
bookAdviser.setSecondTempletId(book.getSecondTempletId());
bookAdviser.setSubLabelId(book.getSubLabelId());
bookAdviser.setGraLabelId(book.getGraLabelId());
bookAdviser.setAreaLabelId(book.getAreaLabelId());
bookAdviser.setVerLabelId(book.getVerLabelId());
bookAdviserBiz.create(bookAdviser);
}
......@@ -1779,4 +1787,15 @@ public class BookBizImpl implements BookBiz {
}
return pageBean;
}
@ParamLog("获取书籍标签")
@Override
public Map<Integer, List<BookLabel>> getBookLabels() {
Map<Integer, List<BookLabel>> map = new HashMap<>();
List<BookLabel> bookLabels = bookLabelDao.getAll();
if (!ListUtils.isEmpty(bookLabels)) {
map = bookLabels.stream().collect(Collectors.groupingBy(BookLabel::getType));
}
return map;
}
}
package com.pcloud.book.book.dao;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
import java.util.Map;
public interface BookLabelDao extends BaseDao<BookLabel> {
List<BookLabel> getListByType(Integer type);
List<BookLabel> getAll();
Map<Long,BookLabel> getMapByIds(List<Long> list);
}
package com.pcloud.book.book.dao.impl;
import com.pcloud.book.book.dao.BookLabelDao;
import com.pcloud.book.book.entity.BookLabel;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/27 17:23
**/
@Repository("bookLabelDao")
public class BookLabelDaoImpl extends BaseDaoImpl<BookLabel> implements BookLabelDao {
@Override
public List<BookLabel> getListByType(Integer type) {
return super.getSqlSession().selectList(super.getStatement("getListByType"), type);
}
@Override
public List<BookLabel> getAll() {
return super.getSqlSession().selectList(super.getStatement("getAll"));
}
@Override
public Map<Long, BookLabel> getMapByIds(List<Long> list) {
return super.getSqlSession().selectMap(super.getStatement("getMapByIds"), list,"id");
}
}
package com.pcloud.book.book.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/27 17:20
**/
@Data
@ApiModel("书籍标签")
public class BookLabel extends BaseEntity {
@ApiModelProperty("标签名称")
private String name;
@ApiModelProperty("标签类型")
private Integer type;
}
......@@ -599,4 +599,10 @@ public interface BookFacade {
@RequestParam(value = "currentPage", required = false) Integer currentPage,
@RequestParam(value = "numPerPage", required = false) Integer numPerPage)
throws BizException, PermissionException;
@ApiOperation("获取书籍标签")
@GetMapping("getBookLabels")
ResponseDto<?> getBookLabels(
@RequestHeader("token") String token
) throws BizException, PermissionException;
}
......@@ -149,7 +149,7 @@ public class BookAdviserFacadeImpl implements BookAdviserFacade {
@RequestParam(value = "channelId", required = false) Long channelId)
throws BizException, PermissionException, JsonParseException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookAdviserBiz.recoverBook4Adviser(bookId, adviserId, channelId, null,null, true);
bookAdviserBiz.recoverBook4Adviser(bookId, adviserId, channelId, null,null, null, null, null, null, true);
return new ResponseDto<>();
}
......
......@@ -824,4 +824,13 @@ public class BookFacadeImpl implements BookFacade {
return new ResponseDto<>(null == pageBean ? new PageBeanNew<>() : pageBean);
}
@GetMapping("getBookLabels")
@Override
public ResponseDto<?> getBookLabels(
@RequestHeader("token") String token
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(bookBiz.getBookLabels());
}
}
\ No newline at end of file
......@@ -5,6 +5,7 @@ import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.keywords.entity.BookGuide;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.push.entity.PushGroup;
import com.pcloud.book.push.entity.PushItem;
import com.pcloud.common.page.PageBeanNew;
......@@ -26,4 +27,6 @@ public interface BookGroupAppBiz {
void exportBookGroupAppDTOSByBookGroupId(Long bookGroupId,String systemCode,Long partyId);
void addOldBookGroupAppToNew();
void addSelfKeywordToBookGroupApp(List<SelfRobotKeyword> selfRobotKeywords);
}
......@@ -23,6 +23,7 @@ import com.pcloud.book.group.dto.QrcodeNameAndProIdDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
import com.pcloud.book.group.dto.SelfBookGroupStDTO;
import com.pcloud.book.group.dto.SelfBookGroupStParamDTO;
import com.pcloud.book.group.dto.SelfRobotBookGroupDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.dto.SelfRobtParamDTO;
import com.pcloud.book.group.dto.TopAgentBookGroupDTO;
......@@ -30,6 +31,7 @@ import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.dto.AgentStatisticsInfoDTO;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.book.group.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.book.group.vo.FriendsVO;
......@@ -721,4 +723,17 @@ public interface BookGroupBiz {
* @return
*/
List<ListKeywordVO> getClassifyKeywordStatistic(Long classifyId);
/**
* 新增微信用户和rays系统用户关联关系
*/
void createWxWechatUserCorrelation(Long wechatUserId, WxWechatUserCorrelation wxWechatUserCorrelation);
/**
* 根据用户和社群书id获取个人号信息
* @param wxUserId
* @param bookGroupId
* @return
*/
SelfRobotBookGroupDTO getSelfRobotBookGroupInfoByUser(String wxUserId, Long bookGroupId);
}
......@@ -32,6 +32,7 @@ import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.entity.BookGuide;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.entity.PushGroup;
......@@ -351,6 +352,36 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz {
}
@ParamLog("将个人号应用关键词插入到社群书应用")
@Override
public void addSelfKeywordToBookGroupApp(List<SelfRobotKeyword> selfRobotKeywords) {
if (ListUtils.isEmpty(selfRobotKeywords)) {
return;
}
List<BookGroupApp> bookGroupApps = new ArrayList<>();
for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords) {
if (ReplyTypeEnum.APP.value.equals(selfRobotKeyword.getType())) {
BookGroupApp bookGroupApp = new BookGroupApp();
bookGroupApp.setOriginType(BookGroupAppOriginTypeEnum.SELF_KEYWORD.code);
bookGroupApp.setServeId(selfRobotKeyword.getServeId());
bookGroupApp.setServeType(selfRobotKeyword.getServeType());
bookGroupApp.setClassifyId(0L);
bookGroupApp.setBookGroupId(selfRobotKeyword.getBookGroupId());
bookGroupApp.setCreateUser(selfRobotKeyword.getCreateUser());
//判断是否已经添加过
BookGroupApp bookGroupAppOld = bookGroupAppDao.getByCondition(bookGroupApp);
if (bookGroupAppOld != null) {
continue;
}
bookGroupApps.add(bookGroupApp);
}
}
if (ListUtils.isEmpty(bookGroupApps)) {
return;
}
bookGroupAppDao.batchInsert(bookGroupApps);
}
@ParamLog("导出")
private void exportDTOS(List<BookGroupAppDTO> list, Long bookGroupId, String systemCode, Long partyId) {
if (ListUtils.isEmpty(list)) {
......
......@@ -6,6 +6,7 @@ import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.DayCountDTO;
import com.pcloud.book.group.dto.LabelUserCountDTO;
import com.pcloud.book.group.dto.SelfRobotBookGroupDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.book.group.vo.UserBookInfoItemVO;
......@@ -154,4 +155,17 @@ public interface BookGroupCipherUserDao extends BaseDao<BookGroupCipherUser> {
* @return
*/
List<AltAndCountDTO> getAltFriendList(Long bookGroupId);
/**
* 根据wxUserId获取
*/
BookGroupCipherUser getByWxUserId(String wxUserId);
/**
* 根据用户和社群书id获取个人号信息
* @param wxUserId
* @param bookGroupId
* @return
*/
SelfRobotBookGroupDTO getSelfRobotBookGroupInfoByUser(String wxUserId, Long bookGroupId);
}
......@@ -298,4 +298,9 @@ public interface BookGroupDao extends BaseDao<BookGroup> {
* @return
*/
BookGroupStatistic4AgentDTO getBaseInfoByBookId(Long bookId);
/**
* 根据书籍简称获取
*/
BookGroup getByShortBookName(String shortBookName);
}
package com.pcloud.book.group.dao;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.common.core.dao.BaseDao;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/31 17:05
**/
public interface WxWechatUserCorrelationDao extends BaseDao<WxWechatUserCorrelation> {
WxWechatUserCorrelation getByWxIdAndBookGroupId(Long bookGroupId, String wxId);
}
......@@ -7,6 +7,7 @@ import com.pcloud.book.group.dto.BookGroupIdAndCountDTO;
import com.pcloud.book.group.dto.CountAndTimeDTO;
import com.pcloud.book.group.dto.DayCountDTO;
import com.pcloud.book.group.dto.LabelUserCountDTO;
import com.pcloud.book.group.dto.SelfRobotBookGroupDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.book.group.vo.UserBookInfoItemVO;
......@@ -168,4 +169,17 @@ public class BookGroupCipherUserDaoImpl extends BaseDaoImpl<BookGroupCipherUser>
public List<AltAndCountDTO> getAltFriendList(Long bookGroupId) {
return getSessionTemplate().selectList(getStatement("getAltFriendList"), bookGroupId);
}
@Override
public BookGroupCipherUser getByWxUserId(String wxUserId) {
return getSessionTemplate().selectOne(getStatement("getByWxUserId"), wxUserId);
}
@Override
public SelfRobotBookGroupDTO getSelfRobotBookGroupInfoByUser(String wxUserId, Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("wxUserId", wxUserId);
return getSessionTemplate().selectOne(getStatement("getSelfRobotBookGroupInfoByUser"), map);
}
}
......@@ -336,4 +336,9 @@ public class BookGroupDaoImpl extends BaseDaoImpl<BookGroup> implements BookGrou
public BookGroupStatistic4AgentDTO getBaseInfoByBookId(Long bookId) {
return getSessionTemplate().selectOne(getStatement("getBaseInfoByBookId"), bookId);
}
@Override
public BookGroup getByShortBookName(String shortBookName) {
return super.getSqlSession().selectOne(getStatement("getByShortBookName"),shortBookName);
}
}
......@@ -25,7 +25,9 @@ public class BookGroupServeDaoImpl extends BaseDaoImpl<BookGroupServe> implement
@Override
public List<BookGroupServe> getListByBookGroupId(Long bookGroupId) {
return super.getSqlSession().selectList(getStatement("getListByBookGroupId"), bookGroupId);
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
return super.getSqlSession().selectList(getStatement("getListByBookGroupId"), map);
}
@Override
......
package com.pcloud.book.group.dao.impl;
import com.pcloud.book.group.dao.WxWechatUserCorrelationDao;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/31 17:06
**/
@Component("wxWechatUserCorrelationDao")
public class WxWechatUserCorrelationDaoImpl extends BaseDaoImpl<WxWechatUserCorrelation> implements WxWechatUserCorrelationDao {
@Override
public WxWechatUserCorrelation getByWxIdAndBookGroupId(Long bookGroupId, String wxId) {
Map<String,Object> map=new HashMap<>();
map.put("bookGroupId",bookGroupId);
map.put("wxId",wxId);
return this.getSqlSession().selectOne(getStatement("getByWxIdAndBookGroupId"),map);
}
}
......@@ -214,6 +214,52 @@ public class BookGroupDTO extends BaseDto {
* 是否属于特殊出版社
*/
private Boolean belongSpecialAgent;
/**
* 书籍简称
*/
private String shortBookName;
/**
* 年级标签id
*/
private Long graLabelId;
/**
* 科目标签id
*/
private Long subLabelId;
/**
* 版本标签id
*/
private Long verLabelId;
/**
* 地域标签id
*/
private Long areaLabelId;
/**
* 年级标签名称
*/
private String graLabelName;
/**
* 科目标签名称
*/
private String subLabelName;
/**
* 版本标签名称
*/
private String verLabelName;
/**
* 地域标签名称
*/
private String areaLabelName;
public String getUrl() {
return url;
......@@ -545,6 +591,78 @@ public class BookGroupDTO extends BaseDto {
this.belongSpecialAgent = belongSpecialAgent;
}
public String getShortBookName() {
return shortBookName;
}
public void setShortBookName(String shortBookName) {
this.shortBookName = shortBookName;
}
public Long getGraLabelId() {
return graLabelId;
}
public void setGraLabelId(Long graLabelId) {
this.graLabelId = graLabelId;
}
public Long getSubLabelId() {
return subLabelId;
}
public void setSubLabelId(Long subLabelId) {
this.subLabelId = subLabelId;
}
public Long getVerLabelId() {
return verLabelId;
}
public void setVerLabelId(Long verLabelId) {
this.verLabelId = verLabelId;
}
public Long getAreaLabelId() {
return areaLabelId;
}
public void setAreaLabelId(Long areaLabelId) {
this.areaLabelId = areaLabelId;
}
public String getGraLabelName() {
return graLabelName;
}
public void setGraLabelName(String graLabelName) {
this.graLabelName = graLabelName;
}
public String getSubLabelName() {
return subLabelName;
}
public void setSubLabelName(String subLabelName) {
this.subLabelName = subLabelName;
}
public String getVerLabelName() {
return verLabelName;
}
public void setVerLabelName(String verLabelName) {
this.verLabelName = verLabelName;
}
public String getAreaLabelName() {
return areaLabelName;
}
public void setAreaLabelName(String areaLabelName) {
this.areaLabelName = areaLabelName;
}
@Override
public String toString() {
return "BookGroupDTO{" +
......@@ -590,5 +708,15 @@ public class BookGroupDTO extends BaseDto {
", assocState=" + assocState +
", belongSpecialAgent=" + belongSpecialAgent +
'}';
", shortBookName='" + shortBookName + '\'' +
", graLabelId=" + graLabelId +
", subLabelId=" + subLabelId +
", verLabelId=" + verLabelId +
", areaLabelId=" + areaLabelId +
", graLabelName=" + graLabelName +
", subLabelName=" + subLabelName +
", verLabelName=" + verLabelName +
", areaLabelName=" + areaLabelName +
"} " + super.toString();
}
}
\ No newline at end of file
......@@ -150,6 +150,11 @@ public class BookGroup extends BaseEntity {
*/
private Boolean belongSpecialAgent;
/**
* 书籍简称
*/
private String shortBookName;
public Long getId() {
return id;
}
......@@ -366,6 +371,14 @@ public class BookGroup extends BaseEntity {
this.belongSpecialAgent = belongSpecialAgent;
}
public String getShortBookName() {
return shortBookName;
}
public void setShortBookName(String shortBookName) {
this.shortBookName = shortBookName;
}
@Override
public String toString() {
return "BookGroup{" +
......@@ -397,5 +410,7 @@ public class BookGroup extends BaseEntity {
", agentId=" + agentId +
", belongSpecialAgent=" + belongSpecialAgent +
'}';
", shortBookName='" + shortBookName + '\'' +
"} " + super.toString();
}
}
\ No newline at end of file
......@@ -25,6 +25,9 @@ public class BookGroupCipherUser extends BaseEntity {
@ApiModelProperty("机器人id")
private String altId;
@ApiModelProperty("书籍简称")
private String shortBookName;
public Long getBookGroupId() {
return bookGroupId;
}
......@@ -57,6 +60,14 @@ public class BookGroupCipherUser extends BaseEntity {
this.altId = altId;
}
public String getShortBookName() {
return shortBookName;
}
public void setShortBookName(String shortBookName) {
this.shortBookName = shortBookName;
}
@Override
public String toString() {
return "BookGroupCipherUser{" +
......@@ -64,6 +75,7 @@ public class BookGroupCipherUser extends BaseEntity {
", bookGroupCipher='" + bookGroupCipher + '\'' +
", wxUserId='" + wxUserId + '\'' +
", altId='" + altId + '\'' +
", shortBookName='" + shortBookName + '\'' +
"} " + super.toString();
}
}
package com.pcloud.book.group.entity;
import com.pcloud.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/31 16:51
**/
@Data
@ApiModel("微信用户和rays系统用户关联关系")
public class WxWechatUserCorrelation extends BaseEntity {
@ApiModelProperty("社群书id")
private Long bookGroupId;
@ApiModelProperty("微信用户id")
private String wxId;
@ApiModelProperty("rays系统微信用户id")
private Long wechatUserId;
}
......@@ -18,7 +18,12 @@ public enum BookGroupAppOriginTypeEnum {
/**
* 配置资源
*/
SERVE(4, "配置资源");
SERVE(4, "配置资源"),
/**
* 个人关键词
*/
SELF_KEYWORD(5,"个人关键词");
public final Integer code;
......
......@@ -7,6 +7,7 @@ import com.pcloud.book.group.dto.UserSelectParamDTO;
import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.book.group.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
import com.pcloud.book.group.vo.FriendsVO;
......@@ -149,7 +150,7 @@ public interface BookGroupFacade {
@RequestParam(value = "isMainEditor", required = false) Integer isMainEditor,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "bookId", required = false) Integer bookId,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType,
@RequestParam(value = "joinGroupType", required = false) String joinGroupType,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "hasServe", required = false) Boolean hasServe)
......@@ -669,4 +670,11 @@ public interface BookGroupFacade {
@GetMapping("getClassifyKeywordStatistic")
ResponseDto<List<ListKeywordVO>> getClassifyKeywordStatistic(
@RequestHeader("token") String token, @RequestParam("classifyId") Long classifyId) throws PermissionException;
@ApiOperation("新增微信用户和rays系统用户关联关系")
@PostMapping("createWxWechatUserCorrelation")
ResponseDto<?> createWxWechatUserCorrelation(
@CookieValue("userInfo") String userInfo,
@RequestBody WxWechatUserCorrelation wxWechatUserCorrelation
)throws BizException, PermissionException;
}
......@@ -12,6 +12,8 @@ import com.pcloud.book.group.entity.BookGroup;
import com.pcloud.book.group.entity.BookGroupClassify;
import com.pcloud.book.group.entity.BookGroupServe;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.group.entity.WxWechatUserCorrelation;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.group.facade.BookGroupFacade;
import com.pcloud.book.group.vo.BookGroupAnalysisParam;
import com.pcloud.book.group.vo.BookGroupAnalysisVO;
......@@ -53,6 +55,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -192,7 +195,7 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
@RequestParam(value = "isMainEditor", required = false) Integer isMainEditor,
@RequestParam(value = "isFundSupport", required = false) Integer isFundSupport,
@RequestParam(value = "bookId", required = false) Integer bookId,
@RequestParam(value = "joinGroupType", required = false) Integer joinGroupType,
@RequestParam(value = "joinGroupType", required = false) String joinGroupType,
@RequestParam(value = "startDate", required = false) String startDate,
@RequestParam(value = "endDate", required = false) String endDate,
@RequestParam(value = "hasServe", required = false) Boolean hasServe)
......@@ -211,7 +214,15 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
paramMap.put("bookName", bookName != null && "".equals(bookName.trim()) ? null : bookName);
paramMap.put("typeCode", typeCode != null && "".equals(typeCode.trim()) ? null : typeCode);
paramMap.put("bookId", bookId);
paramMap.put("joinGroupType", joinGroupType);
List<Integer> joinGroupTypes = new ArrayList<>();
if ("GROUP".equals(joinGroupType)) {
joinGroupTypes.add(JoinGroupTypeEnum.GROUP_QRCODE.getCode());
}
if ("ROBOT".equals(joinGroupType)) {
joinGroupTypes.add(JoinGroupTypeEnum.ROBOT.getCode());
joinGroupTypes.add(JoinGroupTypeEnum.AI_ROBOT.getCode());
}
paramMap.put("joinGroupTypes", joinGroupTypes);
if (!StringUtil.isEmpty(startDate) && !StringUtil.isEmpty(endDate)) {
paramMap.put("startDate", startDate + " 00:00:00");
paramMap.put("endDate", endDate + " 23:59:59");
......@@ -1042,4 +1053,16 @@ public class BookGroupFacadeImpl implements BookGroupFacade {
List<ListKeywordVO> listKeywordVOS = bookGroupBiz.getClassifyKeywordStatistic(classifyId);
return new ResponseDto<>(listKeywordVOS);
}
@ApiOperation("新增微信用户和rays系统用户关联关系")
@PostMapping("createWxWechatUserCorrelation")
@Override
public ResponseDto<?> createWxWechatUserCorrelation(
@CookieValue("userInfo") String userInfo,
@RequestBody WxWechatUserCorrelation wxWechatUserCorrelation
) throws BizException, PermissionException {
Long wechatUserId = Cookie.getId(userInfo, Cookie._WECHAT_USER_ID);
bookGroupBiz.createWxWechatUserCorrelation(wechatUserId,wxWechatUserCorrelation);
return new ResponseDto<>();
}
}
......@@ -11,6 +11,7 @@ import com.pcloud.book.group.dto.GroupUseDTO;
import com.pcloud.book.group.dto.PersonalQrcodeDTO;
import com.pcloud.book.group.dto.QueryByBookAdviserDTO;
import com.pcloud.book.group.dto.ResourceBrowseParamDto;
import com.pcloud.book.group.dto.SelfRobotBookGroupDTO;
import com.pcloud.book.group.dto.SelfRobotUserDTO;
import com.pcloud.book.group.dto.SelfRobtParamDTO;
import com.pcloud.book.group.service.BookGroupService;
......@@ -337,4 +338,12 @@ public class BookGroupServiceImpl implements BookGroupService {
}
@ApiOperation("根据用户和社群书id获取个人号信息")
@GetMapping("getSelfRobotBookGroupInfoByUser")
@Override
public ResponseEntity<ResponseDto<SelfRobotBookGroupDTO>> getSelfRobotBookGroupInfoByUser(@RequestParam("wxUserId") String wxUserId, @RequestParam("bookGroupId") Long bookGroupId) {
SelfRobotBookGroupDTO selfRobotBookGroupDTO = bookGroupBiz.getSelfRobotBookGroupInfoByUser(wxUserId, bookGroupId);
return ResponseHandleUtil.toResponse(selfRobotBookGroupDTO);
}
}
package com.pcloud.book.keywords.biz;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
public interface SelfRobotKeywordBiz {
void batchAddSelfRobotKeyword(Long partyId, List<SelfRobotKeyword> selfRobotKeywords);
void updateSelfRobotKeyword(Long partyId, SelfRobotKeyword selfRobotKeyword);
void deleteSelfRobotKeyword(Long id);
PageBeanNew<SelfRobotKeyword> getSelfRobotKeywordList(Long bookGroupId, String keyword, Integer currentPage, Integer numPerPage);
void updateSelfRobotKeywordSeqNum(SelfRobotKeyword selfRobotKeyword);
String getAppOrProductServeUrl(Long bookGroupId, Long serveId, String serveType, String serveUrl);
String getMaxKeyword(Long bookGroupId);
}
......@@ -122,7 +122,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
//如果暗号为空,表示直接加好友,需要发送统一欢迎语
if (cipher == null) {
SendTextMessageVO vo = new SendTextMessageVO();
vo.setContent("你好,请将书的专属暗号发给我!可以在扫码后的页面上复制,也可以在书上印码位置处找到。");
vo.setContent("终于和您见面了!\n请告诉我您在读哪本书?\n您可以在书中二维码旁找到本书的识别码,以微信聊天的形式发给我。");
vo.setCode(SendMessageTypeEnum.SELF.getCode());
vo.setWxId(agreeAddUserDTO.getRobotWxId());
vo.setAltId(agreeAddUserDTO.getRobotWxId());
......
package com.pcloud.book.keywords.dao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/30 11:39
**/
public interface SelfRobotKeywordDao extends BaseDao<SelfRobotKeyword> {
Integer batchInsert(List<SelfRobotKeyword> selfRobotKeywords);
void updateSelfRobotKeyword(SelfRobotKeyword selfRobotKeyword);
void deleteByBookGroupIds(List<Long> bookGroupIds);
List<SelfRobotKeyword> getListByBookGroupId(Long bookGroupId);
SelfRobotKeyword getByBookGroupIdAndKeyword(Long bookGroupId, String keyword);
Integer getCountByBookGroupId(Long bookGroupId);
List<MaxSeqNAndBGDTO> getMaxSeqNumByBookGroupIds(List<Long> bookGroupIds);
void updateSeqNum(Long id, Integer seqNum);
String getMaxKeyword(Long bookGroupId);
}
package com.pcloud.book.keywords.dao.impl;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/30 11:39
**/
@Component("selfRobotKeywordDao")
public class SelfRobotKeywordDaoImpl extends BaseDaoImpl<SelfRobotKeyword> implements SelfRobotKeywordDao {
@Override
public Integer batchInsert(List<SelfRobotKeyword> selfRobotKeywords) {
return this.getSqlSession().insert(this.getStatement("batchInsert"), selfRobotKeywords);
}
@Override
public void updateSelfRobotKeyword(SelfRobotKeyword selfRobotKeyword) {
this.getSqlSession().update(this.getStatement("updateSelfRobotKeyword"), selfRobotKeyword);
}
@Override
public void deleteByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
this.getSqlSession().delete(this.getStatement("deleteByBookGroupIds"), map);
}
@Override
public List<SelfRobotKeyword> getListByBookGroupId(Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
return this.getSqlSession().selectList(this.getStatement("getListByBookGroupId"), map);
}
@Override
public SelfRobotKeyword getByBookGroupIdAndKeyword(Long bookGroupId, String keyword) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
map.put("keyword", keyword);
return this.getSqlSession().selectOne(this.getStatement("getByBookGroupIdAndKeyword"), map);
}
@Override
public Integer getCountByBookGroupId(Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
return this.getSqlSession().selectOne(this.getStatement("getCountByBookGroupId"), map);
}
@Override
public List<MaxSeqNAndBGDTO> getMaxSeqNumByBookGroupIds(List<Long> bookGroupIds) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupIds", bookGroupIds);
return this.getSqlSession().selectList(this.getStatement("getMaxSeqNumByBookGroupIds"), map);
}
@Override
public void updateSeqNum(Long id, Integer seqNum) {
Map<String, Object> map = new HashMap<>();
map.put("id", id);
map.put("seqNum", seqNum);
this.getSqlSession().update(this.getStatement("updateSeqNum"), map);
}
@Override
public String getMaxKeyword(Long bookGroupId) {
Map<String, Object> map = new HashMap<>();
map.put("bookGroupId", bookGroupId);
return this.getSqlSession().selectOne(this.getStatement("getMaxKeyword"), map);
}
}
package com.pcloud.book.keywords.dto;
import lombok.Data;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/31 12:06
**/
@Data
public class MaxSeqNAndBGDTO {
private Integer maxSeqNum;
private Long bookGroupId;
}
package com.pcloud.book.keywords.entity;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/30 10:55
**/
@Data
@ApiModel("个人号关键词")
public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty("社群码id")
private Long bookGroupId;
@ApiModelProperty("引导语")
private String guide;
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("类型 1 文字 2 图片 3 链接 4应用 5素材")
private Integer type;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("链接地址")
private String linkUrl;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("应用或作品id")
private Long serveId;
@ApiModelProperty("应用或作品类型")
private String serveType;
@ApiModelProperty("资源id")
private Long resourceId;
@ApiModelProperty("排序值")
private Integer seqNum;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("应用或作品图片")
private String servePic;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用或作品类型编码")
private String serveTypeCode;
@ApiModelProperty("资源链接")
private String resourceUrl;
@ApiModelProperty("资源名称")
private String resourceName;
@ApiModelProperty("资源类型编码")
private String resourceTypeCode;
@ApiModelProperty("资源类型名称")
private String resourceTypeName;
@ApiModelProperty("文件类型")
private String fileType;
@ApiModelProperty("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
}
......@@ -22,7 +22,11 @@ public enum ReplyTypeEnum {
/**
* 应用
*/
APP(4);
APP(4),
/**
* 资源
*/
RESOURCE(5);
/**
* 值
*/
......
package com.pcloud.book.keywords.facade;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.common.dto.ResponseDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.permission.PermissionException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@Api(description = "个人号关键词")
public interface SelfRobotKeywordFacade {
@ApiOperation("批量新增个人号关键词")
@PostMapping("batchAddSelfRobotKeyword")
ResponseDto<?> batchAddSelfRobotKeyword(
@RequestHeader("token") String token,
@RequestBody @ApiParam("个人号关键词") List<SelfRobotKeyword> selfRobotKeywords
) throws BizException, PermissionException;
@ApiOperation("更新个人号关键词")
@PostMapping("updateSelfRobotKeyword")
ResponseDto<?> updateSelfRobotKeyword(
@RequestHeader("token") String token,
@RequestBody @ApiParam("个人号关键词") SelfRobotKeyword selfRobotKeyword
) throws BizException, PermissionException;
@ApiOperation("删除个人号关键词")
@GetMapping("deleteSelfRobotKeyword")
ResponseDto<?> deleteSelfRobotKeyword(
@RequestHeader("token") String token,
@RequestParam("id") @ApiParam("个人号关键词id") Long id
) throws BizException, PermissionException;
@ApiOperation("获取个人号关键词列表")
@GetMapping("getSelfRobotKeywordList")
ResponseDto<?> getSelfRobotKeywordList(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam(value = "keyword",required = false) @ApiParam("关键词") String keyword,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("客户端获取个人号关键词列表")
@GetMapping("getSelfRobotKeywordList4Wechat")
ResponseDto<?> getSelfRobotKeywordList4Wechat(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam(value = "keyword",required = false) @ApiParam("关键词") String keyword,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws BizException, PermissionException;
@ApiOperation("修改个人号关键词排序值")
@PostMapping("updateSelfRobotKeywordSeqNum")
ResponseDto<?> updateSelfRobotKeywordSeqNum(
@RequestHeader("token") String token,
@RequestBody @ApiParam("个人号关键词") SelfRobotKeyword selfRobotKeyword
) throws BizException, PermissionException;
@ApiOperation("获取应用或作品链接")
@GetMapping("getAppOrProductServeUrl")
ResponseDto<?> getAppOrProductServeUrl(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam("serveId") @ApiParam("作品或应用id") Long serveId,
@RequestParam("serveType") @ApiParam("作品或应用类型") String serveType,
@RequestParam("serveUrl") @ApiParam("作品或应用链接") String serveUrl
) throws BizException, PermissionException;
@ApiOperation("获取最大关键词")
@GetMapping("getMaxKeyword")
ResponseDto<?> getMaxKeyword(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId
) throws BizException, PermissionException;
}
package com.pcloud.book.keywords.facade.impl;
import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.facade.SelfRobotKeywordFacade;
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 io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @Description
* @Author ruansiyuan
* @Date 2019/12/30 11:05
**/
@RestController("selfRobotKeywordFacade")
@RequestMapping("selfRobotKeyword")
public class SelfRobotKeywordFacadeImpl implements SelfRobotKeywordFacade {
@Autowired
private SelfRobotKeywordBiz selfRobotKeywordBiz;
@ApiOperation("批量新增个人号关键词")
@PostMapping("batchAddSelfRobotKeyword")
@Override
public ResponseDto<?> batchAddSelfRobotKeyword(
@RequestHeader("token") String token,
@RequestBody @ApiParam("个人号关键词") List<SelfRobotKeyword> selfRobotKeywords
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
selfRobotKeywordBiz.batchAddSelfRobotKeyword(partyId, selfRobotKeywords);
return new ResponseDto<>();
}
@ApiOperation("更新个人号关键词")
@PostMapping("updateSelfRobotKeyword")
@Override
public ResponseDto<?> updateSelfRobotKeyword(
@RequestHeader("token") String token,
@RequestBody @ApiParam("个人号关键词") SelfRobotKeyword selfRobotKeyword
) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
selfRobotKeywordBiz.updateSelfRobotKeyword(partyId, selfRobotKeyword);
return new ResponseDto<>();
}
@ApiOperation("删除个人号关键词")
@GetMapping("deleteSelfRobotKeyword")
@Override
public ResponseDto<?> deleteSelfRobotKeyword(
@RequestHeader("token") String token,
@RequestParam("id") @ApiParam("个人号关键词id") Long id
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
selfRobotKeywordBiz.deleteSelfRobotKeyword(id);
return new ResponseDto<>();
}
@ApiOperation("获取个人号关键词列表")
@GetMapping("getSelfRobotKeywordList")
@Override
public ResponseDto<?> getSelfRobotKeywordList(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam(value = "keyword",required = false) @ApiParam("关键词") String keyword,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(selfRobotKeywordBiz.getSelfRobotKeywordList(bookGroupId,keyword,currentPage,numPerPage));
}
@ApiOperation("客户端获取个人号关键词列表")
@GetMapping("getSelfRobotKeywordList4Wechat")
@Override
public ResponseDto<?> getSelfRobotKeywordList4Wechat(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam(value = "keyword",required = false) @ApiParam("关键词") String keyword,
@RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage
) throws BizException, PermissionException {
Cookie.getUserInfo(userInfo);
return new ResponseDto<>(selfRobotKeywordBiz.getSelfRobotKeywordList(bookGroupId,keyword,currentPage,numPerPage));
}
@ApiOperation("修改个人号关键词排序值")
@PostMapping("updateSelfRobotKeywordSeqNum")
@Override
public ResponseDto<?> updateSelfRobotKeywordSeqNum(
@RequestHeader("token") String token,
@RequestBody @ApiParam("个人号关键词") SelfRobotKeyword selfRobotKeyword
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
selfRobotKeywordBiz.updateSelfRobotKeywordSeqNum(selfRobotKeyword);
return new ResponseDto<>();
}
@ApiOperation("获取应用或作品链接")
@GetMapping("getAppOrProductServeUrl")
@Override
public ResponseDto<?> getAppOrProductServeUrl(
@CookieValue("userInfo") String userInfo,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId,
@RequestParam("serveId") @ApiParam("作品或应用id") Long serveId,
@RequestParam("serveType") @ApiParam("作品或应用类型") String serveType,
@RequestParam("serveUrl") @ApiParam("作品或应用链接") String serveUrl
) throws BizException, PermissionException {
Cookie.getUserInfo(userInfo);
return new ResponseDto<>(selfRobotKeywordBiz.getAppOrProductServeUrl(bookGroupId,serveId,serveType,serveUrl));
}
@ApiOperation("获取最大关键词")
@GetMapping("getMaxKeyword")
@Override
public ResponseDto<?> getMaxKeyword(
@RequestHeader("token") String token,
@RequestParam("bookGroupId") @ApiParam("社群码id") Long bookGroupId
) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(selfRobotKeywordBiz.getMaxKeyword(bookGroupId));
}
}
......@@ -6,6 +6,7 @@ import com.pcloud.book.group.dao.BookGroupServeDao;
import com.pcloud.book.group.dto.BookGroupDTO;
import com.pcloud.book.group.enums.JoinGroupTypeEnum;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.mq.config.MQTopicConumer;
import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SceneCode;
......@@ -40,6 +41,8 @@ public class SomeUserScanBookGroupListener {
private BookGroupServeDao bookGroupServeDao;
@Autowired
private TemplateConsr templateConsr;
@Autowired
private SelfRobotKeywordDao selfRobotKeywordDao;
@ParamLog("接收社群码扫码人数达到一定数量topic")
@RabbitHandler
......@@ -68,6 +71,13 @@ public class SomeUserScanBookGroupListener {
isSend = true;
}
}
if (JoinGroupTypeEnum.AI_ROBOT.getCode().equals(joinGroupType)) {
//1v1查询有没有配置资源服务
Integer count = selfRobotKeywordDao.getCountByBookGroupId(bookGroupId);
if (count <= 0) {
isSend = true;
}
}
if (isSend) {
//发送模板消息
sendTemplate(dto);
......
......@@ -56,6 +56,11 @@
<result column="join_group_type" property="joinGroupType" jdbcType="INTEGER"/>
<result column="book_group_cipher" property="bookGroupCipher" jdbcType="VARCHAR"/>
<result column="has_serve" property="hasServe" jdbcType="VARCHAR"/>
<result column="short_book_name" property="shortBookName" jdbcType="VARCHAR"/>
<result column="GRA_LABEL_ID" property="graLabelId" jdbcType="BIGINT" />
<result column="SUB_LABEL_ID" property="subLabelId" jdbcType="BIGINT" />
<result column="VER_LABEL_ID" property="verLabelId" jdbcType="BIGINT" />
<result column="AREA_LABEL_ID" property="areaLabelId" jdbcType="BIGINT" />
</resultMap>
<resultMap id="bookListPageMap" type="bookDto" extends ="bookMap">
......@@ -284,7 +289,8 @@
SELECT
B.BOOK_ID, B.TYPE_CODE,B.ISBN, B.BOOK_NAME,T.TYPE_NAME, B.REMARK, B.AUTHOR, B.PUBLISH,
B.PUBLISH_DATE, B.COVER_IMG, B.AD_IMG, B.DETAIL, B.`VERSION`,B.BOOK_PRICE,B.ISSN,B.SERIAL_NUMBER,BA.IS_MAIN_EDITOR,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,START_TIME,END_TIME,BA.TEMPLET_ID,BA.SECOND_TEMPLET_ID
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT,START_TIME,END_TIME,BA.TEMPLET_ID,BA.SECOND_TEMPLET_ID,
BA.GRA_LABEL_ID,BA.SUB_LABEL_ID,BA.VER_LABEL_ID,BA.AREA_LABEL_ID
FROM
BOOK_ADVISER BA
INNER JOIN
......@@ -545,7 +551,8 @@
SELECT
A.BOOK_ID, A.CHANNEL_ID, A.ADVISER_ID, A.IS_MAIN_EDITOR, B.ISBN, B.BOOK_NAME, B.TYPE_CODE,
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
A.TEMPLET_ID,A.SECOND_TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber
A.TEMPLET_ID,A.SECOND_TEMPLET_ID, A.LAST_MODIFIED_DATE, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber,
A.GRA_LABEL_ID,A.SUB_LABEL_ID,A.VER_LABEL_ID,A.AREA_LABEL_ID
FROM
BOOK_ADVISER A
INNER JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID AND B.IS_DELETE = 0
......@@ -568,25 +575,21 @@
B.AUTHOR, B.PUBLISH, B.PUBLISH_DATE, B.COVER_IMG, B.ORIGIN_NAME, B.BOOK_PRICE, B.ISSN, B.BOOK_NUM, B.SERIAL_NUMBER,
IF(ISNULL(BF.BOOK_FUND_ID),0,1) IS_FUND_SUPPORT, A.TEMPLET_ID, A.BOOK_ADVISER_ID, CONCAT('BK',A.BOOK_ID) uniqueNumber,
G.update_time LAST_MODIFIED_DATE, G.create_time CREATED_DATE, G.id BOOK_GROUP_ID, G.group_qrcode_url groupQrcodeUrl,
G.group_qrcode_name groupQrcodeName, G.dep_label_id depLabelId, G.join_group_type, G.book_group_cipher
, case count(bgs.id)
when 0 then 0
else 1
end has_serve
G.group_qrcode_name groupQrcodeName, G.dep_label_id depLabelId, G.join_group_type, G.book_group_cipher, G.short_book_name
, if(IFNULL(case G.join_group_type
WHEN 1 then bk.id
WHEN 2 THEN bgs.id
WHEN 3 THEN srk.id
else null END,0)=0,0,1)as has_serve
FROM
book_group G
LEFT JOIN BOOK_ADVISER A ON G.BOOK_ID = A.BOOK_ID AND G.CHANNEL_ID = A.CHANNEL_ID AND G.CREATE_USER = A.ADVISER_ID
LEFT JOIN BOOK B ON A.BOOK_ID = B.BOOK_ID
LEFT JOIN BOOK_TYPE T ON B.TYPE_CODE = T.TYPE_CODE
LEFT JOIN BOOK_FUND BF ON BF.BOOK_ID = A.BOOK_ID AND BF.END_TIME <![CDATA[ > ]]> NOW() AND BF.START_TIME <![CDATA[ < ]]> NOW()
<choose>
<when test="joinGroupType!=null and joinGroupType==2">
LEFT JOIN BOOK_GROUP_SERVE bgs on G.id=bgs.book_group_id
</when>
<otherwise>
LEFT JOIN BOOK_KEYWORD bgs on G.id=bgs.book_group_id and bgs.is_delete=0
</otherwise>
</choose>
LEFT JOIN BOOK_KEYWORD bk on G.id=bk.book_group_id and bk.is_delete=0
LEFT JOIN self_robot_keyword srk ON G.id = srk.book_group_id
WHERE
G.create_user = #{adviserId} AND G.is_delete = 0
AND (
......@@ -632,15 +635,18 @@
<if test="startDate != null and endDate != null">
AND G.create_time BETWEEN #{startDate} AND #{endDate}
</if>
<if test="joinGroupType !=null">
AND G.join_group_type=#{joinGroupType}
<if test="joinGroupTypes !=null and joinGroupTypes.size()>0">
AND G.join_group_type in
<foreach collection="joinGroupTypes" item="item" index="index" open="(" separator="," close=")">
${item}
</foreach>
</if>
GROUP BY G.id
<if test="hasServe!=null and hasServe==true">
having count(bgs.id)>0
having has_serve=1
</if>
<if test="hasServe!=null and hasServe==false">
having count(bgs.id)=0
having has_serve=0
</if>
ORDER BY
G.UPDATE_TIME DESC
......
......@@ -34,12 +34,14 @@
<!-- 新增书籍和编辑关联信息-->
<insert id="insert" parameterType="bookAdviser" useGeneratedKeys="true" keyProperty="bookAdviserId" flushCache="true">
INSERT INTO BOOK_ADVISER (
BOOK_ID, ADVISER_ID, CHANNEL_ID, CREATED_USER, CREATED_DATE,IS_MAIN_EDITOR, TEMPLET_ID, SECOND_TEMPLET_ID
BOOK_ID, ADVISER_ID, CHANNEL_ID, CREATED_USER, CREATED_DATE,IS_MAIN_EDITOR, TEMPLET_ID, SECOND_TEMPLET_ID,
GRA_LABEL_ID,SUB_LABEL_ID,VER_LABEL_ID,AREA_LABEL_ID
)
VALUES (
#{bookId, jdbcType=VARCHAR}, #{adviserId, jdbcType=VARCHAR}, #{channelId, jdbcType=VARCHAR},
#{adviserId, jdbcType=BIGINT}, NOW(),#{isMainEditor, jdbcType=BIT},#{templetId, jdbcType=BIGINT},
#{secondTempletId, jdbcType=BIGINT}
#{secondTempletId, jdbcType=BIGINT},#{graLabelId, jdbcType=BIGINT},#{subLabelId, jdbcType=BIGINT},
#{verLabelId, jdbcType=BIGINT},#{areaLabelId, jdbcType=BIGINT}
)
ON
DUPLICATE KEY UPDATE IS_DELETE = 0, IS_MAIN_EDITOR = #{isMainEditor, jdbcType=BIT}
......@@ -49,6 +51,18 @@
<if test="secondTempletId!=null">
,SECOND_TEMPLET_ID=#{secondTempletId, jdbcType=BIGINT}
</if>
<if test="secondTempletId!=null">
,SECOND_TEMPLET_ID=#{secondTempletId, jdbcType=BIGINT}
</if>
<if test="secondTempletId!=null">
,SECOND_TEMPLET_ID=#{secondTempletId, jdbcType=BIGINT}
</if>
<if test="secondTempletId!=null">
,SECOND_TEMPLET_ID=#{secondTempletId, jdbcType=BIGINT}
</if>
<if test="secondTempletId!=null">
,SECOND_TEMPLET_ID=#{secondTempletId, jdbcType=BIGINT}
</if>
</insert>
<!-- 批量新增书籍和编辑关联信息-->
......@@ -366,6 +380,18 @@
<if test="secondTempletId!=null">
,SECOND_TEMPLET_ID = #{secondTempletId, jdbcType=BIGINT}
</if>
<if test="graLabelId!=null">
,GRA_LABEL_ID = #{graLabelId, jdbcType=BIGINT}
</if>
<if test="subLabelId!=null">
,SUB_LABEL_ID = #{subLabelId, jdbcType=BIGINT}
</if>
<if test="verLabelId!=null">
,VER_LABEL_ID = #{verLabelId, jdbcType=BIGINT}
</if>
<if test="areaLabelId!=null">
,AREA_LABEL_ID = #{areaLabelId, jdbcType=BIGINT}
</if>
WHERE
BOOK_ID = #{bookId, jdbcType=BIGINT}
AND
......@@ -421,6 +447,18 @@
<if test="secondTempletId != null">
,SECOND_TEMPLET_ID = #{secondTempletId}
</if>
<if test="graLabelId!=null">
,GRA_LABEL_ID = #{graLabelId, jdbcType=BIGINT}
</if>
<if test="subLabelId!=null">
,SUB_LABEL_ID = #{subLabelId, jdbcType=BIGINT}
</if>
<if test="verLabelId!=null">
,VER_LABEL_ID = #{verLabelId, jdbcType=BIGINT}
</if>
<if test="areaLabelId!=null">
,AREA_LABEL_ID = #{areaLabelId, jdbcType=BIGINT}
</if>
,LAST_MODIFIED_DATE = NOW()
WHERE
BOOK_ID = #{bookId, jdbcType=BIGINT}
......
<?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.book.dao.impl.BookLabelDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.book.entity.BookLabel">
<id column="id" property="id" jdbcType="BIGINT" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id,`name`,`type`
</sql>
<select id="getListByType" parameterType="integer" resultMap="BaseResultMap">
SELECT
<include refid="Base_Column_List"/>
FROM
book_label
where type=#{type}
</select>
<!--获取全部-->
<select id="getAll" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_label
</select>
<!--根据id查询map-->
<select id="getMapByIds" parameterType="list" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_label
where id in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
......@@ -7,12 +7,13 @@
<result column="book_group_cipher" property="bookGroupCipher" jdbcType="VARCHAR"/>
<result column="wx_user_id" property="wxUserId" jdbcType="VARCHAR"/>
<result column="alt_id" property="altId" jdbcType="VARCHAR"/>
<result column="short_book_name" property="shortBookName" jdbcType="VARCHAR"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, book_group_id, book_group_cipher, wx_user_id, alt_id, create_time
id, book_group_id, book_group_cipher, wx_user_id, alt_id, short_book_name, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.BookGroupCipherUser" useGeneratedKeys="true"
......@@ -23,6 +24,7 @@
book_group_cipher,
wx_user_id,
alt_id,
short_book_name,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
......@@ -30,6 +32,7 @@
#{bookGroupCipher,jdbcType=VARCHAR},
#{wxUserId,jdbcType=VARCHAR},
#{altId,jdbcType=VARCHAR},
#{shortBookName,jdbcType=VARCHAR},
NOW()
</trim>
</insert>
......@@ -454,6 +457,33 @@
</if>
</select>
<!--根据wxUserId获取-->
<select id="getByWxUserId" parameterType="string" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group_cipher_user where
wx_user_id=#{wxUserId}
order by create_time desc
limit 1
</select>
<select id="getSelfRobotBookGroupInfoByUser" parameterType="map" resultType="com.pcloud.book.group.dto.SelfRobotBookGroupDTO">
SELECT
u.book_group_id bookGroupId,
g.group_qrcode_name groupQrcodeName,
u.alt_id wxId,
g.book_id bookId,
g.create_user adviserId
FROM
book_group_cipher_user u
LEFT JOIN book_group g ON u.book_group_id = g.id
WHERE
u.book_group_id = #{bookGroupId}
AND u.wx_user_id = #{wxUserId}
ORDER BY
u.id DESC
LIMIT 1
</select>
<select id="getAltCountByBookGroup" parameterType="long" resultType="integer">
SELECT
COUNT(DISTINCT alt_id)
......
......@@ -29,6 +29,7 @@
<result column="is_some_update" property="isSomeUpdate" jdbcType="BOOLEAN"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="belong_special_agent" property="belongSpecialAgent" jdbcType="BOOLEAN"/>
<result column="short_book_name" property="shortBookName" jdbcType="VARCHAR"/>
</resultMap>
<resultMap id="BookGroupDTO" type="com.pcloud.book.group.dto.BookGroupDTO">
......@@ -63,6 +64,7 @@
<result column="is_some_update" property="isSomeUpdate" jdbcType="BOOLEAN"/>
<result column="agent_id" property="agentId" jdbcType="BIGINT"/>
<result column="belong_special_agent" property="belongSpecialAgent" jdbcType="BOOLEAN"/>
<result column="short_book_name" property="shortBookName" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
......@@ -70,7 +72,8 @@
pur_label_id, join_title, join_slogan, personal_qrcode_url, product_id, create_user,
create_time,
update_time, is_delete, is_show_book_name,join_group_type,add_friend_guide,customer_service_name,
is_invite_group,book_group_cipher, last_push_update_time, is_some_update, agent_id, belong_special_agent
is_invite_group,book_group_cipher, last_push_update_time, is_some_update, agent_id, belong_special_agent,
short_book_name
</sql>
<select id="getById" resultMap="BaseResultMap" parameterType="java.lang.Long">
......@@ -304,6 +307,9 @@
<if test="agentId != null">
agent_id = #{agentId},
</if>
<if test="shortBookName != null">
short_book_name = #{shortBookName},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
......@@ -903,4 +909,12 @@
AND book_id = #{bookId}
</select>
<!--根据书籍简称获取-->
<select id="getByShortBookName" parameterType="string" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group
where short_book_name =#{shortBookName}
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -71,7 +71,7 @@
</delete>
<!--根据社群书id获取集合-->
<select id="getListByBookGroupId" parameterType="long" resultMap="BaseResultMap">
<select id="getListByBookGroupId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from book_group_serve
where book_group_id=#{bookGroupId}
......
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.keywords.dao.impl.SelfRobotKeywordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotKeyword">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="guide" property="guide" jdbcType="VARCHAR"/>
<result column="keyword" property="keyword" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="link_url" property="linkUrl" jdbcType="VARCHAR"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="resource_id" property="resourceId" jdbcType="BIGINT"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, book_group_id, guide, keyword, type, content, description, link_url, pic_url, serve_id,
serve_type, resource_id,seq_num,create_user, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true"
keyProperty="id">
insert into self_robot_keyword
<trim prefix="(" suffix=")" suffixOverrides=",">
book_group_id,
guide,
keyword,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num,
create_user,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookGroupId,jdbcType=BIGINT},
#{guide,jdbcType=VARCHAR},
#{keyword,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{resourceId,jdbcType=BIGINT},
#{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true" keyProperty="id">
insert into self_robot_keyword (
book_group_id,
guide,
keyword,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num,
create_user,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.bookGroupId,jdbcType=BIGINT},
#{item.guide,jdbcType=VARCHAR},
#{item.keyword,jdbcType=VARCHAR},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.resourceId,jdbcType=BIGINT},
#{item.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<update id="updateSelfRobotKeyword" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword">
update self_robot_keyword
<set>
book_group_id = #{bookGroupId,jdbcType=BIGINT},
guide = #{guide,jdbcType=VARCHAR},
keyword = #{keyword,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
content = #{content,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
link_url = #{linkUrl,jdbcType=VARCHAR},
pic_url = #{picUrl,jdbcType=VARCHAR},
serve_id = #{serveId,jdbcType=BIGINT},
serve_type = #{serveType,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=BIGINT},
seq_num = #{seqNum,jdbcType=INTEGER}
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<!--删除-->
<delete id="deleteById" parameterType="long">
delete from self_robot_keyword
where id=#{id}
</delete>
<!--根据社群码id集合删除-->
<delete id="deleteByBookGroupIds" parameterType="map">
delete from self_robot_keyword
where book_group_id in
<foreach collection="bookGroupIds" open="(" close=")" item="item" separator=",">
${item}
</foreach>
</delete>
<!--根据社群书id获取-->
<select id="getListByBookGroupId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword
where book_group_id=#{bookGroupId}
order by seq_num
</select>
<!--根据社群码和关键词获取-->
<select id="getByBookGroupIdAndKeyword" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword
where book_group_id=#{bookGroupId}
and keyword=#{keyword}
limit 1
</select>
<!--根据社群码id获取数量-->
<select id="getCountByBookGroupId" parameterType="map" resultType="integer">
select count(1)
from self_robot_keyword
where book_group_id=#{bookGroupId}
</select>
<!--批量获取最大排序值-->
<select id="getMaxSeqNumByBookGroupIds" parameterType="map" resultType="com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO">
select
book_group_id bookGroupId,
ifnull(max(seq_num), 0) maxSeqNum
from self_robot_keyword
where book_group_id in
<foreach collection="bookGroupIds" open="(" close=")" item="item" separator=",">
${item}
</foreach>
group by book_group_id
</select>
<!--获取列表-->
<select id="getSelfRobotKeywordList" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword
where book_group_id=#{bookGroupId}
<if test="keyword!=null">
and keyword like concat('%', #{keyword},'%')
</if>
order by seq_num
</select>
<!--更新最大排序值-->
<update id="updateSeqNum" parameterType="map">
update self_robot_keyword
set seq_num=#{seqNum}
where id=#{id}
</update>
<!--获取最大关键词-->
<select id="getMaxKeyword" parameterType="map" resultType="string">
select max(keyword) from self_robot_keyword
where book_group_id=#{bookGroupId}
</select>
</mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.group.dao.impl.WxWechatUserCorrelationDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.group.entity.WxWechatUserCorrelation">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="wx_id" property="wxId" jdbcType="VARCHAR"/>
<result column="wechat_user_id" property="wechatUserId" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, book_group_id, wx_id, wechat_user_id, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.group.entity.WxWechatUserCorrelation" useGeneratedKeys="true"
keyProperty="id">
insert into wx_wechat_user_correlation
<trim prefix="(" suffix=")" suffixOverrides=",">
book_group_id,
wx_id,
wechat_user_id,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookGroupId,jdbcType=BIGINT},
#{wxId,jdbcType=VARCHAR},
#{wechatUserId,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--根据微信id和社群码id获取-->
<select id="getByWxIdAndBookGroupId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from wx_wechat_user_correlation
where wx_id=#{wxId}
and book_group_id=#{bookGroupId}
</select>
</mapper>
\ No newline at end of file
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