lyhzzz 11 месяцев назад
Родитель
Сommit
2d32f24e52

+ 39 - 0
README.md

@@ -136,3 +136,42 @@
 ~~~~
 
 
+###**v2.8.0**
+~~~~
+1.rtk管理,rtk设备
+    添加字段 
+    accountType     0账号池,1专用账号
+    cameraType      0看看,1看见,2深时,3深光
+    userName
+    password
+    ipAddr
+    mountPoint
+    port
+    operator
+2.场景列表
+    添加字段
+    computeTime  计算时长,秒
+    
+    拍摄模式: location
+    3(SFM架站式-看看场景), 
+    4(SFM架站式-看见/深时/深光场景),
+    5(SLAM移动定位模式) , 
+    6(SLAM移动定位模式-有点位)
+   
+    mixture     是否为混合类型   0 无点位, 
+                                1 有点位,
+    slamCount   slam帧数 
+    
+    新增查询条件
+       shootCounts; 点位数量 数组,0元素表示最小,1元素表示最大
+       locations;  场景类型 数组  3,4为架展示,5,6为slam
+3.权益管理
+    添加绑定相机功能
+    http://120.25.146.52:3090/project/102/interface/api/10542
+    添加移除相机功能
+    http://120.25.146.52:3090/project/102/interface/api/10544
+                                
+~~~~
+
+
+

+ 15 - 0
doc/update.2.8.0.sql

@@ -0,0 +1,15 @@
+ALTER TABLE `4dkankan_v4`.`t_rtk_device`
+    ADD COLUMN `account_type` int NULL DEFAULT 0 COMMENT '0账号池,1专用账号' AFTER `failure_time`;
+ALTER TABLE `4dkankan_v4`.`t_rtk_device`
+    ADD COLUMN `camera_type` int NULL COMMENT '0看看,1看见,2深时,3深光' AFTER `account_type`;
+
+ALTER TABLE `4dkankan_v4`.`t_rtk_device`
+    ADD COLUMN `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL AFTER `camera_type`,
+ADD COLUMN `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL AFTER `user_name`,
+ADD COLUMN `ip_addr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL AFTER `password`,
+ADD COLUMN `mount_point` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL AFTER `ip_addr`,
+ADD COLUMN `port` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL AFTER `mount_point`,
+ADD COLUMN `operator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '运营商' AFTER `port`;
+
+ALTER TABLE `4dkankan_v4`.`t_rtk_account`
+DROP COLUMN `type`;

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

@@ -107,6 +107,12 @@ public enum ResultCode  {
 
     RTK_USERNAME_TEMPLATE_EMPTY(50083, "批量导入数据为空或账号不存在"),
     AGENT_HAVE_SUB(50084, "当前分销商存在下级,请删除下级后再重试"),
+
+    INCREMENT_BIND_CAMERA_ERROR(50085, "相机已绑定权益,请移除后绑定!"),
+    INCREMENT_UNBIND_CAMERA_ERROR(50086, "相机未绑定权益!"),
+    INCREMENT_BIND_ERROR(50087, "权益不存在或已过期!"),
+    INCREMENT_BIND_ERROR2(50088, "权益已绑定相机!"),
+
     ;
 
     private Integer code;

+ 13 - 0
src/main/java/com/fdkankan/manage/controller/UserController.java

@@ -12,6 +12,7 @@ import com.fdkankan.manage.service.IIncrementTypeService;
 import com.fdkankan.manage.service.IUserIncrementService;
 import com.fdkankan.manage.service.IUserService;
 import com.fdkankan.manage.vo.request.CameraParam;
+import com.fdkankan.manage.vo.request.IncrementBindCameraParam;
 import com.fdkankan.manage.vo.request.UserIncrementParam;
 import com.fdkankan.manage.vo.request.UserParam;
 import org.apache.commons.lang3.StringUtils;
@@ -158,5 +159,17 @@ public class UserController {
         userService.ReUcenterUserPassword(userParam);
         return ResultData.ok();
     }
+
+    @PostMapping("/incrementBindCamera")
+    public ResultData incrementBindCamera(@RequestBody IncrementBindCameraParam userParam){
+        userIncrementService.incrementBindCamera(userParam);
+        return ResultData.ok();
+    }
+
+    @PostMapping("/incrementUnBindCamera")
+    public ResultData incrementUnBindCamera(@RequestBody IncrementBindCameraParam userParam){
+        userIncrementService.incrementUnBindCamera(userParam);
+        return ResultData.ok();
+    }
 }
 

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

