wangtao пре 3 година
родитељ
комит
aaf67638d2

+ 48 - 0
lb-app/src/main/java/com/ydd/app/controller/DevelopmentApi.java

@@ -3,19 +3,30 @@ package com.ydd.app.controller;
 import com.alibaba.fastjson.JSONObject;
 import com.ydd.app.dto.*;
 import com.ydd.app.service.*;
+import com.ydd.app.vo.LoginVo;
 import com.ydd.common.annotation.AccessToken;
+import com.ydd.common.annotation.RepeatSubmit;
 import com.ydd.common.core.controller.BaseController;
+import com.ydd.common.core.domain.BaseResult;
 import com.ydd.common.core.domain.ResponseResult;
+import com.ydd.common.core.redis.RedisCache;
 import com.ydd.module.domain.AppInfo;
+import com.ydd.module.enums.ExceptionEnum;
+import com.ydd.module.expection.CustomAppException;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiImplicitParam;
+import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import lombok.RequiredArgsConstructor;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import javax.validation.Valid;
 
+import static com.ydd.module.enums.CacheKeyEnum.SMS_REGISTER_CAPTCHA;
+
 /**
  * Project:lb-server
  * Class:ShopApi
@@ -34,7 +45,9 @@ public class DevelopmentApi extends BaseController {
 
     private final ApiDevelopService apiDevelopService;
 
+    private final ApiMemberService apiMemberService;
 
+    private final RedisCache redisCache;
     /**
      * 刷新token
      */
@@ -132,4 +145,39 @@ public class DevelopmentApi extends BaseController {
 //    public ResponseResult memberCoupon() {
 //        return apiDevelopService.selectMemberCoupon(getLoginId());
 //    }
+
+    @ApiOperation("发送验证码")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, paramType = "query", name = "mobile", value = "手机号"),
+            @ApiImplicitParam(required = true, paramType = "query", name = "type", value = "类型 1:注册登录 2:找回密码 3 身份验证")
+    })
+    @RequestMapping(value = "/send/sms", method = RequestMethod.POST)
+    @RepeatSubmit
+    public BaseResult<String> sendSms(@RequestParam("mobile") String mobile, @RequestParam("type") Integer type) {
+        if(apiMemberService.checkMobile(mobile)){
+            return BaseResult.error("手机号码已经注册");
+        }
+        String code = apiMemberService.sendSms(mobile, type);
+        logger.info("验证码---"+mobile+"---"+code);
+        return BaseResult.success();
+    }
+
+    @ApiOperation("验证码登录")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, paramType = "query", name = "mobile", value = "手机号"),
+            @ApiImplicitParam(required = true, paramType = "query", name = "code", value = "验证码"),
+            @ApiImplicitParam(required = true, paramType = "query", name = "platform", value = "类型 1:android 2:ios"),
+            @ApiImplicitParam(required = false, paramType = "query", name = "appleId", value = "appleId"),
+    })
+    @RequestMapping(value = "/verification", method = RequestMethod.POST)
+    @RepeatSubmit
+    public BaseResult<LoginVo> verification(@RequestParam("mobile") String mobile,
+                                                   @RequestParam("code") String code) {
+        String checkCode = redisCache.getCacheObject(SMS_REGISTER_CAPTCHA.key + mobile);
+        if (StringUtils.isBlank(checkCode) || !code.equals(checkCode)) {
+            throw new CustomAppException(ExceptionEnum.INVALID_SMS_CODE);
+        }
+        return BaseResult.success();
+    }
+
 }

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

