整理代码
parent
6ad85cd00f
commit
ef00082e7c
@ -1,44 +0,0 @@
|
||||
package com.ms.api;
|
||||
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.dto.ItemDTO;
|
||||
import com.ms.api.tool.DsFormRequestTemplate;
|
||||
import com.ms.api.tool.SecurityTool;
|
||||
import com.ms.api.common.UniqueKeyMultiValueMap;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@ExtensionService("dsRequest")
|
||||
@Slf4j
|
||||
public class DsRequestService implements ExtensionServiceHandler<ItemDTO, Integer> {
|
||||
|
||||
@Autowired
|
||||
private DsFormRequestTemplate dsFormRequestTemplate;
|
||||
|
||||
@Override
|
||||
public BaseResponse<Integer> handle(BaseRequest<ItemDTO> req) {
|
||||
UniqueKeyMultiValueMap<String,String> params = new UniqueKeyMultiValueMap<>();
|
||||
params.add("platform", "ddMicroApp");
|
||||
params.add("platformOrderId", "2332");
|
||||
String shopId = SecurityTool.encodeByAES(String.valueOf(78327));
|
||||
log.info(shopId);
|
||||
params.add("shopId", shopId);
|
||||
params.add("operateInfo", "{\"userId\":\"2332\", \"ip\": \"123.21.123.123\"}");
|
||||
params.add("platformSkuId", "123232");
|
||||
try {
|
||||
String res = dsFormRequestTemplate.execute("/order/cancelPurchaseOrderRelate", params);
|
||||
log.info(res);
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return BaseResponse.<Integer>builder()
|
||||
.success(true)
|
||||
.message("success")
|
||||
.data(123)
|
||||
.code("10000")
|
||||
.build();
|
||||
}
|
||||
}
|
@ -1,28 +0,0 @@
|
||||
package com.ms.api;
|
||||
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.dto.ItemDTO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Author: laixw
|
||||
* @Date: 2023/8/23
|
||||
*/
|
||||
@ExtensionService("TaskRun")
|
||||
@Slf4j
|
||||
public class TaskService implements ExtensionServiceHandler<ItemDTO, Void> {
|
||||
@Override
|
||||
public BaseResponse<Void> handle(BaseRequest<ItemDTO> req) {
|
||||
|
||||
// 业务逻辑处理
|
||||
// do something...
|
||||
// db.save(itemDTO);
|
||||
log.info("TaskService...");
|
||||
|
||||
return BaseResponse.<Void>builder()
|
||||
.build();
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.ms.api;
|
||||
|
||||
import com.jinritemai.cloud.base.api.BaseRequest;
|
||||
import com.jinritemai.cloud.base.api.BaseResponse;
|
||||
import com.jinritemai.cloud.base.api.ExtensionService;
|
||||
import com.jinritemai.cloud.base.api.ExtensionServiceHandler;
|
||||
import com.ms.api.common.R;
|
||||
import com.ms.api.dto.ItemDTO;
|
||||
import com.ms.api.dto.move.GetCurrentShopMoveSettingRequestDTO;
|
||||
import com.ms.api.dto.move.GetMoveHistoryProductListRequestDTO;
|
||||
import com.ms.api.dto.move.SaveBatchMoveTaskRequestDTO;
|
||||
import com.ms.api.tool.DsJsonRequestTemplate;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@ExtensionService("testSign")
|
||||
@Slf4j
|
||||
public class TestSignService implements ExtensionServiceHandler<ItemDTO, String> {
|
||||
|
||||
@Autowired
|
||||
private DsJsonRequestTemplate dsJsonRequestTemplate;
|
||||
|
||||
@Override
|
||||
public BaseResponse<String> handle(BaseRequest<ItemDTO> req) {
|
||||
log.info("");
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
// List<String> arrayString = new ArrayList<>();
|
||||
// arrayString.add("arrayString1");
|
||||
// arrayString.add("arrayString2");
|
||||
// params.put("arrayString", arrayString);
|
||||
//
|
||||
// HashMap<String, String> mapStringString = new HashMap<>();
|
||||
// mapStringString.put("A","mapStringString1");
|
||||
// mapStringString.put("B","mapStringString2");
|
||||
// params.put("mapStringString", mapStringString);
|
||||
//
|
||||
// List<Integer> arrayInt64 = new ArrayList<>();
|
||||
// arrayInt64.add(10000);
|
||||
// arrayInt64.add(10000);
|
||||
// params.put("arrayInt64", arrayInt64);
|
||||
//
|
||||
// params.put("int16", 10000);
|
||||
// params.put("int32", 10000);
|
||||
// params.put("int64", 10000);
|
||||
// params.put("double", 10.1);
|
||||
params.put("string", "test");
|
||||
|
||||
// params.put("struct", new GetCurrentShopMoveSettingRequestDTO());
|
||||
//
|
||||
// List<Object> arrayStruct = new LinkedList<>();
|
||||
// arrayStruct.add(new GetCurrentShopMoveSettingRequestDTO());
|
||||
// arrayStruct.add(new GetMoveHistoryProductListRequestDTO());
|
||||
// arrayStruct.add(new SaveBatchMoveTaskRequestDTO());
|
||||
// params.put("arrayStruct", arrayStruct);
|
||||
//
|
||||
// Map<String,Object> mapStringStruct = new HashMap<>();
|
||||
// mapStringStruct.put("mapstruct1", new GetCurrentShopMoveSettingRequestDTO());
|
||||
// mapStringStruct.put("mapstruct2", new GetMoveHistoryProductListRequestDTO());
|
||||
// mapStringStruct.put("mapstruct3", new SaveBatchMoveTaskRequestDTO());
|
||||
// params.put("mapStringStruct", mapStringStruct);
|
||||
|
||||
String res = null;
|
||||
try {
|
||||
res = dsJsonRequestTemplate.execute("/order/testJava", params);
|
||||
log.info(res);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return R.ok(res);
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.ms.api.tool;
|
||||
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* 系统工具
|
||||
*/
|
||||
public class SystemTool {
|
||||
|
||||
/**
|
||||
* 是否生产环境
|
||||
* @return
|
||||
*/
|
||||
public static boolean isProdEnv(){
|
||||
String activeProfile = System.getenv("sys-deploy-env");
|
||||
return "Prod".equals(activeProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否测试环境
|
||||
* @return
|
||||
*/
|
||||
public static boolean isTestEnv(){
|
||||
String activeProfile = System.getenv("sys-deploy-env");
|
||||
return "Test".equals(activeProfile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否生产环境
|
||||
* @return
|
||||
*/
|
||||
public static boolean isDevEnv(){
|
||||
String activeProfile = System.getenv("sys-deploy-env");
|
||||
return StringUtils.isEmpty(activeProfile);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue