From b181d08b9c8c4f3f4d8c475a60506ba4d93c8382 Mon Sep 17 00:00:00 2001
From: zhubaomin <zhubaomin>
Date: 星期三, 09 四月 2025 11:38:23 +0800
Subject: [PATCH] 灌溉计划详情页,包含计划信息、轮灌组信息、取水口命令发布员结果信息
---
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuResultCtrl.java | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 114 insertions(+), 0 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuResultCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuResultCtrl.java
new file mode 100644
index 0000000..8115374
--- /dev/null
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/rtuUpgrade/task/UgRtuResultCtrl.java
@@ -0,0 +1,114 @@
+package com.dy.pipIrrBase.rtuUpgrade.task;
+
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.support.ExcelTypeEnum;
+import com.dy.common.aop.SsoAop;
+import com.dy.common.webUtil.BaseResponse;
+import com.dy.common.webUtil.BaseResponseUtils;
+import com.dy.common.webUtil.QueryResultVo;
+import com.dy.common.webUtil.ResultCodeMsg;
+import com.dy.pipIrrGlobal.pojoUg.UgRtuTask;
+import com.dy.pipIrrGlobal.voUg.VoUgResult;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import io.swagger.v3.oas.annotations.responses.ApiResponses;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import jakarta.servlet.http.HttpServletResponse;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.List;
+
+/**
+ * @Author: liurunyu
+ * @Date: 2024/11/13 16:10
+ * @Description
+ */
+@Slf4j
+@Tag(name = "RTU鍗囩骇缁撴灉", description = "RTU鍗囩骇缁撴灉")
+@RestController
+@RequestMapping(path = "ugRtuResult")
+@SuppressWarnings("unchecked")
+//java鐗堟湰瓒婇珮锛屽娉涘瀷绾︽潫瓒婁弗锛屾墍浠ラ厤缃甋uppressWarnings("unchecked")
+public class UgRtuResultCtrl {
+
+ private UgRtuResultSv sv;
+
+ @Autowired
+ private void setSv(UgRtuResultSv sv) { this.sv = sv; }
+
+ /**
+ * 瀹㈡埛绔垎椤垫煡璇竴涓崌绾т换鍔$殑鎵�鏈夋帶鍒跺櫒
+ * @return 涓�浜汻TU鍗囩骇浠诲姟鏁版嵁
+ */
+ @Operation(summary = "鍒嗛〉鏌ヨ涓�涓崌绾т换鍔′腑鎵�鏈夋帶鍒跺櫒鍗囩骇缁撴煡", description = "瀹㈡埛绔垎椤垫煡璇竴涓崌绾т换鍔′腑鎵�鏈夋帶鍒跺櫒鍗囩骇缁撴煡")
+ @ApiResponses(value = {
+ @ApiResponse(
+ responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE,
+ description = "杩斿洖涓�浜汻TU鍗囩骇浠诲姟鎺у埗鍣ㄥ崌绾ф暟鎹紙BaseResponse.content:QueryResultVo[{}]锛�",
+ content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
+ schema = @Schema(implementation = UgRtuTask.class))}
+ )
+ })
+ @GetMapping(path = "/some")
+ @SsoAop()
+ public BaseResponse<QueryResultVo<List<VoUgResult>>> some(QueryUgResultVo vo) {
+ if (vo.taskId == null) {
+ return BaseResponseUtils.buildErrorMsg("鍗囩骇浠诲姟id涓嶈兘涓虹┖");
+ }
+ if(vo.state != null && vo.state == 1){
+ //鏌ヨ鍗囩骇鎴愬姛鐨�
+ vo.fail = null ;
+ }
+ if(vo.state == null && vo.fail != null){
+ //鏌ヨ鍗囩骇澶辫触鐨�
+ vo.state = 0 ;
+ }
+ QueryResultVo<List<VoUgResult>> res = this.sv.selectSome(vo);
+ return BaseResponseUtils.buildSuccess(res);
+ }
+
+ /**
+ * 瀵煎嚭鍗囩骇缁撴灉RTU鍒楄〃
+ * @param response
+ */
+ @RequestMapping(value = "/exportAll", method = RequestMethod.GET)
+ @SsoAop()
+ public void exportAll(HttpServletResponse response, QueryUgResultVo vo) throws Exception {
+ if(vo.state != null && vo.state == 1){
+ //鏌ヨ鍗囩骇鎴愬姛鐨�
+ vo.fail = null ;
+ }
+ if(vo.state == null && vo.fail != null){
+ //鏌ヨ鍗囩骇澶辫触鐨�
+ vo.state = 0 ;
+ }
+ setExcelRespProp(response, "鍗囩骇缁撴灉鍒楄〃");
+ List<VoUgResult> rsList = this.sv.selectAll(vo);
+ EasyExcel.write(response.getOutputStream())
+ .head(VoUgResult.class)
+ .excelType(ExcelTypeEnum.XLSX)
+ .sheet("鍗囩骇缁撴灉鍒楄〃")
+ .doWrite(rsList);
+ }
+
+
+ /**
+ * 璁剧疆excel涓嬭浇鍝嶅簲澶村睘鎬�
+ */
+ private void setExcelRespProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException {
+ response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
+ response.setCharacterEncoding("utf-8");
+ String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20");
+ response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
+ }
+}
--
Gitblit v1.8.0