New file |
| | |
| | | package com.panzhihua.applets.api; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.panzhihua.common.constants.Constants; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import com.panzhihua.applets.weixin.CheckService; |
| | | import com.panzhihua.common.controller.BaseController; |
| | | 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.service.community.CommunityService; |
| | | import com.panzhihua.common.validated.AddGroup; |
| | | import com.panzhihua.common.validated.PutGroup; |
| | | |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | | * @description: 房屋租售 |
| | | * @author: huang.hongfa weixin hhf9596 qq 959656820 |
| | | * @create: 2021-01-22 15:30 |
| | | **/ |
| | | @Slf4j |
| | | @Api(tags = {"房屋租售"}) |
| | | @RestController |
| | | @RequestMapping("/") |
| | | public class HouseApi extends BaseController { |
| | | @Resource |
| | | private CommunityService communityService; |
| | | @Resource |
| | | private CheckService checkService; |
| | | |
| | | @ApiOperation(value = "房屋租售-新增") |
| | | @PostMapping("house") |
| | | public R addHouse(@RequestBody @Validated(AddGroup.class) ComOpsHouseDTO comOpsHouseDTO) { |
| | | // 微信内容审核 |
| | | String introduction = comOpsHouseDTO.getIntroduction(); |
| | | if (StrUtil.isNotBlank(introduction)) { |
| | | String result = checkService.checkMessageBy(introduction, this.getLoginUserInfo().getOpenid(),this.getAppId()); |
| | | if (StrUtil.isNotBlank(result)) { |
| | | return R.fail(501, "填写内容存在 " + result + " 违规信息"); |
| | | } |
| | | } |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfo(); |
| | | Long userId = loginUserInfo.getUserId(); |
| | | Long communityId = loginUserInfo.getCommunityId(); |
| | | comOpsHouseDTO.setUserId(userId); |
| | | comOpsHouseDTO.setCommunityId(communityId); |
| | | comOpsHouseDTO.setUserType(1); |
| | | return communityService.addOpsHouse(comOpsHouseDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "房屋租售-分页查询", response = ComOpsHouseVO.class) |
| | | @PostMapping("pagehouse") |
| | | public R pageHouse(@RequestBody PageComOpsHouseDTO pageComOpsHouseDTO) { |
| | | LoginUserInfoVO loginUserInfo = this.getLoginUserInfoSureNoLogin(); |
| | | Integer isMy = pageComOpsHouseDTO.getIsMy(); |
| | | if (null != isMy && isMy.equals(1)) { |
| | | pageComOpsHouseDTO.setUserId(loginUserInfo.getUserId()); |
| | | } |
| | | return communityService.pageOpsHouse(pageComOpsHouseDTO); |
| | | } |
| | | |
| | | @ApiOperation(value = "房屋租售-详情", response = ComOpsHouseVO.class) |
| | | @GetMapping("house") |
| | | @ApiImplicitParam(name = "id", value = "房屋租售主键", required = true) |
| | | public R detailHouse(@RequestParam("id") Long id) { |
| | | return communityService.detailOpsHouse(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "房屋租售-修改") |
| | | @PostMapping("putHouse") |
| | | public R updateHouse(@RequestBody @Validated(PutGroup.class) ComOpsHouseVO comOpsHouseVO) { |
| | | return communityService.putOpsHouseByApplets(comOpsHouseVO); |
| | | } |
| | | |
| | | @ApiOperation(value = "房屋租售-删除") |
| | | @GetMapping("delHouse") |
| | | @ApiImplicitParam(name = "id", value = "房屋租售主键", required = true) |
| | | public R delHouse(@RequestParam("id") Long id) { |
| | | return communityService.deleteOpsHouse(id); |
| | | } |
| | | |
| | | @ApiOperation(value = "房屋租售-上下架") |
| | | @PostMapping("undercarriageHouse") |
| | | public R undercarriageHouse(@RequestBody @Validated(PutGroup.class) ComOpsHouseUndercarriageVO comOpsHouseVO) { |
| | | return communityService.undercarriageHouse(comOpsHouseVO); |
| | | } |
| | | |
| | | } |