Selaa lähdekoodia

1.fix channel 将endpoin改为channel
2.add api 添加beetl生成响应数据。

bianlz 1 viikko sitten
vanhempi
commit
dbe5e6fea3
32 muutettua tiedostoa jossa 489 lisäystä ja 675 poistoa
  1. 60 0
      op-admin-server-adapter/src/main/java/com/hrsk/cloud/op/adapter/controller/egress/EgressApiChannelController.java
  2. 0 60
      op-admin-server-adapter/src/main/java/com/hrsk/cloud/op/adapter/controller/egress/EgressApiEndpointController.java
  3. 43 0
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/EgressApiChannelServiceImpl.java
  4. 0 43
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/EgressApiEndpointServiceImpl.java
  5. 44 0
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiChannelCrtExe.java
  6. 34 0
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiChannelQryExe.java
  7. 0 44
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiEndpointCrtExe.java
  8. 0 34
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiEndpointQryExe.java
  9. 16 16
      op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiLoanCrtExe.java
  10. 36 0
      op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/api/EgressApiChannelService.java
  11. 0 36
      op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/api/EgressApiEndpointService.java
  12. 6 2
      op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/EgressApiChannelDTO.java
  13. 2 2
      op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiChannelQry.java
  14. 4 5
      op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiChannelUpsertCmd.java
  15. 2 2
      op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiLoanCrtCmd.java
  16. 1 1
      op-admin-server-domain/src/main/java/com/hrsk/cloud/op/domain/common/EgressApiErrorCodeEnum.java
  17. 2 2
      op-admin-server-domain/src/main/java/com/hrsk/cloud/op/domain/egress/EgressApiChannelIntegrationModeEnum.java
  18. 5 5
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/client/EgressServiceClient.java
  19. 3 1
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/common/QrUtils.java
  20. 7 7
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/dao/EgressApiChannelDao.java
  21. 109 0
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiChannelDO.java
  22. 88 0
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiChannelHistoryDO.java
  23. 0 109
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiEndpointDO.java
  24. 0 83
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiEndpointHistoryDO.java
  25. 2 2
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/mapper/EgressApiChannelHistoryMapper.java
  26. 2 2
      op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/mapper/EgressApiChannelMapper.java
  27. 2 2
      op-admin-server-infrastructure/src/main/resources/mybatis-config.xml
  28. 9 9
      op-admin-server-infrastructure/src/main/resources/mybatis/EgressApiChannelMapper.xml
  29. 5 0
      start/pom.xml
  30. 6 3
      start/src/main/java/com/hrsk/cloud/op/Application.java
  31. 0 204
      start/src/main/java/com/hrsk/cloud/op/test/TotpUtils.java
  32. 1 1
      start/src/main/resources/application-local.yaml

+ 60 - 0
op-admin-server-adapter/src/main/java/com/hrsk/cloud/op/adapter/controller/egress/EgressApiChannelController.java

@@ -0,0 +1,60 @@
+package com.hrsk.cloud.op.adapter.controller.egress;
+
+import com.hrsk.cloud.op.client.api.EgressApiChannelService;
+import com.hrsk.cloud.op.client.dto.EgressApiChannelDTO;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelQry;
+import com.hrsk.pangu.dto.AntDMultiResponse;
+import com.hrsk.pangu.dto.AntDPageResponse;
+import com.hrsk.pangu.dto.PageResponse;
+import com.hrsk.pangu.dto.SingleResponse;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-23 11:36
+ * @description: 通道controller
+ **/
+@RestController()
+@RequestMapping("/egress/api/channel")
+public class EgressApiChannelController {
+
+    @Resource
+    private EgressApiChannelService egressApiChannelService;
+    /**
+     * 创建
+     * @param egressApiChannelUpsertCmd 创建通道
+     * @return
+     */
+    @PutMapping("/create")
+    public SingleResponse<Long> create(@RequestBody EgressApiChannelUpsertCmd egressApiChannelUpsertCmd){
+        return null;
+    }
+
+    /**
+     * 分页查询
+     * @param egressApiChannelQry
+     * @return
+     */
+    @GetMapping("/page")
+    public AntDPageResponse<EgressApiChannelDTO> page(EgressApiChannelQry egressApiChannelQry){
+        PageResponse<EgressApiChannelDTO> response = egressApiChannelService.page(egressApiChannelQry);
+        return AntDPageResponse.of(response);
+    }
+
+    /**
+     * 列表查询
+     * @param egressApiChannelQry
+     * @return
+     */
+    @GetMapping("/list")
+    public AntDMultiResponse<EgressApiChannelDTO> list(EgressApiChannelQry egressApiChannelQry){
+        return AntDMultiResponse.of(egressApiChannelService.list(egressApiChannelQry));
+    }
+}

+ 0 - 60
op-admin-server-adapter/src/main/java/com/hrsk/cloud/op/adapter/controller/egress/EgressApiEndpointController.java

@@ -1,60 +0,0 @@
-package com.hrsk.cloud.op.adapter.controller.egress;
-
-import com.hrsk.cloud.op.client.api.EgressApiEndpointService;
-import com.hrsk.cloud.op.client.dto.EgressApiEndpointDTO;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointQry;
-import com.hrsk.pangu.dto.AntDMultiResponse;
-import com.hrsk.pangu.dto.AntDPageResponse;
-import com.hrsk.pangu.dto.PageResponse;
-import com.hrsk.pangu.dto.SingleResponse;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-23 11:36
- * @description: 通道controller
- **/
-@RestController()
-@RequestMapping("/egress/api/endpoint")
-public class EgressApiEndpointController {
-
-    @Resource
-    private EgressApiEndpointService egressApiEndpointService;
-    /**
-     * 创建
-     * @param egressApiEndpointUpsertCmd 创建通道
-     * @return
-     */
-    @PutMapping("/create")
-    public SingleResponse<Long> create(@RequestBody EgressApiEndpointUpsertCmd egressApiEndpointUpsertCmd){
-        return null;
-    }
-
-    /**
-     * 分页查询
-     * @param egressApiEndpointQry
-     * @return
-     */
-    @GetMapping("/page")
-    public AntDPageResponse<EgressApiEndpointDTO> page(EgressApiEndpointQry egressApiEndpointQry){
-        PageResponse<EgressApiEndpointDTO> response = egressApiEndpointService.page(egressApiEndpointQry);
-        return AntDPageResponse.of(response);
-    }
-
-    /**
-     * 列表查询
-     * @param egressApiEndpointQry
-     * @return
-     */
-    @GetMapping("/list")
-    public AntDMultiResponse<EgressApiEndpointDTO> list(EgressApiEndpointQry egressApiEndpointQry){
-        return AntDMultiResponse.of(egressApiEndpointService.list(egressApiEndpointQry));
-    }
-}

