Pārlūkot izejas kodu

Merge branch 'master' into test

lijin 1 gadu atpakaļ
vecāks
revīzija
7a14a5019f

+ 25 - 0
device-api-service/src/main/java/com/xy/mapper/DeviceSimMapper.java

@@ -36,6 +36,23 @@ public interface DeviceSimMapper extends BaseMapper<DeviceSim> {
      */
      */
     int pageCount(@Param("queryPage") DeviceSimDto.PageCount queryPage);
     int pageCount(@Param("queryPage") DeviceSimDto.PageCount queryPage);
 
 
+    /**
+     * 数量查询
+     *
+     * @param queryPage
+     * @return
+     */
+    int pageCount2(@Param("queryPage") DeviceSimDto.PageCount queryPage);
+
+    /**
+     * 分页查询
+     *
+     * @param page
+     * @param queryPage
+     * @return
+     */
+    IPage<DeviceSimDto.PageVo> page2(IPage page, @Param("queryPage") DeviceSimDto.Page queryPage);
+
     /**
     /**
      * 全量查询
      * 全量查询
      *
      *
@@ -44,6 +61,14 @@ public interface DeviceSimMapper extends BaseMapper<DeviceSim> {
      */
      */
     List<DeviceSimDto.PageVo> page(@Param("queryPage") DeviceSimDto.Page queryPage);
     List<DeviceSimDto.PageVo> page(@Param("queryPage") DeviceSimDto.Page queryPage);
 
 
+    /**
+     * 全量查询
+     *
+     * @param queryPage
+     * @return
+     */
+    List<DeviceSimDto.PageVo> page2(@Param("queryPage") DeviceSimDto.Page queryPage);
+
     /**
     /**
      * 管流量卡过期
      * 管流量卡过期
      *
      *

+ 55 - 0
device-api-service/src/main/java/com/xy/mapper/mapper/DeviceSimMapper.xml

@@ -40,6 +40,61 @@
         </association>
         </association>
     </resultMap>
     </resultMap>
 
 
+    <select id="page2" resultMap="queryPageMap">
+        select
+        di.*,
+        ds.net_state,
+        dsys.sim_iccid, dsys.sim_iccid as id, dsys.sim_isp as type
+        from device_sysinfo dsys
+        join device_info di on(dsys.device_id = di.device_id)
+        join device_status ds on (di.device_id = ds.device_id)
+        where
+        dsys.sim_iccid is not null and di.active_state = 1
+        and NOT EXISTS (
+            SELECT 1
+            FROM device_sim dsim
+            WHERE dsim.id = dsys.sim_iccid
+        )
+        <if test="queryPage.simId != null and queryPage.simId != ''">
+            and dsim.id = #{queryPage.simId}
+        </if>
+        <if test="queryPage.mercId != null">
+            and di.merc_id = #{queryPage.mercId}
+        </if>
+        <if test="queryPage.deviceId != null">
+            and di.device_id = #{queryPage.deviceId}
+        </if>
+        <if test="queryPage.batchNo != null and queryPage.batchNo != ''">
+            and dsim.batch_no = #{queryPage.batchNo}
+        </if>
+    </select>
+
+    <select id="pageCount2" resultType="int">
+        select count(*)
+        from device_sysinfo dsys
+        join device_info di on(dsys.device_id = di.device_id)
+        join device_status ds on (di.device_id = ds.device_id)
+        where
+        dsys.sim_iccid is not null and di.active_state = 1
+        and NOT EXISTS (
+            SELECT 1
+            FROM device_sim dsim
+            WHERE dsim.id = dsys.sim_iccid
+        )
+        <if test="queryPage.simId != null and queryPage.simId != ''">
+            and dsim.id = #{queryPage.simId}
+        </if>
+        <if test="queryPage.mercId != null">
+            and di.merc_id = #{queryPage.mercId}
+        </if>
+        <if test="queryPage.deviceId != null">
+            and di.device_id = #{queryPage.deviceId}
+        </if>
+        <if test="queryPage.batchNo != null and queryPage.batchNo != ''">
+            and dsim.batch_no = #{queryPage.batchNo}
+        </if>
+    </select>
+
     <select id="page" resultMap="queryPageMap">
     <select id="page" resultMap="queryPageMap">
         SELECT
         SELECT
         di.*,
         di.*,

+ 25 - 2
device-api-service/src/main/java/com/xy/service/DeviceSimServiceImpl.java

@@ -188,6 +188,23 @@ public class DeviceSimServiceImpl extends ServiceImpl<DeviceSimMapper, DeviceSim
         return R.ok(toPageBean(iPage));
         return R.ok(toPageBean(iPage));
     }
     }
 
 
+    @PostMapping("pageByNotInit")
+    @ApiOperation("未初始化分页查询")
+    public R<PageBean<DeviceSimDto.PageVo>> pageByNotInit(@RequestBody DeviceSimDto.Page page) {
+        Map<String, SysDictRedis> simConfig = SysDictUtils.get(EnumSimConfig.Code.CODE.getCode());
+        IPage<DeviceSimDto.PageVo> iPage = baseMapper.page2(toIPage(page.getPage()), page);
+        List<DeviceSimDto.PageVo> records = iPage.getRecords();
+        if (Emptys.check(records)) {
+            String name = simConfig.get(EnumSimConfig.name.getCode()).getValue();
+            Integer money = Integer.valueOf(simConfig.get(EnumSimConfig.money.getCode()).getValue());
+            records.forEach(record -> {
+                //封装计费标准
+                record.setChargingName(name).setChargingMoney(money);
+            });
+        }
+        return R.ok(toPageBean(iPage));
+    }
+
     @PostMapping("pageCount")
     @PostMapping("pageCount")
     @ApiOperation("分页数量查询")
     @ApiOperation("分页数量查询")
     public R<DeviceSimDto.PageCountVo> pageCount(@RequestBody @Validated DeviceSimDto.PageCount pageCount) {
     public R<DeviceSimDto.PageCountVo> pageCount(@RequestBody @Validated DeviceSimDto.PageCount pageCount) {
@@ -196,7 +213,7 @@ public class DeviceSimServiceImpl extends ServiceImpl<DeviceSimMapper, DeviceSim
         String theTime = DataTime.getStringAround(0, 0, value, 0, 0, 0);
         String theTime = DataTime.getStringAround(0, 0, value, 0, 0, 0);
         //并行数据
         //并行数据
         DeviceSimDto.PageCountVo pageCountVo = new DeviceSimDto.PageCountVo();
         DeviceSimDto.PageCountVo pageCountVo = new DeviceSimDto.PageCountVo();
-        ThreadPoolUtils.excPoll(DeviceThreadPoolConfig.DEVICE_COMMON_POLL, 5)
+        ThreadPoolUtils.excPoll(DeviceThreadPoolConfig.DEVICE_COMMON_POLL, 6)
                 .execute(() -> {
                 .execute(() -> {
                     //全部
                     //全部
                     DeviceSimDto.PageCount paramsObj = Beans.copy(DeviceSimDto.PageCount.class, pageCount);
                     DeviceSimDto.PageCount paramsObj = Beans.copy(DeviceSimDto.PageCount.class, pageCount);
@@ -235,6 +252,12 @@ public class DeviceSimServiceImpl extends ServiceImpl<DeviceSimMapper, DeviceSim
                     int count = baseMapper.pageCount(paramsObj);
                     int count = baseMapper.pageCount(paramsObj);
                     pageCountVo.setIsNotActivate(count);
                     pageCountVo.setIsNotActivate(count);
                 })
                 })
+                .execute(() -> {
+                    //未初始化
+                    DeviceSimDto.PageCount paramsObj = Beans.copy(DeviceSimDto.PageCount.class, pageCount);
+                    int count = baseMapper.pageCount2(paramsObj);
+                    pageCountVo.setNotInitCount(count);
+                })
                 .end();
                 .end();
         return R.ok(pageCountVo);
         return R.ok(pageCountVo);
     }
     }
@@ -253,7 +276,7 @@ public class DeviceSimServiceImpl extends ServiceImpl<DeviceSimMapper, DeviceSim
             Integer value = Integer.valueOf(simConfig.get(EnumSimConfig.N_200.getCode()).getValue());
             Integer value = Integer.valueOf(simConfig.get(EnumSimConfig.N_200.getCode()).getValue());
             String theTime = DataTime.getStringAround(0, 0, value, 0, 0, 0);
             String theTime = DataTime.getStringAround(0, 0, value, 0, 0, 0);
             download.setThisTime(LocalDateTime.now()).setTheTime(DataTime.toLocal(theTime));
             download.setThisTime(LocalDateTime.now()).setTheTime(DataTime.toLocal(theTime));
-            List<DeviceSimDto.PageVo> pageVos = baseMapper.page(download);
+            List<DeviceSimDto.PageVo> pageVos = download.getIsNotInit() ? baseMapper.page2(download) : baseMapper.page(download);
             List<UploadSim> uploadSims = new ArrayList<>();
             List<UploadSim> uploadSims = new ArrayList<>();
             pageVos.forEach(pageVo -> {
             pageVos.forEach(pageVo -> {
                 UploadSim uploadSim = new UploadSim();
                 UploadSim uploadSim = new UploadSim();

+ 7 - 0
device-api/src/main/java/com/xy/dto/DeviceSimDto.java

@@ -154,6 +154,10 @@ public class DeviceSimDto {
 
 
         @ApiModelProperty(value = "更新批次号")
         @ApiModelProperty(value = "更新批次号")
         private String updateBatchNo;
         private String updateBatchNo;
+
+
+        @ApiModelProperty(value = "未初始化导出")
+        private Boolean isNotInit = false;
     }
     }
 
 
     @Data
     @Data
@@ -314,5 +318,8 @@ public class DeviceSimDto {
 
 
         @ApiModelProperty(value = "待处理条数")
         @ApiModelProperty(value = "待处理条数")
         private int waitHandleCount;
         private int waitHandleCount;
+
+        @ApiModelProperty(value = "未初始化条数")
+        private int notInitCount;
     }
     }
 }
 }