@@ -48,12 +48,6 @@ public class RtkAccount implements Serializable {
     private String port;
 
     /**
-     * 0移动
-     */
-    @TableField("type")
-    private String type;
-
-    /**
      * 运营商
      */
     @TableField("operator")

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

@@ -42,6 +42,33 @@ public class RtkDevice implements Serializable {
     @TableField("use_status")
     private Integer useStatus;
 
+    @TableField("account_type")
+    private Integer accountType;
+
+    @TableField("camera_type")
+    private Integer cameraType;
+
+    @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("rec_status")
     @TableLogic(value = "A",delval = "I")
     private String recStatus;

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

@@ -95,36 +95,25 @@ public class InnerController extends BaseController {
         if(StringUtils.isBlank(rtkSnCode)){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        if("aws".equals(CacheUtil.uploadType)){
-            RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
-            if(rtkInfo == null || rtkInfo.getStatus() == 1 || (rtkInfo.getFailureTime() != null&& rtkInfo.getFailureTime().getTime() <= new Date().getTime())){
-                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);
         }
-        RtkInfo rtkInfo = new RtkInfo();
-        rtkInfo.setRtkSnCode(rtkSnCode);
-        rtkInfo.setRtkType(rtkDevice.getRtkType());
         //rtkDevice.getType() = 0板卡自带账号信息,无需关联
         Integer rtkAccountId = null;
         if(rtkDevice.getRtkType() == 0 && rtkDevice.getFailureTime() != null && rtkDevice.getFailureTime().getTime() <= new Date().getTime()){
             rtkDevice.setRtkType(1);
             rtkDeviceService.updateTypeById(rtkDevice.getId(),1);
         }
-        if(rtkDevice.getRtkType() != 0){
+        if(rtkDevice.getRtkType() != 0 && rtkDevice.getAccountType() == 0){
             RtkAccount rtkAccount = rtkAccountService.getOneNotUseAccount(rtkSnCode,rtkDevice.getCameraSn());
             rtkAccountId = rtkAccount.getId();
-            BeanUtils.copyProperties(rtkAccount,rtkInfo);
+            BeanUtils.copyProperties(rtkAccount,rtkDevice);
         }
+
         String clientIP = ServletUtil.getClientIP(request);
-        rtkUseLogService.saveLog(rtkInfo,clientIP,rtkAccountId,cameraSn,rtkDevice);
-        return ResultData.ok(rtkInfo);
+        rtkUseLogService.saveLog(clientIP,rtkAccountId,cameraSn,rtkDevice);
+        return ResultData.ok(rtkDevice);
     }
 
     /**
@@ -136,15 +125,6 @@ public class InnerController extends BaseController {
         if(StringUtils.isBlank(rtkSnCode)){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        if("aws".equals(CacheUtil.uploadType)){
-            RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
-            if(rtkInfo == null || rtkInfo.getStatus() == 1 || (rtkInfo.getFailureTime() != null&& rtkInfo.getFailureTime().getTime() <= new Date().getTime())){
-                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);

+ 1 - 2
src/main/java/com/fdkankan/manage/service/IRtkUseLogService.java

@@ -17,8 +17,7 @@ import com.fdkankan.manage.vo.request.RtkInfoParam;
  */
 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(String clientIP,Integer rtkAccountId,String cameraSn,RtkDevice rtkDevice);
     void saveLog(RtkDevice rtkDevice, String clientIP, RtkAccount rtkAccount,String cameraSn);
     void saveLog(RtkAccount rtkAccount);
 

+ 5 - 0
src/main/java/com/fdkankan/manage/service/IUserIncrementService.java

@@ -3,6 +3,7 @@ package com.fdkankan.manage.service;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.entity.UserIncrement;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.manage.vo.request.IncrementBindCameraParam;
 import com.fdkankan.manage.vo.request.UserIncrementParam;
 import org.joda.time.DateTime;
 
@@ -41,4 +42,8 @@ public interface IUserIncrementService extends IService<UserIncrement> {
     List<UserIncrement> getByOrderSn(String orderSn);
 
     DateTime getAddUserIncrementTime(UserIncrementParam param);
+
+    void incrementBindCamera(IncrementBindCameraParam userParam);
+
+    void incrementUnBindCamera(IncrementBindCameraParam userParam);
 }

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

@@ -29,9 +29,9 @@ import java.util.stream.Collectors;
 public class RtkUseLogServiceImpl extends ServiceImpl<IRtkUseLogMapper, RtkUseLog> implements IRtkUseLogService {
 
     @Override
-    public void saveLog(RtkInfo rtkInfo, String clientIP,Integer rtkAccountId,String cameraSn,RtkDevice rtkDevice) {
+    public void saveLog( String clientIP,Integer rtkAccountId,String cameraSn,RtkDevice rtkDevice) {
         RtkUseLog rtkUseLog = new RtkUseLog();
-        BeanUtils.copyProperties(rtkInfo,rtkUseLog);
+        BeanUtils.copyProperties(rtkDevice,rtkUseLog);
         rtkUseLog.setId(null);
         rtkUseLog.setCreateTime(null);
         rtkUseLog.setUpdateTime(null);
@@ -44,20 +44,6 @@ public class RtkUseLogServiceImpl extends ServiceImpl<IRtkUseLogMapper, RtkUseLo
     }
 
     @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);

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

@@ -343,6 +343,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                     record.setStatus(-4);
                 }
             }
+            if(record.getLocation() != null && (record.getLocation() == 5 || record.getLocation() == 6)){
+                record.setSlamCount(record.getShootCount());
+            }
         }
         return PageInfo.PageInfo(page);
     }

+ 60 - 3
src/main/java/com/fdkankan/manage/service/impl/UserIncrementServiceImpl.java

@@ -14,6 +14,7 @@ import com.fdkankan.common.util.DateUtil;
 import com.fdkankan.manage.mapper.IUserIncrementMapper;
 import com.fdkankan.manage.service.*;
 import com.fdkankan.manage.util.DateUtils;
+import com.fdkankan.manage.vo.request.IncrementBindCameraParam;
 import com.fdkankan.manage.vo.request.UserIncrementParam;
 import com.fdkankan.manage.vo.response.GroupByCount;
 import com.fdkankan.manage.vo.response.UserIncrementVo;
@@ -252,13 +253,11 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
     }
 
 
