11 changed files with 95 additions and 55 deletions
@ -1,21 +0,0 @@ |
|||||
package com.epmet.feign; |
|
||||
|
|
||||
import com.epmet.commons.tools.constant.ServiceConstant; |
|
||||
import com.epmet.commons.tools.utils.Result; |
|
||||
import com.epmet.dto.CustomerFootBarDTO; |
|
||||
import com.epmet.dto.form.CustomerFootBarFormDTO; |
|
||||
import com.epmet.feign.fallback.OperCustomizeFeignClientFallBack; |
|
||||
import org.springframework.cloud.openfeign.FeignClient; |
|
||||
import org.springframework.http.MediaType; |
|
||||
import org.springframework.web.bind.annotation.PostMapping; |
|
||||
import org.springframework.web.bind.annotation.RequestBody; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) |
|
||||
public interface OperCustomizeFeignClient { |
|
||||
|
|
||||
@PostMapping(value = "/oper/customize/customerfootbar/customerfootbars", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) |
|
||||
Result<List<CustomerFootBarDTO>> getCustomerfootbars(@RequestBody CustomerFootBarFormDTO formDTO); |
|
||||
|
|
||||
} |
|
@ -1,22 +0,0 @@ |
|||||
package com.epmet.feign.fallback; |
|
||||
|
|
||||
import com.epmet.commons.tools.constant.ServiceConstant; |
|
||||
import com.epmet.commons.tools.utils.ModuleUtils; |
|
||||
import com.epmet.commons.tools.utils.Result; |
|
||||
import com.epmet.dto.CustomerFootBarDTO; |
|
||||
import com.epmet.dto.form.CustomerFootBarFormDTO; |
|
||||
import com.epmet.dto.form.CustomerHomeFormDTO; |
|
||||
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
|
||||
import com.epmet.feign.OperCustomizeFeignClient; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
@Component |
|
||||
public class OperCustomizeFeignClientFallBack implements OperCustomizeFeignClient { |
|
||||
|
|
||||
@Override |
|
||||
public Result<List<CustomerFootBarDTO>> getCustomerfootbars(CustomerFootBarFormDTO formDTO) { |
|
||||
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getCustomerfootbars",formDTO); |
|
||||
} |
|
||||
} |
|
@ -0,0 +1,10 @@ |
|||||
|
package com.epmet.resi.mine.dto.from; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class ResiFootBarFormDTO { |
||||
|
|
||||
|
private String customerId; |
||||
|
|
||||
|
} |
@ -0,0 +1,39 @@ |
|||||
|
package com.epmet.modules.app.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.AppClientConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.CustomerFootBarDTO; |
||||
|
import com.epmet.dto.form.CustomerFootBarFormDTO; |
||||
|
import com.epmet.feign.OperCustomizeOpenFeignClient; |
||||
|
import com.epmet.resi.mine.dto.from.ResiFootBarFormDTO; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.util.CollectionUtils; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@RestController |
||||
|
@RequestMapping("app") |
||||
|
public class AppController { |
||||
|
|
||||
|
@Autowired |
||||
|
private OperCustomizeOpenFeignClient operCustomizeFeign; |
||||
|
|
||||
|
@PostMapping("footbar") |
||||
|
public Result getResiFootBars(@RequestBody ResiFootBarFormDTO input) { |
||||
|
CustomerFootBarFormDTO form = new CustomerFootBarFormDTO(); |
||||
|
form.setCustomerId(input.getCustomerId()); |
||||
|
form.setAppType(AppClientConstant.APP_RESI); |
||||
|
Result<List<CustomerFootBarDTO>> result = operCustomizeFeign.getCustomerfootbars(form); |
||||
|
if (CollectionUtils.isEmpty(result.getData())) { |
||||
|
form.setCustomerId("default"); |
||||
|
result = operCustomizeFeign.getCustomerfootbars(form); |
||||
|
} |
||||
|
return result; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue