Browse Source

质检商户可看未激活设备

谭斌 1 year ago
parent
commit
a3192fbc9b

+ 8 - 1
device-api-service/src/main/java/com/xy/service/DeviceInfoServiceImpl.java

@@ -648,6 +648,12 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         Long mercId = dto.getMercId();
         String deviceName = dto.getDeviceName();
         Long deviceId = dto.getDeviceId();
+        boolean isQa = false;
+        if ("393010594508869".equals(String.valueOf(mercId))) {
+            isQa = true;
+        } else {
+            dto.setActiveState("1");
+        }
         List<DeviceInfoDto.MercHomeCountVO> list = this.baseMapper.merHomeCountList(dto);
         if (CollUtil.isEmpty(list)) {
             return R.ok(Collections.emptyList());
@@ -655,7 +661,8 @@ public class DeviceInfoServiceImpl extends ServiceImpl<DeviceInfoMapper, DeviceI
         List<DeviceInfoDto.MercHomeListVO> dataList = new ArrayList<>(list.size());
 
         LambdaQueryWrapper<DeviceInfo> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(DeviceInfo::getActiveState, DeviceActiveStateEnum.TRUE.getCode());
+        //非质检商户才需要激活
+        lqw.eq(!isQa, DeviceInfo::getActiveState, DeviceActiveStateEnum.TRUE.getCode());
         lqw.eq(mercId != null, DeviceInfo::getMercId, mercId);
         lqw.eq(deviceId != null, DeviceInfo::getDeviceId, deviceId);
         lqw.like(StrUtil.isNotEmpty(deviceName), DeviceInfo::getDeviceName, deviceName).orderByAsc(true, DeviceInfo::getDeviceName, DeviceInfo::getDeviceId);

+ 103 - 100
device-api-service/src/main/resources/mapper/DeviceInfoMapper.xml

@@ -87,96 +87,96 @@
     <!-- 分页查询 -->
     <select id="queryPage" resultMap="queryPageMap">
         select info.*,
-               dr.register_num,
-               dr.device_sn        as dr_device_sn,
-               dr.device_pc,
-               dr.asset_no,
-               dr.create_time      as
-                                      dr_create_time,
-               dr.create_user,
-               sysinfo.device_sn   as sysinfo_device_sn,
-               sysinfo.android_start_app_version,
-               sysinfo.android_version,
-               sysinfo.android_root_state,
-               sysinfo.android_model,
-               sysinfo.sys_launcher,
-               sysinfo.sys_timezone,
-               sysinfo.sys_datetimeauto,
-               sysinfo.sys_timezhoneauto,
-               sysinfo.app_upm_version,
-               sysinfo.app_downm_version,
-               sysinfo.sim_iccid,
-               sysinfo.sim_isp,
-               sysinfo.sim_company,
-               sysinfo.disk_space,
-               sysinfo.memery_space,
-               sysinfo.create_time as sysinfo_create_time,
-               status.sys_start_time,
-               status.sys_cur_time,
-               status.sys_power,
-               status.wifi_open,
-               status.blooth_open,
-               status.net_state,
-               status.net_type,
-               status.net_dbm,
-               status.door_state_l,
-               status.door_state_r,
-               status.lock_state_l,
-               status.lock_state_r,
-               status.temp_value,
-               status.temp_state,
-               status.voice_volume,
-               status.light_main,
-               status.light_second,
-               status.disk_space   as status_disk_space,
-               status.disk_remain_space,
-               status.memery_remain_space,
-               status.camera_l_main_state,
-               status.camera_l_second_state,
-               status.camera_r_main_state,
-               status.camera_r_second_state,
-               status.device_state_l,
-               status.device_state_r,
-               status.update_time  as status_update_time,
-               status.stock,
-               status.after_fill_stock,
-               status.stock_status,
-               mp.place_name,
-               ml.line_name        as place_line_name,
-               sr.name             as district_name
+        dr.register_num,
+        dr.device_sn as dr_device_sn,
+        dr.device_pc,
+        dr.asset_no,
+        dr.create_time as
+        dr_create_time,
+        dr.create_user,
+        sysinfo.device_sn as sysinfo_device_sn,
+        sysinfo.android_start_app_version,
+        sysinfo.android_version,
+        sysinfo.android_root_state,
+        sysinfo.android_model,
+        sysinfo.sys_launcher,
+        sysinfo.sys_timezone,
+        sysinfo.sys_datetimeauto,
+        sysinfo.sys_timezhoneauto,
+        sysinfo.app_upm_version,
+        sysinfo.app_downm_version,
+        sysinfo.sim_iccid,
+        sysinfo.sim_isp,
+        sysinfo.sim_company,
+        sysinfo.disk_space,
+        sysinfo.memery_space,
+        sysinfo.create_time as sysinfo_create_time,
+        status.sys_start_time,
+        status.sys_cur_time,
+        status.sys_power,
+        status.wifi_open,
+        status.blooth_open,
+        status.net_state,
+        status.net_type,
+        status.net_dbm,
+        status.door_state_l,
+        status.door_state_r,
+        status.lock_state_l,
+        status.lock_state_r,
+        status.temp_value,
+        status.temp_state,
+        status.voice_volume,
+        status.light_main,
+        status.light_second,
+        status.disk_space as status_disk_space,
+        status.disk_remain_space,
+        status.memery_remain_space,
+        status.camera_l_main_state,
+        status.camera_l_second_state,
+        status.camera_r_main_state,
+        status.camera_r_second_state,
+        status.device_state_l,
+        status.device_state_r,
+        status.update_time as status_update_time,
+        status.stock,
+        status.after_fill_stock,
+        status.stock_status,
+        mp.place_name,
+        ml.line_name as place_line_name,
+        sr.name as district_name
         <if test="queryPage.lon != null and queryPage.lon != ''">
             ,
-                ROUND(
-                            6378.138 * 2 * ASIN(
-                                SQRT(
-                                            POW(
-                                                    SIN(
-                                                                (
-                                                                    #{queryPage.lat} * PI() / 180 - info.lat * PI() / 180
-                                                                    ) / 2
-                                                        ),
-                                                    2
-                                                ) +
-                                            COS(#{queryPage.lat} * PI() / 180) * COS(info.lat * PI() / 180) * POW(
-                                                    SIN(
-                                                                (
-                                                                    #{queryPage.lon} * PI() / 180 - info.lon * PI() / 180
-                                                                    ) / 2
-                                                        ),
-                                                    2
-                                                )
-                                    )
-                            ) * 1000
-                    ) AS m
+            ROUND(
+            6378.138 * 2 * ASIN(
+            SQRT(
+            POW(
+            SIN(
+            (
+            #{queryPage.lat} * PI() / 180 - info.lat * PI() / 180
+            ) / 2
+            ),
+            2
+            ) +
+            COS(#{queryPage.lat} * PI() / 180) * COS(info.lat * PI() / 180) * POW(
+            SIN(
+            (
+            #{queryPage.lon} * PI() / 180 - info.lon * PI() / 180
+            ) / 2
+            ),
+            2
+            )
+            )
+            ) * 1000
+            ) AS m
         </if>
         from device_info info
-                 join device_sysinfo sysinfo on (info.device_id = sysinfo.device_id)
-                 join device_status status on (info.device_id = status.device_id)
-                 join device_register dr on (info.device_id = dr.device_id)
-                 left join merc mr on (info.merc_id = mr.id)
-                 left join merc_place mp on (info.place_id = mp.id)
-                 left join merc_line ml on (info.place_line_id = ml.id)
-                 left join sys_region sr on (info.district_id = sr.id)
+        join device_sysinfo sysinfo on (info.device_id = sysinfo.device_id)
+        join device_status status on (info.device_id = status.device_id)
+        join device_register dr on (info.device_id = dr.device_id)
+        left join merc mr on (info.merc_id = mr.id)
+        left join merc_place mp on (info.place_id = mp.id)
+        left join merc_line ml on (info.place_line_id = ml.id)
+        left join sys_region sr on (info.district_id = sr.id)
         where 1 = 1
 
         <if test="queryPage.isBindMerc != null">
@@ -194,10 +194,10 @@
         </if>
         <if test="queryPage.deviceIdName != null and queryPage.deviceIdName != ''">
             and (
-                        LOCATE(#{queryPage.deviceIdName}, info.device_id) > 0 or
-                        LOCATE(#{queryPage.deviceIdName}, info.device_name)
-                            > 0
-                )
+            LOCATE(#{queryPage.deviceIdName}, info.device_id) > 0 or
+            LOCATE(#{queryPage.deviceIdName}, info.device_name)
+            > 0
+            )
         </if>
         <if test="queryPage.deviceId != null">
             and LOCATE(#{queryPage.deviceId}, info.device_id) > 0
@@ -214,10 +214,10 @@
         </if>
         <if test="queryPage.no != null and queryPage.no != ''">
             and (
-                        LOCATE(#{queryPage.no}, info.merc_device_code) > 0 or
-                        LOCATE(#{queryPage.no}, sysinfo.device_sn) > 0 or
-                        LOCATE(#{queryPage.no}, sysinfo.sim_iccid) > 0
-                )
+            LOCATE(#{queryPage.no}, info.merc_device_code) > 0 or
+            LOCATE(#{queryPage.no}, sysinfo.device_sn) > 0 or
+            LOCATE(#{queryPage.no}, sysinfo.sim_iccid) > 0
+            )
         </if>
         <if test="queryPage.activeState != null">
             and info.active_state = #{queryPage.activeState}
@@ -248,10 +248,10 @@
         </if>
         <if test="queryPage.merc != null and queryPage.merc != ''">
             and (
-                        info.merc_id = #{queryPage.merc} or info.merc_code = #{queryPage.merc} or
-                        LOCATE(#{queryPage.merc}, mr.name)
-                            > 0
-                )
+            info.merc_id = #{queryPage.merc} or info.merc_code = #{queryPage.merc} or
+            LOCATE(#{queryPage.merc}, mr.name)
+            > 0
+            )
         </if>
         <if test="queryPage.placeId != null">
             and info.place_id = #{queryPage.placeId}
@@ -304,7 +304,10 @@
         from device_info
 
         <where>
-            active_state = '1'
+            <if test="query.query.activeState != null and query.activeState != ''">
+                active_state = #{query.activeState}
+            </if>
+
             <if test="query.mercId != null">
                 and merc_id = #{query.mercId}
             </if>
@@ -320,7 +323,7 @@
     <select id="netStateCount" resultType="com.xy.dto.DeviceInfoDto$NetStateCount">
         SELECT d.merc_id,net_state, count(*) as count
         FROM device_info d
-                 LEFT JOIN device_status s ON s.device_id = d.device_id
+        LEFT JOIN device_status s ON s.device_id = d.device_id
         <where>
             d.active_state = '1'
             <if test="mercIdList != null and mercIdList.size()>0">

+ 5 - 1
device-api/src/main/java/com/xy/dto/DeviceInfoDto.java

@@ -70,6 +70,7 @@ public class DeviceInfoDto {
         @ApiModelProperty("离线数")
         private Integer offLineCount = 0;
     }
+
     @Data
     @Accessors(chain = true)
     public static class Obj {
@@ -184,7 +185,7 @@ public class DeviceInfoDto {
 
     @Data
     @Accessors(chain = true)
-    public static class PageSingle extends Vo{
+    public static class PageSingle extends Vo {
         @NotNull(message = "分页对象不能空")
         @ApiModelProperty(value = "分页对象", required = true)
         private PageBean page;
@@ -658,6 +659,9 @@ public class DeviceInfoDto {
         @ApiModelProperty("设备编号")
         private Long deviceId;
 
+        @ApiModelProperty("激活状态")
+        private String activeState;
+
     }