Browse Source

增加权限

xusonglin 5 years ago
parent
commit
6d45c5f339

+ 4 - 0
src/main/java/com/jkcredit/invoice/hub/controller/web/record/BillRecordResource.java

@@ -20,6 +20,7 @@ import com.jkcredit.invoice.hub.spi.web.data.ResponseData;
 import com.jkcredit.invoice.hub.util.BeanUtil;
 import com.jkcredit.invoice.hub.util.BeanUtil;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 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.GetMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
@@ -40,6 +41,7 @@ public class BillRecordResource extends WebResource {
     @Autowired
     @Autowired
     ConsumptionStatisticsService consumptionStatisticsService;
     ConsumptionStatisticsService consumptionStatisticsService;
 
 
+    @PreAuthorize("hasPermission('record','read')")
     @GetMapping("/billRecord")
     @GetMapping("/billRecord")
     public ResponseData billRecord(Page page, BillRecordFB fb) {
     public ResponseData billRecord(Page page, BillRecordFB fb) {
         try {
         try {
@@ -53,6 +55,7 @@ public class BillRecordResource extends WebResource {
         }
         }
     }
     }
 
 
+    @PreAuthorize("hasPermission('record','read')")
     @GetMapping("/invoiceRecord")
     @GetMapping("/invoiceRecord")
     public ResponseData invoiceRecord(Page page, InvoiceRecordFB fb) {
     public ResponseData invoiceRecord(Page page, InvoiceRecordFB fb) {
         try {
         try {
@@ -66,6 +69,7 @@ public class BillRecordResource extends WebResource {
         }
         }
     }
     }
 
 
+    @PreAuthorize("hasPermission('consumption','read')")
     @GetMapping("/consumptionStatistics")
     @GetMapping("/consumptionStatistics")
     public ResponseData consumptionStatistics(Page page, ConsumptionStatisticsFB fb) {
     public ResponseData consumptionStatistics(Page page, ConsumptionStatisticsFB fb) {
         try {
         try {