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/proItems/ProItemsCtrl.java | 65 +++++++++++++++++++++++++++----- 1 files changed, 54 insertions(+), 11 deletions(-) diff --git a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java index ef11a70..8abe361 100644 --- a/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java +++ b/pms-parent/pms-web-platform/src/main/java/com/dy/pmsPlatform/proItems/ProItemsCtrl.java @@ -6,8 +6,10 @@ 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.PltProductParams; import com.dy.pmsGlobal.pojoPlt.PltProductQualityInspectionItems; +import com.dy.pmsGlobal.pojoPlt.PltProductUnqualifiedReason; import jakarta.validation.Valid; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -38,18 +40,25 @@ * @return */ @PostMapping(path="save") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300003") @Log("淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�") - public BaseResponse<PltProductParams> save(@RequestBody @Valid PltProductQualityInspectionItems item, BindingResult bindingResult){ + public BaseResponse<Boolean> save(@RequestBody @Valid PltProductQualityInspectionItems item, BindingResult bindingResult){ + int count = 0; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } item.deleted = false; - return BaseResponseUtils.buildSuccess(sv.save(item)); + item.disabled = false; + count =sv.save(item); }catch (Exception e){ log.error("淇濆瓨浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -61,17 +70,23 @@ * @return */ @PostMapping(path="update") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300003") @Log("鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�") - public BaseResponse<PltProductParams> update(@RequestBody @Valid PltProductQualityInspectionItems item,BindingResult bindingResult){ + public BaseResponse<Boolean> update(@RequestBody @Valid PltProductQualityInspectionItems item,BindingResult bindingResult){ + int count ; try { if (bindingResult != null && bindingResult.hasErrors()) { return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); } - return BaseResponseUtils.buildSuccess(sv.update(item)); + count = sv.update(item); }catch (Exception e){ log.error("鏇存柊浜у搧鍝佽川妫�鏌ラ」鐩紓甯�", e); return BaseResponseUtils.buildException(e.getMessage()); + } + if (count <= 0) { + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�"); + } else { + return BaseResponseUtils.buildSuccess(true); } } @@ -81,14 +96,20 @@ * @return */ @GetMapping(path="delete") - @SsoPowerAop(power = "10300001") + @SsoPowerAop(power = "10300003") @Log("鍒犻櫎浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�") - public BaseResponse<PltProductQualityInspectionItems> 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); } } @@ -99,7 +120,7 @@ * @return */ @GetMapping(path="one") - @SsoPowerAop(power = "10300000") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� + @SsoPowerAop(power = "10300002") //鐧诲綍涓庢潈闄愬悓鏃堕獙璇� @Log("鏍规嵁ID鏌ヨ浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�") public BaseResponse<PltProductQualityInspectionItems> one(String id){ try{ @@ -117,7 +138,7 @@ * @return */ @PostMapping(path="some") - @SsoPowerAop(power = "10300000") + @SsoPowerAop(power = "10300002") @Log("鏌ヨ浜у搧鍝佽川妫�鏌ラ」鐩俊鎭�") public BaseResponse<QueryResultVo<List<PltProductQualityInspectionItems>>> some(@RequestBody QueryVo vo){ try { @@ -128,6 +149,28 @@ return BaseResponseUtils.buildException(e.getMessage()); } } + /** + * 绂佺敤鎴栧惎鐢� + * @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