wangtao 3 vuotta sitten
vanhempi
commit
20dcecb794

+ 119 - 119
lb-app/src/main/java/com/ydd/app/controller/TestApi.java

@@ -1,78 +1,78 @@
-package com.ydd.app.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.ydd.app.service.ApiOrderService;
-import com.ydd.app.service.ApiProductService;
-import com.ydd.app.service.ApiShopService;
-import com.ydd.app.service.ApiWaimaiService;
-import com.ydd.common.core.controller.BaseController;
-import com.ydd.common.core.domain.BaseResult;
-import com.ydd.module.producer.RabbitSender;
-import com.ydd.module.push.MessagePushService;
-import com.ydd.module.service.*;
-import com.ydd.third.common.config.DeliveryConfig;
-import com.ydd.third.common.utils.meituan.sign.SignHelper;
-import com.ydd.third.common.utils.meituan.util.HttpClient;
-import com.ydd.third.common.vo.ResObject;
-import io.swagger.annotations.Api;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Map;
-//
-//
-///**
-// * 测试接口
-// */
-@Api(value = "测试", tags = {"测试接口"})
-@RestController
-@RequestMapping("/app/test")
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
-@Slf4j
-public class TestApi extends BaseController {
-
-
-    private final IOrderService iOrderService;
-    private final IShopService iShopService;
-    private final IWaimaiOrderService iWaimaiOrderService;
-    private final ITempService iTempService;
-    private final ApiProductService apiProductService;
-    private final IDspDeliveryService iDspDeliveryService;
-    private final IOrderLogService iOrderLogService;
-
-    private final ApiWaimaiService apiWaimaiService;
-    @Resource
-    private DeliveryConfig appConfig;
-    @Resource
-    private IProfitsDetailService iProfitsDetailService;
-    private final ApiOrderService apiOrderService;
-
-    private final MessagePushService messagePushService;
-
-    private final IShopDeliveryService iShopDeliveryService;
-    private final IMerchantService iMerchantService;
-    private final IMerchantCategoryService iMerchantCategoryService;
-    private final ApiShopService apiShopService;
-    private final IShopThirdService iShopThirdService;
-    private final IHuoLaLaCityService iHuoLaLaCityService;
-
-    @Resource
-    private IOrderDeliveryService iOrderDeliveryService;
-    @Resource
-    private IAgentService iAgentService;
-    @Resource
-    private IDspConfigService iDspConfigService;
-    @Resource
-    private RedisTemplate redisTemplate;
-    @Resource
-    private  RabbitSender rabbitSender;
+//package com.ydd.app.controller;
+//
+//import com.alibaba.fastjson.JSONObject;
+//import com.ydd.app.service.ApiOrderService;
+//import com.ydd.app.service.ApiProductService;
+//import com.ydd.app.service.ApiShopService;
+//import com.ydd.app.service.ApiWaimaiService;
+//import com.ydd.common.core.controller.BaseController;
+//import com.ydd.common.core.domain.BaseResult;
+//import com.ydd.module.producer.RabbitSender;
+//import com.ydd.module.push.MessagePushService;
+//import com.ydd.module.service.*;
+//import com.ydd.third.common.config.DeliveryConfig;
+//import com.ydd.third.common.utils.meituan.sign.SignHelper;
+//import com.ydd.third.common.utils.meituan.util.HttpClient;
+//import com.ydd.third.common.vo.ResObject;
+//import io.swagger.annotations.Api;
+//import lombok.RequiredArgsConstructor;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.data.redis.core.RedisTemplate;
+//import org.springframework.web.bind.annotation.RequestMapping;
+//import org.springframework.web.bind.annotation.RequestMethod;
+//import org.springframework.web.bind.annotation.RestController;
+//
+//import javax.annotation.Resource;
+//import java.util.HashMap;
+//import java.util.Map;
+////
+////
+/////**
+//// * 测试接口
+//// */
+//@Api(value = "测试", tags = {"测试接口"})
+//@RestController
+//@RequestMapping("/app/test")
+//@RequiredArgsConstructor(onConstructor_ = @Autowired)
+//@Slf4j
+//public class TestApi extends BaseController {
+//
+//
+//    private final IOrderService iOrderService;
+//    private final IShopService iShopService;
+//    private final IWaimaiOrderService iWaimaiOrderService;
+//    private final ITempService iTempService;
+//    private final ApiProductService apiProductService;
+//    private final IDspDeliveryService iDspDeliveryService;
+//    private final IOrderLogService iOrderLogService;
+//
+//    private final ApiWaimaiService apiWaimaiService;
+//    @Resource
+//    private DeliveryConfig appConfig;
+//    @Resource
+//    private IProfitsDetailService iProfitsDetailService;
+//    private final ApiOrderService apiOrderService;
+//
+//    private final MessagePushService messagePushService;
+//
+//    private final IShopDeliveryService iShopDeliveryService;
+//    private final IMerchantService iMerchantService;
+//    private final IMerchantCategoryService iMerchantCategoryService;
+//    private final ApiShopService apiShopService;
+//    private final IShopThirdService iShopThirdService;
+//    private final IHuoLaLaCityService iHuoLaLaCityService;
+//
+//    @Resource
+//    private IOrderDeliveryService iOrderDeliveryService;
+//    @Resource
+//    private IAgentService iAgentService;
+//    @Resource
+//    private IDspConfigService iDspConfigService;
+//    @Resource
+//    private RedisTemplate redisTemplate;
+//    @Resource
+//    private  RabbitSender rabbitSender;
 //    /****************  配送询价(预下单) *************************************/
 //    /**
 //     * 达达询价
@@ -1490,49 +1490,49 @@ public class TestApi extends BaseController {
 //    /**
 //     * 美团配送模拟接单
 //     */
-    @RequestMapping(value = "/orderArrangeMeiTuan", method = RequestMethod.POST)
-    public BaseResult<ResObject> orderArrangeMeiTuan(String orderSn, String mtPeisongId, Integer type) throws Exception {
-        Map<String, String> bizMap = new HashMap<>();
-        bizMap.put("delivery_id", orderSn);
-        bizMap.put("mt_peisong_id", mtPeisongId);
-        Map<String, String> params = new HashMap<>(8);
-        Long timestamp = System.currentTimeMillis() / 1000;
-        params.put("charset", "utf-8");
-        params.put("timestamp", String.valueOf(timestamp));
-        params.put("version", "2");
-        params.put("developerId", appConfig.getMeituanDeveloperId());
-        params.put("businessId", String.valueOf(appConfig.getMeituanBusinessId()));
-        params.put("biz", JSONObject.toJSONString(bizMap));
-        String sign = SignHelper.generateSign(params, appConfig.getMeituanSignKey());
-        params.put("sign", sign);
-        String url = "https://api-open-cater.meituan.com/peisong/test/orderArrange";
-        if (type == 1) {
-            url = "https://api-open-cater.meituan.com/peisong/test/orderPickup";//取货
-        }
-        if (type == 2) {
-            url = "https://api-open-cater.meituan.com/peisong/test/orderDeliver";//送达
-        }
-        if (type == 3) {
-            url = "https://api-open-cater.meituan.com/peisong/test/orderRearrange";//改派
-        }
-        if (type == 4) {
-            url = "https://api-open-cater.meituan.com/peisong/test/orderReportException";//模拟骑手上传异常
-        }
-        try {
-            if (type != 4){
-                log.info("*************美团模拟接单:" + JSONObject.toJSONString(params));
-                String res = HttpClient.post(url, params);
-                log.info("*************美团模拟接单返回---->>>>>:" + JSONObject.toJSONString(res));
-            }else {
-                log.info("*************美团模拟骑手上传异常:" + JSONObject.toJSONString(params));
-                String res = HttpClient.post(url, params);
-                log.info("*************美团模拟骑手上传异常---->>>>>:" + JSONObject.toJSONString(res));
-            }
-        } catch (Exception e) {
-            throw e;
-        }
-        return BaseResult.success();
-    }
+//    @RequestMapping(value = "/orderArrangeMeiTuan", method = RequestMethod.POST)
+//    public BaseResult<ResObject> orderArrangeMeiTuan(String orderSn, String mtPeisongId, Integer type) throws Exception {
+//        Map<String, String> bizMap = new HashMap<>();
+//        bizMap.put("delivery_id", orderSn);
+//        bizMap.put("mt_peisong_id", mtPeisongId);
+//        Map<String, String> params = new HashMap<>(8);
+//        Long timestamp = System.currentTimeMillis() / 1000;
+//        params.put("charset", "utf-8");
+//        params.put("timestamp", String.valueOf(timestamp));
+//        params.put("version", "2");
+//        params.put("developerId", appConfig.getMeituanDeveloperId());
+//        params.put("businessId", String.valueOf(appConfig.getMeituanBusinessId()));
+//        params.put("biz", JSONObject.toJSONString(bizMap));
+//        String sign = SignHelper.generateSign(params, appConfig.getMeituanSignKey());
+//        params.put("sign", sign);
+//        String url = "https://api-open-cater.meituan.com/peisong/test/orderArrange";
+//        if (type == 1) {
+//            url = "https://api-open-cater.meituan.com/peisong/test/orderPickup";//取货
+//        }
+//        if (type == 2) {
+//            url = "https://api-open-cater.meituan.com/peisong/test/orderDeliver";//送达
+//        }
+//        if (type == 3) {
+//            url = "https://api-open-cater.meituan.com/peisong/test/orderRearrange";//改派
+//        }
+//        if (type == 4) {
+//            url = "https://api-open-cater.meituan.com/peisong/test/orderReportException";//模拟骑手上传异常
+//        }
+//        try {
+//            if (type != 4){
+//                log.info("*************美团模拟接单:" + JSONObject.toJSONString(params));
+//                String res = HttpClient.post(url, params);
+//                log.info("*************美团模拟接单返回---->>>>>:" + JSONObject.toJSONString(res));
+//            }else {
+//                log.info("*************美团模拟骑手上传异常:" + JSONObject.toJSONString(params));
+//                String res = HttpClient.post(url, params);
+//                log.info("*************美团模拟骑手上传异常---->>>>>:" + JSONObject.toJSONString(res));
+//            }
+//        } catch (Exception e) {
+//            throw e;
+//        }
+//        return BaseResult.success();
+//    }
 //
 //    /**
 //     * 美团众包-查询配送费
@@ -4389,4 +4389,4 @@ public class TestApi extends BaseController {
 //        return BaseResult.success(result);
 //    }
 //
-}
+//}

+ 0 - 67
lb-third/lb-third-common/src/main/java/com/ydd/third/common/utils/meituan/sign/SignHelper.java

@@ -1,67 +0,0 @@
-package com.ydd.third.common.utils.meituan.sign;
-
-
-import com.ydd.third.common.utils.meituan.util.SHA1Util;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.UnsupportedEncodingException;
-import java.security.NoSuchAlgorithmException;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * 签名计算工具类
- */
-public class SignHelper {
-    private static final Log logger = LogFactory.getLog(SignHelper.class);
-
-    public static String generateSign(Map<String, String> params, String secret) throws NoSuchAlgorithmException, UnsupportedEncodingException {
-        String encodeString = getEncodeString(params, secret);
-        logger.info(String.format("encodeString: %s", encodeString));
-        String sign = generateSign(encodeString);
-        logger.info(String.format("generateSign: %s", sign));
-        return sign;
-    }
-
-    private static String getEncodeString(Map<String, String> params, String secret) {
-        Iterator<String> keyIter = params.keySet().iterator();
-        Set<String> sortedParams = new TreeSet<>();
-        while (keyIter.hasNext()) {
-            sortedParams.add(keyIter.next());
-        }
-
-        StringBuilder strB = new StringBuilder(secret);
-
-        // 排除sign和空值参数
-        for (String key : sortedParams) {
-            if (key.equals("sign")) {
-                continue;
-            }
-
-            String value = params.get(key);
-
-            if (StringUtils.isNotEmpty(value)) {
-                strB.append(key).append(value);
-            }
-        }
-        return strB.toString();
-    }
-
-    private static String generateSign(String content) throws NoSuchAlgorithmException, UnsupportedEncodingException {
-        return SHA1Util.Sha1(content).toLowerCase();
-    }
-
-    /**
-     * 校验请求响应sign
-     *
-     * @param secret secretKey
-     * @param params 参数列表
-     */
-    public static boolean checkSign(String secret, Map<String, String> params) throws NoSuchAlgorithmException, UnsupportedEncodingException{
-        return params.containsKey("sign") && params.get("sign").equals(generateSign(params,secret));
-    }
-}

+ 0 - 145
lb-third/lb-third-common/src/main/java/com/ydd/third/common/utils/meituan/util/CoordinateUtil.java

@@ -1,145 +0,0 @@
-package com.ydd.third.common.utils.meituan.util;
-
-import com.google.common.primitives.Ints;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
-import org.springframework.util.StringUtils;
-
-import java.awt.*;
-import java.util.List;
-
-/**
- * Created by majing06 on 2019/1/11.
- */
-public class CoordinateUtil {
-    private static final Log logger = LogFactory.getLog(CoordinateUtil.class);
-
-    /**
-     * 判断坐标是否在电子围栏范围内
-     *
-     * @param latitude
-     * @param longitude
-     * @param shippingArea
-     * @return
-     */
-    public static boolean isInPolygonalArea(long latitude, long longitude, String shippingArea) {
-        if (!StringUtils.hasText(shippingArea)) {
-            return false;
-        }
-
-        //处理输入为json的情况
-        if (shippingArea.indexOf('{') != -1) {
-            try {
-                ObjectMapper objectMapper = new ObjectMapper();
-                JsonNode node = objectMapper.readTree(shippingArea);
-                List<ShippingAreaPoint> shippingAreaPointList = objectMapper.readValue(node, new TypeReference<List<ShippingAreaPoint>>() {
-                });
-                Polygon polygon = new Polygon();
-                for (ShippingAreaPoint point : shippingAreaPointList) {
-                    if (!StringUtils.hasText(point.getX()) || !isNumeric(point.getX()) || !StringUtils.hasText(point.getY()) || !isNumeric(point.getY())) {
-                        continue;
-                    }
-                    polygon.addPoint(((Long) Long.parseLong(point.getX())).intValue(), ((Long) Long.parseLong(point.getY())).intValue());
-                }
-
-                if (polygon.contains(((Long) latitude).intValue(), ((Long) longitude).intValue())) {
-                    return true;
-                }
-                return false;
-
-            } catch (Exception e) {
-                logger.error("isInPolygonalArea# check point in polygonal area failed! ", e);
-                return false;
-            }
-        }
-
-        try {
-            //处理输入为非json的情况
-            String[] polyvertexs = shippingArea.split(":");
-            outer:
-            for (String polyvertex : polyvertexs) {
-                String[] vertexs = removeBrackets(polyvertex).split(";");
-                if (vertexs.length < 1) {
-                    continue;
-                }
-
-                Polygon polygon = new Polygon();
-                for (String vertex : vertexs) {
-                    String[] point = vertex.split(",");
-                    if (point.length < 2 || !StringUtils.hasText(point[0].trim()) || !StringUtils.hasText(point[1].trim()) ||
-                            (Ints.tryParse(point[0].trim()) == null) || (Ints.tryParse(point[1].trim()) == null)) {
-                        continue outer;
-                    }
-                    polygon.addPoint(((Long) Long.parseLong(point[0].trim())).intValue(), ((Long) Long.parseLong(point[1].trim())).intValue());
-                }
-
-                if (polygon.contains(((Long) latitude).intValue(), ((Long) longitude).intValue())) {
-                    return true;
-                }
-            }
-
-            return false;
-        } catch (Exception e) {
-            logger.error("isInPolygonalArea# check point in polygonal area failed! ", e);
-            return false;
-        }
-    }
-
-    public static String removeBrackets(String str) {
-        int start = str.indexOf('(');
-        if (start == -1) {
-            start = 0;
-        } else {
-            start = start + 1;
-        }
-
-        int end = str.lastIndexOf(')');
-        if (end == -1) {
-            end = str.length();
-        }
-
-        return str.substring(start, end);
-    }
-
-    public static boolean isNumeric(String str) {
-        return str.matches("-?\\d+(\\.\\d+)?");  //match a number with optional '-' and decimal.
-    }
-
-    public static class ShippingAreaPoint {
-        private String x; //longitude
-        private String y; //latitude
-
-        public String getX() {
-            return x;
-        }
-
-        public void setX(String x) {
-            this.x = x;
-        }
-
-        public String getY() {
-            return y;
-        }
-
-        public void setY(String y) {
-            this.y = y;
-        }
-
-        @Override
-        public String toString() {
-            return "ShippingAreaPoint{" +
-                    "x='" + x + '\'' +
-                    ", y='" + y + '\'' +
-                    '}';
-        }
-    }
-
-    public static void main(String[] args) {
-//        String s = "[{\"x\":39984996,\"y\":116305754},{\"x\":39985407,\"y\":116324658},{\"x\":39981050,\"y\":116324873},{\"x\":39980877,\"y\":116316901},{\"x\":39982620,\"y\":116316783},{\"x\":39982382,\"y\":116305904},{\"x\":39982365,\"y\":116305904}]";
-        String s = "[{\"x\":39978929,\"y\":116308522},{\"x\":39977704,\"y\":116309026},{\"x\":39975829,\"y\":116309091},{\"x\":39976298,\"y\":116325088},{\"x\":39980984,\"y\":116324873},{\"x\":39980795,\"y\":116316901},{\"x\":39978773,\"y\":116317105},{\"x\":39978682,\"y\":116313007}]";
-        System.out.println(isInPolygonalArea(39980836, 116320024, s));
-    }
-}

+ 0 - 32
lb-third/lb-third-common/src/main/java/com/ydd/third/common/utils/meituan/util/DateUtil.java

@@ -1,32 +0,0 @@
-package com.ydd.third.common.utils.meituan.util;
-
-import java.util.Date;
-
-/**
- * 时间戳处理类
- */
-public class DateUtil {
-
-    /**
-     * 返回当前时间的秒数
-     *
-     * @return
-     */
-    public static int unixTime() {
-        return (int) (System.currentTimeMillis() / 1000);
-    }
-
-    /**
-     * 把表转换为Date
-     *
-     * @param seconds
-     * @return
-     */
-    public static Date fromUnixTime(Integer seconds) {
-        return new Date(seconds * 1000L);
-    }
-
-    public static Date fromUnixTime(Long seconds) {
-        return new Date(seconds * 1000L);
-    }
-}

+ 0 - 161
lb-third/lb-third-common/src/main/java/com/ydd/third/common/utils/meituan/util/HttpClient.java

@@ -1,161 +0,0 @@
-package com.ydd.third.common.utils.meituan.util;
-
-import com.alibaba.fastjson.JSON;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.http.Consts;
-import org.apache.http.HttpEntity;
-import org.apache.http.StatusLine;
-import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.impl.client.CloseableHttpClient;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import static org.apache.http.impl.client.HttpClients.createDefault;
-
-/**
- * 发送Http请求工具类
- */
-public class HttpClient {
-
-    private static final int DEFAULT_TIMEOUT = 10000;
-    private static final Log logger = LogFactory.getLog(HttpClient.class);
-
-    /**
-     * post 方法
-     *
-     * @param url
-     * @param params
-     * @return
-     * @throws IOException
-     */
-    public static String post(String url, Map<String, String> params) throws IOException {
-        if (StringUtils.isEmpty(url) || params == null || params.isEmpty()) {
-            return "";
-        }
-
-        CloseableHttpClient httpClient = createDefault();
-        CloseableHttpResponse response = null;
-        String result = null;
-
-        try {
-            HttpPost httpPost = new HttpPost(url);
-            RequestConfig requestConfig = RequestConfig
-                    .custom()
-                    .setSocketTimeout(DEFAULT_TIMEOUT)
-                    .setConnectTimeout(DEFAULT_TIMEOUT)
-                    .build();//设置请求和传输超时时间
-
-            httpPost.setConfig(requestConfig);
-            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
-
-            List<BasicNameValuePair> basicNameValuePairs = new ArrayList<>();
-            for (Map.Entry<String, String> entity : params.entrySet()) {
-                basicNameValuePairs.add(new BasicNameValuePair(entity.getKey(), entity.getValue()));
-            }
-
-            UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(basicNameValuePairs, Consts.UTF_8);
-            httpPost.setEntity(urlEncodedFormEntity);
-
-            response = httpClient.execute(httpPost);
-            StatusLine statusLine = response.getStatusLine();
-            logger.info(String.format("request url: %s, params: %s, response status: %s",
-                    url, JSON.toJSONString(params), statusLine.getStatusCode()));
-
-            HttpEntity entity = response.getEntity();
-            result = EntityUtils.toString(entity, Consts.UTF_8);
-            logger.info(String.format("response data: %s", result));
-
-            return result == null ? "" : result.trim();
-
-        } catch (IOException e) {
-            throw e;
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                if (httpClient != null) {
-                    httpClient.close();
-                }
-            } catch (IOException e) {
-                logger.error("close http client failed", e);
-            }
-        }
-
-    }
-
-    /**
-     * 调用post请求接口
-     * @param url
-     * @param params
-     * @return
-     * @throws IOException
-     */
-    public static String zbPost(String url, Map<String, String> params) throws IOException {
-        if (StringUtils.isEmpty(url) || params == null || params.isEmpty()) {
-            return "";
-        }
-
-        CloseableHttpClient httpClient = createDefault();
-        CloseableHttpResponse response = null;
-        String result = null;
-
-        try {
-            HttpPost httpPost = new HttpPost(url);
-            RequestConfig requestConfig = RequestConfig
-                    .custom()
-                    .setSocketTimeout(DEFAULT_TIMEOUT)
-                    .setConnectTimeout(DEFAULT_TIMEOUT)
-                    .build();//设置请求和传输超时时间
-
-            httpPost.setConfig(requestConfig);
-            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
-
-            List<BasicNameValuePair> basicNameValuePairs = new ArrayList<>();
-            for (Map.Entry<String, String> entity : params.entrySet()) {
-                basicNameValuePairs.add(new BasicNameValuePair(entity.getKey(), entity.getValue()));
-            }
-
-            UrlEncodedFormEntity urlEncodedFormEntity = new UrlEncodedFormEntity(basicNameValuePairs, Consts.UTF_8);
-            httpPost.setEntity(urlEncodedFormEntity);
-
-            response = httpClient.execute(httpPost);
-            StatusLine statusLine = response.getStatusLine();
-            logger.info(String.format("request url: %s, params: %s, response status: %s",
-                    url, JSON.toJSONString(params), statusLine.getStatusCode()));
-
-            HttpEntity entity = response.getEntity();
-            result = EntityUtils.toString(entity, Consts.UTF_8);
-            logger.info(String.format("response data: %s", result));
-
-            return result == null ? "" : result.trim();
-
-        } catch (IOException e) {
-            throw e;
-        } finally {
-            try {
-                if (response != null) {
-                    response.close();
-                }
-                if (httpClient != null) {
-                    httpClient.close();
-                }
-            } catch (IOException e) {
-                logger.error("close http client failed", e);
-            }
-        }
-
-    }
-
-}
-

+ 0 - 330
lb-third/lb-third-common/src/main/java/com/ydd/third/common/utils/meituan/util/ParamBuilder.java

@@ -1,330 +0,0 @@
-package com.ydd.third.common.utils.meituan.util;
-
-
-import com.alibaba.fastjson.JSON;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 请求body构造器
- */
-public class ParamBuilder {
-    public static Map<String, String> convertToMap(EvaluateRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-        //putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-       // putIfNotEmpty(map, "sign", request.getSign());
-
-        putIfNotEmpty(map, "comment_content", request.getCommentContent());
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "mt_peisong_id", request.getMtPeisongId());
-        putIfNotEmpty(map, "score", String.valueOf(request.getScore()));
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(CheckRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-       // putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-       // putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "shop_id", String.valueOf(request.getShopId()));
-        putIfNotEmpty(map, "delivery_service_code", String.valueOf(request.getDeliveryServiceCode()));
-        putIfNotEmpty(map, "receiver_address", request.getReceiverAddress());
-        putIfNotEmpty(map, "receiver_lng", String.valueOf(request.getReceiverLng()));
-        putIfNotEmpty(map, "receiver_lat", String.valueOf(request.getReceiverLat()));
-        putIfNotEmpty(map, "check_type", String.valueOf(request.getCheckType()));
-        putIfNotEmpty(map, "mock_order_time", String.valueOf(request.getMockOrderTime()));
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(CancelOrderRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "mt_peisong_id", request.getMtPeisongId());
-        putIfNotEmpty(map, "cancel_reason_id", String.valueOf(request.getCancelOrderReasonId().getCode()));
-        String reason = "其他原因取消";
-        if (StringUtils.isNotBlank(request.getCancelReason())){
-            reason = request.getCancelReason();
-        }
-        putIfNotEmpty(map, "cancel_reason", reason);
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(CreateOrderByShopRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-       // putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-        //putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "order_id", request.getOrderId());
-        putIfNotEmpty(map, "shop_id", String.valueOf(request.getShopId()));
-        putIfNotEmpty(map, "delivery_service_code", String.valueOf(request.getDeliveryServiceCode()));
-        putIfNotEmpty(map, "receiver_name", request.getReceiverName());
-        putIfNotEmpty(map, "receiver_address", request.getReceiverAddress());
-        putIfNotEmpty(map, "receiver_phone", request.getReceiverPhone());
-        putIfNotEmpty(map, "receiver_lng", String.valueOf(request.getReceiverLng()));
-        putIfNotEmpty(map, "receiver_lat", String.valueOf(request.getReceiverLat()));
-        putIfNotEmpty(map, "coordinate_type", String.valueOf(request.getCoordinateType()));
-        putIfNotEmpty(map, "goods_value", String.valueOf(request.getGoodsValue()));
-        putIfNotEmpty(map, "goods_height", String.valueOf(request.getGoodsHeight()));
-        putIfNotEmpty(map, "goods_width", String.valueOf(request.getGoodsWidth()));
-        putIfNotEmpty(map, "goods_length", String.valueOf(request.getGoodsLength()));
-        putIfNotEmpty(map, "goods_weight", String.valueOf(request.getGoodsWeight()));
-        putIfNotEmpty(map, "goods_detail", JSON.toJSONString(request.getGoodsDetail()));
-        putIfNotEmpty(map, "goods_pickup_info", request.getGoodsPickupInfo());
-        putIfNotEmpty(map, "goods_delivery_info", request.getGoodsDeliveryInfo());
-        putIfNotEmpty(map, "expected_pickup_time", String.valueOf(request.getExpectedPickupTime()));
-        putIfNotEmpty(map, "expected_delivery_time", String.valueOf(request.getExpectedDeliveryTime()));
-        putIfNotEmpty(map, "poi_seq", request.getPoiSeq());
-        putIfNotEmpty(map, "note", request.getNote());
-        putIfNotEmpty(map, "cash_on_delivery", String.valueOf(request.getCashOnDelivery()));
-        putIfNotEmpty(map, "cash_on_pickup", String.valueOf(request.getCashOnPickup()));
-        putIfNotEmpty(map, "invoice_title", request.getInvoiceTitle());
-        putIfNotEmpty(map, "order_type", String.valueOf(request.getOrderType().getCode()));
-        putIfNotEmpty(map, "tip_amount", String.valueOf(request.getTipAmount()));
-        putIfNotEmpty(map, "outer_order_source_desc", request.getOuterOrderSourceDesc());
-        putIfNotEmpty(map, "outer_order_source_no", request.getOuterOrderSourceNo());
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMapByPre(PreCreateOrderByShopRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "order_id", request.getOrderId());
-        putIfNotEmpty(map, "outer_order_source_desc", request.getOuterOrderSourceDesc());
-        putIfNotEmpty(map, "outer_order_source_no", request.getOuterOrderSourceNo());
-        putIfNotEmpty(map, "shop_id", String.valueOf(request.getShopId()));
-        putIfNotEmpty(map, "delivery_service_code", String.valueOf(request.getDeliveryServiceCode()));
-        putIfNotEmpty(map, "receiver_name", request.getReceiverName());
-        putIfNotEmpty(map, "receiver_address", request.getReceiverAddress());
-        putIfNotEmpty(map, "receiver_phone", request.getReceiverPhone());
-        putIfNotEmpty(map, "receiver_lng", String.valueOf(request.getReceiverLng()));
-        putIfNotEmpty(map, "receiver_lat", String.valueOf(request.getReceiverLat()));
-        putIfNotEmpty(map, "coordinate_type", String.valueOf(request.getCoordinateType()));
-        putIfNotEmpty(map, "pay_type_code", String.valueOf(request.getPayTypeCode()));
-        putIfNotEmpty(map, "goods_value", String.valueOf(request.getGoodsValue()));
-        putIfNotEmpty(map, "goods_height", String.valueOf(request.getGoodsHeight()));
-        putIfNotEmpty(map, "goods_width", String.valueOf(request.getGoodsWidth()));
-        putIfNotEmpty(map, "goods_length", String.valueOf(request.getGoodsLength()));
-        putIfNotEmpty(map, "goods_weight", String.valueOf(request.getGoodsWeight()));
-        putIfNotEmpty(map, "goods_detail", JSON.toJSONString(request.getGoodsDetail()));
-        putIfNotEmpty(map, "goods_pickup_info", request.getGoodsPickupInfo());
-        putIfNotEmpty(map, "goods_delivery_info", request.getGoodsDeliveryInfo());
-        putIfNotEmpty(map, "expected_pickup_time", String.valueOf(request.getExpectedPickupTime()));
-        putIfNotEmpty(map, "expected_delivery_time", String.valueOf(request.getExpectedDeliveryTime()));
-        putIfNotEmpty(map, "order_type", String.valueOf(request.getOrderType().getCode()));
-        putIfNotEmpty(map, "note", request.getNote());
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(CreateOrderByCoordinatesRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-        //putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-       // putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "order_id", request.getOrderId());
-        putIfNotEmpty(map, "delivery_service_code", String.valueOf(request.getDeliveryServiceCode()));
-        putIfNotEmpty(map, "receiver_name", request.getReceiverName());
-        putIfNotEmpty(map, "receiver_phone", request.getReceiverPhone());
-        putIfNotEmpty(map, "receiver_lng", String.valueOf(request.getReceiverLng()));
-        putIfNotEmpty(map, "receiver_lat", String.valueOf(request.getReceiverLat()));
-        putIfNotEmpty(map, "coordinate_type", String.valueOf(request.getCoordinateType()));
-        putIfNotEmpty(map, "goods_value", String.valueOf(request.getGoodsValue()));
-        putIfNotEmpty(map, "goods_height", String.valueOf(request.getGoodsHeight()));
-        putIfNotEmpty(map, "goods_width", String.valueOf(request.getGoodsWidth()));
-        putIfNotEmpty(map, "goods_length", String.valueOf(request.getGoodsLength()));
-        putIfNotEmpty(map, "goods_weight", String.valueOf(request.getGoodsWeight()));
-        putIfNotEmpty(map, "goods_detail", JSON.toJSONString(request.getGoodsDetail()));
-        putIfNotEmpty(map, "goods_pickup_info", request.getGoodsPickupInfo());
-        putIfNotEmpty(map, "goods_delivery_info", request.getGoodsDeliveryInfo());
-        putIfNotEmpty(map, "expected_pickup_time", String.valueOf(request.getExpectedPickupTime()));
-        putIfNotEmpty(map, "expected_delivery_time", String.valueOf(request.getExpectedDeliveryTime()));
-        putIfNotEmpty(map, "poi_seq", request.getPoiSeq());
-        putIfNotEmpty(map, "note", request.getNote());
-        putIfNotEmpty(map, "order_type", String.valueOf(request.getOrderType().getCode()));
-
-        putIfNotEmpty(map, "pick_up_type", String.valueOf(request.getPickUpType()));
-        putIfNotEmpty(map, "receiver_province", request.getReceiverProvince());
-        putIfNotEmpty(map, "receiver_city", request.getReceiverCity());
-        putIfNotEmpty(map, "receiver_country", request.getReceiverCountry());
-        putIfNotEmpty(map, "receiver_town", request.getReceiverTown());
-        putIfNotEmpty(map, "receiver_detail_address", request.getReceiverDetailAddress());
-
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(QueryOrderRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-       // putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-       // putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "mt_peisong_id", request.getMtPeisongId());
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(MockOrderRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-       // putIfNotEmpty(map, "appkey", request.getAppkey());
-      //  putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-      //  putIfNotEmpty(map, "version", request.getVersion());
-      //  putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "mt_peisong_id", request.getMtPeisongId());
-
-        return map;
-    }
-
-    private static void putIfNotEmpty(Map<String, String> map, String key, String value) {
-        if (StringUtils.isNotEmpty(value) && !"null".equals(value)) {
-            map.put(key, value);
-        }
-    }
-
-    public static Map<String,String> convertToMap(QueryShopAreaRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-       // putIfNotEmpty(map, "appkey", request.getAppkey());
-      //  putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-      //  putIfNotEmpty(map, "version", request.getVersion());
-      //  putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "delivery_service_code", String.valueOf(request.getDeliveryServiceCode()));
-        putIfNotEmpty(map, "shop_id", request.getShopId());
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(CreateShopRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-       // putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-      //  putIfNotEmpty(map, "version", request.getVersion());
-      //  putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "shop_id", request.getShopId());
-        putIfNotEmpty(map, "shop_name", request.getShopName());
-        putIfNotEmpty(map, "category", String.valueOf(request.getCategory()));
-        putIfNotEmpty(map, "second_category", String.valueOf(request.getSecondCategory()));
-        putIfNotEmpty(map, "contact_name", request.getContactName());
-        putIfNotEmpty(map, "contact_phone", request.getContactPhone());
-        putIfNotEmpty(map, "shop_address", request.getShopAddress());
-        putIfNotEmpty(map, "shop_lng", String.valueOf(request.getShopLng()));
-        putIfNotEmpty(map, "shop_lat", String.valueOf(request.getShopLat()));
-        putIfNotEmpty(map, "coordinate_type", String.valueOf(request.getCoordinateType()));
-        putIfNotEmpty(map, "delivery_service_codes", request.getDeliveryServiceCodes());
-        putIfNotEmpty(map, "business_hours", request.getBusinessHours());
-        putIfNotEmpty(map, "contact_email", request.getContactEmail());
-        putIfNotEmpty(map, "shop_address_detail", request.getShopAddressDetail());
-
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(UpdateShopRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-        //putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-       // putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "shop_id", request.getShopId());
-        putIfNotEmpty(map, "shop_name", request.getShopName());
-        putIfNotEmpty(map, "contact_name", request.getContactName());
-        putIfNotEmpty(map, "contact_phone", request.getContactPhone());
-        putIfNotEmpty(map, "shop_address", request.getShopAddress());
-        putIfNotEmpty(map, "shop_address_detail", request.getShopAddressDetail());
-        putIfNotEmpty(map, "shop_lng", String.valueOf(request.getShopLng()));
-        putIfNotEmpty(map, "shop_lat", String.valueOf(request.getShopLat()));
-        putIfNotEmpty(map, "coordinate_type", String.valueOf(request.getCoordinateType()));
-        putIfNotEmpty(map, "delivery_service_codes", request.getDeliveryServiceCodes());
-        putIfNotEmpty(map, "business_hours", request.getBusinessHours());
-        putIfNotEmpty(map, "contact_email", request.getContactEmail());
-
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(QueryShopRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-
-        //putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-      //  putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "shop_id", request.getShopId());
-        return map;
-    }
-
-    public static Map<String, String> convertToMap(OrderAddTipRequest request) {
-        Map<String, String> map = new HashMap<>();
-        if (request == null) {
-            return map;
-        }
-        //putIfNotEmpty(map, "appkey", request.getAppkey());
-       // putIfNotEmpty(map, "timestamp", String.valueOf(request.getTimestamp()));
-       // putIfNotEmpty(map, "version", request.getVersion());
-       // putIfNotEmpty(map, "sign", request.getSign());
-        putIfNotEmpty(map, "delivery_id", String.valueOf(request.getDeliveryId()));
-        putIfNotEmpty(map, "mt_peisong_id", request.getMtPeisongId());
-        putIfNotEmpty(map, "tip_amount", String.valueOf(request.getTipAmount()));
-        putIfNotEmpty(map, "serial_number", request.getSerialNumber());
-        return map;
-    }
-}

+ 0 - 47
lb-third/lb-third-common/src/main/java/com/ydd/third/common/utils/meituan/util/SHA1Util.java

@@ -1,47 +0,0 @@
-package com.ydd.third.common.utils.meituan.util;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import java.io.UnsupportedEncodingException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * SHA1 计算工具类
- */
-public class SHA1Util {
-    private static final Log logger = LogFactory.getLog(SHA1Util.class);
-
-    /**
-     * SHA1 加密
-     *
-     * @param s 待加密的字符串
-     * @return
-     */
-    public final static String Sha1(String s) throws NoSuchAlgorithmException, UnsupportedEncodingException {
-        char hexDigits[] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
-        try {
-            byte[] btInput = s.getBytes("utf-8");
-            // 获得MD5摘要算法的 MessageDigest 对象
-            MessageDigest mdInst = MessageDigest.getInstance("sha-1");
-            // 使用指定的字节更新摘要
-            mdInst.update(btInput);
-            // 获得密文
-            byte[] md = mdInst.digest();
-            // 把密文转换成十六进制的字符串形式
-            int j = md.length;
-            char str[] = new char[j * 2];
-            int k = 0;
-            for (int i = 0; i < j; i++) {
-                byte byte0 = md[i];
-                str[k++] = hexDigits[byte0 >>> 4 & 0xf];
-                str[k++] = hexDigits[byte0 & 0xf];
-            }
-            return new String(str);
-        } catch (Exception e) {
-            logger.error("Sha1 error", e);
-            throw e;
-        }
-    }
-}