package com.stylefeng.guns.modular.code.controller; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.stylefeng.guns.modular.system.dto.FeedBackVo; import com.stylefeng.guns.modular.system.dto.THouseResource; import com.stylefeng.guns.modular.system.model.HouseResource; import com.stylefeng.guns.modular.system.model.ReportHouseResource; import com.stylefeng.guns.modular.system.service.IFeedBackService; import com.stylefeng.guns.modular.system.service.IHouseResourceService; import com.stylefeng.guns.modular.system.service.IReportHouseResourceService; import com.stylefeng.guns.modular.system.util.ResultUtil; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.Date; import java.util.List; @Controller @RequestMapping("/base/report") public class ReportController { @Autowired private IHouseResourceService houseResourceService; @Autowired private IReportHouseResourceService reportHouseResourceService; @Autowired private IFeedBackService feedBackService; @ResponseBody @GetMapping("/list") @ApiOperation(value = "列表", tags = {"后台-房源举报管理"},response = THouseResource.class) @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"), @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"), @ApiImplicitParam(name = "cellName", value = "小区名称", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "dataType", value = "房屋类型(1=出租,2=卖房)", dataType = "Integer", paramType = "query"), @ApiImplicitParam(name = "isManage", value = "1后台2房东3中介", dataType = "Integer", paramType = "query"), @ApiImplicitParam(name = "name", value = "姓名", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "saleAmount", value = "售卖金额区间'-'分隔", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "size", value = "面积", dataType = "Integer", paramType = "query") }) public Object auList(@RequestParam int pageNum, @RequestParam int pageSize, String cellName, Integer dataType, Integer isManage, String name, String saleAmount, Integer id, String size){ PageHelper.startPage(pageNum,pageSize); List houseResources =houseResourceService.reprotList(id,cellName,dataType,isManage,name,saleAmount,size); PageInfo info=new PageInfo<>(houseResources); System.err.println(info); return info; } @ResponseBody @PutMapping("/change") @ApiOperation(value = "status 1=通过,2=拒绝,3删除)", tags = {"后台-房源举报管理"}) public ResultUtil change(String ids, Integer status,String reason){ String[] split = ids.split(","); for (String id : split) { ReportHouseResource reportHouseResource = reportHouseResourceService.selectById(Integer.valueOf(id)); if (status==1){ reportHouseResource.setAudit(1); }else if (status ==2){ reportHouseResource.setAudit(2); reportHouseResource.setBackDate(new Date()); reportHouseResource.setBackReason(reason); HouseResource houseResource = houseResourceService.selectById(reportHouseResource.getHouseResourceId()); houseResource.setStatus(1); houseResourceService.updateById(houseResource); }else if (status == 3){ reportHouseResourceService.deleteById(Integer.valueOf(id)); return ResultUtil.success(); } reportHouseResourceService.updateById(reportHouseResource); } return ResultUtil.success(); } @ResponseBody @GetMapping("/feedback") @ApiOperation(value = "列表", tags = {"后台-意见反馈"}) @ApiImplicitParams({ @ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "query"), @ApiImplicitParam(name = "pageSize", value = "每页数量", required = true, dataType = "int", paramType = "query"), @ApiImplicitParam(name = "phone", value = "电话号码", dataType = "String", paramType = "query"), @ApiImplicitParam(name = "name", value = "提交用户", dataType = "String", paramType = "query") }) public PageInfo auList(@RequestParam int pageNum, @RequestParam int pageSize, String phone,String name){ PageHelper.startPage(pageNum,pageSize); List backVos = feedBackService.list(phone,name); PageInfo info=new PageInfo<>(backVos); System.err.println(info); return info; } @ResponseBody @DeleteMapping("/feedback/delete") @ApiOperation(value = "删除", tags = {"后台-意见反馈"}) public ResultUtil delete(Integer[] ids){ for (Integer id : ids) { feedBackService.deleteById(Integer.valueOf(id)); } return ResultUtil.success("删除成功"); } }