123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545 |
- package com.ydd.third.delivery;
- import com.ydd.third.common.exception.BusinessException;
- import com.ydd.third.common.utils.StringUtils;
- import com.ydd.third.common.vo.ResObject;
- import com.ydd.third.common.vo.shop.*;
- import com.ydd.third.common.vo.vo.order.*;
- import com.ydd.third.delivery.aipt.AiptClient;
- import com.ydd.third.delivery.dada.DadaClient;
- import com.ydd.third.delivery.dianwoda.DianwodaClient;
- import com.ydd.third.delivery.fengniao.FengniaoClient;
- import com.ydd.third.delivery.huolala.HuolalaClient;
- import com.ydd.third.delivery.kuaifu.KfClient;
- import com.ydd.third.delivery.meituan.MeituanClient;
- import com.ydd.third.delivery.shansong.ShansongClient;
- import com.ydd.third.delivery.shansong.ShansongSHClient;
- import com.ydd.third.delivery.shunfeng.ShunfengClient;
- import com.ydd.third.delivery.uupt.UuptClient;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- /**
- * @ClassName Client
- * @Deacription TODO
- * @Author peakren
- * @Date 2/4/21 10:20 PM
- * @Version 1.0
- **/
- @Slf4j
- @Service("deliverClient")
- public class Client {
- @Autowired
- MeituanClient dMeituanClient;
- @Autowired
- DadaClient dadaClient;
- // @Autowired
- // FengniaoClient fengniaoClient;
- @Autowired
- FengniaoClient fengniaoClient;
- @Autowired
- ShunfengClient shunfengClient;
- @Autowired
- ShansongSHClient shansongSHClient;
- @Autowired
- ShansongClient shansongClient;
- @Autowired
- DianwodaClient dianwodaClient;
- @Autowired
- UuptClient uuptClient;
- @Autowired
- AiptClient aiptClient;
- @Autowired
- KfClient kfClient;
- @Autowired
- HuolalaClient huolalaClient;
- /**
- * 下订单
- *
- * @param order
- * @return
- */
- public ResObject<OrderResultVo> createOrder(OrderVo order) {
- // 声明公共参数,RequestSysParams构造方法接收两个参数,第一个为signkey,第二个为appAuthToken
- String client = order.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<OrderResultVo> res;
- if (client.equals("meituan")) {
- res = dMeituanClient.createOrder(order);
- } else if (client.equals("meituanzb")) {
- res = dMeituanClient.createOrderZb(order);
- } else if (client.equals("dada")) {
- res = dadaClient.createOrder(order);
- //res = dadaClient.reAddOrder(order);
- }else if (client.equals("dadayz")) {
- res = dadaClient.createOrder(order);
- } else if (client.equals("fengniao")) {
- // res = fengniaoClient.createOrder(order);
- res = fengniaoClient.createOrder(order);
- } else if (client.equals("shansong")) {
- if (order.getIsMine() == 1) {
- res = shansongClient.createOrder(order);
- } else {
- res = shansongSHClient.createOrder(order);
- }
- } else if (client.equals("shunfeng")) {
- res = shunfengClient.createOrder(order);
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaOrderCreate(order);
- } else if (client.equals("uupt")) {
- res = uuptClient.createOrder(order);
- } else if (client.equals("aipt")) {
- res = aiptClient.createOrder(order);
- } else if (client.equals("kuanfu")) {
- res = kfClient.createOrder(order);
- }else if (client.equals("huolala")){
- res = huolalaClient.createOrder(order);
- }
- else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 查询订单运费/预下单
- *
- * @param order
- * @return
- */
- public ResObject<OrderResultVo> queryOrderDeliverFee(OrderVo order) {
- // 声明公共参数,RequestSysParams构造方法接收两个参数,第一个为signkey,第二个为appAuthToken
- String client = order.getLbClient(); // jsonParams.getString("lb_client");
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lb_client参数");
- }
- ResObject<OrderResultVo> res = null;
- if (client.equals("meituan")) {
- res = dMeituanClient.queryOrderDeliverFee(order);
- } else if (client.equals("meituanzb")) {
- res = dMeituanClient.queryOrderDeliverZbFee(order);
- } else if (client.equals("dada")) {
- res = dadaClient.queryOrderDeliverFee(order);
- } else if (client.equals("dadayz")) {
- res = dadaClient.queryOrderDeliverFee(order);
- } else if (client.equals("fengniao")) {
- //res = fengniaoClient.queryPrice(jsonParamsStr);
- res = fengniaoClient.queryOrderDeliverFee(order);
- } else if (client.equals("shansong")) {
- //res = shansongClient.orderCalculate(order); //订单计费
- if (order.getIsMine() == 1) {
- res = shansongClient.queryOrderDeliverFee(order); //订单计费
- } else {
- res = shansongSHClient.queryOrderDeliverFee(order); //订单计费
- }
- } else if (client.equals("shunfeng")) {
- res = shunfengClient.queryOrderDeliverFee(order);
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaEstimateCost(order);
- } else if (client.equals("uupt")) {
- res = uuptClient.queryOrderDeliverFee(order);
- } else if (client.equals("aipt")) {
- res = aiptClient.queryOrderDeliverFee(order);
- } else if (client.equals("kuanfu")){
- res = kfClient.queryOrderDeliverFee(order);
- } else if (client.equals("huolala")){
- res =huolalaClient.queryOrderDeliverFee(order);
- }
- else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 取消订单
- *
- * @param cancelOrderVo
- * @return
- */
- public ResObject<CancelOrderResultVo> cancelOrder(CancelOrderVo cancelOrderVo) {
- String client = cancelOrderVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<CancelOrderResultVo> res = null;
- if (client.equals("meituan")) {
- res = dMeituanClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("meituanzb")) {
- res = dMeituanClient.cancelZbOrder(cancelOrderVo);
- } else if (client.equals("dada")) {
- res = dadaClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("dadayz")) {
- res = dadaClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("fengniao")) {
- // res = fengniaoClient.cancelOrder(cancelOrderVo);
- res = fengniaoClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("shansong")) {
- if (cancelOrderVo.getIsShansongSH()) {
- res = shansongClient.cancelOrder(cancelOrderVo);//商户,老吴命名错误
- } else {
- res = shansongSHClient.cancelOrder(cancelOrderVo);
- }
- } else if (client.equals("shunfeng")) {
- res = shunfengClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaCancelOrder(cancelOrderVo);
- } else if (client.equals("uupt")) {
- res = uuptClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("aipt")) {
- res = aiptClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("kuanfu")) {
- res = kfClient.cancelOrder(cancelOrderVo);
- } else if (client.equals("huolala")){
- res =huolalaClient.cancelOrder(cancelOrderVo);
- }
- else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 增加小费
- *
- * @param orderTipsVo
- * @return
- */
- public ResObject<OrderTipsResultVo> orderAddTip(OrderTipsVo orderTipsVo) {
- String client = orderTipsVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<OrderTipsResultVo> res = null;
- if (client.equals("meituan")) {
- // res = dMeituanClient.orderAddTip(orderTipsVo);
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("美团配送不支持加小费接口");
- } else if (client.equals("dada")) {
- res = dadaClient.orderAddTip(orderTipsVo);
- } else if (client.equals("dadayz")) {
- res = dadaClient.orderAddTip(orderTipsVo);
- } else if (client.equals("fengniao")) {
- res = fengniaoClient.orderAddTip(orderTipsVo);
- } else if (client.equals("shansong")) {
- if (orderTipsVo.getIsShansongSH()) {
- res = shansongClient.orderAddTip(orderTipsVo); //加价接口
- } else {
- res = shansongSHClient.orderAddTip(orderTipsVo); //加价接口
- }
- } else if (client.equals("shunfeng")) {
- res = shunfengClient.orderAddTip(orderTipsVo);
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaAddTips(orderTipsVo);
- } else if (client.equals("uupt")) {
- res = uuptClient.orderAddTip(orderTipsVo);
- } else if (client.equals("kuanfu")) {
- res = kfClient.orderAddTip(orderTipsVo);
- } else if (client.equals("huolala")){
- res =huolalaClient.orderAddTip(orderTipsVo);
- }
- else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 订单查询
- *
- * @param orderQueryVo
- * @return
- */
- public ResObject<OrderQueryResultVo> queryOrderInfo(OrderQueryVo orderQueryVo) {
- String client = orderQueryVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<OrderQueryResultVo> res;
- if (client.equals("meituan")) {
- res = dMeituanClient.queryOrderInfo(orderQueryVo);
- } else if (client.equals("dada")) {
- res = dadaClient.queryOrderInfo(orderQueryVo);
- } else if (client.equals("dadayz")) {
- res = dadaClient.queryOrderInfo(orderQueryVo);
- } else if (client.equals("fengniao")) {
- // res = fengniaoClient.queryOrder(orderQueryVo);
- res = fengniaoClient.queryOrderInfo(orderQueryVo);
- } else if (client.equals("shansong")) {
- if (orderQueryVo.getIsShansongSH()) {
- res = shansongClient.queryOrderInfo(orderQueryVo);
- } else {
- res = shansongSHClient.queryOrderInfo(orderQueryVo);
- }
- } else if (client.equals("shunfeng")) {
- res = shunfengClient.queryOrderInfo(orderQueryVo);
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaOrderQuery(orderQueryVo);
- } else if (client.equals("uupt")) {
- res = uuptClient.queryOrderInfo(orderQueryVo);
- } else if (client.equals("aipt")) {
- res = aiptClient.queryOrderInfo(orderQueryVo);
- }else if (client.equals("kuanfu")) {
- res = kfClient.queryOrderInfo(orderQueryVo);
- }else if (client.equals("huolala")) {
- res = huolalaClient.queryOrderInfo(orderQueryVo);
- } else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 获取骑手当前位置(信息)
- *
- * @param riderLocationVo
- * @return
- */
- public ResObject<RiderLocationResultVo> getRiderLocation(RiderLocationVo riderLocationVo) {
- String client = riderLocationVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<RiderLocationResultVo> res = null;
- if (client.equals("meituan")) {
- res = dMeituanClient.getRiderLocation(riderLocationVo);
- } else if (client.equals("dada")) {
- riderLocationVo.setIsDirectDelivery(0);
- res = dadaClient.getRiderLocation(riderLocationVo);
- } else if (client.equals("dadayz")) {
- riderLocationVo.setIsDirectDelivery(1);
- res = dadaClient.getRiderLocation(riderLocationVo);
- } else if (client.equals("fengniao")) {
- //res = fengniaoClient.queryCarrier(riderLocationVo);
- res = fengniaoClient.getRiderLocation(riderLocationVo);
- } else if (client.equals("shansong")) {
- if (riderLocationVo.getIsShansongSH()) {
- res = shansongClient.getRiderLocation(riderLocationVo); //加价接口
- } else {
- res = shansongSHClient.getRiderLocation(riderLocationVo); //加价接口
- }
- } else if (client.equals("shunfeng")) {
- res = shunfengClient.getRiderLocation(riderLocationVo);
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaQueryPosition(riderLocationVo);
- } else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 创建门店
- *
- * @param shopVo
- * @return
- */
- public ResObject<ShopResultVo> createShop(ShopVo shopVo) {
- String client = shopVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<ShopResultVo> res = null;
- if (client.equals("meituan")) {
- res = dMeituanClient.createShop(shopVo);
- } else if (client.equals("meituanzb")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("众包没有相应的接口");
- } else if (client.equals("dada")) {
- shopVo.setIsDirectDelivery(0);
- res = dadaClient.createShop(shopVo);
- } else if (client.equals("dadayz")) {
- shopVo.setIsDirectDelivery(1);
- res = dadaClient.createShop(shopVo);
- } else if (client.equals("fengniao")) {
- //res =fengniaoClient.addChainStore(shopVo);
- res = fengniaoClient.createShop(shopVo);
- } else if (client.equals("shansong")) {
- if (shopVo.getIsShansongSH()) {
- res = shansongClient.createShop(shopVo);
- } else {
- res = shansongSHClient.createShop(shopVo);
- }
- } else if (client.equals("shunfeng")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("顺丰没有相应的接口");
- //顺丰没有相应的接口
- // return null;
- } else if (client.equals("uupt")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("UU跑腿没有相应的接口");
- } else if (client.equals("kuanfu")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("快服没有相应的接口");
- } else if (client.equals("dwd")) {
- res = dianwodaClient.dianwodaCreateShop(shopVo);
- } else if (client.equals("huolala")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("货拉拉没有相应的接口");
- } else {
- //顺丰没有相应的接口
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 更新门店
- *
- * @param shopVo
- * @return
- */
- public ResObject<ShopResultVo> updateShop(ShopVo shopVo) {
- String client = shopVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<ShopResultVo> res = null;
- if (client.equals("meituan")) {
- res = dMeituanClient.updateShop(shopVo);
- }else if (client.equals("meituanzb")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("众包没有相应的接口");
- } else if (client.equals("dada")) {
- shopVo.setIsDirectDelivery(0);
- res = dadaClient.updateShop(shopVo);
- } else if (client.equals("dadayz")) {
- shopVo.setIsDirectDelivery(1);
- res = dadaClient.updateShop(shopVo);
- } else if (client.equals("fengniao")) {
- res = fengniaoClient.updateShop(shopVo);
- } else if (client.equals("shansong")) {
- if (shopVo.getIsShansongSH()) {
- res = shansongClient.createShop(shopVo);
- } else {
- res = shansongSHClient.createShop(shopVo);
- }
- } else if (client.equals("shunfeng")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("顺丰没有相应的接口");
- //顺丰没有相应的接口
- } else if (client.equals("huolala")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("货拉拉没有相应的接口");
- //顺丰没有相应的接口
- } else {
- throw new BusinessException("lb_client参数不正确");
- }
- return res;
- }
- /**
- * 查询门店
- *
- * @param shopQueryVo
- * @return
- */
- public ResObject<ShopQueryResultVo> queryShop(ShopQueryVo shopQueryVo) {
- //JSONObject jsonParams = JSONObject.parseObject(jsonParamsStr);
- String client = shopQueryVo.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<ShopQueryResultVo> res = null;
- if (client.equals("meituan")) {
- res = dMeituanClient.queryShop(shopQueryVo);
- } else if (client.equals("dada")) {
- shopQueryVo.setIsDirectDelivery(0);
- res = dadaClient.queryShop(shopQueryVo);
- } else if (client.equals("dadayz")) {
- shopQueryVo.setIsDirectDelivery(1);
- res = dadaClient.queryShop(shopQueryVo);
- } else if (client.equals("fengniao")) {
- // res = fengniaoClient.queryChainStore(shopQueryVo);
- res = fengniaoClient.queryShop(shopQueryVo);
- } else if (client.equals("shansong")) {
- if (shopQueryVo.getIsShansongSH()) {
- res = shansongClient.queryShop(shopQueryVo);
- } else {
- res = shansongSHClient.queryShop(shopQueryVo);
- }
- } else if (client.equals("shunfeng")) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg("顺丰没有相应的接口");
- } else {
- throw new BusinessException("lbClient参数不正确");
- }
- return res;
- }
- /**
- * 查询商户余额
- *
- * @param queryAmount
- * @return
- */
- public ResObject<AmountResultVo> queryAmount(QueryAmount queryAmount) {
- String client = queryAmount.getLbClient();
- if (StringUtils.isBlank(client)) {
- throw new BusinessException("未指定lbClient参数");
- }
- ResObject<AmountResultVo> res = null;
- String msg = "";
- if (client.equals("meituan")) {
- msg = "美团没有相应的接口";
- } else if (client.equals("meituanzb")) {
- msg = "美团众包没有相应的接口";
- } else if (client.equals("dada")) {
- queryAmount.setIsDirectDelivery(0);
- res = dadaClient.queryAmount(queryAmount);
- } else if (client.equals("dadayz")) {
- queryAmount.setIsDirectDelivery(1);
- res = dadaClient.queryAmount(queryAmount);
- } else if (client.equals("fengniao")) {
- // res = fengniaoClient.queryOrder(orderQueryVo);
- res = fengniaoClient.queryAmount(queryAmount);
- } else if (client.equals("shansong")) {
- if (queryAmount.getIsShansongSH()) {
- res = shansongClient.queryAmount(queryAmount);
- } else {
- res = shansongSHClient.queryAmount(null);
- }
- } else if (client.equals("shunfeng")) {
- msg = "顺丰没有相应的接口";
- } else if (client.equals("dwd")) {
- msg = "dwd没有相应的接口";
- } else if (client.equals("uupt")) {
- res = uuptClient.queryAmount(queryAmount);
- } else if (client.equals("aipt")) {
- res = aiptClient.queryAmount(queryAmount);
- }else if (client.equals("kuanfu")) {
- msg = "快服没有相应的接口";
- } else {
- throw new BusinessException("lbClient参数不正确");
- }
- if (null == res) {
- res = new ResObject<>();
- res.setCode(1);
- res.setMsg(msg);
- }
- return res;
- }
- }
|