Commit 7d89e4d0 authored by lius's avatar lius

创建了联系客服feign接口,在module下创建了customerservice包下实现联系客服功能

parent cecea8b8
......@@ -44,7 +44,10 @@ public class AuthFilter implements Filter {
"/app/driverBackend/account/stop",
"/app/ownerBackend/account/stop",
"/app/driverBackend/password/reset",
"/app/esvActuator/health/diskSpace"};
"/app/esvActuator/health/diskSpace",
"/app/driverBackend/carrier/customerservice",
"/app/goodsowner/customerservice"
};
@Autowired
private ProtocolComponent protocolComponent;
......
package com.esv.freight.app.feign;
import com.alibaba.fastjson.JSONObject;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @description:
* @project: app-service
* @name: com.esv.freight.app.feign.CustomerServiceInterface
* @author: 刘胜
* @email: <liusheng@esvtek.com>
* @createTime: 2020/8/12 14:13
* @version: 1.0
*/
@FeignClient(value = "freight-customer-service")
public interface CustomerServiceInterface {
/**
* 获取货主客服电话
* author 刘胜
* createTime 2020/8/12 14:15
**/
@PostMapping(value = "/customer/goodsowner/customerservice")
JSONObject ownerCustomer();
/**
* 获取司机客服电话
* author 刘胜
* createTime 2020/8/12 14:17
**/
@PostMapping(value = "/customer/carrier/customerservice")
JSONObject driverCustomer();
}
package com.esv.freight.app.module.customerservice.controller;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.component.TokenComponent;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.feign.CustomerServiceInterface;
import com.esv.freight.app.module.customerservice.vo.CustomerServiceVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description:
* @project: app-service
* @name: com.esv.freight.app.module.customerservice.controller.DriverCustomerServiceController
* @author: 刘胜
* @email: <liusheng@esvtek.com>
* @createTime: 2020/8/12 13:32
* @version: 1.0
*/
@RestController
@RequestMapping("/driverBackend/carrier")
@Slf4j
@Validated
public class DriverCustomerServiceController {
private CustomerServiceInterface customerServiceInterface;
private TokenComponent tokenComponent;
@Autowired
public DriverCustomerServiceController(CustomerServiceInterface customerServiceInterface, TokenComponent tokenComponent) {
this.customerServiceInterface = customerServiceInterface;
this.tokenComponent = tokenComponent;
}
/**
* description 获取司机客服电话
* param []
* return com.esv.freight.app.common.response.EResponse
* author 刘胜
* createTime 2020/8/12 14:50
**/
@PostMapping("/customerservice")
public EResponse driverCustomer(){
JSONObject result =customerServiceInterface.driverCustomer();
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
CustomerServiceVO customerServiceVO = new CustomerServiceVO();
JSONObject data = result.getJSONObject("data");
customerServiceVO.setPhone(data.getString("phone"));
return EResponse.ok(customerServiceVO);
}
}
package com.esv.freight.app.module.customerservice.controller;
import com.alibaba.fastjson.JSONObject;
import com.esv.freight.app.common.component.TokenComponent;
import com.esv.freight.app.common.response.EResponse;
import com.esv.freight.app.feign.CustomerServiceInterface;
import com.esv.freight.app.module.customerservice.vo.CustomerServiceVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @description:
* @project: app-service
* @name: com.esv.freight.app.module.customerservice.controller.OwnerCustomerServiceController
* @author: 刘胜
* @email: <liusheng@esvtek.com>
* @createTime: 2020/8/12 13:31
* @version: 1.0
*/
@RestController
@RequestMapping("/goodsowner")
@Slf4j
@Validated
public class OwnerCustomerServiceController {
private CustomerServiceInterface customerServiceInterface;
@Autowired
public OwnerCustomerServiceController(CustomerServiceInterface customerServiceInterface) {
this.customerServiceInterface = customerServiceInterface;
}
/**
* description 获取货主客服电话
* param []
* return com.esv.freight.app.common.response.EResponse
* author 刘胜
* createTime 2020/8/12 14:35
**/
@PostMapping("/customerservice")
public EResponse ownerCustomer(){
JSONObject result =customerServiceInterface.ownerCustomer();
if(result.getInteger("code") != 200) {
return EResponse.error(result.getInteger("code"), result.getString("message"));
}
CustomerServiceVO customerServiceVO = new CustomerServiceVO();
JSONObject data = result.getJSONObject("data");
customerServiceVO.setPhone(data.getString("phone"));
return EResponse.ok(customerServiceVO);
}
}
package com.esv.freight.app.module.customerservice.vo;
import lombok.Data;
/**
* @description: 客服电话VO
* @project: app-service
* @name: com.esv.freight.app.module.customerservice.vo.CustomerServiceVO
* @author: 刘胜
* @email: <liusheng@esvtek.com>
* @createTime: 2020/8/12 13:26
* @version: 1.0
*/
@Data
public class CustomerServiceVO {
/**
* 客服电话
*/
private String phone;
}
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