| | |
| | | package com.stylefeng.guns.modular.api; |
| | | |
| | | import com.stylefeng.guns.modular.system.model.AppUser; |
| | | import com.stylefeng.guns.modular.system.model.FeedBack; |
| | | import com.stylefeng.guns.modular.system.model.HouseResource; |
| | | import com.stylefeng.guns.modular.system.service.IAppUserService; |
| | | import com.stylefeng.guns.modular.system.service.IFeedBackService; |
| | | import com.stylefeng.guns.modular.system.service.IHouseResourceService; |
| | | import com.stylefeng.guns.modular.system.service.impl.FeedBackServiceImpl; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import com.stylefeng.guns.modular.system.warpper.req.RegisterAccountReq; |
| | | import com.stylefeng.guns.modular.system.warpper.req.*; |
| | | import com.stylefeng.guns.modular.system.warpper.res.AppletLoginRes; |
| | | import com.stylefeng.guns.modular.system.warpper.res.CollectRes; |
| | | import com.stylefeng.guns.modular.system.warpper.res.SearchIntermediaryRes; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | |
| | | @Autowired |
| | | private IFeedBackService feedBackService; |
| | | @Autowired |
| | | private IHouseResourceService houseResourceService; |
| | | |
| | | |
| | | @ResponseBody |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "jscode", value = "微信jscode", required = true) |
| | | }) |
| | | public ResultUtil<AppletLoginRes> appletLogin(String jscode){ |
| | | return appUserService.appletLogin(jscode); |
| | | public ResultUtil<AppletLoginRes> appletLogin(String jscode,String encryptedPhoneData,String phoneIv){ |
| | | RegisterAccountReq req = new RegisterAccountReq(); |
| | | req.setJscode(jscode); |
| | | req.setEncryptedPhoneData(encryptedPhoneData); |
| | | req.setPhone_iv(phoneIv); |
| | | return appUserService.appletLogin(req); |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/registerAccount") |
| | | @ApiOperation(value = "小程序注册账户", tags = {"登录注册"}) |
| | | public ResultUtil<AppletLoginRes> registerAccount(RegisterAccountReq req){ |
| | | public ResultUtil<AppletLoginRes> registerAccount(@RequestBody RegisterAccountReq req){ |
| | | return appUserService.registerAccount(req); |
| | | } |
| | | |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/userInfo") |
| | | @ApiOperation(value = "个人中心", tags = {"个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header") |
| | | }) |
| | | public ResultUtil<AppUser> userInfo(){ |
| | | return appUserService.userInfo(); |
| | | } |
| | | |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/release") |
| | | @ApiOperation(value = "发布", tags = {"个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header") |
| | | }) |
| | | public ResultUtil<CollectRes> release(){ |
| | | return appUserService.collect(); |
| | | } |
| | | |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/collect") |
| | | @ApiOperation(value = "收藏", tags = {"个人中心"}) |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", required = true, paramType = "header") |
| | | public ResultUtil<CollectRes> collect(@RequestBody UserInfoQuery query){ |
| | | return appUserService.release(query); |
| | | } |
| | | |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @GetMapping("/base/appUser/edit/{id}") |
| | | @ApiOperation(value = "编辑发布的房源", tags = {"个人中心"}) |
| | | public ResultUtil<HouseResource> edit(@PathVariable("id") Integer id){ |
| | | |
| | | return ResultUtil.success(houseResourceService.selectById(id)); |
| | | } |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/auth/{id}") |
| | | @ApiOperation(value = "中介认证", tags = {"个人中心"}) |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", |
| | | required = true, paramType = "header") |
| | | public ResultUtil auth(@RequestBody AppUser appUser){ |
| | | AppUser appUser1 = appUserService.getAppUser(); |
| | | appUser1.setAgentLicenceCode(appUser.getAgentLicenceCode()); |
| | | appUser1.setCompanyName(appUser.getCompanyName()); |
| | | appUser1.setCompanyAddress(appUser.getCompanyAddress()); |
| | | appUser1.setBusinessCardPhoto(appUser.getBusinessCardPhoto()); |
| | | appUser1.setCityId(appUser.getCityId()); |
| | | appUser1.setDistrictId(appUser.getDistrictId()); |
| | | appUser1.setAuditStatus(1); |
| | | appUserService.updateById(appUser1); |
| | | return ResultUtil.success(); |
| | | } |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @GetMapping("/base/appUser/editSubmit") |
| | | @ApiOperation(value = "编辑提交", tags = {"个人中心"}) |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", |
| | | required = true, paramType = "header") |
| | | public ResultUtil editSubmit(@RequestBody AddHouseReq req){ |
| | | HouseResource houseResource = new HouseResource(); |
| | | BeanUtils.copyProperties(req,houseResource); |
| | | houseResource.setInsertTime(new Date()); |
| | | houseResource.setAuthStatus(1); |
| | | houseResource.setIsDelete(0); |
| | | houseResource.setUpdateUserId(appUserService.getAppUser().getId()); |
| | | houseResource.setUpdateTime(new Date()); |
| | | houseResource.setStatus(0); |
| | | houseResource.setLeaseTime(req.getTime()); |
| | | houseResource.setFirmHouse(req.getFirmHouse()); |
| | | if (req.getTime().contains("年")){ |
| | | houseResource.setRentalDuration(2); |
| | | }else{ |
| | | houseResource.setRentalDuration(1); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @GetMapping("/base/appUser/operate") |
| | | @ApiOperation(value = "发布-删除/下架/顶上去", tags = {"个人中心"}) |
| | | public ResultUtil delete(@RequestBody UserInfoDTO dto){ |
| | | switch (dto.getType()){ |
| | | case 1: |
| | | HouseResource houseResource = houseResourceService.selectById(dto.getId()); |
| | | houseResource.setIsDelete(1); |
| | | houseResourceService.updateById(houseResource); |
| | | break; |
| | | case 2: |
| | | HouseResource houseResource1 = houseResourceService.selectById(dto.getId()); |
| | | houseResource1.setStatus(0); |
| | | houseResourceService.updateById(houseResource1); |
| | | break; |
| | | case 3: |
| | | HouseResource houseResource2 = houseResourceService.selectById(dto.getId()); |
| | | houseResource2.setInsertTime(new Date()); |
| | | houseResourceService.updateById(houseResource2); |
| | | break; |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/feedback") |
| | | @ApiOperation(value = "意见反馈", tags = {"个人中心"}) |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", |
| | | required = true, paramType = "header") |
| | | public ResultUtil feedback(@RequestBody FeedBack feedBack){ |
| | | feedBack.setAppUserId(appUserService.getAppUser().getId()); |
| | | feedBack.setInsertTime(new Date()); |
| | | feedBackService.insert(feedBack); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | // todo 放行 |
| | | @ResponseBody |
| | | @PostMapping("/base/appUser/update") |
| | | @ApiOperation(value = "个人资料修改", tags = {"个人中心"}) |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer eyJhbGciOiJIUzUxMiJ....", |
| | | required = true, paramType = "header") |
| | | public ResultUtil update(@RequestBody UpdateAppUser user){ |
| | | AppUser appUser = appUserService.getAppUser(); |
| | | if (StringUtils.hasLength(user.getProfilePhoto())){ |
| | | appUser.setProfilePhoto(user.getProfilePhoto()); |
| | | } |
| | | if (StringUtils.hasLength(user.getNickname())){ |
| | | appUser.setNickname(user.getNickname()); |
| | | } |
| | | appUserService.updateById(appUser); |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | } |