Explorar el Código

Merge remote-tracking branch 'origin/test'

lyhzzz hace 3 meses
padre
commit
404b300af9

+ 8 - 1
doc/update1.10.9.sql

@@ -103,4 +103,11 @@ ALTER TABLE `4dkankan_v4`.`t_scene_cooperation`
 
 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`;
+    ADD COLUMN `need_pay` int NULL DEFAULT 0 AFTER `scene_type`;
+
+ALTER TABLE `4dkankan_v4`.`t_product_order`
+    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `update_time`,
+    ADD COLUMN `need_pay` int NULL DEFAULT 0 AFTER `scene_type`;
+
+ALTER TABLE `4dkankan_v4`.`t_scene_cooperation_count`
+    ADD COLUMN `scene_type` varchar(255) NULL DEFAULT 'mesh' AFTER `rec_status`;

+ 72 - 0
src/main/java/com/fdkankan/ucenter/constant/CameraTypelEnum.java

@@ -0,0 +1,72 @@
+package com.fdkankan.ucenter.constant;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public enum CameraTypelEnum {
+
+    FD_KK_1(1,"四维看看", Arrays.asList(1,2,12,13,14),false),
+    FD_KK_2(4,"四维看看", Arrays.asList(1,2,12,13,14),false),
+    FD_KJ(9,"四维看见", Arrays.asList(3),false),
+    FD_SS_LASER(10,"深时", Arrays.asList(4),true),
+    FD_SG_LASER(11,"深光", Arrays.asList(5),true),
+    FD_SX_LASER(12,"深巡", Arrays.asList(7),true),
+
+    ;
+
+    Integer cameraType;
+    String name;
+    List<Integer> sceneSource;
+    Boolean isLaser;
+
+    CameraTypelEnum(Integer cameraType, String name, List<Integer>sceneSource , Boolean isLaser) {
+        this.cameraType = cameraType;
+        this.name = name;
+        this.sceneSource = sceneSource;
+        this.isLaser = isLaser;
+    }
+
+    public Integer getCameraType() {
+        return cameraType;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public List<Integer> getSceneSource() {
+        return sceneSource;
+    }
+
+    public Boolean getLaser() {
+        return isLaser;
+    }
+
+    public static List<Map<String, Object>> getAllProperties() {
+        return Arrays.stream(values())
+                .map(vo -> {
+                    Map<String, Object> props = new HashMap<>();
+                    props.put("name", vo.name);
+                    props.put("cameraType", vo.cameraType);
+                    props.put("sceneSource", vo.sceneSource);
+                    props.put("isLaser", vo.isLaser);
+                    return props;
+                })
+                .collect(Collectors.toList());
+    }
+
+    public static CameraTypelEnum getByCameraType(Integer cameraType) {
+        for (CameraTypelEnum value : CameraTypelEnum.values()) {
+            if(value.cameraType.equals(cameraType)){
+                return value;
+            }
+        }
+        return null;
+    }
+
+
+
+}

+ 3 - 1
src/main/java/com/fdkankan/ucenter/mq/consumer/AutoOrderConsumer.java

@@ -69,7 +69,9 @@ public class AutoOrderConsumer {
             if(incrementAutoOrder.getSubscriptionId() == null){
                 autoOrderService.subOrder(order.getSubscriptionOrderSn(),order.getSubscriptionId());
             }
-
+            if(order.getPayType() == null || order.getPayType() == 5){
+                order.setPayType(2);
+            }
             switch (order.getEventType()){
                 case "PAYMENT.SALE.COMPLETED" :     //每日扣款
                     //Enum: "completed" "partially_refunded" "pending" "refunded" "denied"

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

@@ -73,6 +73,7 @@ public class OrderDownConsumer {
                 case 0 : case 1: case 2: payType = 0;break;
                 case 3 : case 4:  payType = 1;break;
                 case 5 :   payType = 2;break;
+                default: payType = order.getPayType();
             }
             if(order.getPayStatus() != 1){
                 log.info("order-payResult----支付失败:{}",order);

+ 1 - 0
src/main/java/com/fdkankan/ucenter/pay/paypal/sdk/AutoPaypalVo.java

@@ -22,4 +22,5 @@ public class AutoPaypalVo {
     private String subscriptionId;
 
     private String subscriptionOrderSn;
+    private Integer payType;
 }

+ 11 - 6
src/main/java/com/fdkankan/ucenter/service/impl/AppSceneService.java

@@ -11,6 +11,8 @@ import com.fdkankan.ucenter.common.PageInfo;
 import com.fdkankan.common.util.FileUtils;
 import com.fdkankan.redis.util.RedisUtil;
 import com.fdkankan.ucenter.common.OssPath;
+import com.fdkankan.ucenter.constant.CameraConstant;
+import com.fdkankan.ucenter.constant.CameraTypelEnum;
 import com.fdkankan.ucenter.constant.LoginConstant;
 import com.fdkankan.ucenter.entity.*;
 import com.fdkankan.ucenter.httpClient.service.LaserService;
@@ -108,12 +110,15 @@ public class AppSceneService {
         Page<AppSceneVo> page =  scenePlusMapper.pageList(new Page<>(param.getPageNum(),param.getPageSize()),param);
         List<String> numList = page.getRecords().stream().map(AppSceneVo::getNum).collect(Collectors.toList());
 
-        HashMap<String, JSONObject> ssSceneMap = new HashMap<>();
-        if(param.getCameraType() == 10 ){  //深时
-            ssSceneMap = laserService.list(numList,4);
+
+        CameraTypelEnum cameraTypelEnum = CameraTypelEnum.getByCameraType(param.getCameraType());
+        if(cameraTypelEnum == null){
+            throw new BusinessException(CameraConstant.FAILURE_CODE_6028, CameraConstant.FAILURE_MSG_6028);
         }
-        if( param.getCameraType() == 11){  //深光
-            ssSceneMap = laserService.list(numList,5);
+
+        HashMap<String, JSONObject> ssSceneMap = new HashMap<>();
+        if(cameraTypelEnum.getLaser() ){  //深时
+            ssSceneMap = laserService.list(numList,cameraTypelEnum.getSceneSource().get(0));
         }
 
 //        Set<Long> cameraIdSet = page.getRecords().stream().map(AppSceneVo::getCameraId).collect(Collectors.toSet());
@@ -124,7 +129,7 @@ public class AppSceneService {
         //相机登录     sceneSourceType 取值皆为0
 
         for (AppSceneVo record : page.getRecords()) {
-            if(param.getCameraType() == 10 || param.getCameraType() == 11){  //深时
+            if(cameraTypelEnum.getLaser()){  //深时
                 JSONObject ssObj = ssSceneMap.get(record.getNum());
                 if(ssObj!=null){
                     record.setSceneName(ssObj.getString("title"));

+ 0 - 10
src/main/java/com/fdkankan/ucenter/service/impl/DownService.java

@@ -89,16 +89,6 @@ public class DownService implements IDownService {
             downVo.setDownloadUrl(sceneDownloadLog.getDownloadUrl());
             return downVo;
         }
-        //下载过,有更改
-        if(sceneDownloadLog != null){
-            String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS;
-            if(isUp == 1){
-                redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS_V4;
-            }
-            downVo.setDownloadStatus(2);
-            redisUtil.del(String.format(redisKey,sceneNum));  // 清除旧的下载信息
-            return downVo;
-        }
         return downVo;
     }
 

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

@@ -73,7 +73,7 @@ public class IncrementAutoOrderServiceImpl extends ServiceImpl<IIncrementAutoOrd
     public void paySuccess(IncrementAutoOrder incrementAutoOrder, AutoPaypalVo order) throws Exception {
         incrementOrderService.addNewOrderByOrder(incrementAutoOrder,order);
 
-        incrementOrder.handleOrder(order.getOrderSn(),order.getTradeNo(),order.getOrderSn(),2,null);
+        incrementOrder.handleOrder(order.getOrderSn(),order.getTradeNo(),order.getOrderSn(),order.getPayType(),null);
 
     }
 

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

@@ -267,7 +267,7 @@ public class IncrementOrderServiceImpl extends ServiceImpl<IIncrementOrderMapper
         IncrementOrder incrementOrder = new IncrementOrder();
         incrementOrder.setOrderSn(order.getOrderSn());
         incrementOrder.setAmount(new BigDecimal(order.getAmount()));
-        incrementOrder.setPayType(2);
+        incrementOrder.setPayType(order.getPayType());
         incrementOrder.setPayStatus(-1);
         incrementOrder.setUserId(incrementAutoOrder.getUserId());
         incrementOrder.setCount(1);

+ 9 - 0
src/main/java/com/fdkankan/ucenter/service/impl/InvoiceServiceImpl.java

@@ -50,6 +50,8 @@ public class InvoiceServiceImpl extends ServiceImpl<IInvoiceMapper, Invoice> imp
     IVirtualOrderService virtualOrderService;
     @Autowired
     IExpansionOrderService expansionOrderService;
+    @Autowired
+    IDownloadOrderService downloadOrderService;
 
     @Override
     public Invoice getByOrderId(Long orderId) {
@@ -163,6 +165,13 @@ public class InvoiceServiceImpl extends ServiceImpl<IInvoiceMapper, Invoice> imp
                     money = incrementOrder.getAmount();
                 }
                 break;
+
+            case 3 :
+                DownloadOrder downloadOrder = downloadOrderService.getById(orderId);
+                if(downloadOrder.getPayStatus() == 1){
+                    money = downloadOrder.getAmount();
+                }
+                break;
         }
         return money;
     }

+ 52 - 12
src/main/java/com/fdkankan/ucenter/service/impl/SceneCooperationServiceImpl.java

@@ -49,6 +49,8 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     @Autowired
     IScenePlusService scenePlusService;
     @Autowired
+    IScenePlusExtService scenePlusExtService;
+    @Autowired
     LaserService fdkkLaserService;
     @Autowired
     ISceneResourceCooperationService sceneResourceCooperationService;
@@ -120,7 +122,6 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
 
         HashMap<String, List<User>> byNumList = this.getByNumList(numList,sceneType);
 
-
         for (Long userId : userIds) {
             for (String num : numList) {
                 List<User> users = byNumList.get(num);
@@ -291,7 +292,9 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
 
         if(param.getUserNameList() == null || param.getUserNameList().isEmpty()){
             this.deleteCooperationList(numList,null,param.getSceneType());
-            laserService.saveBatchCooperation(numList,new ArrayList<>(),param.getUserNameList(),"scene","update");
+            if("laser".equals(param.getSceneType())){
+                laserService.saveBatchCooperation(numList,new ArrayList<>(),param.getUserNameList(),"scene","update");
+            }
             return null;
         }
         if(param.getUserNameList().contains( loginUserName)){
@@ -438,13 +441,33 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
     }
 
     private HashMap<String,String> getTotalCount(List<String> numList, List<User> users,String sceneType,Long cameraId){
+        List<String> forList = new ArrayList<>(numList);
+
         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) {
+
+        if(cameraId != null && "mesh".equals(sceneType)){
+            CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
+            if(cameraDetail == null || cameraDetail.getType() == null){
+                throw new BusinessException(ResultCode.CAMERA_NOT_EXIT);
+            }
+            if(cameraDetail.getType() == 10 || cameraDetail.getType() == 11){
+                List<ScenePro> listByNums = sceneProService.getListByNums(numList);
+                List<String> newList = listByNums.stream().filter(e->e.getIsObj() == 1).map(ScenePro::getNum).collect(Collectors.toList());
+
+                List<ScenePlus> listByNums1 = scenePlusService.getListByNums(numList);
+                List<Long> ids = listByNums1.stream().map(ScenePlus::getId).collect(Collectors.toList());
+                HashMap<Long, ScenePlusExt> byPlusIds = scenePlusExtService.getByPlusIds(ids);
+                List<String> newList2 = listByNums1.stream().filter(e -> byPlusIds.get(e.getId()) != null && byPlusIds.get(e.getId()).getIsObj() == 1).map(ScenePlus::getNum).collect(Collectors.toList());
+                forList = newList;
+                forList.addAll(newList2);
+            }
+        }
+
+        for (String num : forList) {
             Integer freeCount = freeMap.get(num) == null ? 1 :freeMap.get(num);
 
             List<User> dbUserList = map.get(num);
@@ -493,17 +516,34 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         numList1.addAll(numList2);
 
 
+        if(StringUtils.isBlank(sceneType) && ( !collect1.isEmpty() || !collect2.isEmpty())){
+            List<String> newList = collect1.stream().filter(e->e.getIsObj() == 1).map(ScenePro::getNum).collect(Collectors.toList());
+            List<Long> ids = collect2.stream().map(ScenePlus::getId).collect(Collectors.toList());
+            HashMap<Long, ScenePlusExt> byPlusIds = scenePlusExtService.getByPlusIds(ids);
+            List<String> newList2 = collect2.stream().filter(e -> byPlusIds.get(e.getId()) != null && byPlusIds.get(e.getId()).getIsObj() == 1).map(ScenePlus::getNum).collect(Collectors.toList());
+            numList = new HashSet<>();
+            numList.addAll(newList2);
+            numList.addAll(newList);
+        }
+
+
         List<SceneCooperation> addList =new ArrayList<>();
-        if( !numList.isEmpty()){
-            if(StringUtils.isBlank(sceneType)){
+        if(StringUtils.isNotBlank(sceneType) ){
+            if(!numList.isEmpty() && "mesh".equals(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);
+            }
+            if(!numList1.isEmpty() && "laser".equals(sceneType)){
+                addList = this.saveBatchByList(new ArrayList<>(numList1), userIds, type,"laser");
+            }
+        }else {
+            if(!numList.isEmpty()){
+                addList = this.saveBatchByList(new ArrayList<>(numList), userIds, type,"mesh");
+            }
+            if(!numList1.isEmpty() ){
+                addList = this.saveBatchByList(new ArrayList<>(numList1), userIds, type,"laser");
             }
         }
+
         List<Long> collect3 = addList.stream().map(SceneCooperation::getUserId).collect(Collectors.toList());
         for (User user : userList) {
             if("aws".equals(NacosProperty.uploadType)){
@@ -528,7 +568,7 @@ public class SceneCooperationServiceImpl extends ServiceImpl<ISceneCooperationMa
         if(StringUtils.isNotBlank(sceneType) && "mesh".equals(sceneType)){
             return;
         }
-        String operatingMode = numList.size() > 1 ? "add" :"update";
+        String operatingMode = (StringUtils.isBlank(sceneType) || numList1.size() > 1) ? "add" :"update";
         laserService.saveBatchCooperation(new ArrayList<>(numList1),snCodeList,collect,type,operatingMode);
 
     }

+ 3 - 0
src/main/java/com/fdkankan/ucenter/service/impl/ScenePlusServiceImpl.java

@@ -130,6 +130,9 @@ public class ScenePlusServiceImpl extends ServiceImpl<IScenePlusMapper, ScenePlu
 
     @Override
     public List<ScenePlus> getListByNums(List<String> numList) {
+        if(numList.isEmpty()){
+            return new ArrayList<>();
+        }
         LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
         wrapper.in(ScenePlus::getNum,numList);
         return this.list(wrapper);

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

@@ -543,6 +543,12 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
                         List<String> userNameList = userVos.stream().map(User::getUserName).collect(Collectors.toList());
                         vo.setCooperationUserIdList(ids);
                         vo.setCooperationUserNameList(userNameList);
+                        if(!ids.isEmpty()){
+                            vo.setCooperationUserId(ids.get(0).toString());
+                        }
+                        if(!userNameList.isEmpty()){
+                            vo.setCooperationUserName(userNameList.get(0));
+                        }
                     }
                 }
             }

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

@@ -131,7 +131,7 @@
         </if>
         <if test="param.userName !=null and param.userName !=''">
             and u.user_name like CONCAT('%',#{param.userName},'%')
-            and coo.rec_status = 'A'
+            and coo.rec_status = 'A' and coo.scene_type = 'mesh'
         </if>
         <if test="param.startTime !=null and param.startTime !=''">
             and p.create_time &gt;= #{param.startTime}