From 46614cb8c1183379694f807c872b6e6bcac932b6 Mon Sep 17 00:00:00 2001 From: ajaxfan <909938737@qq.com> Date: Sat, 6 Mar 2021 09:41:43 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=88=86=E9=A1=B5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/ebtp/extend/bizmessage/dto/PageDTO.java | 10 ++++++++-- .../service/impl/BizMessageConsumerServiceImpl.java | 3 +-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/dto/PageDTO.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/dto/PageDTO.java index b22ef55..023f147 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/dto/PageDTO.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/dto/PageDTO.java @@ -13,11 +13,17 @@ public class PageDTO { @ApiModelProperty(required = false, value = "当前页(默认1)") private int current; - + @ApiModelProperty(required = false, value = "页码(默认1)") private int pageNo; - + @ApiModelProperty(required = false, value = "单页数量(默认15)") private int pageSize; + public PageDTO() { + this.current = 1; + this.pageNo = 1; + this.pageSize = 15; + } + } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/service/impl/BizMessageConsumerServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/service/impl/BizMessageConsumerServiceImpl.java index bb99c71..7d1711b 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/service/impl/BizMessageConsumerServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizmessage/service/impl/BizMessageConsumerServiceImpl.java @@ -69,14 +69,13 @@ public class BizMessageConsumerServiceImpl implements BizMessageConsumerService * @return */ private PageDTO createPageCondition(PageDTO page) { - page = Optional.ofNullable(page).map(p -> { + return Optional.ofNullable(page).map(p -> { p.setCurrent(Math.max(1, p.getCurrent())); p.setPageNo(Math.max(1, p.getPageNo())); p.setPageSize(p.getPageSize() == 0 ? 15 : p.getPageSize()); return p; }).orElseGet(PageDTO::new); - return page; } } From c845ff5237ab483d3bc46b27f8d96563cca01f16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Thu, 18 Mar 2021 10:39:50 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bizbidnotice/controller/BizBidNoticeController.java | 9 +++++++++ .../bizbidshared/controller/BizBidSharedController.java | 4 ++++ .../controller/BizBidSharedRecordController.java | 4 ++++ .../ebtp/extend/export/controller/ExportController.java | 3 +++ 4 files changed, 20 insertions(+) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/controller/BizBidNoticeController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/controller/BizBidNoticeController.java index a7563a2..b17fb7d 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/controller/BizBidNoticeController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidnotice/controller/BizBidNoticeController.java @@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -63,6 +64,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("查询所有列表") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/allList") public BaseResponse> getAll(@RequestBody BizBidNoticeVO bizBidNotice) { @@ -83,6 +85,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("插入新数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/add") public BaseResponse insert( @ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidNotice bizBidNotice) { @@ -100,6 +103,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("修改数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/update") public BaseResponse update( @ApiParam(value = "对象数据", required = true) @RequestBody BizBidNotice bizBidNotice) { @@ -114,6 +118,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("发布数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/fabu/{id}") public BaseResponse fabu(@ApiParam(value = "主键id", required = true) @PathVariable String id) { BizBidNotice notice = new BizBidNotice(); @@ -129,6 +134,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("发布数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/qxfabu/{id}") public BaseResponse qxfabu(@ApiParam(value = "主键id", required = true) @PathVariable String id) { @@ -145,6 +151,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("置顶数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/top/{id}") public BaseResponse top(@ApiParam(value = "主键id", required = true) @PathVariable String id) { @@ -162,6 +169,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("取消置顶数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/qxtop/{id}") public BaseResponse qxtop(@ApiParam(value = "主键id", required = true) @PathVariable String id) { @@ -190,6 +198,7 @@ public class BizBidNoticeController { * @return */ @ApiOperation("删除数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/delete/{id}") public BaseResponse delete(@ApiParam(value = "主键id", required = true) @PathVariable String id) { return BaseResponse.success(ibizBidNoticeService.removeById(id)); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java index 995d15c..7744bfd 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidshared/controller/BizBidSharedController.java @@ -11,6 +11,7 @@ import com.chinaunicom.mall.ebtp.extend.bizbidshared.service.IBizBidSharedServic import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -44,6 +45,7 @@ public class BizBidSharedController { * @return */ @ApiOperation("插入新数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/add") public BaseResponse insert(@ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidShared bizBidShared) { if (StringUtils.isEmpty(bizBidShared.getId())) { @@ -62,6 +64,7 @@ public class BizBidSharedController { * @return */ @ApiOperation("修改数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("") public BaseResponse update(@ApiParam(value = "对象数据", required = true) @RequestBody BizBidShared bizBidShared) { return BaseResponse.success(ibizBidSharedService.updateById(bizBidShared)); @@ -86,6 +89,7 @@ public class BizBidSharedController { * @return */ @ApiOperation("删除数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/delete/{id}") public BaseResponse delete(@ApiParam(value = "主键id", required = true) @PathVariable String id) { return BaseResponse.success(ibizBidSharedService.removeById(id)); diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java index 8b5d35b..743ec41 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java @@ -13,6 +13,7 @@ import com.chinaunicom.mall.ebtp.extend.bizbidsharedrecord.service.IBizBidShared import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -35,6 +36,7 @@ public class BizBidSharedRecordController { * @return */ @ApiOperation("查询数据列表") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/list/{id}") public BasePageResponse getList(@PathVariable("id") String id, @ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidSharedRecordVO bizBidShared) { @@ -49,6 +51,7 @@ public class BizBidSharedRecordController { * @return */ @ApiOperation("插入新数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/add") public BaseResponse insert( @ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidShared bizBidShared) { @@ -72,6 +75,7 @@ public class BizBidSharedRecordController { * @return */ @ApiOperation("修改数据") + @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PutMapping("") public BaseResponse update( @ApiParam(value = "对象数据", required = true) @RequestBody BizBidSharedRecord bizBidSharedRecord) { diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/export/controller/ExportController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/export/controller/ExportController.java index c7bf2d6..0ed055a 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/export/controller/ExportController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/export/controller/ExportController.java @@ -7,6 +7,7 @@ import com.chinaunicom.mall.ebtp.extend.export.service.ExportServiceFactory; import com.chinaunicom.mall.ebtp.extend.export.service.IBizExportDictService; import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; @@ -38,6 +39,7 @@ public class ExportController { * @param request * @param response */ + @PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')") @GetMapping(value = "/{type}") public void export(@PathVariable String type, ExportParame param, HttpServletRequest request, HttpServletResponse response) { exportServiceFactory.getService(type).doExport(param, request, response); @@ -49,6 +51,7 @@ public class ExportController { * @param roomId * @return */ + @PreAuthorize("hasAnyAuthority('ebtp-purchase','ebtp-agency-project-manager')") @GetMapping("/list/{roomId}") public BaseResponse>> list(@PathVariable String roomId) { From f6a1a0d3606e6029c20da8c3fb384a777bbf8939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=98=E5=BA=86=E5=90=89?= <51312040@qq.com> Date: Thu, 18 Mar 2021 10:41:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/BizBidSharedRecordController.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java index 743ec41..5970c70 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizbidsharedrecord/controller/BizBidSharedRecordController.java @@ -51,7 +51,6 @@ public class BizBidSharedRecordController { * @return */ @ApiOperation("插入新数据") - @PreAuthorize("hasAnyAuthority('ebtp-system-admin')") @PostMapping("/add") public BaseResponse insert( @ApiParam(value = "对象数据", required = true) @RequestBody @Valid BizBidShared bizBidShared) {