From 54ad966d0b142c97fc659263b51d1ea5d7b5c7c6 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期五, 28 五月 2021 16:17:08 +0800 Subject: [PATCH] 修改bug --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComOpsHouseServiceImpl.java | 76 ++++++++++++++++++++++++++++++++++++-- 1 files changed, 72 insertions(+), 4 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComOpsHouseServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComOpsHouseServiceImpl.java index 0a79897..88fd25a 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComOpsHouseServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComOpsHouseServiceImpl.java @@ -2,10 +2,12 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.panzhihua.common.enums.OpsHouseStatus; import com.panzhihua.common.model.dtos.community.ComOpsHouseDTO; import com.panzhihua.common.model.dtos.community.PageComOpsHouseDTO; import com.panzhihua.common.model.vos.LoginUserInfoVO; import com.panzhihua.common.model.vos.R; +import com.panzhihua.common.model.vos.community.ComOpsHouseUndercarriageVO; import com.panzhihua.common.model.vos.community.ComOpsHouseVO; import com.panzhihua.common.utlis.StringUtils; import com.panzhihua.service_community.dao.ComOpsHouseDAO; @@ -40,8 +42,8 @@ public R addHouse(ComOpsHouseDTO comOpsHouseDTO) { ComOpsHouseDO comOpsHouseDO=new ComOpsHouseDO(); BeanUtils.copyProperties(comOpsHouseDTO,comOpsHouseDO); - comOpsHouseDAO.insert(comOpsHouseDO); - return R.ok(); + int inserted = comOpsHouseDAO.insert(comOpsHouseDO); + return inserted==1?R.ok():R.fail(); } /** @@ -65,7 +67,13 @@ return R.ok(comOpsHouseVO); } + /** + * 房屋租售-修改 + * @param comOpsHouseVO 修改参数 + * @return 修改结果 + */ @Override + @Transactional(rollbackFor = Exception.class) public R putHouse(ComOpsHouseVO comOpsHouseVO) { ComOpsHouseDO comOpsHouseDO=new ComOpsHouseDO(); BeanUtils.copyProperties(comOpsHouseVO,comOpsHouseDO); @@ -80,7 +88,19 @@ * @return 删除结果 */ @Override + @Transactional(rollbackFor = Exception.class) public R deleteHouse(Long id) { + if(id == null){ + return R.fail("参数错误"); + } + ComOpsHouseDO oldComOpsHouseDO = comOpsHouseDAO.selectById(id); + if(oldComOpsHouseDO == null){ + return R.fail("该房屋租售信息不存在"); + } + if(oldComOpsHouseDO.getStatus().equals(OpsHouseStatus.AUDIT.getCode())){ + return R.fail("该房屋租售信息不可删除,请刷新"); + } + int delete = comOpsHouseDAO.deleteById(id); if (delete>0) { return R.ok(); @@ -107,8 +127,8 @@ } page.setSize(pageSize); page.setCurrent(pageNum); - if(!StringUtils.isEmpty(pageComOpsHouseDTO.getUserRealName())){ - Long userId = comOpsHouseDAO.selectUserIdByName(pageComOpsHouseDTO.getUserRealName()); + if(!StringUtils.isEmpty(pageComOpsHouseDTO.getUserName())){ + Long userId = comOpsHouseDAO.selectUserIdByName(pageComOpsHouseDTO.getUserName()); if (userId==null){ userId = -1L; } @@ -119,4 +139,52 @@ } + /** + * 房屋租售-上下架 + * @param comOpsHouseVO 上下架参数 + * @return 上下架结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public R undercarriageHouse(ComOpsHouseUndercarriageVO comOpsHouseVO) { + + //判断当前房屋租售信息状态 + ComOpsHouseDO oldComOpsHouseDO = comOpsHouseDAO.selectById(comOpsHouseVO.getId()); + if(oldComOpsHouseDO == null){ + return R.fail("该房屋租售信息不存在"); + } + if(oldComOpsHouseDO.getStatus().equals(OpsHouseStatus.AUDIT.getCode())){ + return R.fail("该房屋租售信息不可修改,请刷新"); + } + + BeanUtils.copyProperties(comOpsHouseVO,oldComOpsHouseDO); + comOpsHouseDAO.updateById(oldComOpsHouseDO); + return R.ok(); + } + + /** + * 房屋租售-小程序修改 + * @param comOpsHouseVO 修改参数 + * @return 修改结果 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public R putHouseByApplets(ComOpsHouseVO comOpsHouseVO) { + + ComOpsHouseDO oldComOpsHouseDO = comOpsHouseDAO.selectById(comOpsHouseVO.getId()); + if(oldComOpsHouseDO == null){ + return R.fail("该房屋租售信息不存在"); + } + if(oldComOpsHouseDO.getStatus().equals(OpsHouseStatus.AUDIT.getCode())){ + return R.fail("该房屋租售信息不可修改,请刷新"); + } + + ComOpsHouseDO comOpsHouseDO=new ComOpsHouseDO(); + BeanUtils.copyProperties(comOpsHouseVO,comOpsHouseDO); + //设置房屋租售信息为待审核 + comOpsHouseDO.setStatus(OpsHouseStatus.AUDIT.getCode()); + comOpsHouseDAO.updateById(comOpsHouseDO); + return R.ok(); + } + } -- Gitblit v1.7.1