@@ -1,126 +1,78 @@
-//package com.ydd.app.controller;
-//
-//import com.alibaba.fastjson.JSONObject;
-//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-//import com.ydd.app.RandomPhoneNum;
-//import com.ydd.app.dto.AddressReq;
-//import com.ydd.app.dto.OrderReq;
-//import com.ydd.app.dto.ValuationRes;
-//import com.ydd.app.service.*;
-//import com.ydd.common.core.controller.BaseController;
-//import com.ydd.common.core.domain.BaseResult;
-//import com.ydd.common.enums.DeliveryTypeEnums;
-//import com.ydd.common.utils.SnCodeUtils;
-//import com.ydd.common.utils.sign.SignatureUtil;
-//import com.ydd.module.domain.*;
-//import com.ydd.module.dto.DeliveryDto;
-//import com.ydd.module.enums.*;
-//import com.ydd.module.producer.RabbitSender;
-//import com.ydd.module.push.MessagePushService;
-//import com.ydd.module.service.*;
-//import com.ydd.third.common.utils.AddressLngLatExchanger;
-//import com.ydd.third.common.utils.DateUtils;
-//import com.ydd.third.common.utils.StringUtils;
-//import com.ydd.third.common.vo.ResObject;
-//import com.ydd.third.common.vo.waimai.ElemeOrderResultVo;
-//import com.ydd.third.delivery.Client;
-//import com.ydd.third.delivery.config.DeliveryConfig;
-//import com.ydd.third.delivery.dada.DadaClient;
-//import com.ydd.third.delivery.fengniao.FengniaoClient;
-//import com.ydd.third.delivery.fengniao.entity.FengniaoV3Token;
-//import com.ydd.third.delivery.huolala.HuolalaClient;
-//import com.ydd.third.delivery.kuaifu.KfClient;
-//import com.ydd.third.delivery.meituan.MeituanAuthClient;
-//import com.ydd.third.delivery.meituan.MeituanClient;
-//import com.ydd.third.delivery.meituan.sign.SignHelper;
-//import com.ydd.third.delivery.meituan.util.HttpClient;
-//import com.ydd.third.delivery.shansong.ShansongClient;
-//import com.ydd.third.delivery.vo.order.*;
-//import com.ydd.third.delivery.vo.shop.ShopQueryResultVo;
-//import com.ydd.third.delivery.vo.shop.ShopQueryVo;
-//import com.ydd.third.delivery.vo.shop.ShopResultVo;
-//import com.ydd.third.delivery.vo.shop.ShopVo;
-//import com.ydd.third.waimai.eleRetai.EleRetaiClient;
-//import com.ydd.third.waimai.eleRetai.param.OrderGetResult;
-//import com.ydd.third.waimai.eleme.ElemeAuthClient;
-//import com.ydd.third.waimai.eleme.ElemeClient;
-//import com.ydd.third.waimai.meituan.MeituanCallback;
-//import com.ydd.third.waimai.vo.ConfirmOrderVo;
-//import com.ydd.third.waimai.vo.ElemeOrderResultVo;
-//import com.ydd.third.waimai.vo.MeituanOrderResultVo;
-//import io.swagger.annotations.Api;
-//import io.swagger.annotations.ApiImplicitParam;
-//import io.swagger.annotations.ApiImplicitParams;
-//import io.swagger.annotations.ApiOperation;
-//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.*;
-//
-//import javax.annotation.Resource;
-//import java.math.BigDecimal;
-//import java.math.RoundingMode;
-//import java.text.SimpleDateFormat;
-//import java.util.*;
-//import java.util.concurrent.ThreadLocalRandom;
+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 Client deliveryClient;
-//    private final DadaClient dadaClient;
-//    private final KfClient kfClient;
-//    private final ShansongClient shansongClient;
-//    private final MeituanAuthClient meituanAuthClient;
-//    private final MeituanClient meituanClient;
-//    private final MeituanCallback meituanCallback;
-//    private final ElemeAuthClient elemeAuthClient;
-//    private final ElemeClient elemeClient;
-//    private final com.ydd.third.waimai.Client waimaiClient;
-//    private final FengniaoClient fengniaoClient;
-//    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 EleRetaiClient eleRetaiClient;
-//    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;
-//    private final HuolalaClient huolalaClient;
-//    @Resource
-//    private IOrderDeliveryService iOrderDeliveryService;
-//    @Resource
-//    private IAgentService iAgentService;
-//    @Resource
-//    private IDspConfigService iDspConfigService;
-//    @Resource
-//    private RedisTemplate redisTemplate;
-//    @Resource
-//    private  RabbitSender rabbitSender;
+@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;
 //    /****************  配送询价(预下单) *************************************/
 //    /**
 //     * 达达询价
@@ -1538,49 +1490,49 @@
 //    /**
 //     * 美团配送模拟接单
 //     */
-//    @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();
+    }
 //
 //    /**
 //     * 美团众包-查询配送费
@@ -4437,4 +4389,4 @@
 //        return BaseResult.success(result);
 //    }
 //
-//}
+}

+ 69 - 0
lb-module/src/main/java/com/ydd/module/domain/WaimaiOrderRecord.java

@@ -0,0 +1,69 @@
+package com.ydd.module.domain;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+import com.ydd.common.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+
+import java.math.BigDecimal;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 【请填写功能名称】对象 lb_waimai_order_record
+ * 
+ * @author douya
+ * @date 2022-05-07
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("lb_waimai_order_record")
+public class WaimaiOrderRecord implements Serializable {
+
+private static final long serialVersionUID=1L;
+
+
+    /** $column.columnComment */
+    @TableId(value = "id")
+    private Long id;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()")
+    private Long waimaiOrderId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()")
+    private Long waimaiId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()")
+    private Long shopId;
+
+    /** $column.columnComment */
+    @Excel(name = "${comment}" , readConverterExp = "$column.readConverterExp()")
+    private Integer num;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新时间 */
+    @TableField(update = "now()")
+    private Date updateTime;
+
+    /** 删除标识位: 0正常 1删除 */
+    @TableLogic
+    private Integer deleted;
+
+    @TableField(exist = false)
+    private Map<String, Object> params = new HashMap<>();
+}

