Pārlūkot izejas kodu

Merge branch 'rtk-1.2.0' into test

# Conflicts:
#	src/main/java/com/fdkankan/manage/service/impl/IncrementOrderMgServiceImpl.java
#	src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java
#	src/main/java/com/fdkankan/manage/util/ExcelUtil.java
#	src/main/java/com/fdkankan/manage/vo/request/UserIncrementParam.java
lyhzzz 1 gadu atpakaļ
vecāks
revīzija
a60736099f
69 mainītis faili ar 2340 papildinājumiem un 152 dzēšanām
  1. 3 1
      README.md
  2. 59 2
      doc/rtk接口文档.md
  3. 6 0
      pom.xml
  4. 8 0
      src/main/java/com/fdkankan/manage/common/ResultCode.java
  5. 63 0
      src/main/java/com/fdkankan/manage/constant/RtkTypeEnum.java
  6. 32 0
      src/main/java/com/fdkankan/manage/controller/CurrencyController.java
  7. 5 2
      src/main/java/com/fdkankan/manage/controller/ExcelController.java
  8. 50 0
      src/main/java/com/fdkankan/manage/controller/RtkAccountController.java
  9. 49 0
      src/main/java/com/fdkankan/manage/controller/RtkDeviceController.java
  10. 1 3
      src/main/java/com/fdkankan/manage/controller/RtkInfoController.java
  11. 37 0
      src/main/java/com/fdkankan/manage/controller/RtkUseLogController.java
  12. 28 0
      src/main/java/com/fdkankan/manage/controller/SceneController.java
  13. 51 0
      src/main/java/com/fdkankan/manage/entity/Currency.java
  14. 2 0
      src/main/java/com/fdkankan/manage/entity/DownloadOrder.java
  15. 2 0
      src/main/java/com/fdkankan/manage/entity/DownloadOrderMg.java
  16. 2 0
      src/main/java/com/fdkankan/manage/entity/IncrementOrder.java
  17. 3 0
      src/main/java/com/fdkankan/manage/entity/IncrementOrderMg.java
  18. 99 0
      src/main/java/com/fdkankan/manage/entity/RtkAccount.java
  19. 70 0
      src/main/java/com/fdkankan/manage/entity/RtkDevice.java
  20. 6 0
      src/main/java/com/fdkankan/manage/entity/RtkInfo.java
  21. 84 0
      src/main/java/com/fdkankan/manage/entity/RtkUseLog.java
  22. 1 1
      src/main/java/com/fdkankan/manage/generate/AutoGenerate.java
  23. 6 0
      src/main/java/com/fdkankan/manage/httpClient/client/LaserClient.java
  24. 49 0
      src/main/java/com/fdkankan/manage/httpClient/service/LaserService.java
  25. 66 25
      src/main/java/com/fdkankan/manage/inner/controller/InnerController.java
  26. 18 0
      src/main/java/com/fdkankan/manage/mapper/ICurrencyMapper.java
  27. 22 0
      src/main/java/com/fdkankan/manage/mapper/IRtkAccountMapper.java
  28. 18 0
      src/main/java/com/fdkankan/manage/mapper/IRtkDeviceMapper.java
  29. 18 0
      src/main/java/com/fdkankan/manage/mapper/IRtkUseLogMapper.java
  30. 43 0
      src/main/java/com/fdkankan/manage/mq/consumer/LaserSceneGpsConsumer.java
  31. 9 0
      src/main/java/com/fdkankan/manage/mq/param/LaserSceneGpsVo.java
  32. 6 0
      src/main/java/com/fdkankan/manage/service/ICameraService.java
  33. 16 0
      src/main/java/com/fdkankan/manage/service/ICurrencyService.java
  34. 6 0
      src/main/java/com/fdkankan/manage/service/IDownService.java
  35. 42 0
      src/main/java/com/fdkankan/manage/service/IRtkAccountService.java
  36. 34 0
      src/main/java/com/fdkankan/manage/service/IRtkDeviceService.java
  37. 28 0
      src/main/java/com/fdkankan/manage/service/IRtkUseLogService.java
  38. 122 1
      src/main/java/com/fdkankan/manage/service/impl/CameraServiceImpl.java
  39. 20 0
      src/main/java/com/fdkankan/manage/service/impl/CurrencyServiceImpl.java
  40. 64 0
      src/main/java/com/fdkankan/manage/service/impl/DownService.java
  41. 15 97
      src/main/java/com/fdkankan/manage/service/impl/ExcelServiceImpl.java
  42. 1 0
      src/main/java/com/fdkankan/manage/service/impl/IncrementOrderMgServiceImpl.java
  43. 374 0
      src/main/java/com/fdkankan/manage/service/impl/RtkAccountServiceImpl.java
  44. 258 0
      src/main/java/com/fdkankan/manage/service/impl/RtkDeviceServiceImpl.java
  45. 2 2
      src/main/java/com/fdkankan/manage/service/impl/RtkInfoServiceImpl.java
  46. 138 0
      src/main/java/com/fdkankan/manage/service/impl/RtkUseLogServiceImpl.java
  47. 6 0
      src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java
  48. 63 0
      src/main/java/com/fdkankan/manage/task/DingdingService.java
  49. 104 0
      src/main/java/com/fdkankan/manage/task/TaskService.java
  50. 1 1
      src/main/java/com/fdkankan/manage/test/TestController.java
  51. 52 13
      src/main/java/com/fdkankan/manage/util/ExcelUtil.java
  52. 23 0
      src/main/java/com/fdkankan/manage/vo/request/RtkAccountInParam.java
  53. 13 0
      src/main/java/com/fdkankan/manage/vo/request/RtkDeviceInParam.java
  54. 2 1
      src/main/java/com/fdkankan/manage/vo/request/RtkInfoParam.java
  55. 1 0
      src/main/java/com/fdkankan/manage/vo/request/UserIncrementParam.java
  56. 4 0
      src/main/java/com/fdkankan/manage/vo/response/DownOrderVo.java
  57. 4 0
      src/main/java/com/fdkankan/manage/vo/response/IncrementOrderVo.java
  58. 1 1
      src/main/resources/bootstrap.yml
  59. 5 0
      src/main/resources/mapper/manage/CurrencyMapper.xml
  60. 2 2
      src/main/resources/mapper/manage/IncrementOrderMapper.xml
  61. 13 0
      src/main/resources/mapper/manage/RtkAccountMapper.xml
  62. 5 0
      src/main/resources/mapper/manage/RtkDeviceMapper.xml
  63. 5 0
      src/main/resources/mapper/manage/RtkUseLogMapper.xml
  64. BIN
      src/main/resources/template/cameraCompany.xlsx
  65. BIN
      src/main/resources/template/cameraIn.xlsx
  66. BIN
      src/main/resources/template/cameraOut.xlsx
  67. BIN
      src/main/resources/template/rtkAccount.xlsx
  68. BIN
      src/main/resources/template/rtkAccountFailureTime.xlsx
  69. BIN
      src/main/resources/template/rtkDevice.xlsx

+ 3 - 1
README.md

@@ -115,4 +115,6 @@
 2.rtk管理
 3.计算优先级
 4.全景相机作品列表。    /overall/cameraSceneList
-~~~~
+~~~~
+
+

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 59 - 2
doc/rtk接口文档.md


+ 6 - 0
pom.xml

@@ -168,6 +168,12 @@
       <version>3.0.0-SNAPSHOT</version>
     </dependency>
 
+    <dependency>
+      <groupId>com.fdkankan</groupId>
+      <artifactId>4dkankan-utils-dingtalk</artifactId>
+      <version>3.0.0-SNAPSHOT</version>
+    </dependency>
+
   </dependencies>
 
   <build>

+ 8 - 0
src/main/java/com/fdkankan/manage/common/ResultCode.java

