|
@@ -0,0 +1,105 @@
|
|
|
|
+package com.hrsk.cloud.eg.app.business;
|
|
|
|
+
|
|
|
|
+import com.alibaba.cola.exception.BizException;
|
|
|
|
+import com.hrsk.cloud.eg.app.request.api.EgApiEndpointReq;
|
|
|
|
+import com.hrsk.cloud.eg.app.request.api.EgApiLoanExtendReq;
|
|
|
|
+import com.hrsk.cloud.eg.app.request.api.EgApiProductExtendReq;
|
|
|
|
+import com.hrsk.cloud.eg.app.request.api.EgApiReq;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiDo;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiEndpointDo;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiLoanExtendDo;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.repository.database.entity.EgApiProductExtendDo;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiEndpointService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiLoanExtendService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiProductExtendService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.service.EgApiService;
|
|
|
|
+import com.hrsk.cloud.eg.infrastructure.utils.BeanCopyUtils;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @author zhangyy
|
|
|
|
+ * @version 1.0
|
|
|
|
+ * @description: EgOperateBusinessService eg接出操作类
|
|
|
|
+ * @date 2024/9/23 13:49
|
|
|
|
+ */
|
|
|
|
+@Service
|
|
|
|
+public class EgOperateBusinessService {
|
|
|
|
+ @Resource
|
|
|
|
+ private EgApiService egApiService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private EgApiEndpointService egApiEndpointService;
|
|
|
|
+ @Resource
|
|
|
|
+ private EgApiProductExtendService egApiProductExtendService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private EgApiLoanExtendService egApiLoanExtendService;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @description: 保存接出api
|
|
|
|
+ * @author zhangyy
|
|
|
|
+ * @date 2024/9/23 14:08
|
|
|
|
+ * @version 1.0
|
|
|
|
+ */
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Long saveApiInfo(EgApiReq req) {
|
|
|
|
+ EgApiDo copy = BeanCopyUtils.copy(req, EgApiDo.class);
|
|
|
|
+ egApiService.save(copy);
|
|
|
|
+ return copy.getId();
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @description: 保存api的配置
|
|
|
|
+ * @author zhangyy
|
|
|
|
+ * @date 2024/9/23 14:18
|
|
|
|
+ * @version 1.0
|
|
|
|
+ */
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public Long saveApiConfig(EgApiEndpointReq req) {
|
|
|
|
+ EgApiEndpointDo copy = BeanCopyUtils.copy(req, EgApiEndpointDo.class);
|
|
|
|
+ EgApiDo apiDo = egApiService.getById(req.getApiId());
|
|
|
|
+ if (Objects.isNull(apiDo)) {
|
|
|
|
+ throw new BizException("主api信息为空");
|
|
|
|
+ }
|
|
|
|
+ copy.setApiName(apiDo.getApiName());
|
|
|
|
+ copy.setApiCode(apiDo.getApiCode());
|
|
|
|
+ egApiEndpointService.save(copy);
|
|
|
|
+ return copy.getId();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @description: 保存api扩展信息
|
|
|
|
+ * @param:
|
|
|
|
+ * @return:
|
|
|
|
+ * @author zhangyy
|
|
|
|
+ * @date: 2024/9/23 14:26
|
|
|
|
+ */
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void saveLoanApiExtend(EgApiLoanExtendReq req) {
|
|
|
|
+ if (Objects.isNull(req)){
|
|
|
|
+ throw new BizException("信息不能为空");
|
|
|
|
+ }
|
|
|
|
+ EgApiLoanExtendDo copy = BeanCopyUtils.copy(req, EgApiLoanExtendDo.class);
|
|
|
|
+ egApiLoanExtendService.save(copy);
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * @description: 保存api扩展信息
|
|
|
|
+ * @param:
|
|
|
|
+ * @return:
|
|
|
|
+ * @author zhangyy
|
|
|
|
+ * @date: 2024/9/23 14:26
|
|
|
|
+ */
|
|
|
|
+ public void saveInterbankApiExtend(EgApiProductExtendReq req) {
|
|
|
|
+ if (Objects.isNull(req)){
|
|
|
|
+ throw new BizException("信息不能为空");
|
|
|
|
+ }
|
|
|
|
+ EgApiProductExtendDo copy = BeanCopyUtils.copy(req, EgApiProductExtendDo.class);
|
|
|
|
+ egApiProductExtendService.save(copy);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|