+ 14 - 0
lb-module/src/main/java/com/ydd/module/mapper/WaimaiOrderRecordMapper.java

@@ -0,0 +1,14 @@
+package com.ydd.module.mapper;
+
+import com.ydd.module.domain.WaimaiOrderRecord;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 【请填写功能名称】Mapper接口
+ *
+ * @author douya
+ * @date 2022-05-07
+ */
+public interface WaimaiOrderRecordMapper extends BaseMapper<WaimaiOrderRecord> {
+
+}

+ 21 - 0
lb-module/src/main/java/com/ydd/module/service/IWaimaiOrderRecordService.java

@@ -0,0 +1,21 @@
+package com.ydd.module.service;
+
+import com.ydd.module.domain.WaimaiOrderRecord;
+import com.baomidou.mybatisplus.extension.service.IService;
+import java.util.List;
+
+/**
+ * 【请填写功能名称】Service接口
+ *
+ * @author douya
+ * @date 2022-05-07
+ */
+public interface IWaimaiOrderRecordService extends IService<WaimaiOrderRecord> {
+
+    /**
+     * 查询列表
+     * @param waimaiOrderRecord 实体
+     * @return 列表
+     */
+    List<WaimaiOrderRecord> queryList(WaimaiOrderRecord waimaiOrderRecord);
+}

+ 41 - 0
lb-module/src/main/java/com/ydd/module/service/impl/WaimaiOrderRecordServiceImpl.java

@@ -0,0 +1,41 @@
+package com.ydd.module.service.impl;
+
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.apache.commons.lang3.StringUtils;
+import com.ydd.module.mapper.WaimaiOrderRecordMapper;
+import com.ydd.module.domain.WaimaiOrderRecord;
+import com.ydd.module.service.IWaimaiOrderRecordService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 【请填写功能名称】Service业务层处理
+ *
+ * @author douya
+ * @date 2022-05-07
+ */
+@Service
+public class WaimaiOrderRecordServiceImpl extends ServiceImpl<WaimaiOrderRecordMapper, WaimaiOrderRecord> implements IWaimaiOrderRecordService {
+
+    @Override
+    public List<WaimaiOrderRecord> queryList(WaimaiOrderRecord waimaiOrderRecord) {
+        LambdaQueryWrapper<WaimaiOrderRecord> lqw = Wrappers.lambdaQuery();
+        if (waimaiOrderRecord.getWaimaiOrderId() != null){
+            lqw.eq(WaimaiOrderRecord::getWaimaiOrderId ,waimaiOrderRecord.getWaimaiOrderId());
+        }
+        if (waimaiOrderRecord.getWaimaiId() != null){
+            lqw.eq(WaimaiOrderRecord::getWaimaiId ,waimaiOrderRecord.getWaimaiId());
+        }
+        if (waimaiOrderRecord.getShopId() != null){
+            lqw.eq(WaimaiOrderRecord::getShopId ,waimaiOrderRecord.getShopId());
+        }
+        if (waimaiOrderRecord.getNum() != null){
+            lqw.eq(WaimaiOrderRecord::getNum ,waimaiOrderRecord.getNum());
+        }
+        return this.list(lqw);
+    }
+}

+ 16 - 0
lb-module/src/main/resources/mapper/module/WaimaiOrderRecordMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ydd.module.mapper.WaimaiOrderRecordMapper">
+    
+    <resultMap type="WaimaiOrderRecord" id="WaimaiOrderRecordResult">
+        <result property="id"    column="id"    />
+        <result property="waimaiOrderId"    column="waimai_order_id"    />
+        <result property="waimaiId"    column="waimai_id"    />
+        <result property="shopId"    column="shop_id"    />
+        <result property="num"    column="num"    />
+    </resultMap>
+
+
+</mapper>

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

@@ -0,0 +1,66 @@
+package com.ydd.third.common.utils.meituan.sign;
+
+import com.ydd.third.delivery.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));
+    }
+}

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

@@ -0,0 +1,145 @@
+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));
+    }
+}

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

@@ -0,0 +1,32 @@
+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);
+    }
+}

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

@@ -0,0 +1,161 @@
+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);
+            }
+        }
+
+    }
+
+}
+

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

@@ -0,0 +1,330 @@
+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;
+    }
+}

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

@@ -0,0 +1,47 @@
+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;
+        }
+    }
+}