From 80e22bcc7af8aebed7443965655542fbe4966708 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期三, 09 四月 2025 15:11:55 +0800 Subject: [PATCH] 灌溉计划删除,所有命令发布都失败依然允许终止 --- pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java | 74 ++++++++++++++++++------------------- 1 files changed, 36 insertions(+), 38 deletions(-) diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java index 305f725..317d3c1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/issue/IssueCtrl.java @@ -1,6 +1,5 @@ package com.dy.pipIrrWechat.issue; -import com.alibaba.fastjson2.JSONArray; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; @@ -8,7 +7,7 @@ import com.dy.pipIrrGlobal.pojoSe.SeReportReply; import com.dy.pipIrrGlobal.voSe.VoIssueReport; import com.dy.pipIrrGlobal.voSe.VoIssueReportReply; -import com.dy.pipIrrWechat.issue.dto.DtoIssueReport; +import com.dy.pipIrrWechat.issue.dto.DtoDeleteParam; import com.dy.pipIrrWechat.issue.dto.DtoReportReply; import com.dy.pipIrrWechat.issue.qo.QoIssueReport; import jakarta.validation.Valid; @@ -18,7 +17,6 @@ import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.*; -import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Objects; @@ -46,34 +44,14 @@ */ @PostMapping(path = "addIssueReport") @Transactional(rollbackFor = Exception.class) - public BaseResponse<Boolean> addIssueReport(@RequestBody @Valid DtoIssueReport po, BindingResult bindingResult) { + public BaseResponse<Boolean> addIssueReport(@RequestBody @Valid SeIssueReport po, BindingResult bindingResult) { if(bindingResult != null && bindingResult.hasErrors()){ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - Long clientId = po.getClientId(); - String phone = Optional.ofNullable(po.getPhone()).orElse(""); - BigDecimal lng = Optional.ofNullable(po.getLng()).orElse(BigDecimal.valueOf(0)); - BigDecimal lat = Optional.ofNullable(po.getLat()).orElse(BigDecimal.valueOf(0)); - String content = Optional.ofNullable(po.getContent()).orElse(""); - JSONArray images = Optional.ofNullable(po.getImages()).orElse(new JSONArray()); - JSONArray audios = Optional.ofNullable(po.getAudios()).orElse(new JSONArray()); - JSONArray videos = Optional.ofNullable(po.getVideos()).orElse(new JSONArray()); - - SeIssueReport seIssueReport = new SeIssueReport(); - seIssueReport.setClientId(clientId); - seIssueReport.setPhone(phone); - seIssueReport.setLng(lng); - seIssueReport.setLat(lat); - seIssueReport.setContent(content); - seIssueReport.setImages(images); - seIssueReport.setAudios(audios); - seIssueReport.setVideos(videos); - seIssueReport.setReportTime(new Date()); - seIssueReport.setState((byte)1); - Long issueReportId = issueSv.insertIssueReport(seIssueReport); - if(issueReportId == null) { - return BaseResponseUtils.buildErrorMsg("鍐滄埛闂涓婃姤澶辫触"); + String result = issueSv.addIssueReport(po); + if(!result.equals("success")) { + return BaseResponseUtils.buildErrorMsg(result); } return BaseResponseUtils.buildSuccess(true) ; @@ -87,8 +65,8 @@ @GetMapping(path = "/getIssueReports") public BaseResponse<QueryResultVo<List<VoIssueReport>>> getIssueReports(QoIssueReport vo) { try { - QueryResultVo<List<VoIssueReport>> res = issueSv.getIssueReports(vo); - return BaseResponseUtils.buildSuccess(res); + //QueryResultVo<List<VoIssueReport_temp>> res = issueSv.getIssueReports(vo); + return BaseResponseUtils.buildSuccess(issueSv.getIssueReports(vo)); } catch (Exception e) { log.error("鑾峰彇鍐滄埛闂涓婃姤璁板綍寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); @@ -96,23 +74,29 @@ } /** - * 閫昏緫鍒犻櫎鍐滄埛闂涓婃姤 - * @param issueReportId + * 閫昏緫鍒犻櫎鍐滄埛闂涓婃姤锛屽垹闄ゅ墠鍏堝垽鏂鍒犻櫎鐨勪笂鎶ユ槸鍚﹀瓨鍦� + * @param po + * @param bindingResult * @return */ @PostMapping(path = "deleteIssueReport") - public BaseResponse<Boolean> deleteIssueReport(@RequestParam("issueReportId") Long issueReportId) { - if (issueReportId == null) { - return BaseResponseUtils.buildErrorMsg("鏈�夋嫨瑕佸垹闄ょ殑鍐滄埛闂涓婃姤"); + public BaseResponse<Boolean> deleteIssueReport(@RequestBody @Valid DtoDeleteParam po, BindingResult bindingResult) { + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + + // 鏍规嵁涓婃姤ID鍙婂啘鎴稩D鑾峰彇鏈垹闄ょ殑涓婃姤锛屽垹闄や笂鎶ュ垽鏂娇鐢� + SeIssueReport seIssueReport = issueSv.getReport(po.getIssueReportId(), po.getClientId()); + if(seIssueReport == null) { + return BaseResponseUtils.buildErrorMsg("鎮ㄨ鍒犻櫎鐨勯棶棰樹笂鎶ヤ笉瀛樺湪"); } try { - //鍙栨按鍙D - Integer recordCount = Optional.ofNullable(issueSv.deleteIssueReport(issueReportId)).orElse(0); + Integer recordCount = Optional.ofNullable(issueSv.deleteIssueReport(po.getIssueReportId())).orElse(0); if (recordCount == 0) { return BaseResponseUtils.buildErrorMsg("鍐滄埛闂涓婃姤鍒犻櫎澶辫触"); - } else { - return BaseResponseUtils.buildSuccess(true); + }else { + return BaseResponseUtils.buildSuccess(); } } catch (Exception e) { log.error("鍐滄埛闂涓婃姤鍒犻櫎澶辫触", e); @@ -133,6 +117,7 @@ return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } + // 娣诲姞涓婃姤鍥炲璁板綍 SeReportReply seReportReply = new SeReportReply(); seReportReply.setReportId(po.getReportId()); seReportReply.setReplyContent(po.getReplyContent()); @@ -141,6 +126,15 @@ Long reportReplyId = issueSv.insertReportReply(seReportReply); if(reportReplyId == null) { return BaseResponseUtils.buildErrorMsg("鍥炲鍐滄埛闂涓婃姤澶辫触"); + } + + // 淇敼闂涓婃姤鐘舵�佷负宸插洖澶� + SeIssueReport seIssueReport = new SeIssueReport(); + seIssueReport.setId(po.getReportId()); + seIssueReport.setState((byte)2); + Integer issueReportId = issueSv.updateIssueReport(seIssueReport); + if(issueReportId == null) { + return BaseResponseUtils.buildErrorMsg("鍐滄埛闂涓婃姤淇敼澶辫触"); } return BaseResponseUtils.buildSuccess(true) ; @@ -153,6 +147,10 @@ */ @GetMapping(path = "/getReportReply") public BaseResponse<VoIssueReportReply> getReportReply(@RequestParam("reportId") Long reportId) { + if(reportId == null) { + return BaseResponseUtils.buildErrorMsg("璇烽�夋嫨涓�涓棶棰樹笂鎶�"); + } + try { return BaseResponseUtils.buildSuccess(issueSv.getReportReplyByReportId(reportId)); } catch (Exception e) { -- Gitblit v1.8.0