Commit 5b7f0a8e by 裴大威

Merge branch 'feat-1002537' into 'master'

1002537

See merge request rays/pcloud-book!526
parents c50cb1a1 096b3b15
......@@ -88,4 +88,14 @@ public class FeedbackConsr {
}
@ParamLog("删除用户答卷记录")
public void deleteUserAnswerRecord(List<Long> paperIds, String userWxId) {
try {
paperService.deleteUserAnswerRecord(paperIds, userWxId);
}catch (Exception e){
LOGGER.error("deleteUserAnswerRecord调用失败"+e.getMessage(),e);
}
}
}
......@@ -57,6 +57,7 @@ import com.pcloud.book.pcloudkeyword.biz.PcloudRobotBiz;
import com.pcloud.book.pcloudkeyword.dao.PcloudRobotDao;
import com.pcloud.book.pcloudkeyword.entity.PcloudRobot;
import com.pcloud.book.personalstage.biz.PersonalStageBiz;
import com.pcloud.book.personalstage.biz.PersonalStageJumpBiz;
import com.pcloud.book.personalstage.constant.PersonalStageConstant;
import com.pcloud.book.weixinclock.dao.WeixinClockGroupClassifyDao;
import com.pcloud.book.weixinclock.dto.WeixinClockDto;
......@@ -148,6 +149,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
@Value("${wechat.group.link.prefix}")
private String wechatGroupLinkPrefix;
@Autowired
private PersonalStageJumpBiz personalStageJumpBiz;
@ParamLog("同意加好友发送欢迎语")
@Override
......@@ -163,6 +166,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
//判断是否是平台端小号
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(agreeAddUserDTO.getRobotWxId());
if (pcloudRobot!=null){
//删除需求单记录
personalStageJumpBiz.deletePaperRecord(agreeAddUserDTO.getRobotWxId(),agreeAddUserDTO.getUserWxId());
pcloudRobotBiz.sendWelcomeReply(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
//好友引导语
sendFriendGuide(null, agreeAddUserDTO);
......@@ -279,6 +284,8 @@ public class BookGuideBizImpl implements BookGuideBiz {
//判断是否是平台端小号
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(agreeAddUserDTO.getRobotWxId());
if (pcloudRobot!=null){
//删除需求单记录
personalStageJumpBiz.deletePaperRecord(agreeAddUserDTO.getRobotWxId(),agreeAddUserDTO.getUserWxId());
pcloudRobotBiz.sendWelcomeReply(agreeAddUserDTO.getRobotWxId(), agreeAddUserDTO.getUserWxId(), agreeAddUserDTO.getIp());
//好友引导语
sendFriendGuide(null, agreeAddUserDTO);
......
......@@ -40,6 +40,15 @@ public interface PersonalStageJumpBiz {
*/
Boolean handlePersonalStageJump(String userWxId, String robotWxId, String content, JumpTypeEnum jumpTypeEnum);
/**
* 跳转到之前的阶段,清除用户填写需求单记录
* @param personalStageId
* @param afterPersonalStageId
* @param userWxId
* @param robotId
*/
public void dealPaperRecord(Long personalStageId, Long afterPersonalStageId, String userWxId, String robotId);
void dealDelayLinkup(DelayQueueDTO dto);
/**
......@@ -96,4 +105,12 @@ public interface PersonalStageJumpBiz {
Boolean getHasEndServiceJump(Long personalStageId);
void endServiceJumpNext(EndServiceJumpNextDTO endServiceJumpNextDTO);
/**
* 删除用户的需求单记录
* @param robotId
* @param userWxId
*/
public void deletePaperRecord(String robotId, String userWxId);
}
......@@ -443,6 +443,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
}
GroupRobotDTO groupRobotDTO = wechatGroupConsr.getGroupRobotByWxId(robotWxId);
String ip = weixinQrcodeBiz.getRobotIpByGeneration(groupRobotDTO.getVersion());
//处理需求单记录
dealPaperRecord(currentStageUser.getPersonalStageId(),jumpKeywordDto.getAfterPersonalStageId(), userWxId, robotWxId);
// 发送邮件
sendEmail(userWxId, robotWxId, content, jumpKeywordDto);
// 将用户置为下个阶段
......@@ -454,6 +456,30 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
return true;
}
@ParamLog("跳转到之前的阶段,清除用户填写需求单记录")
public void dealPaperRecord(Long personalStageId, Long afterPersonalStageId, String userWxId, String robotId){
PersonalStage personalStage = personalStageDao.getById(personalStageId);
PersonalStage afterPersonalStage = personalStageDao.getById(afterPersonalStageId);
if (null == personalStage || null == afterPersonalStage){
return;
}
Boolean jumpBefore = false;
if (null != personalStage.getSeqNum() && null!= afterPersonalStage.getSeqNum()){
//当前阶段比下一阶段序号大
if (personalStage.getSeqNum()>afterPersonalStage.getSeqNum()){
jumpBefore = true;
}else if (personalStage.getSeqNum().equals(afterPersonalStage.getSeqNum())){
//序号相同,当前阶段id比下一阶段大
if (personalStageId.compareTo(afterPersonalStageId)>0){
jumpBefore = true;
}
}
}
if (jumpBefore){
this.deletePaperRecord(robotId, userWxId);
}
}
@ParamLog("处理衔接语跳转延时")
@Override
public void dealDelayLinkup(DelayQueueDTO dto) {
......@@ -543,6 +569,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
jumpKeywordDto.setAfterPersonalStageId(paperJump.getAfterPersonalStageId());
jumpKeywordDto.setPersonalStageJumpId(paperJump.getId());
sendEmail(userWxId, robotWxId, content, jumpKeywordDto);
//处理需求单记录
dealPaperRecord(stageId,paperJump.getAfterPersonalStageId(),userWxId, robotWxId);
// 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotWxId, userWxId, ip, paperJump.getAfterPersonalStageId());
// 发送内容衔接语
......@@ -651,6 +679,8 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
}
GroupRobotDTO groupRobotDTO = wechatGroupConsr.getGroupRobotByWxId(robotId);
String ip = weixinQrcodeBiz.getRobotIpByGeneration(groupRobotDTO.getVersion());
//处理需求单记录
dealPaperRecord(personalStageId,afterStageId,wxId, robotId);
// 将用户置为下个阶段
PersonalStageUser nextPersonalStageUser = personalStageBiz.nextStageAddStageUserAndWakeupDelay(robotId, wxId, ip, afterStageId);
// 发送内容衔接语
......@@ -987,4 +1017,21 @@ public class PersonalStageJumpBizImpl implements PersonalStageJumpBiz {
}
return map;
}
@Override
@ParamLog("删除用户的需求单记录")
public void deletePaperRecord(String robotId, String userWxId){
PcloudRobot pcloudRobot = pcloudRobotDao.getByWxId(robotId);
if (null!=pcloudRobot && null!=pcloudRobot.getRobotType()){
List<Long> paperIds = personalStageDao.getPaperIdListByRobotClassify(pcloudRobot.getRobotType().longValue());
if (!ListUtils.isEmpty(paperIds)){
feedbackConsr.deleteUserAnswerRecord(paperIds, userWxId);
}
}
//删除书名和阅读偏好缓存
String bookKey ="BOOK:USER_SEND_CONTENT:" + userWxId + "-" +robotId;
String readingKey ="BOOK:READING_STYLE:" + userWxId + "-" + robotId;
JedisClusterUtils.del(bookKey);
JedisClusterUtils.del(readingKey);
}
}
......@@ -17,4 +17,6 @@ public interface PersonalStageDao extends BaseDao<PersonalStage> {
PersonalStage getFirstStage(Long robotClassifyId);
List<PersonalStageDTO> getPersonalStageList(Long robotClassifyId);
List<Long> getPaperIdListByRobotClassify(Long robotClassifyId);
}
\ No newline at end of file
......@@ -41,4 +41,9 @@ public class PersonalStageDaoImpl extends BaseDaoImpl<PersonalStage> implements
paramMap.put("robotClassifyId", robotClassifyId);
return super.getSqlSession().selectList(getStatement("getPersonalStageList"), paramMap);
}
@Override
public List<Long> getPaperIdListByRobotClassify(Long robotClassifyId) {
return getSessionTemplate().selectList(getStatement("getPaperIdListByRobotClassify"), robotClassifyId);
}
}
......@@ -134,4 +134,12 @@
order by seq_num, id
limit 1
</select>
<select id="getPaperIdListByRobotClassify" parameterType="long" resultType="long">
SELECT DISTINCT paper_id FROM personal_stage
WHERE
robot_classify_id = #{robotClassifyId}
AND paper_id>0
</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