From a55b77017e8763d0fe044a30b39f37dc9ebb9dbb Mon Sep 17 00:00:00 2001 From: liuxm <liuxm_a@163.com> Date: 星期二, 21 五月 2024 14:19:28 +0800 Subject: [PATCH] 返回文件原始名和扩展名 --- pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java | 66 +++++++++++++++++++++++++++----- 1 files changed, 55 insertions(+), 11 deletions(-) diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java index df860b6..80bc77c 100644 --- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proSR/ProSRCtrl.java @@ -6,7 +6,9 @@ import com.dy.common.webUtil.BaseResponseUtils; import com.dy.common.webUtil.QueryResultVo; import com.dy.pmsGlobal.aop.Log; +import com.dy.pmsGlobal.pojoBa.BaRole; import com.dy.pmsGlobal.pojoPlt.PltProductScrappingReason; +import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -37,18 +39,25 @@ * @return */ @PostMapping(path="save") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300011") @Log("淇濆瓨浜у搧璁惧鎶ュ簾鍘熷洜") - public BaseResponse<PltProductScrappingReason> save(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ + public BaseResponse<Boolean> save(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ + int count; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } + reason.disabled = false; reason.deleted = false; - return BaseResponseUtils.buildSuccess(sv.save(reason)); + count = sv.save(reason); }catch (Exception e){ log.error("淇濆瓨浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -60,17 +69,23 @@ * @return */ @PostMapping(path="update") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300011") @Log("鏇存柊浜у搧璁惧鎶ュ簾鍘熷洜") - public BaseResponse<PltProductScrappingReason> update(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ + public BaseResponse<Boolean> update(@RequestBody @Valid PltProductScrappingReason reason,BindingResult bindingResult){ + int count; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - return BaseResponseUtils.buildSuccess(sv.update(reason)); + count = sv.update(reason); }catch (Exception e){ log.error("鏇存柊浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -80,14 +95,20 @@ * @return */ @GetMapping(path="delete") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300011") @Log("鍒犻櫎浜у搧璁惧鎶ュ簾鍘熷洜") - public BaseResponse<PltProductScrappingReason> delete(String id){ + public BaseResponse<Boolean> delete(String id){ + int count; try { - return BaseResponseUtils.buildSuccess(sv.delete(Long.parseLong(id))); + count = sv.delete(Long.parseLong(id)); }catch (Exception e){ log.error("鍒犻櫎浜у搧璁惧鎶ュ簾鍘熷洜寮傚父", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -98,7 +119,7 @@ * @return */ @GetMapping(path="one") - @SsoPowerAop(power = "10300000") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� + @SsoPowerAop(power = "10300010") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� @Log("鏍规嵁ID鏌ヨ浜у搧璁惧鎶ュ簾鍘熷洜") public BaseResponse<PltProductScrappingReason> one(String id){ try{ @@ -116,7 +137,7 @@ * @return */ @PostMapping(path="some") - @SsoPowerAop(power = "10300000") + @SsoPowerAop(power = "10300010") @Log("鏌ヨ浜у搧璁惧鎶ュ簾鍘熷洜") public BaseResponse<QueryResultVo<List<PltProductScrappingReason>>> some(@RequestBody QueryVo vo){ try { @@ -128,5 +149,28 @@ } } + /** + * 绂佺敤鎴栧惎鐢� + * @param reason + * @return + */ + @PostMapping(path="disabled") + @SsoPowerAop(power = "10100011") + @Log("绂佺敤鎴栧惎鐢ㄦ姤搴熷師鍥�") + public BaseResponse<Boolean> disabled(@RequestBody PltProductUnqualifiedReason reason){ + int count; + try { + count = sv.disabled(reason.id,reason.disabled); + }catch (Exception e){ + log.error("绂佺敤鎴栧惎鐢ㄦ姤搴熷師鍥犲紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); + } + } + } -- Gitblit v1.8.0