+ 43 - 0
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/EgressApiChannelServiceImpl.java

@@ -0,0 +1,43 @@
+package com.hrsk.cloud.op.app.egress;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.hrsk.cloud.op.app.egress.executor.EgressApiChannelQryExe;
+import com.hrsk.cloud.op.client.api.EgressApiChannelService;
+import com.hrsk.cloud.op.client.dto.EgressApiDTO;
+import com.hrsk.cloud.op.client.dto.EgressApiChannelDTO;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelQry;
+import com.hrsk.pangu.dto.MultiResponse;
+import com.hrsk.pangu.dto.PageResponse;
+import com.hrsk.pangu.dto.SingleResponse;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-23 13:33
+ * @description: 接出通道服务实现
+ **/
+@Service
+public class EgressApiChannelServiceImpl implements EgressApiChannelService {
+    @Resource
+    private EgressApiChannelQryExe egressApiChannelQryExe;
+
+    @Override
+    public SingleResponse<Long> create(EgressApiChannelUpsertCmd egressApiChannelUpsertCmd) {
+        return null;
+    }
+
+    @Override
+    public PageResponse<EgressApiChannelDTO> page(EgressApiChannelQry egressApiChannelQry) {
+        Page<EgressApiDTO> page = PageHelper.startPage(egressApiChannelQry.getCurrent(), egressApiChannelQry.getPageSize());
+        return PageResponse.of(egressApiChannelQryExe.execute(egressApiChannelQry),page.getTotal(),page.getPageSize(),page.getPageNum());
+    }
+
+    @Override
+    public MultiResponse<EgressApiChannelDTO> list(EgressApiChannelQry egressApiChannelQry) {
+        return MultiResponse.of(egressApiChannelQryExe.execute(egressApiChannelQry));
+    }
+}

+ 0 - 43
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/EgressApiEndpointServiceImpl.java

@@ -1,43 +0,0 @@
-package com.hrsk.cloud.op.app.egress;
-
-import com.github.pagehelper.Page;
-import com.github.pagehelper.PageHelper;
-import com.hrsk.cloud.op.app.egress.executor.EgressApiEndpointQryExe;
-import com.hrsk.cloud.op.client.api.EgressApiEndpointService;
-import com.hrsk.cloud.op.client.dto.EgressApiDTO;
-import com.hrsk.cloud.op.client.dto.EgressApiEndpointDTO;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointQry;
-import com.hrsk.pangu.dto.MultiResponse;
-import com.hrsk.pangu.dto.PageResponse;
-import com.hrsk.pangu.dto.SingleResponse;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-23 13:33
- * @description: 接出通道服务实现
- **/
-@Service
-public class EgressApiEndpointServiceImpl implements EgressApiEndpointService {
-    @Resource
-    private EgressApiEndpointQryExe egressApiEndpointQryExe;
-
-    @Override
-    public SingleResponse<Long> create(EgressApiEndpointUpsertCmd egressApiEndpointUpsertCmd) {
-        return null;
-    }
-
-    @Override
-    public PageResponse<EgressApiEndpointDTO> page(EgressApiEndpointQry egressApiEndpointQry) {
-        Page<EgressApiDTO> page = PageHelper.startPage(egressApiEndpointQry.getCurrent(), egressApiEndpointQry.getPageSize());
-        return PageResponse.of(egressApiEndpointQryExe.execute(egressApiEndpointQry),page.getTotal(),page.getPageSize(),page.getPageNum());
-    }
-
-    @Override
-    public MultiResponse<EgressApiEndpointDTO> list(EgressApiEndpointQry egressApiEndpointQry) {
-        return MultiResponse.of(egressApiEndpointQryExe.execute(egressApiEndpointQry));
-    }
-}

+ 44 - 0
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiChannelCrtExe.java

@@ -0,0 +1,44 @@
+package com.hrsk.cloud.op.app.egress.executor;
+
+import com.hrsk.cloud.op.client.dto.Operator;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiChannelDO;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiChannelHistoryDO;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.mapper.EgressApiChannelHistoryMapper;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.mapper.EgressApiChannelMapper;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-23 13:34
+ * @description: 创建API通道EXE
+ **/
+@Component
+public class EgressApiChannelCrtExe {
+    @Resource
+    private EgressApiChannelMapper egressApiChannelMapper;
+    @Resource
+    private EgressApiChannelHistoryMapper egressApiChannelHistoryMapper;
+
+    /**
+     * 执行 备份->插入->删除
+     * @param egressApiChannelUpsertCmd CMD
+     * @param operator 执行人
+     * @return 主键
+     */
+    public Long execute(EgressApiChannelUpsertCmd egressApiChannelUpsertCmd, Operator operator){
+        int version = 1;
+        if(egressApiChannelUpsertCmd.getId()!=null){
+            EgressApiChannelDO egressApiChannel = egressApiChannelMapper.selectById(egressApiChannelUpsertCmd.getId());
+            egressApiChannelMapper.deleteById(egressApiChannelUpsertCmd.getId());
+            egressApiChannelHistoryMapper.insert(EgressApiChannelHistoryDO.from(egressApiChannel));
+            version = Integer.valueOf(egressApiChannel.getVersion())+1;
+        }
+        EgressApiChannelDO egressApiChannel = EgressApiChannelDO.from(egressApiChannelUpsertCmd,version+"",operator);
+        egressApiChannelMapper.insert(egressApiChannel);
+        return egressApiChannel.getId();
+    }
+
+}

+ 34 - 0
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiChannelQryExe.java

@@ -0,0 +1,34 @@
+package com.hrsk.cloud.op.app.egress.executor;
+
+import com.hrsk.cloud.op.client.dto.EgressApiChannelDTO;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelQry;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.dao.EgressApiChannelDao;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiChannelDO;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-21 15:29
+ * @description: 接出API通道查询执行
+ **/
+@Component
+public class EgressApiChannelQryExe {
+    @Resource
+    private EgressApiChannelDao egressApiChannelDao;
+    /**
+     * 执行
+     * @param egressApiChannelQry CMD
+     * @return 接出API列表
+     */
+    public List<EgressApiChannelDTO> execute(EgressApiChannelQry egressApiChannelQry){
+        EgressApiChannelDO query = new EgressApiChannelDO();
+        BeanUtils.copyProperties(egressApiChannelQry,query);
+        List<EgressApiChannelDO> egressApiChannelDOS = egressApiChannelDao.selectEgressApiChannel(query);
+        return egressApiChannelDOS.stream().map(egressApiChannelDO -> egressApiChannelDO.toDTO()).collect(Collectors.toList());
+    }
+}

+ 0 - 44
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiEndpointCrtExe.java

