From 15fa9d64f49b8d1ae7d75a535ed45bb359e26024 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期一, 30 八月 2021 17:04:37 +0800 Subject: [PATCH] bug修复 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java | 53 ++++++++++++++++++++++++++++++++--------------------- 1 files changed, 32 insertions(+), 21 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java index 85ed47f..2e467f5 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActReserveServiceImpl.java @@ -85,7 +85,7 @@ //查询当前用户是否已预约并判断是否能继续预约 if(comActReserveDO.getJoinAllCount()!=0){ Integer count=comActReserveRecordMapper.selectCount(new QueryWrapper<ComActReserveRecordDO>().eq("reserve_id",comActReserveCommitVO.getId())); - if(count>=comActReserveDO.getJoinCount()){ + if(count>=comActReserveDO.getJoinAllCount()){ return R.fail("预约已上限"); } } @@ -175,6 +175,7 @@ comActReserveMapper.updateById(comActReserveDO); //新增用户答题记录 ComActReserveRecordDO userAnswerDO = new ComActReserveRecordDO(); + userAnswerDO.setCommunityId(comActReserveCommitVO.getCommunityId()); userAnswerDO.setPhone(comActReserveCommitVO.getPhone()); userAnswerDO.setReserveId(questId); userAnswerDO.setReserveTime(comActReserveCommitVO.getReserveTime()); @@ -556,30 +557,40 @@ } @Override - public R getById(Long id,Long userId,Long recordId) { + public R getById(Long id,Long userId,Long recordId,Integer isBack) { ComActReserveDO comActReserveDO=comActReserveMapper.selectById(id); if(comActReserveDO!=null){ ComActReserveDetailVO comActReserveDetailVO=new ComActReserveDetailVO(); - BeanUtils.copyProperties(comActReserveDO,comActReserveDetailVO); - List<ComActReserveRecordDO> list=comActReserveRecordMapper.selectList(new QueryWrapper<ComActReserveRecordDO>().eq("user_id",userId).eq("reserve_id",id).in("status",1,2).orderByDesc("reserve_time")); - List<ComActReserveRecordDO> secondlist=comActReserveRecordMapper.selectList(new QueryWrapper<ComActReserveRecordDO>().eq("user_id",userId).eq("reserve_id",id).orderByDesc("reserve_time")); - //判断当前数据是否可重复提交 - if(comActReserveDO.getIsRepeat()==ComActReserveDetailVO.isOk.y||list.isEmpty()){ - comActReserveDetailVO.setIsOk(ComActReserveDetailVO.isOk.n); - }else { - comActReserveDetailVO.setIsOk(ComActReserveDetailVO.isOk.y); + if(isBack!=1){ + comActReserveDO.setViewNum(comActReserveDO.getViewNum()+1); + BeanUtils.copyProperties(comActReserveDO,comActReserveDetailVO); + List<ComActReserveRecordDO> list=comActReserveRecordMapper.selectList(new QueryWrapper<ComActReserveRecordDO>().eq("user_id",userId).eq("reserve_id",id).in("status",1,2).orderByDesc("reserve_time")); + List<ComActReserveRecordDO> secondlist=comActReserveRecordMapper.selectList(new QueryWrapper<ComActReserveRecordDO>().eq("user_id",userId).eq("reserve_id",id).orderByDesc("reserve_time")); + //判断当前数据是否可重复提交 + if(comActReserveDO.getIsRepeat()==ComActReserveDetailVO.isOk.y||list.isEmpty()){ + comActReserveDetailVO.setIsOk(ComActReserveDetailVO.isOk.n); + }else { + comActReserveDetailVO.setIsOk(ComActReserveDetailVO.isOk.y); + } + //如果用户已提交返回最新一条记录 列表时间倒序排列 + if(!list.isEmpty()){ + comActReserveDetailVO.setJsonObject(list.get(0).getJsonObject()); + comActReserveDetailVO.setReserveTime(list.get(0).getReserveTime()); + } + if(!secondlist.isEmpty()&&recordId!=null){ + secondlist.forEach(comActReserveRecordDO -> { + if(comActReserveRecordDO.getId().equals(recordId)){ + comActReserveDetailVO.setRecordStatus(comActReserveRecordDO.getStatus()); + } + }); + } + //更新浏览量 + comActReserveMapper.updateById(comActReserveDO); + return R.ok(comActReserveDetailVO); } - //如果用户已提交返回最新一条记录 列表时间倒序排列 - if(!list.isEmpty()){ - comActReserveDetailVO.setJsonObject(list.get(0).getJsonObject()); - comActReserveDetailVO.setReserveTime(list.get(0).getReserveTime()); - } - if(!secondlist.isEmpty()&&recordId!=null){ - secondlist.forEach(comActReserveRecordDO -> { - if(comActReserveRecordDO.getId().equals(recordId)){ - comActReserveDetailVO.setRecordStatus(comActReserveRecordDO.getStatus()); - } - }); + ComActReserveRecordDO comActReserveRecordDO =comActReserveRecordMapper.selectById(recordId); + if(comActReserveRecordDO!=null){ + BeanUtils.copyProperties(comActReserveRecordDO,comActReserveDetailVO); } return R.ok(comActReserveDetailVO); } -- Gitblit v1.7.1