소스 검색

Merge remote-tracking branch 'origin/test'

lyhzzz 4 달 전
부모
커밋
a89802f509
54개의 변경된 파일1567개의 추가작업 그리고 177개의 파일을 삭제
  1. 7 0
      README.md
  2. 106 0
      doc/update1.10.9.sql
  3. 11 0
      src/main/java/com/fdkankan/ucenter/common/SceneSourceUtil.java
  4. 10 0
      src/main/java/com/fdkankan/ucenter/common/constants/ResultCode.java
  5. 40 0
      src/main/java/com/fdkankan/ucenter/controller/ProductController.java
  6. 10 0
      src/main/java/com/fdkankan/ucenter/controller/SceneController.java
  7. 23 0
      src/main/java/com/fdkankan/ucenter/controller/SceneCooperationController.java
  8. 1 0
      src/main/java/com/fdkankan/ucenter/controller/app/AppController.java
  9. 6 4
      src/main/java/com/fdkankan/ucenter/controller/app/SceneApiController.java
  10. 67 0
      src/main/java/com/fdkankan/ucenter/entity/Product.java
  11. 55 0
      src/main/java/com/fdkankan/ucenter/entity/ProductCooperation.java
  12. 114 0
      src/main/java/com/fdkankan/ucenter/entity/ProductOrder.java
  13. 2 1
      src/main/java/com/fdkankan/ucenter/entity/SceneCooperation.java
  14. 49 0
      src/main/java/com/fdkankan/ucenter/entity/SceneCooperationCount.java
  15. 3 0
      src/main/java/com/fdkankan/ucenter/entity/User.java
  16. 1 1
      src/main/java/com/fdkankan/ucenter/generate/AutoGenerate.java
  17. 1 1
      src/main/java/com/fdkankan/ucenter/httpClient/param/PayGoods.java
  18. 14 0
      src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java
  19. 18 0
      src/main/java/com/fdkankan/ucenter/mapper/IProductCooperationMapper.java
  20. 18 0
      src/main/java/com/fdkankan/ucenter/mapper/IProductMapper.java
  21. 18 0
      src/main/java/com/fdkankan/ucenter/mapper/IProductOrderMapper.java
  22. 18 0
      src/main/java/com/fdkankan/ucenter/mapper/ISceneCooperationCountMapper.java
  23. 12 1
      src/main/java/com/fdkankan/ucenter/mq/consumer/OrderDownConsumer.java
  24. 25 0
      src/main/java/com/fdkankan/ucenter/service/IProductCooperationService.java
  25. 24 0
      src/main/java/com/fdkankan/ucenter/service/IProductOrderService.java
  26. 20 0
      src/main/java/com/fdkankan/ucenter/service/IProductService.java
  27. 24 0
      src/main/java/com/fdkankan/ucenter/service/ISceneCooperationCountService.java
  28. 13 4
      src/main/java/com/fdkankan/ucenter/service/ISceneCooperationService.java
  29. 1 1
      src/main/java/com/fdkankan/ucenter/service/ISceneDownloadLogService.java
  30. 2 2
      src/main/java/com/fdkankan/ucenter/service/impl/AppCameraService.java
  31. 1 1
      src/main/java/com/fdkankan/ucenter/service/impl/CameraDetailServiceImpl.java
  32. 32 63
      src/main/java/com/fdkankan/ucenter/service/impl/CameraServiceImpl.java
  33. 7 5
      src/main/java/com/fdkankan/ucenter/service/impl/DownService.java
  34. 6 0
      src/main/java/com/fdkankan/ucenter/service/impl/OrderServiceImpl.java
  35. 91 0
      src/main/java/com/fdkankan/ucenter/service/impl/ProductCooperationServiceImpl.java
  36. 99 0
      src/main/java/com/fdkankan/ucenter/service/impl/ProductOrderServiceImpl.java
  37. 48 0
      src/main/java/com/fdkankan/ucenter/service/impl/ProductServiceImpl.java
  38. 91 0
      src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationCountServiceImpl.java
  39. 350 70
      src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java
  40. 2 1
      src/main/java/com/fdkankan/ucenter/service/impl/SceneDownloadLogServiceImpl.java
  41. 23 14
      src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java
  42. 1 0
      src/main/java/com/fdkankan/ucenter/service/impl/UserServiceImpl.java
  43. 2 0
      src/main/java/com/fdkankan/ucenter/vo/request/RegisterParam.java
  44. 18 0
      src/main/java/com/fdkankan/ucenter/vo/request/SceneCooperationParam.java
  45. 1 0
      src/main/java/com/fdkankan/ucenter/vo/response/GroupByCount.java
  46. 4 0
      src/main/java/com/fdkankan/ucenter/vo/response/SceneVo.java
  47. 48 0
      src/main/resources/bootstrap-dev-eur.yml
  48. 3 1
      src/main/resources/bootstrap-dev.yml
  49. 1 1
      src/main/resources/bootstrap.yml
  50. 5 0
      src/main/resources/mapper/ucenter/ProductCooperationMapper.xml
  51. 5 0
      src/main/resources/mapper/ucenter/ProductMapper.xml
  52. 5 0
      src/main/resources/mapper/ucenter/ProductOrderMapper.xml
  53. 5 0
      src/main/resources/mapper/ucenter/SceneCooperationCountMapper.xml
  54. 6 6
      src/main/resources/mapper/ucenter/SceneProMapper.xml

+ 7 - 0
README.md

@@ -33,4 +33,11 @@
     1.ucenter/user/scene/uploadE57  从日本同步
     2.newList sceneSouce 为57,表示为e57mesh场景
     3.findSceneNumber 接口添加key e57 e57_OBJ
+~~~~
+
+###**1.10.9**
+~~~~
+1.批量协作
+2.协作商品详情
+http://120.25.146.52:3090/project/228/interface/api/cat_2077
 ~~~~

+ 106 - 0
doc/update1.10.9.sql