-    @Autowired
-    IUserIncrementService userIncrementService;
 
     public DateTime getDateTime(IncrementType incrementType, Long userIncrementId,Integer count) {
         Date userTime = new Date();
         if(userIncrementId != null){
-            UserIncrement userIncrement = userIncrementService.getById(userIncrementId);
+            UserIncrement userIncrement = this.getById(userIncrementId);
             userTime = DateUtils.getDate(userIncrement.getIncrementEndTime());
         }
         return  DateUtils.getDateTime(userTime, incrementType,count);
@@ -311,4 +310,62 @@ public class UserIncrementServiceImpl extends ServiceImpl<IUserIncrementMapper,
         wrapper.like(UserIncrement::getOrderSn,orderSn);
         return this.list(wrapper);
     }
+
+
+    @Override
+    public void incrementBindCamera(IncrementBindCameraParam userParam) {
+        Long cameraId = checkIncrementCamera(userParam);
+        UserIncrement userIncrementByCam = this.getByCameraId(cameraId);
+        if(userIncrementByCam != null ){
+            throw new BusinessException(ResultCode.INCREMENT_BIND_CAMERA_ERROR);
+        }
+        UserIncrement userIncrement = this.getById(userParam.getIncrementId());
+        if(userIncrement == null  || userIncrement.getIsExpired() !=0 || StringUtils.isEmpty(userIncrement.getIncrementEndTime())){
+            throw new BusinessException(ResultCode.INCREMENT_BIND_ERROR);
+        }
+        Date date = DateUtil.string2Date(userIncrement.getIncrementEndTime(), "yyyy-MM-dd HH:mm:ss");
+        if(date.getTime() <= new Date().getTime()){
+            throw new BusinessException(ResultCode.INCREMENT_BIND_ERROR);
+        }
+        if(userIncrement.getCameraId() != null){
+            throw new BusinessException(ResultCode.INCREMENT_BIND_ERROR2);
+        }
+
+        LambdaUpdateWrapper<UserIncrement> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(UserIncrement::getId,userParam.getIncrementId());
+        wrapper.set(UserIncrement::getCameraId,cameraId);
+        this.update(wrapper);
+        sceneProService.lockOrUnLockBySpace(cameraId);
+    }
+
+    @Override
+    public void incrementUnBindCamera(IncrementBindCameraParam userParam) {
+        Long cameraId = checkIncrementCamera(userParam);
+        UserIncrement userIncrementByCam = this.getByCameraId(cameraId);
+        if(userIncrementByCam == null ){
+            throw new BusinessException(ResultCode.INCREMENT_UNBIND_CAMERA_ERROR);
+        }
+        UserIncrement userIncrement = this.getById(userParam.getIncrementId());
+        if(userIncrement == null  ){
+            throw new BusinessException(ResultCode.INCREMENT_BIND_ERROR);
+        }
+
+        LambdaUpdateWrapper<UserIncrement> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(UserIncrement::getId,userParam.getIncrementId());
+        wrapper.set(UserIncrement::getCameraId,null);
+        this.update(wrapper);
+        sceneProService.lockOrUnLockBySpace(cameraId);
+    }
+
+    private Long checkIncrementCamera(IncrementBindCameraParam userParam){
+        if(StringUtils.isEmpty(userParam.getSnCode()) || userParam.getIncrementId() == null ){
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+        Camera camera = cameraService.getBySnCode(userParam.getSnCode());
+        if(camera == null){
+            throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
+        }
+
+        return camera.getId();
+    }
 }