@@ -1,44 +0,0 @@
-package com.hrsk.cloud.op.app.egress.executor;
-
-import com.hrsk.cloud.op.client.dto.Operator;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiEndpointDO;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiEndpointHistoryDO;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.mapper.EgressApiEndpointHistoryMapper;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.mapper.EgressApiEndpointMapper;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-23 13:34
- * @description: 创建API通道EXE
- **/
-@Component
-public class EgressApiEndpointCrtExe {
-    @Resource
-    private EgressApiEndpointMapper egressApiEndpointMapper;
-    @Resource
-    private EgressApiEndpointHistoryMapper egressApiEndpointHistoryMapper;
-
-    /**
-     * 执行 备份->插入->删除
-     * @param egressApiEndpointUpsertCmd CMD
-     * @param operator 执行人
-     * @return 主键
-     */
-    public Long execute(EgressApiEndpointUpsertCmd egressApiEndpointUpsertCmd, Operator operator){
-        int version = 1;
-        if(egressApiEndpointUpsertCmd.getId()!=null){
-            EgressApiEndpointDO egressApiEndpoint = egressApiEndpointMapper.selectById(egressApiEndpointUpsertCmd.getId());
-            egressApiEndpointMapper.deleteById(egressApiEndpointUpsertCmd.getId());
-            egressApiEndpointHistoryMapper.insert(EgressApiEndpointHistoryDO.from(egressApiEndpoint));
-            version = Integer.valueOf(egressApiEndpoint.getVersion())+1;
-        }
-        EgressApiEndpointDO egressApiEndpoint = EgressApiEndpointDO.from(egressApiEndpointUpsertCmd,version+"",operator);
-        egressApiEndpointMapper.insert(egressApiEndpoint);
-        return egressApiEndpoint.getId();
-    }
-
-}

+ 0 - 34
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiEndpointQryExe.java

@@ -1,34 +0,0 @@
-package com.hrsk.cloud.op.app.egress.executor;
-
-import com.hrsk.cloud.op.client.dto.EgressApiEndpointDTO;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointQry;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.dao.EgressApiEndpointDao;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiEndpointDO;
-import org.springframework.beans.BeanUtils;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-21 15:29
- * @description: 接出API通道查询执行
- **/
-@Component
-public class EgressApiEndpointQryExe {
-    @Resource
-    private EgressApiEndpointDao egressApiEndpointDao;
-    /**
-     * 执行
-     * @param egressApiEndpointQry CMD
-     * @return 接出API列表
-     */
-    public List<EgressApiEndpointDTO> execute(EgressApiEndpointQry egressApiEndpointQry){
-        EgressApiEndpointDO query = new EgressApiEndpointDO();
-        BeanUtils.copyProperties(egressApiEndpointQry,query);
-        List<EgressApiEndpointDO> egressApiEndpointDOS = egressApiEndpointDao.selectEgressApiEndpoint(query);
-        return egressApiEndpointDOS.stream().map(egressApiEndpointDO -> egressApiEndpointDO.toDTO()).collect(Collectors.toList());
-    }
-}

+ 16 - 16
op-admin-server-app/src/main/java/com/hrsk/cloud/op/app/egress/executor/EgressApiLoanCrtExe.java

@@ -1,7 +1,7 @@
 package com.hrsk.cloud.op.app.egress.executor;
 
 import com.hrsk.cloud.op.client.dto.Operator;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
 import com.hrsk.cloud.op.client.dto.command.EgressApiLoanCrtCmd;
 import com.hrsk.cloud.op.domain.common.EgressApiErrorCodeEnum;
 import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiDO;
@@ -23,10 +23,10 @@ import javax.annotation.Resource;
 @Slf4j
 @Component
 public class EgressApiLoanCrtExe {
-    private static final String LOAN_ENDPOINT_NAME_CHECK_FORMAT = "%s-撞库";
-    private static final String LOAN_ENDPOINT_NAME_APPLY_FORMAT = "%s-注册";
+    private static final String LOAN_CHANNEL_NAME_CHECK_FORMAT = "%s-撞库";
+    private static final String LOAN_CHANNEL_NAME_APPLY_FORMAT = "%s-注册";
     @Resource
-    private EgressApiEndpointCrtExe egressApiEndpointCrtExe;
+    private EgressApiChannelCrtExe egressApiChannelCrtExe;
     @Resource
     private EgressApiMapper egressApiMapper;
     @Resource
@@ -45,33 +45,33 @@ public class EgressApiLoanCrtExe {
         }
         transactionTemplate.execute(status -> {
             try {
-                createApiEndpoints(egressApiDO.getApiName(),egressApiLoanCrtCmd,operator);
+                createApiChannels(egressApiDO.getApiName(),egressApiLoanCrtCmd,operator);
                 createEgressApiLoan(egressApiLoanCrtCmd,operator);
             }catch (Exception ex){
                 log.error("创建失败!",ex);
                 status.setRollbackOnly();
-                throw new BizException(EgressApiErrorCodeEnum.API_ENDPOINT_CRT_FAIL.getCode(),EgressApiErrorCodeEnum.API_ENDPOINT_CRT_FAIL.getMessage(),ex);
+                throw new BizException(EgressApiErrorCodeEnum.API_CHANNEL_CRT_FAIL.getCode(),EgressApiErrorCodeEnum.API_CHANNEL_CRT_FAIL.getMessage(),ex);
             }
             return null;
         });
     }
 
     /**
-     * 创建ENDPOINT
+     * 创建CHANNEL
      * @param egressApiLoanCrtCmd cmd
      * @param operator 操作人
      */
