Commit 5b328081 by 裴大威

feat C1000756

parent d536c7c9
package com.pcloud.book.book.constant;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.common.constant.CacheConstant;
import java.util.Map;
/**
* 描述 :图书常量
*
......@@ -112,4 +117,61 @@ public class BookConstant {
* 30天
*/
public static final Long THIRTY = 30L;
public enum BookKeywordAuditEnum {
NORMAL(0),
/**
* 待审核
*/
TO_AUDIT(1),
/**
* 审核通过
*/
PASS_THE_AUDIT(2),
/**
* 拒绝审核
*/
REFUSE_THE_AUDIT(3);
private Integer code;
BookKeywordAuditEnum(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
public static final Map<Integer, BookKeywordAuditEnum> AUDIT_ENUM_MAP = Maps.newHashMap();
static {
for (BookKeywordAuditEnum auditEnum : Lists.newArrayList(BookKeywordAuditEnum.values())) {
AUDIT_ENUM_MAP.put(auditEnum.getCode(), auditEnum);
}
}
public enum BookKeywordScopeEnum {
/**
* 全部
*/
ALL(0),
/**
* 编辑
*/
EDITOR(1);
private Integer code;
BookKeywordScopeEnum(Integer code) {
this.code = code;
}
public Integer getCode() {
return code;
}
}
}
package com.pcloud.book.book.biz;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.vo.BookKeywordProductVO;
import com.pcloud.book.book.vo.request.AddBookKeywordRequestVO;
import com.pcloud.book.book.vo.request.CheckKeywordRequestVO;
import com.pcloud.book.book.vo.request.EditBookKeywordRequestVO;
import com.pcloud.book.book.vo.request.QueryBookKeywordWarehouseRequestVO;
import com.pcloud.book.book.vo.response.BookKeywordResponseVO;
import com.pcloud.book.keywords.vo.SetKeywordVO;
import com.pcloud.common.page.PageBeanNew;
import java.util.List;
public interface BookKeywordWarehouseBiz {
Long addBookKeyword(SetKeywordVO setKeywordVO);
/**
* 新增关键词
*/
Long addBookKeyword(AddBookKeywordRequestVO vo, Integer useKeyword);
/**
* 修改关键词
*/
void editBookKeyword(EditBookKeywordRequestVO vo);
/**
* 删除关键词
*/
void deleteBookKeyword(Long keywordId, Long adviserId);
/**
* 关键词库查询
*/
PageBeanNew<BookKeywordResponseVO> listBookKeywordWarehouse(QueryBookKeywordWarehouseRequestVO vo);
/**
* 使用关键词
*/
void useKeyword(Long adviserId, Long keywordDetailId);
/**
* 查询关键词详情(去掉)
*/
BookKeywordResponseVO getDetail(Long keywordId);
/**
* 常用关键词
*/
PageBeanNew<BookKeywordProductVO> oftenKeyword(Integer currentPage, Integer numPerPage, Long bookGroupId, Long adviserId, Long depthLabelId, Long classifyId);
/**
* 热门关键词
*/
PageBeanNew<BookKeywordProductVO> hotKeyword(Integer currentPage, Integer numPerPage, Long adviserId, Long bookGroupId, String keyword, Long depthLabelId, Long classifyId);
/**
* 审核关键词
*/
void auditKeyword(Long partyId, Long keywordId, BookConstant.BookKeywordAuditEnum auditEnum);
/**
* 检查关键词是否重复
*/
List<Long> checkKeyword(CheckKeywordRequestVO vo);
}
package com.pcloud.book.book.dao;
import com.pcloud.book.book.entity.KeywordUseRecord;
import com.pcloud.common.core.dao.BaseDao;
public interface KeywordUseRecordDao extends BaseDao<KeywordUseRecord> {
int insertSelective(KeywordUseRecord record);
KeywordUseRecord selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(KeywordUseRecord record);
int updateByPrimaryKey(KeywordUseRecord record);
KeywordUseRecord getByAdviserIdAndKeywordId(Long adviserId, Long keywordId);
void addOne(Long adviserId, Long id);
}
\ No newline at end of file
package com.pcloud.book.book.dao;
import com.pcloud.book.book.entity.KeywordWarehouse;
import com.pcloud.book.book.vo.request.CheckKeywordRequestVO;
import com.pcloud.book.book.vo.response.CheckKeywordResponseVO;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
public interface KeywordWarehouseDao extends BaseDao<KeywordWarehouse> {
int insertSelective(KeywordWarehouse record);
KeywordWarehouse selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(KeywordWarehouse record);
int updateByPrimaryKey(KeywordWarehouse record);
List<KeywordWarehouse> listByIds(List<Long> ids);
List<CheckKeywordResponseVO> checkKeyword(CheckKeywordRequestVO vo);
}
\ No newline at end of file
package com.pcloud.book.book.dao;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.common.core.dao.BaseDao;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface KeywordWarehouseDetailDao extends BaseDao<KeywordWarehouseDetail> {
int insertSelective(KeywordWarehouseDetail record);
KeywordWarehouseDetail selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(KeywordWarehouseDetail record);
int updateByPrimaryKey(KeywordWarehouseDetail record);
void deleteDetails(Long keywordId);
void addOne(Long adviserId, Long id);
List<KeywordWarehouseDetail> listByKeywordIds(@Param("list") List<Long> ids);
}
\ No newline at end of file
package com.pcloud.book.book.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.book.dao.KeywordUseRecordDao;
import com.pcloud.book.book.entity.KeywordUseRecord;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.Map;
@Component
public class KeywordUseRecordDaoImpl extends BaseDaoImpl<KeywordUseRecord> implements KeywordUseRecordDao {
@Override
public int insertSelective(KeywordUseRecord record) {
return this.getSqlSession().insert("com.pcloud.book.book.dao.impl.KeywordUseRecordDaoImpl.insertSelective", record);
}
@Override
public KeywordUseRecord selectByPrimaryKey(Integer id) {
return this.getSqlSession().selectOne("com.pcloud.book.book.dao.impl.KeywordUseRecordDaoImpl.selectByPrimaryKey", id);
}
@Override
public int updateByPrimaryKeySelective(KeywordUseRecord record) {
return this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordUseRecordDaoImpl.updateByPrimaryKeySelective", record);
}
@Override
public int updateByPrimaryKey(KeywordUseRecord record) {
return this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordUseRecordDaoImpl.updateByPrimaryKey", record);
}
@Override
public KeywordUseRecord getByAdviserIdAndKeywordId(Long adviserId, Long keywordDetailId) {
Map<String, Object> map = Maps.newHashMap();
map.put("adviserId", adviserId);
map.put("keywordDetailId", keywordDetailId);
return this.getSqlSession().selectOne("com.pcloud.book.book.dao.impl.KeywordUseRecordDaoImpl.getByAdviserIdAndKeywordId", map);
}
@Override
public void addOne(Long adviserId, Long id) {
Map<String, Object> map = Maps.newHashMap();
map.put("adviserId", adviserId);
map.put("id", id);
this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordUseRecordDaoImpl.addOne", map);
}
}
package com.pcloud.book.book.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.book.dao.KeywordWarehouseDao;
import com.pcloud.book.book.entity.KeywordWarehouse;
import com.pcloud.book.book.vo.request.CheckKeywordRequestVO;
import com.pcloud.book.book.vo.response.CheckKeywordResponseVO;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public class KeywordWarehouseDaoImpl extends BaseDaoImpl<KeywordWarehouse> implements KeywordWarehouseDao {
@Override
public int insertSelective(KeywordWarehouse record) {
return this.getSqlSession().insert("com.pcloud.book.book.dao.impl.KeywordWarehouseDaoImpl.insertSelective", record);
}
@Override
public KeywordWarehouse selectByPrimaryKey(Long id) {
return this.getSqlSession().selectOne("com.pcloud.book.book.dao.impl.KeywordWarehouseDaoImpl.selectByPrimaryKey", id);
}
@Override
public int updateByPrimaryKeySelective(KeywordWarehouse record) {
return this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordWarehouseDaoImpl.updateByPrimaryKeySelective", record);
}
@Override
public int updateByPrimaryKey(KeywordWarehouse record) {
return this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordWarehouseDaoImpl.updateByPrimaryKey", record);
}
@Override
public List<KeywordWarehouse> listByIds(List<Long> ids) {
return this.getSqlSession().selectList("com.pcloud.book.book.dao.impl.KeywordWarehouseDaoImpl.listByIds", ids);
}
@Override
public List<CheckKeywordResponseVO> checkKeyword(CheckKeywordRequestVO vo) {
Map<String, Object> map = Maps.newHashMap();
map.put("keyword", vo.getKeyword());
map.put("list", vo.getDepthLabelIds());
return this.getSqlSession().selectList("com.pcloud.book.book.dao.impl.KeywordWarehouseDaoImpl.checkKeyword", map);
}
}
package com.pcloud.book.book.dao.impl;
import com.google.common.collect.Maps;
import com.pcloud.book.book.dao.KeywordWarehouseDetailDao;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
public class KeywordWarehouseDetailDaoImpl extends BaseDaoImpl<KeywordWarehouseDetail> implements KeywordWarehouseDetailDao {
@Override
public int insertSelective(KeywordWarehouseDetail record) {
return this.getSqlSession().insert("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.insertSelective", record);
}
@Override
public KeywordWarehouseDetail selectByPrimaryKey(Long id) {
return this.getSqlSession().selectOne("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.selectByPrimaryKey", id);
}
@Override
public int updateByPrimaryKeySelective(KeywordWarehouseDetail record) {
return this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.updateByPrimaryKeySelective", record);
}
@Override
public int updateByPrimaryKey(KeywordWarehouseDetail record) {
return this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.updateByPrimaryKey", record);
}
@Override
public void deleteDetails(Long keywordId) {
this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.deleteDetails", keywordId);
}
@Override
public void addOne(Long adviserId, Long id) {
Map<String, Object> map = Maps.newHashMap();
map.put("adviserId", adviserId);
map.put("id", id);
this.getSqlSession().update("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.addOne", map);
}
@Override
public List<KeywordWarehouseDetail> listByKeywordIds(List<Long> ids) {
return this.getSqlSession().selectList("com.pcloud.book.book.dao.impl.KeywordWarehouseDetailDaoImpl.listByKeywordIds", ids);
}
}
package com.pcloud.book.book.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class KeywordUseRecord extends BaseEntity {
private static final long serialVersionUID = 2218918681920971881L;
private Long keywordId;
private Long keywordDetailId;
private Long adviserId;
private Integer useNum;
private Long createUser;
private Long updateUser;
private Integer isDelete;
}
\ No newline at end of file
package com.pcloud.book.book.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class KeywordWarehouse extends BaseEntity {
private static final long serialVersionUID = 681141672872945668L;
private String keyword;
private Integer scope;
private Integer matchingRule;
private Integer auditStatus;
private String guide;
private Long editorId;
private Long createUser;
private Long updateUser;
private Integer isDelete;
}
\ No newline at end of file
package com.pcloud.book.book.entity;
import com.pcloud.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class KeywordWarehouseDetail extends BaseEntity {
private static final long serialVersionUID = 6093266266761819768L;
private Long keywordId;
private Long professionalLabelId;
private Long depthLabelId;
private Long purposeLabelId;
private String groupId;
private Long productId;
private String productType;
private Long channelId;
private String typeCode;
private String description;
private String content;
private String linkUrl;
private String picUrl;
private Integer useNum;
private Long createUser;
private Long updateUser;
private Integer isDelete;
}
\ No newline at end of file
package com.pcloud.book.book.facade.impl;
import com.pcloud.book.book.biz.BookKeywordWarehouseBiz;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.vo.BookKeywordProductVO;
import com.pcloud.book.book.vo.request.AddBookKeywordRequestVO;
import com.pcloud.book.book.vo.request.CheckKeywordRequestVO;
import com.pcloud.book.book.vo.request.EditBookKeywordRequestVO;
import com.pcloud.book.book.vo.request.QueryBookKeywordWarehouseRequestVO;
import com.pcloud.book.book.vo.response.BookKeywordResponseVO;
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 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;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
@Api("关键词库")
@RestController
@RequestMapping("keywordWarehouse")
public class BookKeywordWarehouseFacadeImpl {
@Resource
private BookKeywordWarehouseBiz bookKeywordWarehouseBiz;
@PostMapping("addBookKeyword")
public ResponseDto<Void> addBookKeyword(@RequestHeader("token") String token, @RequestBody AddBookKeywordRequestVO vo) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
vo.setUserId(adviserId);
this.bookKeywordWarehouseBiz.addBookKeyword(vo, null);
return new ResponseDto<>();
}
@PostMapping("editBookKeyword")
public ResponseDto<Void> editBookKeyword(@RequestHeader("token") String token, @RequestBody EditBookKeywordRequestVO vo) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
vo.setUserId(adviserId);
this.bookKeywordWarehouseBiz.editBookKeyword(vo);
return new ResponseDto<>();
}
@GetMapping("deleteBookKeyword")
public ResponseDto<Void> deleteBookKeyword(@RequestHeader("token") String token, @RequestParam("keywordId") Long keywordId) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
this.bookKeywordWarehouseBiz.deleteBookKeyword(keywordId, adviserId);
return new ResponseDto<>();
}
@PostMapping("listBookKeywordWarehouse")
public ResponseDto<PageBeanNew<BookKeywordResponseVO>> listBookKeywordWarehouse(@RequestHeader("token") String token, @RequestBody QueryBookKeywordWarehouseRequestVO vo) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
vo.setUserId(adviserId);
final PageBeanNew<BookKeywordResponseVO> pageBeanNew = this.bookKeywordWarehouseBiz.listBookKeywordWarehouse(vo);
return new ResponseDto<>(pageBeanNew);
}
@GetMapping("useKeyword")
public ResponseDto<Void> useKeyword(@RequestHeader("token") String token, @RequestParam("keywordDetailId") Long keywordDetailId) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
this.bookKeywordWarehouseBiz.useKeyword(adviserId, keywordDetailId);
return new ResponseDto<>();
}
@GetMapping("getDetail")
public ResponseDto<BookKeywordResponseVO> getDetail(@RequestHeader("token") String token, @RequestParam("keywordId") Long keywordId) throws PermissionException {
final BookKeywordResponseVO detail = this.bookKeywordWarehouseBiz.getDetail(keywordId);
return new ResponseDto<>(detail);
}
@GetMapping("oftenKeyword")
public ResponseDto<PageBeanNew<BookKeywordProductVO>> oftenKeyword(@RequestHeader("token") String token, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage, @RequestParam("bookGroupId") Long bookGroupId,
@RequestParam("depthLabelId") Long depthLabelId, @RequestParam("classifyId") Long classifyId) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
final PageBeanNew<BookKeywordProductVO> pageBeanNew = this.bookKeywordWarehouseBiz.oftenKeyword(currentPage, numPerPage, bookGroupId, adviserId, depthLabelId, classifyId);
return new ResponseDto<>(pageBeanNew);
}
@GetMapping("hotKeyword")
public ResponseDto<PageBeanNew<BookKeywordProductVO>> hotKeyword(@RequestHeader("token") String token, @RequestParam("currentPage") Integer currentPage,
@RequestParam("numPerPage") Integer numPerPage, @RequestParam("bookGroupId") Long bookGroupId,
@RequestParam(value = "keyword", required = false) String keyword,
@RequestParam("depthLabelId") Long depthLabelId, @RequestParam("classifyId") Long classifyId) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
final PageBeanNew<BookKeywordProductVO> pageBeanNew = this.bookKeywordWarehouseBiz.hotKeyword(currentPage, numPerPage, adviserId, bookGroupId, keyword, depthLabelId, classifyId);
return new ResponseDto<>(pageBeanNew);
}
@GetMapping("auditKeyword")
public ResponseDto<Void> auditKeyword(@RequestHeader("token") String token, @RequestParam("keywordId") Long keywordId, @RequestParam("auditCode") Integer auditCode) throws PermissionException {
Long adviserId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
this.bookKeywordWarehouseBiz.auditKeyword(adviserId, keywordId, BookConstant.AUDIT_ENUM_MAP.get(auditCode));
return new ResponseDto<>();
}
@PostMapping("checkKeyword")
public ResponseDto<List<Long>> checkKeyword(@RequestHeader("token") String token, @RequestBody CheckKeywordRequestVO vo) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
final List<Long> code = this.bookKeywordWarehouseBiz.checkKeyword(vo);
return new ResponseDto<>(code);
}
}
package com.pcloud.book.book.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.common.utils.BeanUtils;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookKeywordDetailVO {
private List<KeywordWearhouseLabelVO> labels;
/**
* 分组id,一组label对应一个作品/应用
*/
@ApiModelProperty("分组id,一组label对应一个作品/应用,那么这个整体为一组,按顺序1-15,每组不要重复")
private Integer groupId;
@ApiModelProperty("作品渠道id")
private Long channelId;
@ApiModelProperty("作品/应用标签")
private String proLabelName;
@ApiModelProperty("作品/应用id")
private String depLabelName;
@ApiModelProperty("作品/应用id")
private String purLabelName;
@ApiModelProperty("作品/应用id")
private Long productId;
@ApiModelProperty("作品/应用类型")
private String productType;
@ApiModelProperty("应用类型")
private String typeCode;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("应用/作品描述(答案 or 互动墙)")
private String description;
@ApiModelProperty("跳转链接")
private String linkUrl;
@ApiModelProperty("图片地址")
private String picUrl;
public static BookKeywordDetailVO cloneByEntity(KeywordWarehouseDetail detail) {
if (null == detail) {
return new BookKeywordDetailVO();
}
final BookKeywordDetailVO detailVO = new BookKeywordDetailVO();
BeanUtils.copyProperties(detail, detailVO);
return detailVO;
}
}
package com.pcloud.book.book.vo;
import com.google.common.collect.Lists;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.common.utils.BeanUtils;
import org.springframework.util.CollectionUtils;
import java.util.List;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
@Data
@ToString
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookKeywordProductVO {
@ApiModelProperty("关键词id")
private Long keywordId;
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("关键词详情id")
private Long keywordDetailId;
@ApiModelProperty("匹配规则")
private Integer matchingRule;
@ApiModelProperty("作品/应用id")
private Long productId;
@ApiModelProperty("作品/应用类型(1:商品2:应用)")
private String productType;
@ApiModelProperty("渠道id")
private Long channelId;
@ApiModelProperty("作品/应用图片")
private String picUrl;
@ApiModelProperty("作品/应用链接")
private String linkUrl;
@ApiModelProperty("作品/应用标题")
private String title;
@ApiModelProperty("作品/应用描述")
private String description;
@ApiModelProperty("关键词引导语")
private String guide;
@ApiModelProperty("作品/应用内容")
private String content;
@ApiModelProperty("应用类型")
private String typeCode;
@ApiModelProperty("专业标签id")
private Long professionalLabelId;
@ApiModelProperty("深度标签id")
private Long depthLabelId;
@ApiModelProperty("目的标签")
private Long purposeLabelId;
@ApiModelProperty("使用次数")
private Integer useNum;
@ApiModelProperty("是否标记(1:是 0:否)")
private Integer isMark;
public static List<BookKeywordProductVO> cloneByEntity(List<KeywordWarehouseDetail> list){
if(CollectionUtils.isEmpty(list)) {
return Lists.newArrayList();
}
List<BookKeywordProductVO> vos = Lists.newArrayList();
for (KeywordWarehouseDetail detail : list) {
BookKeywordProductVO vo = new BookKeywordProductVO();
BeanUtils.copyProperties(detail, vo);
vos.add(vo);
}
return vos;
}
}
package com.pcloud.book.book.vo;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.common.utils.BeanUtils;
import lombok.Data;
@Data
public class KeywordWearhouseLabelVO {
private Long professionalLabelId;
private String professionalLabelName;
private Long depthLabelId;
private String depthLabelName;
private Long purposeLabelId;
private String purposeLabelName;
public static KeywordWearhouseLabelVO cloneByEntity(KeywordWarehouseDetail detail) {
if (null == detail) {
return new KeywordWearhouseLabelVO();
}
final KeywordWearhouseLabelVO detailVO = new KeywordWearhouseLabelVO();
BeanUtils.copyProperties(detail, detailVO);
return detailVO;
}
}
package com.pcloud.book.book.vo.request;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.entity.KeywordWarehouse;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.book.book.vo.BookKeywordDetailVO;
import com.pcloud.book.book.vo.KeywordWearhouseLabelVO;
import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
@ApiModel
public class AddBookKeywordRequestVO extends BaseRequestVO {
private static final long serialVersionUID = -5581508584274149498L;
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("引导语")
private String guide;
@ApiModelProperty("匹配规则(0:精准匹配1:模糊匹配)")
private Integer matchingRule;
@ApiModelProperty("适用范围(0:所有出版社,1:编辑)")
private Integer scope;
@ApiModelProperty("审核状态(0:手动添加免审核 1:申请待审核 2:审核通过 3:拒绝审核)")
private Integer auditStatus;
@ApiModelProperty("编辑id(适用范围为所有出版社的时候可以为空)")
private Long editorId;
@ApiModelProperty("关键词详情")
private List<BookKeywordDetailVO> details;
public KeywordWarehouse getEntity() {
final KeywordWarehouse warehouse = new KeywordWarehouse();
BeanUtils.copyProperties(this, warehouse);
final Date now = new Date();
warehouse.setEditorId(null == this.getEditorId() ? 0L : this.getEditorId());
// warehouse.setAuditStatus(null == this.getAuditStatus() ? BookConstant.BookKeywordAuditEnum.NORMAL.getCode() : BookConstant.BookKeywordAuditEnum.TO_AUDIT.getCode());
warehouse.setAuditStatus(null == this.getAuditStatus() ? BookConstant.BookKeywordAuditEnum.NORMAL.getCode() : BookConstant.BookKeywordAuditEnum.PASS_THE_AUDIT.getCode());
warehouse.setCreateUser(this.getUserId());
warehouse.setUpdateUser(this.getUserId());
warehouse.setCreateTime(now);
warehouse.setUpdateTime(now);
warehouse.setIsDelete(0);
return warehouse;
}
public List<KeywordWarehouseDetail> getDetailEntity(Long keywordId) {
final List<KeywordWarehouseDetail> list = Lists.newArrayList();
List<BookKeywordDetailVO> details = this.getDetails();
if(CollectionUtils.isEmpty(details)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "关键词信息为空");
}
Map<Integer, String> map = Maps.newHashMap();
for (BookKeywordDetailVO vo : details) {
final List<KeywordWearhouseLabelVO> labels = vo.getLabels();
if("PRODUCT".equals(vo.getProductType()) && null == vo.getChannelId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "渠道信息不能为空");
}
if(CollectionUtils.isEmpty(labels)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "标签信息为空");
}
for (KeywordWearhouseLabelVO label : labels) {
KeywordWarehouseDetail detail = new KeywordWarehouseDetail();
BeanUtils.copyProperties(vo, detail);
String uuid = map.get(vo.getGroupId());
if (StringUtil.isBlank(uuid)) {
uuid = StringUtil.getUUID();
map.put(vo.getGroupId(), uuid);
}
// 分组id唯一
detail.setGroupId(uuid);
detail.setProfessionalLabelId(label.getProfessionalLabelId());
detail.setPurposeLabelId(label.getPurposeLabelId());
detail.setDepthLabelId(label.getDepthLabelId());
final Date now = new Date();
detail.setKeywordId(keywordId);
detail.setUseNum(0);
detail.setCreateUser(this.getUserId());
detail.setUpdateUser(this.getUserId());
detail.setCreateTime(now);
detail.setUpdateTime(now);
detail.setIsDelete(0);
list.add(detail);
}
}
return list;
}
public Boolean check() {
return CollectionUtils.isEmpty(this.getDetails())
|| StringUtil.isBlank(this.getKeyword())
|| StringUtil.isBlank(this.getGuide())
|| null == this.getMatchingRule()
|| null == this.getScope()
|| null == this.getUserId()
|| (scope != 0 && null == this.getEditorId());
}
}
package com.pcloud.book.book.vo.request;
import com.pcloud.common.entity.BaseRequestVO;
import java.util.List;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class CheckKeywordRequestVO extends BaseRequestVO {
private static final long serialVersionUID = 4139553896398532109L;
private Long keywordId;
private String keyword;
private List<Long> depthLabelIds;
}
package com.pcloud.book.book.vo.request;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.constant.BookConstant;
import com.pcloud.book.book.entity.KeywordWarehouse;
import com.pcloud.book.book.entity.KeywordWarehouseDetail;
import com.pcloud.book.book.vo.BookKeywordDetailVO;
import com.pcloud.book.book.vo.KeywordWearhouseLabelVO;
import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.BeanUtils;
import com.pcloud.common.utils.string.StringUtil;
import org.springframework.util.CollectionUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
@ApiModel
public class EditBookKeywordRequestVO extends BaseRequestVO {
private static final long serialVersionUID = 719494003873772831L;
@ApiModelProperty("关键词主键")
private Long keywordId;
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("引导语")
private String guide;
@ApiModelProperty("匹配规则(0:精准匹配1:模糊匹配)")
private Integer matchingRule;
@ApiModelProperty("适用范围(0:所有出版社,1:编辑)")
private Integer scope;
@ApiModelProperty("编辑id(适用范围为所有出版社的时候可以为空)")
private Long editorId;
@ApiModelProperty("关键词详情")
private List<BookKeywordDetailVO> details;
public KeywordWarehouse getEntity() {
final KeywordWarehouse warehouse = new KeywordWarehouse();
BeanUtils.copyProperties(this, warehouse);
final Date now = new Date();
warehouse.setId(keywordId);
warehouse.setAuditStatus(BookConstant.BookKeywordAuditEnum.NORMAL.getCode());
warehouse.setUpdateUser(this.getUserId());
warehouse.setUpdateTime(now);
return warehouse;
}
public List<KeywordWarehouseDetail> getDetailEntity(Long keywordId) {
final List<KeywordWarehouseDetail> list = Lists.newArrayList();
List<BookKeywordDetailVO> details = this.getDetails();
Map<Integer, String> map = Maps.newHashMap();
for (BookKeywordDetailVO vo : details) {
final List<KeywordWearhouseLabelVO> labels = vo.getLabels();
if("PRODUCT".equals(vo.getProductType()) && null == vo.getChannelId()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "渠道信息不能为空");
}
if(CollectionUtils.isEmpty(labels)) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "标签信息为空");
}
for (KeywordWearhouseLabelVO labelVO : vo.getLabels()) {
final KeywordWarehouseDetail detail = new KeywordWarehouseDetail();
BeanUtils.copyProperties(vo, detail);
String uuid = map.get(vo.getGroupId());
if (StringUtil.isBlank(uuid)) {
uuid = StringUtil.getUUID();
map.put(vo.getGroupId(), uuid);
}
// 分组id唯一
detail.setGroupId(uuid);
detail.setPurposeLabelId(labelVO.getPurposeLabelId());
detail.setDepthLabelId(labelVO.getDepthLabelId());
detail.setProfessionalLabelId(labelVO.getProfessionalLabelId());
final Date now = new Date();
detail.setUseNum(0);
detail.setKeywordId(keywordId);
detail.setCreateUser(this.getUserId());
detail.setUpdateUser(this.getUserId());
detail.setCreateTime(now);
detail.setUpdateTime(now);
detail.setIsDelete(0);
list.add(detail);
}
}
return list;
}
public Boolean check() {
return null == this.getKeywordId()
|| StringUtil.isBlank(this.getKeyword())
|| StringUtil.isBlank(this.getGuide())
|| null == this.getMatchingRule()
|| null == this.getScope()
|| null == this.getUserId()
|| CollectionUtils.isEmpty(this.getDetails())
|| (scope != 0 && null == this.getEditorId())
;
}
}
package com.pcloud.book.book.vo.request;
import com.pcloud.common.entity.BasePageRequestVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
@ApiModel("查询关键词库列表")
public class QueryBookKeywordWarehouseRequestVO extends BasePageRequestVO {
private static final long serialVersionUID = 4027474233489240382L;
@ApiModelProperty(value = "主键", hidden = true)
private Long id;
@ApiModelProperty("关键词")
private String keyword;
@ApiModelProperty("专业关键词id")
private Long professionalLabelId;
@ApiModelProperty("深度关键词id")
private Long depthLabelId;
@ApiModelProperty("目的关键词id")
private Long purposeLabelId;
}
package com.pcloud.book.book.vo.response;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.pcloud.book.book.vo.BookKeywordDetailVO;
import java.io.Serializable;
import java.util.List;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BookKeywordResponseVO implements Serializable {
private static final long serialVersionUID = -1180965999128554190L;
private Long id;
/**
* 关键词
*/
@ApiModelProperty("关键词id")
private String keyword;
@ApiModelProperty("引导语")
private String guide;
/**
* 适用范围(0:所有出版社,1:编辑)
*/
@ApiModelProperty("0:精准匹配1:模糊匹配")
private Integer matchingRule;
@ApiModelProperty("出版id")
private Long agentId;
@ApiModelProperty("出版名称")
private String agentName;
@ApiModelProperty("编辑id")
private Long editorId;
@ApiModelProperty("编辑名称")
private String editorName;
/**
* 商品/应用id
*/
private List<BookKeywordDetailVO> product;
}
package com.pcloud.book.book.vo.response;
import java.io.Serializable;
import lombok.Data;
@Data
public class CheckKeywordResponseVO implements Serializable {
private static final long serialVersionUID = 5291107769450086908L;
private Long keywordId;
private Long depthLabelId;
private Long num;
}
......@@ -84,6 +84,25 @@ public class AppConsr {
return appDtos;
}
public Map<Long, AppDto> mapBaseByIds(List<Long> appIds) {
LOGGER.info("获取应用基本信息[appService.mapByIds],参数列表[appIds]:" + appIds);
Map<Long, AppDto> appDtos = new HashMap<>();
if (ListUtils.isEmpty(appIds)) {
return appDtos;
}
try {
ResponseEntity<ResponseDto<Map<Long, AppDto>>> appDtosEntity = appService.mapBaseByIds(appIds);
appDtos = ResponseHandleUtil.parseMapResponse(appDtosEntity, Long.class, AppDto.class);
} catch (BizException e) {
LOGGER.warn("获取应用基本信息[appService.mapByIds]:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("获取应用基本信息[appService.mapByIds]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_USER_ERROR, "获取应用基本信息失败~!");
}
return appDtos;
}
/**
* 获取应用基本信息
* @param appIds 应用ID列表
......
/**
*
*/
package com.pcloud.book.consumer.label;
import com.pcloud.common.core.biz.LabelUsedQueueBiz;
import com.pcloud.common.core.dto.LabelUsedMessageDto;
import com.pcloud.common.exceptions.BizException;
import com.pcloud.common.utils.ListUtils;
import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.labelcenter.label.service.LabelService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
/**
* @描述:标签中间件
* @作者:songx
* @创建时间:2016年12月21日,下午3:04:17 @版本:1.0
*/
@Slf4j
@Component("labelConsr")
public class LabelConsr {
@Autowired
private LabelService labelService;
@Autowired
private LabelUsedQueueBiz labelUsedQueueBiz;
/**
* 标签使用量
*/
public void sendLabelUsed(Long partyId, Long proLabelId, Long depLabelId, Long purLabelId) throws BizException {
log.info("【标签中心(消)】标签使用量,<START>.[partyId]=" + partyId + ",[proLabelId]=" + proLabelId + ",[depLabelId]="
+ depLabelId + ",[purLabelId]=" + purLabelId);
if (proLabelId == null && depLabelId == null && purLabelId == null) {
return;
}
LabelUsedMessageDto labelUsedMessageDto = new LabelUsedMessageDto(partyId, proLabelId, depLabelId, purLabelId);
try {
labelUsedQueueBiz.sendMessageQueue(labelUsedMessageDto);
} catch (Exception e) {
log.error("【标签中心(消)】标签使用量.[sendMessageQueue]:" + e.getMessage(), e);
}
log.info("【标签中心(消)】标签使用量,<END>");
}
/**
* 获取标签的名称
*/
public Map<Long, String> getLabelName(List<Long> labelIds) throws BizException {
log.info("【标签中心(消)】获取标签的名称,<START>.[labelIds]=" + labelIds.toString());
if (ListUtils.isEmpty(labelIds)) {
return null;
}
Map<Long, String> labelNameMap = null;
try {
labelNameMap = ResponseHandleUtil.parseMap(labelService.getLabelName(labelIds), Long.class, String.class);
} catch (Exception e) {
log.error("【标签中心(消)】获取标签的名称.[getLabelName]:" + e.getMessage(), e);
}
log.info("【标签中心(消)】获取标签的名称,<END>.[labelNameMap]=" + (labelNameMap == null ? null : labelNameMap.toString()));
return labelNameMap;
}
/**
* 根据标签名称获取标签id
*/
public Long getLabelIdByName(Long partyId, String code, String labelName, Long parentLabelId) {
log.info("【标签中心(消)】根据标签名称获取标签id,<START>.[partyId]=" + partyId + ",[code]=" + code + ",[labelName]="
+ labelName + ",[parentLabelId]=" + parentLabelId);
if (parentLabelId == null) {
return null;
}
Long labelId = null;
try {
labelId = ResponseHandleUtil
.parseResponse(labelService.getLableIdByName(partyId, code, labelName, parentLabelId), Long.class);
} catch (Exception e) {
log.error("【标签中心(消)】根据标签名称获取标签id.[getLableIdByName]:" + e.getMessage(), e);
}
log.info("【标签中心(消)】根据标签名称获取标签id,<START>.[labelId]=" + labelId);
return labelId;
}
}
......@@ -10,6 +10,7 @@ import com.pcloud.common.utils.ResponseHandleUtil;
import com.pcloud.resourcecenter.product.dto.ProDto;
import com.pcloud.resourcecenter.product.dto.Product4BookDTO;
import com.pcloud.resourcecenter.product.dto.ProductDto;
import com.pcloud.resourcecenter.product.dto.ProductLabelDto;
import com.pcloud.resourcecenter.product.dto.UpdateAppProductParamDTO;
import com.pcloud.resourcecenter.product.entity.Product;
import com.pcloud.resourcecenter.product.service.ProductService;
......@@ -63,6 +64,28 @@ public class ProductConsr {
}
/**
* 获取商品ID集合获取商品的标签
*/
public Map<Long, ProductLabelDto> getLabelByProIds(List<Long> productIds) throws BizException {
LOGGER.info("【资源中心(消)】获取商品ID集合获取商品的标签,<START>.[productIds]=" + productIds);
if (ListUtils.isEmpty(productIds)) {
return null;
}
try {
return ResponseHandleUtil.parseMapResponse(productService.getLabelByProIds(productIds),
Long.class, ProductLabelDto.class);
} catch (BizException e) {
LOGGER.warn("【资源中心(消)】获取商品ID集合获取商品的标签失败:" + e.getMessage(), e);
throw new BizException(e.getCode(), e.getMessage());
} catch (Exception e) {
LOGGER.error("【资源中心(消)】获取商品ID集合获取商品的标签.[listProDetail4Wechat]:" + e.getMessage(), e);
throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "服务内部错误,请稍后重试");
} finally {
LOGGER.info("【资源中心(消)】获取商品ID集合获取商品的标签信息,<END>");
}
}
/**
* 资源中心拉取商品基本信息
*/
public Map<Long, ProductDto> getProBasesByIds(List<Long> productIds) throws BizException {
......
......@@ -22,7 +22,7 @@ public interface BookKeywordBiz {
* @Desr:新增关键词
* @Date:2019/4/25 10:53
*/
void insertKeyword(SetKeywordVO setKeywordVO, Long partyId);
void insertKeyword(SetKeywordVO setKeywordVO);
/**
* @Author:lili
......
package com.pcloud.book.keywords.biz.impl;
import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.biz.BookKeywordWarehouseBiz;
import com.pcloud.book.consumer.channel.QrcodeSceneConsr;
import com.pcloud.book.consumer.resource.ProductConsr;
import com.pcloud.book.consumer.wechatgroup.WechatGroupConsr;
......@@ -54,6 +55,8 @@ import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
/**
* @author lily
* @date 2019/4/25 10:47
......@@ -80,11 +83,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private AppTouchRecordDao appTouchRecordDao;
@Autowired
private GroupQrcodeDao groupQrcodeDao;
@Resource
private BookKeywordWarehouseBiz bookKeywordWarehouseBiz;
@Override
@ParamLog("新增关键词")
@Transactional(rollbackFor = Exception.class)
public void insertKeyword(SetKeywordVO setKeywordVO, Long partyId) {
public void insertKeyword(SetKeywordVO setKeywordVO) {
if(null == setKeywordVO || setKeywordVO.check()) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "应用/作品信息为空");
}
if (setKeywordVO.getClassifyId() == null) {
setKeywordVO.setClassifyId(0L);
}
......@@ -102,7 +110,7 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
//新增关键词
Keyword keyword = new Keyword();
BeanUtils.copyProperties(setKeywordVO, keyword);
keyword.setCreateUser(partyId);
keyword.setCreateUser(setKeywordVO.getUserId());
keywordDao.insert(keyword);
//上架商品
List<Long> productIds = new ArrayList<>();
......@@ -119,7 +127,13 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
//获取最大排序值
Integer rank = bookKeywordDao.getMaxRank(setKeywordVO.getBookGroupId(), bookKeyword.getClassifyId());
bookKeyword.setRank(rank + 1);
bookKeyword.setCreateUser(partyId);
bookKeyword.setCreateUser(setKeywordVO.getUserId());
if (null != setKeywordVO.getAddWarehouse() && 1 == setKeywordVO.getAddWarehouse()) {
setKeywordVO.setChannelId(bookGroupDTO.getChannelId());
final Long warehouseId = bookKeywordWarehouseBiz.addBookKeyword(setKeywordVO);
bookKeyword.setWarehouseId(warehouseId);
bookKeyword.setIsWarehouse(1);
}
bookKeywordDao.insert(bookKeyword);
}
......@@ -141,6 +155,9 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if (bookGroupDTO == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "该社群码不存在!");
}
if (null != updateKeywordVO.getAddWarehouse() && 1 == updateKeywordVO.getAddWarehouse()) {
this.bookKeywordDao.updateIsWarehouse(updateKeywordVO.getBookKeywordId());
}
Keyword keyword = new Keyword();
BeanUtils.copyProperties(updateKeywordVO, keyword);
keyword.setId(updateKeywordVO.getKeywordId());
......
......@@ -64,6 +64,12 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
KeywordVO getByBookKeyword(Long bookKeywordId);
/**
* 更新仓库值
* @param bookKeywordId
*/
void updateIsWarehouse(Long bookKeywordId);
/**
* @Author:lili
* @Desr:获取关键词数量
* @Date:2019/5/14 16:46
......
......@@ -73,6 +73,11 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
}
@Override
public void updateIsWarehouse(Long bookKeywordId) {
this.getSqlSession().update("updateIsWarehouse", bookKeywordId);
}
@Override
public Integer getKeywordCount(Long bookGroupId, Long classifyId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("bookGroupId", bookGroupId);
......
......@@ -5,53 +5,32 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2019/4/25 10:17
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class KeywordDTO implements Serializable {
private static final long serialVersionUID = -6868312018634217941L;
@ApiModelProperty("关键词标识")
private Long keywordId;
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("是否仓库词(1:是 0:否)")
private Integer isWarehouse;
@ApiModelProperty("仓库关键词id")
private Long warehouseId;
@ApiModelProperty("引导语")
private String guide;
public Long getKeywordId() {
return keywordId;
}
public void setKeywordId(Long keywordId) {
this.keywordId = keywordId;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public String getGuide() {
return guide;
}
public void setGuide(String guide) {
this.guide = guide;
}
@Override
public String toString() {
return "KeywordVO{" +
"keywordId=" + keywordId +
", keywords='" + keywords + '\'' +
", guide='" + guide + '\'' +
'}';
}
}
......@@ -3,12 +3,15 @@ package com.pcloud.book.keywords.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2019/5/6 11:08
*/
@Data
public class ReplyKeywordDTO implements Serializable {
private static final long serialVersionUID = -8574462003400058682L;
@ApiModelProperty("关键词标识")
private Long keywordId;
......@@ -18,6 +21,12 @@ public class ReplyKeywordDTO implements Serializable {
@ApiModelProperty("回复类型")
private Integer replyType;
@ApiModelProperty("是否仓库词(1:是 0:否)")
private Integer isWarehouse;
@ApiModelProperty("仓库关键词id")
private Long warehouseId;
@ApiModelProperty("内容")
private String content;
......@@ -30,72 +39,4 @@ public class ReplyKeywordDTO implements Serializable {
@ApiModelProperty("描述信息")
private String description;
public Long getKeywordId() {
return keywordId;
}
public void setKeywordId(Long keywordId) {
this.keywordId = keywordId;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public Integer getReplyType() {
return replyType;
}
public void setReplyType(Integer replyType) {
this.replyType = replyType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "ReplyKeywordDTO{" +
"keywordId=" + keywordId +
", keywords='" + keywords + '\'' +
", replyType=" + replyType +
", content='" + content + '\'' +
", picUrl='" + picUrl + '\'' +
", linkUrl='" + linkUrl + '\'' +
", description='" + description + '\'' +
'}';
}
}
......@@ -4,12 +4,20 @@ import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* @author lily
* @date 2019/4/24 11:38
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class BookKeyword extends BaseEntity {
private static final long serialVersionUID = -2202518041150996052L;
private Long id;
/**
......@@ -38,6 +46,16 @@ public class BookKeyword extends BaseEntity {
private Integer setType;
/**
* 是否仓库
*/
private Integer isWarehouse;
/**
* 仓库关键词id
*/
private Long warehouseId;
/**
* 排序
*/
private Integer rank;
......@@ -66,117 +84,5 @@ public class BookKeyword extends BaseEntity {
*/
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getBookId() {
return bookId;
}
public void setBookId(Long bookId) {
this.bookId = bookId;
}
public Long getChannelId() {
return channelId;
}
public void setChannelId(Long channelId) {
this.channelId = channelId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Integer getSetType() {
return setType;
}
public void setSetType(Integer setType) {
this.setType = setType;
}
public Integer getRank() {
return rank;
}
public void setRank(Integer rank) {
this.rank = rank;
}
public Long getKeywordId() {
return keywordId;
}
public void setKeywordId(Long keywordId) {
this.keywordId = keywordId;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "BookKeyword{" +
"id=" + id +
", bookId=" + bookId +
", channelId=" + channelId +
", bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", setType=" + setType +
", rank=" + rank +
", keywordId=" + keywordId +
", createUser=" + createUser +
", createTime=" + createTime +
", updateUser=" + updateUser +
", updateTime=" + updateTime +
'}';
}
}
......@@ -4,12 +4,20 @@ import com.pcloud.common.entity.BaseEntity;
import java.util.Date;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* @author lily
* @date 2019/4/24 11:34
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class Keyword extends BaseEntity {
private static final long serialVersionUID = -2337009049174430167L;
/**
* 关键词标识
*/
......@@ -36,6 +44,11 @@ public class Keyword extends BaseEntity {
private Integer replyType;
/**
* 是否仓库词
*/
private Integer isWarehouse;
/**
* 服务标识
*/
private Long serveId;
......@@ -85,148 +98,4 @@ public class Keyword extends BaseEntity {
*/
private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getGuide() {
return guide;
}
public void setGuide(String guide) {
this.guide = guide;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public Integer getMatchingRule() {
return matchingRule;
}
public void setMatchingRule(Integer matchingRule) {
this.matchingRule = matchingRule;
}
public Integer getReplyType() {
return replyType;
}
public void setReplyType(Integer replyType) {
this.replyType = replyType;
}
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getServeType() {
return serveType;
}
public void setServeType(String serveType) {
this.serveType = serveType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getCreateUser() {
return createUser;
}
public void setCreateUser(Long createUser) {
this.createUser = createUser;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getUpdateUser() {
return updateUser;
}
public void setUpdateUser(Long updateUser) {
this.updateUser = updateUser;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "Keyword{" +
"id=" + id +
", guide='" + guide + '\'' +
", keywords='" + keywords + '\'' +
", matchingRule=" + matchingRule +
", replyType=" + replyType +
", serveId=" + serveId +
", serveType='" + serveType + '\'' +
", content='" + content + '\'' +
", picUrl='" + picUrl + '\'' +
", linkUrl='" + linkUrl + '\'' +
", description='" + description + '\'' +
", createUser=" + createUser +
", createTime=" + createTime +
", updateUser=" + updateUser +
", updateTime=" + updateTime +
'}';
}
}
......@@ -39,7 +39,8 @@ public class BookKeywordFacadeImpl implements BookKeywordFacade {
@PostMapping("insertKeyword")
public ResponseDto<?> insertKeyword(@RequestHeader("token") String token, @RequestBody SetKeywordVO setKeywordVO) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookKeywordBiz.insertKeyword(setKeywordVO, partyId);
setKeywordVO.setUserId(partyId);
bookKeywordBiz.insertKeyword(setKeywordVO);
return new ResponseDto<>();
}
......
......@@ -5,14 +5,17 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2019/4/25 10:17
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class KeywordVO implements Serializable {
private static final long serialVersionUID = -3814214370941974682L;
@ApiModelProperty("社群码设置关键词标识")
private Long bookKeywordId;
......@@ -22,6 +25,12 @@ public class KeywordVO implements Serializable {
@ApiModelProperty("分类标识")
private Long classifyId;
@ApiModelProperty("是否仓库词(1:是 0:否)")
private Integer isWarehouse;
@ApiModelProperty("仓库关键词id")
private Long warehouseId;
@ApiModelProperty("社群码标识")
private Long bookGroupId;
......@@ -55,135 +64,4 @@ public class KeywordVO implements Serializable {
@ApiModelProperty("描述信息")
private String description;
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getKeywordId() {
return keywordId;
}
public void setKeywordId(Long keywordId) {
this.keywordId = keywordId;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public String getGuide() {
return guide;
}
public void setGuide(String guide) {
this.guide = guide;
}
public Integer getMatchingRule() {
return matchingRule;
}
public void setMatchingRule(Integer matchingRule) {
this.matchingRule = matchingRule;
}
public Integer getReplyType() {
return replyType;
}
public void setReplyType(Integer replyType) {
this.replyType = replyType;
}
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getServeType() {
return serveType;
}
public void setServeType(String serveType) {
this.serveType = serveType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Long getBookKeywordId() {
return bookKeywordId;
}
public void setBookKeywordId(Long bookKeywordId) {
this.bookKeywordId = bookKeywordId;
}
@Override
public String toString() {
return "KeywordVO{" +
"bookKeywordId=" + bookKeywordId +
", keywordId=" + keywordId +
", classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", keywords='" + keywords + '\'' +
", guide='" + guide + '\'' +
", matchingRule=" + matchingRule +
", replyType=" + replyType +
", serveId=" + serveId +
", serveType='" + serveType + '\'' +
", content='" + content + '\'' +
", picUrl='" + picUrl + '\'' +
", linkUrl='" + linkUrl + '\'' +
", description='" + description + '\'' +
'}';
}
}
......@@ -5,14 +5,17 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2019/4/25 10:17
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ListKeywordVO implements Serializable {
private static final long serialVersionUID = -4077837341410058443L;
@ApiModelProperty("设置关键词标识")
private Long bookKeywordId;
......@@ -28,6 +31,12 @@ public class ListKeywordVO implements Serializable {
@ApiModelProperty("匹配规则")
private Integer matchingRule;
@ApiModelProperty("是否仓库词(1:是 0:否)")
private Integer isWarehouse;
@ApiModelProperty("仓库关键词id")
private Long warehouseId;
@ApiModelProperty("回复类型")
private Integer replyType;
......@@ -52,126 +61,4 @@ public class ListKeywordVO implements Serializable {
@ApiModelProperty("排序")
private Integer rank;
public Long getBookKeywordId() {
return bookKeywordId;
}
public void setBookKeywordId(Long bookKeywordId) {
this.bookKeywordId = bookKeywordId;
}
public Long getKeywordId() {
return keywordId;
}
public void setKeywordId(Long keywordId) {
this.keywordId = keywordId;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public String getGuide() {
return guide;
}
public void setGuide(String guide) {
this.guide = guide;
}
public Integer getMatchingRule() {
return matchingRule;
}
public void setMatchingRule(Integer matchingRule) {
this.matchingRule = matchingRule;
}
public Integer getReplyType() {
return replyType;
}
public void setReplyType(Integer replyType) {
this.replyType = replyType;
}
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getServeType() {
return serveType;
}
public void setServeType(String serveType) {
this.serveType = serveType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Integer getRank() {
return rank;
}
public void setRank(Integer rank) {
this.rank = rank;
}
@Override
public String toString() {
return "ListKeywordVO{" +
"bookKeywordId=" + bookKeywordId +
", keywordId=" + keywordId +
", keywords='" + keywords + '\'' +
", guide='" + guide + '\'' +
", matchingRule=" + matchingRule +
", replyType=" + replyType +
", serveId=" + serveId +
", serveType='" + serveType + '\'' +
", content='" + content + '\'' +
", picUrl='" + picUrl + '\'' +
", linkUrl='" + linkUrl + '\'' +
", description='" + description + '\'' +
", rank=" + rank +
'}';
}
}
package com.pcloud.book.keywords.vo;
import java.io.Serializable;
import com.pcloud.common.entity.BaseRequestVO;
import com.pcloud.common.utils.string.StringUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* @author lily
* @date 2019/4/24 14:41
*/
public class SetKeywordVO implements Serializable {
@EqualsAndHashCode(callSuper = true)
@Data
@ToString(callSuper = true)
public class SetKeywordVO extends BaseRequestVO {
private static final long serialVersionUID = 969101052142345874L;
@ApiModelProperty("社群码标识")
private Long bookGroupId;
......@@ -22,6 +30,15 @@ public class SetKeywordVO implements Serializable {
@ApiModelProperty("关键词")
private String keywords;
@ApiModelProperty("渠道id")
private Long channelId;
@ApiModelProperty("是否仓库词(1:是 0:否)")
private Integer isWarehouse;
@ApiModelProperty("仓库词id")
private Long warehouseId;
@ApiModelProperty("引导语")
private String guide;
......@@ -46,129 +63,17 @@ public class SetKeywordVO implements Serializable {
@ApiModelProperty("链接地址")
private String linkUrl;
@ApiModelProperty("类型")
private String typeCode;
@ApiModelProperty("描述信息")
private String description;
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Integer getSetType() {
return setType;
}
public void setSetType(Integer setType) {
this.setType = setType;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public String getGuide() {
return guide;
}
public void setGuide(String guide) {
this.guide = guide;
}
public Integer getMatchingRule() {
return matchingRule;
}
public void setMatchingRule(Integer matchingRule) {
this.matchingRule = matchingRule;
}
public Integer getReplyType() {
return replyType;
}
public void setReplyType(Integer replyType) {
this.replyType = replyType;
}
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getServeType() {
return serveType;
}
public void setServeType(String serveType) {
this.serveType = serveType;
}
public String getContent() {
return content;
}
@ApiModelProperty("是否加入仓库")
private Integer addWarehouse;
public void setContent(String content) {
this.content = content;
public Boolean check() {
return 4 == this.getReplyType() && (null == this.getServeId() || StringUtil.isBlank(this.getServeType()));
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "SetKeywordVO{" +
"bookGroupId=" + bookGroupId +
", classifyId=" + classifyId +
", setType=" + setType +
", keywords='" + keywords + '\'' +
", guide='" + guide + '\'' +
", matchingRule=" + matchingRule +
", replyType=" + replyType +
", serveId=" + serveId +
", serveType='" + serveType + '\'' +
", content='" + content + '\'' +
", picUrl='" + picUrl + '\'' +
", linkUrl='" + linkUrl + '\'' +
", description='" + description + '\'' +
'}';
}
}
......@@ -3,13 +3,16 @@ package com.pcloud.book.keywords.vo;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author lily
* @date 2019/4/24 14:41
*/
@Data
public class UpdateKeywordVO implements Serializable {
private static final long serialVersionUID = 1437983088879919619L;
@ApiModelProperty("关键词标识")
private Long keywordId;
......@@ -19,6 +22,9 @@ public class UpdateKeywordVO implements Serializable {
@ApiModelProperty("社群码标识")
private Long bookGroupId;
@ApiModelProperty("书刊关键词id")
private Long bookKeywordId;
@ApiModelProperty("关键词")
private String keywords;
......@@ -31,6 +37,12 @@ public class UpdateKeywordVO implements Serializable {
@ApiModelProperty("回复类型")
private Integer replyType;
@ApiModelProperty("是否仓库词(1:是 0:否)")
private Integer isWarehouse;
@ApiModelProperty("仓库词id")
private Long warehouseId;
@ApiModelProperty("服务标识")
private Long serveId;
......@@ -49,126 +61,7 @@ public class UpdateKeywordVO implements Serializable {
@ApiModelProperty("描述信息")
private String description;
public Long getKeywordId() {
return keywordId;
}
public void setKeywordId(Long keywordId) {
this.keywordId = keywordId;
}
@ApiModelProperty("是否加入仓库")
private Integer addWarehouse;
public Long getClassifyId() {
return classifyId;
}
public void setClassifyId(Long classifyId) {
this.classifyId = classifyId;
}
public Long getBookGroupId() {
return bookGroupId;
}
public void setBookGroupId(Long bookGroupId) {
this.bookGroupId = bookGroupId;
}
public String getKeywords() {
return keywords;
}
public void setKeywords(String keywords) {
this.keywords = keywords;
}
public String getGuide() {
return guide;
}
public void setGuide(String guide) {
this.guide = guide;
}
public Integer getMatchingRule() {
return matchingRule;
}
public void setMatchingRule(Integer matchingRule) {
this.matchingRule = matchingRule;
}
public Integer getReplyType() {
return replyType;
}
public void setReplyType(Integer replyType) {
this.replyType = replyType;
}
public Long getServeId() {
return serveId;
}
public void setServeId(Long serveId) {
this.serveId = serveId;
}
public String getServeType() {
return serveType;
}
public void setServeType(String serveType) {
this.serveType = serveType;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPicUrl() {
return picUrl;
}
public void setPicUrl(String picUrl) {
this.picUrl = picUrl;
}
public String getLinkUrl() {
return linkUrl;
}
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
@Override
public String toString() {
return "UpdateKeywordVO{" +
"keywordId=" + keywordId +
", classifyId=" + classifyId +
", bookGroupId=" + bookGroupId +
", keywords='" + keywords + '\'' +
", guide='" + guide + '\'' +
", matchingRule=" + matchingRule +
", replyType=" + replyType +
", serveId=" + serveId +
", serveType='" + serveType + '\'' +
", content='" + content + '\'' +
", picUrl='" + picUrl + '\'' +
", linkUrl='" + linkUrl + '\'' +
", description='" + description + '\'' +
'}';
}
}
<?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.KeywordUseRecordDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.book.entity.KeywordUseRecord">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="keyword_id" property="keywordId" jdbcType="BIGINT"/>
<result column="keyword_detail_id" property="keywordDetailId" jdbcType="BIGINT"/>
<result column="adviser_id" property="adviserId" jdbcType="BIGINT"/>
<result column="use_num" property="useNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="update_user" property="updateUser" jdbcType="BIGINT"/>
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
<result column="is_delete" property="isDelete" jdbcType="INTEGER"/>
</resultMap>
<sql id="Base_Column_List">
id, keyword_id, keyword_detail_id, adviser_id, use_num, create_user, create_time, update_user, update_time,
is_delete
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List"/>
from book_keyword_use_record
where id = #{id,jdbcType=BIGINT}
</select>
<select id="getByAdviserIdAndKeywordId" resultMap="BaseResultMap">
select
id, keyword_id, keyword_detail_id, adviser_id, use_num
from book_keyword_use_record
where adviser_id = #{adviserId,jdbcType=BIGINT} and keyword_detail_id = #{keywordDetailId,jdbcType=BIGINT}
</select>
<insert id="insert" parameterType="com.pcloud.book.book.entity.KeywordUseRecord">
insert into book_keyword_use_record (id, keyword_id, keyword_detail_id, adviser_id,
use_num, create_user, create_time,
update_user, update_time, is_delete
)
values (#{id,jdbcType=BIGINT}, #{keywordId,jdbcType=BIGINT}, #{keywordDetailId,jdbcType=BIGINT}, #{adviserId,jdbcType=BIGINT},
#{useNum,jdbcType=INTEGER}, #{createUser,jdbcType=BIGINT}, #{createTime,jdbcType=TIMESTAMP},
#{updateUser,jdbcType=BIGINT}, #{updateTime,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.book.entity.KeywordUseRecord">
insert into book_keyword_use_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="keywordId != null">
keyword_id,
</if>
<if test="keywordDetailId != null">
keyword_detail_id,
</if>
<if test="adviserId != null">
adviser_id,
</if>
<if test="useNum != null">
use_num,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateUser != null">
update_user,
</if>
<if test="updateTime != null">
update_time,
</if>
<if test="isDelete != null">
is_delete,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="keywordId != null">
#{keywordId,jdbcType=BIGINT},
</if>
<if test="keywordDetailId != null">
#{keywordDetailId,jdbcType=BIGINT},
</if>
<if test="adviserId != null">
#{adviserId,jdbcType=BIGINT},
</if>
<if test="useNum != null">
#{useNum,jdbcType=INTEGER},
</if>
<if test="createUser != null">
#{createUser,jdbcType=BIGINT},
</if>
<if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null">
#{updateUser,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDelete != null">
#{isDelete,jdbcType=INTEGER},
</if>
</trim>
</insert>
<select id="oftenKeyword" resultType="com.pcloud.book.book.vo.BookKeywordProductVO" parameterType="map">
SELECT
a.keyword_id as keywordId,
a.keyword_detail_id as keywordDetailId,
b.description,
b.link_url as linkUrl,
b.pic_url as picUrl,
b.product_id as productId,
b.product_type as productType,
b.type_code as typeCode,
b.content,
c.matching_rule as matchingRule,
a.use_num as useNum,
c.guide
FROM
book_keyword_use_record a
LEFT JOIN book_keyword_warehouse_detail b ON a.keyword_detail_id = b.id
LEFT JOIN book_keyword_warehouse c ON a.keyword_id = c.id
WHERE
b.is_delete = 0
AND a.adviser_id = #{adviserId}
<if test="depthLabelId != null and depthLabelId != '' ">
and b.depth_label_id = #{depthLabelId}
</if>
order by a.use_num DESC, a.create_time DESC
</select>
<update id="addOne">
update book_keyword_use_record set use_num = use_num + 1, update_user = #{adviserId}, update_time = NOW() where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKeySelective"
parameterType="com.pcloud.book.book.entity.KeywordUseRecord">
update book_keyword_use_record
<set>
<if test="keywordId != null">
keyword_id = #{keywordId,jdbcType=BIGINT},
</if>
<if test="keywordDetailId != null">
keyword_detail_id = #{keywordDetailId,jdbcType=BIGINT},
</if>
<if test="adviserId != null">
adviser_id = #{adviserId,jdbcType=BIGINT},
</if>
<if test="useNum != null">
use_num = #{useNum,jdbcType=INTEGER},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=BIGINT},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null">
update_user = #{updateUser,jdbcType=BIGINT},
</if>
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDelete != null">
is_delete = #{isDelete,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.book.entity.KeywordUseRecord">
update book_keyword_use_record
set keyword_id = #{keywordId,jdbcType=BIGINT},
keyword_detail_id = #{keywordDetailId,jdbcType=BIGINT},
adviser_id = #{adviserId,jdbcType=BIGINT},
use_num = #{useNum,jdbcType=INTEGER},
create_user = #{createUser,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_delete = #{isDelete,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
<?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.KeywordWarehouseDaoImpl" >
<resultMap id="BaseResultMap" type="com.pcloud.book.book.entity.KeywordWarehouse" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="keyword" property="keyword" jdbcType="VARCHAR" />
<result column="guide" property="guide" jdbcType="VARCHAR" />
<result column="scope" property="scope" jdbcType="INTEGER" />
<result column="matching_rule" property="matchingRule" jdbcType="INTEGER" />
<result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
<result column="editor_id" property="editorId" jdbcType="INTEGER" />
<result column="create_user" property="createUser" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
<result column="update_user" property="updateUser" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
<result column="is_delete" property="isDelete" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, keyword, guide, scope, matching_rule, audit_status, editor_id, create_user, create_time, update_user,
update_time, is_delete
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from book_keyword_warehouse
where id = #{id,jdbcType=BIGINT}
</select>
<select id="listByIds" parameterType="list" resultMap="BaseResultMap">
select id, keyword, guide, scope, matching_rule, audit_status, editor_id from book_keyword_warehouse
where id in
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
order by id desc
</select>
<select id="listBookKeywordWarehouse" resultType="com.pcloud.book.book.vo.response.BookKeywordResponseVO" parameterType="map">
select
a.id, a.keyword, a.guide, a.matching_rule as matchingRule, editor_id as editorId
from book_keyword_warehouse a left join book_keyword_warehouse_detail b on a.id = b.keyword_id
where a.is_delete = 0 and b.is_delete = 0
<if test="keyword != null and keyword != '' ">
and a.keyword LIKE CONCAT('%', #{keyword},'%')
</if>
<if test="professionalLabelId != null and professionalLabelId != '' ">
and b.professional_label_id = #{professionalLabelId}
</if>
<if test="depthLabelId != null and depthLabelId != '' ">
and b.depth_label_id = #{depthLabelId}
</if>
<if test="purposeLabelId != null and purposeLabelId != '' ">
and b.purpose_label_id = #{purposeLabelId}
</if>
<if test="id != null and id != '' ">
and a.id = #{id}
</if>
group by a.id
order by a.create_time desc
</select>
<select id="checkKeyword" resultType="com.pcloud.book.book.vo.response.CheckKeywordResponseVO">
SELECT
a.keyword_id as keywordId,
a.depth_label_id as depthLabelId,
count(*) AS num
FROM
book_keyword_warehouse_detail a
LEFT JOIN book_keyword_warehouse b ON a.keyword_id = b.id
WHERE
a.is_delete = 0
AND b.is_delete = 0
AND b.keyword = #{keyword}
AND a.depth_label_id IN
<foreach collection="list" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</select>
<insert id="insert" parameterType="com.pcloud.book.book.entity.KeywordWarehouse" useGeneratedKeys="true" keyProperty="id" >
insert into book_keyword_warehouse (id, keyword, guide, scope,
matching_rule, audit_status, editor_id,
create_user, create_time, update_user,
update_time, is_delete)
values (#{id,jdbcType=BIGINT}, #{keyword,jdbcType=VARCHAR}, #{guide,jdbcType=VARCHAR}, #{scope,jdbcType=INTEGER},
#{matchingRule,jdbcType=INTEGER}, #{auditStatus,jdbcType=INTEGER}, #{editorId,jdbcType=INTEGER},
#{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER},
#{updateTime,jdbcType=TIMESTAMP}, #{isDelete,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.pcloud.book.book.entity.KeywordWarehouse" >
insert into book_keyword_warehouse
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="guide != null" >
guide,
</if>
<if test="keyword != null" >
keyword,
</if>
<if test="scope != null" >
scope,
</if>
<if test="matchingRule != null" >
matching_rule,
</if>
<if test="auditStatus != null" >
audit_status,
</if>
<if test="editorId != null" >
editor_id,
</if>
<if test="createUser != null" >
create_user,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="updateUser != null" >
update_user,
</if>
<if test="updateTime != null" >
update_time,
</if>
<if test="isDelete != null" >
is_delete,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=BIGINT},
</if>
<if test="guide != null" >
#{guide,jdbcType=VARCHAR},
</if>
<if test="keyword != null" >
#{keyword,jdbcType=VARCHAR},
</if>
<if test="scope != null" >
#{scope,jdbcType=INTEGER},
</if>
<if test="matchingRule != null" >
#{matchingRule,jdbcType=INTEGER},
</if>
<if test="auditStatus != null" >
#{auditStatus,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
#{editorId,jdbcType=INTEGER},
</if>
<if test="createUser != null" >
#{createUser,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null" >
#{updateUser,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
#{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDelete != null" >
#{isDelete,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.pcloud.book.book.entity.KeywordWarehouse" >
update book_keyword_warehouse
<set >
<if test="keyword != null" >
keyword = #{keyword,jdbcType=VARCHAR},
</if>
<if test="scope != null" >
scope = #{scope,jdbcType=INTEGER},
</if>
<if test="guide != null" >
guide = #{guide,jdbcType=VARCHAR},
</if>
<if test="matchingRule != null" >
matching_rule = #{matchingRule,jdbcType=INTEGER},
</if>
<if test="auditStatus != null" >
audit_status = #{auditStatus,jdbcType=INTEGER},
</if>
<if test="editorId != null" >
editor_id = #{editorId,jdbcType=INTEGER},
</if>
<if test="createUser != null" >
create_user = #{createUser,jdbcType=INTEGER},
</if>
<if test="createTime != null" >
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if test="updateUser != null" >
update_user = #{updateUser,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if test="isDelete != null" >
is_delete = #{isDelete,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.pcloud.book.book.entity.KeywordWarehouse" >
update book_keyword_warehouse
set keyword = #{keyword,jdbcType=VARCHAR},
scope = #{scope,jdbcType=INTEGER},
guide = #{guide,jdbcType=VARCHAR},
matching_rule = #{matchingRule,jdbcType=INTEGER},
audit_status = #{auditStatus,jdbcType=INTEGER},
editor_id = #{editorId,jdbcType=INTEGER},
create_user = #{createUser,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_user = #{updateUser,jdbcType=INTEGER},
update_time = #{updateTime,jdbcType=TIMESTAMP},
is_delete = #{isDelete,jdbcType=INTEGER}
where id = #{id,jdbcType=BIGINT}
</update>
</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