瀏覽代碼

camera-wifi-prefix

lyhzzz 1 年之前
父節點
當前提交
a423f61763

+ 34 - 0
src/main/java/com/fdkankan/manage/controller/CameraWifiPrefixController.java

@@ -0,0 +1,34 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.Result;
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.service.ICameraWifiPrefixService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2023-11-01
+ */
+@RestController
+@RequestMapping("/service/manage/cameraWifiPrefix")
+public class CameraWifiPrefixController {
+
+    @Autowired
+    ICameraWifiPrefixService cameraWifiPrefixService;
+
+    @GetMapping("/allList")
+    public ResultData allList(){
+
+        return ResultData.ok(cameraWifiPrefixService.list());
+    }
+}
+

+ 54 - 0
src/main/java/com/fdkankan/manage/entity/CameraWifiPrefix.java

@@ -0,0 +1,54 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2023-11-01
+ */
+@Getter
+@Setter
+@TableName("t_camera_wifi_prefix")
+public class CameraWifiPrefix implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 相机 WiFiname_前缀
+     */
+    @TableField("wifi_name_prefix")
+    private String wifiNamePrefix;
+
+    /**
+     * 相机类型
+     */
+    @TableField("camera_type")
+    private Integer cameraType;
+
+    @TableField("rec_status")
+    @TableLogic
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/manage/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
         String path =System.getProperty("user.dir");
 
 
         generate(path,"manage", getTables(new String[]{
         generate(path,"manage", getTables(new String[]{
-                "t_folder"
+                "t_camera_wifi_prefix"
         }));
         }));
 
 
 //        generate(path,"goods", getTables(new String[]{
 //        generate(path,"goods", getTables(new String[]{

+ 18 - 0
src/main/java/com/fdkankan/manage/mapper/ICameraWifiPrefixMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.CameraWifiPrefix;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-11-01
+ */
+@Mapper
+public interface ICameraWifiPrefixMapper extends BaseMapper<CameraWifiPrefix> {
+
+}

+ 16 - 0
src/main/java/com/fdkankan/manage/service/ICameraWifiPrefixService.java

@@ -0,0 +1,16 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.CameraWifiPrefix;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-11-01
+ */
+public interface ICameraWifiPrefixService extends IService<CameraWifiPrefix> {
+
+}

+ 10 - 8
src/main/java/com/fdkankan/manage/service/impl/CameraServiceImpl.java

@@ -62,6 +62,8 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
     @Autowired
     @Autowired
     IOrderService orderService;
     IOrderService orderService;
     @Autowired
     @Autowired
+    ICameraWifiPrefixService cameraWifiPrefixService;
+    @Autowired
     ICameraTypeService cameraTypeService;
     ICameraTypeService cameraTypeService;
 
 
     @Override
     @Override