@@ -0,0 +1,106 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : 4dkk120.24.144.164
+ Source Server Type    : MySQL
+ Source Server Version : 80025
+ Source Host           : 120.24.144.164:3306
+ Source Schema         : 4dkankan_v4
+
+ Target Server Type    : MySQL
+ Target Server Version : 80025
+ File Encoding         : 65001
+
+ Date: 17/03/2025 15:53:32
+*/
+
+SET NAMES utf8mb4;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+-- Table structure for t_product
+-- ----------------------------
+DROP TABLE IF EXISTS `t_product`;
+CREATE TABLE `t_product`  (
+  `id` int NOT NULL AUTO_INCREMENT,
+  `type_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `price` decimal(10, 2) NULL DEFAULT NULL COMMENT '单价',
+  `limit_count` int NULL DEFAULT NULL COMMENT '限购数量',
+  `free_count` int NULL DEFAULT NULL COMMENT '免费数量',
+  `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
+  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_product
+-- ----------------------------
+INSERT INTO `t_product` VALUES (1, 'cooperation', '协作', 0.01, 5, 1, 'A', '2025-03-13 11:48:36', '2025-03-13 11:49:05');
+
+-- ----------------------------
+-- Table structure for t_product_cooperation
+-- ----------------------------
+DROP TABLE IF EXISTS `t_product_cooperation`;
+CREATE TABLE `t_product_cooperation`  (
+  `id` int NOT NULL AUTO_INCREMENT,
+  `order_sn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `num` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
+  `cooperation_user_id` int NULL DEFAULT NULL,
+  `rec_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT 'A',
+  `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+  `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  PRIMARY KEY (`id`) USING BTREE
+) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
+
+-- ----------------------------
+-- Records of t_product_cooperation
+-- ----------------------------
+
+-- ----------------------------
+-- Table structure for t_product_order
+-- ----------------------------
+CREATE TABLE `t_product_order` (
+                                   `id` int NOT NULL AUTO_INCREMENT,
+                                   `product_id` int DEFAULT NULL,
+                                   `order_sn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '订单号',
+                                   `amount` decimal(10,2) DEFAULT NULL,
+                                   `number` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL DEFAULT '' COMMENT '支付宝的交易号或者微信支付订单号',
+                                   `pay_type` tinyint NOT NULL DEFAULT '-1' COMMENT '付款方式,0表示微信,1表示支付宝,2表示paypal,3表示其他',
+                                   `pay_status` tinyint DEFAULT '0' COMMENT '状态,0或-1表示未付款,-2表示已退款,1表示已付款',
+                                   `trade_time` datetime DEFAULT NULL COMMENT '交易时间',
+                                   `user_id` bigint DEFAULT NULL COMMENT '用户表t_user的id',
+                                   `count` tinyint DEFAULT NULL COMMENT '购买数量',
+                                   `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                   `rec_status` varchar(2) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT 'A' COMMENT '记录的状态,A: 生效,I: 禁用',
+                                   `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+                                   `time_zone_off` int DEFAULT '0' COMMENT '时区差,单位分钟',
+                                   `lang` varchar(255) DEFAULT NULL,
+                                   `camera_id` int DEFAULT NULL,
+                                   PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=DYNAMIC;
+
+-- ----------------------------
+-- Records of t_product_order
+-- ----------------------------
+
+SET FOREIGN_KEY_CHECKS = 1;
+
+CREATE TABLE `t_scene_cooperation_count` (
+                                             `id` int NOT NULL AUTO_INCREMENT,
+                                             `num` varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
+                                             `count` int DEFAULT NULL,
+                                             `rec_status` varchar(255) COLLATE utf8mb4_general_ci DEFAULT 'A',
+                                             `create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+                                             `update_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+                                             PRIMARY KEY (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
+
+
+ALTER TABLE `4dkankan_v4`.`t_scene_cooperation`
+    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `rec_status`;
+
+ALTER TABLE `4dkankan_v4`.`t_product_cooperation`
+    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `update_time`,
+    ADD COLUMN `need_pay` int NULL DEFAULT 0 AFTER `scene_type`;

+ 11 - 0
src/main/java/com/fdkankan/ucenter/common/SceneSourceUtil.java

@@ -0,0 +1,11 @@
+package com.fdkankan.ucenter.common;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class SceneSourceUtil {
+
+    public static List<Integer> getLaserList(){
+        return Arrays.asList(4,5,57);
+    }
+}

+ 10 - 0
src/main/java/com/fdkankan/ucenter/common/constants/ResultCode.java

@@ -1,13 +1,23 @@
 package com.fdkankan.ucenter.common.constants;
 
 
+import com.fdkankan.common.constant.CameraConstant;
+
 public enum ResultCode {
 
 
     UPLOAD_ERROR2(500001, "上传失败。文件格式不对"),
     UPLOAD_ERROR(500002, "上传失败。"),
+    UPLOAD_ERROR3(500003, "文件不存在!"),
+    CAMERA_NOT_EXIT(500004, "相机不存在或未绑定"),
+    DIS_COO_ERROR(500005, "解除失败,相机没协作用户"),
+    NOT_PER(500006, "权限不足"),
+    COO_ERROR(500007, "协作失败,请先解除协作"),
+    COO_LIMIT_ERROR(500007, "协作失败,协作数量超过限制"),
+    COO_LIMIT_ERROR2(500008, "协作失败,重复协作"),
 
     USER_NOT_LOGIN(3004, "用户未登录"),
+    PARAM_MISS(3001, "参数缺失"),
 
 
     ;

+ 40 - 0
src/main/java/com/fdkankan/ucenter/controller/ProductController.java

@@ -0,0 +1,40 @@
+package com.fdkankan.ucenter.controller;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.ucenter.common.BaseController;
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.entity.Case;
+import com.fdkankan.ucenter.service.ICaseService;
+import com.fdkankan.ucenter.service.IProductService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2022-10-13
+ */
+@RestController
+@RequestMapping("/ucenter/product")
+public class ProductController extends BaseController {
+
+    @Autowired
+    IProductService productService;
+
+    @GetMapping("/getByKey/{typeKey}")
+    public Result getByKey(@PathVariable String typeKey){
+        return Result.success(productService.getByKey(typeKey));
+    }
+
+    @GetMapping("/getFreeCount/{num}/{sceneType}")
+    public Result getFreeCount(@PathVariable String num,@PathVariable String sceneType){
+        return Result.success(productService.getFreeCount(num,sceneType));
+    }
+}
+

+ 10 - 0
src/main/java/com/fdkankan/ucenter/controller/SceneController.java

@@ -28,6 +28,7 @@ import com.fdkankan.ucenter.vo.request.SceneParam;
 import com.fdkankan.ucenter.vo.response.DownloadProcessVo;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.language.Nysiis;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.*;
@@ -329,6 +330,15 @@ public class SceneController extends BaseController {
                                 @RequestParam(value = "title",required = false)String title,
                                 @RequestParam(value = "newFileName",required = false)String newFileName ){
 
+
+        if(StringUtils.isBlank(newFileName)){
+            throw new BusinessException(ResultCode.PARAM_MISS);
+        }
+        String ossPath = "ucenter/e57/"+newFileName;
+        if(!fYunFileServiceInterface.fileExist(ossPath)){
+            throw new BusinessException(ResultCode.UPLOAD_ERROR3);
+        }
+
         UploadEditSceneParam editSceneParam = new UploadEditSceneParam();
         editSceneParam.setTitle(title);
         editSceneParam.setUserId(getUser().getId());

+ 23 - 0
src/main/java/com/fdkankan/ucenter/controller/SceneCooperationController.java

@@ -60,6 +60,29 @@ public class SceneCooperationController extends BaseController {
         sceneCooperationService.saveCooperation(param,username);
         return Result.success();
     }
+
+    @PostMapping("/saveBatch")
+    public Result saveBatch(@RequestBody SceneCooperationParam param){
+        String username = JwtUtil.getUsername(getToken());
+        if(StringUtils.isNotBlank(getLang())){
+            param.setLang(getLang());
+        }
+        param.setTimeZone(getTimeZone());
+        return Result.success(sceneCooperationService.saveBatchCooperation(param,username));
+    }
+
+    @PostMapping("/saveCamera")
+    public Result saveCamera(@RequestBody SceneCooperationParam param){
+        String username = JwtUtil.getUsername(getToken());
+        if(StringUtils.isNotBlank(getLang())){
+            param.setLang(getLang());
+        }
+        param.setTimeZone(getTimeZone());
+        return Result.success(sceneCooperationService.saveCamera(param,username));
+    }
+
+
+
     /**
      * 取消协作场景
      * sceneNum         场景码

+ 1 - 0
src/main/java/com/fdkankan/ucenter/controller/app/AppController.java

@@ -70,6 +70,7 @@ public class AppController extends BaseController {
     public Result register(@RequestBody RegisterParam param){
         param.setConfirmPwd(param.getPassword());
         param.setClear("YES");
+        param.setAgentKey(getAgentKey());
         loginService.register(param);
         return Result.success();
     }

+ 6 - 4
src/main/java/com/fdkankan/ucenter/controller/app/SceneApiController.java

@@ -34,6 +34,7 @@ import java.io.File;
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.util.*;
+import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import lombok.extern.slf4j.Slf4j;
@@ -163,12 +164,13 @@ public class SceneApiController extends BaseController {
         BeanUtils.copyProperties(user,ssoUser);
 
         if(!ssoUser.getId().equals(userId)) {
-            HashMap<String, User> cooMap = cooperationService.getByNumList(Arrays.asList(sceneNum));
-            User cooUser = cooMap.get(sceneNum);
-            if(cooUser == null ){
+            HashMap<String, List<User>> cooMap = cooperationService.getByNumList(Arrays.asList(sceneNum),"mesh");
+            List<User> cooUsers = cooMap.get(sceneNum);
+            if(cooUsers == null || cooUsers.isEmpty()){
                 throw new BusinessException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
             }
-            if(cooUser.getId().longValue() != ssoUser.getId().longValue()){
+            List<Long> collect = cooUsers.stream().map(User::getId).collect(Collectors.toList());
+            if(!collect.contains(ssoUser.getId())){
                 throw new BusinessException(SceneConstant.FAILURE_CODE_5014, SceneConstant.FAILURE_MSG_5014);
             }
 

+ 67 - 0
src/main/java/com/fdkankan/ucenter/entity/Product.java

@@ -0,0 +1,67 @@
+package com.fdkankan.ucenter.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.math.BigDecimal;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Getter
+@Setter
+@TableName("t_product")
+public class Product implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("type_key")
+    private String typeKey;
+
+    @TableField("name")
+    private String name;
+
+    /**
+     * 单价
+     */
+    @TableField("price")
+    private BigDecimal price;
+
+    /**
+     * 限购数量
+     */
+    @TableField("limit_count")
+    private Integer limitCount;
+
+    /**
+     * 免费数量
+     */
+    @TableField("free_count")
+    private Integer freeCount;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 55 - 0
src/main/java/com/fdkankan/ucenter/entity/ProductCooperation.java

@@ -0,0 +1,55 @@
+package com.fdkankan.ucenter.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 2025-03-13
+ */
+@Getter
+@Setter
+@TableName("t_product_cooperation")
+public class ProductCooperation implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("order_sn")
+    private String orderSn;
+
+    @TableField("num")
+    private String num;
+
+    @TableField("cooperation_user_id")
+    private Long cooperationUserId;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("scene_type")
+    private String sceneType;
+
+    @TableField("need_pay")
+    private Integer needPay;
+}

+ 114 - 0
src/main/java/com/fdkankan/ucenter/entity/ProductOrder.java

@@ -0,0 +1,114 @@
+package com.fdkankan.ucenter.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.math.BigDecimal;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Getter
+@Setter
+@TableName("t_product_order")
+public class ProductOrder implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("product_id")
+    private Integer productId;
+
+    /**
+     * 订单号
+     */
+    @TableField("order_sn")
+    private String orderSn;
+
+    @TableField("amount")
+    private BigDecimal amount;
+
+    /**
+     * 支付宝的交易号或者微信支付订单号
+     */
+    @TableField("number")
+    private String number;
+
+    /**
+     * 付款方式,0表示微信,1表示支付宝,2表示paypal,3表示其他
+     */
+    @TableField("pay_type")
+    private Integer payType;
+
+    /**
+     * 状态,0或-1表示未付款,-2表示已退款,1表示已付款
+     */
+    @TableField("pay_status")
+    private Integer payStatus;
+
+    /**
+     * 交易时间
+     */
+    @TableField("trade_time")
+    private Date tradeTime;
+
+    /**
+     * 用户表t_user的id
+     */
+    @TableField("user_id")
+    private Long userId;
+
+    /**
+     * 购买数量
+     */
+    @TableField("count")
+    private Integer count;
+
+    /**
+     * 创建时间
+     */
+    @TableField("create_time")
+    private Date createTime;
+
+    /**
+     * 记录的状态,A: 生效,I: 禁用
+     */
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    /**
+     * 更新时间
+     */
+    @TableField("update_time")
+    private Date updateTime;
+
+    /**
+     * 时区差,单位分钟
+     */
+    @TableField("time_zone_off")
+    private Integer timeZoneOff;
+
+    @TableField("lang")
+    private String lang;
+
+
+    @TableField("camera_id")
+    private Long cameraId;
+
+    @TableField("scene_type")
+    private String sceneType;
+}

+ 2 - 1
src/main/java/com/fdkankan/ucenter/entity/SceneCooperation.java

@@ -50,5 +50,6 @@ public class SceneCooperation implements Serializable {
     @TableLogic(value = "A",delval = "I")
     private String recStatus;
 
-
+    @TableField("scene_type")
+    private String sceneType;
 }

+ 49 - 0
src/main/java/com/fdkankan/ucenter/entity/SceneCooperationCount.java

@@ -0,0 +1,49 @@
+package com.fdkankan.ucenter.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 2025-03-20
+ */
+@Getter
+@Setter
+@TableName("t_scene_cooperation_count")
+public class SceneCooperationCount implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("num")
+    private String num;
+
+    @TableField("count")
+    private Integer count;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+    @TableField("scene_type")
+    private String sceneType;
+}

+ 3 - 0
src/main/java/com/fdkankan/ucenter/entity/User.java

@@ -148,4 +148,7 @@ public class User implements Serializable {
     @TableField("update_time")
     private String updateTime;
 
+    @TableField("agent_key")
+    private String agentKey;
+
 }

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

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

+ 1 - 1
src/main/java/com/fdkankan/ucenter/httpClient/param/PayGoods.java

@@ -7,7 +7,7 @@ public class PayGoods {
     private String name;
     private Integer count;
     private String sceneNum;
-    private Integer type;   //0专业会员,1高级会员,2下载,3配件
+    private Integer type;   //0专业会员,1高级会员,2下载,3配件,4协作订单
     private Integer goodsId;
     private Integer monthQy = 1;
     private String nameEn;

+ 14 - 0
src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java

@@ -430,4 +430,18 @@ public class LaserService {
         }
         return null ;
     }
+
+    public void saveBatchCooperation(List<String> numList2,List<String> snCodeList, List<String> userNameList,String type,String operatingMode) {
+        log.info(numList2.size() +"---------"+snCodeList.size());
+        if(numList2.isEmpty() && snCodeList.isEmpty()){
+            return;
+        }
+        HashMap<String,Object> map = new HashMap<>();
+        map.put("numList",numList2);
+        map.put("type",type);
+        map.put("snCodeList",snCodeList);
+        map.put("userNameList",userNameList);
+        map.put("operatingMode",operatingMode);
+        rabbitMqProducer.sendByWorkQueue("laser-batch-save-cooperation",map);
+    }
 }

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/IProductCooperationMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.ProductCooperation;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Mapper
+public interface IProductCooperationMapper extends BaseMapper<ProductCooperation> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/IProductMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.Product;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Mapper
+public interface IProductMapper extends BaseMapper<Product> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/IProductOrderMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.ProductOrder;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Mapper
+public interface IProductOrderMapper extends BaseMapper<ProductOrder> {
+
+}

+ 18 - 0
src/main/java/com/fdkankan/ucenter/mapper/ISceneCooperationCountMapper.java

@@ -0,0 +1,18 @@
+package com.fdkankan.ucenter.mapper;
+
+import com.fdkankan.ucenter.entity.SceneCooperationCount;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-20
+ */
+@Mapper
+public interface ISceneCooperationCountMapper extends BaseMapper<SceneCooperationCount> {
+
+}

+ 12 - 1
src/main/java/com/fdkankan/ucenter/mq/consumer/OrderDownConsumer.java

@@ -9,6 +9,8 @@ import com.fdkankan.ucenter.pay.strategy.impl.EntityOrderImpl;
 import com.fdkankan.ucenter.pay.strategy.impl.IncrementOrderImpl;
 import com.fdkankan.ucenter.service.IIncrementAutoOrderService;
 import com.fdkankan.ucenter.service.IIncrementOrderService;
+import com.fdkankan.ucenter.service.IProductOrderService;
+import com.fdkankan.ucenter.service.IProductService;
 import com.rabbitmq.client.Channel;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringEscapeUtils;
@@ -40,6 +42,8 @@ public class OrderDownConsumer {
     EntityOrderImpl entityOrder;
     @Autowired
     IIncrementAutoOrderService autoOrderService;
+    @Autowired
+    IProductOrderService productOrderService;
 
 
     @RabbitListener(
@@ -70,6 +74,10 @@ public class OrderDownConsumer {
                 case 3 : case 4:  payType = 1;break;
                 case 5 :   payType = 2;break;
             }
+            if(order.getPayStatus() != 1){
+                log.info("order-payResult----支付失败:{}",order);
+                return;
+            }
             if("incrementOrder".equals(order.getOrderType())){
                 incrementOrder.handleOrder(order.getOrderSn(),order.getTradeNo(),order.getOpenId(),payType,null);
             }
@@ -79,8 +87,11 @@ public class OrderDownConsumer {
             if("partOrder".equals(order.getOrderType())){
                 entityOrder.handleOrder(order.getOrderSn(),order.getTradeNo(),order.getOpenId(),payType,null);
             }
+            if("cooperationOrder".equals(order.getOrderType())){
+                productOrderService.handleOrder(order.getOrderSn(),order.getTradeNo(),order.getOpenId(),payType);
+            }
         }catch (Exception e){
-            log.error("order-payResult----消费失败",e);
+            log.info("order-payResult----消费失败",e);
         }finally {
 
         }

+ 25 - 0
src/main/java/com/fdkankan/ucenter/service/IProductCooperationService.java

@@ -0,0 +1,25 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.entity.ProductCooperation;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.ucenter.entity.ProductOrder;
+import com.fdkankan.ucenter.entity.User;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+public interface IProductCooperationService extends IService<ProductCooperation> {
+
+    void add(ProductOrder productOrder, List<User> users, List<String>numList1, HashMap<String,String> map1, HashMap<String,String> map2, String sceneType);
+
+    void paySuccess(String orderSn);
+}

+ 24 - 0
src/main/java/com/fdkankan/ucenter/service/IProductOrderService.java

@@ -0,0 +1,24 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.entity.ProductOrder;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.ucenter.entity.User;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+public interface IProductOrderService extends IService<ProductOrder> {
+
+    ProductOrder createOrder(Integer totalCount, String key, User user,Integer payType, Integer timeZone,Long cameraId,String lang,String sceneType);
+
+    void handleOrder(String orderSn, String tradeNo, String openId, Integer payType);
+
+    ProductOrder getByOrderSn(String orderSn);
+}

+ 20 - 0
src/main/java/com/fdkankan/ucenter/service/IProductService.java

@@ -0,0 +1,20 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.entity.Product;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fdkankan.ucenter.entity.SceneCooperationCount;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+public interface IProductService extends IService<Product> {
+
+    Product getByKey(String key);
+
+    Integer getFreeCount(String num,String sceneType);
+}

+ 24 - 0
src/main/java/com/fdkankan/ucenter/service/ISceneCooperationCountService.java

@@ -0,0 +1,24 @@
+package com.fdkankan.ucenter.service;
+
+import com.fdkankan.ucenter.entity.ProductCooperation;
+import com.fdkankan.ucenter.entity.SceneCooperationCount;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-20
+ */
+public interface ISceneCooperationCountService extends IService<SceneCooperationCount> {
+
+    void saveCount(List<ProductCooperation> needPay, Integer size);
+
+     List<SceneCooperationCount> getByNumList(List<String> numList,String sceneType);
+
+    SceneCooperationCount getByNum(String num,String sceneType);
+}

+ 13 - 4
src/main/java/com/fdkankan/ucenter/service/ISceneCooperationService.java

@@ -21,9 +21,10 @@ public interface ISceneCooperationService extends IService<SceneCooperation> {
 
     Long getCooperationSceneNum(Long userId, List<Integer> sceneSourceList);
 
-    void deleteCooperationList(List<ScenePro> sceneProList, List<ScenePlus> scenePlusList) ;
+    void deleteCooperationList(List<ScenePro> sceneProList, List<ScenePlus> scenePlusList,List<Long> userIds) ;
+    void deleteCooperationList(List<String> numList,List<Long> userIds,String sceneType) ;
 
-    void saveBatchByList(List<ScenePro> sceneProList, List<ScenePlus> scenePlusList, Long userId ,List<Long>resourceIds);
+    List<SceneCooperation> saveBatchByList(List<String> numList, List<Long> userId ,String type,String sceneType);
 
     JSONObject sceneResourceList(SceneCooperationParam param);
 
@@ -37,9 +38,17 @@ public interface ISceneCooperationService extends IService<SceneCooperation> {
 
     List<String> getNumByUserIds(List<Long> userIds);
 
-    HashMap<String, User> getByNumList(List<String> numList);
+    HashMap<String, List<User>> getByNumList(List<String> numList,String sceneType);
 
-    SceneCooperation getByNum(String num);
+    List<SceneCooperation> getByNum(String num,String sceneType);
 
     Object cooperationSceneList(SceneParam param, String username);
+
+    ProductOrder saveBatchCooperation(SceneCooperationParam param, String username);
+
+     void  successAddCooperation(List<String> numList,List<Long> userIds,Long loginUserId,Long cameraId,String lang,String sceneType, List<ProductCooperation> needPay );
+
+
+     ProductOrder saveCamera(SceneCooperationParam param, String username);
+
 }

+ 1 - 1
src/main/java/com/fdkankan/ucenter/service/ISceneDownloadLogService.java

@@ -13,5 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISceneDownloadLogService extends IService<SceneDownloadLog> {
 
-    SceneDownloadLog getByStatusAndNum(String sceneNum, int status, Integer isUpgrade);
+    SceneDownloadLog getByStatusAndNum(String sceneNum, Integer status, Integer isUpgrade,Integer version);
 }

+ 2 - 2
src/main/java/com/fdkankan/ucenter/service/impl/AppCameraService.java

@@ -203,12 +203,12 @@ public class AppCameraService {
                 ScenePro scenePro = sceneProService.getByUnicode(unicode);
                 ScenePlusExt scenePlusExt = scenePlusExtService.getByUnicode(unicode);
                 if(scenePro != null || scenePlusExt !=null){
-                    if(scenePro!= null && scenePro.getPayStatus() !=1){
+                    if(scenePro!= null && scenePro.getStatus() != null &&  scenePro.getStatus() !=-1 &&  scenePro.getPayStatus() != null &&  scenePro.getPayStatus() !=1){
                         return new AppCameraSpace(0L,cameraDetail.getUnit());
                     }
                     if(scenePlusExt!= null ){
                         ScenePlus scenePlus = scenePlusService.getById(scenePlusExt.getPlusId());
-                        if(scenePlus != null && scenePlus.getPayStatus() != 1){
+                        if(scenePlus != null && scenePlus.getSceneStatus() != null  && scenePlus.getSceneStatus() !=-1 && scenePlus.getPayStatus() != null && scenePlus.getPayStatus() != 1){
                             return new AppCameraSpace(0L,cameraDetail.getUnit());
                         }
                     }

+ 1 - 1
src/main/java/com/fdkankan/ucenter/service/impl/CameraDetailServiceImpl.java

@@ -137,7 +137,7 @@ public class CameraDetailServiceImpl extends ServiceImpl<ICameraDetailMapper, Ca
         //删除场景协作信息
         List<ScenePro> sceneProList = sceneProService.getListByCameraIds(cameraIds);
         List<ScenePlus> scenePlusList = scenePlusService.getListByCameraIds(cameraIds);
-        sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList);
+        sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList,null);
         fdkkLaserService.disableCooperation(detailMap, cameraMap);
         //解绑删除相机。文件夹与场景绑定关系
         List<Long > sceneIds = new ArrayList<>();

+ 32 - 63
src/main/java/com/fdkankan/ucenter/service/impl/CameraServiceImpl.java

@@ -3,14 +3,15 @@ package com.fdkankan.ucenter.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.common.constant.AppConstant;
-import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.ucenter.common.PageInfo;
 import com.fdkankan.common.util.DateUtil;
 import com.fdkankan.common.util.FileSizeUtil;
 import com.fdkankan.ucenter.common.constants.NacosProperty;
+import com.fdkankan.ucenter.common.constants.ResultCode;
 import com.fdkankan.ucenter.constant.CameraConstant;
 import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.entity.*;
+import com.fdkankan.ucenter.exception.BusinessException;
 import com.fdkankan.ucenter.httpClient.service.LaserService;
 import com.fdkankan.ucenter.mapper.ICameraMapper;
 import com.fdkankan.ucenter.service.*;
@@ -183,19 +184,22 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         }
         for (CameraVo responseCamera : page.getRecords()) {
             responseCamera.setCameraType(param.getCameraType());
+            GroupByCount groupByCount = sceneNumMap.get(responseCamera.getId());
+            Integer sceneNum = groupByCount == null ? 0 : Math.toIntExact(sceneNumMap.get(responseCamera.getId()).getCount());
+            Long space = groupByCount == null ?0 :sceneNumMap.get(responseCamera.getId()).getSpace();
             if (responseCamera.getType() != 0){
                 if("GB".equals(responseCamera.getUnit())){
-                    responseCamera.setUsedSpaceStr(FileSizeUtil.formatFileSize(Long.parseLong(responseCamera.getUsedSpace())));
+                    responseCamera.setUsedSpaceStr(FileSizeUtil.formatFileSize(space));
                     responseCamera.setTotalSpaceStr(FileSizeUtil.formatFileSize(Long.parseLong(responseCamera.getTotalSpace())));
-                    String usedSpace = String.valueOf(FileSizeUtil.formetFileSize(Long.parseLong(responseCamera.getUsedSpace()), FileSizeUtil.SIZETYPE_GB));
+                    String usedSpace = String.valueOf(FileSizeUtil.formetFileSize(space, FileSizeUtil.SIZETYPE_GB));
                     String totalSpace = String.valueOf(FileSizeUtil.formetFileSize(Long.parseLong(responseCamera.getTotalSpace()), FileSizeUtil.SIZETYPE_GB));
                     responseCamera.setUsedSpace(usedSpace);
                     responseCamera.setTotalSpace(totalSpace);
                 }
                 if("SP".equals(responseCamera.getUnit())){
-                    responseCamera.setUsedSpaceStr(responseCamera.getUsedSpace());
+                    responseCamera.setUsedSpaceStr(String.valueOf(sceneNum));
                     responseCamera.setTotalSpaceStr(responseCamera.getTotalSpace());
-                    responseCamera.setUsedSpace(responseCamera.getUsedSpace());
+                    responseCamera.setUsedSpace(String.valueOf(responseCamera.getUsedSpace()));
                     responseCamera.setTotalSpace(responseCamera.getTotalSpace());
                 }
 
@@ -239,19 +243,7 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
 
                 }
             }
-//            CameraType cameraType = cameraTypeService.getByCameraType(responseCamera.getType());
-//            if (cameraType.getIsLaser() == 1) {
-//                Map<String, String> params = new HashMap<>();
-//                params.put("snCode", responseCamera.getSnCode());
-//                responseCamera.setSceneNum(fdkkLaserService.getLaserSceneNum(params));
-//            }else{
-//                Integer sceneNum = sceneNumMap.get(responseCamera.getId()) == null ? 0 : Math.toIntExact(sceneNumMap.get(responseCamera.getId()).getCount());
-//                String lastTime = sceneNumMap.get(responseCamera.getId()) == null ? "" : sceneNumMap.get(responseCamera.getId()).getLastTime();
-//                responseCamera.setSceneNum(sceneNum);
-//                responseCamera.setLastTime(lastTime);
-//            }
-            Integer sceneNum = sceneNumMap.get(responseCamera.getId()) == null ? 0 : Math.toIntExact(sceneNumMap.get(responseCamera.getId()).getCount());
-            String lastTime = sceneNumMap.get(responseCamera.getId()) == null ? "" : sceneNumMap.get(responseCamera.getId()).getLastTime();
+            String lastTime = groupByCount == null ? "" : sceneNumMap.get(responseCamera.getId()).getLastTime();
             responseCamera.setSceneNum(sceneNum);
             responseCamera.setLastTime(lastTime);
         }
@@ -338,51 +330,18 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         cameraDetailService.updateCooperationByIds(cameraIds, user.getId());
         sceneResourceCameraService.deleteByCameraIds(cameraIds);
 
-        //保存相机和场景资源的关联关系你
-        List<Long> resourceIdList = new ArrayList<>();
-        List<SceneResource> v3List = new ArrayList<>();
-        List<SceneResource> v4List = new ArrayList<>();
-        if (StringUtils.isNotEmpty(resourceIds)) {
-            for (String rId : resourceIds.split(",")) {
-                resourceIdList.add(Long.valueOf(rId));
-            }
-            List<SceneResource> sceneResources = sceneResourceService.listByIds(resourceIdList);
-            v3List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v3")).collect(Collectors.toList());
-            v4List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v4")).collect(Collectors.toList());
-
-            sceneResourceCameraService.saveBatchByCameraIds(cameraIds,resourceIdList);
-        }else {
-            List<Long> laserCameraIds = new ArrayList<>();
-            for (Long cameraId : detailMap.keySet()) {
-                CameraDetail detail = detailMap.get(cameraId);
-                CameraType cameraType = cameraTypeService.getByCameraType(detail.getType());
-                if (cameraType.getIsLaser() == 1) {
-                    laserCameraIds.add(cameraId);
-                }
-            }
-            if(laserCameraIds.size() >0){
-                List<SceneResource> sceneResources = sceneResourceService.list();
-                List<Long> collect = sceneResources.stream().map(SceneResource::getId).collect(Collectors.toList());
-                sceneResourceCameraService.saveBatchByCameraIds(laserCameraIds,collect);
-
-                v3List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v3")).collect(Collectors.toList());
-                v4List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v4")).collect(Collectors.toList());
-            }
-
-        }
 
         List<ScenePro> sceneProList = sceneProService.getListByCameraIds(cameraIds);
         List<ScenePlus> scenePlusList = scenePlusService.getListByCameraIds(cameraIds);
-        sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList);
-
-        if(!v3List.isEmpty() && !sceneProList.isEmpty()){
-            List<Long> v3Ids = v3List.stream().map(SceneResource::getId).collect(Collectors.toList());
-            sceneCooperationService.saveBatchByList(sceneProList,new ArrayList<>(),user.getId(),v3Ids);
-        }
-
-        if(!v4List.isEmpty() && !scenePlusList.isEmpty()){
-            List<Long> v4Ids = v4List.stream().map(SceneResource::getId).collect(Collectors.toList());
-            sceneCooperationService.saveBatchByList(new ArrayList<>(),scenePlusList,user.getId(),v4Ids);
+        //sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList,Arrays.asList(user.getId()));
+
+        List<String> numList = new ArrayList<>();
+        List<String> v3List = sceneProList.stream().map(ScenePro::getNum).collect(Collectors.toList());
+        List<String> v4List = scenePlusList.stream().map(ScenePlus::getNum).collect(Collectors.toList());
+        numList.addAll(v3List);
+        numList.addAll(v4List);
+        if( !numList.isEmpty()){
+            sceneCooperationService.saveBatchByList(numList,Arrays.asList(user.getId()),"camera","mesh");
         }
 
 
@@ -399,12 +358,22 @@ public class CameraServiceImpl extends ServiceImpl<ICameraMapper, Camera> implem
         cameraIds.add(cameraId);
         HashMap<Long, CameraDetail> detailMap = cameraDetailService.getByCameraIds(cameraIds);
         HashMap<Long, Camera> cameraMap = this.getByIds(cameraIds);
-        cameraDetailService.updateCooperationByIds(cameraIds, null);
-        sceneResourceCameraService.deleteByCameraIds(cameraIds);
+        CameraDetail cameraDetail = detailMap.get(cameraId);
+        Camera camera = cameraMap.get(cameraId);
+        if(camera == null || cameraDetail == null){
+            throw new BusinessException(ResultCode.CAMERA_NOT_EXIT);
+        }
+        if(cameraDetail.getCooperationUser() == null){
+            throw new BusinessException(ResultCode.DIS_COO_ERROR);
+        }
 
         List<ScenePro> sceneProList = sceneProService.getListByCameraIds(cameraIds);
         List<ScenePlus> scenePlusList = scenePlusService.getListByCameraIds(cameraIds);
-        sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList);
+        sceneCooperationService.deleteCooperationList(sceneProList,scenePlusList,Arrays.asList(cameraDetail.getCooperationUser()));
+
+        cameraDetailService.updateCooperationByIds(cameraIds, null);
+        sceneResourceCameraService.deleteByCameraIds(cameraIds);
+
         fdkkLaserService.disableCooperation(detailMap, cameraMap);
 
     }

+ 7 - 5
src/main/java/com/fdkankan/ucenter/service/impl/DownService.java

@@ -76,15 +76,15 @@ public class DownService implements IDownService {
         }
         Integer sceneVersion = getSceneVersion(scenePro, plus);
 
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp);
+        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp,sceneVersion);
         DownVo downVo = new DownVo();
-        if(sceneDownloadLog != null){
+        if(sceneDownloadLog != null ){
             downVo.setDownloadStatus(1);
             return downVo;
         }
-        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,isUp);
+        sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,1,isUp,sceneVersion);
         //3下载过,并且没有修改过
-        if(sceneDownloadLog != null && sceneDownloadLog.getSceneVersion().intValue() == sceneVersion){
+        if(sceneDownloadLog != null ){
             downVo.setDownloadStatus(3);
             downVo.setDownloadUrl(sceneDownloadLog.getDownloadUrl());
             return downVo;
@@ -225,7 +225,9 @@ public class DownService implements IDownService {
         if(scenePro == null){
             isUp = 1;
         }
-        SceneDownloadLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp);
+        Integer sceneVersion = getSceneVersion(scenePro, plus);
+
+        SceneDownloadLog sceneDownloadLog = sceneDownloadLogService.getByStatusAndNum(sceneNum,0,isUp,sceneVersion);
 
         DownloadProcessVo downloadProcessVo = JSONObject.parseObject(result, DownloadProcessVo.class);
         if(sceneDownloadLog != null){

+ 6 - 0
src/main/java/com/fdkankan/ucenter/service/impl/OrderServiceImpl.java

@@ -74,6 +74,8 @@ public class OrderServiceImpl extends ServiceImpl<IOrderMapper, Order> implement
     IOrderService orderService;
     @Autowired
     IIncrementAutoOrderService incrementAutoOrderService;
+    @Autowired
+    IProductOrderService productOrderService;
 
     @Override
     public PageInfo pageList(OrderParam param) {
@@ -241,6 +243,10 @@ public class OrderServiceImpl extends ServiceImpl<IOrderMapper, Order> implement
         if(autoOrder != null && StringUtils.isNotBlank(autoOrder.getSubscriptionId())){
             return true;
         }
+        ProductOrder productOrder = productOrderService.getByOrderSn(orderSn);
+        if(productOrder != null && productOrder.getPayStatus() == 1){
+            return true;
+        }
         return false;
     }
 

+ 91 - 0
src/main/java/com/fdkankan/ucenter/service/impl/ProductCooperationServiceImpl.java

@@ -0,0 +1,91 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.ucenter.entity.ProductCooperation;
+import com.fdkankan.ucenter.entity.ProductOrder;
+import com.fdkankan.ucenter.entity.User;
+import com.fdkankan.ucenter.mapper.IProductCooperationMapper;
+import com.fdkankan.ucenter.service.IProductCooperationService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.ucenter.service.IProductOrderService;
+import com.fdkankan.ucenter.service.ISceneCooperationService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Service
+public class ProductCooperationServiceImpl extends ServiceImpl<IProductCooperationMapper, ProductCooperation> implements IProductCooperationService {
+
+    @Autowired
+    ISceneCooperationService sceneCooperationService;
+    @Autowired
+    IProductOrderService productOrderService;
+
+    @Override
+    public void add(ProductOrder productOrder, List<User> users,List<String> list , HashMap<String,String> map1, HashMap<String,String> map2, String sceneType) {
+
+        if(StringUtils.isBlank(sceneType)){
+            this.saveList(productOrder,users,list,map1,"mesh");
+            this.saveList(productOrder,users,list,map2,"laser");
+        }else {
+            this.saveList(productOrder,users,list,map1,sceneType);
+        }
+
+    }
+
+    private void saveList(ProductOrder productOrder, List<User> users,List<String> list ,  HashMap<String,String> map1,String sceneType){
+        List<ProductCooperation> productCooperations = new ArrayList<>();
+
+        for (String num : list) {
+            for (User user : users) {
+                ProductCooperation productCooperation = new ProductCooperation();
+                productCooperation.setOrderSn(productOrder.getOrderSn());
+                productCooperation.setCooperationUserId(user.getId());
+                productCooperation.setNum(num);
+                productCooperation.setSceneType(sceneType);
+                if(map1.get(user.getId()+","+num) != null){
+                    productCooperation.setNeedPay(1);
+                }
+                productCooperations.add(productCooperation);
+            }
+        }
+        if(!productCooperations.isEmpty()){
+            this.saveBatch(productCooperations);
+        }
+    }
+
+    @Override
+    public void paySuccess(String orderSn) {
+        ProductOrder productOrder = productOrderService.getByOrderSn(orderSn);
+        if(productOrder == null){
+            return;
+        }
+
+        LambdaQueryWrapper<ProductCooperation> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(ProductCooperation::getOrderSn,orderSn);
+        List<ProductCooperation> list = this.list(wrapper);
+        if(list.isEmpty()){
+            return;
+        }
+        List<String> numList = list.stream().map(ProductCooperation::getNum).collect(Collectors.toList());
+        List<ProductCooperation> needPay = list.stream().filter(e -> e.getNeedPay() == 1).collect(Collectors.toList());
+        Set<Long> userIds = list.stream().map(ProductCooperation::getCooperationUserId).collect(Collectors.toSet());
+
+        if(productOrder.getCameraId() != null){
+            sceneCooperationService.successAddCooperation(numList,new ArrayList<>(userIds),productOrder.getUserId(), productOrder.getCameraId(), productOrder.getLang(),null,needPay);
+        }else {
+            sceneCooperationService.successAddCooperation(numList,new ArrayList<>(userIds),productOrder.getUserId(), null, productOrder.getLang(),productOrder.getSceneType(),needPay);
+        }
+    }
+}

+ 99 - 0
src/main/java/com/fdkankan/ucenter/service/impl/ProductOrderServiceImpl.java

@@ -0,0 +1,99 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.exception.BusinessException;
+import com.fdkankan.ucenter.constant.OrderConstant;
+import com.fdkankan.ucenter.entity.Product;
+import com.fdkankan.ucenter.entity.ProductOrder;
+import com.fdkankan.ucenter.entity.User;
+import com.fdkankan.ucenter.httpClient.param.PayGoods;
+import com.fdkankan.ucenter.httpClient.service.PayService;
+import com.fdkankan.ucenter.httpClient.vo.PayOrderVo;
+import com.fdkankan.ucenter.mapper.IProductOrderMapper;
+import com.fdkankan.ucenter.service.IProductCooperationService;
+import com.fdkankan.ucenter.service.IProductOrderService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.ucenter.service.IProductService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Service
+public class ProductOrderServiceImpl extends ServiceImpl<IProductOrderMapper, ProductOrder> implements IProductOrderService {
+
+    @Autowired
+    IProductService productService;
+    @Autowired
+    PayService payService;
+
+
+    @Override
+    public ProductOrder createOrder(Integer totalCount, String key, User user,Integer payType, Integer timeZone,Long cameraId,String lang,String sceneType) {
+        ProductOrder productOrder = new ProductOrder();
+
+        Product product = productService.getByKey(key);
+        BigDecimal price = BigDecimal.ZERO;
+        if(product != null){
+            price = product.getPrice();
+            productOrder.setProductId(product.getId());
+        }
+        productOrder.setAmount(price);
+        productOrder.setPayType(payType);
+        productOrder.setUserId(user.getId());
+        productOrder.setCount(totalCount);
+        productOrder.setTimeZoneOff(timeZone);
+        productOrder.setCameraId(cameraId);
+        productOrder.setLang(lang);
+        productOrder.setSceneType(sceneType);
+
+        PayGoods payGoods = new PayGoods(product.getName(),totalCount,4,1);
+        PayOrderVo payOrderVo = payService.downOrder(price.multiply(new BigDecimal(totalCount)), "cooperationOrder",user.getUserName(),user.getNickName(), Arrays.asList(payGoods),null);
+        if(payOrderVo == null){
+            throw new BusinessException(OrderConstant.FAILURE_CODE_8005,OrderConstant.FAILURE_MSG_8005);
+        }
+        productOrder.setOrderSn(payOrderVo.getOrderSn());
+        this.save(productOrder);
+
+        return productOrder;
+    }
+
+    @Autowired
+    IProductCooperationService productCooperationService;
+
+    @Override
+    public void handleOrder(String orderSn, String tradeNo, String openId, Integer payType) {
+        LambdaUpdateWrapper<ProductOrder> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(ProductOrder::getOrderSn,orderSn);
+        wrapper.set(ProductOrder::getTradeTime,new Date());
+        wrapper.set(ProductOrder::getNumber,tradeNo);
+        wrapper.set(ProductOrder::getPayStatus,1);
+        wrapper.set(ProductOrder::getPayType,payType);
+        this.update(wrapper);
+
+        productCooperationService.paySuccess(orderSn);
+    }
+
+    @Override
+    public ProductOrder getByOrderSn(String orderSn) {
+        LambdaQueryWrapper<ProductOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(ProductOrder::getOrderSn,orderSn);
+        List<ProductOrder> list = this.list(wrapper);
+        if(list.isEmpty() ){
+            return null;
+        }
+        return list.get(0);
+    }
+}

+ 48 - 0
src/main/java/com/fdkankan/ucenter/service/impl/ProductServiceImpl.java

@@ -0,0 +1,48 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.fdkankan.ucenter.entity.Product;
+import com.fdkankan.ucenter.entity.SceneCooperation;
+import com.fdkankan.ucenter.entity.SceneCooperationCount;
+import com.fdkankan.ucenter.mapper.IProductMapper;
+import com.fdkankan.ucenter.service.IProductService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.ucenter.service.ISceneCooperationCountService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-13
+ */
+@Service
+public class ProductServiceImpl extends ServiceImpl<IProductMapper, Product> implements IProductService {
+
+    @Autowired
+    ISceneCooperationCountService sceneCooperationCountService;
+    @Override
+    public Product getByKey(String key) {
+        LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(Product::getTypeKey,key);
+        List<Product> list = this.list(wrapper);
+        if(list.isEmpty()){
+            return null;
+        }
+        return list.get(0);
+    }
+
+    @Override
+    public Integer getFreeCount(String num,String sceneType) {
+        SceneCooperationCount byNum = sceneCooperationCountService.getByNum(num,sceneType);
+        if(byNum == null){
+            return 1;
+        }
+        return byNum.getCount();
+    }
+}

+ 91 - 0
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationCountServiceImpl.java

@@ -0,0 +1,91 @@
+package com.fdkankan.ucenter.service.impl;
+
+import com.alibaba.druid.sql.visitor.functions.Concat;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.ucenter.entity.ProductCooperation;
+import com.fdkankan.ucenter.entity.SceneCooperation;
+import com.fdkankan.ucenter.entity.SceneCooperationCount;
+import com.fdkankan.ucenter.entity.User;
+import com.fdkankan.ucenter.mapper.ISceneCooperationCountMapper;
+import com.fdkankan.ucenter.service.ISceneCooperationCountService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fdkankan.ucenter.service.ISceneCooperationService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2025-03-20
+ */
+@Service
+public class SceneCooperationCountServiceImpl extends ServiceImpl<ISceneCooperationCountMapper, SceneCooperationCount> implements ISceneCooperationCountService {
+
+    @Autowired
+    ISceneCooperationService sceneCooperationService;
+    @Override
+    public void saveCount(List<ProductCooperation> needPay, Integer size) {
+        if(needPay == null || needPay.isEmpty() || size <=0){
+            return;
+        }
+        HashMap<String,Integer> map = new HashMap<>();
+        for (ProductCooperation productCooperation : needPay) {
+            map.merge(productCooperation.getNum() + productCooperation.getSceneType(), 1, Integer::sum);
+        }
+
+        HashSet<String> hashSet = new HashSet<>();
+        for (ProductCooperation productCooperation : needPay) {
+            if(hashSet.contains(productCooperation.getNum()+productCooperation.getSceneType())){
+                continue;
+            }
+            hashSet.add(productCooperation.getNum()+productCooperation.getSceneType());
+
+            String num = productCooperation.getNum();
+            SceneCooperationCount byNum = this.getByNum(num, productCooperation.getSceneType());
+            if(byNum == null){
+                SceneCooperationCount count = new SceneCooperationCount();
+                count.setSceneType(productCooperation.getSceneType());
+                count.setNum(num);
+                count.setCount( map.get(num + productCooperation.getSceneType()) + 1);
+                this.save(count);
+            }else {
+                LambdaUpdateWrapper<SceneCooperationCount> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.eq(SceneCooperationCount::getId,byNum.getId());
+                wrapper.set(SceneCooperationCount::getCount, byNum.getCount() + map.get(num + productCooperation.getSceneType()));
+                this.update(wrapper);
+            }
+        }
+
+    }
+
+    @Override
+    public List<SceneCooperationCount> getByNumList(List<String> numList,String sceneType) {
+        if(numList == null || numList.isEmpty()){
+            return new ArrayList<>();
+        }
+        LambdaQueryWrapper<SceneCooperationCount> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(SceneCooperationCount::getNum,numList);
+        wrapper.eq(SceneCooperationCount::getSceneType,sceneType);
+        return this.list(wrapper);
+    }
+
+    @Override
+    public SceneCooperationCount getByNum(String num,String sceneType) {
+        LambdaQueryWrapper<SceneCooperationCount> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SceneCooperationCount::getNum,num);
+        wrapper.eq(SceneCooperationCount::getSceneType,sceneType);
+        List<SceneCooperationCount> list = this.list(wrapper);
+        if(list == null || list.isEmpty()){
+            return null;
+        }
+        return list.get(0);
+    }
+}

+ 350 - 70
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -3,13 +3,15 @@ package com.fdkankan.ucenter.service.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.fdkankan.common.constant.SceneConstant;
-import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.ucenter.common.PageInfo;
 import com.fdkankan.ucenter.common.RedisKeyUtil;
+import com.fdkankan.ucenter.common.SceneSourceUtil;
 import com.fdkankan.ucenter.common.constants.NacosProperty;
+import com.fdkankan.ucenter.common.constants.ResultCode;
 import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.entity.*;
+import com.fdkankan.ucenter.exception.BusinessException;
 import com.fdkankan.ucenter.httpClient.service.LaserService;
 import com.fdkankan.ucenter.mapper.ISceneCooperationMapper;
 import com.fdkankan.ucenter.service.*;
@@ -18,7 +20,9 @@ import com.fdkankan.ucenter.util.DateUserUtil;
 import com.fdkankan.ucenter.vo.request.SceneCooperationParam;
 import com.fdkankan.ucenter.vo.request.SceneParam;
 import com.google.common.collect.Lists;
+import com.sun.org.apache.bcel.internal.generic.RET;
 import org.apache.commons.lang3.StringUtils;
+import org.opencv.face.Face;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -60,6 +64,12 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     RedisUtil redisUtil;
     @Autowired
     IMailTemplateService mailTemplateService;
+    @Autowired
+    IProductOrderService productOrderService;
+    @Autowired
+    IProductCooperationService productCooperationService;
+    @Autowired
+    ISceneCooperationCountService sceneCooperationCountService;
 
     @Override
     public Long getCooperationSceneNum(Long userId, List<Integer> sceneSourceList) {
@@ -69,15 +79,29 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     }
 
     @Override
-    public void deleteCooperationList(List<ScenePro> sceneProList,List<ScenePlus> scenePlusList) {
+    public void deleteCooperationList(List<ScenePro> sceneProList,List<ScenePlus> scenePlusList,List<Long> userIds) {
         if(CollectionUtils.isEmpty(sceneProList) && CollectionUtils.isEmpty(scenePlusList)){
             return;
         }
         List<String> numList = sceneProList.stream().map(ScenePro::getNum).collect(Collectors.toList());
         List<String> numList2 = scenePlusList.stream().map(ScenePlus::getNum).collect(Collectors.toList());
         numList.addAll(numList2);
+        this.deleteCooperationList(numList,userIds,null);
+    }
+
+    @Override
+    public void deleteCooperationList(List<String> numList,List<Long> userIds,String sceneType) {
+        if(CollectionUtils.isEmpty(numList) ){
+            return;
+        }
         LambdaQueryWrapper<SceneCooperation> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(SceneCooperation::getSceneNum,numList);
+        if(sceneType != null){
+            wrapper.eq(SceneCooperation::getSceneType,sceneType);
+        }
+        if(userIds != null && !userIds.isEmpty()){
+            wrapper.in(SceneCooperation::getUserId,userIds);
+        }
         List<SceneCooperation> list = this.list(wrapper);
         List<Long> ids = list.stream().map(SceneCooperation::getId).collect(Collectors.toList());
         if(ids.size() >0){
@@ -90,48 +114,61 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     }
 
     @Override
-    public void saveBatchByList(List<ScenePro> sceneProList, List<ScenePlus> scenePlusList, Long userId,List<Long> resourceIdList) {
+    public List<SceneCooperation> saveBatchByList(List<String> numList,  List<Long> userIds,String type,String sceneType) {
         List<SceneCooperation> list = new ArrayList<>();
-        for (ScenePro scenePro : sceneProList) {
-            SceneCooperation sceneCooperationEntity = new SceneCooperation();
-            sceneCooperationEntity.setUserId(userId);
-            sceneCooperationEntity.setSceneNum(scenePro.getNum());
-            sceneCooperationEntity.setRecStatus("A");
-            sceneCooperationEntity.setCreateTime(DateUserUtil.getDate(new Date()));
-            sceneCooperationEntity.setUpdateTime(DateUserUtil.getDate(new Date()));
-            list.add(sceneCooperationEntity);
-        }
-        for (ScenePlus scenePlus : scenePlusList) {
-            SceneCooperation sceneCooperationEntity = new SceneCooperation();
-            sceneCooperationEntity.setUserId(userId);
-            sceneCooperationEntity.setSceneNum(scenePlus.getNum());
-            sceneCooperationEntity.setRecStatus("A");
-            sceneCooperationEntity.setCreateTime(DateUserUtil.getDate(new Date()));
-            sceneCooperationEntity.setUpdateTime(DateUserUtil.getDate(new Date()));
-            list.add(sceneCooperationEntity);
-        }
-        for (SceneCooperation sceneCooperation : list) {
-            redisUtil.hset(RedisKeyUtil.SCENE_COOPERATION_NUM_USERID, sceneCooperation.getSceneNum(), sceneCooperation.getUserId() + "");
-        }
-        this.saveBatch(list);
-
-        if(resourceIdList.size() >0){
-            List<SceneResourceCooperation> resourceCooperationList = new ArrayList<>();
-            for (SceneCooperation sceneCooperation : list) {
-                for (Long resourceId : resourceIdList) {
-                    SceneResourceCooperation sceneResourceCooperation = new SceneResourceCooperation();
-                    sceneResourceCooperation.setSceneResourceId(resourceId);
-                    sceneResourceCooperation.setSceneCooperationId(sceneCooperation.getId());
-                    sceneResourceCooperation.setRecStatus("A");
-                    sceneResourceCooperation.setCreateTime(DateUserUtil.getDate(new Date()));
-                    sceneResourceCooperation.setUpdateTime(DateUserUtil.getDate(new Date()));
-                    resourceCooperationList.add(sceneResourceCooperation);
+        List<String> delList = new ArrayList<>();
+
+        HashMap<String, List<User>> byNumList = this.getByNumList(numList,sceneType);
+
+
+        for (Long userId : userIds) {
+            for (String num : numList) {
+                List<User> users = byNumList.get(num);
+                if(users != null && !users.isEmpty()){
+                    List<Long> collect1 = users.stream().map(User::getId).collect(Collectors.toList());
+                    if("scene".equals(type) && numList.size() == 1){
+                        for (Long l : collect1) {
+                            if(!userIds.contains(l)){
+                                delList.add(num + "," +l);
+                            }
+                        }
+                    }
+                    if(collect1.contains(userId)){
+                        continue;
+                    }
                 }
+
+                SceneCooperation sceneCooperationEntity = new SceneCooperation();
+                sceneCooperationEntity.setUserId(userId);
+                sceneCooperationEntity.setSceneNum(num);
+                sceneCooperationEntity.setSceneType(sceneType);
+                sceneCooperationEntity.setRecStatus("A");
+                sceneCooperationEntity.setCreateTime(DateUserUtil.getDate(new Date()));
+                sceneCooperationEntity.setUpdateTime(DateUserUtil.getDate(new Date()));
+                list.add(sceneCooperationEntity);
             }
-            if(resourceCooperationList.size() >0){
-                sceneResourceCooperationService.saveBatch(resourceCooperationList,10000);
+        }
+
+        if(!list.isEmpty()){
+            for (SceneCooperation sceneCooperation : list) {
+                redisUtil.hset(RedisKeyUtil.SCENE_COOPERATION_NUM_USERID, sceneCooperation.getSceneNum(), sceneCooperation.getUserId() + "");
             }
+            this.saveBatch(list);
+        }
+
+        for (String num : delList) {
+            String[] split = num.split(",");
+            delCooperation(split[0],Long.valueOf(split[1]));
         }
+        return  list;
+    }
+
+    private void delCooperation(String num ,Long userId){
+        redisUtil.hdel(RedisKeyUtil.SCENE_COOPERATION_NUM_USERID,num,userId.toString());
+        LambdaQueryWrapper<SceneCooperation> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(SceneCooperation::getSceneNum,num);
+        wrapper.eq(SceneCooperation::getUserId,userId);
+        this.remove(wrapper);
     }
 
     @Override
@@ -205,6 +242,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         User user = userService.getByUserName(username);
         LambdaQueryWrapper<SceneCooperation> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SceneCooperation::getUserId,user.getId());
+        wrapper.eq(SceneCooperation::getSceneType,"mesh");
         List<SceneCooperation> list = this.list(wrapper);
         List<String> numList = list.parallelStream().map(SceneCooperation::getSceneNum).collect(Collectors.toList());
         if(numList.size() <=0){
@@ -220,13 +258,15 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     }
 
     @Override
-    public void saveCooperation(SceneCooperationParam param, String username) {
-        if(StringUtils.isEmpty(param.getUserName()) || StringUtils.isEmpty(param.getSceneNum()) || StringUtils.isEmpty(param.getResourceIds())){
+    public void saveCooperation(SceneCooperationParam param, String loginUserName) {
+        if(StringUtils.isEmpty(param.getUserName()) || StringUtils.isEmpty(param.getSceneNum())){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
         }
-        if(param.getUserName().equals( username)){
+        if(param.getUserName().equals( loginUserName)){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3024, LoginConstant.FAILURE_MSG_3024);
         }
+        User loginUser = userService.getByUserName(loginUserName);
+
         User user = userService.getByUserName(param.getUserName());
         if(user == null){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3021, LoginConstant.FAILURE_MSG_3021);
@@ -235,32 +275,262 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         List<String> numList =  Arrays.asList(nums);
         List<ScenePro> proList = sceneProService.getListByNums(numList);
         List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
-        this.deleteCooperationList(proList,plusList);
-
-        List<SceneResource> v3List = new ArrayList<>();
-        List<SceneResource> v4List = new ArrayList<>();
-        List<Long> resourceIdList = new ArrayList<>();
-        if (StringUtils.isNotEmpty(param.getResourceIds())) {
-            for (String rId : param.getResourceIds().split(",")) {
-                resourceIdList.add(Long.valueOf(rId));
+        //this.deleteCooperationList(proList,plusList,Arrays.asList(user.getId()));
+
+        saveCooperationCommon(loginUser,param.getLang(),Arrays.asList(user),proList,plusList,null,"scene","mesh");
+    }
+
+    @Override
+    public ProductOrder saveBatchCooperation(SceneCooperationParam param, String loginUserName) {
+        if( StringUtils.isEmpty(param.getSceneNum())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+
+        String[] nums = param.getSceneNum().split(",");
+        List<String> numList =  Arrays.asList(nums);
+
+        if(param.getUserNameList() == null || param.getUserNameList().isEmpty()){
+            this.deleteCooperationList(numList,null,param.getSceneType());
+            laserService.saveBatchCooperation(numList,new ArrayList<>(),param.getUserNameList(),"scene","update");
+            return null;
+        }
+        if(param.getUserNameList().contains( loginUserName)){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3024, LoginConstant.FAILURE_MSG_3024);
+        }
+        if(param.getUserNameList().size() != new HashSet<>(param.getUserNameList()).size()){
+            throw new BusinessException(ResultCode.COO_LIMIT_ERROR2);
+        }
+        if(param.getUserNameList().size() >5){
+            throw new BusinessException(ResultCode.COO_LIMIT_ERROR);
+        }
+        User loginUser = userService.getByUserName(loginUserName);
+        if(numList.size() >1){
+            HashMap<String, List<User>> byNumList = this.getByNumList(numList, param.getSceneType());
+            for (String num : numList) {
+                if(byNumList.get(num) != null && !byNumList.isEmpty()) {
+                    if (byNumList.get(num).size() + param.getUserNameList().size() > 5) {
+                        throw new BusinessException(ResultCode.COO_LIMIT_ERROR);
+                    }
+                    List<User> users = byNumList.get(num);
+                    Set<String> collect = users.stream().map(User::getUserName).collect(Collectors.toSet());
+
+                    if(collect.containsAll(param.getUserNameList())){
+                        throw new BusinessException(ResultCode.COO_LIMIT_ERROR2);
+                    }
+                }
+            }
+        }
+
+        List<User> users = new ArrayList<>();
+        for (String userName : param.getUserNameList()) {
+            User user = userService.getByUserName(userName);
+            if(user == null){
+                throw new BusinessException(LoginConstant.FAILURE_CODE_3021, LoginConstant.FAILURE_MSG_3021);
             }
-            List<SceneResource> sceneResources = sceneResourceService.listByIds(resourceIdList);
-            v3List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v3")).collect(Collectors.toList());
-            v4List = sceneResources.stream().filter(entity -> entity.getVersion().equals("v4")).collect(Collectors.toList());
+            users.add(user);
+        }
+
+
+        ProductOrder productOrder = checkNeedPay(numList, users, loginUser, param.getPayType(), param.getTimeZone(),null,param.getLang(),param.getSceneType());
+
+        if(productOrder == null){
+            successAddCooperation(numList,users,param.getLang(),loginUser,param.getSceneType());
         }
+        return productOrder;
+
+    }
 
-        if(!v3List.isEmpty() && !proList.isEmpty()){
-            List<Long> v3Ids = v3List.stream().map(SceneResource::getId).collect(Collectors.toList());
-            this.saveBatchByList(proList,new ArrayList<>(),user.getId(),v3Ids);
+    @Override
+    public ProductOrder saveCamera(SceneCooperationParam param, String loginUserName) {
+        if(param.getCameraId() == null  || StringUtils.isEmpty(param.getUserName())){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3001, LoginConstant.FAILURE_MSG_3001);
+        }
+        if(param.getUserName().equals( loginUserName)){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3025, LoginConstant.FAILURE_MSG_3025);
+        }
+        User user = userService.getByUserName(param.getUserName());
+        if(user == null){
+            throw new BusinessException(LoginConstant.FAILURE_CODE_3015,LoginConstant.FAILURE_MSG_3015);
+        }
+        User loginUser = userService.getByUserName(loginUserName);
+        Camera camera = cameraService.getById(param.getCameraId());
+        CameraDetail cameraDetail = cameraDetailService.getByCameraId(param.getCameraId());
+        if(camera == null || cameraDetail == null || cameraDetail.getUserId() == null){
+            throw new BusinessException(ResultCode.CAMERA_NOT_EXIT);
+        }
+        if(!loginUser.getId().equals(cameraDetail.getUserId())){
+            throw new BusinessException(ResultCode.NOT_PER);
         }
-        if(!v4List.isEmpty() && !plusList.isEmpty()){
-            List<Long> v4Ids = v4List.stream().map(SceneResource::getId).collect(Collectors.toList());
-            this.saveBatchByList(new ArrayList<>(),plusList,user.getId(),v4Ids);
+        if(cameraDetail.getCooperationUser() != null){
+            throw new BusinessException(ResultCode.COO_ERROR);
         }
 
-        if("aws".equals(NacosProperty.uploadType)){
-            mailTemplateService.sendSceneCooperation(proList,plusList,param.getUserName(),param.getLang());
+        List<ScenePro> v3List = sceneProService.getListByCameraId(param.getCameraId());
+        List<ScenePlus> v4List = scenePlusService.getListByCameraId(param.getCameraId());
+        List<String> v3NumList = v3List.stream().map(ScenePro::getNum).collect(Collectors.toList());
+        List<String> v4NumList = v4List.stream().map(ScenePlus::getNum).collect(Collectors.toList());
+
+        List<String> allList = new ArrayList<>();
+        allList.addAll(v3NumList);
+        allList.addAll(v4NumList);
+
+        ProductOrder productOrder = checkNeedPay(allList, Arrays.asList(user), loginUser, param.getPayType(), param.getTimeZone(),param.getCameraId(),param.getLang(),null);
+        if(productOrder == null){
+            successAddCooperation(v3List,v4List,Arrays.asList(user),param.getLang(),loginUser,Arrays.asList(camera),null);
+            cameraDetailService.updateCooperationByIds(Arrays.asList(param.getCameraId()),user.getId());
         }
+
+        return productOrder;
+    }
+
+    private void  successAddCooperation(List<String> numList, List<User> users, String lang, User loginUser,String sceneType){
+        List<ScenePro> proList = sceneProService.getListByNums(numList);
+        List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
+        List<Long> userIds = users.stream().map(User::getId).collect(Collectors.toList());
+        //this.deleteCooperationList(proList,plusList,userIds);
+
+        saveCooperationCommon(loginUser,lang,users,proList,plusList,null,"scene",sceneType);
+    }
+
+    @Override
+    public void  successAddCooperation(List<String> numList,List<Long> userIds,Long loginUserId,Long cameraId,String lang,String sceneType,List<ProductCooperation> needPay ){
+        //this.deleteCooperationList(numList,userIds);
+        List<ScenePro> proList = sceneProService.getListByNums(numList);
+        List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
+        List<User> users = userService.listByIds(userIds);
+        User user = userService.getById(loginUserId);
+        if(cameraId != null ){
+            Camera camera = cameraService.getById(cameraId);
+            saveCooperationCommon(user,lang,users,proList,plusList,Arrays.asList(camera),"camera",sceneType);
+            cameraDetailService.updateCooperationByIds(Arrays.asList(cameraId),userIds.get(0));
+        }else {
+            saveCooperationCommon(user,lang,users,proList,plusList,null,"scene",sceneType);
+        }
+        sceneCooperationCountService.saveCount(needPay,userIds.size());
+
+    }
+
+    private void  successAddCooperation(List<ScenePro> v3List,List<ScenePlus> v4List,List<User> users,String lang,User loginUser,List<Camera>cameraList,String sceneType){
+        List<Long> userIds = users.stream().map(User::getId).collect(Collectors.toList());
+        //this.deleteCooperationList(v3List,v4List,userIds);
+        saveCooperationCommon(loginUser,lang,users,v3List,v4List,cameraList,"camera",sceneType);
+
+    }
+
+
+
+    private ProductOrder checkNeedPay(List<String> numList, List<User> users,User loginUser,Integer payType,Integer timeZone,Long cameraId,String lang,String sceneType) {
+        HashMap<String,String> needNumListMesh = new HashMap<>();
+        HashMap<String,String> needNumListLaser =new HashMap<>();
+        if(StringUtils.isBlank(sceneType)){
+            needNumListMesh = getTotalCount(numList,users,"mesh",cameraId);
+            needNumListLaser =  getTotalCount(numList,users,"laser",cameraId);
+        }else {
+            needNumListMesh = getTotalCount(numList,users,sceneType,cameraId);
+        }
+        if(needNumListMesh.size() + needNumListLaser.size()<=0){
+            return null;
+        }
+        ProductOrder productOrder = productOrderService.createOrder(needNumListMesh.size() + needNumListLaser.size(), "cooperation", loginUser, payType, timeZone, cameraId, lang, sceneType);
+        productCooperationService.add(productOrder,users,numList,needNumListMesh,needNumListLaser,sceneType);
+        return productOrder;
+
+    }
+
+    private HashMap<String,String> getTotalCount(List<String> numList, List<User> users,String sceneType,Long cameraId){
+        List<SceneCooperationCount> freeCountList = sceneCooperationCountService.getByNumList(numList,sceneType);
+        HashMap<String,Integer> freeMap = new HashMap<>();
+        freeCountList.forEach(e -> freeMap.put(e.getNum(),e.getCount()));
+
+        HashMap<String, List<User>> map = this.getByNumList(numList,sceneType);
+        HashMap<String,String> needNumList = new HashMap<>();
+        for (String num : numList) {
+            Integer freeCount = freeMap.get(num) == null ? 1 :freeMap.get(num);
+
+            List<User> dbUserList = map.get(num);
+
+            if(dbUserList != null && !dbUserList.isEmpty()){
+                List<Long> dbUserIds = dbUserList.stream().map(User::getId).collect(Collectors.toList());
+                HashMap<Long,User> userHashMap = new HashMap<>();
+                for (User user : users) {
+                    if(dbUserIds.contains(user.getId())){
+                        userHashMap.put(user.getId(),user);
+                    }
+                }
+                Integer totalSize = dbUserList.size() - userHashMap.size();
+
+                if(numList.size() >1){
+                    freeCount = (totalSize > freeCount ? totalSize :  (freeCount - totalSize));
+                }else {
+                    freeCount = (totalSize > freeCount ? totalSize : freeCount) ;
+                }
+            }
+
+            for (int i = 0 ; i< users.size() - freeCount;i++){
+                needNumList.put(users.get(i).getId()+","+num,num);
+            }
+
+        }
+        return needNumList;
+    }
+
+    @Autowired
+    LaserService laserService;
+
+    private void saveCooperationCommon(User LoginUser,String lang,List<User> userList,List<ScenePro> proList, List<ScenePlus> plusList,List<Camera >cameraList,String type,String sceneType){
+
+        List<Long> userIds = userList.stream().map(User::getId).collect(Collectors.toList());
+        Set<String> numList = new HashSet<>();
+        List<String> v3List = proList.stream().map(ScenePro::getNum).collect(Collectors.toList());
+        List<String> v4List = plusList.stream().map(ScenePlus::getNum).collect(Collectors.toList());
+        numList.addAll(v3List);
+        numList.addAll(v4List);
+
+        List<ScenePro> collect1 = proList.stream().filter(e -> SceneSourceUtil.getLaserList().contains(e.getSceneSource())).collect(Collectors.toList());
+        List<ScenePlus> collect2 = plusList.stream().filter(e -> SceneSourceUtil.getLaserList().contains(e.getSceneSource())).collect(Collectors.toList());
+        Set<String> numList1 = collect1.stream().map(ScenePro::getNum).collect(Collectors.toSet());
+        Set<String> numList2 = collect2.stream().map(ScenePlus::getNum).collect(Collectors.toSet());
+        numList1.addAll(numList2);
+
+
+        List<SceneCooperation> addList =new ArrayList<>();
+        if( !numList.isEmpty()){
+            if(StringUtils.isBlank(sceneType)){
+                addList = this.saveBatchByList(new ArrayList<>(numList), userIds, type,"mesh");
+                if(!numList1.isEmpty()){
+                    this.saveBatchByList(new ArrayList<>(numList1), userIds, type,"laser");
+                }
+            }else {
+                addList = this.saveBatchByList(new ArrayList<>(numList), userIds, type,sceneType);
+            }
+        }
+        List<Long> collect3 = addList.stream().map(SceneCooperation::getUserId).collect(Collectors.toList());
+        for (User user : userList) {
+            if("aws".equals(NacosProperty.uploadType)){
+                if("camera".equals(type) && cameraList != null){
+                    HashMap<Long, Camera> cameraMap = new HashMap<>();
+                    cameraList.forEach(e -> cameraMap.put(e.getId(),e));
+                    mailTemplateService.sendCameraCooperation(cameraMap,user.getUserName(),lang);
+                }else {
+                    if(collect3.contains(user.getId())){
+                        mailTemplateService.sendSceneCooperation(proList,plusList,user.getUserName(),lang);
+                    }
+                }
+            }
+        }
+
+
+        List<String> collect = userList.stream().map(User::getUserName).collect(Collectors.toList());
+        List<String> snCodeList = new ArrayList<>();
+        if(cameraList !=null ){
+            snCodeList = cameraList.stream().map(Camera::getSnCode).collect(Collectors.toList());
+        }
+        if(StringUtils.isNotBlank(sceneType) && "mesh".equals(sceneType)){
+            return;
+        }
+        String operatingMode = numList.size() > 1 ? "add" :"update";
+        laserService.saveBatchCooperation(new ArrayList<>(numList1),snCodeList,collect,type,operatingMode);
+
     }
 
     @Override
@@ -272,7 +542,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         List<String> numList =  Arrays.asList(nums);
         List<ScenePro> proList = sceneProService.getListByNums(numList);
         List<ScenePlus> plusList = scenePlusService.getListByNums(numList);
-        this.deleteCooperationList(proList,plusList);
+        this.deleteCooperationList(proList,plusList,null);
     }
 
     @Override
@@ -298,30 +568,40 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     }
 
     @Override
-    public HashMap<String, User> getByNumList(List<String> numList) {
+    public HashMap<String, List<User>> getByNumList(List<String> numList,String sceneType) {
+        if(numList == null || numList.isEmpty()){
+            return new HashMap<>();
+        }
         LambdaQueryWrapper<SceneCooperation> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(SceneCooperation::getSceneNum,numList);
+        if(StringUtils.isNotBlank(sceneType)){
+            wrapper.eq(SceneCooperation::getSceneType,sceneType);
+        }
         List<SceneCooperation> list = this.list(wrapper);
-        HashMap<String,User> cooMap = new HashMap<>();
+        HashMap<String,List<User>> cooMap = new HashMap<>();
         if(list.size() >0){
             List<Long> userIds = list.parallelStream().map(SceneCooperation::getUserId).collect(Collectors.toList());
             if(userIds.size() >0){
                 HashMap<Long, User> userMap = userService.getByIds(userIds);
-                list.forEach(entity -> cooMap.put(entity.getSceneNum(),userMap.get(entity.getUserId())));
+                for (SceneCooperation entity : list) {
+                    User user = userMap.get(entity.getUserId());
+                    cooMap.computeIfAbsent(entity.getSceneNum(), k -> new ArrayList<>());
+                    if(!cooMap.get(entity.getSceneNum()).contains(user)){
+                        cooMap.get(entity.getSceneNum()).add(user);
+                    }
+                }
             }
         }
         return cooMap;
     }
 
     @Override
-    public SceneCooperation getByNum(String num) {
+    public List<SceneCooperation> getByNum(String num,String sceneType) {
         LambdaQueryWrapper<SceneCooperation> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SceneCooperation::getSceneNum,num);
+        wrapper.eq(SceneCooperation::getSceneType,sceneType);
         List<SceneCooperation> list = this.list(wrapper);
-        if(list == null || list.size() <=0){
-            return null;
-        }
-        return list.get(0);
+        return list;
     }
 
     @Override

+ 2 - 1
src/main/java/com/fdkankan/ucenter/service/impl/SceneDownloadLogServiceImpl.java

@@ -21,7 +21,7 @@ import java.util.List;
 public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMapper, SceneDownloadLog> implements ISceneDownloadLogService {
 
     @Override
-    public SceneDownloadLog getByStatusAndNum(String sceneNum, int status, Integer isUpgrade) {
+    public SceneDownloadLog getByStatusAndNum(String sceneNum, Integer status, Integer isUpgrade,Integer version) {
         LambdaQueryWrapper<SceneDownloadLog> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(SceneDownloadLog::getSceneNum,sceneNum);
         wrapper.eq(SceneDownloadLog::getStatus,status);
@@ -30,6 +30,7 @@ public class SceneDownloadLogServiceImpl extends ServiceImpl<ISceneDownloadLogMa
             sysVersion = "v4";
         }
         wrapper.eq(SceneDownloadLog::getSysVersion,sysVersion);
+        wrapper.eq(SceneDownloadLog::getSceneVersion,version);
         wrapper.orderByDesc(SceneDownloadLog::getCreateTime);
         List<SceneDownloadLog> list = this.list(wrapper);
         if(list != null && list.size() >0){

+ 23 - 14
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -294,6 +294,9 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         Long space = 0L;
         if (list != null && list.size() > 0){
             for (SimpleSceneVo scenePro : list){
+                if(scenePro.getCompanyId()!=null && scenePro.getCompanyId() == 26L && scenePro.getLocation() != null && scenePro.getLocation() ==7){
+                    continue;
+                }
                 Long sceneSpace  = scenePro.getSpace()== null ? 0 : scenePro.getSpace();
                 if("SP".equals(unit)){
                     sceneSpace = 1L;
@@ -481,14 +484,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         Page<SceneVo> sceneList = sceneService.getSceneList(param);
         for (SceneVo record : sceneList.getRecords()) {
             record.setUserName(username);
-            SceneCooperation sceneCooperationEntity = sceneCooperationService.getByNum(record.getNum());
-            if(sceneCooperationEntity != null && sceneCooperationEntity.getUserId()!= null){
-
-                User user1 = userService.getById(sceneCooperationEntity.getUserId());
-                if(user1 != null){
-                    record.setCooperationUserId(String.valueOf(sceneCooperationEntity.getUserId()));
-                    record.setCooperationUserName(user1.getUserName());
+            List<SceneCooperation> sceneCooperationEntitys = sceneCooperationService.getByNum(record.getNum(),"mesh");
+            if(sceneCooperationEntitys != null && !sceneCooperationEntitys.isEmpty()){
+                List<String> userNameList = new ArrayList<>();
+                List<Long> userIds = new ArrayList<>();
+                for (SceneCooperation sceneCooperationEntity : sceneCooperationEntitys) {
+                    User user1 = userService.getById(sceneCooperationEntity.getUserId());
+                    if(user1 != null){
+                        userIds.add(sceneCooperationEntity.getUserId());
+                        userNameList.add(user1.getUserName());
+                    }
                 }
+                record.setCooperationUserNameList(userNameList);
+                record.setCooperationUserIdList(userIds);
             }
         }
         return PageInfo.PageInfo(sceneList);
@@ -526,13 +534,15 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         //设置协作者信息
         if(sceneVoPage.getRecords().size() >0){
             List<String> numList = sceneVoPage.getRecords().parallelStream().map(SceneVo::getNum).collect(Collectors.toList());
-            HashMap<String,User> cooMap = sceneCooperationService.getByNumList(numList);
+            HashMap<String,List<User>> cooMap = sceneCooperationService.getByNumList(numList,"mesh");
             for (SceneVo vo : sceneVoPage.getRecords()) {
                 if (StringUtils.isNotBlank(vo.getNum())) {
-                    User userVo = cooMap.get(vo.getNum());
-                    if (userVo != null) {
-                        vo.setCooperationUserId(userVo.getId().toString());
-                        vo.setCooperationUserName(userVo.getUserName());
+                    List<User> userVos = cooMap.get(vo.getNum());
+                    if (userVos != null) {
+                        List<Long> ids = userVos.stream().map(User::getId).collect(Collectors.toList());
+                        List<String> userNameList = userVos.stream().map(User::getUserName).collect(Collectors.toList());
+                        vo.setCooperationUserIdList(ids);
+                        vo.setCooperationUserNameList(userNameList);
                     }
                 }
             }
@@ -1088,8 +1098,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         HashMap<Long, ScenePlusExt> plusMap = scenePlusExtService.getByPlusIds(plusIds);
         for (ScenePlus scenePlus : plusList) {
             ScenePlusExt ext = plusMap.get(scenePlus.getId());
-            if(ext == null || scenePlus.getSceneStatus() !=-2 ||
-                    (cameraDetail.getCompanyId()!=null && cameraDetail.getCompanyId() == 26L && ext.getLocation() != null && ext.getLocation() ==7)){
+            if(ext == null || scenePlus.getSceneStatus() !=-2 ){
                 continue;
             }
             SimpleSceneVo sceneVo = new SimpleSceneVo();

+ 1 - 0
src/main/java/com/fdkankan/ucenter/service/impl/UserServiceImpl.java

@@ -110,6 +110,7 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         userEntity.setRecStatus("A");
         userEntity.setCreateTime(DateUserUtil.getDate(new Date()));
         userEntity.setUpdateTime(DateUserUtil.getDate(new Date()));
+        userEntity.setAgentKey(param.getAgentKey());
         this.save(userEntity);
     }
 

+ 2 - 0
src/main/java/com/fdkankan/ucenter/vo/request/RegisterParam.java

@@ -13,4 +13,6 @@ public class RegisterParam {
 
     private String clear;
 
+    private String agentKey;
+
 }

+ 18 - 0
src/main/java/com/fdkankan/ucenter/vo/request/SceneCooperationParam.java

@@ -2,6 +2,7 @@ package com.fdkankan.ucenter.vo.request;
 
 import lombok.Data;
 
+import java.util.ArrayList;
 import java.util.List;
 
 @Data
@@ -16,4 +17,21 @@ public class SceneCooperationParam {
     private String resourceIds;
 
     private String lang = "en";
+    private Integer payType;
+    private Integer timeZone;
+
+    private List<String> userNameList = new ArrayList<>();
+
+    private String sceneType="mesh";
+
+    public List<String> getUserNameList() {
+        if(userNameList.isEmpty()){
+            return userNameList;
+        }
+        List<String> list = new ArrayList<>();
+        for (String s : userNameList) {
+            list.add(s.trim());
+        }
+        return list;
+    }
 }

+ 1 - 0
src/main/java/com/fdkankan/ucenter/vo/response/GroupByCount.java

@@ -7,4 +7,5 @@ public class GroupByCount {
     private Long id;
     private Long count;
     private String lastTime;
+    private Long space;
 }

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

@@ -6,6 +6,8 @@ import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.util.List;
+
 @Data
 @Builder
 @NoArgsConstructor
@@ -17,6 +19,8 @@ public class SceneVo {
     private String childName;
     private String cooperationUserId;
     private String cooperationUserName;         //协作者
+    private List<Long> cooperationUserIdList;
+    private List<String> cooperationUserNameList;         //协作者
     private Integer isFolder;                   //0 场景,1文件夹
     private String num;
     private String sceneName;

+ 48 - 0
src/main/resources/bootstrap-dev-eur.yml

@@ -0,0 +1,48 @@
+spring:
+  application:
+    name: 4dkankan-center-ucenter
+  cloud:
+    nacos:
+      config:
+        server-addr: 3.75.137.132:8848
+        file-extension: yaml
+        namespace: 4dkankan-v4-dev-eur
+        extension-configs:
+          - data-id: 4dkankan-center-ucenter.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+        shared-configs:
+
+          - data-id: common-redis-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-rabbitmq-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-fyun-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: forest-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: common-db-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+
+          - data-id: sms-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
+      discovery:
+        server-addr: ${spring.cloud.nacos.config.server-addr}
+        namespace: ${spring.cloud.nacos.config.namespace}
+
+
+

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

@@ -37,7 +37,9 @@ spring:
             group: DEFAULT_GROUP
             refresh: true
 
-
+          - data-id: sms-config.yaml
+            group: DEFAULT_GROUP
+            refresh: true
       discovery:
         server-addr: ${spring.cloud.nacos.config.server-addr}
         namespace: ${spring.cloud.nacos.config.namespace}

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

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: test-eur
+    active: dev-eur
 server:
   port: 8082
   servlet:

+ 5 - 0
src/main/resources/mapper/ucenter/ProductCooperationMapper.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.ucenter.mapper.IProductCooperationMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/ucenter/ProductMapper.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.ucenter.mapper.IProductMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/ucenter/ProductOrderMapper.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.ucenter.mapper.IProductOrderMapper">
+
+</mapper>

+ 5 - 0
src/main/resources/mapper/ucenter/SceneCooperationCountMapper.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.ucenter.mapper.ISceneCooperationCountMapper">
+
+</mapper>

+ 6 - 6
src/main/resources/mapper/ucenter/SceneProMapper.xml

@@ -3,8 +3,8 @@
 <mapper namespace="com.fdkankan.ucenter.mapper.ISceneProMapper">
 
     <select id="findSceneProNumByCameraIds" resultType="com.fdkankan.ucenter.vo.response.GroupByCount">
-        SELECT camera_id as id,count(id)  as count ,max(create_time) as lastTime FROM t_scene_pro
-        WHERE rec_status = 'A' AND camera_id is not null AND is_upgrade = 0
+        SELECT camera_id as id,count(id)  as count,sum(space)  as space  ,max(create_time) as lastTime FROM t_scene_pro
+        WHERE rec_status = 'A'  AND is_upgrade = 0
         and camera_id in
         <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
             #{cameraId}
@@ -12,8 +12,8 @@
         GROUP BY camera_id
     </select>
     <select id="findScenePlusNumByCameraIds" resultType="com.fdkankan.ucenter.vo.response.GroupByCount">
-        SELECT camera_id as id,count(id)  as count ,max(create_time) as lastTime FROM t_scene_plus
-        WHERE rec_status = 'A' AND camera_id is not null
+        SELECT camera_id as id,count(s.id)  as count ,sum(space)  as space ,max(s.create_time) as lastTime FROM t_scene_plus s left join  t_scene_plus_ext e on s.id = e.plus_id
+        WHERE s.rec_status = 'A'
         and camera_id in
         <foreach item="cameraId" collection="cameraIds" open="(" separator="," close=")">
             #{cameraId}
@@ -24,7 +24,7 @@
     <select id="pageListAndFolder" resultType="com.fdkankan.ucenter.vo.response.SceneVo">
         <include refid="HasFolder"></include>
         SELECT * FROM (
-        SELECT  p.id ,null as name ,0 as isFolder,null as type,null as parentId ,p.create_time,num,scene_name,scene_dec,
+        SELECT DISTINCT  p.id ,null as name ,0 as isFolder,null as type,null as parentId ,p.create_time,num,scene_name,scene_dec,
         p.status,pay_status,thumb,web_site,0 as is_upgrade,sn_code,view_count,p.build_type, null as removePortrait,p.scene_source
         FROM t_scene_pro p
         <include refid="sceneJoinCamera"></include>
@@ -39,7 +39,7 @@
           and  p.is_obj  = #{param.isObj}
         </if>
         UNION ALL
-        SELECT  p.id as id ,null as name ,0 as isFolder,null as type,null as parentId,e.algorithm_time as createTime ,num,title as scene_name,description as scene_dec,
+        SELECT  DISTINCT  p.id as id ,null as name ,0 as isFolder,null as type,null as parentId,e.algorithm_time as createTime ,num,title as scene_name,description as scene_dec,
         scene_status as status,pay_status,thumb,web_site,1 as is_upgrade,sn_code,view_count,e.build_type,p.remove_portrait as removePortrait,p.scene_source
         FROM t_scene_plus p
         LEFT JOIN t_scene_plus_ext e on p.id = e.plus_id