+ 11 - 0
src/main/java/com/fdkankan/manage/vo/request/IncrementBindCameraParam.java

@@ -0,0 +1,11 @@
+package com.fdkankan.manage.vo.request;
+
+import lombok.Data;
+
+@Data
+public class IncrementBindCameraParam {
+
+    private Integer incrementId;
+    private Integer userId;
+    private String snCode;
+}

+ 17 - 0
src/main/java/com/fdkankan/manage/vo/request/SceneParam.java

@@ -30,6 +30,11 @@ public class SceneParam extends RequestBase {
     private List<Long> cameraIds;
     private List<Long> userIds;
 
+    private List<Integer> shootCounts;
+    private Integer shootCountMin;
+    private Integer shootCountMax;
+    private List<Integer> locations;
+
     private List<String> numList = new ArrayList<>();
     public String getStartTime() {
         if(timeList != null && timeList.size() >1){
@@ -59,5 +64,17 @@ public class SceneParam extends RequestBase {
         return "DESC";
     }
 
+    public Integer getShootCountMin() {
+        if(shootCounts != null && shootCounts.size() >1){
+            return shootCounts.get(0);
+        }
+        return shootCountMin;
+    }
 
+    public Integer getShootCountMax() {
+        if(shootCounts != null && shootCounts.size() >1){
+            return shootCounts.get(1);
+        }
+        return shootCountMax;
+    }
 }

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

@@ -49,4 +49,8 @@ public class SceneVo {
     private Integer location;
 
     private Integer mixture = 0; // 0否 1是
+
+    private Long computeTime ; // 计算时长 单位秒
+
+    private Integer slamCount ; // slam帧数
 }

+ 23 - 2
src/main/resources/mapper/manage/SceneProMapper.xml

@@ -24,23 +24,44 @@
         SELECT * FROM(
         select s.scene_name ,s.num,s.create_time,s.space as sceneSize
         ,s.view_count,s.status,s.pay_status,'v3' as scene_version ,s.web_site , s.thumb
-        ,null as algorithmTime,data_source,s.shoot_count,s.gps,s.user_id,s.camera_id
+        ,null as algorithmTime,data_source,s.shoot_count,s.gps,s.user_id,s.camera_id,s.compute_time,null as location
         from t_scene_pro s
         <include refid="commonWhere"></include>
         <if test="param.sceneName != null and param.sceneName!='' ">
             and s.scene_name like concat ('%',#{param.sceneName},'%')
         </if>
+        <if test="param.shootCountMin != null  ">
+            and s.shoot_count &gt;= #{param.shootCountMin}
+        </if>
+        <if test="param.shootCountMax != null  ">
+            and s.shoot_count &lt;= #{param.shootCountMax}
+        </if>
+        <if test="param.locations !=null and param.locations.size >0">
+            and s.rec_status = 'AAA'
+        </if>
         and is_upgrade = 0
         UNION ALL
         select s.title as sceneName ,s.num,s.create_time,e.space as sceneSize
         ,e.view_count,s.scene_status as status,s.pay_status,'v4' as scene_version,e.web_site,e.thumb
-        ,algorithm_time,data_source,e.shoot_count,e.gps,s.user_id,s.camera_id
+        ,algorithm_time,data_source,e.shoot_count,e.gps,s.user_id,s.camera_id,s.compute_time,e.location
         from t_scene_plus s
         left join t_scene_plus_ext e on s.id = e.plus_id
         <include refid="commonWhere"></include>
         <if test="param.sceneName != null and param.sceneName!='' ">
             and s.title like concat ('%',#{param.sceneName},'%')
         </if>
+        <if test="param.shootCountMin != null  ">
+            and e.shoot_count &gt;= #{param.shootCountMin}
+        </if>
+        <if test="param.shootCountMax != null  ">
+            and e.shoot_count &lt;= #{param.shootCountMax}
+        </if>
+        <if test="param.locations !=null and param.locations.size >0">
+            and e.location in
+            <foreach item="location" collection="param.locations" open="(" separator="," close=")">
+                #{location}
+            </foreach>
+        </if>
         ) as tb
         order by ${param.field} ${param.order}
     </select>