Commit 60c5c49b by daixing

关键词配置优化-运营需求

parent fd7505cd
...@@ -32,6 +32,8 @@ import com.pcloud.book.group.enums.RankTypeEnum; ...@@ -32,6 +32,8 @@ import com.pcloud.book.group.enums.RankTypeEnum;
import com.pcloud.book.group.set.GroupSet; import com.pcloud.book.group.set.GroupSet;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.*; import com.pcloud.book.group.vo.*;
import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
import com.pcloud.common.core.constant.SystemCode; import com.pcloud.common.core.constant.SystemCode;
import com.pcloud.common.core.enums.NotifyOriginTypeEnum; import com.pcloud.common.core.enums.NotifyOriginTypeEnum;
...@@ -115,7 +117,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -115,7 +117,11 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
@Autowired @Autowired
private LabelService labelService; private LabelService labelService;
@Autowired @Autowired
private BookKeywordDao bookKeywordDao;
@Autowired
private GroupSet groupSet; private GroupSet groupSet;
@Autowired
private BookGroupClassifyBiz bookGroupClassifyBiz;
@Override @Override
@ParamLog("新增分类") @ParamLog("新增分类")
...@@ -170,6 +176,28 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz { ...@@ -170,6 +176,28 @@ public class BookGroupClassifyBizImpl implements BookGroupClassifyBiz {
bookGroupClassifyDao.updateSpecId(bookGroupClassify.getId(), bookGroupClassify.getProductSpecId()); bookGroupClassifyDao.updateSpecId(bookGroupClassify.getId(), bookGroupClassify.getProductSpecId());
//发送更新群名称请求 //发送更新群名称请求
// String robotId = wechatGroupConsr.getRobotIdByGroupId(oneQrcode.getWeixinGroupId()); // String robotId = wechatGroupConsr.getRobotIdByGroupId(oneQrcode.getWeixinGroupId());
//同步关键词
List<BookKeyword> bookKeywords = new ArrayList<>();
List<SyncKeyworsVO> syncKeyworsVOS = bookKeywordDao.getKeywordsIdsByBookGroupId(addClassifyVO.getBookGroupId());
syncKeyworsVOS.forEach(e -> {
BookKeyword bookKeyword = new BookKeyword();
bookKeyword.setBookGroupId(addClassifyVO.getBookGroupId());
bookKeyword.setClassifyId(bookGroupClassify.getId());
bookKeyword.setKeywordId(e.getKeywordsId());
bookKeyword.setBookId(addClassifyVO.getBookId());
bookKeyword.setChannelId(addClassifyVO.getChannelId());
bookKeyword.setSetType(0);
//获取最大排序值
Integer seq = bookKeywordDao.getMaxRank(addClassifyVO.getBookGroupId(), bookKeyword.getClassifyId());
bookKeyword.setRank(seq + 1);
bookKeyword.setCreateUser(partyId);
bookKeyword.setWarehouseId(e.getWarehouseId());
bookKeyword.setIsWarehouse(e.getIsWarehouse());
bookKeyword.setIsEdit(0);
bookKeywords.add(bookKeyword);
});
bookKeywordDao.insert(bookKeywords);
SendWeixinRequestTools.changeGroupName(oneQrcode.getRobotWxId(), oneQrcode.getWeixinGroupId(), groupQrcode.getGroupName()); SendWeixinRequestTools.changeGroupName(oneQrcode.getRobotWxId(), oneQrcode.getWeixinGroupId(), groupQrcode.getGroupName());
} }
......
package com.pcloud.book.group.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/16 16:34
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public class SyncKeyworsVO implements Serializable {
private static final long serialVersionUID = 3548004941763949055L;
private Long keywordsId;
private Integer isWarehouse;
private Long warehouseId;
public Long getKeywordsId() {
return keywordsId;
}
public void setKeywordsId(Long keywordsId) {
this.keywordsId = keywordsId;
}
public Integer getIsWarehouse() {
return isWarehouse;
}
public void setIsWarehouse(Integer isWarehouse) {
this.isWarehouse = isWarehouse;
}
public Long getWarehouseId() {
return warehouseId;
}
public void setWarehouseId(Long warehouseId) {
this.warehouseId = warehouseId;
}
@Override
public String toString() {
return "SyncKeyworsVO{" +
"keywordsId=" + keywordsId +
", isWarehouse=" + isWarehouse +
", warehouseId=" + warehouseId +
'}';
}
}
\ No newline at end of file
...@@ -35,7 +35,7 @@ public interface BookKeywordBiz { ...@@ -35,7 +35,7 @@ public interface BookKeywordBiz {
* @Desr:删除关键词 * @Desr:删除关键词
* @Date:2019/4/25 10:53 * @Date:2019/4/25 10:53
*/ */
void deleteKeyword(Long keywordId, Long partyId); void deleteKeyword(DeleteKeywordVO deleteKeywordVO, Long partyId);
/** /**
* @Author:lili * @Author:lili
...@@ -83,6 +83,12 @@ public interface BookKeywordBiz { ...@@ -83,6 +83,12 @@ public interface BookKeywordBiz {
PageBeanNew<KeywordStatisticsDTO> getKeywordStatistics(Integer currentPage, Integer numPerPage, Long bookGroupId, String weixinGroupId); PageBeanNew<KeywordStatisticsDTO> getKeywordStatistics(Integer currentPage, Integer numPerPage, Long bookGroupId, String weixinGroupId);
/** /**
* @description 获取关键词个数
* @author 戴兴
* @date 2019/7/18 15:55
*/
Integer getKeywordCount(Long bookGroupId, Long classifyId);
/**
* 获取某个群内关键词配置的所有资源 * 获取某个群内关键词配置的所有资源
* @param qrWeixinParam * @param qrWeixinParam
* @return * @return
......
...@@ -21,6 +21,7 @@ import com.pcloud.book.group.entity.AppTouchRecord; ...@@ -21,6 +21,7 @@ import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.GroupQrcode; import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.enums.TouchTypeEnum; import com.pcloud.book.group.enums.TouchTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.ClassifyNameVO;
import com.pcloud.book.keywords.biz.BookKeywordBiz; import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dao.BookKeywordRecordDao; import com.pcloud.book.keywords.dao.BookKeywordRecordDao;
...@@ -143,28 +144,100 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -143,28 +144,100 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
} }
productConsr.productAutoOnShelves(bookGroupDTO.getChannelId(), productIds); productConsr.productAutoOnShelves(bookGroupDTO.getChannelId(), productIds);
//新增关键词与分类或者图书的关系 //新增关键词与分类或者图书的关系
BookKeyword bookKeyword = new BookKeyword(); //按群创建
BeanUtils.copyProperties(setKeywordVO, bookKeyword); if (setKeywordVO.getSetType() == 1){
bookKeyword.setKeywordId(keyword.getId()); BookKeyword bookKeyword = new BookKeyword();
bookKeyword.setBookId(bookGroupDTO.getBookId()); BeanUtils.copyProperties(setKeywordVO, bookKeyword);
bookKeyword.setChannelId(bookGroupDTO.getChannelId()); bookKeyword.setKeywordId(keyword.getId());
//获取最大排序值 bookKeyword.setBookId(bookGroupDTO.getBookId());
Integer rank = bookKeywordDao.getMaxRank(setKeywordVO.getBookGroupId(), bookKeyword.getClassifyId()); bookKeyword.setChannelId(bookGroupDTO.getChannelId());
bookKeyword.setRank(rank + 1); //获取最大排序值
bookKeyword.setCreateUser(setKeywordVO.getUserId()); Integer rank = bookKeywordDao.getMaxRank(setKeywordVO.getBookGroupId(), bookKeyword.getClassifyId());
if (null != setKeywordVO.getAddWarehouse() && 1 == setKeywordVO.getAddWarehouse()) { bookKeyword.setRank(rank + 1);
setKeywordVO.setChannelId(bookGroupDTO.getChannelId()); bookKeyword.setCreateUser(setKeywordVO.getUserId());
final Long warehouseId = bookKeywordWarehouseBiz.addBookKeyword(setKeywordVO); if (null != setKeywordVO.getAddWarehouse() && 1 == setKeywordVO.getAddWarehouse()) {
bookKeyword.setWarehouseId(warehouseId); setKeywordVO.setChannelId(bookGroupDTO.getChannelId());
bookKeyword.setIsWarehouse(1); final Long warehouseId = bookKeywordWarehouseBiz.addBookKeyword(setKeywordVO);
} bookKeyword.setWarehouseId(warehouseId);
if(null == bookKeyword.getIsWarehouse()){ bookKeyword.setIsWarehouse(1);
bookKeyword.setIsWarehouse(0); }
} if(null == bookKeyword.getIsWarehouse()){
if(null == bookKeyword.getWarehouseId()){ bookKeyword.setIsWarehouse(0);
bookKeyword.setWarehouseId(0L); }
} if(null == bookKeyword.getWarehouseId()){
bookKeywordDao.insert(bookKeyword); bookKeyword.setWarehouseId(0L);
}
bookKeyword.setIsEdit(1);
bookKeywordDao.insert(bookKeyword);
}
//按书创建
else {
List<ClassifyNameVO> classifyNameVOS = bookGroupClassifyDao.listClassifyByRank(setKeywordVO.getBookGroupId());
List<BookKeyword> bookKeywords = new ArrayList<>();
//创建群的记录
if (!ListUtils.isEmpty(classifyNameVOS)) {
classifyNameVOS.forEach(e -> {
BookKeyword bookKeyword = new BookKeyword();
BeanUtils.copyProperties(setKeywordVO, bookKeyword);
bookKeyword.setKeywordId(keyword.getId());
bookKeyword.setBookId(bookGroupDTO.getBookId());
bookKeyword.setChannelId(bookGroupDTO.getChannelId());
bookKeyword.setClassifyId(e.getId());
//获取最大排序值
Integer rank = bookKeywordDao.getMaxRank(setKeywordVO.getBookGroupId(), bookKeyword.getClassifyId());
bookKeyword.setRank(rank + 1);
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);
}
if (null == bookKeyword.getIsWarehouse()) {
bookKeyword.setIsWarehouse(0);
}
if (null == bookKeyword.getWarehouseId()) {
bookKeyword.setWarehouseId(0L);
}
if (0 == bookKeyword.getClassifyId()) {
bookKeyword.setIsEdit(1);
}else {
bookKeyword.setIsEdit(0);
}
bookKeywords.add(bookKeyword);
});
}
//创建书的记录
BookKeyword bookKeyword = new BookKeyword();
BeanUtils.copyProperties(setKeywordVO, bookKeyword);
bookKeyword.setKeywordId(keyword.getId());
bookKeyword.setBookId(bookGroupDTO.getBookId());
bookKeyword.setChannelId(bookGroupDTO.getChannelId());
//获取最大排序值
Integer rank = bookKeywordDao.getMaxRank(setKeywordVO.getBookGroupId(), bookKeyword.getClassifyId());
bookKeyword.setRank(rank + 1);
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);
}
if (null == bookKeyword.getIsWarehouse()) {
bookKeyword.setIsWarehouse(0);
}
if (null == bookKeyword.getWarehouseId()) {
bookKeyword.setWarehouseId(0L);
}
if (0 == bookKeyword.getClassifyId()) {
bookKeyword.setIsEdit(1);
}else {
bookKeyword.setIsEdit(0);
}
bookKeywords.add(bookKeyword);
bookKeywordDao.insert(bookKeywords);
}
} }
@Override @Override
...@@ -237,9 +310,20 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -237,9 +310,20 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("删除关键词") @ParamLog("删除关键词")
public void deleteKeyword(Long keywordId, Long partyId) { public void deleteKeyword(DeleteKeywordVO deleteKeywordVO, Long partyId) {
keywordDao.deleteById(keywordId, partyId); if (deleteKeywordVO == null || deleteKeywordVO.getIsEdit() == null || deleteKeywordVO.getKeywordId() == null){
bookKeywordDao.deleteById(keywordId, partyId); throw new BookBizException(BookBizException.ERROR,"缺少必要参数");
}
if (deleteKeywordVO.getClassifyId() == null){
deleteKeywordVO.setClassifyId(0L);
}
if (deleteKeywordVO.getIsEdit() == 1){
keywordDao.deleteById(deleteKeywordVO.getKeywordId(), partyId);
bookKeywordDao.deleteById(deleteKeywordVO.getKeywordId(), partyId);
}else {
bookKeywordDao.deleteKeywords(deleteKeywordVO.getKeywordId(),deleteKeywordVO.getBookGroupId(),deleteKeywordVO.getClassifyId(),partyId);
}
} }
@Override @Override
...@@ -273,6 +357,9 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -273,6 +357,9 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
if ("PRODUCT".equalsIgnoreCase(vo.getServeType())) { if ("PRODUCT".equalsIgnoreCase(vo.getServeType())) {
productIds.add(vo.getServeId()); productIds.add(vo.getServeId());
} }
if (vo.getIsEdit() == null){
vo.setIsEdit(1);
}
} }
Map<Long, AppDto> app = Maps.newHashMap(); Map<Long, AppDto> app = Maps.newHashMap();
if(!CollectionUtils.isEmpty(appIds)) { if(!CollectionUtils.isEmpty(appIds)) {
...@@ -496,7 +583,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -496,7 +583,16 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
return pageBeanNew; return pageBeanNew;
} }
@Override
public Integer getKeywordCount(Long bookGroupId, Long classifyId) {
if (bookGroupId == null){
throw new BookBizException(BookBizException.ERROR, "缺少参数bookGroupId");
}
if (classifyId == null){
classifyId = 0L;
}
return bookKeywordDao.getKeywordCount(bookGroupId, classifyId);
}
@Override @Override
......
package com.pcloud.book.keywords.dao; package com.pcloud.book.keywords.dao;
import com.pcloud.book.group.vo.SyncKeyworsVO;
import com.pcloud.book.keywords.dto.KeywordDTO; import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO; import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookKeyword; import com.pcloud.book.keywords.entity.BookKeyword;
...@@ -83,4 +84,18 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> { ...@@ -83,4 +84,18 @@ public interface BookKeywordDao extends BaseDao<BookKeyword> {
* @return * @return
*/ */
List<ListKeywordVO> getKeywordsByClassifyIds(List<Long> classifyIds, Long bookId); List<ListKeywordVO> getKeywordsByClassifyIds(List<Long> classifyIds, Long bookId);
/**
* @description 根据booGroupId获取关键词id
* @author 戴兴
* @date 2019/7/16 15:28
*/
List<SyncKeyworsVO> getKeywordsIdsByBookGroupId(Long bookGroupId);
/**
* @description 按群删除关键词
* @author 戴兴
* @date 2019/7/16 17:18
*/
void deleteKeywords(Long keywordId, Long bookGroupId, Long classifyId, Long partyId);
} }
...@@ -2,6 +2,7 @@ package com.pcloud.book.keywords.dao.impl; ...@@ -2,6 +2,7 @@ package com.pcloud.book.keywords.dao.impl;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.pcloud.book.group.vo.SyncKeyworsVO;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.dto.KeywordDTO; import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO; import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
...@@ -98,4 +99,19 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book ...@@ -98,4 +99,19 @@ public class BookKeywordDaoImpl extends BaseDaoImpl<BookKeyword> implements Book
paramMap.put("bookId", bookId); paramMap.put("bookId", bookId);
return this.getSqlSession().selectList(this.getStatement("getKeywordsByClassifyIds"), paramMap); return this.getSqlSession().selectList(this.getStatement("getKeywordsByClassifyIds"), paramMap);
} }
@Override
public List<SyncKeyworsVO> getKeywordsIdsByBookGroupId(Long bookGroupId) {
return this.getSqlSession().selectList(this.getStatement("getKeywordsIdsByBookGroupId"), bookGroupId);
}
@Override
public void deleteKeywords(Long keywordId, Long bookGroupId, Long classifyId, Long partyId) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("keywordId", keywordId);
paramMap.put("bookGroupId", bookGroupId);
paramMap.put("classifyId", classifyId);
paramMap.put("partyId", partyId);
this.getSqlSession().update(this.getStatement("deleteKeywords"), paramMap);
}
} }
...@@ -84,5 +84,10 @@ public class BookKeyword extends BaseEntity { ...@@ -84,5 +84,10 @@ public class BookKeyword extends BaseEntity {
*/ */
private Date updateTime; private Date updateTime;
/**
* 创建类型0-按书创建,1-按群创建
*/
private Integer isEdit;
} }
...@@ -34,7 +34,7 @@ public interface BookKeywordFacade { ...@@ -34,7 +34,7 @@ public interface BookKeywordFacade {
@ApiOperation(value = "设置关键词", httpMethod = "POST") @ApiOperation(value = "设置关键词", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"), @ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "setKeywordVO", value = "设置关键词", dataType = "SetKeywordVO", paramType = "body") @ApiImplicitParam(name = "setKeywordVO", value = "设置关键词", dataType = "List<SetKeywordVO>", paramType = "body")
}) })
@PostMapping("insertKeyword") @PostMapping("insertKeyword")
ResponseDto<?> insertKeyword(@RequestHeader("token") String token, @RequestBody List<SetKeywordVO> setKeywordVOs) ResponseDto<?> insertKeyword(@RequestHeader("token") String token, @RequestBody List<SetKeywordVO> setKeywordVOs)
...@@ -49,13 +49,13 @@ public interface BookKeywordFacade { ...@@ -49,13 +49,13 @@ public interface BookKeywordFacade {
ResponseDto<?> updateKeyword(@RequestHeader("token") String token, @RequestBody UpdateKeywordVO updateKeywordVO) ResponseDto<?> updateKeyword(@RequestHeader("token") String token, @RequestBody UpdateKeywordVO updateKeywordVO)
throws BizException, PermissionException; throws BizException, PermissionException;
@ApiOperation(value = "删除关键词", httpMethod = "GET") @ApiOperation(value = "删除关键词", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"), @ApiImplicitParam(name = "token", value = "token", dataType = "String", paramType = "header"),
@ApiImplicitParam(name = "keywordId", value = "关键词标识", dataType = "Long", paramType = "query") @ApiImplicitParam(name = "deleteKeywordVO", value = "关键词删除VO", dataType = "DeleteKeywordVO", paramType = "body")
}) })
@GetMapping("deleteKeyword") @PostMapping("deleteKeyword")
ResponseDto<?> deleteKeyword(@RequestHeader("token") String token, @RequestParam("keywordId") Long keywordId) ResponseDto<?> deleteKeyword(@RequestHeader("token") String token, @RequestBody DeleteKeywordVO deleteKeywordVO)
throws BizException, PermissionException; throws BizException, PermissionException;
...@@ -106,6 +106,12 @@ public interface BookKeywordFacade { ...@@ -106,6 +106,12 @@ public interface BookKeywordFacade {
@RequestParam(value = "weixinGroupId",required = false) String weixinGroupId @RequestParam(value = "weixinGroupId",required = false) String weixinGroupId
) throws BizException, PermissionException; ) throws BizException, PermissionException;
@ApiOperation("获取关键词数量")
@GetMapping("getKeywordCount")
ResponseDto<?> getKeywordCount(@RequestHeader("token") String token,@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam(required = false,value = "classifyId") Long classifyId) throws PermissionException;
@ApiOperation("获取某个群内关键词配置的所有资源") @ApiOperation("获取某个群内关键词配置的所有资源")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"), @ApiImplicitParam(name = "userInfo", value = "Cookie", dataType = "string", paramType = "header"),
......
...@@ -58,10 +58,10 @@ public class BookKeywordFacadeImpl implements BookKeywordFacade { ...@@ -58,10 +58,10 @@ public class BookKeywordFacadeImpl implements BookKeywordFacade {
} }
@Override @Override
@GetMapping("deleteKeyword") @PostMapping("deleteKeyword")
public ResponseDto<?> deleteKeyword(@RequestHeader("token") String token, @RequestParam("keywordId") Long keywordId) throws BizException, PermissionException { public ResponseDto<?> deleteKeyword(@RequestHeader("token") String token, @RequestBody DeleteKeywordVO deleteKeywordVO) throws BizException, PermissionException {
Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); Long partyId = (Long) SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
bookKeywordBiz.deleteKeyword(keywordId, partyId); bookKeywordBiz.deleteKeyword(deleteKeywordVO, partyId);
return new ResponseDto<>(); return new ResponseDto<>();
} }
...@@ -116,7 +116,15 @@ public class BookKeywordFacadeImpl implements BookKeywordFacade { ...@@ -116,7 +116,15 @@ public class BookKeywordFacadeImpl implements BookKeywordFacade {
return new ResponseDto<>(bookKeywordBiz.getKeywordStatistics(currentPage,numPerPage,bookGroupId,weixinGroupId)); return new ResponseDto<>(bookKeywordBiz.getKeywordStatistics(currentPage,numPerPage,bookGroupId,weixinGroupId));
} }
@Override
@ApiOperation("获取关键词数量")
@GetMapping("getKeywordCount")
public ResponseDto<?> getKeywordCount(@RequestHeader("token") String token,@RequestParam("bookGroupId") Long bookGroupId,
@RequestParam(required = false,value = "classifyId") Long classifyId) throws PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
Integer keywordCount = bookKeywordBiz.getKeywordCount(bookGroupId, classifyId);
return new ResponseDto<>(keywordCount);
}
@ApiOperation("获取某个群内关键词配置的所有资源") @ApiOperation("获取某个群内关键词配置的所有资源")
@PostMapping("getAllServiceByWeixinGroup4Wechat") @PostMapping("getAllServiceByWeixinGroup4Wechat")
......
package com.pcloud.book.keywords.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import java.io.Serializable;
/**
* @author 戴兴
* @description TODO
* @date 2019/7/16 17:06
*/
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class DeleteKeywordVO implements Serializable {
private static final long serialVersionUID = -3814214370941974682L;
private Long keywordId;
private Long bookGroupId;
private Long classifyId;
private Integer isEdit;
}
\ No newline at end of file
...@@ -79,4 +79,7 @@ public class ListKeywordVO implements Serializable { ...@@ -79,4 +79,7 @@ public class ListKeywordVO implements Serializable {
@ApiModelProperty("来源APP应用,PRODUCT作品,SUPER_PRODUCT超级作者作品") @ApiModelProperty("来源APP应用,PRODUCT作品,SUPER_PRODUCT超级作者作品")
private String apSource; private String apSource;
@ApiModelProperty("是否可编辑0-否,1-是")
private Integer isEdit;
} }
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
warehouse_id, warehouse_id,
create_user, create_user,
create_time, create_time,
is_edit,
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
#{bookId,jdbcType=BIGINT}, #{bookId,jdbcType=BIGINT},
...@@ -30,8 +31,38 @@ ...@@ -30,8 +31,38 @@
#{warehouseId,jdbcType=BIGINT}, #{warehouseId,jdbcType=BIGINT},
#{createUser,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT},
NOW(), NOW(),
#{isEdit,jdbcType=TINYINT},
</trim> </trim>
</insert> </insert>
<insert id="batchInsert" parameterType="bookKeyword" useGeneratedKeys="true" keyProperty="id">
insert into book_keyword(book_id,
channel_id,
book_group_id,
classify_id,
set_type,
rank,
keyword_id,
is_warehouse,
warehouse_id,
create_user,
create_time,
is_edit) values
<foreach collection="list" item="item" separator=",">
(#{item.bookId,jdbcType=BIGINT},
#{item.channelId,jdbcType=BIGINT},
#{item.bookGroupId,jdbcType=BIGINT},
#{item.classifyId,jdbcType=BIGINT},
#{item.setType,jdbcType=TINYINT},
#{item.rank,jdbcType=TINYINT},
#{item.keywordId,jdbcType=BIGINT},
#{item.isWarehouse,jdbcType=TINYINT},
#{item.warehouseId,jdbcType=BIGINT},
#{item.createUser,jdbcType=BIGINT},
NOW(),
#{item.isEdit,jdbcType=TINYINT})
</foreach>
</insert>
<update id="deleteById" parameterType="map"> <update id="deleteById" parameterType="map">
update book_keyword update book_keyword
...@@ -82,7 +113,8 @@ ...@@ -82,7 +113,8 @@
k.serve_id serveId, k.serve_id serveId,
k.serve_type serveType, k.serve_type serveType,
bk.is_warehouse as isWarehouse, bk.is_warehouse as isWarehouse,
bk.warehouse_id as warehouseId bk.warehouse_id as warehouseId,
bk.is_edit as isEdit
FROM FROM
book_keyword bk book_keyword bk
JOIN JOIN
...@@ -261,6 +293,24 @@ ...@@ -261,6 +293,24 @@
ORDER BY ORDER BY
bk.rank ASC,bk.id DESC bk.rank ASC,bk.id DESC
</select> </select>
<select id="getKeywordsIdsByBookGroupId" parameterType="long" resultType="com.pcloud.book.group.vo.SyncKeyworsVO">
select k.id keywordsId, bk.is_warehouse isWarehouse, bk.warehouse_id warehouseId from book_keyword bk
JOIN keyword k ON bk.keyword_id = k.id where bk.book_group_id = #{bookGroupId}
</select>
<update id="deleteKeywords" parameterType="map">
update book_keyword
<set>
is_delete = 1,
update_user = #{partyId},
update_time = now()
</set>
where keyword_id = #{keywordId,jdbcType=BIGINT}
and book_group_id = #{bookGroupId,jdbcType=BIGINT}
and classify_id = #{classifyId,jdbcType=BIGINT}
</update>
<select id="getServiceByWeixinGroup" parameterType="map" resultType="com.pcloud.book.keywords.dto.ServiceResourceDTO"> <select id="getServiceByWeixinGroup" parameterType="map" resultType="com.pcloud.book.keywords.dto.ServiceResourceDTO">
SELECT SELECT
t.channel_id as channelId, t.channel_id as channelId,
......
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