Prechádzať zdrojové kódy

添加接口:判断密钥文件上传是更新还是初始化

wangpenghui 10 mesiacov pred
rodič
commit
9b6ccf9c18

+ 6 - 0
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/controller/VppKeyFileController.java

@@ -27,4 +27,10 @@ public class VppKeyFileController {
         return new ResultMap<>(CommonConstant.SUCCESS, CommonConstant.RESULT_SUCCESS);
     }
 
+    @PostMapping("/updateOrInit")
+    public ResultMap<Boolean> updateOrInit() {
+        return new ResultMap<>(CommonConstant.SUCCESS, CommonConstant.RESULT_SUCCESS,vppKeyFileService.updateOrInit());
+    }
+
+
 }

+ 8 - 6
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/VppCompanyService.java

@@ -1,13 +1,7 @@
 package cn.kdan.pdf.tech.core.service;
 
 import cn.kdan.pdf.tech.core.model.VppCompany;
-import cn.kdan.pdf.tech.core.model.VppTeam;
-import cn.kdan.pdf.tech.core.pojo.dto.CreateTeamDTO;
-import cn.kdan.pdf.tech.core.pojo.dto.EditTeamDTO;
-import cn.kdan.pdf.tech.core.pojo.vo.VppTeamListVO;
 import cn.kdan.pdf.tech.core.pojo.vo.VppTeamMenberVO;
-import cn.kdan.pdf.tech.core.pojo.vo.VppTeamVO;
-import com.github.pagehelper.PageInfo;
 
 import java.util.List;
 
@@ -31,4 +25,12 @@ public interface VppCompanyService {
     List<VppTeamMenberVO> getComponyMenber();
 
     void insert(VppCompany vppCompany);
+
+    /**
+     * 获取总数
+     *
+     * @return 总行数
+     */
+    long count();
+
 }

+ 7 - 0
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/VppKeyFileService.java

@@ -14,4 +14,11 @@ public interface VppKeyFileService {
      * @param updateOrInit 是否更新或初始化 更新:true, 初始化:false
      */
     void parseKeyFile(MultipartFile keyFile, boolean updateOrInit);
+
+    /**
+     * 判断是更新还是初始化
+     *
+     * @return Boolean
+     */
+    Boolean updateOrInit();
 }

+ 5 - 2
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/impl/VppCompanyServiceImpl.java

@@ -3,11 +3,9 @@ package cn.kdan.pdf.tech.core.service.impl;
 import cn.kdan.pdf.tech.core.mapper.VppCompanyMapper;
 import cn.kdan.pdf.tech.core.model.VppCompany;
 import cn.kdan.pdf.tech.core.model.VppMember;
-import cn.kdan.pdf.tech.core.pojo.dto.SetGeneralDTO;
 import cn.kdan.pdf.tech.core.pojo.vo.VppTeamMenberVO;
 import cn.kdan.pdf.tech.core.service.VppCompanyService;
 import cn.kdan.pdf.tech.core.service.VppMemberService;
-import cn.kdan.pdf.tech.core.service.VppSetService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.compress.utils.Lists;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -73,4 +71,9 @@ public class VppCompanyServiceImpl implements VppCompanyService {
     public void insert(VppCompany vppCompany) {
         vppCompanyMapper.insert(vppCompany);
     }
+
+    @Override
+    public long count() {
+        return vppCompanyMapper.countByExample(null);
+    }
 }

+ 5 - 0
pdf-tech-core/src/main/java/cn/kdan/pdf/tech/core/service/impl/VppKeyFileServiceImpl.java

@@ -61,4 +61,9 @@ public class VppKeyFileServiceImpl implements VppKeyFileService {
         }
     }
 
+    @Override
+    public Boolean updateOrInit() {
+        return vppCompanyService.count() > 0;
+    }
+
 }

+ 1 - 1
pdf-tech-core/src/main/resources/application.yml

@@ -90,6 +90,6 @@ cors:
   allow-origins: "*"
   allow-max-age: "3600"
 httpMatchers:
-  request: "/login,/logout,/vppMember/resetPassword,/oauth/**,/auth/**,/vppMember/create,/vppTeam/confirmTeamMember,/static/images/**,/vppDevice/activation,/vppDevice/verify,/vppKeyFile/parseKeyFile"
+  request: "/login,/logout,/vppMember/resetPassword,/oauth/**,/auth/**,/vppMember/create,/vppTeam/confirmTeamMember,/static/images/**,/vppDevice/activation,/vppDevice/verify,/vppKeyFile/parseKeyFile,/vppKeyFile/updateOrInit"
   web: "/hystrix.stream,/webjars/**,/resources/**,/swagger-ui.html,/swagger-resources/**,/v2/api-docs,/static/images/**"