Commit d6915518 by chamberone

feat: 集成图层相关接口

1 parent 6fd945d0
......@@ -16,29 +16,13 @@
package com.dituhui.pea.order.feign.dto;
/**
* @author TrevorLink
*/
public class AccountDTO {
private String userId;
private Integer price;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
import lombok.Data;
public Integer getPrice() {
return price;
}
@Data
public class LayerDTO {
public void setPrice(Integer price) {
this.price = price;
}
private String id;
private String code;
private String name;
}
/*
* Copyright 2013-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.dituhui.pea.order.feign.dto;
/**
* @author TrevorLink
*/
public class StorageDTO {
private String commodityCode;
private Integer count;
public String getCommodityCode() {
return commodityCode;
}
public void setCommodityCode(String commodityCode) {
this.commodityCode = commodityCode;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
package com.dituhui.pea.order.service.impl;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.common.ResultEnum;
import com.dituhui.pea.order.feign.ISaaSRemoteService;
import com.dituhui.pea.order.feign.dto.LayerDTO;
import com.dituhui.pea.order.service.BusinessLayerService;
import com.dituhui.pea.order.utils.TypeUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Slf4j
@Service
public class BusinessLayerServiceImpl implements BusinessLayerService {
@Autowired
private ISaaSRemoteService saasRemoteService;
@Value("${SaaS.ak}")
String ak;
@Override
public Result<?> businessLayers() {
return null;
......@@ -30,7 +45,18 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
@Override
public Result<?> businessCustomLayerAdd() {
return null;
String layerName = "上海大区苏州分部基础技能";
// 同步创建saas图层,返回layerId
String result = saasRemoteService.addLayer(ak, layerName, 1, 1);
log.info("addLayer params:{} result:{}", layerName, result);
Result<LayerDTO> saasResult = TypeUtils.<LayerDTO>convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
}
String layerId = saasResult.getResult().getId();// 存入pea
return Result.success(null);
}
@Override
......@@ -40,6 +66,16 @@ public class BusinessLayerServiceImpl implements BusinessLayerService {
@Override
public Result<?> businessCustomLayerRemove() {
String layerId = "";
// 同步创建saas图层,返回layerId
String result = saasRemoteService.deleteLayer(ak, layerId);
log.info("deleteLayer params:{} result:{}", layerId, result);
Result<Boolean> saasResult = TypeUtils.<Boolean>convertResult(result);
if (!ResultEnum.SUCCESS.getCode().equals(saasResult.getCode())) {
return Result.failure(saasResult.getMessage());
}
return null;
}
}
......@@ -12,6 +12,12 @@ public class TypeUtils {
private final static Gson gson = new Gson();
/**
* 文本转Result对象
*
* @param text
* @return
*/
public static <T> Result<T> convertResult(String text) {
if (StringUtils.isEmpty(text)) {
return null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!