Browse Source

洗车设备列表

skyline 1 year ago
parent
commit
c871bd77ef

+ 10 - 8
admin-web/src/views/admin/station/device/index.vue

@@ -100,13 +100,15 @@ const state = reactive({
   exportConfig: {},
   columns: [
     // {type: 'selection', width: 60, align: 'center', fixed: 'left'},
-    {label: '设备名称', prop: 'deviceName', width: 180, query: true, type: 'text', resizable: true, fixed: 'left'},
-    {label: '状态', prop: 'state', width: 180,query: true, type: 'dict', conf: {dict: 'WashDevice.status'}, resizable: true},
-    {label: '网点ID', prop: 'stationId', width: 180,query: true, type: 'text', resizable: true},
-    {label: '产品key', prop: 'productKey', width: 180, query: true, type: 'text', resizable: true},
-    {label: '设备主机状态', prop: 'fsmState', width: 180, query: true, type: 'text', resizable: true},
+    {label: '站点ID', prop: 'stationId', width: 80,query: true, type: 'text', resizable: true},
+    {label: '站点名称', prop: 'stationName', width: 150,query: true, type: 'text', resizable: true},
+    {label: '设备编号', prop: 'shortId', width: 100, query: true, type: 'text', resizable: true, fixed: 'left'},
+    // {label: '设备名称', prop: 'deviceName', width: 180, query: true, type: 'text', resizable: true, fixed: 'left'},
+    // {label: '产品key', prop: 'productKey', width: 180, query: true, type: 'text', resizable: true},
+    {label: '状态', prop: 'state', width: 90,query: true, type: 'dict', conf: {dict: 'WashDevice.status'}, resizable: true},
+    {label: '设备状态', prop: 'fsmState', width: 90, query: true, type: 'text', resizable: true},
     {
-      label: '本次运行时长', prop: 'uptimeMs', width: 180, query: false, type: 'render', resizable: true,
+      label: '运行时长', prop: 'uptimeMs', width: 100, query: false, type: 'render', resizable: true,
       render: (h: any, row: any) => {
         return (
             h('div', null,u.fmt.fmtDuration(row))
@@ -116,7 +118,7 @@ const state = reactive({
     {label: '功能', prop: 'functions', width: 180, query: true, type: 'text', resizable: true},
     {label: '是否有泡沫', prop: 'hasFoam', width: 180, query: true, type: 'dict', conf: {dict: 'WashDevice.foam'}, resizable: true},
     {label: '是否有水', prop: 'hasWater', width: 180, query: true, type: 'dict', conf: {dict: 'WashDevice.water'}, resizable: true},
-    {label: '当前温度', prop: 'temperatureChip', width: 180, query: false, type: 'text', resizable: true},
+    // {label: '当前温度', prop: 'temperatureChip', width: 180, query: false, type: 'text', resizable: true},
     {label: '创建时间', prop: 'createTime', query: false, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
     {label: '更新时间', prop: 'updateTime', query: false, sortable: 'custom', type: 'datetime', resizable: true, conf: {format: (val: any) => u.fmt.fmtDateTime(val)}},
     {
@@ -233,4 +235,4 @@ const handleRowDelete = (row: any) => {
 // defineExpose({
 //     loadData,
 // });
-</script>
+</script>

+ 24 - 9
car-wash-entity/src/main/java/com/kym/entity/miniapp/vo/WashDeviceVo.java

@@ -30,19 +30,14 @@ public class WashDeviceVo extends BaseEntity {
     private String stationId;
 
     /**
-     * 站点编号
-     */
-    private String shortId;
-
-    /**
-     * 产品key
+     * 站点名称
      */
-    private String productKey;
+    private String stationName;
 
     /**
-     * 设备名称
+     * 站点编号
      */
-    private String deviceName;
+    private String shortId;
 
     /**
      * 功能
@@ -64,4 +59,24 @@ public class WashDeviceVo extends BaseEntity {
      */
     private String fsmState;
 
+    /**
+     * 本次上电以来的时间戳
+     */
+    private String uptimeMs;
+
+    /**
+     * 是否有水:-1不支持或未开启,0无水,1有水
+     */
+    private Boolean hasWater;
+
+    /**
+     * 是否有泡沫:-1不支持或未开启,0无泡沫,1有泡沫
+     */
+    private Boolean hasFoam;
+
+    /**
+     * 板载温度传感器的温度值
+     */
+    private Integer temperatureChip;
+
 }

+ 2 - 2
car-wash-service/src/main/java/com/kym/service/miniapp/WashDeviceService.java

@@ -1,7 +1,7 @@
 package com.kym.service.miniapp;
 
+import com.kym.entity.common.PageBean;
 import com.kym.entity.miniapp.WashDevice;
-import com.kym.entity.miniapp.WashOrder;
 import com.kym.entity.miniapp.queryParams.DeviceQueryParams;
 import com.kym.entity.miniapp.vo.WashDeviceVo;
 import com.kym.service.mybatisplus.MyBaseService;
@@ -35,6 +35,6 @@ public interface WashDeviceService extends MyBaseService<WashDevice> {
 
     void add(WashDevice device);
 
-    Object list(DeviceQueryParams query);
+    PageBean<WashDeviceVo> list(DeviceQueryParams query);
     //endregion
 }

+ 10 - 10
car-wash-service/src/main/java/com/kym/service/miniapp/impl/WashDeviceServiceImpl.java

@@ -1,18 +1,11 @@
 package com.kym.service.miniapp.impl;
 
 import cn.dev33.satoken.stp.StpUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.PageHelper;
-import com.github.yulichang.toolkit.JoinWrappers;
-import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import com.kym.common.utils.CommUtil;
 import com.kym.entity.common.PageBean;
-import com.kym.entity.miniapp.OrderRechargeRights;
-import com.kym.entity.miniapp.UserRechargeRights;
 import com.kym.entity.miniapp.WashDevice;
-import com.kym.entity.miniapp.WashStation;
 import com.kym.entity.miniapp.queryParams.DeviceQueryParams;
-import com.kym.entity.miniapp.vo.UserOrderRechargeRightsVo;
 import com.kym.entity.miniapp.vo.WashDeviceVo;
 import com.kym.mapper.miniapp.WashDeviceMapper;
 import com.kym.service.cache.KymCache;
@@ -139,13 +132,20 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
     }
 
     @Override
-    public Object list(DeviceQueryParams query) {
+    public PageBean<WashDeviceVo> list(DeviceQueryParams query) {
         PageHelper.startPage(query.getPageNum(), query.getPageSize());
         List<WashDevice> list = lambdaQuery()
-                .like(CommUtil.isNotEmptyAndNull(query.getDeviceName()), WashDevice::getDeviceName, query.getDeviceName())
                 .eq(CommUtil.isNotEmptyAndNull(query.getStationId()), WashDevice::getStationId, query.getStationId())
                 .list();
-        return new PageBean<>(list);
+        var voList = new ArrayList<WashDeviceVo>();
+        list.forEach(item -> {
+            var vo = new WashDeviceVo();
+            BeanUtils.copyProperties(item, vo);
+            vo.setShortId(KymCache.INSTANCE.getShortIdByProductKeyAndDeviceName(item.getProductKey(), item.getDeviceName()));
+            vo.setStationName(KymCache.INSTANCE.getStationNameById(item.getStationId()));
+            voList.add(vo);
+        });
+        return new PageBean<>(voList);
     }
 
     //endregion