Commit 39afffcf by 吴博

优化接口

parent d40fb232
...@@ -157,7 +157,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -157,7 +157,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
@Autowired @Autowired
private PcloudSkillRecordDao pcloudSkillRecordDao; private PcloudSkillRecordDao pcloudSkillRecordDao;
private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(5); private static final ExecutorService EXECUTOR_SERVICE = Executors.newFixedThreadPool(2);
...@@ -764,31 +764,32 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO)); ...@@ -764,31 +764,32 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO));
if (null != pcloudSkill){ if (null != pcloudSkill){
skillFuseReply = pcloudSkill.getSkillFuseReply(); skillFuseReply = pcloudSkill.getSkillFuseReply();
} }
final Integer finalState = state;
if (SkillTypeEnum.TIME_MANAGE.value == type){ EXECUTOR_SERVICE.execute(() ->{
//读书计划 确认某个读书计划 if (SkillTypeEnum.TIME_MANAGE.value == type){
if (null == state){ //读书计划 确认某个读书计划
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId); if (null == finalState){
}else {
if (SubTypeEnum.SUCCESS.value == state){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId); taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else if (SubTypeEnum.CANCEL.value == state){ }else {
taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId); if (SubTypeEnum.SUCCESS.value == finalState){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else if (SubTypeEnum.CANCEL.value == finalState){
taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId);
}
} }
}else if (SkillTypeEnum.READING.value == type){
pcloudGroupActivityBiz.processGroup(wxUserId,robotId,Long.valueOf(relSkillId.toString()));
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
}else if (SkillTypeEnum.RESOURCE.value == type){
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
} }
}else if (SkillTypeEnum.READING.value == type){
pcloudGroupActivityBiz.processGroup(wxUserId,robotId,Long.valueOf(relSkillId.toString()));
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
}else if (SkillTypeEnum.RESOURCE.value == type){
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
}
//修改pcloud_skill_record 状态值 //修改pcloud_skill_record 状态值
if (SkillTypeEnum.READING.value == type || SkillTypeEnum.RESOURCE.value == type){ if (SkillTypeEnum.READING.value == type || SkillTypeEnum.RESOURCE.value == type){
state = SubTypeEnum.SUCCESS.value; pcloudSkillRecordDao.updateState4ResourceAndActivity(wxUserId,robotId,id,SubTypeEnum.SUCCESS.value);
pcloudSkillRecordDao.updateState4ResourceAndActivity(wxUserId,robotId,id,state); }
}
//修改pcloud_sub_remind 未订阅提醒表状态 //修改pcloud_sub_remind 未订阅提醒表状态
pcloudSubRemindBiz.updateSubState(relSkillId,type,wxUserId,id); pcloudSubRemindBiz.updateSubState(relSkillId,type,wxUserId,id);
});
return skillFuseReply; return skillFuseReply;
} }
......
...@@ -305,13 +305,11 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz { ...@@ -305,13 +305,11 @@ public class PcloudSkillBizImpl implements PcloudSkillBiz {
if(skill == null) { if(skill == null) {
throw new BookBizException(BookBizException.PARAM_IS_NULL, "技能不存在,订阅失败!"); throw new BookBizException(BookBizException.PARAM_IS_NULL, "技能不存在,订阅失败!");
} }
ThreadPoolUtils.OTHER_THREAD_POOL.execute(() -> { // 发送订阅回复信息
// 发送订阅回复信息 List<PcloudSubReply> replyList = pcloudSubReplyDao.getListByPcloudSkillId(skill.getId());
List<PcloudSubReply> replyList = pcloudSubReplyDao.getListByPcloudSkillId(skill.getId()); List<PcloudSubReply> subReplyList;
List<PcloudSubReply> subReplyList; subReplyList = replyList.stream().filter(s->SubTypeEnum.SUCCESS.value.equals(s.getSubType())).collect(Collectors.toList());
subReplyList = replyList.stream().filter(s->SubTypeEnum.SUCCESS.value.equals(s.getSubType())).collect(Collectors.toList()); this.sendSubReplyMessage(subReplyList, robotId, wxUserId);
this.sendSubReplyMessage(subReplyList, robotId, wxUserId);
});
} }
@Override @Override
......
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