|
@@ -5,6 +5,7 @@ import fcb.project.manager.base.entity.TmAudit;
|
|
import fcb.project.manager.base.entity.TmEstate;
|
|
import fcb.project.manager.base.entity.TmEstate;
|
|
import fcb.project.manager.base.entity.TmHouse;
|
|
import fcb.project.manager.base.entity.TmHouse;
|
|
import fcb.project.manager.base.enums.DeleteStatus;
|
|
import fcb.project.manager.base.enums.DeleteStatus;
|
|
|
|
+import fcb.project.manager.base.enums.HouseStatus;
|
|
import fcb.project.manager.base.service.impl.TmAuditServiceImpl;
|
|
import fcb.project.manager.base.service.impl.TmAuditServiceImpl;
|
|
import fcb.project.manager.base.service.impl.TmEstateServiceImpl;
|
|
import fcb.project.manager.base.service.impl.TmEstateServiceImpl;
|
|
import fcb.project.manager.base.service.impl.TmHouseServiceImpl;
|
|
import fcb.project.manager.base.service.impl.TmHouseServiceImpl;
|
|
@@ -117,6 +118,8 @@ public class HouseManagerController {
|
|
log.info("{}楼盘下面的房源{}已经存在" , tmHouse.getEstateId() , tmHouse.getHouseTitle());
|
|
log.info("{}楼盘下面的房源{}已经存在" , tmHouse.getEstateId() , tmHouse.getHouseTitle());
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "楼盘已经存在,无需再添加");
|
|
throw new CommonBaseException(ResultCodeEnum.D101 , "楼盘已经存在,无需再添加");
|
|
}
|
|
}
|
|
|
|
+ //创建默认是草稿的状态
|
|
|
|
+ tmHouse.setStatus(0);
|
|
if(tmHouseService.insertNew(tmHouse)){
|
|
if(tmHouseService.insertNew(tmHouse)){
|
|
return Result.success("新增成功");
|
|
return Result.success("新增成功");
|
|
}else{
|
|
}else{
|
|
@@ -152,6 +155,17 @@ public class HouseManagerController {
|
|
if(StringUtils.isBlank(houseId)){
|
|
if(StringUtils.isBlank(houseId)){
|
|
return Result.failure("房源ID不能为空");
|
|
return Result.failure("房源ID不能为空");
|
|
}
|
|
}
|
|
|
|
+ TmHouse dbHouse = tmHouseService.getById(houseId);
|
|
|
|
+ if(null == dbHouse){
|
|
|
|
+ return Result.failure("房源不存在,无需删除");
|
|
|
|
+ }
|
|
|
|
+ if(null != dbHouse.getStatus()){
|
|
|
|
+ //除了草稿、未通过状态,其他状态都不能删除
|
|
|
|
+ if(!HouseStatus.canDelete(dbHouse.getStatus())){
|
|
|
|
+ return Result.failure("存在待审核/已审核数据,无法删除");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
int delete = tmHouseService.deleteHouseById(houseId);
|
|
int delete = tmHouseService.deleteHouseById(houseId);
|
|
if(delete != 1){
|
|
if(delete != 1){
|
|
return Result.failure("删除失败");
|
|
return Result.failure("删除失败");
|
|
@@ -172,6 +186,9 @@ public class HouseManagerController {
|
|
return Result.failure("id不能为空");
|
|
return Result.failure("id不能为空");
|
|
}
|
|
}
|
|
TmHouse dbHouse = tmHouseService.getById(tmHouse.getId());
|
|
TmHouse dbHouse = tmHouseService.getById(tmHouse.getId());
|
|
|
|
+ if(null == dbHouse){
|
|
|
|
+ return Result.failure("房源不存在");
|
|
|
|
+ }
|
|
if(tmHouseService.updateHouse(tmHouse)){
|
|
if(tmHouseService.updateHouse(tmHouse)){
|
|
return Result.success("修改成功");
|
|
return Result.success("修改成功");
|
|
}else{
|
|
}else{
|
|
@@ -191,9 +208,14 @@ public class HouseManagerController {
|
|
return Result.failure("房源ID不能为空");
|
|
return Result.failure("房源ID不能为空");
|
|
}
|
|
}
|
|
TmHouse dbHouse = tmHouseService.getById(houseId);
|
|
TmHouse dbHouse = tmHouseService.getById(houseId);
|
|
- if(null == dbHouse){
|
|
|
|
- return Result.failure("房源不存在");
|
|
|
|
|
|
+ if(null == dbHouse || null == dbHouse.getStatus()){
|
|
|
|
+ return Result.failure("房源不存在或者房源状态非法");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if(HouseStatus.AUDITED.getCode().compareTo(dbHouse.getStatus()) == 0){
|
|
|
|
+ return Result.failure("房源已审核");
|
|
|
|
+ }
|
|
|
|
+
|
|
if(StringUtils.isBlank(dbHouse.getEstateId())){
|
|
if(StringUtils.isBlank(dbHouse.getEstateId())){
|
|
return Result.failure("房源未分配所属的楼盘不存在");
|
|
return Result.failure("房源未分配所属的楼盘不存在");
|
|
}
|
|
}
|
|
@@ -223,7 +245,7 @@ public class HouseManagerController {
|
|
|
|
|
|
|
|
|
|
@PostMapping("/dismissAudit")
|
|
@PostMapping("/dismissAudit")
|
|
- @ApiOperation(value = "撤销审核记录")
|
|
|
|
|
|
+ @ApiOperation(value = "撤销审核记录-")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name = "houseId", value = "房源ID", paramType = "query", required = true, dataType = "String"),
|
|
@ApiImplicitParam(name = "houseId", value = "房源ID", paramType = "query", required = true, dataType = "String"),
|
|
})
|
|
})
|