Commit 534b1a89 by 裴大威

【ID1002254】个人号DEMO临时方案

parent 50ee8a02
......@@ -9,6 +9,7 @@ import com.pcloud.book.group.biz.BookGroupAppBiz;
import com.pcloud.book.group.biz.BookGroupClassifyBiz;
import com.pcloud.book.group.biz.GroupQrcodeBiz;
import com.pcloud.book.group.dao.AppTouchRecordDao;
import com.pcloud.book.group.dao.BookGroupCipherUserDao;
import com.pcloud.book.group.dao.BookGroupClassifyDao;
import com.pcloud.book.group.dao.BookGroupDao;
import com.pcloud.book.group.dao.GroupQrcodeDao;
......@@ -21,6 +22,7 @@ import com.pcloud.book.group.dto.PushAddUserMessageDTO;
import com.pcloud.book.group.dto.SendDefaultGuideMessageDTO;
import com.pcloud.book.group.dto.SendGuideMessageDTO;
import com.pcloud.book.group.entity.AppTouchRecord;
import com.pcloud.book.group.entity.BookGroupCipherUser;
import com.pcloud.book.group.entity.GroupQrcode;
import com.pcloud.book.group.entity.JoinGroupCipher;
import com.pcloud.book.group.enums.CipherTypeEnum;
......@@ -33,6 +35,7 @@ import com.pcloud.book.keywords.biz.BookKeywordBiz;
import com.pcloud.book.keywords.dao.BookGuideDao;
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.KeywordDTO;
import com.pcloud.book.keywords.dto.KeywordStatusDTO;
......@@ -40,6 +43,7 @@ import com.pcloud.book.keywords.dto.ReplyKeywordDTO;
import com.pcloud.book.keywords.entity.BookGuide;
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.vo.GuideVO;
import com.pcloud.book.keywords.vo.ReplyMessageVO;
......@@ -60,6 +64,7 @@ import com.sdk.wxgroup.WxGroupSDK;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
......@@ -110,6 +115,13 @@ public class BookGuideBizImpl implements BookGuideBiz {
private WeixinClockGroupClassifyDao weixinClockGroupClassifyDao;
@Autowired
private BookGroupAppBiz bookGroupAppBiz;
@Autowired
private BookGroupCipherUserDao bookGroupCipherUserDao;
@Autowired
private SelfRobotKeywordDao selfRobotKeywordDao;
@Value("${system.env}")
private String envStr;
@ParamLog("同意加好友发送欢迎语")
@Override
......@@ -121,6 +133,57 @@ public class BookGuideBizImpl implements BookGuideBiz {
String cipher = agreeAddUserDTO.getCipher();
//如果暗号为空,表示直接加好友,需要发送统一欢迎语
if (cipher == null) {
//临时演示用,后面要删掉
BookGroupDTO dto=null;
if (envStr.toUpperCase().equals("TEST")&&agreeAddUserDTO.getRobotWxId().equals("wxid_zus32xb5ukjn22")){
dto = bookGroupDao.getDTOById(1621L);
}
if (envStr.toUpperCase().equals("UAT")&&agreeAddUserDTO.getRobotWxId().equals("wxid_51ff9f099l9a22")){
dto = bookGroupDao.getDTOById(449L);
}
if (envStr.toUpperCase().equals("PRO")&&agreeAddUserDTO.getRobotWxId().equals("wxid_x8i897ryabo722")){
dto = bookGroupDao.getDTOById(23718L);
}
if (dto!=null){
Long bookGroupId=dto.getId();
BookGroupCipherUser bookGroupCipherUser = new BookGroupCipherUser();
bookGroupCipherUser.setBookGroupCipher(dto.getBookGroupCipher());
bookGroupCipherUser.setShortBookName(dto.getShortBookName());
bookGroupCipherUser.setBookGroupId(bookGroupId);
bookGroupCipherUser.setWxUserId(agreeAddUserDTO.getUserWxId());
bookGroupCipherUser.setAltId(agreeAddUserDTO.getRobotWxId());
//新增暗号对应记录
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());
//回复关键词引导语
List<SelfRobotKeyword> selfRobotKeywords = selfRobotKeywordDao.getListByBookGroupId(bookGroupId);
if (!ListUtils.isEmpty(selfRobotKeywords)){
String content="你可以通过以下方式唤醒我,让我知道你的学习需求:\n";
for (SelfRobotKeyword selfRobotKeyword:selfRobotKeywords){
content=content+"●"+selfRobotKeyword.getGuide()+"\n";
}
if (!StringUtil.isEmpty(content)){
SendTextMessageVO vo = new SendTextMessageVO();
vo.setContent(content);
vo.setCode(SendMessageTypeEnum.SELF.getCode());
vo.setWxId(agreeAddUserDTO.getRobotWxId());
vo.setAltId(agreeAddUserDTO.getRobotWxId());
vo.setWxGroupId(agreeAddUserDTO.getUserWxId());
vo.setIp(agreeAddUserDTO.getIp());
WxGroupSDK.sendTextMessage(vo);
log.info("临时demo发送个人号加好友信息"+vo.toString());
}
}
return;
}
SendTextMessageVO vo = new SendTextMessageVO();
vo.setContent("终于和您见面了!\n请告诉我您在读哪本书?\n如果您在上一步中复制了暗号,\n您可以把暗号粘贴在下方对话框内,以微信聊天的形式发给我。" +
"\n如果在上一步中,没有提示您复制暗号,\n您可以在【书中二维码旁】找到本书的简称及年份,\n在下方对话框内输入本书简称及年份,以微信聊天的形式发给我。");
......
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