Browse Source

Merge branch 'task-lyh-sg'

# Conflicts:
#	src/main/java/com/fdkankan/ucenter/controller/app/AppCameraController.java
#	src/main/resources/mapper/ucenter/CameraMapper.xml
lyhzzz 1 năm trước cách đây
mục cha
commit
489e929678

+ 1 - 1
src/main/java/com/fdkankan/ucenter/controller/CameraController.java

@@ -150,7 +150,7 @@ public class CameraController extends BaseController {
         User user = userService.getByToken(getToken());
         LambdaQueryWrapper<CameraDetail> condition = new LambdaQueryWrapper<>();
         condition.eq(CameraDetail::getCooperationUser,user.getId());
-        condition.eq(CameraDetail::getGoodsId,10);
+        condition.eq(CameraDetail::getType,10);
         List<CameraDetail> list = cameraDetailService.list(condition);
         if(CollectionUtils.isEmpty(list)){
             return Result.success();

+ 14 - 9
src/main/java/com/fdkankan/ucenter/controller/api/LaserController.java

@@ -15,10 +15,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -43,7 +40,8 @@ public class LaserController extends BaseController {
      * 根据手机号码获取 相机 sncode
      */
     @RequestMapping(value = "/getSnCodeByPhone",method = RequestMethod.GET)
-    public Result getSnCodeByUserName(@RequestParam(required = false)String phone) throws Exception {
+    public Result getSnCodeByUserName(@RequestParam(required = false)String phone,
+                                      @RequestParam(required = false)Integer sceneSource) throws Exception {
         List<Long> userIds = userService.getLikeUserName(phone);
         HashMap<String,Object> map = new HashMap<>();
         Set<String> snCodeSet = new HashSet<>();
@@ -52,10 +50,17 @@ public class LaserController extends BaseController {
         if(userIds.size() <=0){
             return Result.success(map);
         }
-
-        List<CameraAppVo> camera = cameraDetailService.getListByUserIdsAndType(userIds, 10);
-        snCodeSet = camera.stream().map(CameraAppVo::getSnCode).collect(Collectors.toSet());
-        map.put("snCodes",snCodeSet);
+        List<CameraAppVo> camera = new ArrayList<>();
+        if(sceneSource == 4){
+            camera = cameraDetailService.getListByUserIdsAndType(userIds, 10);
+        }
+        if(sceneSource == 5){
+            camera = cameraDetailService.getListByUserIdsAndType(userIds, 11);
+        }
+        if(camera.size() >0){
+            snCodeSet = camera.stream().map(CameraAppVo::getSnCode).collect(Collectors.toSet());
+            map.put("snCodes",snCodeSet);
+        }
         return Result.success(map);
     }
 

+ 3 - 0
src/main/java/com/fdkankan/ucenter/controller/app/AppCameraController.java

@@ -25,6 +25,9 @@ public class AppCameraController {
     public Result getCamerasForUser(@RequestBody JSONObject param ){
         String userName = param.get("userName") == null ? null : param.getString("userName");
         Integer cameraType = param.get("cameraType") == null ? 4 : param.getInteger("cameraType");
+        if(cameraType == 4){
+            cameraType = 1;
+        }
         return Result.success(appCameraService.getCameraForUser(userName,cameraType));
     }
 

+ 3 - 0
src/main/java/com/fdkankan/ucenter/controller/app/AppSceneController.java

@@ -25,6 +25,9 @@ public class AppSceneController extends BaseController {
      */
     @PostMapping("/getAppAllSceneByPage")
     public Result getAppAllSceneByPage(@RequestBody AppSceneParam param){
+        if(param.getCameraType() == 4){
+            param.setCameraType(1);
+        }
         return Result.success( appSceneService.pageList(param));
     }
 

+ 3 - 0
src/main/java/com/fdkankan/ucenter/controller/app/AppUserController.java

@@ -28,6 +28,9 @@ public class AppUserController {
     public Result getUserInfo(@RequestBody JSONObject param){
         String phoneNum = param.get("phoneNum") == null ? null : param.getString("phoneNum");
         Integer cameraType = param.get("cameraType") == null ? 4 : param.getInteger("cameraType");
+        if(cameraType == 4){
+            cameraType = 1;
+        }
         return Result.success( appUserService.getUserInfo(phoneNum,cameraType));
     }
 

+ 1 - 1
src/main/java/com/fdkankan/ucenter/httpClient/client/LaserClient.java

@@ -19,7 +19,7 @@ public interface LaserClient {
      * 根据用户获取激光相机数量
      */
     @Post("/laser/4dage/getSceneNum")
-    Result getSceneNum(@Header("fdToken") String token);
+    Result getSceneNum(@Header("fdToken") String token,@JSONBody Map<String, Object> param);
     /**
      * 获取相机场景数
      * @param param

+ 4 - 2
src/main/java/com/fdkankan/ucenter/httpClient/service/LaserService.java

@@ -54,10 +54,12 @@ public class LaserService {
      * 根据用户获取激光相机数量
      * @param token
      */
-    public SceneNumVo getLaserSceneNumByUser(String token) {
+    public SceneNumVo getLaserSceneNumByUser(String token,Integer sceneSource) {
         SceneNumVo sceneNumVo = new SceneNumVo();
         try {
-            Result sceneNum = laserClient.getSceneNum(token);
+            HashMap<String,Object> param = new HashMap<>();
+            param.put("sceneSource",sceneSource);
+            Result sceneNum = laserClient.getSceneNum(token,param);
             if(sceneNum != null && sceneNum.getCode() == 200){
                 sceneNumVo = JSONObject.parseObject(JSONObject.toJSONString(sceneNum.getData()), SceneNumVo.class);
                 sceneNumVo.setTotalNum(sceneNumVo.getSceneNum() + sceneNumVo.getCooperationSceneNum());

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

@@ -316,7 +316,7 @@ public class AppSceneService {
         }
         sceneProService.deleteByList(proList,plusList,userId);
 
-        if(sceneSource != null && sceneSource == 4){
+        if(sceneSource != null && (sceneSource == 4 || sceneSource == 5)){
             laserService.delete(sceneNum);
         }
     }

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

@@ -81,7 +81,7 @@ public class CameraDetailServiceImpl extends ServiceImpl<ICameraDetailMapper, Ca
         LambdaQueryWrapper<CameraDetail> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CameraDetail::getUserId,userId);
         if(type != null){
-            wrapper.eq(CameraDetail::getGoodsId,type);
+            wrapper.eq(CameraDetail::getType,type);
         }
         return this.count(wrapper);
     }

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

@@ -63,7 +63,7 @@ public class DownService implements IDownService {
         isObj = isObj == null ?0 :isObj;
 
         log.info("checkDownLoad--sceneType:{},isObj:{}",sceneType,isObj);
-        if(sceneType == 4 && isObj !=1){ //深时场景
+        if((sceneType == 4 || sceneType == 5) && isObj !=1){ //深时场景
             return SSCheckDownload(sceneNum);
         }
         SceneDownloadLog sceneDownloadLog;
@@ -134,7 +134,7 @@ public class DownService implements IDownService {
         isObj = isObj == null ?0 :isObj;
 
         log.info("down--sceneType:{},isObj:{}",sceneType,isObj);
-        if(sceneType == 4 && isObj !=1){ //深时场景
+        if((sceneType == 4|| sceneType == 5) && isObj !=1){ //深时场景
             return SSDownload(sceneNum,userName);
         }
         DownVo downVo = new DownVo();
@@ -145,7 +145,7 @@ public class DownService implements IDownService {
         }
         Integer downLoadTotal = 0;
         Integer downLoadNum = 0;
-        if(sceneType == 4){
+        if(sceneType == 4 || sceneType == 5){
             downLoadTotal = user.getSsDownloadNumTotal();
             downLoadNum = user.getSsDownloadNum();
 
@@ -177,7 +177,7 @@ public class DownService implements IDownService {
         redisUtil.lRightPush(downloadTaskKey, JSONObject.toJSONString(params));
 
         //修改用户的下载次数
-        if(sceneType == 4){
+        if(sceneType == 4|| sceneType == 5){
             user.setSsDownloadNum(user.getSsDownloadNum() + 1);
         }else {
             user.setDownloadNum(user.getDownloadNum() + 1);
@@ -210,7 +210,7 @@ public class DownService implements IDownService {
         isObj = isObj == null ?0 :isObj;
 
         log.info("downloadProcess--sceneType:{},isObj:{}",sceneType,isObj);
-        if(sceneType == 4 && isObj !=1){ //深时场景
+        if((sceneType == 4 || sceneType == 5 )&& isObj !=1){ //深时场景
             return SSDownloadProcess(sceneNum);
         }
         String redisKey = RedisKey.PREFIX_DOWNLOAD_PROGRESS;

+ 12 - 7
src/main/java/com/fdkankan/ucenter/service/impl/SceneProServiceImpl.java

@@ -142,14 +142,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         sceneNumVoKk.setTotalNum(oldNum + sceneNumVoKk.getTotalNum());
 
         SceneNumVo sceneNumVoKj = getSceneNumVoByType(Collections.singletonList(3), user.getId());
-        SceneNumVo sceneNumVoSS = fdkkLaserService.getLaserSceneNumByUser(token);
 
+        SceneNumVo sceneNumVoSS = fdkkLaserService.getLaserSceneNumByUser(token,4);
         SceneNumVo sceneNumVoSSObj = getSceneNumVoByObjType(Arrays.asList(4), user.getId());
+
+        SceneNumVo sceneNumVoSG = fdkkLaserService.getLaserSceneNumByUser(token,5);
+        SceneNumVo sceneNumVoSGObj = getSceneNumVoByObjType(Arrays.asList(5), user.getId());
         HashMap<String, SceneNumVo> hashMap = new HashMap<>();
         hashMap.put("kk",sceneNumVoKk);
         hashMap.put("kJ",sceneNumVoKj);
         hashMap.put("SS",sceneNumVoSS);
         hashMap.put("SS_OBJ",sceneNumVoSSObj);
+        hashMap.put("SG",sceneNumVoSG);
+        hashMap.put("SG_OBJ",sceneNumVoSGObj);
         return hashMap;
     }
 
@@ -567,7 +572,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             totalSceneNum = folderSceneService.getCountByFolderAndSon(param.getFolderId());
         }else if(param.getIsObj() != null && param.getIsObj() ==1){
             if(param.getUserId()!= null){
-                totalSceneNum = this.getCountByLaserAndIsObj(param.getUserId());
+                totalSceneNum = this.getCountByLaserAndIsObj(param.getUserId(),Integer.valueOf(param.getSceneSource()));
             }
         }
         JSONObject jsonObject = new JSONObject();
@@ -576,19 +581,19 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
         return jsonObject;
     }
 
-    private Long getCountByLaserAndIsObj(Long userId) {
+    private Long getCountByLaserAndIsObj(Long userId,Integer sceneSource) {
         Long proCount = 0L;
         Long plusCount = 0L;
         LambdaQueryWrapper<ScenePro> proWr = new LambdaQueryWrapper<>();
         proWr.eq(ScenePro::getUserId,userId);
-        proWr.eq(ScenePro::getSceneSource,4);
+        proWr.eq(ScenePro::getSceneSource,sceneSource);
         proWr.eq(ScenePro::getIsObj,1);
         proWr.eq(ScenePro::getIsUpgrade,0);
         proCount = this.count(proWr);
 
         LambdaQueryWrapper<ScenePlus> plusWr = new LambdaQueryWrapper<>();
         plusWr.eq(ScenePlus::getUserId,userId);
-        plusWr.eq(ScenePlus::getSceneSource,4);
+        plusWr.eq(ScenePlus::getSceneSource,sceneSource);
         List<ScenePlus> list = scenePlusService.list(plusWr);
         if(list.size() >0){
             List<Long> plusIds = list.stream().map(ScenePlus::getId).collect(Collectors.toList());
@@ -1094,7 +1099,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             return;
         }
 
-        if(sceneProEntity.getSceneSource() != 4){
+        if(sceneProEntity.getSceneSource() != 4 && sceneProEntity.getSceneSource() != 5){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3003, "只能操作激光场景");
         }
 
@@ -1145,7 +1150,7 @@ public class SceneProServiceImpl extends ServiceImpl<ISceneProMapper, ScenePro>
             throw new BusinessException(SceneConstant.FAILURE_CODE_5005, SceneConstant.FAILURE_MSG_5005);
         }
 
-        if(scenePlus.getSceneSource() != 4){
+        if(scenePlus.getSceneSource() != 4 && scenePlus.getSceneSource() !=5){
             throw new BusinessException(LoginConstant.FAILURE_CODE_3003, "只能操作激光场景");
         }
 

+ 2 - 4
src/main/resources/mapper/ucenter/CameraDetailMapper.xml

@@ -5,22 +5,20 @@
     <select id="getListByUserAndType" resultType="com.fdkankan.ucenter.vo.response.CameraAppVo">
      SELECT *,c.id as cameraId FROM t_camera_detail d
         LEFT JOIN t_camera c on d.camera_id = c.id
-        LEFT JOIN t_goods g on d.goods_id = g.id
         WHERE d.rec_status = 'A'
         and d.user_id = #{userId}
-        and d.goods_id = #{cameraType}
+        and d.type = #{cameraType}
     </select>
 
     <select id="getListByUserIdsAndType" resultType="com.fdkankan.ucenter.vo.response.CameraAppVo">
         SELECT *,c.id as cameraId FROM t_camera_detail d
             LEFT JOIN t_camera c on d.camera_id = c.id
-              LEFT JOIN t_goods g on d.goods_id = g.id
         WHERE d.rec_status = 'A'
           and d.user_id in
         <foreach item="userId" collection="userIds" open="(" separator="," close=")">
             #{userId}
         </foreach>
-          and d.goods_id = #{cameraType}
+          and d.type = #{cameraType}
     </select>
 
     <select id="getListByUserAndTypeEx" resultType="com.fdkankan.ucenter.vo.response.CameraExcelVo">

+ 1 - 3
src/main/resources/mapper/ucenter/CameraMapper.xml

@@ -4,11 +4,10 @@
 
     <select id="pageList" resultType="com.fdkankan.ucenter.vo.response.CameraVo">
         select c.id,c.sn_code,c.child_name ,d.balance,d.type , d.total_space,d.used_space,
-        u.id as cooperationUser,u.user_name as cooperationUserName,g.pic,d.goods_id,d.unit
+        u.id as cooperationUser,u.user_name as cooperationUserName,d.unit
         from t_camera c
         left join t_camera_detail d on c.id = d.camera_id
         left join t_user u on d.cooperation_user = u.id
-        left join t_goods g on d.goods_id = g.id
         WHERE c.rec_status = 'A'
         <if test="param.selecttype !=null and param.selecttype == 2 and param.childName !=null and param.childName!='' ">
             and c.child_name like CONCAT('%',#{param.childName},'%')
@@ -30,7 +29,6 @@
     <select id="getCameraInfo" resultType="com.fdkankan.ucenter.vo.response.CameraAppVo">
          select * from  t_camera c
         left join t_camera_detail d on c.id = d.camera_id
-        left join t_goods g on d.goods_id = g.id
         left join t_user u on d.user_id = u.id
         where c.rec_status = 'A'
         and c.child_name = #{childName}

+ 2 - 2
src/main/resources/mapper/ucenter/ScenePlusMapper.xml

@@ -58,7 +58,7 @@
             and  p.scene_type  = #{param.sceneType}
         </if>
         <if test= 'param.cameraType != null' >
-            and tcd.goods_id = #{param.cameraType}
+            and tcd.type = #{param.cameraType}
         </if>
         <if test="param.copyNumSet !=null and param.copyNumSet.size >0">
             and  p.num not in
@@ -72,7 +72,7 @@
     <select id="getCountByUserId" resultType="java.lang.Long">
         select count(*) from t_scene_plus s left join t_camera_detail d on s.camera_id = d.camera_id
         where s.rec_status = 'A'
-          and s.user_id = #{userId} and d.goods_id = #{cameraType}
+          and s.user_id = #{userId} and d.type = #{cameraType}
     </select>
 
 

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

@@ -60,7 +60,7 @@
     <select id="getCountByUserId" resultType="java.lang.Long">
            select count(*) from t_scene_pro s left join t_camera_detail d on s.camera_id = d.camera_id
         where s.rec_status = 'A' and s.is_upgrade = 0
-        and s.user_id = #{userId} and d.goods_id = #{cameraType}
+        and s.user_id = #{userId} and d.type = #{cameraType}
     </select>
 
     <sql id="HasFolder">