@@ -112,8 +114,8 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         if(StringUtils.isEmpty(wifiName) ){
         if(StringUtils.isEmpty(wifiName) ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         }
-        List<CameraType> list = cameraTypeService.list();
-        Set<String> wifiNamePrefixList = list.stream().map(CameraType::getWifiNamePrefix).collect(Collectors.toSet());
+        List<CameraWifiPrefix> list = cameraWifiPrefixService.list();
+        Set<String> wifiNamePrefixList = list.stream().map(CameraWifiPrefix::getWifiNamePrefix).collect(Collectors.toSet());
 
 
         if(!wifiName.contains("_")){
         if(!wifiName.contains("_")){
             throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
             throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
@@ -125,7 +127,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         if(!wifiNamePrefixList.contains(cameraPrefix)){
         if(!wifiNamePrefixList.contains(cameraPrefix)){
             throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
             throw new BusinessException(ResultCode.WIFI_NAME_ERROR);
         }
         }
-        HashMap<String,CameraType> cameraTypeMap = new HashMap<>();
+        HashMap<String,CameraWifiPrefix> cameraTypeMap = new HashMap<>();
         list.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
         list.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
 
 
         if(cameraTypeMap.get(cameraPrefix) == null){
         if(cameraTypeMap.get(cameraPrefix) == null){
@@ -141,7 +143,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         saveBatchCamera(Collections.singletonList(wifiName),cameraTypeMap);
         saveBatchCamera(Collections.singletonList(wifiName),cameraTypeMap);
     }
     }
 
 
-    private Integer saveBatchCamera(List<String> wifiNameList,HashMap<String,CameraType> cameraTypeMap){
+    private Integer saveBatchCamera(List<String> wifiNameList,HashMap<String,CameraWifiPrefix> cameraTypeMap){
         HashSet<String> wifiNameSet = new HashSet<>(wifiNameList);
         HashSet<String> wifiNameSet = new HashSet<>(wifiNameList);
         List<Camera> cameraList = new ArrayList<>();
         List<Camera> cameraList = new ArrayList<>();
         for (String wifiName : wifiNameSet) {
         for (String wifiName : wifiNameSet) {
@@ -171,7 +173,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
             cameraDetail.setCameraId(camera.getId());
             cameraDetail.setCameraId(camera.getId());
             cameraDetail.setCountry(0);//默认中国
             cameraDetail.setCountry(0);//默认中国
             String wifiNamePrix = camera.getWifiName().split("_")[0]+"_";
             String wifiNamePrix = camera.getWifiName().split("_")[0]+"_";
-            CameraType cameraType = cameraTypeMap.get(wifiNamePrix);
+            CameraWifiPrefix cameraType = cameraTypeMap.get(wifiNamePrix);
             cameraDetail.setType(cameraType.getCameraType());
             cameraDetail.setType(cameraType.getCameraType());
 
 
             if (1 == cameraDetail.getType() || 9 == cameraDetail.getType() || 10 == cameraDetail.getType() || 11 == cameraDetail.getType()){
             if (1 == cameraDetail.getType() || 9 == cameraDetail.getType() || 10 == cameraDetail.getType() || 11 == cameraDetail.getType()){
@@ -209,10 +211,10 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
     }
     }
     @Override
     @Override
     public Integer ins(List<String> wifiNameList){
     public Integer ins(List<String> wifiNameList){
-        List<CameraType> cameraTypeList = cameraTypeService.list();
-        Set<String> wifiNamePrefixList = cameraTypeList.stream().map(CameraType::getWifiNamePrefix).collect(Collectors.toSet());
+        List<CameraWifiPrefix> cameraTypeList = cameraWifiPrefixService.list();
+        Set<String> wifiNamePrefixList = cameraTypeList.stream().map(CameraWifiPrefix::getWifiNamePrefix).collect(Collectors.toSet());
         List<Integer> errorRow = getErrorRow(wifiNameList,wifiNamePrefixList);
         List<Integer> errorRow = getErrorRow(wifiNameList,wifiNamePrefixList);
-        HashMap<String,CameraType> cameraTypeMap = new HashMap<>();
+        HashMap<String,CameraWifiPrefix> cameraTypeMap = new HashMap<>();
         cameraTypeList.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
         cameraTypeList.forEach(entity->cameraTypeMap.put(entity.getWifiNamePrefix(),entity));
 
 
         excelService.toExcelError(errorRow);
         excelService.toExcelError(errorRow);

+ 20 - 0
src/main/java/com/fdkankan/manage/service/impl/CameraWifiPrefixServiceImpl.java

@@ -0,0 +1,20 @@
+package com.fdkankan.manage.service.impl;
+
+import com.fdkankan.manage.entity.CameraWifiPrefix;
+import com.fdkankan.manage.mapper.ICameraWifiPrefixMapper;
+import com.fdkankan.manage.service.ICameraWifiPrefixService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2023-11-01
+ */
+@Service
+public class CameraWifiPrefixServiceImpl extends ServiceImpl<ICameraWifiPrefixMapper, CameraWifiPrefix> implements ICameraWifiPrefixService {
+
+}

+ 5 - 0
src/main/resources/mapper/manage/CameraWifiPrefixMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fdkankan.manage.mapper.ICameraWifiPrefixMapper">
+
+</mapper>