lyhzzz пре 2 година
родитељ
комит
54781a5745

+ 2 - 1
src/main/java/com/fdkankan/manage_jp/config/WebAppConfig.java

@@ -19,7 +19,8 @@ public class WebAppConfig implements WebMvcConfigurer {
 
 
 		registry.addInterceptor(ucenterInterceptor).addPathPatterns("/**")
 		registry.addInterceptor(ucenterInterceptor).addPathPatterns("/**")
 				.excludePathPatterns(
 				.excludePathPatterns(
-						"/**/manage_jp/user/login/**"
+						"/**/manage_jp/user/login/**",
+						"/**/test/**"
 				);
 				);
 
 
 		WebMvcConfigurer.super.addInterceptors(registry);
 		WebMvcConfigurer.super.addInterceptors(registry);

+ 75 - 0
src/main/java/com/fdkankan/manage_jp/controller/TestController.java

@@ -0,0 +1,75 @@
+package com.fdkankan.manage_jp.controller;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.common.util.JwtUtil;
+import com.fdkankan.fyun.face.FYunFileServiceInterface;
+import com.fdkankan.manage_jp.common.Result;
+import com.fdkankan.manage_jp.entity.ScenePlus;
+import com.fdkankan.manage_jp.entity.ScenePlusExt;
+import com.fdkankan.manage_jp.service.IScenePlusExtService;
+import com.fdkankan.manage_jp.service.IScenePlusService;
+import com.fdkankan.manage_jp.service.IUserService;
+import com.fdkankan.manage_jp.vo.request.LoginParam;
+import com.fdkankan.manage_jp.vo.request.UserListParam;
+import com.fdkankan.manage_jp.vo.request.UserParam;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import sun.rmi.runtime.Log;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 用户信息表 前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2022-12-23
+ */
+@RestController
+@Slf4j
+@RequestMapping("/manage_jp/test")
+public class TestController extends BaseController {
+
+    @Autowired
+    private IScenePlusService scenePlusService;
+    @Autowired
+    private IScenePlusExtService scenePlusExtService;
+    @Autowired
+    private FYunFileServiceInterface fYunFileServiceInterface;
+
+    @GetMapping("/updateUserId")
+    public Result updateUserId(){
+        LambdaQueryWrapper<ScenePlus> wrapper = new LambdaQueryWrapper<>();
+        wrapper.isNull(ScenePlus::getUserId);
+        List<ScenePlus> list = scenePlusService.list(wrapper);
+        for (ScenePlus scenePlus : list) {
+            ScenePlusExt plusExt = scenePlusExtService.getByPlusId(scenePlus.getId());
+            if(plusExt !=null){
+                String fdage =  plusExt.getDataSource().replace("/mnt/data","home") +"/data.fdage";
+                String fileContent = fYunFileServiceInterface.getFileContent(fdage);
+                if(StringUtils.isNotBlank(fileContent)){
+                    JSONObject jsonObject = JSONObject.parseObject(fileContent);
+                    String account = jsonObject.getString("account");
+                    if(StringUtils.isNotBlank(account)){
+                        Integer userId = Integer.parseInt(account);
+                        log.info("更新userId---num:{},account:{}",scenePlus.getNum(),userId);
+                        LambdaUpdateWrapper<ScenePlus> updateWrapper = new LambdaUpdateWrapper<>();
+                        updateWrapper.set(ScenePlus::getUserId,userId);
+                        updateWrapper.eq(ScenePlus::getId,scenePlus.getId());
+                        scenePlusService.update(updateWrapper);
+                    }
+
+                }
+            }
+        }
+        return Result.success();
+    }
+
+}
+

+ 2 - 0
src/main/java/com/fdkankan/manage_jp/service/IScenePlusExtService.java

@@ -14,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface IScenePlusExtService extends IService<ScenePlusExt> {
 public interface IScenePlusExtService extends IService<ScenePlusExt> {
 
 
     void delByPlus(Long plusId);
     void delByPlus(Long plusId);
+
+    ScenePlusExt getByPlusId(Long id);
 }
 }

+ 3 - 0
src/main/java/com/fdkankan/manage_jp/service/impl/CompanyServiceImpl.java

@@ -326,6 +326,9 @@ public class CompanyServiceImpl extends ServiceImpl<ICompanyMapper, Company> imp
     @Override
     @Override
     public Company getByCameraId(Integer cameraId) {
     public Company getByCameraId(Integer cameraId) {
         CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
         CameraDetail cameraDetail = cameraDetailService.getByCameraId(cameraId);
+        if(cameraDetail == null || cameraDetail.getCameraId() == null){
+            return null;
+        }
         return this.getById(cameraDetail.getCompanyId());
         return this.getById(cameraDetail.getCompanyId());
     }
     }
 }
 }

+ 7 - 0
src/main/java/com/fdkankan/manage_jp/service/impl/ScenePlusExtServiceImpl.java

@@ -24,4 +24,11 @@ public class ScenePlusExtServiceImpl extends ServiceImpl<IScenePlusExtMapper, Sc
         wrapper.eq(ScenePlusExt::getPlusId,plusId);
         wrapper.eq(ScenePlusExt::getPlusId,plusId);
         this.remove(wrapper);
         this.remove(wrapper);
     }
     }
+
+    @Override
+    public ScenePlusExt getByPlusId(Long id) {
+        LambdaQueryWrapper<ScenePlusExt> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(ScenePlusExt::getPlusId,id);
+        return getOne(wrapper);
+    }
 }
 }