Commit 75c1bfb7 by 曾迫

qq机器人发送欢迎语

parent 1afa0d1c
...@@ -30,6 +30,11 @@ ...@@ -30,6 +30,11 @@
<!--内部调用依赖--> <!--内部调用依赖-->
<dependency> <dependency>
<groupId>com.dcg</groupId>
<artifactId>CoolQSDK</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.pcloud.common</groupId> <groupId>com.pcloud.common</groupId>
<artifactId>pcloud-common</artifactId> <artifactId>pcloud-common</artifactId>
<version>${pcloud-common.version}</version> <version>${pcloud-common.version}</version>
......
package com.pcloud.book.consumer.wechatgroup; package com.pcloud.book.consumer.wechatgroup;
import com.dcg.coolq.sdk.CoolQSDK;
import com.dcg.coolq.sdk.message.vos.send.PrivateMsgSendVO;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.common.core.aspect.ParamLog; import com.pcloud.common.core.aspect.ParamLog;
...@@ -70,6 +72,14 @@ public class WechatGroupConsr { ...@@ -70,6 +72,14 @@ public class WechatGroupConsr {
throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "服务内部错误,请稍后重试"); throw new BookBizException(BookBizException.INVOKE_RES_ERROR, "服务内部错误,请稍后重试");
} }
} }
@ParamLog("qq机器人发送消息")
public void sendMessage4QQ(PrivateMsgSendVO privateMsgSendVO) {
try {
CoolQSDK.sendPrivateMsg(privateMsgSendVO);
} catch (Exception e) {
log.error("qq机器人给用户发送消息失败.[sendMessage]:" + e.getMessage(), e);
}
}
@ParamLog("是否群机器人") @ParamLog("是否群机器人")
public Boolean isGroupRobot(String robotWxId) { public Boolean isGroupRobot(String robotWxId) {
......
...@@ -56,7 +56,9 @@ import com.pcloud.book.keywords.vo.SetGuideVO; ...@@ -56,7 +56,9 @@ import com.pcloud.book.keywords.vo.SetGuideVO;
import com.pcloud.book.keywords.vo.UpdateGuideVO; import com.pcloud.book.keywords.vo.UpdateGuideVO;
import com.pcloud.book.pcloudkeyword.biz.PcloudRobotBiz; import com.pcloud.book.pcloudkeyword.biz.PcloudRobotBiz;
import com.pcloud.book.pcloudkeyword.dao.PcloudRobotDao; import com.pcloud.book.pcloudkeyword.dao.PcloudRobotDao;
import com.pcloud.book.pcloudkeyword.dao.PcloudRobotWelcomeDao;
import com.pcloud.book.pcloudkeyword.entity.PcloudRobot; import com.pcloud.book.pcloudkeyword.entity.PcloudRobot;
import com.pcloud.book.pcloudkeyword.entity.PcloudRobotWelcome;
import com.pcloud.book.personalstage.biz.PersonalStageBiz; import com.pcloud.book.personalstage.biz.PersonalStageBiz;
import com.pcloud.book.personalstage.biz.PersonalStageJumpBiz; import com.pcloud.book.personalstage.biz.PersonalStageJumpBiz;
import com.pcloud.book.personalstage.constant.PersonalStageConstant; import com.pcloud.book.personalstage.constant.PersonalStageConstant;
...@@ -150,6 +152,11 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -150,6 +152,11 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Autowired @Autowired
private PersonalStageBiz personalStageBiz; private PersonalStageBiz personalStageBiz;
@Autowired
private PcloudRobotWelcomeDao pcloudRobotWelcomeDao;
@Value("${wechat.group.link.prefix}") @Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix; private String wechatGroupLinkPrefix;
@Autowired @Autowired
...@@ -160,7 +167,8 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -160,7 +167,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
@ParamLog("同意加好友发送欢迎语") @ParamLog("同意加好友发送欢迎语")
@Override @Override
public void sendGuide(AgreeAddUserDTO agreeAddUserDTO) { public void sendGuide(AgreeAddUserDTO agreeAddUserDTO) {
if(null == agreeAddUserDTO || StringUtil.isBlank(agreeAddUserDTO.getRobotWxId()) || StringUtil.isBlank(agreeAddUserDTO.getUserWxId())) { if(agreeAddUserDTO.getRobotType()==null||agreeAddUserDTO.getRobotType()==1) {
if (null == agreeAddUserDTO || StringUtil.isBlank(agreeAddUserDTO.getRobotWxId()) || StringUtil.isBlank(agreeAddUserDTO.getUserWxId())) {
log.info("[同意加好友发送欢迎语] 参数为空 agreeAddUserDTO:{}", agreeAddUserDTO); log.info("[同意加好友发送欢迎语] 参数为空 agreeAddUserDTO:{}", agreeAddUserDTO);
return; return;
} }
...@@ -170,14 +178,14 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -170,14 +178,14 @@ public class BookGuideBizImpl implements BookGuideBiz {
//发送配置欢迎语 create by lihao 2020.2.7 //发送配置欢迎语 create by lihao 2020.2.7
//判断是否是平台端小号 //判断是否是平台端小号
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(agreeAddUserDTO.getRobotWxId()); PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(agreeAddUserDTO.getRobotWxId());
if (pcloudRobot!=null){ if (pcloudRobot != null) {
//删除需求单记录 //删除需求单记录
personalStageJumpBiz.deletePaperRecord(agreeAddUserDTO.getRobotWxId(),agreeAddUserDTO.getUserWxId()); personalStageJumpBiz.deletePaperRecord(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId());
pcloudRobotBiz.sendWelcomeReply(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp()); pcloudRobotBiz.sendWelcomeReply(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
//好友引导语 //好友引导语
sendFriendGuide(null, agreeAddUserDTO); sendFriendGuide(null, agreeAddUserDTO);
if (personalStageBiz.isPersonalStageUser(agreeAddUserDTO.getRobotWxId())){ if (personalStageBiz.isPersonalStageUser(agreeAddUserDTO.getRobotWxId())) {
personalStageBiz.createAddUserStageUser(agreeAddUserDTO.getRobotWxId(),agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp()); personalStageBiz.createAddUserStageUser(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
} }
return; return;
} }
...@@ -239,7 +247,7 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -239,7 +247,7 @@ public class BookGuideBizImpl implements BookGuideBiz {
// 根据暗号获取分类id和bookGroupId推送关键词欢迎语 // 根据暗号获取分类id和bookGroupId推送关键词欢迎语
List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(dto.getClassifyId(), dto.getBookGroupId()); List<KeywordDTO> keywords = bookKeywordBiz.listFiveKeyword(dto.getClassifyId(), dto.getBookGroupId());
//发主打资源 //发主打资源
sendMainKeyword(keywords,agreeAddUserDTO,dto,wxGroupId); sendMainKeyword(keywords, agreeAddUserDTO, dto, wxGroupId);
//发关键词列表 //发关键词列表
sendWeixinRequestTools.sendKeywordsInfoToSelf(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp()); sendWeixinRequestTools.sendKeywordsInfoToSelf(keywords, agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
// 拉群 // 拉群
...@@ -281,6 +289,27 @@ public class BookGuideBizImpl implements BookGuideBiz { ...@@ -281,6 +289,27 @@ public class BookGuideBizImpl implements BookGuideBiz {
} else { } else {
JedisClusterUtils.incr(BookConstant.WXGROUP_ADD_USER_NUM + agreeAddUserDTO.getRobotWxId()); JedisClusterUtils.incr(BookConstant.WXGROUP_ADD_USER_NUM + agreeAddUserDTO.getRobotWxId());
} }
}else{
//qq同意加好友 并发送欢迎语
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(agreeAddUserDTO.getRobotWxId());
if (pcloudRobot!=null){
//删除需求单记录
//TODO
List<PcloudRobotWelcome> robotWelcomeListByPcloudClassifyId = pcloudRobotWelcomeDao.getRobotWelcomeListByPcloudClassifyId(Long.valueOf(pcloudRobot.getRobotType()), agreeAddUserDTO.getRobotType());
pcloudRobotBiz.sendQQWelcomeReply(agreeAddUserDTO.getReceiverId(),agreeAddUserDTO.getUserId(),robotWelcomeListByPcloudClassifyId);
//TODO 阶段处理
/*if (personalStageBiz.isPersonalStageUser(agreeAddUserDTO.getRobotWxId())){
Long personalStageId = personalStageBiz.createAddUserStageUser(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
//清空缓存中该阶段的非关键词数量
//刪除发送非关键词次数緩存
JedisClusterUtils.del(PersonalStageConstant.USER_SEND_KEYWORD_COUNT_LOCK + personalStageId + "_" + agreeAddUserDTO.getUserWxId());
//删除进度单点击记录缓存
JedisClusterUtils.del("BOOK:LINK_PROGRESS:"+ agreeAddUserDTO.getUserWxId() + "-" +agreeAddUserDTO.getRobotWxId());
}*/
return;
}
}
} }
@ParamLog("重置体验同意加好友发送欢迎语") @ParamLog("重置体验同意加好友发送欢迎语")
......
...@@ -109,4 +109,6 @@ public interface PcloudRobotBiz { ...@@ -109,4 +109,6 @@ public interface PcloudRobotBiz {
List<String> getPcloudRobotByRobotType(Integer classifyId,Integer groupRobotType); List<String> getPcloudRobotByRobotType(Integer classifyId,Integer groupRobotType);
void handleMiniAppQr(); void handleMiniAppQr();
void sendQQWelcomeReply(Long receiverId, Long userId, List<PcloudRobotWelcome> robotWelcomeListByPcloudClassifyId);
} }
...@@ -35,7 +35,7 @@ public interface PcloudRobotClassifyBiz { ...@@ -35,7 +35,7 @@ public interface PcloudRobotClassifyBiz {
*/ */
PageBeanNew<PcloudRobotClassifyResponseVO> listClassifyByPage(Integer currentPage, Integer numPerPage); PageBeanNew<PcloudRobotClassifyResponseVO> listClassifyByPage(Integer currentPage, Integer numPerPage);
ClassifyWelcomeDTO getClassifyWelcome(Long classifyId); ClassifyWelcomeDTO getClassifyWelcome(Long classifyId,Integer robotType);
void updateClassifyWelcome(ClassifyWelcomeDTO classifyWelcomeDTO); void updateClassifyWelcome(ClassifyWelcomeDTO classifyWelcomeDTO);
......
package com.pcloud.book.pcloudkeyword.biz.impl; package com.pcloud.book.pcloudkeyword.biz.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.dcg.coolq.sdk.message.MessageBuilder;
import com.dcg.coolq.sdk.message.components.ComponentImage;
import com.dcg.coolq.sdk.message.components.ComponentRecord;
import com.dcg.coolq.sdk.message.components.ComponentText;
import com.dcg.coolq.sdk.message.vos.send.PrivateMsgSendVO;
import com.pcloud.appcenter.app.dto.AppDto; import com.pcloud.appcenter.app.dto.AppDto;
import com.pcloud.book.base.exception.BookBizException; import com.pcloud.book.base.exception.BookBizException;
import com.pcloud.book.book.dao.BookDao; import com.pcloud.book.book.dao.BookDao;
...@@ -44,6 +49,7 @@ import com.pcloud.book.pcloudkeyword.set.PcloudRobotSet; ...@@ -44,6 +49,7 @@ import com.pcloud.book.pcloudkeyword.set.PcloudRobotSet;
import com.pcloud.book.push.biz.SelfPushBiz; import com.pcloud.book.push.biz.SelfPushBiz;
import com.pcloud.book.push.dao.PersonalAppletsDao; import com.pcloud.book.push.dao.PersonalAppletsDao;
import com.pcloud.book.push.entity.PersonalApplets; import com.pcloud.book.push.entity.PersonalApplets;
import com.pcloud.book.push.enums.ItemTypeEnum;
import com.pcloud.book.skill.biz.PcloudSkillBiz; import com.pcloud.book.skill.biz.PcloudSkillBiz;
import com.pcloud.book.skill.entity.PcloudSkill; import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.book.util.common.ThreadPoolUtils; import com.pcloud.book.util.common.ThreadPoolUtils;
...@@ -302,14 +308,16 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz { ...@@ -302,14 +308,16 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
map.put("robotWxId", robotWxId); map.put("robotWxId", robotWxId);
PcloudRobot pcloudRobot = (PcloudRobot)pcloudRobotDao.getBy(map, "getByRobotWxId"); PcloudRobot pcloudRobot = (PcloudRobot)pcloudRobotDao.getBy(map, "getByRobotWxId");
PcloudRobotClassify robotClassify=new PcloudRobotClassify(); PcloudRobotClassify robotClassify=new PcloudRobotClassify();
Integer isOpenH5=0;
if(pcloudRobot != null) { if(pcloudRobot != null) {
if (pcloudRobot.getRobotType() != null) { if (pcloudRobot.getRobotType() != null) {
Integer welcomeDuration = 3; Integer welcomeDuration = 3;
robotClassify = pcloudRobotClassifyBiz.getClassifyById(pcloudRobot.getRobotType().longValue()); robotClassify = pcloudRobotClassifyBiz.getClassifyById(pcloudRobot.getRobotType().longValue());
if (robotClassify != null && robotClassify.getWelcomeDuration() != null) { List<PcloudRobotWelcome> robotWelcomeList = pcloudRobotWelcomeDao.getRobotWelcomeListByPcloudClassifyId(pcloudRobot.getRobotType().longValue(),1);
welcomeDuration = robotClassify.getWelcomeDuration(); if(robotWelcomeList!=null&&robotWelcomeList.size()>0){
welcomeDuration=robotWelcomeList.get(0).getWelcomeDuration();
isOpenH5=robotWelcomeList.get(0).getIsOpenPushH5url();
} }
List<PcloudRobotWelcome> robotWelcomeList = pcloudRobotWelcomeDao.getRobotWelcomeListByPcloudClassifyId(pcloudRobot.getRobotType().longValue());
pcloudRobotSet.fillRobotWelcome(robotWelcomeList); pcloudRobotSet.fillRobotWelcome(robotWelcomeList);
Integer count= robotWelcomeList.size(); Integer count= robotWelcomeList.size();
String messageGroup = UUID.randomUUID().toString(); String messageGroup = UUID.randomUUID().toString();
...@@ -414,7 +422,7 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz { ...@@ -414,7 +422,7 @@ public class PcloudRobotBizImpl implements PcloudRobotBiz {
index ++; index ++;
} }
} }
if (robotClassify != null && robotClassify.getIsOpenPushH5url() != null && robotClassify.getIsOpenPushH5url() == 1) { if (isOpenH5== 1) {
//发送H5链接 //发送H5链接
String endUrl = wechatLinkPrefix + "/dialog" + "?book_group_id=" + 0 + "&wxId=" + userWxId + "&robotWxId=" + robotWxId; String endUrl = wechatLinkPrefix + "/dialog" + "?book_group_id=" + 0 + "&wxId=" + userWxId + "&robotWxId=" + robotWxId;
String resultUrl = UrlUtils.getShortUrl4Own(endUrl); String resultUrl = UrlUtils.getShortUrl4Own(endUrl);
...@@ -916,4 +924,48 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO)); ...@@ -916,4 +924,48 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO));
}); });
} }
} }
@Override
public void sendQQWelcomeReply(Long receiverId, Long userId, List<PcloudRobotWelcome> robotWelcomeListByPcloudClassifyId) {
if (StringUtil.isEmpty(userId.toString()) || StringUtil.isEmpty(receiverId.toString())){
return;
}
if(getUserTdState(receiverId.toString(), userId.toString()) == 1) {
return;
}
for (PcloudRobotWelcome pcloudRobotWelcome:robotWelcomeListByPcloudClassifyId) {
PrivateMsgSendVO privateMsgSendVO = new PrivateMsgSendVO();
privateMsgSendVO.setSenderQQCode(Long.valueOf(receiverId));
privateMsgSendVO.setReceiverQQCode(Long.valueOf(userId));
if (WelcomeReplyTypeEnum.TEXT.value.equals(pcloudRobotWelcome.getReplyType())) {
// 构造一个文本消息
String message = new MessageBuilder().add(new ComponentText(pcloudRobotWelcome.getContent())).toString();// 文本消息
privateMsgSendVO.setMessage(message);
wechatGroupConsr.sendMessage4QQ(privateMsgSendVO);
return;
}
if (WelcomeReplyTypeEnum.IMAGE.value.equals(pcloudRobotWelcome.getReplyType())) {
// 构造一个图片消息
String message = new MessageBuilder().add(new ComponentImage(pcloudRobotWelcome.getPicUrl())) .toString(); // 图片消息
privateMsgSendVO.setMessage(message);
wechatGroupConsr.sendMessage4QQ(privateMsgSendVO);
return;
}
if (WelcomeReplyTypeEnum.AUDIO.value.equals(pcloudRobotWelcome.getReplyType())) {
// 构造一个图片消息
String message = new MessageBuilder().add(new ComponentRecord(pcloudRobotWelcome.getResourceUrl(),false)).toString(); // 音频消息
privateMsgSendVO.setMessage(message);
wechatGroupConsr.sendMessage4QQ(privateMsgSendVO);
return;
}
if (WelcomeReplyTypeEnum.RESOURCE.value.equals(pcloudRobotWelcome.getReplyType())) {
// 构造一个图片消息
String message = new MessageBuilder().add(new ComponentRecord(pcloudRobotWelcome.getResourceId().toString(),false)).toString(); // 资源文件消息
privateMsgSendVO.setMessage(message);
wechatGroupConsr.sendMessage4QQ(privateMsgSendVO);
return;
}
}
}
} }
...@@ -124,12 +124,13 @@ public class PcloudRobotClassifyBizImpl implements PcloudRobotClassifyBiz { ...@@ -124,12 +124,13 @@ public class PcloudRobotClassifyBizImpl implements PcloudRobotClassifyBiz {
} }
@Override @Override
public ClassifyWelcomeDTO getClassifyWelcome(Long classifyId) { public ClassifyWelcomeDTO getClassifyWelcome(Long classifyId,Integer robotType) {
ClassifyWelcomeDTO classifyWelcomeDTO = new ClassifyWelcomeDTO(); ClassifyWelcomeDTO classifyWelcomeDTO = new ClassifyWelcomeDTO();
PcloudRobotClassify robotClassify = pcloudRobotClassifyDao.getById(classifyId); List<PcloudRobotWelcome> pcloudRobotWelcomeList = pcloudRobotWelcomeDao.getRobotWelcomeListByPcloudClassifyId(classifyId,robotType);
classifyWelcomeDTO.setIsOpenPushH5url(robotClassify.getIsOpenPushH5url()); if(pcloudRobotWelcomeList!=null&&pcloudRobotWelcomeList.size()>0){
classifyWelcomeDTO.setWelcomeDuration(robotClassify.getWelcomeDuration()); classifyWelcomeDTO.setIsOpenPushH5url(pcloudRobotWelcomeList.get(0).getIsOpenPushH5url());
List<PcloudRobotWelcome> pcloudRobotWelcomeList = pcloudRobotWelcomeDao.getRobotWelcomeListByPcloudClassifyId(classifyId); classifyWelcomeDTO.setWelcomeDuration(pcloudRobotWelcomeList.get(0).getWelcomeDuration());
}
pcloudRobotSet.fillRobotWelcome(pcloudRobotWelcomeList); pcloudRobotSet.fillRobotWelcome(pcloudRobotWelcomeList);
classifyWelcomeDTO.setPcloudRobotWelcomeList(pcloudRobotWelcomeList); classifyWelcomeDTO.setPcloudRobotWelcomeList(pcloudRobotWelcomeList);
return classifyWelcomeDTO; return classifyWelcomeDTO;
...@@ -137,12 +138,15 @@ public class PcloudRobotClassifyBizImpl implements PcloudRobotClassifyBiz { ...@@ -137,12 +138,15 @@ public class PcloudRobotClassifyBizImpl implements PcloudRobotClassifyBiz {
@Override @Override
public void updateClassifyWelcome(ClassifyWelcomeDTO classifyWelcomeDTO) { public void updateClassifyWelcome(ClassifyWelcomeDTO classifyWelcomeDTO) {
pcloudRobotClassifyDao.updateWelcomeDuration(classifyWelcomeDTO.getPcloudClassifyId(), classifyWelcomeDTO.getWelcomeDuration(),classifyWelcomeDTO.getIsOpenPushH5url()); // pcloudRobotClassifyDao.updateWelcomeDuration(classifyWelcomeDTO.getPcloudClassifyId(), classifyWelcomeDTO.getWelcomeDuration(),classifyWelcomeDTO.getIsOpenPushH5url());
List<PcloudRobotWelcome> robotWelcomeList = classifyWelcomeDTO.getPcloudRobotWelcomeList(); List<PcloudRobotWelcome> robotWelcomeList = classifyWelcomeDTO.getPcloudRobotWelcomeList();
pcloudRobotWelcomeDao.deleteByPcloudClassifyId(classifyWelcomeDTO.getPcloudClassifyId()); pcloudRobotWelcomeDao.deleteByPcloudClassifyId(classifyWelcomeDTO.getPcloudClassifyId(),classifyWelcomeDTO.getRobotType());
if (ListUtils.isEmpty(robotWelcomeList)) { if (ListUtils.isEmpty(robotWelcomeList)) {
return; return;
} }
for (PcloudRobotWelcome robotWelcome:robotWelcomeList) {
robotWelcome.setRobotType(classifyWelcomeDTO.getRobotType());
}
pcloudRobotWelcomeDao.batchInsert(robotWelcomeList); pcloudRobotWelcomeDao.batchInsert(robotWelcomeList);
} }
......
...@@ -13,7 +13,7 @@ public interface PcloudRobotWelcomeDao extends BaseDao<PcloudRobotWelcome> { ...@@ -13,7 +13,7 @@ public interface PcloudRobotWelcomeDao extends BaseDao<PcloudRobotWelcome> {
void batchInsert(List<PcloudRobotWelcome> robotWelcomeList); void batchInsert(List<PcloudRobotWelcome> robotWelcomeList);
List<PcloudRobotWelcome> getRobotWelcomeListByPcloudClassifyId(Long pcloudClassifyId); List<PcloudRobotWelcome> getRobotWelcomeListByPcloudClassifyId(Long pcloudClassifyId,Integer robotType);
void deleteByPcloudClassifyId(Long pcloudClassifyId); void deleteByPcloudClassifyId(Long pcloudClassifyId,Integer robotType);
} }
...@@ -5,7 +5,9 @@ import com.pcloud.book.pcloudkeyword.entity.PcloudRobotWelcome; ...@@ -5,7 +5,9 @@ import com.pcloud.book.pcloudkeyword.entity.PcloudRobotWelcome;
import com.pcloud.common.core.dao.BaseDaoImpl; import com.pcloud.common.core.dao.BaseDaoImpl;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
@Component("pcloudRobotWelcomeDao") @Component("pcloudRobotWelcomeDao")
public class PcloudRobotWelcomeDaoImpl extends BaseDaoImpl<PcloudRobotWelcome> implements PcloudRobotWelcomeDao { public class PcloudRobotWelcomeDaoImpl extends BaseDaoImpl<PcloudRobotWelcome> implements PcloudRobotWelcomeDao {
...@@ -26,13 +28,19 @@ public class PcloudRobotWelcomeDaoImpl extends BaseDaoImpl<PcloudRobotWelcome> i ...@@ -26,13 +28,19 @@ public class PcloudRobotWelcomeDaoImpl extends BaseDaoImpl<PcloudRobotWelcome> i
} }
@Override @Override
public List<PcloudRobotWelcome> getRobotWelcomeListByPcloudClassifyId(Long pcloudClassifyId) { public List<PcloudRobotWelcome> getRobotWelcomeListByPcloudClassifyId(Long pcloudClassifyId,Integer robotType) {
return super.getSqlSession().selectList(getStatement("getRobotWelcomeListByPcloudClassifyId"), pcloudClassifyId); Map<String,Object> map=new HashMap<>();
map.put("pcloudClassifyId",pcloudClassifyId);
map.put("robotType",robotType);
return super.getSqlSession().selectList(getStatement("getRobotWelcomeListByPcloudClassifyId"), map);
} }
@Override @Override
public void deleteByPcloudClassifyId(Long pcloudClassifyId) { public void deleteByPcloudClassifyId(Long pcloudClassifyId,Integer robotType) {
super.getSqlSession().delete(getStatement("deleteByPcloudClassifyId"), pcloudClassifyId); Map<String,Object> map=new HashMap<>();
map.put("pcloudClassifyId",pcloudClassifyId);
map.put("robotType",robotType);
super.getSqlSession().delete(getStatement("deleteByPcloudClassifyId"), map);
} }
} }
...@@ -21,4 +21,7 @@ public class ClassifyWelcomeDTO extends BaseDTO { ...@@ -21,4 +21,7 @@ public class ClassifyWelcomeDTO extends BaseDTO {
private List<PcloudRobotWelcome> pcloudRobotWelcomeList; private List<PcloudRobotWelcome> pcloudRobotWelcomeList;
@ApiModelProperty("机器人分类 1微信机器人 2qq机器人")
private Integer robotType;
} }
...@@ -70,6 +70,14 @@ public class PcloudRobotWelcome extends BaseEntity { ...@@ -70,6 +70,14 @@ public class PcloudRobotWelcome extends BaseEntity {
@ApiModelProperty("小程序宣传图片") @ApiModelProperty("小程序宣传图片")
private String sloganImgUrl; private String sloganImgUrl;
@ApiModelProperty("机器人分类 1微信机器人 2qq机器人")
private Integer robotType;
@ApiModelProperty("欢迎语间隔时长")
private Integer welcomeDuration;
@ApiModelProperty("是否开启h5页面链接推送")
private Integer isOpenPushH5url;
......
...@@ -64,9 +64,9 @@ public class PcloudRobotClassifyFacade { ...@@ -64,9 +64,9 @@ public class PcloudRobotClassifyFacade {
@GetMapping("getClassifyWelcome") @GetMapping("getClassifyWelcome")
public ResponseDto<?> getClassifyWelcome( public ResponseDto<?> getClassifyWelcome(
@RequestHeader("token") @ApiParam("token信息") String token, @RequestHeader("token") @ApiParam("token信息") String token,
@RequestParam("classifyId") @ApiParam("分类ID") Long classifyId) throws BizException, PermissionException { @RequestParam("classifyId") @ApiParam("分类ID") Long classifyId,@RequestParam("robotType") @ApiParam("分类ID") Integer robotType) throws BizException, PermissionException {
SessionUtil.getVlaue(token, SessionUtil.PARTY_ID); SessionUtil.getVlaue(token, SessionUtil.PARTY_ID);
return new ResponseDto<>(pcloudRobotClassifyBiz.getClassifyWelcome(classifyId)); return new ResponseDto<>(pcloudRobotClassifyBiz.getClassifyWelcome(classifyId,robotType));
} }
@PostMapping("updateClassifyWelcome") @PostMapping("updateClassifyWelcome")
......
...@@ -15,11 +15,14 @@ ...@@ -15,11 +15,14 @@
<result column="resource_id" property="resourceId" jdbcType="INTEGER"/> <result column="resource_id" property="resourceId" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/> <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="personal_applets_id" property="personalAppletsId" jdbcType="BIGINT"/> <result column="personal_applets_id" property="personalAppletsId" jdbcType="BIGINT"/>
<result column="robot_type" property="robotType" jdbcType="INTEGER"/>
<result column="welcome_duration" property="welcomeDuration" jdbcType="INTEGER"/>
<result column="is_open_push_h5url" property="isOpenPushH5url" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<sql id="Base_Column_List" > <sql id="Base_Column_List" >
id, pcloud_robot_id, pcloud_classify_id, reply_type, content, pic_url, file_name, file_type, file_url, id, pcloud_robot_id, pcloud_classify_id, reply_type, content, pic_url, file_name, file_type, file_url,
file_size, resource_id, create_time,personal_applets_id file_size, resource_id, create_time,personal_applets_id,robot_type,welcome_duration,is_open_push_h5url
</sql> </sql>
<!--批量插入--> <!--批量插入-->
...@@ -36,7 +39,10 @@ ...@@ -36,7 +39,10 @@
file_size, file_size,
resource_id, resource_id,
create_time, create_time,
personal_applets_id personal_applets_id,
robot_type,
welcome_duration,
is_open_push_h5url
) values ) values
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
...@@ -51,7 +57,10 @@ ...@@ -51,7 +57,10 @@
#{item.fileSize,jdbcType=BIGINT}, #{item.fileSize,jdbcType=BIGINT},
#{item.resourceId,jdbcType=BIGINT}, #{item.resourceId,jdbcType=BIGINT},
NOW(), NOW(),
#{item.personalAppletsId,jdbcType=BIGINT} #{item.personalAppletsId,jdbcType=BIGINT},
#{item.robotType,jdbcType=INTEGER},
#{item.welcomeDuration,jdbcType=INTEGER},
#{item.isOpenPushH5url,jdbcType=INTEGER}
) )
</foreach> </foreach>
</insert> </insert>
...@@ -61,9 +70,9 @@ ...@@ -61,9 +70,9 @@
where pcloud_robot_id = #{pcloudRobotId} where pcloud_robot_id = #{pcloudRobotId}
</delete> </delete>
<delete id="deleteByPcloudClassifyId" parameterType="long"> <delete id="deleteByPcloudClassifyId" parameterType="map">
delete from pcloud_robot_welcome delete from pcloud_robot_welcome
where pcloud_classify_id = #{pcloudClassifyId} where pcloud_classify_id = #{pcloudClassifyId} and robot_type=#{robotType}
</delete> </delete>
<select id="getRobotWelcomeListByPcloudRobotId" parameterType="long" resultMap="BaseResultMap"> <select id="getRobotWelcomeListByPcloudRobotId" parameterType="long" resultMap="BaseResultMap">
...@@ -72,9 +81,9 @@ ...@@ -72,9 +81,9 @@
where pcloud_robot_id = #{pcloudRobotId} where pcloud_robot_id = #{pcloudRobotId}
</select> </select>
<select id="getRobotWelcomeListByPcloudClassifyId" parameterType="long" resultMap="BaseResultMap"> <select id="getRobotWelcomeListByPcloudClassifyId" parameterType="map" resultMap="BaseResultMap">
select <include refid="Base_Column_List"/> select <include refid="Base_Column_List"/>
from pcloud_robot_welcome from pcloud_robot_welcome
where pcloud_classify_id = #{pcloudClassifyId} where pcloud_classify_id = #{pcloudClassifyId} and robot_type=#{robotType}
</select> </select>
</mapper> </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