|
|
@@ -0,0 +1,82 @@
|
|
|
+package com.yinjie.heating.webcore.rest;
|
|
|
+
|
|
|
+import com.dySweetFishPlugin.sql.RMapUtils;
|
|
|
+import com.sweetfish.net.http.*;
|
|
|
+import com.sweetfish.service.Local;
|
|
|
+import com.sweetfish.service.RetResult;
|
|
|
+import com.sweetfish.util.AutoLoad;
|
|
|
+import com.yinjie.heating.common.api.ERPService;
|
|
|
+import com.yinjie.heating.common.api.heating.CallThirdAppService;
|
|
|
+import com.yinjie.heating.common.api.heating.HeatingDocService;
|
|
|
+import com.yinjie.heating.common.base.BaseService;
|
|
|
+import com.yinjie.heating.common.datas.ERPHeader;
|
|
|
+import com.yinjie.heating.common.datas.HttpCode;
|
|
|
+import com.yinjie.heating.common.entity.base.DataBaseMultiItemEx;
|
|
|
+import com.yinjie.heating.common.entity.callthird.BaseResponse;
|
|
|
+import com.yinjie.heating.common.entity.callthird.QueryFeeResponse;
|
|
|
+import com.yinjie.heating.common.entity.heating.HeatingApp;
|
|
|
+import com.yinjie.heating.common.entity.site.ERPTokenUser;
|
|
|
+import org.rex.RMap;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.CompletableFuture;
|
|
|
+
|
|
|
+/**
|
|
|
+ * Created by jlutt on 2020-07-29
|
|
|
+ * ERP平台基础服务
|
|
|
+ *
|
|
|
+ * @author jlutt
|
|
|
+ */
|
|
|
+@AutoLoad(false)
|
|
|
+@Local
|
|
|
+@RestService(name = "test", moduleid = 1, comment = "测试接口")
|
|
|
+@SuppressWarnings({"rawtypes", "unused"})
|
|
|
+public class TestRest extends BaseService {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ CallThirdAppService callThirdAppService;
|
|
|
+ @Resource
|
|
|
+ HeatingDocService heatingDocService;
|
|
|
+
|
|
|
+ @RestMapping(name = "callQueryFee", sort = 1, methods = {"GET", "POST"})
|
|
|
+ public CompletableFuture<RMap> callQueryFee(
|
|
|
+ @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ HeatingApp app = heatingDocService.getRedisHeatingApp("TEST000000", Long.parseLong(supplierCode));
|
|
|
+
|
|
|
+ RetResult<QueryFeeResponse> result = callThirdAppService.callQueryFee("testUserBillKey", app, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (result.isSuccess()) {
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ } else {
|
|
|
+ return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "测试失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
+ @RestMapping(name = "callRequestPay", sort = 2, methods = {"GET", "POST"})
|
|
|
+ public CompletableFuture<RMap> callRequestPay(
|
|
|
+ @RestParam(name = "&", comment = "登录用户,无需传入") ERPTokenUser currentUser,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_DATASOURCE) String dataSourceId,
|
|
|
+ @RestHeader(name = ERPHeader.HTTPHEADER_SUPPLIER) String supplierCode) {
|
|
|
+ return CompletableFuture.supplyAsync(
|
|
|
+ () -> {
|
|
|
+ HeatingApp app = heatingDocService.getRedisHeatingApp("TEST000000", Long.parseLong(supplierCode));
|
|
|
+
|
|
|
+ RetResult<BaseResponse> result = callThirdAppService.callRequestPay("testUserBillKey", "20250425", "bankNo000000000000000",
|
|
|
+ "100", app, dataSourceId, Long.parseLong(supplierCode));
|
|
|
+ if (result.isSuccess()) {
|
|
|
+ return RMapUtils.successV2(result.getResult(), null, null);
|
|
|
+ } else {
|
|
|
+ return RMapUtils.error(HttpCode.BAD_REQUEST.value(), "测试失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ }, getExecutor()
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|