@@ -98,6 +98,14 @@ public enum ResultCode  {
     RTK_SN_CODE_NOT_AC(50077, "板卡SN码未激活"),
     SGRTK_SN_EXIST(50078, "深光插件sn已存在"),
 
+    RTK_ACCOUNT_NOT_EXIT(50079, "rtk账号库存不足"),
+    SCENE_NOT_EXIST_E57(50080, "场景不存在e57文件"),
+
+    RTK_DEVICEIN_TEMPLATE_EMPTY(50081, "批量导入数据为空"),
+
+    RTK_USERNAME_EXIST(50082, "用户名称已存在"),
+
+    RTK_USERNAME_TEMPLATE_EMPTY(50083, "批量导入数据为空或账号不存在"),
     ;
 
     private Integer code;

+ 63 - 0
src/main/java/com/fdkankan/manage/constant/RtkTypeEnum.java

@@ -0,0 +1,63 @@
+package com.fdkankan.manage.constant;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum RtkTypeEnum {
+    /**
+     * 填写说明:
+     * 1、相机SN:需是已入库设备的SN码;
+     * 2、板卡类型(请复制填入):千寻板卡千寻账号、千寻板卡移动账号、北云板卡移动账号;
+     * 3、板卡SN:按板卡SN号输入;
+     * 4、深光RTK插件SN:按插件SN输入;
+     */
+    QX_QX(0,"千寻板卡千寻账号"),
+    QX_YD(1,"千寻板卡移动账号"),
+    BY_YD(2,"北云板卡移动账号")
+
+    ;
+
+
+    int code;
+    String msg;
+
+    RtkTypeEnum(int code, String msg) {
+        this.code = code;
+        this.msg = msg;
+    }
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    public String getMsg() {
+        return msg;
+    }
+
+    public void setMsg(String msg) {
+        this.msg = msg;
+    }
+    public static RtkTypeEnum getByCode(int code){
+        RtkTypeEnum[] values = RtkTypeEnum.values();
+        for (RtkTypeEnum value : values) {
+            if(value.code == code){
+                return value;
+            }
+        }
+        return null;
+    }
+    public static RtkTypeEnum getByMsg(String msg){
+        if(StringUtils.isNotBlank(msg)){
+            RtkTypeEnum[] values = RtkTypeEnum.values();
+            for (RtkTypeEnum value : values) {
+                if(value.msg.equalsIgnoreCase(msg)){
+                    return value;
+                }
+            }
+        }
+        return null;
+    }
+}

+ 32 - 0
src/main/java/com/fdkankan/manage/controller/CurrencyController.java

@@ -0,0 +1,32 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.service.ICurrencyService;
+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 2024-09-05
+ */
+@RestController
+@RequestMapping("/service/manage/currency")
+public class CurrencyController {
+
+    @Autowired
+    ICurrencyService currencyService;
+
+    @GetMapping("/allList")
+    public ResultData allList(){
+        return ResultData.ok(currencyService.list());
+    }
+}
+

+ 5 - 2
src/main/java/com/fdkankan/manage/controller/ExcelController.java

@@ -29,7 +29,7 @@ public class ExcelController {
 
     /**
      * 下载出入库模板
-     * type 0 入库模板, 1出库模板 ,2 客户关联模板
+     * type 0 入库模板, 1出库模板 ,2 客户关联模板,3 rtk设备模版,4rtk账号模版,5 rtk账号过期时间
      */
     @GetMapping("/downTemplate")
     public void downInTemplate(@RequestParam(required = false,defaultValue = "0") Integer type,
@@ -39,6 +39,9 @@ public class ExcelController {
             case 0 : fileName = "cameraIn.xlsx"; break;
             case 1 : fileName = "cameraOut.xlsx"; break;
             case 2 : fileName = "cameraCompany.xlsx"; break;
+            case 3 : fileName = "rtkDevice.xlsx"; break;
+            case 4 : fileName = "rtkAccount.xlsx"; break;
+            case 5 : fileName = "rtkAccountFailureTime.xlsx"; break;
             default: throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
         InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream("template/"+fileName);
@@ -63,7 +66,7 @@ public class ExcelController {
     }
     /**
      * 导入excel
-     * type 0 入库模板, 1出库模板 ,2 客户关联模板
+     * type 0 入库模板, 1出库模板 ,2 客户关联模板,3 rtk设备模版,4rtk账号模版,5 rtk账号过期时间
      */
     @PostMapping("/uploadExcel")
     public ResultData uploadExcel(@RequestParam(required = false) MultipartFile file,

+ 50 - 0
src/main/java/com/fdkankan/manage/controller/RtkAccountController.java

@@ -0,0 +1,50 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.RtkAccount;
+import com.fdkankan.manage.entity.RtkInfo;
+import com.fdkankan.manage.service.IRtkAccountService;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@RestController
+@RequestMapping("/service/manage/rtkAccount")
+public class RtkAccountController {
+
+    @Autowired
+    IRtkAccountService rtkAccountService;
+
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody RtkInfoParam param){
+        return ResultData.ok(rtkAccountService.pageList(param));
+    }
+
+    @PostMapping("/saveOrEdit")
+    public ResultData saveOrEdit(@RequestBody RtkAccount param){
+        rtkAccountService.saveOrEditEntity(param);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/del")
+    public ResultData del(@RequestBody RtkAccount param){
+        rtkAccountService.del(param);
+        return ResultData.ok();
+    }
+
+}
+

+ 49 - 0
src/main/java/com/fdkankan/manage/controller/RtkDeviceController.java

@@ -0,0 +1,49 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.entity.RtkAccount;
+import com.fdkankan.manage.entity.RtkDevice;
+import com.fdkankan.manage.entity.RtkInfo;
+import com.fdkankan.manage.service.IRtkDeviceService;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@RestController
+@RequestMapping("/service/manage/rtkDevice")
+public class RtkDeviceController {
+
+    @Autowired
+    IRtkDeviceService rtkDeviceService;
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody RtkInfoParam param){
+        return ResultData.ok(rtkDeviceService.pageList(param));
+    }
+
+    @PostMapping("/saveOrEdit")
+    public ResultData saveOrEdit(@RequestBody RtkDevice rtkDevice){
+        rtkDeviceService.saveOrEditEntity(rtkDevice);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/del")
+    public ResultData del(@RequestBody RtkDevice rtkDevice){
+        rtkDeviceService.del(rtkDevice);
+        return ResultData.ok();
+    }
+}
+

+ 1 - 3
src/main/java/com/fdkankan/manage/controller/RtkInfoController.java

@@ -23,9 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
 import java.util.Objects;
 
 /**
- * 经销商申请管理
- * @author 
- * @since 2022-09-21
+ * rtk 1.1.0  ,1.2.0版本废弃
  */
 @RestController
 @RequestMapping("/service/manage/rtkInfo")

+ 37 - 0
src/main/java/com/fdkankan/manage/controller/RtkUseLogController.java

@@ -0,0 +1,37 @@
+package com.fdkankan.manage.controller;
+
+
+import com.fdkankan.common.util.SecurityUtil;
+import com.fdkankan.manage.common.ResultData;
+import com.fdkankan.manage.service.IRtkUseLogService;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@RestController
+@RequestMapping("/service/manage/rtkUseLog")
+public class RtkUseLogController {
+
+    @Autowired
+    IRtkUseLogService rtkUseLogService;
+
+    @PostMapping("/list")
+    public ResultData list(@RequestBody RtkInfoParam param){
+        return ResultData.ok(rtkUseLogService.pageList(param));
+    }
+
+
+}
+

+ 28 - 0
src/main/java/com/fdkankan/manage/controller/SceneController.java

@@ -123,6 +123,34 @@ public class SceneController {
         return ResultData.ok(downService.downloadProcess(num,isObj));
     }
 
+
+    /**
+     * 检查下载
+     * num      场景码
+     */
+    @GetMapping("/checkDownLoadE57")
+    public ResultData checkDownLoadE57(@RequestParam(required = false) String num){
+        return ResultData.ok(downService.checkDownLoadE57(num));
+    }
+
+    /**
+     * 下载场景
+     * num      场景码
+     */
+    @GetMapping("/downSceneE57")
+    public ResultData downSceneE57(@RequestParam(required = false) String num){
+        return ResultData.ok(downService.downE57(num));
+    }
+
+    /**
+     * 下载场景进度条
+     * num      场景码
+     */
+    @GetMapping("/downloadProcessE57")
+    public ResultData downloadProcessE57(@RequestParam(required = false) String num){
+        return ResultData.ok(downService.downloadProcessE57(num));
+    }
+
     /**
      * 场景重算
      * num      场景码

+ 51 - 0
src/main/java/com/fdkankan/manage/entity/Currency.java

@@ -0,0 +1,51 @@
+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 2024-09-05
+ */
+@Getter
+@Setter
+@TableName("t_currency")
+public class Currency implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("symbol")
+    private String symbol;
+
+    @TableField("name")
+    private String name;
+
+    @TableField("name_en")
+    private String nameEn;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 2 - 0
src/main/java/com/fdkankan/manage/entity/DownloadOrder.java

@@ -120,5 +120,7 @@ public class DownloadOrder implements Serializable {
     @TableField("scene_name")
     private String sceneName;
 
+    @TableField("currency_symbol")
+    private String currencySymbol;
 
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/entity/DownloadOrderMg.java

@@ -173,5 +173,7 @@ public class DownloadOrderMg implements Serializable {
     @TableField("agent_name")
     private String agentName;
 
+    @TableField("currency_symbol")
+    private String currencySymbol;
 
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/entity/IncrementOrder.java

@@ -114,5 +114,7 @@ public class IncrementOrder implements Serializable {
     @TableField("update_time")
     private String updateTime;
 
+    @TableField("currency_symbol")
+    private String currencySymbol;
 
 }

+ 3 - 0
src/main/java/com/fdkankan/manage/entity/IncrementOrderMg.java

@@ -173,4 +173,7 @@ public class IncrementOrderMg implements Serializable {
     @TableField("agent_name")
     private String agentName;
 
+    @TableField("currency_symbol")
+    private String currencySymbol;
+
 }

+ 99 - 0
src/main/java/com/fdkankan/manage/entity/RtkAccount.java

@@ -0,0 +1,99 @@
+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 com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Getter
+@Setter
+@TableName("t_rtk_account")
+@ToString
+public class RtkAccount implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("user_name")
+    private String userName;
+
+    @TableField("password")
+    private String password;
+
+    @TableField("ip_addr")
+    private String ipAddr;
+
+    @TableField("mount_point")
+    private String mountPoint;
+
+    @TableField("port")
+    private String port;
+
+    /**
+     * 0移动
+     */
+    @TableField("type")
+    private String type;
+
+    /**
+     * 运营商
+     */
+    @TableField("operator")
+    private String operator;
+
+    /**
+     * 使用状态0初始状态未激活,1未使用,2正在使用,3已停用
+     */
+    @TableField("status")
+    private Integer status;
+
+    @TableField("use_status")
+    private Integer useStatus;
+
+    @TableField("failure_time")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date failureTime;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("create_user_id")
+    private Long createUserId;
+
+    @TableField("update_user_id")
+    private Long updateUserId;
+
+    @TableField("del_user_id")
+    private Long delUserId;
+
+    @TableField(exist = false)
+    private String createUserName;
+    @TableField(exist = false)
+    private String createNickName;
+
+}

+ 70 - 0
src/main/java/com/fdkankan/manage/entity/RtkDevice.java

@@ -0,0 +1,70 @@
+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 2024-07-22
+ */
+@Getter
+@Setter
+@TableName("t_rtk_device")
+public class RtkDevice implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("rtk_sn_code")
+    private String rtkSnCode;
+
+    @TableField("camera_sn")
+    private String cameraSn;
+
+    @TableField("sg_rtk_sn")
+    private String sgRtkSn;
+
+    @TableField("rtk_type")
+    private Integer rtkType;
+
+    @TableField("use_status")
+    private Integer useStatus;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("create_user_id")
+    private Long createUserId;
+
+    @TableField("update_user_id")
+    private Long updateUserId;
+
+    @TableField("del_user_id")
+    private Long delUserId;
+
+    @TableField(exist = false)
+    private String createUserName;
+    @TableField(exist = false)
+    private String createNickName;
+
+}

+ 6 - 0
src/main/java/com/fdkankan/manage/entity/RtkInfo.java

@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.*;
 
 import java.io.Serializable;
 import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -113,4 +115,8 @@ public class RtkInfo implements Serializable {
     @TableField(exist = false)
     private String updateUserName;
 
+    @TableField(value = "failure_time",updateStrategy = FieldStrategy.IGNORED)
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date failureTime;
+
 }

+ 84 - 0
src/main/java/com/fdkankan/manage/entity/RtkUseLog.java

@@ -0,0 +1,84 @@
+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 2024-07-22
+ */
+@Getter
+@Setter
+@TableName("t_rtk_use_log")
+public class RtkUseLog implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("rtk_sn_code")
+    private String rtkSnCode;
+
+    @TableField("camera_sn")
+    private String cameraSn;
+
+    @TableField("sg_rtk_sn")
+    private String sgRtkSn;
+
+
+    @TableField("rtk_account_id")
+    private Integer rtkAccountId;
+
+    @TableField("user_name")
+    private String userName;
+
+    @TableField("password")
+    private String password;
+
+    @TableField("ip_addr")
+    private String ipAddr;
+
+    @TableField("mount_point")
+    private String mountPoint;
+
+    @TableField("port")
+    private String port;
+    @TableField("operator")
+    private String operator;
+
+    @TableField("rtk_type")
+    private Integer rtkType;
+
+    @TableField("account_status")
+    private Integer accountStatus;
+
+    @TableField("use_type")
+    private Integer useType;
+
+    @TableField("visit_ip")
+    private String visitIp;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    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");
 
         generate(path,"manage", getTables(new String[]{
-                "mq_send_log",
+                "t_currency"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

+ 6 - 0
src/main/java/com/fdkankan/manage/httpClient/client/LaserClient.java

@@ -77,4 +77,10 @@ public interface LaserClient {
      */
     @Post("/laser/4dage/scene/camera/toBind")
     Result toBind(@JSONBody SsBindParam param) ;
+
+    @Post("/laser/4dage/downE57Status")
+    Result downE57Status(@JSONBody SSDownSceneParam param);
+
+    @Post("/laser/4dage/downE57")
+    Result downE57(@JSONBody SSDownSceneParam param);
 }

+ 49 - 0
src/main/java/com/fdkankan/manage/httpClient/service/LaserService.java

@@ -393,6 +393,55 @@ public class LaserService {
         }
         return null ;
     }
+
+    public SSDownSceneVo downE57Status(String num) {
+        try {
+            SSDownSceneVo vo ;
+            SSDownSceneParam param = new SSDownSceneParam();
+            param.setSceneCode(num);
+            Result responseEntity = laserClient.downE57Status(param);
+            if( responseEntity.getCode() != HttpStatus.OK.value()){
+                log.error("downE57Status-根据场景码获取激光转台下载状态失败:{}",responseEntity);
+                return null;
+            }
+            if(responseEntity.getCode() == 407){
+                throw new BusinessException(ResultCode.SCENE_NOT_EXIST_E57);
+            }
+            vo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getData()), SSDownSceneVo.class);
+            return vo;
+
+        }catch (BusinessException e){
+            throw new BusinessException(ResultCode.SCENE_NOT_EXIST_E57);
+        }catch (Exception e){
+            log.error("downE57Status-根据场景码获取激光转台下载状态失败!",e);
+        }
+        return null ;
+    }
+
+    public SSDownSceneVo downE57(String num) {
+        try {
+            SSDownSceneVo vo ;
+            SSDownSceneParam param = new SSDownSceneParam();
+            param.setSceneCode(num);
+            Result responseEntity = laserClient.downE57(param);
+            if( responseEntity.getCode() != HttpStatus.OK.value()){
+                log.error("downE57-根据场景码获取激光转台下载失败:{}",responseEntity);
+                return null;
+            }
+            if(responseEntity.getCode() == 407){
+                throw new BusinessException(ResultCode.SCENE_NOT_EXIST_E57);
+            }
+            vo = JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getData()), SSDownSceneVo.class);
+            return vo ;
+        }catch (BusinessException e){
+            throw new BusinessException(ResultCode.SCENE_NOT_EXIST_E57);
+        }catch (Exception e){
+            log.error("downE57-根据场景码获取激光转台下载状态失败!",e);
+        }
+        return null ;
+    }
+
+
     public void toBind(String snCode) {
         try {
             SsBindParam param = new SsBindParam();

+ 66 - 25
src/main/java/com/fdkankan/manage/inner/controller/InnerController.java

@@ -1,19 +1,22 @@
 package com.fdkankan.manage.inner.controller;
 
+import cn.hutool.extra.servlet.ServletUtil;
 import cn.hutool.log.Log;
 import com.fdkankan.common.util.SecurityUtil;
+import com.fdkankan.manage.common.CacheUtil;
 import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.common.ResultData;
 import com.fdkankan.manage.controller.BaseController;
+import com.fdkankan.manage.entity.RtkAccount;
+import com.fdkankan.manage.entity.RtkDevice;
 import com.fdkankan.manage.entity.RtkInfo;
+import com.fdkankan.manage.entity.RtkUseLog;
 import com.fdkankan.manage.exception.BusinessException;
-import com.fdkankan.manage.service.ICommonService;
-import com.fdkankan.manage.service.IRtkInfoService;
-import com.fdkankan.manage.service.ISceneProService;
-import com.fdkankan.manage.service.IServiceUpTipService;
+import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.util.RsaUtils;
 import com.fdkankan.manage.vo.request.SceneParam;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
@@ -76,36 +79,74 @@ public class InnerController extends BaseController {
 
     @Autowired
     IRtkInfoService rtkInfoService;
+    @Autowired
+    IRtkAccountService rtkAccountService;
+    @Autowired
+    IRtkDeviceService rtkDeviceService;
+    @Autowired
+    IRtkUseLogService rtkUseLogService;
 
     /**
-     *
+     * 相机开启rtk获取账号
      */
     @GetMapping("/info/{rtkSnCode}")
-    public ResultData info(@PathVariable String rtkSnCode){
+    public synchronized ResultData info(@PathVariable String rtkSnCode,
+                                        @RequestParam(value = "cameraSn",required = false) String cameraSn){
         if(StringUtils.isBlank(rtkSnCode)){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-//        String token = getSign();
-//        if(StringUtils.isBlank(token)){
-//            throw new BusinessException(ResultCode.RTK_TOKEN_NOT_EXIT);
-//        }
-//        try {
-//            String deTxt = RsaUtils.decipher(token, RsaUtils.privateKey);
-//            if(!deTxt.equals(rtkSnCode)){
-//                throw new BusinessException(ResultCode.RTK_TOKEN_ERROR);
-//            }
-//        }catch (Exception e){
-//            throw new BusinessException(ResultCode.RTK_TOKEN_ERROR);
-//        }
-
-
-        RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
-        if(rtkInfo == null){
+        if("aws".equals(CacheUtil.uploadType)){
+            RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
+            if(rtkInfo == null){
+                throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
+            }
+            String clientIP = ServletUtil.getClientIP(request);
+            rtkUseLogService.saveLog(rtkInfo,clientIP,cameraSn,0);
+            return ResultData.ok(rtkInfo);
+        }
+        RtkDevice rtkDevice = rtkDeviceService.getByRtkSnCode(rtkSnCode);
+        if(rtkDevice == null || rtkDevice.getUseStatus() !=0){
             throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
         }
-//        if(rtkInfo.getStatus() == 0){
-//            throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_AC);
-//        }
+        RtkInfo rtkInfo = new RtkInfo();
+        rtkInfo.setRtkSnCode(rtkSnCode);
+        rtkInfo.setRtkType(rtkDevice.getRtkType());
+        //rtkDevice.getType() = 0板卡自带账号信息,无需关联
+        Integer rtkAccountId = null;
+        if(rtkDevice.getRtkType() != 0){
+            RtkAccount rtkAccount = rtkAccountService.getOneNotUseAccount(rtkSnCode,rtkDevice.getCameraSn());
+            rtkAccountId = rtkAccount.getId();
+            BeanUtils.copyProperties(rtkAccount,rtkInfo);
+        }
+        String clientIP = ServletUtil.getClientIP(request);
+        rtkUseLogService.saveLog(rtkInfo,clientIP,rtkAccountId,cameraSn,rtkDevice);
         return ResultData.ok(rtkInfo);
     }
+
+    /**
+     * 相机关闭rtk,回收账号
+     */
+    @GetMapping("/stop/{rtkSnCode}")
+    public ResultData stop(@PathVariable String rtkSnCode,
+                           @RequestParam(value = "cameraSn",required = false) String cameraSn){
+        if(StringUtils.isBlank(rtkSnCode)){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        if("aws".equals(CacheUtil.uploadType)){
+            RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
+            if(rtkInfo == null){
+                throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
+            }
+            String clientIP = ServletUtil.getClientIP(request);
+            rtkUseLogService.saveLog(rtkInfo,clientIP,cameraSn,1);
+            return ResultData.ok();
+        }
+        RtkDevice rtkDevice = rtkDeviceService.getByRtkSnCode(rtkSnCode);
+        if(rtkDevice == null){
+            throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
+        }
+        String clientIP = ServletUtil.getClientIP(request);
+        rtkAccountService.stop(rtkDevice,clientIP,cameraSn);
+        return ResultData.ok();
+    }
 }

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

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.Currency;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-09-05
+ */
+@Mapper
+public interface ICurrencyMapper extends BaseMapper<Currency> {
+
+}

+ 22 - 0
src/main/java/com/fdkankan/manage/mapper/IRtkAccountMapper.java

@@ -0,0 +1,22 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.RtkAccount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Mapper
+public interface IRtkAccountMapper extends BaseMapper<RtkAccount> {
+
+    List<RtkAccount> getByNotUseList();
+    List<RtkAccount> getByCanUseList();
+}

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

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.RtkDevice;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Mapper
+public interface IRtkDeviceMapper extends BaseMapper<RtkDevice> {
+
+}

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

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.RtkUseLog;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Mapper
+public interface IRtkUseLogMapper extends BaseMapper<RtkUseLog> {
+
+}

+ 43 - 0
src/main/java/com/fdkankan/manage/mq/consumer/LaserSceneGpsConsumer.java

@@ -0,0 +1,43 @@
+package com.fdkankan.manage.mq.consumer;
+
+import com.alibaba.fastjson.JSONObject;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.nio.charset.StandardCharsets;
+
+/**
+ * 场景封存解封 mq
+ */
+@Slf4j
+@Component
+public class LaserSceneGpsConsumer {
+
+
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.laser.update-scene.location:save-scene-location}")
+    )
+    public void consumerQueue(Channel channel, Message message)  {
+        try {
+            String messageId = message.getMessageProperties().getMessageId();
+            String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+            log.info("laser-update-save-scene-location-mq--messageId:{},msg:{}",messageId,msg);
+
+            channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+
+
+        }catch (Exception e){
+            log.info("laser-save-scene-location------消费失败",e);
+        }finally {
+
+        }
+
+    }
+
+}

+ 9 - 0
src/main/java/com/fdkankan/manage/mq/param/LaserSceneGpsVo.java

@@ -0,0 +1,9 @@
+package com.fdkankan.manage.mq.param;
+
+import lombok.Data;
+
+@Data
+public class LaserSceneGpsVo {
+    private String num;
+    private Double[] location;
+ }

+ 6 - 0
src/main/java/com/fdkankan/manage/service/ICameraService.java

@@ -52,4 +52,10 @@ public interface ICameraService extends IService<Camera> {
     HashMap<Long, Camera> getByIds(List<Long> cameraIds);
 
     List<Camera> getBySnCodes(Set<String> snCodes);
+
+    Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
+
+    Integer outExcelList(List<HashMap<Integer, String>> excelRowList);
+
+    Integer companyExcelList(List<HashMap<Integer, String>> excelRowList);
 }

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

@@ -0,0 +1,16 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.Currency;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-09-05
+ */
+public interface ICurrencyService extends IService<Currency> {
+
+}

+ 6 - 0
src/main/java/com/fdkankan/manage/service/IDownService.java

@@ -10,4 +10,10 @@ public interface IDownService {
     DownVo down(String sceneNum,Integer isObj);
 
     DownloadProcessVo downloadProcess(String num,Integer isObj);
+
+    DownVo checkDownLoadE57(String num);
+
+    DownVo downE57(String num);
+
+    DownloadProcessVo downloadProcessE57(String num);
 }

+ 42 - 0
src/main/java/com/fdkankan/manage/service/IRtkAccountService.java

@@ -0,0 +1,42 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.RtkAccount;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.entity.RtkDevice;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+public interface IRtkAccountService extends IService<RtkAccount> {
+
+    RtkAccount getOneNotUseAccount(String rtkSnCode,String cameraSn);
+
+    void updateAccountStatus(Integer id, int status);
+
+    void stop(RtkDevice rtkDevice, String clientIP,String cameraSn);
+
+    Object pageList(RtkInfoParam param);
+
+    void saveOrEditEntity(RtkAccount param);
+
+    void del(RtkAccount param);
+
+    RtkAccount getByUserName(String userName);
+
+
+    Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
+
+    Integer insFailureTimeExcelList(List<HashMap<Integer, String>> excelRowList);
+
+    List<RtkAccount> getByNotUseList();
+    List<RtkAccount> getByCanUseList();
+}

+ 34 - 0
src/main/java/com/fdkankan/manage/service/IRtkDeviceService.java

@@ -0,0 +1,34 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.RtkAccount;
+import com.fdkankan.manage.entity.RtkDevice;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+
+import java.util.HashMap;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+public interface IRtkDeviceService extends IService<RtkDevice> {
+
+    RtkDevice getByRtkSnCode(String rtkSnCode);
+
+    Object pageList(RtkInfoParam param);
+
+    void saveOrEditEntity(RtkDevice rtkDevice);
+
+    void del(RtkDevice rtkDevice);
+
+    RtkDevice getSgRtkSn(String sgRtkSn);
+
+    RtkDevice getByCameraSn(String cameraSnCode);
+
+    Integer insExcelList(List<HashMap<Integer, String>> excelRowList);
+}

+ 28 - 0
src/main/java/com/fdkankan/manage/service/IRtkUseLogService.java

@@ -0,0 +1,28 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.RtkAccount;
+import com.fdkankan.manage.entity.RtkDevice;
+import com.fdkankan.manage.entity.RtkInfo;
+import com.fdkankan.manage.entity.RtkUseLog;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+public interface IRtkUseLogService extends IService<RtkUseLog> {
+
+    void saveLog(RtkInfo rtkInfo, String clientIP,Integer rtkAccountId,String cameraSn,RtkDevice rtkDevice);
+    void saveLog(RtkInfo rtkInfo, String clientIP,String cameraSn,Integer useType);
+    void saveLog(RtkDevice rtkDevice, String clientIP, RtkAccount rtkAccount,String cameraSn);
+    void saveLog(RtkAccount rtkAccount);
+
+    RtkUseLog getByRtkSn(String rtkSnCode);
+
+    Object pageList(RtkInfoParam param);
+}

+ 122 - 1
src/main/java/com/fdkankan/manage/service/impl/CameraServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.common.constant.Constant;
 import com.fdkankan.manage.common.*;
+import com.fdkankan.manage.constant.CameraOutTypeEnum;
 import com.fdkankan.manage.entity.*;
 import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.common.util.DateUtil;
@@ -112,7 +113,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
     }
 
     @Override
-    public void in(String wifiName) {
+    public synchronized void in(String wifiName) {
         if(StringUtils.isEmpty(wifiName) ){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
@@ -639,4 +640,124 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         wrapper.in(Camera::getSnCode,snCodes);
         return this.list(wrapper);
     }
+
+    @Override
+    public Integer insExcelList(List<HashMap<Integer, String>> excelRowList) {
+        List<String> wifiNameList = new ArrayList<>();
+        Integer index = 0;
+        for (HashMap<Integer, String> map : excelRowList) {
+            index ++;
+            if(map.isEmpty()){
+                continue;
+            }
+            if(index == 0 && !map.get(0).equals("设备入库模板")){
+                throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
+            }
+            if(index <4){   //从第四行开始
+                continue;
+            }
+            String wifiName = map.get(0);
+            wifiNameList.add(wifiName);
+        }
+
+        if(wifiNameList.size() <=0){
+            throw new BusinessException(ResultCode.IN_TEMPLATE_EMPTY);
+        }
+        return this.ins(wifiNameList);
+    }
+
+    @Autowired
+    IAgentNewService agentNewService;
+    @Override
+    public Integer outExcelList(List<HashMap<Integer, String>> excelRowList) {
+        List<CameraInOutParam> params = new ArrayList<>();
+        List<Integer> errorIndex = new ArrayList<>();
+        Integer index = 0;
+        for (HashMap<Integer, String> map : excelRowList) {
+            index ++;
+            if(map.isEmpty()){
+                continue;
+            }
+            if(index == 0 && !map.get(0).equals("设备出库模板")){
+                throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
+            }
+            if(index <4){
+                continue;
+            }
+            String snCode = map.get(0);
+            String outTypeString = map.get(1);
+            String companyName = map.get(2);
+            String orderSn = map.get(3);
+            String agentName = map.get(4);
+            String buyDate = map.get(5);
+            CameraOutTypeEnum outTypeEnum = CameraOutTypeEnum.getByMsg(outTypeString);
+            if(outTypeEnum == null || StringUtils.isBlank(snCode) || StringUtils.isBlank(buyDate)){
+                log.error("outError-->出库错误:出库类型为空或snCode为空:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
+                        ,snCode,outTypeString,companyName,orderSn,agentName);
+                errorIndex.add(index -3);
+            }
+            CameraInOutParam param = new CameraInOutParam();
+            if(outTypeEnum != null){
+                int outType = outTypeEnum.getCode();
+                param.setOutType(outType);
+            }
+            param.setBuyDate(buyDate);
+            if(StringUtils.isNotBlank(agentName)){
+                AgentNew agentNew = agentNewService.getByName(agentName);
+                if(agentNew == null){
+                    log.error("outError-->出库错误:代理商不存在:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
+                            ,snCode,outTypeString,companyName,orderSn,agentName);
+                    errorIndex.add(index -3);
+                }else {
+                    param.setAgentId(agentNew.getId());
+                }
+            }
+            param.setCompanyName(companyName);
+            param.setOrderSn(orderSn);
+            param.setSnCode(snCode);
+            params.add(param);
+
+        }
+
+        excelService.toExcelError(errorIndex);
+
+        if(params.size() <=0){
+            throw new BusinessException(ResultCode.OUT_TEMPLATE_EMPTY);
+        }
+        return this.outs(params);
+    }
+
+    @Override
+    public Integer companyExcelList(List<HashMap<Integer, String>> excelRowList) {
+        List<CameraInOutParam> companyParams = new ArrayList<>();
+        List<Integer> errorIndex = new ArrayList<>();
+        Integer index = 0;
+        for (HashMap<Integer, String> map : excelRowList) {
+            index ++;
+            if(map.isEmpty()){
+                continue;
+            }
+            if(index == 0 && !map.get(0).equals("客户关联模板")){
+                throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
+            }
+            if(index <4){
+                continue;
+            }
+            CameraInOutParam param = new CameraInOutParam();
+            param.setCompanyName(map.get(0));
+            param.setSnCode(map.get(1));
+            if(StringUtils.isBlank(param.getSnCode()) || StringUtils.isBlank(param.getCompanyName())){
+                errorIndex.add(index -3 );
+            }
+            companyParams.add(param);
+
+        }
+        excelService.toExcelError(errorIndex);
+
+
+        if( companyParams.size() <=0){
+            throw new BusinessException(ResultCode.COMPANY_TEMPLATE_EMPTY);
+        }
+        return this.updateCompany(companyParams);
+    }
 }

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

@@ -0,0 +1,20 @@
+package com.fdkankan.manage.service.impl;
+
+import com.fdkankan.manage.entity.Currency;
+import com.fdkankan.manage.mapper.ICurrencyMapper;
+import com.fdkankan.manage.service.ICurrencyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-09-05
+ */
+@Service
+public class CurrencyServiceImpl extends ServiceImpl<ICurrencyMapper, Currency> implements ICurrencyService {
+
+}

+ 64 - 0
src/main/java/com/fdkankan/manage/service/impl/DownService.java

@@ -294,4 +294,68 @@ public class DownService implements IDownService {
         return downVo;
     }
 
+
+    @Override
+    public DownVo checkDownLoadE57(String num) {
+        DownVo downVo = new DownVo();
+        SSDownSceneVo vo = laserService.downE57Status(num);
+        if(vo == null){
+            throw new BusinessException(ResultCode.SS_SCENE_DOWN_ERROR);
+        }
+        downVo.setDownloadStatus(0);
+        if(vo.getStatus() == 1){
+            downVo.setDownloadStatus(3);
+            downVo.setDownloadUrl(vo.getUrl());
+        }
+        if(vo.getStatus() == 2){
+            downVo.setDownloadStatus(2);
+        }
+        if(vo.getStatus() == 3){
+            downVo.setDownloadStatus(1);
+        }
+        return downVo;
+    }
+
+    @Override
+    public DownVo downE57(String num) {
+        DownVo downVo = new DownVo();
+
+        //status :0:正在生成 1,初次生成  2,已经生成直接下载 3,重新生成
+        SSDownSceneVo vo = laserService.downE57(num);
+        if(vo == null){
+            throw new BusinessException(ResultCode.SS_SCENE_DOWN_ERROR);
+        }
+        downVo.setDownloadStatus(1);
+        return downVo;
+    }
+
+    public static HashMap<String,Integer> ssNumProcessNumE57Map = new HashMap<>();
+
+
+    @Override
+    public DownloadProcessVo downloadProcessE57(String num) {
+        DownloadProcessVo downVo = new DownloadProcessVo();
+        SSDownSceneVo vo = laserService.downE57Status(num);
+        if(vo == null){
+            throw new BusinessException(ResultCode.SS_SCENE_DOWN_ERROR);
+        }
+        downVo.setStatus(1003);
+        if(vo.getStatus() == 0 || vo.getStatus() == 2 || vo.getStatus() == 3){    //下载中
+            ssNumProcessNumE57Map.merge(num, 1, Integer::sum);
+            Integer percent = ssNumProcessNumE57Map.get(num);
+            percent = percent /2;
+            if(percent >50){
+                percent = 50;
+            }
+            downVo.setStatus(1001);
+            downVo.setPercent(percent);
+        }
+        if(vo.getStatus() == 1 ){    //下载完成
+            ssNumProcessNumE57Map.remove(num);
+            downVo.setPercent(100);
+            downVo.setUrl(vo.getUrl());
+            downVo.setStatus(1002);
+        }
+        return downVo;
+    }
 }

+ 15 - 97
src/main/java/com/fdkankan/manage/service/impl/ExcelServiceImpl.java

@@ -9,10 +9,7 @@ import com.fdkankan.manage.entity.AgentNew;
 import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.manage.constant.CameraOutTypeEnum;
 import com.fdkankan.manage.entity.Company;
-import com.fdkankan.manage.service.IAgentNewService;
-import com.fdkankan.manage.service.ICameraService;
-import com.fdkankan.manage.service.ICompanyService;
-import com.fdkankan.manage.service.IExcelService;
+import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.util.ExcelUtil;
 import com.fdkankan.manage.vo.request.CameraInOutParam;
 import lombok.extern.slf4j.Slf4j;
@@ -48,6 +45,10 @@ public class ExcelServiceImpl implements IExcelService {
     ICameraService cameraService;
     @Autowired
     IAgentNewService agentNewService;
+    @Autowired
+    IRtkDeviceService rtkDeviceService;
+    @Autowired
+    IRtkAccountService rtkAccountService;
 
     public void commonExport(HttpServletRequest request, HttpServletResponse response,String name,List<?> result,ExcelWriter excelWriter) throws Exception {
         response.setContentType("application/vnd.ms-excel");
@@ -91,102 +92,19 @@ public class ExcelServiceImpl implements IExcelService {
         try {
             excelRowList = ExcelUtil.getExcelRowList(file);
         }catch (Exception e){
+            log.info("updateExcel-error:{}",e);
             throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
         }
-        List<String> wifiNameList = new ArrayList<>();
-        List<CameraInOutParam> params = new ArrayList<>();
-        List<CameraInOutParam> companyParams = new ArrayList<>();
-        List<Integer> errorIndex = new ArrayList<>();
-        Integer index = 0;
-        for (HashMap<Integer, String> map : excelRowList) {
-            index ++;
-            if(map.isEmpty()){
-                continue;
-            }
-            if(type == 0){      //入库
-                if(index == 0 && !map.get(0).equals("设备入库模板")){
-                    throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
-                }
-                if(index <4){   //从第四行开始
-                    continue;
-                }
-                String wifiName = map.get(0);
-                wifiNameList.add(wifiName);
-            }else if(type == 1){    //出库
-                if(index == 0 && !map.get(0).equals("设备出库模板")){
-                    throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
-                }
-                if(index <4){
-                    continue;
-                }
-                String snCode = map.get(0);
-                String outTypeString = map.get(1);
-                String companyName = map.get(2);
-                String orderSn = map.get(3);
-                String agentName = map.get(4);
-                String buyDate = map.get(5);
-                CameraOutTypeEnum outTypeEnum = CameraOutTypeEnum.getByMsg(outTypeString);
-                if(outTypeEnum == null || StringUtils.isBlank(snCode) || StringUtils.isBlank(buyDate)){
-                    log.error("outError-->出库错误:出库类型为空或snCode为空:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
-                            ,snCode,outTypeString,companyName,orderSn,agentName);
-                    errorIndex.add(index -3);
-                }
-                CameraInOutParam param = new CameraInOutParam();
-                if(outTypeEnum != null){
-                    int outType = outTypeEnum.getCode();
-                    param.setOutType(outType);
-                }
-                param.setBuyDate(buyDate);
-                if(StringUtils.isNotBlank(agentName)){
-                    AgentNew agentNew = agentNewService.getByName(agentName);
-                    if(agentNew == null){
-                        log.error("outError-->出库错误:代理商不存在:snCode:{},outType:{},companyName:{},orderSn:{},agentName:{}"
-                                ,snCode,outTypeString,companyName,orderSn,agentName);
-                        errorIndex.add(index -3);
-                    }else {
-                        param.setAgentId(agentNew.getId());
-                    }
-                }
-                param.setCompanyName(companyName);
-                param.setOrderSn(orderSn);
-                param.setSnCode(snCode);
-                params.add(param);
-            }else if(type == 2){   //关联客户
-                if(index == 0 && !map.get(0).equals("客户关联模板")){
-                    throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
-                }
-                if(index <4){
-                    continue;
-                }
-                CameraInOutParam param = new CameraInOutParam();
-                param.setCompanyName(map.get(0));
-                param.setSnCode(map.get(1));
-                if(StringUtils.isBlank(param.getSnCode()) || StringUtils.isBlank(param.getCompanyName())){
-                    errorIndex.add(index -3 );
-                }
-                companyParams.add(param);
-            }
-        }
-         this.toExcelError(errorIndex);
-
-        if(type == 0 && wifiNameList.size() <=0){
-            throw new BusinessException(ResultCode.IN_TEMPLATE_EMPTY);
-        }else if(type == 1 && params.size() <=0){
-
-            throw new BusinessException(ResultCode.OUT_TEMPLATE_EMPTY);
-        }else if(type == 2 && companyParams.size() <=0){
-            throw new BusinessException(ResultCode.COMPANY_TEMPLATE_EMPTY);
-        }
-        if(wifiNameList.size() >0){
-            return cameraService.ins(wifiNameList);
-        }
-        if(params.size() >0){
-            return cameraService.outs(params);
-        }
-        if(companyParams.size() >0){
-            return cameraService.updateCompany(companyParams);
+        switch (type){
+            case 0 :return cameraService.insExcelList(excelRowList);
+            case 1 :return cameraService.outExcelList(excelRowList);
+            case 2 :return cameraService.companyExcelList(excelRowList);
+            case 3 :return rtkDeviceService.insExcelList(excelRowList);
+            case 4 :return rtkAccountService.insExcelList(excelRowList);
+            case 5 :return rtkAccountService.insFailureTimeExcelList(excelRowList);
+            default:
+                throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        return 0;
     }
 
     @Override

+ 1 - 0
src/main/java/com/fdkankan/manage/service/impl/IncrementOrderMgServiceImpl.java

@@ -34,6 +34,7 @@ public class IncrementOrderMgServiceImpl extends ServiceImpl<IIncrementOrderMgMa
         incrementOrderMg.setPayStatus(1);
         incrementOrderMg.setIncrementType(incrementType.getId());
         incrementOrderMg.setAmount(param.getAmount());
+        incrementOrderMg.setCurrencySymbol(param.getCurrencySymbol());
         if(incrementType.getValidTimeType() == 0){
             incrementOrderMg.setMemberLevels("PR");
         }

+ 374 - 0
src/main/java/com/fdkankan/manage/service/impl/RtkAccountServiceImpl.java

@@ -0,0 +1,374 @@
+package com.fdkankan.manage.service.impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.constant.RtkTypeEnum;
+import com.fdkankan.manage.entity.*;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.ICameraDetailMapper;
+import com.fdkankan.manage.mapper.IRtkAccountMapper;
+import com.fdkankan.manage.service.*;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.task.DingdingService;
+import com.fdkankan.manage.task.TaskService;
+import com.fdkankan.manage.util.DateUtils;
+import com.fdkankan.manage.util.SendMailUtils;
+import com.fdkankan.manage.vo.request.RtkAccountInParam;
+import com.fdkankan.manage.vo.request.RtkDeviceInParam;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+import com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Service
+@Slf4j
+public class RtkAccountServiceImpl extends ServiceImpl<IRtkAccountMapper, RtkAccount> implements IRtkAccountService {
+
+
+    @Autowired
+    RedisUtil redisUtil;
+    @Autowired
+    IRtkUseLogService rtkUseLogService;
+    @Autowired
+    ISysUserService sysUserService;
+    @Autowired
+    DingdingService dingdingService;
+    @Autowired
+    TaskService taskService;
+    @Autowired
+    ICameraService cameraService;
+    @Autowired
+    ICameraDetailService cameraDetailService;
+    @Autowired
+    IExcelService excelService;
+
+    @Override
+    public RtkAccount getOneNotUseAccount(String rtkSnCode,String cameraSn) {
+        String redisKey = "4dkankan:rtk:snCode:"+rtkSnCode;
+        Long time = 8 * 60 * 60L;
+        if(StringUtils.isNotBlank(cameraSn)){
+            Camera camera = cameraService.getBySnCode(cameraSn);
+            if(camera != null){
+                CameraDetail cameraDetail = cameraDetailService.getByCameraId(camera.getId());
+                if(cameraDetail != null && ( cameraDetail.getType() == 10 || cameraDetail.getType() == 11)){
+                    time = 4 * 60 * 60L;
+                }
+            }
+        }
+        if(redisUtil.hasKey(redisKey)){
+            String jsonStr = redisUtil.get(redisKey);
+            RtkAccount rtkAccount = JSONObject.parseObject(jsonStr, RtkAccount.class);
+            log.info("rtkAccount:{}",jsonStr);
+            Boolean flag = checkAccountFailureTime(rtkAccount.getId());
+            if(flag){
+                redisUtil.expire(redisKey,time);
+                return rtkAccount;
+            }else {
+                redisUtil.del(redisKey);
+            }
+        }
+
+        List<RtkAccount> list = this.getByNotUseList();
+        if(list == null || list.isEmpty()){
+            //账号库存不足,钉钉通知
+            dingdingService.sendDingDingMsg(0);
+            throw new BusinessException(ResultCode.RTK_ACCOUNT_NOT_EXIT);
+        }
+        dingdingService.modelThreshold(list.size() -1,this.getByCanUseList().size());
+
+        RtkAccount rtkAccount = null;
+        RtkUseLog rtkUseLog = rtkUseLogService.getByRtkSn(rtkSnCode);
+        if(rtkUseLog != null && rtkUseLog.getRtkAccountId() != null){
+            RtkAccount rtkAccount2 = this.getById(rtkUseLog.getRtkAccountId());
+            if(rtkAccount2 != null && rtkAccount2.getStatus() == 1 && rtkAccount2.getUseStatus() == 0 && rtkAccount2.getFailureTime() !=null &&  rtkAccount2.getFailureTime().getTime() > new Date().getTime()){
+                rtkAccount = rtkAccount2;
+            }
+        }
+        if(rtkAccount == null){
+            rtkAccount = list.get(0);
+        }
+
+        updateAccountStatus(rtkAccount.getId(),2);
+        redisUtil.set(redisKey,JSONObject.toJSONString(rtkAccount),time);
+        return rtkAccount;
+    }
+
+
+    private Boolean checkAccountFailureTime(Integer accountId) {
+        RtkAccount dbRtkAccount = this.getById(accountId);
+        if(dbRtkAccount == null  || dbRtkAccount.getUseStatus() == 1){
+            return false;
+        }
+        if(dbRtkAccount.getFailureTime() != null &&  dbRtkAccount.getFailureTime().getTime() <= new Date().getTime() ){
+            return false;
+        }
+        return true;
+    }
+
+    @Override
+    public void updateAccountStatus(Integer id, int status) {
+        LambdaUpdateWrapper<RtkAccount> wrapper1 = new LambdaUpdateWrapper<>();
+        wrapper1.eq(RtkAccount::getId,id);
+        wrapper1.set(RtkAccount::getStatus,status);
+        this.update(wrapper1);
+    }
+
+    @Override
+    public void stop(RtkDevice rtkDevice,String clientIP,String cameraSn) {
+        String redisKey = "4dkankan:rtk:snCode:"+rtkDevice.getRtkSnCode();
+        if(redisUtil.hasKey(redisKey)){
+            String jsonStr = redisUtil.get(redisKey);
+            RtkAccount rtkAccount = JSONObject.parseObject(jsonStr, RtkAccount.class);
+            rtkUseLogService.saveLog(rtkDevice,clientIP,rtkAccount,cameraSn);
+            updateAccountStatus(rtkAccount.getId(),1);
+            redisUtil.del(redisKey);
+        }
+    }
+
+    @Override
+    public Object pageList(RtkInfoParam param) {
+        LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(param.getUserName())){
+            wrapper.like(RtkAccount::getUserName,param.getUserName());
+        }
+        if(StringUtils.isNotBlank(param.getOperator())){
+            wrapper.like(RtkAccount::getOperator,param.getOperator());
+        }
+        if(StringUtils.isNotBlank(param.getStartTime())&& StringUtils.isNotBlank(param.getEndTime()) ) {
+            wrapper.between(RtkAccount::getCreateTime,param.getStartTime(),param.getEndTime());
+        }
+        wrapper.orderByDesc(RtkAccount::getCreateTime);
+        wrapper.orderByDesc(RtkAccount::getId);
+        Page<RtkAccount> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
+        Set<Long> createUserIds = page.getRecords().stream().map(RtkAccount::getCreateUserId).collect(Collectors.toSet());
+        HashMap<Long, SysUser> byIds = sysUserService.getByIds(createUserIds);
+
+        for (RtkAccount record : page.getRecords()) {
+            SysUser sysUser = byIds.get(record.getCreateUserId());
+            if(sysUser != null){
+                record.setCreateUserName(sysUser.getUserName());
+                record.setCreateNickName(sysUser.getNickName());
+            }
+        }
+        return PageInfo.PageInfo(page);
+    }
+
+    @Override
+    public void saveOrEditEntity(RtkAccount param) {
+        if(StringUtils.isBlank(param.getUserName()) || param.getPassword() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        RtkAccount rtkAccount = this.getByUserName(param.getUserName());
+        if(rtkAccount != null && param.getId() == null){
+            throw new BusinessException(ResultCode.RTK_USERNAME_EXIST);
+        }
+        if(rtkAccount != null && !param.getId().equals(rtkAccount.getId())){
+            throw new BusinessException(ResultCode.RTK_USERNAME_EXIST);
+        }
+        if(param.getId()== null){
+            param.setCreateUserId(Long.valueOf(StpUtil.getLoginId().toString()));
+        }
+        if(param.getId()!= null){
+            param.setUpdateUserId(Long.valueOf(StpUtil.getLoginId().toString()));
+        }
+
+        this.saveOrUpdate(param);
+    }
+
+    @Override
+    public void del(RtkAccount param) {
+        if(param.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        RtkAccount rtkAccount = this.getById(param.getId());
+        if(rtkAccount != null){
+            LambdaUpdateWrapper<RtkAccount> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(RtkAccount::getId,param.getId());
+            wrapper.set(RtkAccount::getDelUserId,Long.valueOf(StpUtil.getLoginId().toString()));
+            wrapper.set(RtkAccount::getRecStatus,rtkAccount.getId());
+            this.update(wrapper);
+        }
+    }
+
+    @Override
+    public RtkAccount getByUserName(String userName) {
+        LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkAccount::getUserName,userName);
+        return this.getOne(wrapper);
+    }
+
+
+    @Override
+    public Integer insExcelList(List<HashMap<Integer, String>> excelRowList) {
+        List<RtkAccountInParam> params = new ArrayList<>();
+        List<Integer> errorIndex = new ArrayList<>();
+        Integer index = 0;
+        for (HashMap<Integer, String> map : excelRowList) {
+            index ++;
+            if(map.isEmpty()){
+                continue;
+            }
+            if(index == 0 && !map.get(0).equals("差分账号批量导入模板")){
+                throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
+            }
+            if(index <4){
+                continue;
+            }
+            String userName = map.get(0);
+            String password = map.get(1);
+            String operator = map.get(2);
+            String ipAddr = map.get(3);
+            String mountPoint = map.get(4);
+            String port = map.get(5);
+            String failureTimeStr = map.get(6);
+            if(StringUtils.isBlank(userName) && StringUtils.isBlank(password) && StringUtils.isBlank(operator) && StringUtils.isBlank(ipAddr)
+                    && StringUtils.isBlank(mountPoint)&& StringUtils.isBlank(port)&& StringUtils.isBlank(failureTimeStr)){
+                continue;
+            }
+
+            log.info("rtkAccount-excel-in--userName:{},password:{},operator:{},ipAddr:{},mountPoint:{},port:{},failureTime:{}",userName,password,operator,ipAddr,mountPoint,port,failureTimeStr);
+            if(StringUtils.isBlank(userName) || StringUtils.isBlank(password) || StringUtils.isBlank(operator)|| StringUtils.isBlank(ipAddr) || StringUtils.isBlank(mountPoint) || StringUtils.isBlank(port)){
+                errorIndex.add(index -3);
+                continue;
+            }
+            RtkAccount rtkAccount = this.getByUserName(userName);
+            if(rtkAccount !=null){
+                errorIndex.add(index -3);
+                continue;
+            }
+            Date failureTime = null;
+            if(StringUtils.isNotBlank(failureTimeStr)){
+                try {
+                    failureTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(failureTimeStr);
+                } catch (ParseException e) {
+                    errorIndex.add(index -3);
+                    continue;
+                }
+            }
+            RtkAccountInParam param = new RtkAccountInParam(userName,password,operator,ipAddr,mountPoint,port,failureTime);
+            params.add(param);
+        }
+        excelService.toExcelError(errorIndex);
+
+        if(params.size() <=0){
+            throw new BusinessException(ResultCode.RTK_DEVICEIN_TEMPLATE_EMPTY);
+        }
+        return this.ins(params);
+    }
+
+    private Integer ins(List<RtkAccountInParam> params) {
+        List<RtkAccount> dbs = new ArrayList<>();
+        for (RtkAccountInParam param : params) {
+            RtkAccount rtkAccount = new RtkAccount();
+            rtkAccount.setUserName(param.getUserName());
+            rtkAccount.setPassword(param.getPassword());
+            rtkAccount.setIpAddr(param.getIpAddr());
+            rtkAccount.setMountPoint(param.getMountPoint());
+            rtkAccount.setPort(param.getPort());
+            rtkAccount.setOperator(param.getOperator());
+            rtkAccount.setFailureTime(param.getFailureTime());
+            rtkAccount.setCreateUserId(Long.valueOf( StpUtil.getLoginId().toString()));
+            dbs.add(rtkAccount);
+        }
+        if(dbs.isEmpty()){
+            return 0;
+        }
+        this.saveBatch(dbs);
+        return dbs.size();
+    }
+
+    @Override
+    public Integer insFailureTimeExcelList(List<HashMap<Integer, String>> excelRowList) {
+        List<RtkAccountInParam> params = new ArrayList<>();
+        List<Integer> errorIndex = new ArrayList<>();
+        Integer index = 0;
+        for (HashMap<Integer, String> map : excelRowList) {
+            index++;
+            if (map.isEmpty()) {
+                continue;
+            }
+            if (index == 0 && !map.get(0).equals("到期时间批量导入模板")) {
+                throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
+            }
+            if (index < 4) {
+                continue;
+            }
+            String userName = map.get(0);
+            String failureTimeStr = map.get(1);
+            if(StringUtils.isBlank(userName)  && StringUtils.isBlank(failureTimeStr)){
+                continue;
+            }
+
+            log.info("rtkAccount-excel-in--userName:{},failureTime:{}",userName,failureTimeStr);
+            if(StringUtils.isBlank(userName) || StringUtils.isBlank(failureTimeStr)){
+                errorIndex.add(index -3);
+                continue;
+            }
+            RtkAccount rtkAccount = this.getByUserName(userName);
+            if(rtkAccount == null){
+                continue;
+            }
+            Date failureTime = null;
+            if(StringUtils.isNotBlank(failureTimeStr)){
+                try {
+                    failureTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(failureTimeStr);
+                } catch (ParseException e) {
+                    //errorIndex.add(index -3);
+                    continue;
+                }
+            }
+            RtkAccountInParam param = new RtkAccountInParam(userName,failureTime);
+            params.add(param);
+        }
+
+        excelService.toExcelError(errorIndex);
+
+        if(params.size() <=0){
+            throw new BusinessException(ResultCode.RTK_USERNAME_TEMPLATE_EMPTY);
+        }
+        return this.updateFailureTime(params);
+    }
+
+    private Integer updateFailureTime(List<RtkAccountInParam> params) {
+        for (RtkAccountInParam param : params) {
+            LambdaUpdateWrapper<RtkAccount> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(RtkAccount::getUserName,param.getUserName());
+            wrapper.set(RtkAccount::getFailureTime,param.getFailureTime());
+            this.update(wrapper);
+        }
+        return params.size();
+    }
+
+    @Override
+    public List<RtkAccount> getByNotUseList() {
+        return this.getBaseMapper().getByNotUseList();
+    }
+    @Override
+    public List<RtkAccount> getByCanUseList() {
+        return this.getBaseMapper().getByCanUseList();
+    }
+}

+ 258 - 0
src/main/java/com/fdkankan/manage/service/impl/RtkDeviceServiceImpl.java

@@ -0,0 +1,258 @@
+package com.fdkankan.manage.service.impl;
+
+import cn.dev33.satoken.stp.StpUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.constant.CameraOutTypeEnum;
+import com.fdkankan.manage.constant.RtkTypeEnum;
+import com.fdkankan.manage.entity.*;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.mapper.IRtkDeviceMapper;
+import com.fdkankan.manage.service.ICameraService;
+import com.fdkankan.manage.service.IExcelService;
+import com.fdkankan.manage.service.IRtkDeviceService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.service.ISysUserService;
+import com.fdkankan.manage.vo.request.CameraInOutParam;
+import com.fdkankan.manage.vo.request.RtkDeviceInParam;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Service
+@Slf4j
+public class RtkDeviceServiceImpl extends ServiceImpl<IRtkDeviceMapper, RtkDevice> implements IRtkDeviceService {
+
+    @Autowired
+    ISysUserService sysUserService;
+    @Autowired
+    IExcelService excelService;
+    @Autowired
+    ICameraService cameraService;
+    @Override
+    public RtkDevice getByRtkSnCode(String rtkSnCode) {
+        LambdaQueryWrapper<RtkDevice> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkDevice::getRtkSnCode,rtkSnCode);
+        List<RtkDevice> list = this.list(wrapper);
+        if(list == null || list.isEmpty()){
+            return null;
+        }
+        return list.get(0);
+    }
+
+    @Override
+    public Object pageList(RtkInfoParam param) {
+        LambdaQueryWrapper<RtkDevice> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(param.getRtkSnCode())){
+            wrapper.like(RtkDevice::getRtkSnCode,param.getRtkSnCode());
+        }
+        if(StringUtils.isNotBlank(param.getCameraSn())){
+            wrapper.like(RtkDevice::getCameraSn,param.getCameraSn());
+        }
+        if(StringUtils.isNotBlank(param.getSgRtkSn())){
+            wrapper.like(RtkDevice::getSgRtkSn,param.getSgRtkSn());
+        }
+        if(StringUtils.isNotBlank(param.getStartTime())&& StringUtils.isNotBlank(param.getEndTime()) ) {
+            wrapper.between(RtkDevice::getCreateTime,param.getStartTime(),param.getEndTime());
+        }
+        wrapper.orderByDesc(RtkDevice::getCreateTime);
+        wrapper.orderByDesc(RtkDevice::getId);
+        Page<RtkDevice> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
+        Set<Long> createUserIds = page.getRecords().stream().map(RtkDevice::getCreateUserId).collect(Collectors.toSet());
+        HashMap<Long, SysUser> byIds = sysUserService.getByIds(createUserIds);
+
+        for (RtkDevice record : page.getRecords()) {
+            SysUser sysUser = byIds.get(record.getCreateUserId());
+            if(sysUser != null){
+                record.setCreateUserName(sysUser.getUserName());
+                record.setCreateNickName(sysUser.getNickName());
+            }
+        }
+        return PageInfo.PageInfo(page);
+    }
+
+    @Override
+    public void saveOrEditEntity(RtkDevice param) {
+        if(StringUtils.isBlank(param.getRtkSnCode()) || param.getRtkType() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        RtkDevice rtkDevice = this.getByRtkSnCode(param.getRtkSnCode());
+        if(rtkDevice != null && param.getId() == null){
+            throw new BusinessException(ResultCode.RTK_SN_EXIST);
+        }
+        if(rtkDevice != null && !param.getId().equals(rtkDevice.getId())){
+            throw new BusinessException(ResultCode.RTK_SN_EXIST);
+        }
+        RtkDevice  rtkDevice2 = null;
+        if(StringUtils.isNotBlank(param.getSgRtkSn())){
+            rtkDevice2 = this.getSgRtkSn(param.getSgRtkSn());
+        }
+        if(rtkDevice2 != null && param.getId() == null){
+            throw new BusinessException(ResultCode.SGRTK_SN_EXIST);
+        }
+        if(rtkDevice2 != null && !param.getId().equals(rtkDevice2.getId())){
+            throw new BusinessException(ResultCode.SGRTK_SN_EXIST);
+        }
+        RtkDevice  rtkDevice3 = null;
+        if(StringUtils.isNotBlank(param.getCameraSn())){
+            Camera camera = cameraService.getBySnCode(param.getCameraSn());
+            if(camera == null){
+                throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
+            }
+            rtkDevice3 = this.getByCameraSn(param.getCameraSn());
+        }
+        if(rtkDevice3 != null && param.getId() == null){
+            throw new BusinessException(ResultCode.CAMERA_SN_EXIST);
+        }
+        if(rtkDevice3 != null && !param.getId().equals(rtkDevice3.getId())){
+            throw new BusinessException(ResultCode.CAMERA_SN_EXIST);
+        }
+        if(param.getId()== null){
+            param.setCreateUserId(Long.valueOf(StpUtil.getLoginId().toString()));
+        }
+        if(param.getId()!= null){
+            param.setUpdateUserId(Long.valueOf(StpUtil.getLoginId().toString()));
+        }
+        this.saveOrUpdate(param);
+    }
+
+    @Override
+    public void del(RtkDevice param) {
+        if(param.getId() == null){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        RtkDevice rtkDevice = this.getById(param.getId());
+        if(rtkDevice != null){
+            LambdaUpdateWrapper<RtkDevice> wrapper = new LambdaUpdateWrapper<>();
+            wrapper.eq(RtkDevice::getId,param.getId());
+            wrapper.set(RtkDevice::getDelUserId,Long.valueOf(StpUtil.getLoginId().toString()));
+            wrapper.set(RtkDevice::getRecStatus,rtkDevice.getId());
+            this.update(wrapper);
+        }
+
+    }
+
+
+    @Override
+    public RtkDevice getSgRtkSn(String sgRtkSn) {
+        LambdaQueryWrapper<RtkDevice> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkDevice::getSgRtkSn,sgRtkSn);
+        return this.getOne(wrapper);
+    }
+
+    @Override
+    public RtkDevice getByCameraSn(String cameraSnCode) {
+        LambdaQueryWrapper<RtkDevice> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkDevice::getCameraSn,cameraSnCode);
+        List<RtkDevice> list = this.list(wrapper);
+        if(list == null || list.isEmpty()){
+            return null;
+        }
+        return list.get(0);
+    }
+
+    @Override
+    public Integer insExcelList(List<HashMap<Integer, String>> excelRowList) {
+        List<RtkDeviceInParam> params = new ArrayList<>();
+        List<Integer> errorIndex = new ArrayList<>();
+        HashSet<String> rtkSnSet = new HashSet<>();
+        HashSet<String> cameraSnSet = new HashSet<>();
+        Integer index = 0;
+        for (HashMap<Integer, String> map : excelRowList) {
+            index ++;
+            if(map.isEmpty()){
+                continue;
+            }
+            if(index == 0 && !map.get(0).equals("RTK批量导入模板")){
+                throw new BusinessException(ResultCode.TEMPLATE_TYPE_ERROR);
+            }
+            if(index <4){
+                continue;
+            }
+            String cameraSn = map.get(0);
+            String rtkTypeStr = map.get(1);
+            String rtkSn = map.get(2);
+            String rtkSgSn = map.get(3);
+            if(StringUtils.isBlank(cameraSn) && StringUtils.isBlank(rtkTypeStr) && StringUtils.isBlank(rtkSn) && StringUtils.isBlank(rtkSgSn)){
+                continue;
+            }
+            log.info("rtkDevice-excel-in--cameraSn:{},rtkTypeStr:{},rtkSn:{},rtkSgSn:{},index:{}",cameraSn,rtkTypeStr,rtkSn,rtkSgSn,index);
+            RtkTypeEnum rtkTypeEnum = RtkTypeEnum.getByMsg(rtkTypeStr);
+            if(StringUtils.isBlank(rtkSn) || rtkTypeEnum == null){
+                errorIndex.add(index -3);
+                continue;
+            }
+            RtkDevice rtkDevice = this.getByRtkSnCode(rtkSn);
+            if(rtkDevice !=null){
+                errorIndex.add(index -3);
+                continue;
+            }
+            if(rtkSnSet.contains(rtkSn)){
+                errorIndex.add(index -3);
+                continue;
+            }
+            rtkSnSet.add(rtkSn);
+            if(StringUtils.isNotBlank(cameraSn)){
+                Camera camera = cameraService.getBySnCode(cameraSn);
+                if(camera == null){
+                    errorIndex.add(index -3);
+                    continue;
+                }
+                RtkDevice rtkDevice2 = this.getByCameraSn(cameraSn);
+                if(rtkDevice2 !=null){
+                    errorIndex.add(index -3);
+                    continue;
+                }
+                if(cameraSnSet.contains(cameraSn)){
+                    errorIndex.add(index -3);
+                    continue;
+                }
+                cameraSnSet.add(cameraSn);
+
+            }
+            RtkDeviceInParam param = new RtkDeviceInParam(cameraSn,rtkTypeEnum.getCode(),rtkSn,rtkSgSn);
+            params.add(param);
+        }
+        excelService.toExcelError(errorIndex);
+
+        if(params.size() <=0){
+            throw new BusinessException(ResultCode.RTK_DEVICEIN_TEMPLATE_EMPTY);
+        }
+        return this.ins(params);
+    }
+
+    private Integer ins(List<RtkDeviceInParam> params) {
+        List<RtkDevice> dbs = new ArrayList<>();
+        for (RtkDeviceInParam param : params) {
+            RtkDevice rtkDevice = new RtkDevice();
+            rtkDevice.setRtkSnCode(param.getRtkSn());
+            rtkDevice.setCameraSn(param.getCameraSn());
+            rtkDevice.setSgRtkSn(param.getRtkSgSn());
+            rtkDevice.setRtkType(param.getRtkType());
+            rtkDevice.setCreateUserId(Long.valueOf( StpUtil.getLoginId().toString()));
+            dbs.add(rtkDevice);
+        }
+        if(dbs.isEmpty()){
+            return 0;
+        }
+        this.saveBatch(dbs);
+        return dbs.size();
+    }
+}

+ 2 - 2
src/main/java/com/fdkankan/manage/service/impl/RtkInfoServiceImpl.java

@@ -59,8 +59,8 @@ public class RtkInfoServiceImpl extends ServiceImpl<IRtkInfoMapper, RtkInfo> imp
         if(StringUtils.isNotBlank(param.getOperator())){
             wrapper.like(RtkInfo::getOperator,param.getOperator());
         }
-        if(StringUtils.isNotBlank(param.getCameraSnCode())){
-            wrapper.like(RtkInfo::getCameraSnCode,param.getCameraSnCode());
+        if(StringUtils.isNotBlank(param.getCameraSn())){
+            wrapper.like(RtkInfo::getCameraSnCode,param.getCameraSn());
         }
         if(StringUtils.isNotBlank(param.getSgRtkSn())){
             wrapper.like(RtkInfo::getSgRtkSn,param.getSgRtkSn());

+ 138 - 0
src/main/java/com/fdkankan/manage/service/impl/RtkUseLogServiceImpl.java

@@ -0,0 +1,138 @@
+package com.fdkankan.manage.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.PageInfo;
+import com.fdkankan.manage.entity.*;
+import com.fdkankan.manage.mapper.IRtkUseLogMapper;
+import com.fdkankan.manage.service.IRtkUseLogService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.manage.vo.request.RtkInfoParam;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-07-22
+ */
+@Service
+public class RtkUseLogServiceImpl extends ServiceImpl<IRtkUseLogMapper, RtkUseLog> implements IRtkUseLogService {
+
+    @Override
+    public void saveLog(RtkInfo rtkInfo, String clientIP,Integer rtkAccountId,String cameraSn,RtkDevice rtkDevice) {
+        RtkUseLog rtkUseLog = new RtkUseLog();
+        BeanUtils.copyProperties(rtkInfo,rtkUseLog);
+        rtkUseLog.setId(null);
+        rtkUseLog.setCreateTime(null);
+        rtkUseLog.setUpdateTime(null);
+        rtkUseLog.setVisitIp(clientIP);
+        rtkUseLog.setRtkAccountId(rtkAccountId);
+        rtkUseLog.setUseType(0);
+        rtkUseLog.setCameraSn(cameraSn);
+        rtkUseLog.setSgRtkSn(rtkDevice.getSgRtkSn());
+        this.save(rtkUseLog);
+    }
+
+    @Override
+    public void saveLog(RtkInfo rtkInfo, String clientIP,String cameraSn,Integer useType) {
+        RtkUseLog rtkUseLog = new RtkUseLog();
+        BeanUtils.copyProperties(rtkInfo,rtkUseLog);
+        rtkUseLog.setId(null);
+        rtkUseLog.setCreateTime(null);
+        rtkUseLog.setUpdateTime(null);
+        rtkUseLog.setVisitIp(clientIP);
+        rtkUseLog.setRtkAccountId(null);
+        rtkUseLog.setUseType(useType);
+        rtkUseLog.setCameraSn(cameraSn);
+        this.save(rtkUseLog);
+    }
+
+    @Override
+    public void saveLog(RtkDevice rtkDevice, String clientIP, RtkAccount rtkAccount,String cameraSn) {
+        RtkUseLog rtkUseLog = new RtkUseLog();
+        rtkUseLog.setVisitIp(clientIP);
+        rtkUseLog.setRtkSnCode(rtkDevice.getRtkSnCode());
+        rtkUseLog.setSgRtkSn(rtkDevice.getSgRtkSn());
+        rtkUseLog.setCameraSn(cameraSn);
+        rtkUseLog.setUserName(rtkAccount.getUserName());
+        rtkUseLog.setPassword(rtkAccount.getPassword());
+        rtkUseLog.setIpAddr(rtkAccount.getIpAddr());
+        rtkUseLog.setMountPoint(rtkAccount.getMountPoint());
+        rtkUseLog.setPort(rtkAccount.getPort());
+        rtkUseLog.setOperator(rtkAccount.getOperator());
+        rtkUseLog.setRtkType(rtkDevice.getRtkType());
+        rtkUseLog.setAccountStatus(rtkAccount.getStatus());
+        rtkUseLog.setVisitIp(clientIP);
+        rtkUseLog.setRtkAccountId(rtkAccount.getId());
+        rtkUseLog.setUseType(1);
+        this.save(rtkUseLog);
+    }
+
+    @Override
+    public void saveLog(RtkAccount rtkAccount) {
+        LambdaQueryWrapper<RtkUseLog> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkUseLog::getUserName,rtkAccount.getUserName());
+        wrapper.eq(RtkUseLog::getUseType,0);
+        wrapper.orderByDesc(RtkUseLog::getId);
+        List<RtkUseLog> logList = this.list(wrapper);
+        if(logList.isEmpty()){
+            return;
+        }
+        RtkUseLog rtkUseLog = logList.get(0);
+        rtkUseLog.setId(null);
+        rtkUseLog.setUseType(1);
+        rtkUseLog.setCreateTime(null);
+        rtkUseLog.setUpdateTime(null);
+        this.save(rtkUseLog);
+    }
+
+    @Override
+    public RtkUseLog getByRtkSn(String rtkSnCode) {
+        LambdaQueryWrapper<RtkUseLog> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkUseLog::getRtkSnCode,rtkSnCode);
+        wrapper.eq(RtkUseLog::getUseType,0);
+        wrapper.orderByDesc(RtkUseLog::getId);
+        List<RtkUseLog> list = this.list(wrapper);
+        if(list != null && !list.isEmpty()){
+            return list.get(0);
+        }
+        return null;
+    }
+
+    @Override
+    public Object pageList(RtkInfoParam param) {
+        LambdaQueryWrapper<RtkUseLog> wrapper = new LambdaQueryWrapper<>();
+        if(StringUtils.isNotBlank(param.getRtkSnCode())){
+            wrapper.like(RtkUseLog::getRtkSnCode,param.getRtkSnCode());
+        }
+        if(StringUtils.isNotBlank(param.getCameraSn())){
+            wrapper.like(RtkUseLog::getCameraSn,param.getCameraSn());
+        }
+        if(StringUtils.isNotBlank(param.getSgRtkSn())){
+            wrapper.like(RtkUseLog::getSgRtkSn,param.getSgRtkSn());
+        }
+        if(StringUtils.isNotBlank(param.getUserName())){
+            wrapper.like(RtkUseLog::getUserName,param.getUserName());
+        }
+        if(param.getUseType() !=null){
+            wrapper.eq(RtkUseLog::getUseType,param.getUseType());
+        }
+        if(StringUtils.isNotBlank(param.getStartTime())&& StringUtils.isNotBlank(param.getEndTime()) ) {
+            wrapper.between(RtkUseLog::getCreateTime,param.getStartTime(),param.getEndTime());
+        }
+        wrapper.orderByDesc(RtkUseLog::getCreateTime);
+        wrapper.orderByDesc(RtkUseLog::getId);
+        Page<RtkUseLog> page = this.page(new Page<>(param.getPageNum(), param.getPageSize()), wrapper);
+        return PageInfo.PageInfo(page);
+    }
+}

+ 6 - 0
src/main/java/com/fdkankan/manage/service/impl/SceneProServiceImpl.java

@@ -236,11 +236,17 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         HashMap<String, JSONObject> laserMap = new HashMap<>();
         if(param.getType() == 2 && StringUtils.isNotBlank(param.getSceneName())){
             laserMap = laserService.list(param.getSceneName(), 4);
+            if(laserMap.isEmpty()){
+                return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
+            }
             param.setSceneName(null);
         }
         if(param.getType() == 6 && StringUtils.isNotBlank(param.getSceneName())){
             laserMap = laserService.list(param.getSceneName(), 5);
             param.setSceneName(null);
+            if(laserMap.isEmpty()){
+                return PageInfo.PageInfoEmpty(param.getPageNum(),param.getPageSize());
+            }
         }
         if(!laserMap.isEmpty()){
             Set<String> keySet = laserMap.keySet();

+ 63 - 0
src/main/java/com/fdkankan/manage/task/DingdingService.java

@@ -0,0 +1,63 @@
+package com.fdkankan.manage.task;
+
+import com.fdkankan.dingtalk.DingTalkSendUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.cloud.context.config.annotation.RefreshScope;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+@Service
+@Slf4j
+@RefreshScope
+public class DingdingService {
+
+    @Autowired
+    DingTalkSendUtils dingTalkSendUtils;
+
+
+    private static String msgPattern =
+            "**域名**: %s\n\n" +
+                    "**库存数量**: %s\n\n" ;
+
+
+    @Value("${main.url}")
+    String mainUrl;
+    @Value("${dingtalk.threshold:0.2}")
+    String threshold;
+
+    public void sendDingDingMsg(Integer count){
+        try {
+            String format = String.format(msgPattern, mainUrl, count);
+            dingTalkSendUtils.sendActioncardMsgToDingRobot(format,"RTK账号库存预警");
+        }catch (Exception e){
+            log.info("发送钉钉消息失败:{}",e);
+        }
+    }
+
+    public void modelThreshold(int size,long total) {
+        try {
+            if(size == 0){
+                this.sendDingDingMsg(size);
+                return;
+            }
+            BigDecimal totalCount = new BigDecimal(total);
+            BigDecimal dbCount = new BigDecimal(size);
+
+            BigDecimal divideCount = dbCount.divide(totalCount,2,RoundingMode.HALF_DOWN);
+            BigDecimal thresholdCount = new BigDecimal(threshold).setScale(2,RoundingMode.HALF_DOWN);
+            log.info("modelThreshold--{},{},{},{}",threshold,divideCount,thresholdCount,divideCount.compareTo(thresholdCount));
+            if(divideCount.compareTo(thresholdCount) <= 0 ){
+                this.sendDingDingMsg(size);
+            }
+        }catch (Exception e){
+            log.info("modelThreshold--error:{},{}",size,total,e);
+        }
+
+    }
+
+}

+ 104 - 0
src/main/java/com/fdkankan/manage/task/TaskService.java

@@ -0,0 +1,104 @@
+package com.fdkankan.manage.task;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.manage.common.CacheUtil;
+import com.fdkankan.manage.common.ResultCode;
+import com.fdkankan.manage.entity.RtkAccount;
+import com.fdkankan.manage.exception.BusinessException;
+import com.fdkankan.manage.service.IRtkAccountService;
+import com.fdkankan.manage.service.IRtkUseLogService;
+import com.fdkankan.redis.util.RedisUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+@Service
+@Slf4j
+public class TaskService {
+
+    @Autowired
+    RedisUtil redisUtil;
+    @Autowired
+    IRtkAccountService rtkAccountService;
+    @Autowired
+    DingdingService dingdingService;
+    @Autowired
+    IRtkUseLogService rtkUseLogService;
+
+    @Scheduled(cron = "0 */1 * * * ?")
+    public void task() {
+        try {
+            if("aws".equals(CacheUtil.uploadType)){
+                return;
+            }
+            checkAccount();
+        }catch (Exception e){
+            log.info("定时任务checkAccount出错:",e);
+        }
+
+    }
+
+    @Scheduled(cron = "0 0 * * * ?")
+    public void task2() {
+        try {
+            if("aws".equals(CacheUtil.uploadType)){
+                return;
+            }
+            checkAccountDb();
+        }catch (Exception e){
+            log.info("定时任务checkAccountDb出错:",e);
+        }
+    }
+
+    /**
+     * 检查账号
+     */
+    public void checkAccount() {
+        HashMap<String, String> map = new HashMap<>();
+        String redisKey = "4dkankan:rtk:snCode:*";
+        Set<String> keys = redisUtil.keys(redisKey);
+        if(keys!= null && !keys.isEmpty()){
+            for (String key : keys) {
+                String jsonStr = redisUtil.get(key);
+                RtkAccount rtkAccount = JSONObject.parseObject(jsonStr, RtkAccount.class);
+                map.put(rtkAccount.getUserName(),key);
+            }
+        }
+        LambdaQueryWrapper<RtkAccount> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(RtkAccount::getStatus,2);
+        List<RtkAccount> list = rtkAccountService.list(wrapper);
+        for (RtkAccount rtkAccount : list) {
+            if(map.containsKey(rtkAccount.getUserName())){
+                continue;
+            }
+            rtkAccountService.updateAccountStatus(rtkAccount.getId(),1);
+            rtkUseLogService.saveLog(rtkAccount);
+        }
+
+    }
+
+
+    /**
+     * 检查账号   账号库存不足,钉钉通知
+     */
+    public void checkAccountDb() {
+        List<RtkAccount> list = rtkAccountService.getByNotUseList();
+        if(list == null || list.isEmpty()){
+            dingdingService.sendDingDingMsg(0);
+            return;
+        }
+        dingdingService.modelThreshold(list.size(),rtkAccountService.getByCanUseList().size());
+    }
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/manage/test/TestController.java

@@ -82,7 +82,7 @@ public class TestController {
 
     /**
      * 导入excel
-     * type 0 入库模板, 1出库模板 ,2 客户关联模板
+     * type 0 入库模板, 1出库模板 ,2 客户关联模板 ,3 rtk设备模版,4rtk账号模版
      */
     @PostMapping("/uploadExcel")
     public ResultData uploadExcel(@RequestParam(required = false) MultipartFile file) throws IOException {

+ 52 - 13
src/main/java/com/fdkankan/manage/util/ExcelUtil.java

@@ -1,13 +1,14 @@
 package com.fdkankan.manage.util;
 
+import org.apache.commons.lang3.ObjectUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.IOException;
-import java.io.InputStream;
+import java.io.*;
 import java.text.SimpleDateFormat;
 import java.util.ArrayList;
 import java.util.Date;
@@ -33,19 +34,10 @@ public class ExcelUtil {
             //转换为List数组
             for (int cellNum=0;cellNum<= row.getLastCellNum();cellNum++){
                 Cell cell = row.getCell(cellNum);
-                if (cell != null && cell.getCellTypeEnum() != CellType.STRING && HSSFDateUtil.isCellDateFormatted(cell))
-                {
-                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
-                    Date date = HSSFDateUtil.getJavaDate(cell.getNumericCellValue());
-                    String value = sdf.format(date);
-                    map.put(cellNum,value);
-                    continue;
-                }
                 if(cell != null){
                     DataFormatter dataFormatter = new DataFormatter();
                     String cellValue = dataFormatter.formatCellValue(cell);
                     map.put(cellNum,cellValue);
-
                 }
 
             }
@@ -54,7 +46,7 @@ public class ExcelUtil {
         return rowList;
     }
 
-  private static  String fommartNum(String value){
+    private static  String fommartNum(String value){
         try {
             if(isNumeric2(value) && value.contains(".")){
                 return Double.valueOf(value).intValue() +"";
@@ -63,12 +55,45 @@ public class ExcelUtil {
             return value;
         }
         return value;
-  }
+    }
 
     public static boolean isNumeric2(String str) {
         return str != null && str.matches("-?\\d+(\\.\\d+)?");
     }
 
+    public static List<HashMap<Integer,String>> getExcelRowList(File multipartFile) throws IOException {
+        //行List,也是最终要返回的List
+        List<HashMap<Integer,String>> rowList=new ArrayList<>();
+        Workbook workbook=getExcelWorkBook(multipartFile);
+        Sheet sheet = workbook.getSheetAt(0);
+        if (sheet == null) {
+            throw new IOException("创建Sheet失败!");
+        }
+        //开始遍历行
+        for (int i=0;i<= sheet.getLastRowNum();i++){
+            Row row = sheet.getRow(i);
+            //列List
+            HashMap<Integer,String> map = new HashMap<>();
+            //转换为List数组
+            for (int cellNum=0;cellNum<= row.getLastCellNum();cellNum++){
+                Cell cell = row.getCell(cellNum);
+                if(ObjectUtils.isNotEmpty(cell)){
+                    DataFormatter dataFormatter = new DataFormatter();
+                    String cellValue = dataFormatter.formatCellValue(cell);
+                    System.out.println(cellValue);
+                    map.put(cellNum,cellValue);
+                }
+
+            }
+            rowList.add(map);
+        }
+        return rowList;
+    }
+
+    public static void main(String[] args) throws IOException {
+        getExcelRowList(new File("D:\\abc\\111111\\rtk账号导入模板 (1).xlsx"));
+    }
+
 
     //获取WorkBook对象
     private static Workbook getExcelWorkBook(MultipartFile multipartFile) throws IOException {
@@ -84,4 +109,18 @@ public class ExcelUtil {
             return new XSSFWorkbook(inputStream);
         }
     }
+
+    private static Workbook getExcelWorkBook(File multipartFile) throws IOException {
+        InputStream inputStream = new FileInputStream(multipartFile);
+        String originalFileName=multipartFile.getName();
+        assert originalFileName != null;
+        String fileType=originalFileName.substring(originalFileName.lastIndexOf(".")+1);
+        if (fileType.equalsIgnoreCase("xls")) {
+            //xls格式
+            return new HSSFWorkbook(inputStream);
+        } else {
+            //xlsx格式
+            return new XSSFWorkbook(inputStream);
+        }
+    }
 }

+ 23 - 0
src/main/java/com/fdkankan/manage/vo/request/RtkAccountInParam.java

@@ -0,0 +1,23 @@
+package com.fdkankan.manage.vo.request;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@AllArgsConstructor
+public class RtkAccountInParam {
+    private String userName ;
+    private String password ;
+    private String operator ;
+    private String ipAddr ;
+    private String mountPoint;
+    private String port ;
+    private Date failureTime ;
+
+    public RtkAccountInParam(String userName, Date failureTime) {
+        this.userName = userName;
+        this.failureTime = failureTime;
+    }
+}

+ 13 - 0
src/main/java/com/fdkankan/manage/vo/request/RtkDeviceInParam.java

@@ -0,0 +1,13 @@
+package com.fdkankan.manage.vo.request;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+@Data
+@AllArgsConstructor
+public class RtkDeviceInParam {
+    private String cameraSn ;
+    private Integer rtkType ;
+    private String rtkSn ;
+    private String rtkSgSn ;
+}

+ 2 - 1
src/main/java/com/fdkankan/manage/vo/request/RtkInfoParam.java

@@ -10,8 +10,9 @@ public class RtkInfoParam extends RequestBase{
     private String rtkSnCode;
     private String userName;
     private String operator;
-    private String cameraSnCode;
+    private String cameraSn;
     private String sgRtkSn;
+    private Integer useType;
 
     private List<String> timeList;
 

+ 1 - 0
src/main/java/com/fdkankan/manage/vo/request/UserIncrementParam.java

@@ -52,4 +52,5 @@ public class UserIncrementParam {
     private String remark;
 
     private BigDecimal amount;
+    private String currencySymbol;
 }

+ 4 - 0
src/main/java/com/fdkankan/manage/vo/response/DownOrderVo.java

@@ -63,9 +63,13 @@ public class DownOrderVo {
     private String downTypeStr;
 
 
+
     @ExcelProperty("订单金额")
     private BigDecimal amount;              //订单金额
 
+    @ExcelProperty("币种")
+    private String currencySymbol;              //订单金额
+
     @ExcelProperty("数量")
     private BigDecimal count;             //数量
 

+ 4 - 0
src/main/java/com/fdkankan/manage/vo/response/IncrementOrderVo.java

@@ -58,9 +58,13 @@ public class IncrementOrderVo {
     @ExcelProperty("权益类型")
     private String memberLevels;
 
+
     @ExcelProperty("订单金额")
     private BigDecimal amount;              //订单金额
 
+    @ExcelProperty("币种")
+    private String currencySymbol;              //订单金额
+
     @ExcelProperty("数量")
     private BigDecimal count;             //数量
 

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -5,4 +5,4 @@ logging:
   config: classpath:logback-spring.xml
 mybatis-plus:
   configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl #开启sql日志

+ 5 - 0
src/main/resources/mapper/manage/CurrencyMapper.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.ICurrencyMapper">
+
+</mapper>

+ 2 - 2
src/main/resources/mapper/manage/IncrementOrderMapper.xml

@@ -5,7 +5,7 @@
     <select id="pageList" resultType="com.fdkankan.manage.vo.response.IncrementOrderVo">
         select o.id,o.trade_time ,o.order_sn,o.member_levels,o.amount,o.count,o.pay_type,o.number,o.pay_status,o.time_zone_off,o.increment_id,o.create_time,
                null as customer_name,0 as customer_type,null as end_customer,null as use_type ,null as project_num ,
-               null as remark,null as agentName,null as agentId,
+               null as remark,null as agentName,null as agentId,o.currency_symbol,
                 u.user_name,u.nick_name,
                '线上' as payMethod
         from  t_increment_order o
@@ -16,7 +16,7 @@
         </if>
         union all
         select o.id,o.trade_time ,o.order_sn,o.member_levels,o.amount,o.count,o.pay_type,o.number,o.pay_status,o.time_zone_off,o.increment_id,o.create_time,
-        o.customer_name,o.customer_type,o.end_customer,o.use_type,o.project_num,o.remark,o.agent_name,o.agent_id,
+        o.customer_name,o.customer_type,o.end_customer,o.use_type,o.project_num,o.remark,o.agent_name,o.agent_id,o.currency_symbol,
         u.user_name,u.nick_name ,'线下'as payMethod from t_increment_order_mg o
         left join t_user u on o.user_id = u.id
         <include refid="commonWhere"></include>

+ 13 - 0
src/main/resources/mapper/manage/RtkAccountMapper.xml

@@ -0,0 +1,13 @@
+<?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.IRtkAccountMapper">
+
+    <select id="getByNotUseList" resultType="com.fdkankan.manage.entity.RtkAccount">
+        SELECT * FROM t_rtk_account WHERE rec_status = 'A' and `status` in (0,1) and use_status = 0 and (failure_time is  null or failure_time &gt; NOW())
+        order by update_time asc,id asc
+    </select>
+
+    <select id="getByCanUseList" resultType="com.fdkankan.manage.entity.RtkAccount">
+        SELECT * FROM t_rtk_account WHERE rec_status = 'A'  and use_status = 0 and (failure_time is  null or failure_time &gt; NOW())
+    </select>
+</mapper>

+ 5 - 0
src/main/resources/mapper/manage/RtkDeviceMapper.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.IRtkDeviceMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/manage/RtkUseLogMapper.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.IRtkUseLogMapper">
+
+</mapper>

BIN
src/main/resources/template/cameraCompany.xlsx


BIN
src/main/resources/template/cameraIn.xlsx


BIN
src/main/resources/template/cameraOut.xlsx


BIN
src/main/resources/template/rtkAccount.xlsx


BIN
src/main/resources/template/rtkAccountFailureTime.xlsx


BIN
src/main/resources/template/rtkDevice.xlsx