skyline 2 роки тому
батько
коміт
9fd84189fb

+ 3 - 3
admin-web/src/views/admin/index.vue

@@ -169,7 +169,7 @@ const state = reactive({
 
 const shortcuts = [
   {
-    text: '上周',
+    text: '近7天',
     value: () => {
       const end = new Date()
       const start = new Date()
@@ -178,7 +178,7 @@ const shortcuts = [
     },
   },
   {
-    text: '上个月',
+    text: '近30天',
     value: () => {
       const end = new Date()
       const start = new Date()
@@ -187,7 +187,7 @@ const shortcuts = [
     },
   },
   {
-    text: '最近三个月',
+    text: '近90天',
     value: () => {
       const end = new Date()
       const start = new Date()

+ 13 - 2
admin/src/main/java/com/kym/admin/controller/StationController.java

@@ -1,9 +1,12 @@
 package com.kym.admin.controller;
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.kym.common.R;
 import com.kym.common.annotation.SysLog;
 import com.kym.entity.admin.Station;
 import com.kym.service.admin.StationService;
+import com.kym.service.utils.KymCache;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -26,8 +29,11 @@ public class StationController {
 
     private final StationService stationService;
 
-    public StationController(StationService stationService) {
+    private final KymCache kymCache;
+
+    public StationController(StationService stationService, @Lazy KymCache kymCache) {
         this.stationService = stationService;
+        this.kymCache = kymCache;
     }
 
     @SysLog("充电站数据统计")
@@ -44,7 +50,12 @@ public class StationController {
 
     @GetMapping("listStation")
     R listStation(@RequestParam(required = false) String stationName) {
-        var res = stationService.lambdaQuery().like(isNotNull(stationName), Station::getStationName, stationName).orderByDesc(Station::getStationId).list();
+        // 判断数据权限
+        var adminStationId = kymCache.getAdminUserStationId(StpUtil.getLoginIdAsLong());
+        var res = stationService.lambdaQuery()
+                .eq(isNotNull(adminStationId), Station::getStationId, adminStationId)
+                .like(isNotNull(stationName), Station::getStationName, stationName)
+                .orderByDesc(Station::getStationId).list();
         return R.success(res);
     }
 

+ 12 - 2
entity/src/main/java/com/kym/entity/admin/queryParams/StatQueryParam.java

@@ -16,7 +16,17 @@ public class StatQueryParam extends PageParams {
     private static final String TYPE_MONTH = "month";
 
     private String stationId;
-    private String startTime;
-    private String endTime;
     private String type;
+
+
+    /**
+     * 查询开始日期
+     */
+    private LocalDate startTime;
+
+
+    /**
+     * 查询结束日期
+     */
+    private LocalDate endTime;
 }

+ 1 - 1
entity/src/main/java/com/kym/entity/miniapp/params/ApplyInvoiceParams.java

@@ -25,7 +25,7 @@ public class ApplyInvoiceParams {
     /**
      * 发票类型:INDIVIDUAL-个人 ORGANIZATION-企业
      */
-    private int invoiceType;
+    private String invoiceType;
 
     /**
      * 发票抬头