From 0923c2a6f1a7b4d28e39f566f9ff27557e2bf250 Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期五, 27 三月 2026 14:57:29 +0800
Subject: [PATCH] 修改
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THelpNeedsController.java | 76 +++++++++++++++++++++++++++++++++++++
1 files changed, 75 insertions(+), 1 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THelpNeedsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THelpNeedsController.java
index f0c30d4..641bc3c 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THelpNeedsController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/THelpNeedsController.java
@@ -1,25 +1,43 @@
package com.ruoyi.web.controller.api;
+import cn.afterturn.easypoi.excel.ExcelExportUtil;
+import cn.afterturn.easypoi.excel.entity.ExportParams;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.WebUtils;
+import com.ruoyi.framework.web.service.TokenService;
+import com.ruoyi.system.dto.HandleAppealServicesDTO;
+import com.ruoyi.system.dto.HandleHelpNeedsDTO;
+import com.ruoyi.system.export.THelpNeedsExport;
+import com.ruoyi.system.export.TMicroWishExport;
import com.ruoyi.system.model.TAppUser;
+import com.ruoyi.system.model.TAppealServices;
import com.ruoyi.system.model.THelpNeeds;
import com.ruoyi.system.model.THelpNeeds;
import com.ruoyi.system.query.AssistedDiningListQuery;
import com.ruoyi.system.query.HelpNeedsListQuery;
+import com.ruoyi.system.query.TCourseOrderQuery;
import com.ruoyi.system.service.THelpNeedsService;
import com.ruoyi.system.service.THelpNeedsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
+import java.util.Objects;
import java.util.stream.Collectors;
/**
@@ -36,6 +54,8 @@
public class THelpNeedsController {
@Autowired
private THelpNeedsService helpNeedsService;
+ @Autowired
+ private TokenService tokenService;
@ApiOperation(value = "助需管理分页列表")
@PostMapping(value = "/pageList")
public R<PageInfo<THelpNeeds>> pageList(@RequestBody HelpNeedsListQuery query) {
@@ -47,6 +67,8 @@
@Log(title = "助需管理-添加", businessType = BusinessType.INSERT)
@PostMapping(value = "/add")
public R<Boolean> save(@RequestBody THelpNeeds dto) {
+ String nickName = tokenService.getLoginUser().getUser().getNickName();
+ dto.setNickName(nickName);
helpNeedsService.save(dto);
return R.ok();
}
@@ -75,8 +97,60 @@
}
@ApiOperation(value = "查看详情")
@GetMapping(value = "/detail")
- public R<THelpNeeds> detail(Integer id) {
+ public R<THelpNeeds> detail(String id) {
return R.ok(helpNeedsService.getById( id));
}
+
+ /**
+ * 处理助需
+ */
+ @Log(title = "助需管理-处理助需", businessType = BusinessType.UPDATE)
+ @ApiOperation(value = "处理助需")
+ @PostMapping(value = "/handleHelpNeeds")
+ public R<String> handleHelpNeeds(@RequestBody HandleHelpNeedsDTO dto) {
+
+ Long userId = tokenService.getLoginUser().getUserId();
+ String nickName = tokenService.getLoginUser().getUser().getNickName();
+
+ THelpNeeds helpNeeds = helpNeedsService.getById(dto.getId());
+ helpNeeds.setStatus(2);
+ helpNeeds.setUserId(userId);
+ helpNeeds.setProcessPersonName(nickName);
+ helpNeeds.setProcessTime(LocalDateTime.now());
+ helpNeeds.setProcessRemark(dto.getProcessRemark());
+ helpNeeds.setProcessPictures(dto.getProcessPictures());
+ helpNeedsService.updateById(helpNeeds);
+ return R.ok();
+ }
+
+ @Log(title = "助需管理-助需记录导出", businessType = BusinessType.EXPORT)
+ @ApiOperation(value = "助需记录导出")
+ @PostMapping("/exportHelpNeeds")
+ public void exportHelpNeeds(@RequestBody HelpNeedsListQuery query){
+ List<THelpNeedsExport> helpNeedsExports = helpNeedsService.exportHelpNeeds(query);
+ Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), THelpNeedsExport.class, helpNeedsExports);
+ HttpServletResponse response = WebUtils.response();
+ assert response != null;
+ response.setContentType("application/vnd.ms-excel");
+ response.setCharacterEncoding("utf-8");
+ ServletOutputStream outputStream = null;
+ try {
+ String fileName = URLEncoder.encode("助需记录导出.xls", "utf-8");
+ response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
+ response.setContentType("application/vnd.ms-excel;charset=UTF-8");
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-Control", "no-cache");
+ outputStream = response.getOutputStream();
+ workbook.write(outputStream);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ try {
+ outputStream.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
}
--
Gitblit v1.7.1