Commit 25f4d685 by 阮思源

Merge branch 'fix-1021062' into 'master'

fixstate

See merge request rays/pcloud-book!464
parents 55485466 9cfac35b
...@@ -41,6 +41,8 @@ import com.pcloud.book.skill.dao.PcloudSubRemindDao; ...@@ -41,6 +41,8 @@ import com.pcloud.book.skill.dao.PcloudSubRemindDao;
import com.pcloud.book.skill.entity.PcloudGroupActivity; import com.pcloud.book.skill.entity.PcloudGroupActivity;
import com.pcloud.book.skill.entity.PcloudSkill; import com.pcloud.book.skill.entity.PcloudSkill;
import com.pcloud.book.skill.entity.PcloudSubRemind; import com.pcloud.book.skill.entity.PcloudSubRemind;
import com.pcloud.book.skill.enums.SkillTypeEnum;
import com.pcloud.book.skill.enums.SubTypeEnum;
import com.pcloud.book.skill.facade.response.QueryPcloudResponseVO; import com.pcloud.book.skill.facade.response.QueryPcloudResponseVO;
import com.pcloud.book.timecontrol.biz.TaskBiz; import com.pcloud.book.timecontrol.biz.TaskBiz;
import com.pcloud.book.timecontrol.biz.TaskSubscribeBiz; import com.pcloud.book.timecontrol.biz.TaskSubscribeBiz;
...@@ -655,7 +657,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -655,7 +657,7 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
throw new BizException(BizException.PARAM_IS_NULL.getCode(),"type为空或者relSkillId为空"); throw new BizException(BizException.PARAM_IS_NULL.getCode(),"type为空或者relSkillId为空");
} }
RobotSkillDetail robotSkillDetail = new RobotSkillDetail(); RobotSkillDetail robotSkillDetail = new RobotSkillDetail();
if (1 == type){ if (SkillTypeEnum.TIME_MANAGE.value == type){
TaskDto taskDto = taskBiz.getTaskById(relSkillId); TaskDto taskDto = taskBiz.getTaskById(relSkillId);
if (null != taskDto){ if (null != taskDto){
TimeControlTaskSubscribe timeControlTaskSubscribe = timeControlTaskSubscribeMapper.getSubscribe(wxUserId,null,relSkillId); TimeControlTaskSubscribe timeControlTaskSubscribe = timeControlTaskSubscribeMapper.getSubscribe(wxUserId,null,relSkillId);
...@@ -668,14 +670,14 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -668,14 +670,14 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
robotSkillDetail.setRelSkillName(taskDto.getTaskName()); robotSkillDetail.setRelSkillName(taskDto.getTaskName());
robotSkillDetail.setRelSkillIntroduce(taskDto.getTaskIntroduce()); robotSkillDetail.setRelSkillIntroduce(taskDto.getTaskIntroduce());
} }
}else if (2 == type){ }else if (SkillTypeEnum.READING.value == type){
PcloudGroupActivity pcloudGroupActivity = pcloudGroupActivityDao.getById(relSkillId); PcloudGroupActivity pcloudGroupActivity = pcloudGroupActivityDao.getById(relSkillId);
if (null != pcloudGroupActivity){ if (null != pcloudGroupActivity){
robotSkillDetail.setRelSkillId(Integer.valueOf(pcloudGroupActivity.getId().toString())); robotSkillDetail.setRelSkillId(Integer.valueOf(pcloudGroupActivity.getId().toString()));
robotSkillDetail.setRelSkillName(pcloudGroupActivity.getName()); robotSkillDetail.setRelSkillName(pcloudGroupActivity.getName());
robotSkillDetail.setRelSkillIntroduce(pcloudGroupActivity.getDesc()); robotSkillDetail.setRelSkillIntroduce(pcloudGroupActivity.getDesc());
} }
}else if (3 == type){ }else if (SkillTypeEnum.RESOURCE.value == type){
QueryPcloudResponseVO queryPcloudResponseVO = pcloudResourceDao.getPcloudResource(Long.valueOf(relSkillId.toString())); QueryPcloudResponseVO queryPcloudResponseVO = pcloudResourceDao.getPcloudResource(Long.valueOf(relSkillId.toString()));
if (null != queryPcloudResponseVO){ if (null != queryPcloudResponseVO){
robotSkillDetail.setRelSkillId(Integer.valueOf(queryPcloudResponseVO.getId().toString())); robotSkillDetail.setRelSkillId(Integer.valueOf(queryPcloudResponseVO.getId().toString()));
...@@ -684,22 +686,31 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -684,22 +686,31 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
} }
} }
//新增技能获取记录 //新增技能获取记录
PcloudSkillRecord pcloudSkillRecord = pcloudSkillRecordDao.getBySkillIdAndWxId(skillId, wxUserId); PcloudSkillRecord pcloudSkillRecord = pcloudSkillRecordDao.getBySkillIdAndWxId(skillId, wxUserId);
if (null == pcloudSkillRecord) { if (null == pcloudSkillRecord) {
PcloudSkillRecord pcloudSkillRecordNew = new PcloudSkillRecord(); PcloudSkillRecord pcloudSkillRecordNew = new PcloudSkillRecord();
if (SkillTypeEnum.TIME_MANAGE.value == type){
//先查询订阅状态
TimeControlTaskSubscribe timeControlTaskSubscribe = taskSubscribeBiz.getSubscribeState(wxUserId,relSkillId);
if (null != timeControlTaskSubscribe){
pcloudSkillRecordNew.setState(timeControlTaskSubscribe.getState());
}else {
pcloudSkillRecordNew.setState(0);
}
}else if (SkillTypeEnum.READING.value == type || SkillTypeEnum.RESOURCE.value == type){
pcloudSkillRecordNew.setState(0);
}
pcloudSkillRecordNew.setRobotWxId(robotWxId); pcloudSkillRecordNew.setRobotWxId(robotWxId);
pcloudSkillRecordNew.setWxUserId(wxUserId); pcloudSkillRecordNew.setWxUserId(wxUserId);
pcloudSkillRecordNew.setSkillId(skillId); pcloudSkillRecordNew.setSkillId(skillId);
pcloudSkillRecordNew.setSkillType(type); pcloudSkillRecordNew.setSkillType(type);
pcloudSkillRecordNew.setState(0);
pcloudSkillRecordNew.setCreateTime(new Date()); pcloudSkillRecordNew.setCreateTime(new Date());
pcloudSkillRecordNew.setUpdateTime(new Date()); pcloudSkillRecordNew.setUpdateTime(new Date());
pcloudSkillRecordDao.insertSelective(pcloudSkillRecordNew); pcloudSkillRecordDao.insertSelective(pcloudSkillRecordNew);
}else { }else {
if (1 == type){ if (SkillTypeEnum.TIME_MANAGE.value == type){
if (2 == pcloudSkillRecord.getState()){ if (SubTypeEnum.CANCEL.value == pcloudSkillRecord.getState()){
pcloudSkillRecord.setState(0); pcloudSkillRecord.setState(0);
} }
} }
...@@ -738,32 +749,26 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz { ...@@ -738,32 +749,26 @@ public class SelfRobotKeywordBizImpl implements SelfRobotKeywordBiz {
skillFuseReply = pcloudSkill.getSkillFuseReply(); skillFuseReply = pcloudSkill.getSkillFuseReply();
} }
if (1 == type){ if (SkillTypeEnum.TIME_MANAGE.value == type){
//读书计划 确认某个读书计划 //读书计划 确认某个读书计划
if (null == state){ if (null == state){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId); taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else { }else {
if (1 == state){ if (SubTypeEnum.SUCCESS.value == state){
taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId); taskSubscribeBiz.subscribeTask(wxUserId,null,relSkillId,robotId);
}else if (2 == state){ }else if (SubTypeEnum.CANCEL.value == state){
taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId); taskSubscribeBiz.unSubscribeTask(wxUserId,null,relSkillId);
} }
} }
}else if (2 == type){ }else if (SkillTypeEnum.READING.value == type){
pcloudGroupActivityBiz.processGroup(wxUserId,robotId,Long.valueOf(relSkillId.toString())); pcloudGroupActivityBiz.processGroup(wxUserId,robotId,Long.valueOf(relSkillId.toString()));
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId); pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
}else if (3 == type){ }else if (SkillTypeEnum.RESOURCE.value == type){
pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId); pcloudSkillBiz.sendResource(id,wxUserId,robotId,relSkillId);
} }
//修改pcloud_skill_record 状态值 //修改pcloud_skill_record 状态值
if (2 == type || 3 == type){ if (SkillTypeEnum.READING.value == type || SkillTypeEnum.RESOURCE.value == type){
state = 1; state = SubTypeEnum.SUCCESS.value;
}else if (1 == type){
if (null == state){
state = 1;
}
}
if(2 == type || 3 == type){
pcloudSkillRecordDao.updateState4ResourceAndActivity(wxUserId,robotId,id,state); pcloudSkillRecordDao.updateState4ResourceAndActivity(wxUserId,robotId,id,state);
} }
//修改pcloud_sub_remind 未订阅提醒表状态 //修改pcloud_sub_remind 未订阅提醒表状态
......
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