| | |
| | | package com.stylefeng.guns.modular.code.controller; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.stylefeng.guns.modular.system.dto.Host; |
| | | import com.stylefeng.guns.modular.system.dto.Medium; |
| | | import com.stylefeng.guns.modular.system.dto.THouseResource; |
| | | import com.stylefeng.guns.modular.system.model.AppUser; |
| | | import com.stylefeng.guns.modular.system.model.TAppUserAuditRecord; |
| | | import com.stylefeng.guns.modular.system.service.IAppUserService; |
| | | import com.stylefeng.guns.modular.system.service.TAppUserAuditRecordService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | |
| | | @Autowired |
| | | private IAppUserService appUserService; |
| | | @Autowired |
| | | private TAppUserAuditRecordService appUserAuditRecordService; |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/list") |
| | | @ApiOperation(value = "查询中介列表", tags = {"后台-中介管理"}) |
| | | @ApiOperation(value = "查询中介列表", tags = {"后台-中介管理"},response = Medium.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "nickname", value = "微信昵称", required = false), |
| | | @ApiImplicitParam(name = "userType", value = "3(房东)",dataType = "int",required = true), |
| | | // @ApiImplicitParam(name = "userType", value = "3(中介)",dataType = "int",required = true), |
| | | @ApiImplicitParam(name = "status", value = "状态(1=正常,2=冻结,3=删除)",dataType = "int",required = false), |
| | | @ApiImplicitParam(name = "phone", value = "电话",required = false), |
| | | @ApiImplicitParam(name = "pageNo", required = false), |
| | | @ApiImplicitParam(name = "pageNum", required = false), |
| | | @ApiImplicitParam(name = "pageSize",required = false), |
| | | |
| | | }) |
| | | public List<Medium> list(String nickname, Integer userType, Integer status, String phone, @RequestParam() int pageNo, @RequestParam()int pageSize){ |
| | | int index = (pageNo-1)*pageSize; |
| | | int size = pageSize; |
| | | List<Medium> medius = appUserService.listMedium(nickname,userType,status,phone,index,size); |
| | | return medius; |
| | | public Object list(String nickname, Integer status, String phone, @RequestParam() int pageNum, @RequestParam()int pageSize){ |
| | | Integer userType = 3; |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | |
| | | List<Medium> medius = appUserService.listMedium(nickname,null,status,phone); |
| | | PageInfo<Medium> info=new PageInfo<>(medius); |
| | | System.err.println(info); |
| | | return info; |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/add") |
| | | @ApiOperation(value = "添加中介", tags = {"后台-中介管理"}) |
| | | public ResultUtil addHost( Medium host){ |
| | | public ResultUtil addHost(@RequestBody Medium host){ |
| | | System.out.println("===================添加房东=="); |
| | | AppUser appUser = new AppUser(); |
| | | BeanUtils.copyProperties(host,appUser); |
| | |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/pre/update") |
| | | @ApiOperation(value = "编辑前获取中介信息", tags = {"后台-中介管理"}) |
| | | @ApiOperation(value = "编辑前获取中介信息", tags = {"后台-中介管理"},response = Medium.class) |
| | | public Medium preupdate(Integer id){ |
| | | AppUser appUser = appUserService.selectById(id); |
| | | Medium host = new Medium(); |
| | |
| | | @ResponseBody |
| | | @PutMapping("/forzen") |
| | | @ApiOperation(value = "更改状态1=正常,2=冻结,3=删除", tags = {"后台-中介管理"}) |
| | | public ResultUtil frozen(Integer id,Integer status){ |
| | | AppUser appUser = appUserService.selectById(id); |
| | | public ResultUtil frozen(String ids,Integer status){ |
| | | String[] split = ids.split(","); |
| | | for (String s : split) { |
| | | AppUser appUser = appUserService.selectById(Integer.valueOf(s)); |
| | | appUser.setStatus(status); |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | | String res = ""; |
| | | switch (status) { |
| | | case 1: |
| | |
| | | @ResponseBody |
| | | @PutMapping("/update") |
| | | @ApiOperation(value = "编辑中介", tags = {"后台-中介管理"}) |
| | | public ResultUtil update(Medium host){ |
| | | public ResultUtil update(@RequestBody Medium host){ |
| | | // AppUser appUser = appUserService.selectById(id); |
| | | // Host host = new Host(); |
| | | AppUser appUser =new AppUser(); |
| | |
| | | appUserService.updateById(appUser); |
| | | return ResultUtil.success("编辑成功"); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/auth/list") |
| | | @ApiOperation(value = "查询中介审核列表", tags = {"后台-中介审核管理"},response = Medium.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "nickname", value = "微信昵称", required = false), |
| | | @ApiImplicitParam(name = "userType", value = "3(中介)",dataType = "int",required = true), |
| | | @ApiImplicitParam(name = "status", value = "1=待审核,2=审核通过,3=审核拒绝",dataType = "int",required = false), |
| | | @ApiImplicitParam(name = "phone", value = "电话",required = false), |
| | | @ApiImplicitParam(name = "pageNum", required = true), |
| | | @ApiImplicitParam(name = "pageSize",required = true), |
| | | |
| | | }) |
| | | public Object aulist(String nickname, Integer userType, Integer status, String phone, int pageNum, int pageSize){ |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<Medium> medius = appUserService.listAuMedium(nickname,null,status,phone); |
| | | PageInfo<Medium> info=new PageInfo<>(medius); |
| | | System.err.println(info); |
| | | return info; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @GetMapping("/auth/record/list") |
| | | @ApiOperation(value = "查询中介审核记录列表", tags = {"后台-中介审核管理"},response = TAppUserAuditRecord.class) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "status", value = "1=待审核,2=审核通过,3=审核拒绝",dataType = "int",required = false), |
| | | @ApiImplicitParam(name = "pageNum", required = true), |
| | | @ApiImplicitParam(name = "pageSize",required = true), |
| | | @ApiImplicitParam(name = "auId",value ="中介id" ,required = true) |
| | | }) |
| | | public Object record(Integer auId,Integer status,int pageNum, int pageSize){ |
| | | Wrapper<TAppUserAuditRecord> wrapper = new EntityWrapper<TAppUserAuditRecord>(); |
| | | |
| | | wrapper.eq("app_user_id", auId); |
| | | if (status!=null){ |
| | | wrapper.eq("audit_status",status); |
| | | } |
| | | PageHelper.startPage(pageNum,pageSize); |
| | | List<TAppUserAuditRecord> list = appUserAuditRecordService.selectList(wrapper); |
| | | PageInfo<TAppUserAuditRecord> info=new PageInfo<>(list); |
| | | System.err.println(info); |
| | | return info; |
| | | } |
| | | |
| | | @ResponseBody |
| | | @DeleteMapping("/auth/record/delete") |
| | | @ApiOperation(value = "查询中介审核列表-删除", tags = {"后台-中介审核管理"},response = TAppUserAuditRecord.class) |
| | | public Object recordDelete(String ids){ |
| | | String[] split = ids.split(","); |
| | | for (String id : split) { |
| | | appUserAuditRecordService.deleteById(Integer.valueOf(id)); |
| | | } |
| | | return ResultUtil.success("删除成功"); |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PutMapping("/auth/change") |
| | | @ApiOperation(value = "(批量)更改状态1=审核通过,2=审核拒绝,3=删除", tags = {"后台-中介审核管理"}) |
| | | public ResultUtil frozen(String ids,Integer status,String reason){ |
| | | String[] split = ids.split(","); |
| | | for (String id : split) { |
| | | AppUser appUser = appUserService.selectById(Integer.valueOf(id)); |
| | | if (status==1){ |
| | | appUser.setAuth(2); |
| | | appUser.setUserType(3); |
| | | // appUser.setRefuseDate(new Date()); |
| | | appUser.setChangeTime(new Date()); |
| | | //记录 |
| | | TAppUserAuditRecord appUserAuditRecord = new TAppUserAuditRecord(); |
| | | appUserAuditRecord.setAppUserId(Integer.valueOf(id)); |
| | | appUserAuditRecord.setAuditStatus(2); |
| | | appUserAuditRecord.setInsertTime(new Date()); |
| | | appUserAuditRecordService.insert(appUserAuditRecord); |
| | | }else if (status==2){ |
| | | appUser.setAuth(3); |
| | | appUser.setAuditNote(reason); |
| | | appUser.setRefuseDate(new Date()); |
| | | //记录 |
| | | TAppUserAuditRecord appUserAuditRecord = new TAppUserAuditRecord(); |
| | | appUserAuditRecord.setAppUserId(Integer.valueOf(id)); |
| | | appUserAuditRecord.setAuditStatus(3); |
| | | appUserAuditRecord.setInsertTime(new Date()); |
| | | appUserAuditRecord.setAuditNote(reason); |
| | | appUserAuditRecordService.insert(appUserAuditRecord); |
| | | }else if (status==3){ |
| | | appUser.setStatus(3); |
| | | } |
| | | |
| | | appUserService.updateById(appUser); |
| | | } |
| | | |
| | | |
| | | return ResultUtil.success("操作成功"); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |