skyline před 2 roky
rodič
revize
c7241484f8

+ 2 - 2
admin-web/src/views/admin/station/stat/dialog.vue

@@ -211,7 +211,7 @@ const onSubmit = () => {
     // console.log('basic checkForm!', valid,fields)
     if (valid) {
       state.btnLoading = true;
-      const url = state.ruleForm.id > 0 ? "stationStatMonth/modify" : "stationStatMonth/add"
+      const url = state.ruleForm.id > 0 ? "/stat/modifyStationStatMonth" : "stationStatMonth/add"
       $body(url, state.ruleForm).then(() => {
         state.btnLoading = false;
         Msg.message('操作成功');
@@ -233,7 +233,7 @@ const handleFormChange = (formData: any) => {
 
 // 初始化表格数据
 const loadData = (id: any) => {
-  $get(`stationStatMonth/detail/${id}`).then((res: any) => {
+  $get(`/stat/getStationStatMonth/${id}`).then((res: any) => {
     state.ruleForm = res;
   })
 }

+ 16 - 19
admin-web/src/views/admin/station/stat/index.vue

@@ -43,21 +43,17 @@
 
         <ext-select
             v-model="state.formQuery.stationId"
-            multiple
             placeholder="站点"
+            clearable
             url="station/listStation"
-            url-method="get"
+            urlMethod="get"
+            data-key=""
             label-key="stationName"
             value-key="stationId"
             @on-change="loadData(true)"
-            data-key=""
-            clearable
             class="wd150 mr10">
         </ext-select>
 
-
-
-
         <el-button class="ml10"  plain size="default" type="success" @click="loadData(true)">
           <SvgIcon name="ele-Search"/>
           查询
@@ -149,18 +145,19 @@ const state = reactive({
     data: [] as Array < any >,
     loading: false,
     columns: [
-      {label: '站点', prop: 'stationId', resizable: true,width:150,fixed:'left'},
-      {label: '统计时间', prop: 'statMonth', resizable: true,width:130},
-      {label: '总充电费用', prop: 'totalMoney', resizable: true,width:130},
-      {label: '总电费', prop: 'elecMoney', resizable: true,width:130},
-      {label: '实际抄表电费金额', prop: 'actualElecMoney', resizable: true,width:160},
-      {label: '总服务费', prop: 'serviceMoney', resizable: true,width:130},
-      {label: '服务费优惠金额', prop: 'serviceMoneyDiscount', resizable: true,width:160},
-      {label: '总优惠金额', prop: 'discountAmount', resizable: true,width:130},
-      {label: '充电人数', prop: 'chargeUsers', resizable: true,width:130},
-      {label: '订单平均充电费用', prop: 'avgOrderMoney', resizable: true,width:160},
-      {label: '充电有效订单数', prop: 'validOrders', resizable: true,width:160},
-      {label: '创建时间', prop: 'createTime', sortable: 'custom', resizable: true,width:200,fixed: 'right',},
+      {label: '站点', prop: 'stationId', resizable: true,width:140,fixed:'left'},
+      {label: '统计时间', prop: 'statMonth', resizable: true,width:90},
+      {label: '订单金额', prop: 'totalMoney', resizable: true,width:100},
+      {label: '订单电费', prop: 'elecMoney', resizable: true,width:100},
+      {label: '实际抄表电费', prop: 'actualElecMoney', resizable: true,width:120},
+      {label: '订单服务费', prop: 'serviceMoney', resizable: true,width:110},
+      {label: '服务费优惠金额', prop: 'serviceMoneyDiscount', resizable: true,width:135},
+      {label: '总优惠金额', prop: 'discountAmount', resizable: true,width:110},
+      {label: '充电人数', prop: 'chargeUsers', resizable: true,width:100},
+      {label: '充电有效订单数', prop: 'validOrders', resizable: true,width:135},
+      {label: '订单平均充电费用', prop: 'avgOrderMoney', resizable: true,width:145},
+      {label: '单枪平均日充电量', prop: 'avgConnectorElec', resizable: true,width:145},
+      // {label: '创建时间', prop: 'createTime', sortable: 'custom', resizable: true,width:200,fixed: 'right',},
       {
         label: '操作', prop: 'action', width: 180, align: 'center', fixed: 'right',
       }

+ 12 - 0
admin/src/main/java/com/kym/admin/controller/StatController.java

@@ -1,6 +1,7 @@
 package com.kym.admin.controller;
 
 import com.kym.common.R;
+import com.kym.entity.admin.StationStatMonth;
 import com.kym.entity.admin.queryParams.StatQueryParam;
 import com.kym.entity.admin.queryParams.StatementsQueryParam;
 import com.kym.service.admin.StationStatMonthService;
@@ -78,5 +79,16 @@ public class StatController {
         return R.success(stationStatMonthService.getById(statMonthId));
     }
 
+    /**
+     * 修改站点月统计数据(填写电费账单数据)
+     *
+     * @param stationStatMonth
+     * @return
+     */
+    @PostMapping("/modifyStationStatMonth")
+    R<?> modifyStationStatMonth(@RequestBody StationStatMonth stationStatMonth) {
+        stationStatMonthService.modifyStationStatMonth(stationStatMonth);
+        return R.success();
+    }
 
 }

+ 7 - 4
entity/src/main/java/com/kym/entity/admin/StationStatMonth.java

@@ -1,13 +1,12 @@
 package com.kym.entity.admin;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.kym.entity.BaseEntity;
 import lombok.Getter;
 import lombok.Setter;
 import lombok.experimental.Accessors;
 
-import java.time.LocalDate;
-
 /**
  * <p>
  * 站点统计表-月
@@ -29,6 +28,12 @@ public class StationStatMonth extends BaseEntity {
      */
     private String stationId;
 
+    /**
+     * 站点名称
+     */
+    @TableField(exist = false)
+    private String stationName;
+
     /**
      * 统计时间
      */
@@ -103,6 +108,4 @@ public class StationStatMonth extends BaseEntity {
      * 实际抄表电费金额(分)
      */
     private Integer actualElecMoney;
-
-
 }

+ 2 - 0
service/src/main/java/com/kym/service/admin/StationStatMonthService.java

@@ -16,4 +16,6 @@ import com.kym.entity.common.PageBean;
 public interface StationStatMonthService extends IService<StationStatMonth> {
 
     PageBean<StationStatMonth> listStatMonth(StatementsQueryParam params);
+
+    void modifyStationStatMonth(StationStatMonth stationStatMonth);
 }

+ 12 - 1
service/src/main/java/com/kym/service/admin/impl/StationStatMonthServiceImpl.java

@@ -8,6 +8,7 @@ import com.kym.entity.admin.queryParams.StatementsQueryParam;
 import com.kym.entity.common.PageBean;
 import com.kym.mapper.admin.StationStatMonthMapper;
 import com.kym.service.admin.StationStatMonthService;
+import com.kym.service.cache.KymCache;
 import org.springframework.stereotype.Service;
 
 /**
@@ -29,6 +30,16 @@ public class StationStatMonthServiceImpl extends ServiceImpl<StationStatMonthMap
                 .eq(!CommUtil.isEmptyOrNull(params.getStatMonth()), StationStatMonth::getStatMonth, params.getStatMonth())
                 .orderByDesc(StationStatMonth::getStatMonth)
                 .list();
-        return new PageBean<>(res);
+        var page = new PageBean<>(res);
+        page.setList(res.stream().peek(item -> item.setStationName(KymCache.INSTANCE.getStationNameById(item.getStationId()))).toList());
+        return page;
+    }
+
+    @Override
+    public void modifyStationStatMonth(StationStatMonth stationStatMonth) {
+        lambdaUpdate().eq(StationStatMonth::getId, stationStatMonth.getId())
+                .set(CommUtil.isNotEmptyAndNull(stationStatMonth.getActualPower()), StationStatMonth::getActualPower, stationStatMonth.getActualPower())
+                .set(CommUtil.isNotEmptyAndNull(stationStatMonth.getActualElecMoney()), StationStatMonth::getActualElecMoney, stationStatMonth.getActualElecMoney())
+                .update();
     }
 }