Commit bb956790 by zhuyajie

多条关键词回复

parent 4a4d9f5f
...@@ -29,10 +29,7 @@ import com.pcloud.book.group.enums.AppAndProductTypeEnum; ...@@ -29,10 +29,7 @@ import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.enums.BookGroupAppOriginTypeEnum; import com.pcloud.book.group.enums.BookGroupAppOriginTypeEnum;
import com.pcloud.book.keywords.dao.BookGuideDao; import com.pcloud.book.keywords.dao.BookGuideDao;
import com.pcloud.book.keywords.dao.BookKeywordDao; import com.pcloud.book.keywords.dao.BookKeywordDao;
import com.pcloud.book.keywords.entity.BookGuide; import com.pcloud.book.keywords.entity.*;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.BookKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.push.dao.PushGroupDao; import com.pcloud.book.push.dao.PushGroupDao;
import com.pcloud.book.push.entity.PushGroup; import com.pcloud.book.push.entity.PushGroup;
...@@ -360,11 +357,13 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz { ...@@ -360,11 +357,13 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz {
} }
List<BookGroupApp> bookGroupApps = new ArrayList<>(); List<BookGroupApp> bookGroupApps = new ArrayList<>();
for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords) { for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords) {
if (ReplyTypeEnum.APP.value.equals(selfRobotKeyword.getType())) { List<SelfRobotKeywordReply> replyList = selfRobotKeyword.getKeywordReplyList();
for (SelfRobotKeywordReply keywordReply : replyList){
if (ReplyTypeEnum.APP.value.equals(keywordReply.getType())) {
BookGroupApp bookGroupApp = new BookGroupApp(); BookGroupApp bookGroupApp = new BookGroupApp();
bookGroupApp.setOriginType(BookGroupAppOriginTypeEnum.SELF_KEYWORD.code); bookGroupApp.setOriginType(BookGroupAppOriginTypeEnum.SELF_KEYWORD.code);
bookGroupApp.setServeId(selfRobotKeyword.getServeId()); bookGroupApp.setServeId(keywordReply.getServeId());
bookGroupApp.setServeType(selfRobotKeyword.getServeType()); bookGroupApp.setServeType(keywordReply.getServeType());
bookGroupApp.setClassifyId(0L); bookGroupApp.setClassifyId(0L);
bookGroupApp.setBookGroupId(selfRobotKeyword.getBookGroupId()); bookGroupApp.setBookGroupId(selfRobotKeyword.getBookGroupId());
bookGroupApp.setCreateUser(selfRobotKeyword.getCreateUser()); bookGroupApp.setCreateUser(selfRobotKeyword.getCreateUser());
...@@ -376,6 +375,7 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz { ...@@ -376,6 +375,7 @@ public class BookGroupAppBizImpl implements BookGroupAppBiz {
bookGroupApps.add(bookGroupApp); bookGroupApps.add(bookGroupApp);
} }
} }
}
if (ListUtils.isEmpty(bookGroupApps)) { if (ListUtils.isEmpty(bookGroupApps)) {
return; return;
} }
......
...@@ -25,18 +25,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools; ...@@ -25,18 +25,12 @@ import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO; import com.pcloud.book.group.vo.GroupQrcodeBaseInfoVO;
import com.pcloud.book.keywords.biz.BookGuideBiz; import com.pcloud.book.keywords.biz.BookGuideBiz;
import com.pcloud.book.keywords.biz.BookKeywordBiz; import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.dao.BookGuideDao; import com.pcloud.book.keywords.dao.*;
import com.pcloud.book.keywords.dao.BookGuideReplyDao;
import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dto.GuideDTO; import com.pcloud.book.keywords.dto.GuideDTO;
import com.pcloud.book.keywords.dto.KeywordDTO; import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatusDTO; import com.pcloud.book.keywords.dto.KeywordStatusDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO; import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookGuide; import com.pcloud.book.keywords.entity.*;
import com.pcloud.book.keywords.entity.BookGuideReply;
import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.GuideVO; import com.pcloud.book.keywords.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO; import com.pcloud.book.keywords.vo.ReplyMessageVO;
...@@ -125,6 +119,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -125,6 +119,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Value("${system.env}") @Value("${system.env}")
private String envStr; private String envStr;
@Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
@ParamLog("同意加好友发送欢迎语") @ParamLog("同意加好友发送欢迎语")
@Override @Override
...@@ -157,41 +153,18 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -157,41 +153,18 @@ public class BookGuideBizImpl implements BookGuideBiz {
bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId()); bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId());
//新增暗号对应记录 //新增暗号对应记录
bookGroupCipherUserDao.insert(bookGroupCipherUser); bookGroupCipherUserDao.insert(bookGroupCipherUser);
/* SendTextMessageVO addFriendVo = new SendTextMessageVO();
addFriendVo.setContent(dto.getAddFriendGuide());
addFriendVo.setCode(SendMessageTypeEnum.SELF.getCode());
addFriendVo.setWxId(agreeAddUserDTO.getRobotWxId());
addFriendVo.setAltId(agreeAddUserDTO.getRobotWxId());
addFriendVo.setWxGroupId(agreeAddUserDTO.getUserWxId());
addFriendVo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(addFriendVo);
log.info("临时demo发送个人号加好友欢迎语信息"+addFriendVo.toString());*/
//好友引导语 //好友引导语
sendFriendGuide(bookGroupId, agreeAddUserDTO); sendFriendGuide(bookGroupId, agreeAddUserDTO);
//回复关键词引导语 //回复关键词引导语
List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId); List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(selfRobotKeywords)){ if (!ListUtils.isEmpty(selfRobotKeywords)){
/* try {
String content="现在你试试回复我定制一套【背单词】读书计划【 】内关键词来唤醒我";
SendTextMessageVO voh = new SendTextMessageVO();
voh.setContent(content);
voh.setCode(SendMessageTypeEnum.SELF.getCode());
voh.setWxId(agreeAddUserDTO.getRobotWxId());
voh.setAltId(agreeAddUserDTO.getRobotWxId());
voh.setWxGroupId(agreeAddUserDTO.getUserWxId());
voh.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(voh);
log.info("临时demo发送个人号加好友信息唤醒"+voh.toString());
Thread.sleep(5000);
} catch (InterruptedException e) {
log.error("发消息休眠5秒出错", e);
}*/
ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(()->{ ThreadPoolUtils.SEND_MESSAGE_THREAD_POOL.execute(()->{
for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){ for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){
try { try {
if ("长江作业本".equals(selfRobotKeyword.getKeyword())){ if ("长江作业本".equals(selfRobotKeyword.getKeyword())){
Thread.sleep(1000*60*10); Thread.sleep(1000*60*10);
} }
if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){
SendTextMessageVO vo = new SendTextMessageVO(); SendTextMessageVO vo = new SendTextMessageVO();
vo.setContent(selfRobotKeyword.getGuide()); vo.setContent(selfRobotKeyword.getGuide());
vo.setCode(SendMessageTypeEnum.SELF.getCode()); vo.setCode(SendMessageTypeEnum.SELF.getCode());
...@@ -200,6 +173,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -200,6 +173,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
vo.setWxGroupId(agreeAddUserDTO.getUserWxId()); vo.setWxGroupId(agreeAddUserDTO.getUserWxId());
vo.setIp(agreeAddUserDTO.getIp()); vo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(vo); WxGroupSDK.sendTextMessage(vo);
log.info("临时demo发送个人号加好友信息"+vo.toString());
}
if ("学前".equals(selfRobotKeyword.getKeyword()) if ("学前".equals(selfRobotKeyword.getKeyword())
&&envStr.toUpperCase().equals("PRO")&&agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")){ &&envStr.toUpperCase().equals("PRO")&&agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")){
SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO(); SendGroupInviteVO sendGroupInviteVO = new SendGroupInviteVO();
...@@ -211,9 +186,15 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -211,9 +186,15 @@ public class BookGuideBizImpl implements BookGuideBiz {
log.info("临时发送入群连接 sendGroupInviteVO:{}", sendGroupInviteVO); log.info("临时发送入群连接 sendGroupInviteVO:{}", sendGroupInviteVO);
} }
if ("教辅书单".equals(selfRobotKeyword.getKeyword())){ if ("教辅书单".equals(selfRobotKeyword.getKeyword())){
List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId());
if (ListUtils.isEmpty(replyList)){
continue;
}
for (SelfRobotKeywordReply keywordReply : replyList){
if (ReplyTypeEnum.RESOURCE.value.equals(keywordReply.getType())){
SendFileVO sendFileVO = new SendFileVO(); SendFileVO sendFileVO = new SendFileVO();
Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(selfRobotKeyword.getResourceId())); Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(keywordReply.getResourceId()));
ResourceDTO resourceDTO = map.get(selfRobotKeyword.getResourceId()); ResourceDTO resourceDTO = map.get(keywordReply.getResourceId());
if (resourceDTO != null) { if (resourceDTO != null) {
sendFileVO.setFileUrl(resourceDTO.getFileUrl()); sendFileVO.setFileUrl(resourceDTO.getFileUrl());
sendFileVO.setFileName(resourceDTO.getResourceName()); sendFileVO.setFileName(resourceDTO.getResourceName());
...@@ -223,7 +204,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -223,7 +204,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
sendFileVO.setWxId(agreeAddUserDTO.getUserWxId()); sendFileVO.setWxId(agreeAddUserDTO.getUserWxId());
WxGroupSDK.sendFile(sendFileVO); WxGroupSDK.sendFile(sendFileVO);
} }
log.info("临时demo发送个人号加好友信息"+vo.toString()); }
}
Thread.sleep(1000*40); Thread.sleep(1000*40);
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.error("发消息休眠5秒出错", e); log.error("发消息休眠5秒出错", e);
......
...@@ -45,18 +45,12 @@ import com.pcloud.book.group.vo.ClassifyVO; ...@@ -45,18 +45,12 @@ import com.pcloud.book.group.vo.ClassifyVO;
import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO; import com.pcloud.book.group.vo.GroupQrcode4ClassifyVO;
import com.pcloud.book.group.vo.ListClassifyVO; import com.pcloud.book.group.vo.ListClassifyVO;
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.*;
import com.pcloud.book.keywords.dao.BookKeywordRecordDao;
import com.pcloud.book.keywords.dao.KeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dto.KeywordDTO; import com.pcloud.book.keywords.dto.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatisticsDTO; import com.pcloud.book.keywords.dto.KeywordStatisticsDTO;
import com.pcloud.book.keywords.dto.ReplyKeywordDTO; import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.dto.ServiceResourceDTO; import com.pcloud.book.keywords.dto.ServiceResourceDTO;
import com.pcloud.book.keywords.entity.BookKeyword; import com.pcloud.book.keywords.entity.*;
import com.pcloud.book.keywords.entity.BookKeywordRecord;
import com.pcloud.book.keywords.entity.Keyword;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.book.keywords.vo.DeleteKeywordVO; import com.pcloud.book.keywords.vo.DeleteKeywordVO;
import com.pcloud.book.keywords.vo.KeywordVO; import com.pcloud.book.keywords.vo.KeywordVO;
...@@ -182,6 +176,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -182,6 +176,8 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
private ResourceConsr resourceConsr; private ResourceConsr resourceConsr;
@Value("${system.env}") @Value("${system.env}")
private String envStr; private String envStr;
@Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
/** /**
* 字符串切割长度 * 字符串切割长度
*/ */
...@@ -609,10 +605,15 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -609,10 +605,15 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
String ip = sendTextDTO.getIp(); String ip = sendTextDTO.getIp();
Integer code = sendTextDTO.getCode(); Integer code = sendTextDTO.getCode();
String robotId = sendTextDTO.getWxId(); String robotId = sendTextDTO.getWxId();
Integer type = selfRobotKeyword.getType(); List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId());
if (ListUtils.isEmpty(replyList)){
return;
}
for (SelfRobotKeywordReply keywordReply : replyList){
Integer type = keywordReply.getType();
if (ReplyTypeEnum.TEXT.value.equals(type)) { if (ReplyTypeEnum.TEXT.value.equals(type)) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
sendTextMessageVO.setContent(selfRobotKeyword.getContent()); sendTextMessageVO.setContent(keywordReply.getContent());
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(userWxId); sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
...@@ -623,57 +624,96 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -623,57 +624,96 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
SendPicMessageVO sendPicMessageVO = new SendPicMessageVO(); SendPicMessageVO sendPicMessageVO = new SendPicMessageVO();
sendPicMessageVO.setWxGroupId(userWxId); sendPicMessageVO.setWxGroupId(userWxId);
sendPicMessageVO.setAltId(robotId); sendPicMessageVO.setAltId(robotId);
sendPicMessageVO.setPicUrl(selfRobotKeyword.getPicUrl()); sendPicMessageVO.setPicUrl(keywordReply.getPicUrl());
sendPicMessageVO.setIp(ip); sendPicMessageVO.setIp(ip);
sendPicMessageVO.setCode(code); sendPicMessageVO.setCode(code);
WxGroupSDK.sendPicMessage(sendPicMessageVO); WxGroupSDK.sendPicMessage(sendPicMessageVO);
} }
if (ReplyTypeEnum.LINK.value.equals(type)) { if (ReplyTypeEnum.LINK.value.equals(type)) {
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); /* SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
String content = selfRobotKeyword.getGuide() + ",点击这里进入:" + selfRobotKeyword.getLinkUrl(); String content;
if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){
content = selfRobotKeyword.getGuide() + ",点击这里进入:" + keywordReply.getLinkUrl();
}else {
content = "点击这里进入:" + keywordReply.getLinkUrl();
}
sendTextMessageVO.setContent(content); sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(userWxId); sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code); sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);*/
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setCode(code);
sendArticleMessageVO.setAltId(robotId);
sendArticleMessageVO.setDescription(keywordReply.getDescription());
sendArticleMessageVO.setWxGroupId(userWxId);
sendArticleMessageVO.setLinkUrl(keywordReply.getLinkUrl());
sendArticleMessageVO.setPicUrl(keywordReply.getPicUrl());
sendArticleMessageVO.setTitle(keywordReply.getContent());
sendArticleMessageVO.setIp(ip);
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
} }
if (ReplyTypeEnum.APP.value.equals(type)) { if (ReplyTypeEnum.APP.value.equals(type)) {
BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(selfRobotKeyword.getBookGroupId()); BookGroupDTO bookGroupDTO = bookGroupDao.getDTOById(selfRobotKeyword.getBookGroupId());
AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(bookGroupDTO.getChannelId()); AccountSettingDto accountSettingDto = qrcodeSceneConsr.getWechatInfo(bookGroupDTO.getChannelId());
if (AppAndProductTypeEnum.APP.value.equals(selfRobotKeyword.getServeType())) { if (AppAndProductTypeEnum.APP.value.equals(keywordReply.getServeType())) {
AppDto appDto = appConsr.getBaseById(selfRobotKeyword.getServeId()); AppDto appDto = appConsr.getBaseById(keywordReply.getServeId());
if (appDto != null) { if (appDto != null) {
accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId()); accountSettingDto = qrcodeSceneConsr.getWechatInfo(appDto.getChannelId());
} }
} }
// 处理链接地址 // 处理链接地址
String endUrl = selfRobotKeyword.getLinkUrl() + "&book_group_id=" + selfRobotKeyword.getBookGroupId() + "&wxId=" + userWxId + "&robotWxId=" + robotId; String endUrl = keywordReply.getLinkUrl() + "&book_group_id=" + selfRobotKeyword.getBookGroupId() + "&wxId=" + userWxId + "&robotWxId=" + robotId;
String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl); String linkUrl = SendWeixinRequestTools.splitUrl(accountSettingDto, endUrl);
String resultUrl = UrlUtils.getShortUrl4Own(linkUrl); String resultUrl = UrlUtils.getShortUrl4Own(linkUrl);
SendTextMessageVO sendTextMessageVO = new SendTextMessageVO(); /* SendTextMessageVO sendTextMessageVO = new SendTextMessageVO();
String content = selfRobotKeyword.getGuide() + ",点击这里进入:" + resultUrl; String content;
if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){
content = selfRobotKeyword.getGuide() + ",点击这里进入:" + resultUrl;
}else {
content = "点击这里进入:" + resultUrl;
}
sendTextMessageVO.setContent(content); sendTextMessageVO.setContent(content);
sendTextMessageVO.setAltId(robotId); sendTextMessageVO.setAltId(robotId);
sendTextMessageVO.setWxGroupId(userWxId); sendTextMessageVO.setWxGroupId(userWxId);
sendTextMessageVO.setIp(ip); sendTextMessageVO.setIp(ip);
sendTextMessageVO.setCode(code); sendTextMessageVO.setCode(code);
WxGroupSDK.sendTextMessage(sendTextMessageVO); WxGroupSDK.sendTextMessage(sendTextMessageVO);*/
SendArticleMessageVO sendArticleMessageVO = new SendArticleMessageVO();
sendArticleMessageVO.setCode(code);
sendArticleMessageVO.setAltId(robotId);
sendArticleMessageVO.setDescription(keywordReply.getDescription());
sendArticleMessageVO.setWxGroupId(userWxId);
sendArticleMessageVO.setLinkUrl(resultUrl);
sendArticleMessageVO.setPicUrl(keywordReply.getPicUrl());
sendArticleMessageVO.setTitle(keywordReply.getContent());
sendArticleMessageVO.setIp(ip);
WxGroupSDK.sendArticleMessage(sendArticleMessageVO);
} }
if (ReplyTypeEnum.RESOURCE.value.equals(type)) { if (ReplyTypeEnum.RESOURCE.value.equals(type)) {
SendFileVO sendFileVO = new SendFileVO(); SendFileVO sendFileVO = new SendFileVO();
Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(selfRobotKeyword.getResourceId())); Map<Long, ResourceDTO> map = resourceConsr.mapByIds(Arrays.asList(keywordReply.getResourceId()));
ResourceDTO resourceDTO = map.get(selfRobotKeyword.getResourceId()); ResourceDTO resourceDTO = map.get(keywordReply.getResourceId());
if (resourceDTO != null) { if (resourceDTO != null) {
sendFileVO.setFileUrl(resourceDTO.getFileUrl()); sendFileVO.setFileUrl(resourceDTO.getFileUrl());
sendFileVO.setFileName(resourceDTO.getResourceName()); String fileName = resourceDTO.getResourceName();
String fileType = resourceDTO.getFileType();
log.info("fileName="+fileName+"+fileType+"+fileType);
if (fileName.contains(fileType)){//去掉后缀
fileName = fileName.substring(0, fileName.indexOf(fileType)-1);
}
log.info("fileName="+fileName);
sendFileVO.setFileName(fileName);
} }
sendFileVO.setIp(ip); sendFileVO.setIp(ip);
sendFileVO.setAltId(robotId); sendFileVO.setAltId(robotId);
sendFileVO.setWxId(userWxId); sendFileVO.setWxId(userWxId);
WxGroupSDK.sendFile(sendFileVO); WxGroupSDK.sendFile(sendFileVO);
} }
}
} }
@ParamLog("获取的关键词是否为社群书的简称") @ParamLog("获取的关键词是否为社群书的简称")
...@@ -710,7 +750,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz { ...@@ -710,7 +750,12 @@ public class BookKeywordBizImpl implements BookKeywordBiz {
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
SelfRobotKeyword selfRobotKeyword = selfRobotKeywords.get(i); SelfRobotKeyword selfRobotKeyword = selfRobotKeywords.get(i);
String toAddIn = selfRobotKeyword.getGuide() + ",请回复“" + selfRobotKeyword.getKeyword() + "”\n"; String toAddIn;
if (!StringUtil.isEmpty(selfRobotKeyword.getGuide())){
toAddIn = selfRobotKeyword.getGuide() + ",请回复“" + selfRobotKeyword.getKeyword() + "”\n";
}else {
toAddIn = "请回复“" + selfRobotKeyword.getKeyword() + "”\n";
}
//最后一个 //最后一个
if (i + 1 == size) { if (i + 1 == size) {
// 拼接反馈链接 // 拼接反馈链接
......
...@@ -13,8 +13,10 @@ import com.pcloud.book.group.enums.AppAndProductTypeEnum; ...@@ -13,8 +13,10 @@ import com.pcloud.book.group.enums.AppAndProductTypeEnum;
import com.pcloud.book.group.tools.SendWeixinRequestTools; import com.pcloud.book.group.tools.SendWeixinRequestTools;
import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz; import com.pcloud.book.keywords.biz.SelfRobotKeywordBiz;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao; import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO; import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword; import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.book.keywords.enums.ReplyTypeEnum; import com.pcloud.book.keywords.enums.ReplyTypeEnum;
import com.pcloud.channelcenter.wechat.dto.AccountSettingDto; import com.pcloud.channelcenter.wechat.dto.AccountSettingDto;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
...@@ -58,6 +60,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -58,6 +60,8 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
private ResourceConsr resourceConsr; private ResourceConsr resourceConsr;
@Autowired @Autowired
private QrcodeSceneConsr qrcodeSceneConsr; private QrcodeSceneConsr qrcodeSceneConsr;
@Autowired
private SelfRobotKeywordReplyDao selfRobotKeywordReplyDao;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ParamLog("批量新增个人号关键词") @ParamLog("批量新增个人号关键词")
...@@ -88,20 +92,33 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -88,20 +92,33 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
selfRobotKeyword.setSeqNum(maxSeqNum + 1); selfRobotKeyword.setSeqNum(maxSeqNum + 1);
maxSeqNum = maxSeqNum + 1; maxSeqNum = maxSeqNum + 1;
maxSeqMap.put(bookGroupId, maxSeqNum); maxSeqMap.put(bookGroupId, maxSeqNum);
}
//新增 //新增
selfRobotKeywordDao.batchInsert(selfRobotKeywords); selfRobotKeywordDao.insert(selfRobotKeyword);
Long keywordId = selfRobotKeyword.getId();
List<SelfRobotKeywordReply> replyList = selfRobotKeyword.getKeywordReplyList();
replyList.forEach(selfRobotKeywordReply -> {
selfRobotKeywordReply.setKeywordId(keywordId);
selfRobotKeywordReply.setCreateUser(partyId);
});
selfRobotKeywordReplyDao.insert(replyList);
}
//将作品应用关键词加到社群书应用 //将作品应用关键词加到社群书应用
bookGroupAppBiz.addSelfKeywordToBookGroupApp(selfRobotKeywords); bookGroupAppBiz.addSelfKeywordToBookGroupApp(selfRobotKeywords);
Map<Long, List<SelfRobotKeyword>> listMap = selfRobotKeywords.stream().filter(s -> AppAndProductTypeEnum.PRODUCT.value.equalsIgnoreCase(s.getServeType())).collect(Collectors.groupingBy(s -> s.getBookGroupId()));
for (Long bookGroupId : bookGroupIds) { for (Long bookGroupId : bookGroupIds) {
List<SelfRobotKeyword> list = listMap.get(bookGroupId); List<SelfRobotKeyword> list = selfRobotKeywordDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(list)) { for (SelfRobotKeyword keyword : list){
List<Long> productIds = list.stream().filter(s -> s.getServeId() != null).map(SelfRobotKeyword::getServeId).collect(Collectors.toList()); List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(keyword.getId());
if (!ListUtils.isEmpty(replyList)) {
List<SelfRobotKeywordReply> replyProductList = replyList.stream().filter(s -> AppAndProductTypeEnum.PRODUCT.value.equalsIgnoreCase(s.getServeType())).collect(Collectors.toList());
if (ListUtils.isEmpty(replyProductList)){
continue;
}
List<Long> productIds = replyProductList.stream().filter(s -> s.getServeId() != null).map(SelfRobotKeywordReply::getServeId).collect(Collectors.toList());
//自动上架 //自动上架
productConsr.productAutoOnShelves(btcMap.get(bookGroupId), productIds); productConsr.productAutoOnShelves(btcMap.get(bookGroupId), productIds);
} }
} }
}
} }
...@@ -115,10 +132,19 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -115,10 +132,19 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "未找到该社群书!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "未找到该社群书!");
} }
selfRobotKeywordDao.updateSelfRobotKeyword(selfRobotKeyword); selfRobotKeywordDao.updateSelfRobotKeyword(selfRobotKeyword);
if (ReplyTypeEnum.APP.value.equals(selfRobotKeyword.getType()) selfRobotKeywordReplyDao.deleteByKeywordId(selfRobotKeyword.getId());
&& AppAndProductTypeEnum.PRODUCT.value.equals(selfRobotKeyword.getServeType())) { List<SelfRobotKeywordReply> replyList = selfRobotKeyword.getKeywordReplyList();
replyList.forEach(selfRobotKeywordReply -> {
selfRobotKeywordReply.setKeywordId(selfRobotKeyword.getId());
selfRobotKeywordReply.setCreateUser(partyId);
});
selfRobotKeywordReplyDao.insert(replyList);
for (SelfRobotKeywordReply selfRobotKeywordReply:replyList){
if (ReplyTypeEnum.APP.value.equals(selfRobotKeywordReply.getType())
&& AppAndProductTypeEnum.PRODUCT.value.equals(selfRobotKeywordReply.getServeType())) {
//上架 //上架
productConsr.productAutoOnShelves(dto.getChannelId(), Arrays.asList(selfRobotKeyword.getServeId())); productConsr.productAutoOnShelves(dto.getChannelId(), Arrays.asList(selfRobotKeywordReply.getServeId()));
}
} }
} }
...@@ -127,6 +153,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -127,6 +153,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
@Override @Override
public void deleteSelfRobotKeyword(Long id) { public void deleteSelfRobotKeyword(Long id) {
selfRobotKeywordDao.deleteById(id); selfRobotKeywordDao.deleteById(id);
selfRobotKeywordReplyDao.deleteByKeywordId(id);
} }
@ParamLog("获取个人号关键词列表") @ParamLog("获取个人号关键词列表")
...@@ -189,18 +216,24 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -189,18 +216,24 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
List<Long> appIds=new ArrayList<>(); List<Long> appIds=new ArrayList<>();
List<Long> productIds=new ArrayList<>(); List<Long> productIds=new ArrayList<>();
List<Long> resourceIds=new ArrayList<>(); List<Long> resourceIds=new ArrayList<>();
for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){ for (SelfRobotKeyword selfRobotKeyword : selfRobotKeywords){
Integer type=selfRobotKeyword.getType(); List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId());
if (ListUtils.isEmpty(replyList)){
continue;
}
for (SelfRobotKeywordReply keywordReply : replyList){
Integer type=keywordReply.getType();
if (ReplyTypeEnum.APP.value.equals(type)){ if (ReplyTypeEnum.APP.value.equals(type)){
if (AppAndProductTypeEnum.APP.value.equals(selfRobotKeyword.getServeType())){ if (AppAndProductTypeEnum.APP.value.equals(keywordReply.getServeType())){
appIds.add(selfRobotKeyword.getServeId()); appIds.add(keywordReply.getServeId());
} }
if (AppAndProductTypeEnum.PRODUCT.value.equals(selfRobotKeyword.getServeType())){ if (AppAndProductTypeEnum.PRODUCT.value.equals(keywordReply.getServeType())){
productIds.add(selfRobotKeyword.getServeId()); productIds.add(keywordReply.getServeId());
} }
} }
if (ReplyTypeEnum.RESOURCE.value.equals(type)){ if (ReplyTypeEnum.RESOURCE.value.equals(type)){
resourceIds.add(selfRobotKeyword.getResourceId()); resourceIds.add(keywordReply.getResourceId());
}
} }
} }
Map<Long, AppDto> appDtoMap=new HashMap<>(); Map<Long, AppDto> appDtoMap=new HashMap<>();
...@@ -216,43 +249,50 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -216,43 +249,50 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
resourceDTOMap = resourceConsr.mapByIds(resourceIds); resourceDTOMap = resourceConsr.mapByIds(resourceIds);
} }
for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){ for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){
Integer type=selfRobotKeyword.getType(); List<SelfRobotKeywordReply> replyList = selfRobotKeywordReplyDao.getListByKeywordId(selfRobotKeyword.getId());
if (ListUtils.isEmpty(replyList)){
continue;
}
for (SelfRobotKeywordReply keywordReply : replyList){
Integer type=keywordReply.getType();
if (ReplyTypeEnum.APP.value.equals(type)){ if (ReplyTypeEnum.APP.value.equals(type)){
Long serveId=selfRobotKeyword.getServeId(); Long serveId=keywordReply.getServeId();
if (AppAndProductTypeEnum.APP.value.equals(selfRobotKeyword.getServeType())){ if (AppAndProductTypeEnum.APP.value.equals(keywordReply.getServeType())){
AppDto appDto=appDtoMap.get(serveId); AppDto appDto=appDtoMap.get(serveId);
if (appDto!=null){ if (appDto!=null){
selfRobotKeyword.setServePic(appDto.getSquareImg()); keywordReply.setServePic(appDto.getSquareImg());
selfRobotKeyword.setServeName(appDto.getTitle()); keywordReply.setServeName(appDto.getTitle());
selfRobotKeyword.setServeTypeCode(appDto.getTypeCode()); keywordReply.setServeTypeCode(appDto.getTypeCode());
selfRobotKeyword.setServeTypeName(appDto.getTypeName()); keywordReply.setServeTypeName(appDto.getTypeName());
} }
} }
if (AppAndProductTypeEnum.PRODUCT.value.equals(selfRobotKeyword.getServeType())){ if (AppAndProductTypeEnum.PRODUCT.value.equals(keywordReply.getServeType())){
ProductDto productDto=productDtoMap.get(serveId); ProductDto productDto=productDtoMap.get(serveId);
if (productDto!=null){ if (productDto!=null){
selfRobotKeyword.setServePic(productDto.getCoverImg()); keywordReply.setServePic(productDto.getCoverImg());
selfRobotKeyword.setServeName(productDto.getProductName()); keywordReply.setServeName(productDto.getProductName());
ProductTypeDto productTypeDto = productDto.getProductTypeDto(); ProductTypeDto productTypeDto = productDto.getProductTypeDto();
if (productTypeDto!=null){ if (productTypeDto!=null){
selfRobotKeyword.setServeTypeCode(productTypeDto.getTypeCode()); keywordReply.setServeTypeCode(productTypeDto.getTypeCode());
selfRobotKeyword.setServeTypeName(productTypeDto.getTypeName()); keywordReply.setServeTypeName(productTypeDto.getTypeName());
} }
} }
} }
} }
if (ReplyTypeEnum.RESOURCE.value.equals(type)){ if (ReplyTypeEnum.RESOURCE.value.equals(type)){
ResourceDTO resourceDTO = resourceDTOMap.get(selfRobotKeyword.getResourceId()); ResourceDTO resourceDTO = resourceDTOMap.get(keywordReply.getResourceId());
if (resourceDTO!=null){ if (resourceDTO!=null){
selfRobotKeyword.setResourceName(resourceDTO.getResourceName()); keywordReply.setResourceName(resourceDTO.getResourceName());
selfRobotKeyword.setResourceUrl(resourceDTO.getFileUrl()); keywordReply.setResourceUrl(resourceDTO.getFileUrl());
selfRobotKeyword.setResourceTypeCode(resourceDTO.getTypeCode()); keywordReply.setResourceTypeCode(resourceDTO.getTypeCode());
selfRobotKeyword.setResourceTypeName(resourceDTO.getTypeName()); keywordReply.setResourceTypeName(resourceDTO.getTypeName());
selfRobotKeyword.setFileType(resourceDTO.getFileType()); keywordReply.setFileType(resourceDTO.getFileType());
selfRobotKeyword.setResourcePdfItems(resourceDTO.getResourcePdfItems()); keywordReply.setResourcePdfItems(resourceDTO.getResourcePdfItems());
selfRobotKeyword.setResourceOfficeItemDTOs(resourceDTO.getResourceOfficeItemDTOs()); keywordReply.setResourceOfficeItemDTOs(resourceDTO.getResourceOfficeItemDTOs());
}
} }
} }
selfRobotKeyword.setKeywordReplyList(replyList);
} }
} }
...@@ -310,30 +350,35 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -310,30 +350,35 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
if (selfRobotKeyword.getBookGroupId() == null) { if (selfRobotKeyword.getBookGroupId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群码id不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "社群码id不能为空!");
} }
if (selfRobotKeyword.getType() == null) { if (ListUtils.isEmpty(selfRobotKeyword.getKeywordReplyList())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "类型不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "回复不能为空!");
} }
if (StringUtil.isEmpty(selfRobotKeyword.getGuide())) { /* if (StringUtil.isEmpty(selfRobotKeyword.getGuide())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "引导语不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "引导语不能为空!");
} }*/
if (StringUtil.isEmpty(selfRobotKeyword.getKeyword())) { if (StringUtil.isEmpty(selfRobotKeyword.getKeyword())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "关键词不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "关键词不能为空!");
} }
Integer type = selfRobotKeyword.getType(); for (SelfRobotKeywordReply selfRobotKeywordReply: selfRobotKeyword.getKeywordReplyList()){
if (ReplyTypeEnum.TEXT.value.equals(type) && StringUtil.isEmpty(selfRobotKeyword.getContent())) { if (null == selfRobotKeywordReply.getType()){
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "回复类型不能为空!");
}
Integer type = selfRobotKeywordReply.getType();
if (ReplyTypeEnum.TEXT.value.equals(type) && StringUtil.isEmpty(selfRobotKeywordReply.getContent())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "内容不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "内容不能为空!");
} }
if (ReplyTypeEnum.IMAGE.value.equals(type) && StringUtil.isEmpty(selfRobotKeyword.getPicUrl())) { if (ReplyTypeEnum.IMAGE.value.equals(type) && StringUtil.isEmpty(selfRobotKeywordReply.getPicUrl())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "图片地址不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "图片地址不能为空!");
} }
if (ReplyTypeEnum.LINK.value.equals(type) && StringUtil.isEmpty(selfRobotKeyword.getLinkUrl())) { if (ReplyTypeEnum.LINK.value.equals(type) && StringUtil.isEmpty(selfRobotKeywordReply.getLinkUrl())) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "链接地址不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "链接地址不能为空!");
} }
if (ReplyTypeEnum.APP.value.equals(type) && (StringUtil.isEmpty(selfRobotKeyword.getServeType()) || selfRobotKeyword.getServeId() == null)) { if (ReplyTypeEnum.APP.value.equals(type) && (StringUtil.isEmpty(selfRobotKeywordReply.getServeType()) || selfRobotKeywordReply.getServeId() == null)) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "应用或作品id和类型不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "应用或作品id和类型不能为空!");
} }
if (ReplyTypeEnum.RESOURCE.value.equals(type) && selfRobotKeyword.getResourceId() == null) { if (ReplyTypeEnum.RESOURCE.value.equals(type) && selfRobotKeywordReply.getResourceId() == null) {
throw new BookBizException(BookBizException.PARAM_IS_ERROR, "资源id和连接不能为空!"); throw new BookBizException(BookBizException.PARAM_IS_ERROR, "资源id和连接不能为空!");
} }
} }
}
} }
package com.pcloud.book.keywords.dao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.common.core.dao.BaseDao;
import java.util.List;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/03 11:39
**/
public interface SelfRobotKeywordReplyDao extends BaseDao<SelfRobotKeywordReply> {
void deleteByKeywordId(Long keywordId);
List<SelfRobotKeywordReply> getListByKeywordId(Long keywordId);
}
package com.pcloud.book.keywords.dao.impl;
import com.pcloud.book.keywords.dao.SelfRobotKeywordDao;
import com.pcloud.book.keywords.dao.SelfRobotKeywordReplyDao;
import com.pcloud.book.keywords.dto.MaxSeqNAndBGDTO;
import com.pcloud.book.keywords.entity.SelfRobotKeyword;
import com.pcloud.book.keywords.entity.SelfRobotKeywordReply;
import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/03 11:39
**/
@Component("selfRobotKeywordReplyDao")
public class SelfRobotKeywordReplyDaoImpl extends BaseDaoImpl<SelfRobotKeywordReply> implements SelfRobotKeywordReplyDao {
@Override
public void deleteByKeywordId(Long keywordId) {
getSessionTemplate().delete(getStatement("deleteByKeywordId"), keywordId);
}
@Override
public List<SelfRobotKeywordReply> getListByKeywordId(Long keywordId) {
return getSessionTemplate().selectList(getStatement("getListByKeywordId"), keywordId);
}
}
...@@ -27,66 +27,12 @@ public class SelfRobotKeyword extends BaseEntity { ...@@ -27,66 +27,12 @@ public class SelfRobotKeyword extends BaseEntity {
@ApiModelProperty("关键词") @ApiModelProperty("关键词")
private String keyword; private String keyword;
@ApiModelProperty("类型 1 文字 2 图片 3 链接 4应用 5素材")
private Integer type;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("链接地址")
private String linkUrl;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("应用或作品id")
private Long serveId;
@ApiModelProperty("应用或作品类型")
private String serveType;
@ApiModelProperty("资源id")
private Long resourceId;
@ApiModelProperty("排序值") @ApiModelProperty("排序值")
private Integer seqNum; private Integer seqNum;
@ApiModelProperty("创建人") @ApiModelProperty("创建人")
private Long createUser; private Long createUser;
@ApiModelProperty("应用或作品图片") @ApiModelProperty("关键词回复列表")
private String servePic; private List<SelfRobotKeywordReply> keywordReplyList;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用或作品类型编码")
private String serveTypeCode;
@ApiModelProperty("资源链接")
private String resourceUrl;
@ApiModelProperty("资源名称")
private String resourceName;
@ApiModelProperty("资源类型编码")
private String resourceTypeCode;
@ApiModelProperty("资源类型名称")
private String resourceTypeName;
@ApiModelProperty("文件类型")
private String fileType;
@ApiModelProperty("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
} }
package com.pcloud.book.keywords.entity;
import com.pcloud.common.entity.BaseEntity;
import com.pcloud.contentcenter.resource.dto.ResourceOfficeItemDTO;
import com.pcloud.contentcenter.resource.dto.ResourcePdfItemDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* @Description
* @Author zhuyajie
* @Date 2020/02/03 11:39
**/
@Data
@ApiModel("个人号关键词回复")
public class SelfRobotKeywordReply extends BaseEntity {
@ApiModelProperty("关键词id")
private Long keywordId;
@ApiModelProperty("类型 1 文字 2 图片 3 链接 4应用 5素材")
private Integer type;
@ApiModelProperty("内容")
private String content;
@ApiModelProperty("描述")
private String description;
@ApiModelProperty("链接地址")
private String linkUrl;
@ApiModelProperty("图片地址")
private String picUrl;
@ApiModelProperty("应用或作品id")
private Long serveId;
@ApiModelProperty("应用或作品类型")
private String serveType;
@ApiModelProperty("资源id")
private Long resourceId;
@ApiModelProperty("排序值")
private Integer seqNum;
@ApiModelProperty("创建人")
private Long createUser;
@ApiModelProperty("应用或作品图片")
private String servePic;
@ApiModelProperty("应用或作品名称")
private String serveName;
@ApiModelProperty("应用或作品类型名称")
private String serveTypeName;
@ApiModelProperty("应用或作品类型编码")
private String serveTypeCode;
@ApiModelProperty("资源链接")
private String resourceUrl;
@ApiModelProperty("资源名称")
private String resourceName;
@ApiModelProperty("资源类型编码")
private String resourceTypeCode;
@ApiModelProperty("资源类型名称")
private String resourceTypeName;
@ApiModelProperty("文件类型")
private String fileType;
@ApiModelProperty("pdf转码后的单张图片集合")
private List<ResourcePdfItemDTO> resourcePdfItems;
@ApiModelProperty("文件转码后的单张图片集合")
private List<ResourceOfficeItemDTO> resourceOfficeItemDTOs;
}
...@@ -6,14 +6,6 @@ ...@@ -6,14 +6,6 @@
<result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/> <result column="book_group_id" property="bookGroupId" jdbcType="BIGINT"/>
<result column="guide" property="guide" jdbcType="VARCHAR"/> <result column="guide" property="guide" jdbcType="VARCHAR"/>
<result column="keyword" property="keyword" jdbcType="VARCHAR"/> <result column="keyword" property="keyword" jdbcType="VARCHAR"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="link_url" property="linkUrl" jdbcType="VARCHAR"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="resource_id" property="resourceId" jdbcType="BIGINT"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/> <result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/> <result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
...@@ -21,8 +13,7 @@ ...@@ -21,8 +13,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, book_group_id, guide, keyword, type, content, description, link_url, pic_url, serve_id, id, book_group_id, guide, keyword, seq_num, create_user, create_time
serve_type, resource_id,seq_num,create_user, create_time
</sql> </sql>
<insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true" <insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeyword" useGeneratedKeys="true"
...@@ -32,14 +23,6 @@ ...@@ -32,14 +23,6 @@
book_group_id, book_group_id,
guide, guide,
keyword, keyword,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num, seq_num,
create_user, create_user,
create_time create_time
...@@ -48,14 +31,6 @@ ...@@ -48,14 +31,6 @@
#{bookGroupId,jdbcType=BIGINT}, #{bookGroupId,jdbcType=BIGINT},
#{guide,jdbcType=VARCHAR}, #{guide,jdbcType=VARCHAR},
#{keyword,jdbcType=VARCHAR}, #{keyword,jdbcType=VARCHAR},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{resourceId,jdbcType=BIGINT},
#{seqNum,jdbcType=INTEGER}, #{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT}, #{createUser,jdbcType=BIGINT},
NOW() NOW()
...@@ -68,14 +43,6 @@ ...@@ -68,14 +43,6 @@
book_group_id, book_group_id,
guide, guide,
keyword, keyword,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num, seq_num,
create_user, create_user,
create_time create_time
...@@ -85,14 +52,6 @@ ...@@ -85,14 +52,6 @@
#{item.bookGroupId,jdbcType=BIGINT}, #{item.bookGroupId,jdbcType=BIGINT},
#{item.guide,jdbcType=VARCHAR}, #{item.guide,jdbcType=VARCHAR},
#{item.keyword,jdbcType=VARCHAR}, #{item.keyword,jdbcType=VARCHAR},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.resourceId,jdbcType=BIGINT},
#{item.seqNum,jdbcType=INTEGER}, #{item.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT}, #{item.createUser,jdbcType=BIGINT},
NOW() NOW()
...@@ -106,14 +65,6 @@ ...@@ -106,14 +65,6 @@
book_group_id = #{bookGroupId,jdbcType=BIGINT}, book_group_id = #{bookGroupId,jdbcType=BIGINT},
guide = #{guide,jdbcType=VARCHAR}, guide = #{guide,jdbcType=VARCHAR},
keyword = #{keyword,jdbcType=VARCHAR}, keyword = #{keyword,jdbcType=VARCHAR},
type = #{type,jdbcType=INTEGER},
content = #{content,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
link_url = #{linkUrl,jdbcType=VARCHAR},
pic_url = #{picUrl,jdbcType=VARCHAR},
serve_id = #{serveId,jdbcType=BIGINT},
serve_type = #{serveType,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=BIGINT},
seq_num = #{seqNum,jdbcType=INTEGER} seq_num = #{seqNum,jdbcType=INTEGER}
</set> </set>
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
...@@ -203,4 +154,10 @@ ...@@ -203,4 +154,10 @@
${item} ${item}
</foreach> </foreach>
</select> </select>
<select id="getById" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword
where id=#{id}
</select>
</mapper> </mapper>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd" >
<mapper namespace="com.pcloud.book.keywords.dao.impl.SelfRobotKeywordReplyDaoImpl">
<resultMap id="BaseResultMap" type="com.pcloud.book.keywords.entity.SelfRobotKeywordReply">
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="keyword_id" property="keywordId" jdbcType="BIGINT"/>
<result column="type" property="type" jdbcType="INTEGER"/>
<result column="content" property="content" jdbcType="VARCHAR"/>
<result column="description" property="description" jdbcType="VARCHAR"/>
<result column="link_url" property="linkUrl" jdbcType="VARCHAR"/>
<result column="pic_url" property="picUrl" jdbcType="VARCHAR"/>
<result column="serve_id" property="serveId" jdbcType="BIGINT"/>
<result column="serve_type" property="serveType" jdbcType="VARCHAR"/>
<result column="resource_id" property="resourceId" jdbcType="BIGINT"/>
<result column="seq_num" property="seqNum" jdbcType="INTEGER"/>
<result column="create_user" property="createUser" jdbcType="BIGINT"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
</resultMap>
<sql id="Base_Column_List">
id, keyword_id, type, content, description, link_url, pic_url, serve_id,
serve_type, resource_id, seq_num, create_user, create_time
</sql>
<insert id="insert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeywordReply" useGeneratedKeys="true"
keyProperty="id">
insert into self_robot_keyword_reply
<trim prefix="(" suffix=")" suffixOverrides=",">
keyword_id,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num,
create_user,
create_time
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{keywordId,jdbcType=BIGINT},
#{type,jdbcType=INTEGER},
#{content,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR},
#{linkUrl,jdbcType=VARCHAR},
#{picUrl,jdbcType=VARCHAR},
#{serveId,jdbcType=BIGINT},
#{serveType,jdbcType=VARCHAR},
#{resourceId,jdbcType=BIGINT},
#{seqNum,jdbcType=INTEGER},
#{createUser,jdbcType=BIGINT},
NOW()
</trim>
</insert>
<!--批量插入-->
<insert id="batchInsert" parameterType="com.pcloud.book.keywords.entity.SelfRobotKeywordReply" useGeneratedKeys="true" keyProperty="id">
insert into self_robot_keyword_reply (
keyword_id,
type,
content,
description,
link_url,
pic_url,
serve_id,
serve_type,
resource_id,
seq_num,
create_user,
create_time
) values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.keywordId,jdbcType=BIGINT},
#{item.type,jdbcType=INTEGER},
#{item.content,jdbcType=VARCHAR},
#{item.description,jdbcType=VARCHAR},
#{item.linkUrl,jdbcType=VARCHAR},
#{item.picUrl,jdbcType=VARCHAR},
#{item.serveId,jdbcType=BIGINT},
#{item.serveType,jdbcType=VARCHAR},
#{item.resourceId,jdbcType=BIGINT},
#{item.seqNum,jdbcType=INTEGER},
#{item.createUser,jdbcType=BIGINT},
NOW()
)
</foreach>
</insert>
<delete id="deleteByKeywordId" parameterType="map">
delete from self_robot_keyword_reply
where keyword_id = #{keywordId}
</delete>
<select id="getListByKeywordId" parameterType="long" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/>
from self_robot_keyword_reply
where keyword_id = #{keywordId}
order by seq_num, id
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment