package com.ruoyi.management.controller; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.PageInfo; import com.ruoyi.common.security.service.TokenService; import com.ruoyi.management.domain.TFeedback; import com.ruoyi.management.domain.TUseGuide; import com.ruoyi.management.dto.FeedbackQuery; import com.ruoyi.management.query.UseGuideQuery; import com.ruoyi.management.service.ITFeedbackService; import com.ruoyi.management.vo.FeedbackVO; import com.ruoyi.study.api.domain.TUser; import com.ruoyi.study.api.feignClient.StudyClient; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; import java.util.ArrayList; import java.util.List; /** *

* 用户反馈 前端控制器 *

* * @author 无关风月 * @since 2024-04-26 */ @Controller @RequestMapping("/tFeedback") public class TFeedbackController { @Autowired private ITFeedbackService feedbackService; @PostMapping("/addFeedBack") @ApiOperation(value = "反馈", tags = {"家长端-意见反馈"}) public R addFeedBack(@RequestBody TFeedback dto) { feedbackService.save(dto); return R.ok(); } @Autowired private StudyClient studyClient; @ResponseBody @PostMapping("/listAll") @ApiOperation(value = "列表查询", tags = {"反馈管理"}) public AjaxResult> listAll(FeedbackQuery query){ // if (query.getEndTime()!=null){ // query.getEndTime().setHours(23); // query.getEndTime().setMinutes(59); // query.getEndTime().setSeconds(59); // } List list = feedbackService.listAll(query); List result = new ArrayList<>(); for (FeedbackVO feedbackVO : list) { TUser data = studyClient.getUserById(feedbackVO.getUserId()).getData(); if (data == null )continue; feedbackVO.setName(data.getName()); feedbackVO.setPhone(data.getPhone()); if (!StringUtils.hasLength(query.getPhone()) && !StringUtils.hasLength(query.getUserName())) { result.add(feedbackVO); continue; } // 如果筛选条件输入了电话或者姓名那么需要过滤掉不符合条件的数据 if (StringUtils.hasLength(query.getPhone()) && StringUtils.hasLength(query.getUserName())) { if (feedbackVO.getPhone().contains(query.getPhone()) && feedbackVO.getName().contains(query.getUserName())) { result.add(feedbackVO); } } else if (StringUtils.hasLength(query.getPhone())) { if (feedbackVO.getPhone().contains(query.getPhone())) { result.add(feedbackVO); } } else if (StringUtils.hasLength(query.getUserName())) { if (feedbackVO.getName().contains(query.getUserName())) { result.add(feedbackVO); } } } PageInfo res = new PageInfo<>(query.getPageNumber(), query.getPageSize()); res.setTotal(result.size()); res.setRecords(result); return AjaxResult.success(res); } @ResponseBody @GetMapping("/detail") @ApiOperation(value = "查看详情", tags = {"反馈管理"}) public AjaxResult detail(Integer id){ TFeedback feedback = feedbackService.getById(id); return AjaxResult.success(feedback); } @ResponseBody @GetMapping("/handle") @ApiOperation(value = "处理", tags = {"反馈管理"}) public AjaxResult handle(Integer id){ TFeedback feedback = feedbackService.getById(id); feedback.setState(2); feedbackService.updateById(feedback); return AjaxResult.success(); } }