-    private void createApiEndpoints(String apiName,EgressApiLoanCrtCmd egressApiLoanCrtCmd, Operator operator){
+    private void createApiChannels(String apiName,EgressApiLoanCrtCmd egressApiLoanCrtCmd, Operator operator){
         //checkinto
-        EgressApiEndpointUpsertCmd checkinto = egressApiLoanCrtCmd.getCheckinto();
-        checkinto.setEndpointCode("checkinto");
-        checkinto.setEndpointName(String.format(LOAN_ENDPOINT_NAME_CHECK_FORMAT,apiName));
-        egressApiEndpointCrtExe.execute(checkinto,operator);
+        EgressApiChannelUpsertCmd checkinto = egressApiLoanCrtCmd.getCheckinto();
+        checkinto.setChannelCode("checkinto");
+        checkinto.setChannelName(String.format(LOAN_CHANNEL_NAME_CHECK_FORMAT,apiName));
+        egressApiChannelCrtExe.execute(checkinto,operator);
         //apply
-        EgressApiEndpointUpsertCmd apply = egressApiLoanCrtCmd.getApply();
-        apply.setEndpointName(String.format(LOAN_ENDPOINT_NAME_APPLY_FORMAT,apiName));
-        apply.setEndpointCode("apply");
-        egressApiEndpointCrtExe.execute(apply,operator);
+        EgressApiChannelUpsertCmd apply = egressApiLoanCrtCmd.getApply();
+        apply.setChannelName(String.format(LOAN_CHANNEL_NAME_APPLY_FORMAT,apiName));
+        apply.setChannelCode("apply");
+        egressApiChannelCrtExe.execute(apply,operator);
     }
 
     /**

+ 36 - 0
op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/api/EgressApiChannelService.java

@@ -0,0 +1,36 @@
+package com.hrsk.cloud.op.client.api;
+
+import com.hrsk.cloud.op.client.dto.EgressApiChannelDTO;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelQry;
+import com.hrsk.pangu.dto.MultiResponse;
+import com.hrsk.pangu.dto.PageResponse;
+import com.hrsk.pangu.dto.SingleResponse;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-23 13:33
+ * @description: 接出API通道服务
+ **/
+public interface EgressApiChannelService {
+    /**
+     * 创建
+     * @param egressApiChannelUpsertCmd CMD
+     * @return ID
+     */
+    SingleResponse<Long> create(EgressApiChannelUpsertCmd egressApiChannelUpsertCmd);
+
+    /**
+     * 分页查询
+     * @param egressApiChannelQry 查询条件
+     * @return 分页数据
+     */
+    PageResponse<EgressApiChannelDTO> page(EgressApiChannelQry egressApiChannelQry);
+
+    /**
+     * 列表查询
+     * @param egressApiChannelQry 查询条件
+     * @return 列表数据
+     */
+    MultiResponse<EgressApiChannelDTO> list(EgressApiChannelQry egressApiChannelQry);
+}

+ 0 - 36
op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/api/EgressApiEndpointService.java

@@ -1,36 +0,0 @@
-package com.hrsk.cloud.op.client.api;
-
-import com.hrsk.cloud.op.client.dto.EgressApiEndpointDTO;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointQry;
-import com.hrsk.pangu.dto.MultiResponse;
-import com.hrsk.pangu.dto.PageResponse;
-import com.hrsk.pangu.dto.SingleResponse;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-23 13:33
- * @description: 接出API通道服务
- **/
-public interface EgressApiEndpointService {
-    /**
-     * 创建
-     * @param egressApiEndpointUpsertCmd CMD
-     * @return ID
-     */
-    SingleResponse<Long> create(EgressApiEndpointUpsertCmd egressApiEndpointUpsertCmd);
-
-    /**
-     * 分页查询
-     * @param egressApiEndpointQry 查询条件
-     * @return 分页数据
-     */
-    PageResponse<EgressApiEndpointDTO> page(EgressApiEndpointQry egressApiEndpointQry);
-
-    /**
-     * 列表查询
-     * @param egressApiEndpointQry 查询条件
-     * @return 列表数据
-     */
-    MultiResponse<EgressApiEndpointDTO> list(EgressApiEndpointQry egressApiEndpointQry);
-}

+ 6 - 2
op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/EgressApiEndpointDTO.java → op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/EgressApiChannelDTO.java

@@ -10,7 +10,7 @@ import java.util.Date;
  * @description: 接出API通道数据传输类
  **/
 @Data
-public class EgressApiEndpointDTO {
+public class EgressApiChannelDTO {
     /**
      * 主键
      */
@@ -30,7 +30,11 @@ public class EgressApiEndpointDTO {
     /**
      * 通道名称
      */
-    private String endpointName;
+    private String channelName;
+    /**
+     * 通道名称
+     */
+    private String channelCode;
     /**
      * 集成方式
      */

+ 2 - 2
op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiEndpointQry.java → op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiChannelQry.java

@@ -9,7 +9,7 @@ import lombok.Data;
  * @description: 接出API通道查询
  **/
 @Data
-public class EgressApiEndpointQry extends AntDQuery {
+public class EgressApiChannelQry extends AntDQuery {
     /**
      * APIID
      */
@@ -21,5 +21,5 @@ public class EgressApiEndpointQry extends AntDQuery {
     /**
      * 通道编码
      */
-    private String endpointCode;
+    private String channelCode;
 }

+ 4 - 5
op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiEndpointUpsertCmd.java → op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiChannelUpsertCmd.java

@@ -5,10 +5,10 @@ import lombok.Data;
 /**
  * @author: bianlanzhou
  * @create: 2024-10-23 11:38
- * @description: api endpoint 创建CMD
+ * @description: api channel 创建CMD
  **/
 @Data
-public class EgressApiEndpointUpsertCmd {
+public class EgressApiChannelUpsertCmd {
     /**
      * 主键
      */
@@ -20,11 +20,11 @@ public class EgressApiEndpointUpsertCmd {
     /**
      * 通道名称
      */
-    private String endpointName;
+    private String channelName;
     /**
      * 通道编码
      */
-    private String endpointCode;
+    private String channelCode;
     /**
      * 集成方式
      */
@@ -37,5 +37,4 @@ public class EgressApiEndpointUpsertCmd {
      * http响应配置
      */
     private String responseConfig;
-
 }

+ 2 - 2
op-admin-server-client/src/main/java/com/hrsk/cloud/op/client/dto/command/EgressApiLoanCrtCmd.java

@@ -26,10 +26,10 @@ public class EgressApiLoanCrtCmd {
     /**
      * 撞库通道
      */
-    private EgressApiEndpointUpsertCmd checkinto;
+    private EgressApiChannelUpsertCmd checkinto;
     /**
      * 申请通道
      */
-    private EgressApiEndpointUpsertCmd apply;
+    private EgressApiChannelUpsertCmd apply;
 
 }

+ 1 - 1
op-admin-server-domain/src/main/java/com/hrsk/cloud/op/domain/common/EgressApiErrorCodeEnum.java

@@ -7,7 +7,7 @@ package com.hrsk.cloud.op.domain.common;
  **/
 public enum EgressApiErrorCodeEnum {
     API_NOT_EXIST("100006","api不存在!"),
-    API_ENDPOINT_CRT_FAIL("100005","api通道创建失败!"),
+    API_CHANNEL_CRT_FAIL("100005","api通道创建失败!"),
     API_STATUS_CAN_NOT_DELETE("100004","当前状态API无法删除!"),
     API_CODE_IS_DUPLICATE("100003","api编码已存在!"),
     API_NAME_IS_DUPLICATE("100002","api名称已存在!"),

+ 2 - 2
op-admin-server-domain/src/main/java/com/hrsk/cloud/op/domain/egress/EgressApiEndpointIntegrationModeEnum.java → op-admin-server-domain/src/main/java/com/hrsk/cloud/op/domain/egress/EgressApiChannelIntegrationModeEnum.java

@@ -8,7 +8,7 @@ import lombok.Getter;
  * @description: 通道接出方式
  **/
 @Getter
-public enum EgressApiEndpointIntegrationModeEnum {
+public enum EgressApiChannelIntegrationModeEnum {
     CUSTOMIZE("customize","自定义代码模式"),
     GUIDE("guide","向导模式");
     /**
@@ -25,7 +25,7 @@ public enum EgressApiEndpointIntegrationModeEnum {
      * @param code
      * @param desc
      */
-    EgressApiEndpointIntegrationModeEnum(String code, String desc) {
+    EgressApiChannelIntegrationModeEnum(String code, String desc) {
         this.code = code;
         this.desc = desc;
     }

+ 5 - 5
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/client/EgressServiceClient.java

@@ -1,7 +1,7 @@
 package com.hrsk.cloud.op.infrastructure.client;
 
 import com.alibaba.fastjson2.JSON;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
 import lombok.extern.slf4j.Slf4j;
 import okhttp3.MediaType;
 import okhttp3.OkHttpClient;
@@ -31,11 +31,11 @@ public class EgressServiceClient {
 
     /**
      * 批量创建API通道
-     * @param egressApiEndpointUpsertCmds cmds
+     * @param egressApiChannelUpsertCmds cmds
      */
-    public boolean batchCreateApiEndpoint(List<EgressApiEndpointUpsertCmd> egressApiEndpointUpsertCmds) throws IOException {
-        String requestBody = JSON.toJSONString(egressApiEndpointUpsertCmds);
-        log.info("开始http请求(post),url:{},payload:{}", egServiceUrl+"/api/endpoint/batchCreate", requestBody);
+    public boolean batchCreateApiChannel(List<EgressApiChannelUpsertCmd> egressApiChannelUpsertCmds) throws IOException {
+        String requestBody = JSON.toJSONString(egressApiChannelUpsertCmds);
+        log.info("开始http请求(post),url:{},payload:{}", egServiceUrl+"/api/egressApiChannel/batchCreate", requestBody);
         RequestBody body = RequestBody.create(requestBody, CONTENT_TYPE_JSON);
         Request request = new Request.Builder()
                 .url(egServiceUrl)

+ 3 - 1
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/common/QrUtils.java

@@ -52,8 +52,10 @@ public class QrUtils {
     }
 
     public static void main(String[] args) {
+       // System.out.println(UUID.randomUUID().toString());
         try {
-            String secret = "otpauth://totp/admin?secret=e867dc42-46f8-421d-8122-6c9d1d6fb820&issuer=hrsk-open-platform";
+//            String secret = "otpauth://totp/admin?secret=e867dc42-46f8-421d-8122-6c9d1d6fb820&issuer=hrsk-open-platform";
+            String secret = "otpauth://totp/zhangyuanying?secret=bb2b930b-7aba-414d-a357-1e0e0536b321&issuer=hrsk-open-platform";
             System.out.println(secret);
             System.out.println(Base64.encode(QrUtils.draw(secret,200,200)));
         } catch (WriterException e) {

+ 7 - 7
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/dao/EgressApiEndpointDao.java → op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/dao/EgressApiChannelDao.java

@@ -1,6 +1,6 @@
 package com.hrsk.cloud.op.infrastructure.repository.database.mysql.dao;
 
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiEndpointDO;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiChannelDO;
 import org.apache.ibatis.annotations.Mapper;
 import org.springframework.stereotype.Repository;
 
@@ -9,15 +9,15 @@ import java.util.List;
 /**
  * @author: bianlanzhou
  * @create: 2024-10-29 17:01
- * @description: egress_api_endpoint 表DAO
+ * @description: egress_api_channel 表DAO
  **/
 @Repository
 @Mapper
-public interface EgressApiEndpointDao {
+public interface EgressApiChannelDao {
     /**
-     * 查询egress_api_endpoint
-     * @param egressApiEndpointDO 条件
-     * @return egress_api_endpoint列表
+     * 查询egress_api_channel
+     * @param egressApiChannelDO 条件
+     * @return egress_api_channel列表
      */
-    List<EgressApiEndpointDO> selectEgressApiEndpoint(EgressApiEndpointDO egressApiEndpointDO);
+    List<EgressApiChannelDO> selectEgressApiChannel(EgressApiChannelDO egressApiChannelDO);
 }

+ 109 - 0
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiChannelDO.java

@@ -0,0 +1,109 @@
+package com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.hrsk.cloud.op.client.dto.EgressApiChannelDTO;
+import com.hrsk.cloud.op.client.dto.Operator;
+import com.hrsk.cloud.op.client.dto.command.EgressApiChannelUpsertCmd;
+import com.hrsk.cloud.op.domain.egress.EgressApiStatusEnum;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-23 14:25
+ * @description: 表 egress_api_channel 数据对象。
+ **/
+@Data
+@TableName("egress_api_channel")
+public class EgressApiChannelDO extends BaseDO{
+
+    /**
+     * ID
+     */
+    private Long id;
+
+    /**
+     * egress_api的主键
+     */
+    private Long apiId;
+
+    /**
+     * api名称
+     */
+    @TableField(exist = false)
+    private String apiName;
+
+    /**
+     * API类型
+     */
+    @TableField(exist = false)
+    private String apiType;
+
+    /**
+     * 通道名称
+     */
+    private String channelName;
+    /**
+     * 通道编码
+     */
+    private String channelCode;
+    /**
+     * 集成方式
+     */
+    private String integrationMode;
+
+    /**
+     * 请求配置
+     */
+    private String requestConfig;
+
+    /**
+     * 响应配置
+     */
+    private String responseConfig;
+
+    /**
+     * 版本
+     */
+    private String version;
+
+    /**
+     * 备注
+     */
+    private String memo;
+
+    /**
+     * 转化
+     * @param egressApiChannelUpsertCmd cmd
+     * @param version 版本
+     * @param operator cmd
+     * @return EgressApiChannelDO
+     */
+    public static EgressApiChannelDO from(EgressApiChannelUpsertCmd egressApiChannelUpsertCmd, String version, Operator operator){
+        EgressApiChannelDO egressApiChannel = new EgressApiChannelDO();
+        BeanUtils.copyProperties(egressApiChannelUpsertCmd,egressApiChannel);
+        egressApiChannel.setRequestConfig(egressApiChannelUpsertCmd.getRequestConfig());
+        egressApiChannel.setResponseConfig(egressApiChannelUpsertCmd.getResponseConfig());
+        egressApiChannel.setCreateUserid(operator.getId());
+        egressApiChannel.setCreateUsername(operator.getUsername());
+        egressApiChannel.setModifyUserid(operator.getId());
+        egressApiChannel.setModifyUsername(operator.getUsername());
+        egressApiChannel.setVersion(version);
+        egressApiChannel.setStatus(EgressApiStatusEnum.OK.getCode());
+        return egressApiChannel;
+    }
+
+    /**
+     * 转DTO
+     * @return
+     */
+    public EgressApiChannelDTO toDTO(){
+        EgressApiChannelDTO egressApiChannel = new EgressApiChannelDTO();
+        BeanUtils.copyProperties(this,egressApiChannel);
+        egressApiChannel.setRequestConfig(requestConfig);
+        egressApiChannel.setResponseConfig(responseConfig);
+        return egressApiChannel;
+    }
+
+}

+ 88 - 0
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiChannelHistoryDO.java

@@ -0,0 +1,88 @@
+package com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.hrsk.cloud.op.client.dto.EgressApiChannelDTO;
+import lombok.Data;
+import org.springframework.beans.BeanUtils;
+
+/**
+ * @author: bianlanzhou
+ * @create: 2024-10-23 14:25
+ * @description: 表 egress_api_channel 数据对象。
+ **/
+@Data
+@TableName("egress_api_channel_history")
+public class EgressApiChannelHistoryDO extends BaseDO{
+    /**
+     * ID
+     */
+    private Long id;
+
+    /**
+     * 通道ID
+     */
+    private Long channelId;
+
+    /**
+     * egress_api的主键
+     */
+    private Long apiId;
+
+    /**
+     * api名称
+     */
+    private String apiName;
+
+    /**
+     * API类型
+     */
+    private String apiType;
+
+    /**
+     * 通道名称
+     */
+    private String channelName;
+
+    /**
+     * 通道编码
+     */
+    private String channelCode;
+
+    /**
+     * 请求配置
+     */
+    private byte[] requestConfig;
+
+    /**
+     * 备注
+     */
+    private String memo;
+    /**
+     * 版本
+     */
+    private String version;
+
+    /**
+     * 转化
+     * @param egressApiChannelDO DO
+     * @return this
+     */
+    public static EgressApiChannelHistoryDO from(EgressApiChannelDO egressApiChannelDO){
+        EgressApiChannelHistoryDO egressApiChannelHistory = new EgressApiChannelHistoryDO();
+        BeanUtils.copyProperties(egressApiChannelDO,egressApiChannelHistory);
+        egressApiChannelHistory.setId(null);
+        egressApiChannelHistory.setChannelId(egressApiChannelDO.getId());
+        egressApiChannelHistory.setVersion(egressApiChannelDO.getVersion());
+        return egressApiChannelHistory;
+    }
+
+    /**
+     * 转DTO
+     * @return
+     */
+    public EgressApiChannelDTO toDTO(){
+        EgressApiChannelDTO egressApiChannelDTO = new EgressApiChannelDTO();
+        BeanUtils.copyProperties(this, egressApiChannelDTO);
+        return egressApiChannelDTO;
+    }
+}

+ 0 - 109
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiEndpointDO.java

@@ -1,109 +0,0 @@
-package com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.hrsk.cloud.op.client.dto.EgressApiEndpointDTO;
-import com.hrsk.cloud.op.client.dto.Operator;
-import com.hrsk.cloud.op.client.dto.command.EgressApiEndpointUpsertCmd;
-import com.hrsk.cloud.op.domain.egress.EgressApiStatusEnum;
-import lombok.Data;
-import org.springframework.beans.BeanUtils;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-23 14:25
- * @description: 表 egress_api_endpoint 数据对象。
- **/
-@Data
-@TableName("egress_api_endpoint")
-public class EgressApiEndpointDO extends BaseDO{
-
-    /**
-     * ID
-     */
-    private Long id;
-
-    /**
-     * egress_api的主键
-     */
-    private Long apiId;
-
-    /**
-     * api名称
-     */
-    @TableField(exist = false)
-    private String apiName;
-
-    /**
-     * API类型
-     */
-    @TableField(exist = false)
-    private String apiType;
-
-    /**
-     * 通道名称
-     */
-    private String endpointName;
-    /**
-     * 通道编码
-     */
-    private String endpointCode;
-    /**
-     * 集成方式
-     */
-    private String integrationMode;
-
-    /**
-     * 请求配置
-     */
-    private String requestConfig;
-
-    /**
-     * 响应配置
-     */
-    private String responseConfig;
-
-    /**
-     * 版本
-     */
-    private String version;
-
-    /**
-     * 备注
-     */
-    private String memo;
-
-    /**
-     * 转化
-     * @param egressApiEndpointUpsertCmd cmd
-     * @param version 版本
-     * @param operator cmd
-     * @return EgressApiEndpointDO
-     */
-    public static EgressApiEndpointDO from(EgressApiEndpointUpsertCmd egressApiEndpointUpsertCmd, String version,Operator operator){
-        EgressApiEndpointDO egressApiEndpoint = new EgressApiEndpointDO();
-        BeanUtils.copyProperties(egressApiEndpointUpsertCmd,egressApiEndpoint);
-        egressApiEndpoint.setRequestConfig(egressApiEndpointUpsertCmd.getRequestConfig());
-        egressApiEndpoint.setResponseConfig(egressApiEndpointUpsertCmd.getResponseConfig());
-        egressApiEndpoint.setCreateUserid(operator.getId());
-        egressApiEndpoint.setCreateUsername(operator.getUsername());
-        egressApiEndpoint.setModifyUserid(operator.getId());
-        egressApiEndpoint.setModifyUsername(operator.getUsername());
-        egressApiEndpoint.setVersion(version);
-        egressApiEndpoint.setStatus(EgressApiStatusEnum.OK.getCode());
-        return egressApiEndpoint;
-    }
-
-    /**
-     * 转DTO
-     * @return
-     */
-    public EgressApiEndpointDTO toDTO(){
-        EgressApiEndpointDTO egressApiEndpoint = new EgressApiEndpointDTO();
-        BeanUtils.copyProperties(this,egressApiEndpoint);
-        egressApiEndpoint.setRequestConfig(requestConfig);
-        egressApiEndpoint.setResponseConfig(responseConfig);
-        return egressApiEndpoint;
-    }
-
-}

+ 0 - 83
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/entity/EgressApiEndpointHistoryDO.java

@@ -1,83 +0,0 @@
-package com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.hrsk.cloud.op.client.dto.EgressApiEndpointDTO;
-import lombok.Data;
-import org.springframework.beans.BeanUtils;
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-23 14:25
- * @description: 表 egress_api_endpoint 数据对象。
- **/
-@Data
-@TableName("egress_api_endpoint_history")
-public class EgressApiEndpointHistoryDO extends BaseDO{
-    /**
-     * ID
-     */
-    private Long id;
-
-    /**
-     * 通道ID
-     */
-    private Long endpointId;
-
-    /**
-     * egress_api的主键
-     */
-    private Long apiId;
-
-    /**
-     * api名称
-     */
-    private String apiName;
-
-    /**
-     * API类型
-     */
-    private String apiType;
-
-    /**
-     * 通道名称
-     */
-    private String endpointName;
-
-    /**
-     * 请求配置
-     */
-    private byte[] requestConfig;
-
-    /**
-     * 备注
-     */
-    private String memo;
-    /**
-     * 版本
-     */
-    private String version;
-
-    /**
-     * 转化
-     * @param egressApiEndpointDO DO
-     * @return this
-     */
-    public static EgressApiEndpointHistoryDO from(EgressApiEndpointDO egressApiEndpointDO){
-        EgressApiEndpointHistoryDO egressApiEndpointHistory = new EgressApiEndpointHistoryDO();
-        BeanUtils.copyProperties(egressApiEndpointDO,egressApiEndpointHistory);
-        egressApiEndpointHistory.setId(null);
-        egressApiEndpointHistory.setEndpointId(egressApiEndpointDO.getId());
-        egressApiEndpointHistory.setVersion(egressApiEndpointDO.getVersion());
-        return egressApiEndpointHistory;
-    }
-
-    /**
-     * 转DTO
-     * @return
-     */
-    public EgressApiEndpointDTO toDTO(){
-        EgressApiEndpointDTO egressApiEndpointDTO = new EgressApiEndpointDTO();
-        BeanUtils.copyProperties(this,egressApiEndpointDTO);
-        return egressApiEndpointDTO;
-    }
-}

+ 2 - 2
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/mapper/EgressApiEndpointHistoryMapper.java → op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/mapper/EgressApiChannelHistoryMapper.java

@@ -1,12 +1,12 @@
 package com.hrsk.cloud.op.infrastructure.repository.database.mysql.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiEndpointHistoryDO;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiChannelHistoryDO;
 
 /**
  * @author: bianlanzhou
  * @create: 2024-10-23 14:24
  * @description: 接出API通道MAPPER
  **/
-public interface EgressApiEndpointHistoryMapper extends BaseMapper<EgressApiEndpointHistoryDO> {
+public interface EgressApiChannelHistoryMapper extends BaseMapper<EgressApiChannelHistoryDO> {
 }

+ 2 - 2
op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/mapper/EgressApiEndpointMapper.java → op-admin-server-infrastructure/src/main/java/com/hrsk/cloud/op/infrastructure/repository/database/mysql/mapper/EgressApiChannelMapper.java

@@ -1,12 +1,12 @@
 package com.hrsk.cloud.op.infrastructure.repository.database.mysql.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiEndpointDO;
+import com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity.EgressApiChannelDO;
 
 /**
  * @author: bianlanzhou
  * @create: 2024-10-23 14:24
  * @description: 接出API通道MAPPER
  **/
-public interface EgressApiEndpointMapper extends BaseMapper<EgressApiEndpointDO> {
+public interface EgressApiChannelMapper extends BaseMapper<EgressApiChannelDO> {
 }

+ 2 - 2
op-admin-server-infrastructure/src/main/resources/mybatis-config.xml

@@ -14,8 +14,8 @@
         <package name="com.hrsk.cloud.op.infrastructure.repository.database.mysql.entity"/>
     </typeAliases>
     <mappers>
-        <mapper resource="mybatis/EgressApiEndpointMapper.xml"/>
+        <mapper resource="mybatis/EgressApiChannelMapper.xml"/>
         <mapper resource="mybatis/SysUserMapper.xml"/>
         <mapper resource="mybatis/SysMenuMapper.xml"/>
     </mappers>
-</configuration>
+</configuration>

+ 9 - 9
op-admin-server-infrastructure/src/main/resources/mybatis/EgressApiEndpointMapper.xml → op-admin-server-infrastructure/src/main/resources/mybatis/EgressApiChannelMapper.xml

@@ -1,11 +1,11 @@
 <?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.hrsk.cloud.op.infrastructure.repository.database.mysql.dao.EgressApiEndpointDao">
-    <select id="selectEgressApiEndpoint" parameterType="EgressApiEndpointDO" resultType="EgressApiEndpointDO">
+<mapper namespace="com.hrsk.cloud.op.infrastructure.repository.database.mysql.dao.EgressApiChannelDao">
+    <select id="selectEgressApiChannel" parameterType="EgressApiChannelDO" resultType="EgressApiChannelDO">
         select
-            ea.api_name,epe.id,epe.endpoint_name,epe.api_id,ea.api_type,epe.integration_mode,epe.request_config,epe.response_config,epe.gmt_create,epe.gmt_modify
-        from egress_api_endpoint epe
+            ea.api_name,epe.id,epe.channel_name,epe.api_id,ea.api_type,epe.integration_mode,epe.request_config,epe.response_config,epe.gmt_create,epe.gmt_modify
+        from egress_api_channel epe
                  join egress_api ea on ea.id = epe.api_id
         where ea.`status` != 'delete'
         <if test="apiName!=null" >
@@ -14,11 +14,11 @@
         <if test="apiId!=null and apiId > 0" >
             and epe.api_id = #{apiId}
         </if>
-        <if test="endpointName!=null" >
-            and epe.endpoint_name like concat('%', #{endpointName}, '%')
+        <if test="channelName!=null" >
+            and epe.channel_name like concat('%', #{channelName}, '%')
         </if>
-        <if test="endpointCode!=null" >
-            and epe.endpoint_code = #{endpointCode}
+        <if test="channelCode!=null" >
+            and epe.channel_code = #{channelCode}
         </if>
     </select>
-</mapper>
+</mapper>

+ 5 - 0
start/pom.xml

@@ -20,6 +20,11 @@
             <groupId>com.hrsk.cloud</groupId>
             <artifactId>op-admin-server-adapter</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.3.4</version>
+        </dependency>
     </dependencies>
 
 </project>

+ 6 - 3
start/src/main/java/com/hrsk/cloud/op/Application.java

@@ -4,10 +4,11 @@ import lombok.extern.slf4j.Slf4j;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.ApplicationContext;
 
 @Slf4j
 @SpringBootApplication
-@MapperScan("com.hrsk.cloud.op.infrastructure.repository.database.mysql")
+@MapperScan(basePackages = {"com.hrsk.cloud.op.infrastructure.repository.database.mysql"})
 public class Application {
     /**
      * main函数
@@ -24,8 +25,10 @@ public class Application {
     private static void launch(String[] args){
         log.info("Begin to start Spring Boot Application ......");
         long startTime = System.currentTimeMillis();
-        SpringApplication.run(Application.class, args);
+        ApplicationContext ac = SpringApplication.run(Application.class, args);
         long endTime = System.currentTimeMillis();
         log.info("Spring Boot Application has been started, Time used: "+ (endTime - startTime) + "ms" );
     }
-}
+
+
+}

+ 0 - 204
start/src/main/java/com/hrsk/cloud/op/test/TotpUtils.java

@@ -1,204 +0,0 @@
-package com.hrsk.cloud.op.test;
-
-import com.google.zxing.WriterException;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.binary.Base32;
-import org.apache.commons.lang3.RandomStringUtils;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.UUID;
-
-
-/**
- * @author: bianlanzhou
- * @create: 2024-10-18 11:17
- * @description:
- **/
-@Slf4j
-public class TotpUtils {
-    /** 时间步长,动态口令变化时间周期(单位秒) */
-    private static final int TIME_STEP = 30;
-    /** 动态口令默认长度 */
-    private static final int CODE_DIGITS = 6;
-
-    /**
-     * 生成唯一密钥
-     *
-     * @return
-     */
-    public static String generateSecretKey() {
-        // UUID + 4位随机字符生成唯一标识
-        String uniqueId = UUID.randomUUID() + RandomStringUtils.randomAlphabetic(4);
-        return new String(new Base32().encode(uniqueId.getBytes()));
-    }
-
-    /**
-     * 生成一个基于TOTP标准身份验证器识别的字符串
-     * 将该字符串生成二维码可供通用动态密码工具识别,例如:iOS应用(Authy)、微信小程序(二次验证码)
-     *
-     * @param user
-     * @param secret
-     * @return   &issuer={2}
-     */
-    public static String getQRCodeStr(String user, String secret) {
-        String format = "otpauth://totp/%s?secret=%s";
-        return String.format(format, user, secret);
-    }
-
-    /**
-     * 生成动态口令
-     *
-     * @param secret
-     * @return
-     */
-    public static String generateTOTP(String secret) {
-        return TotpUtils.generateTOTP(secret, TotpUtils.getCurrentInterval(), CODE_DIGITS);
-    }
-
-    /**
-     * 生成指定位数的动态口令
-     *
-     * @param secret
-     * @param codeDigits
-     * @return
-     */
-    public static String generateTOTP(String secret, int codeDigits) {
-        return TotpUtils.generateTOTP(secret, TotpUtils.getCurrentInterval(), codeDigits);
-    }
-
-    /**
-     * 验证动态口令
-     *
-     * @param secret
-     * @param code
-     * @return
-     */
-    public static boolean verify(String secret, String code) {
-        return TotpUtils.verify(secret, code, CODE_DIGITS);
-    }
-
-    /**
-     * 验证动态口令
-     *
-     * @param secret
-     * @param code
-     * @param codeDigits
-     * @return
-     */
-    public static boolean verify(String secret, String code, int codeDigits) {
-        long currentInterval = TotpUtils.getCurrentInterval();
-        // 考虑到时间延时,需考虑前一个步长的动态密码是否匹配
-        for (int i = 0; i <= 1; i++) {
-            String tmpCode = TotpUtils.generateTOTP(secret, currentInterval - i, codeDigits);
-            if (tmpCode.equals(code)) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * 获取动态口令剩余秒数
-     * <p>
-     * 所有口令是基于时间戳计算,因此任何动态口令的剩余有效时间都是一致的
-     *
-     * @return
-     */
-    public static int getRemainingSeconds() {
-        return TIME_STEP - (int) (System.currentTimeMillis() / 1000 % TIME_STEP);
-    }
-
-    /**
-     * 生成动态口令
-     *
-     * @param secret
-     * @param currentInterval
-     * @param codeDigits
-     * @return
-     */
-    private static String generateTOTP(String secret, long currentInterval, int codeDigits) {
-        if (codeDigits < 1 || codeDigits > 18) {
-            throw new UnsupportedOperationException("不支持" + codeDigits + "位数的动态口令");
-        }
-        byte[] content = ByteBuffer.allocate(8).putLong(currentInterval).array();
-        byte[] hash = TotpUtils.hmacsha(content, secret);
-        // 获取hash最后一个字节的低4位,作为选择结果的开始下标偏移
-        int offset = hash[hash.length - 1] & 0xf;
-        // 获取4个字节组成一个整数,其中第一个字节最高位为符号位,不获取,使用0x7f
-        int binary = ((hash[offset] & 0x7f) << 24) |
-                ((hash[offset + 1] & 0xff) << 16) |
-                ((hash[offset + 2] & 0xff) << 8) |
-                (hash[offset + 3] & 0xff);
-        // 如果所需位数为6,则该值为1000000
-        long digitsPower = Long.parseLong(TotpUtils.rightPadding("1", codeDigits + 1));
-        // 获取当前数值后的指定位数
-        long code = binary % digitsPower;
-        // 将数字转成字符串,不够指定位前面补0
-        return TotpUtils.leftPadding(Long.toString(code), codeDigits);
-    }
-
-    /**
-     * 获取当前时间戳
-     *
-     * @return
-     */
-    private static long getCurrentInterval() {
-        return System.currentTimeMillis() / 1000 / TIME_STEP;
-    }
-
-    /**
-     * 向左补足0
-     *
-     * @param value
-     * @param length
-     * @return
-     */
-    private static String leftPadding(String value, int length) {
-        while (value.length() < length) {
-            value = "0" + value;
-        }
-        return value;
-    }
-
-    /**
-     * 向右补足0
-     *
-     * @param value
-     * @param length
-     * @return
-     */
-    private static String rightPadding(String value, int length) {
-        while (value.length() < length) {
-            value = value + "0";
-        }
-        return value;
-    }
-
-    /**
-     * 使用HmacSHA1加密
-     *
-     * @param content
-     * @param key
-     * @return
-     */
-    private static byte[] hmacsha(byte[] content, String key) {
-        try {
-            byte[] byteKey = new Base32().decode(key);
-            Mac hmac = Mac.getInstance("HmacSHA1");
-            SecretKeySpec keySpec = new SecretKeySpec(byteKey, "HmacSHA1");
-            hmac.init(keySpec);
-            return hmac.doFinal(content);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-        return null;
-    }
-
-    public static void main(String[] args) throws IOException, WriterException {
-        //System.out.println(Base64.encode(QrUtils.draw(TotpUtils.getQRCodeStr("admin","e867dc42-46f8-421d-8122-6c9d1d6fb820"),200,200)));
-        System.out.println(TotpUtils.verify("e867dc42-46f8-421d-8122-6c9d1d6fb820","935145"));
-    }
-}

+ 1 - 1
start/src/main/resources/application-local.yaml

@@ -38,4 +38,4 @@ spring:
 # egress service
 egress:
   service:
-    url: http://127.0.0.1:8082
+    url: http://127.0.0.1:8082