Commit 501f4433 by ping.wu

FeignClient 修改

parent 9cd5930b
...@@ -72,8 +72,8 @@ public class UserServiceImpl implements UserService { ...@@ -72,8 +72,8 @@ public class UserServiceImpl implements UserService {
private PartnerManager partnerManager; private PartnerManager partnerManager;
// @Autowired // @Autowired
// private CustomerClient customerClient; // private CustomerClient customerClient;
@Autowired // @Autowired
private StoreClient storeClient; // private StoreClient storeClient;
// @Autowired // @Autowired
// private ShortMessageClient shortMessageClient; // private ShortMessageClient shortMessageClient;
// @Autowired // @Autowired
......
...@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.PostMapping; ...@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@FeignClient(name = "CustomerClient", url = "${saas.customertools.feign.url}") @FeignClient(name = "customer-service", url = "${saas.customertools.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"}) @RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface MemberToolsClient { public interface MemberToolsClient {
......
/** ///**
* All rights Reserved, Designed By www.freemud.cn // * All rights Reserved, Designed By www.freemud.cn
* // *
* @Title: StoreController // * @Title: StoreController
* @Package cn.freemud.controller // * @Package cn.freemud.controller
* @Description: // * @Description:
* @author: ping.wu // * @author: ping.wu
* @date: 2018/5/11 19:14 // * @date: 2018/5/11 19:14
* @version V1.0 // * @version V1.0
* @Copyright: 2018 www.freemud.cn Inc. All rights reserved. // * @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目 // * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/ // */
package cn.freemud.service.thirdparty; //package cn.freemud.service.thirdparty;
//
import cn.freemud.entities.dto.*; //import cn.freemud.entities.dto.*;
import org.springframework.cloud.openfeign.FeignClient; //import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType; //import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping; //import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; //import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; //import org.springframework.web.bind.annotation.RequestMapping;
//
@FeignClient(name = "CONSOLE-API",url = "${saas.storeclient.feign.url}") //@FeignClient(name = "CONSOLE-API",url = "${saas.storeclient.feign.url}")
@RequestMapping(produces = {"application/json;charset=UTF-8"}) //@RequestMapping(produces = {"application/json;charset=UTF-8"})
public interface StoreClient { //public interface StoreClient {
//
/** // /**
* 查询附近门店 // * 查询附近门店
* // *
* @param request // * @param request
* @return // * @return
*/ // */
@PostMapping(value = "/api/v2/organization/nearStoreList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) // @PostMapping(value = "/api/v2/organization/nearStoreList", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
StoreBaseResponseDto<StoreListResponseDto> findNearStores(@RequestBody NearStoreRequestDto request); // StoreBaseResponseDto<StoreListResponseDto> findNearStores(@RequestBody NearStoreRequestDto request);
//
/** // /**
* 查询单个门店信息 // * 查询单个门店信息
* // *
* @param request // * @param request
* @return // * @return
*/ // */
@PostMapping(value = "/api/v2/organization/get", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) // @PostMapping(value = "/api/v2/organization/get", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
StoreBaseResponseDto<StoreResponseDto> getStoreInfo(@RequestBody StoreInfoRequestDto request); // StoreBaseResponseDto<StoreResponseDto> getStoreInfo(@RequestBody StoreInfoRequestDto request);
//
/** // /**
* 查询门店轮播图 // * 查询门店轮播图
* // *
* @param request // * @param request
* @return // * @return
*/ // */
@PostMapping(value = "/api/v2/storeImage/list", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) // @PostMapping(value = "/api/v2/storeImage/list", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
StoreBaseResponseDto<StoreImageListResponseDto> findStoreImages(@RequestBody StoreImagesRequestDto request); // StoreBaseResponseDto<StoreImageListResponseDto> findStoreImages(@RequestBody StoreImagesRequestDto request);
} //}
package cn.freemud.client; //package cn.freemud.client;
//
import cn.freemud.entities.dto.*; //import cn.freemud.entities.dto.*;
import cn.freemud.service.thirdparty.StoreClient; //import cn.freemud.service.thirdparty.StoreClient;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.junit.Test; //import org.junit.Test;
import org.junit.runner.RunWith; //import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; //import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest; //import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; //import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients; //import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.test.context.junit4.SpringRunner; //import org.springframework.test.context.junit4.SpringRunner;
//
import java.util.List; //import java.util.List;
//
/** ///**
* All rights Reserved, Designed By www.freemud.cn // * All rights Reserved, Designed By www.freemud.cn
* // *
* @version V1.0 // * @version V1.0
* @Title: StoreClientTest // * @Title: StoreClientTest
* @Package cn.freemud.client // * @Package cn.freemud.client
* @Description: 测试 // * @Description: 测试
* @author: zhenghuan.yang // * @author: zhenghuan.yang
* @date: 2018/6/25 15:41 // * @date: 2018/6/25 15:41
* @Copyright: 2018 www.freemud.cn Inc. All rights reserved. // * @Copyright: 2018 www.freemud.cn Inc. All rights reserved.
* 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目 // * 注意:本内容仅限于上海非码科技内部传阅,禁止外泄以及用于其他的商业目
*/ // */
@Slf4j //@Slf4j
@RunWith(SpringRunner.class) //@RunWith(SpringRunner.class)
@SpringBootTest //@SpringBootTest
@EnableDiscoveryClient //@EnableDiscoveryClient
@EnableFeignClients //@EnableFeignClients
@EnableAutoConfiguration //@EnableAutoConfiguration
public class StoreClientTest { //public class StoreClientTest {
@Autowired // @Autowired
private StoreClient storeClient; // private StoreClient storeClient;
//
/** // /**
* 查询附近门店 // * 查询附近门店
*/ // */
@Test // @Test
public void findNearStores() { // public void findNearStores() {
NearStoreRequestDto nearStoreRequestDto=new NearStoreRequestDto(); // NearStoreRequestDto nearStoreRequestDto=new NearStoreRequestDto();
nearStoreRequestDto.setPartnerId("1832"); // nearStoreRequestDto.setPartnerId("1832");
nearStoreRequestDto.setLatitude("31.269248962402344"); // nearStoreRequestDto.setLatitude("31.269248962402344");
nearStoreRequestDto.setLongitude("121.37284088134766"); // nearStoreRequestDto.setLongitude("121.37284088134766");
nearStoreRequestDto.setActiveFlag("1"); // nearStoreRequestDto.setActiveFlag("1");
nearStoreRequestDto.setTypeFlag("3"); // nearStoreRequestDto.setTypeFlag("3");
nearStoreRequestDto.setPageNo(1); // nearStoreRequestDto.setPageNo(1);
nearStoreRequestDto.setPlaceOrderFlag("1"); // nearStoreRequestDto.setPlaceOrderFlag("1");
nearStoreRequestDto.setPageSize(100); // nearStoreRequestDto.setPageSize(100);
nearStoreRequestDto.setDistance("100000"); // nearStoreRequestDto.setDistance("100000");
StoreBaseResponseDto<StoreListResponseDto> response = storeClient.findNearStores(nearStoreRequestDto); // StoreBaseResponseDto<StoreListResponseDto> response = storeClient.findNearStores(nearStoreRequestDto);
StoreListResponseDto storeListResponseDto=response.getBizVO(); // StoreListResponseDto storeListResponseDto=response.getBizVO();
List<StoreResponseDto> list=storeListResponseDto.getList(); // List<StoreResponseDto> list=storeListResponseDto.getList();
log.info("storeId " + "freeDeliveryPrice "+"deliveryPrice " +"delivery" ); // log.info("storeId " + "freeDeliveryPrice "+"deliveryPrice " +"delivery" );
for (StoreResponseDto store:list){ // for (StoreResponseDto store:list){
String insert="INSERT INTO open_platform_partner_store_delivery_config (`partner_id`, `store_id`, `delivery_limit_amount`, `delivery_amount`, `default_delivery_range`, `add_range_count`, `add_range_amount`, `gmt_created`, `gmt_modified`) VALUES ('"+nearStoreRequestDto.getPartnerId()+"', '"+store.getStoreCode()+"','"+store.getFreeDeliveryPrice()*100+"','"+store.getDeliveryPrice()*100+"', '3000', '3000', '250', '2018-12-13 17:08:25', '2018-12-13 18:15:43');"; // String insert="INSERT INTO open_platform_partner_store_delivery_config (`partner_id`, `store_id`, `delivery_limit_amount`, `delivery_amount`, `default_delivery_range`, `add_range_count`, `add_range_amount`, `gmt_created`, `gmt_modified`) VALUES ('"+nearStoreRequestDto.getPartnerId()+"', '"+store.getStoreCode()+"','"+store.getFreeDeliveryPrice()*100+"','"+store.getDeliveryPrice()*100+"', '3000', '3000', '250', '2018-12-13 17:08:25', '2018-12-13 18:15:43');";
System.out.println(insert); // System.out.println(insert);
/* System.out.println(store.getStoreCode()+" "+store.getFreeDeliveryPrice()+" "+store.getDeliveryPrice()+" "+store.getDelivery());*/ // /* System.out.println(store.getStoreCode()+" "+store.getFreeDeliveryPrice()+" "+store.getDeliveryPrice()+" "+store.getDelivery());*/
} // }
} // }
/** // /**
* 查询单个门店信息 // * 查询单个门店信息
*/ // */
@Test // @Test
public void getStoreInfo() { // public void getStoreInfo() {
StoreInfoRequestDto storeInfoRequestDto=new StoreInfoRequestDto(); // StoreInfoRequestDto storeInfoRequestDto=new StoreInfoRequestDto();
storeInfoRequestDto.setPartnerId("360bb48b-5316-458a-903e-9a44c7f339b1"); // storeInfoRequestDto.setPartnerId("360bb48b-5316-458a-903e-9a44c7f339b1");
storeInfoRequestDto.setStoreCode(""); // storeInfoRequestDto.setStoreCode("");
StoreBaseResponseDto<StoreResponseDto> storeBaseResponseDto = storeClient.getStoreInfo(storeInfoRequestDto); // StoreBaseResponseDto<StoreResponseDto> storeBaseResponseDto = storeClient.getStoreInfo(storeInfoRequestDto);
log.info("storeBaseResponseDto==="+storeBaseResponseDto); // log.info("storeBaseResponseDto==="+storeBaseResponseDto);
} // }
/** // /**
* 查询门店轮播图 // * 查询门店轮播图
*/ // */
@Test // @Test
public void findStoreImages() { // public void findStoreImages() {
StoreImagesRequestDto toreImagesRequestDto=new StoreImagesRequestDto(); // StoreImagesRequestDto toreImagesRequestDto=new StoreImagesRequestDto();
toreImagesRequestDto.setPartnerId("360bb48b-5316-458a-903e-9a44c7f339b1"); // toreImagesRequestDto.setPartnerId("360bb48b-5316-458a-903e-9a44c7f339b1");
toreImagesRequestDto.setBusinessId(""); // toreImagesRequestDto.setBusinessId("");
toreImagesRequestDto.setTypeFlag(1); // toreImagesRequestDto.setTypeFlag(1);
StoreBaseResponseDto<StoreImageListResponseDto> storeBaseResponseDto = storeClient.findStoreImages(toreImagesRequestDto); // StoreBaseResponseDto<StoreImageListResponseDto> storeBaseResponseDto = storeClient.findStoreImages(toreImagesRequestDto);
log.info("storeBaseResponseDto==="+storeBaseResponseDto); // log.info("storeBaseResponseDto==="+storeBaseResponseDto);
} // }
} //}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment