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,15 +764,16 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO)); ...@@ -764,15 +764,16 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO));
if (null != pcloudSkill){ if (null != pcloudSkill){
skillFuseReply = pcloudSkill.getSkillFuseReply(); skillFuseReply = pcloudSkill.getSkillFuseReply();
} }
final Integer finalState = state;
EXECUTOR_SERVICE.execute(() ->{
if (SkillTypeEnum.TIME_MANAGE.value == type){ if (SkillTypeEnum.TIME_MANAGE.value == type){
//读书计划 确认某个读书计划 //读书计划 确认某个读书计划
if (null == state){ if (null == finalState){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId); taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else { }else {
if (SubTypeEnum.SUCCESS.value == state){ if (SubTypeEnum.SUCCESS.value == finalState){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId); taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else if (SubTypeEnum.CANCEL.value == state){ }else if (SubTypeEnum.CANCEL.value == finalState){
taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId); taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId);
} }
} }
...@@ -784,11 +785,11 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO)); ...@@ -784,11 +785,11 @@ wechatGroupConsr.sendMessage(JSON.toJSONString(sendFileVO));
} }
//修改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