菠萝派接口-发货接口
正在显示
6 个修改的文件
包含
302 行增加
和
87 行删除
| 1 | package com.sibu.orderHelper.integral.dao; | 1 | package com.sibu.orderHelper.integral.dao; |
| 2 | import com.sibu.orderHelper.integral.model.*; | 2 | import com.sibu.orderHelper.integral.model.*; |
| 3 | import com.sibu.orderHelper.integral.pineapple.model.Orders; | 3 | import com.sibu.orderHelper.integral.pineapple.model.*; |
| 4 | import com.sibu.orderHelper.integral.pineapple.model.OrdersProduct; | ||
| 5 | import com.sibu.orderHelper.integral.pineapple.model.Product; | ||
| 6 | import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; | 4 | import com.sibu.orderHelper.integral.reponse.CheckRefundStatusResponse; |
| 7 | import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; | 5 | import com.sibu.orderHelper.integral.reponse.DoingOrderDetailResponse; |
| 8 | import com.sibu.orderHelper.integral.reponse.SkuApiResponse; | 6 | import com.sibu.orderHelper.integral.reponse.SkuApiResponse; |
| ... | @@ -86,4 +84,28 @@ public interface PineappleDao { | ... | @@ -86,4 +84,28 @@ public interface PineappleDao { |
| 86 | List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn); | 84 | List<OrdersProduct> getOrdersProductList(@Param("orderSn")String orderSn); |
| 87 | 85 | ||
| 88 | 86 | ||
| 87 | /** | ||
| 88 | * 根据条件查询省市级信息 | ||
| 89 | * @param params | ||
| 90 | * @return | ||
| 91 | */ | ||
| 92 | Regions getRegionsByMap(Map<String,Object> params); | ||
| 93 | |||
| 94 | /** | ||
| 95 | * 根据id查询省市级信息 | ||
| 96 | * @param id | ||
| 97 | * @return | ||
| 98 | */ | ||
| 99 | Regions getRegionsById(@Param("id") Integer id); | ||
| 100 | |||
| 101 | |||
| 102 | /** | ||
| 103 | * 根据条件查询物流公司 | ||
| 104 | * @return | ||
| 105 | */ | ||
| 106 | List<CourierCompany> getCourierCompanyByName(Map<String,Object> params); | ||
| 107 | |||
| 108 | |||
| 109 | |||
| 110 | |||
| 89 | } | 111 | } | ... | ... |
| ... | @@ -68,9 +68,6 @@ | ... | @@ -68,9 +68,6 @@ |
| 68 | <if test="addressInfo !=null and addressInfo !=''"> | 68 | <if test="addressInfo !=null and addressInfo !=''"> |
| 69 | address_info = #{addressInfo}, | 69 | address_info = #{addressInfo}, |
| 70 | </if> | 70 | </if> |
| 71 | <if test="deliverTime !=null and deliverTime !=''"> | ||
| 72 | deliver_time = #{deliverTime}, | ||
| 73 | </if> | ||
| 74 | <if test="logisticsNumber !=null and logisticsNumber !=''"> | 71 | <if test="logisticsNumber !=null and logisticsNumber !=''"> |
| 75 | logistics_number = #{logisticsNumber}, | 72 | logistics_number = #{logisticsNumber}, |
| 76 | </if> | 73 | </if> |
| ... | @@ -123,9 +120,12 @@ | ... | @@ -123,9 +120,12 @@ |
| 123 | <if test="productId !=null and productId !=''"> | 120 | <if test="productId !=null and productId !=''"> |
| 124 | AND (p.id = #{productId} or p.product_code = #{productId} | 121 | AND (p.id = #{productId} or p.product_code = #{productId} |
| 125 | </if> | 122 | </if> |
| 126 | <if test="state !=null and state !=''"> | 123 | <if test="state !=null and state !='' and state != -1"> |
| 127 | AND p.state = #{state} | 124 | AND p.state = #{state} |
| 128 | </if> | 125 | </if> |
| 126 | <if test="state !=null and state !='' and state == -1"> | ||
| 127 | AND p.state IN ('6','7') | ||
| 128 | </if> | ||
| 129 | <if test="productName !=null and productName !=''"> | 129 | <if test="productName !=null and productName !=''"> |
| 130 | AND p.state = #{productName} | 130 | AND p.state = #{productName} |
| 131 | </if> | 131 | </if> |
| ... | @@ -180,42 +180,42 @@ | ... | @@ -180,42 +180,42 @@ |
| 180 | limit ${PageIndex}, ${PageSize} | 180 | limit ${PageIndex}, ${PageSize} |
| 181 | </select> | 181 | </select> |
| 182 | 182 | ||
| 183 | <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct"> | 183 | <resultMap id="ordersProduct" type="com.sibu.orderHelper.integral.pineapple.model.OrdersProduct"> |
| 184 | <result property="id" column="id" /> | 184 | <result property="id" column="id" /> |
| 185 | <result property="ordersId" column="orders_id" /> | 185 | <result property="ordersId" column="orders_id" /> |
| 186 | <result property="ordersSn" column="orders_sn" /> | 186 | <result property="ordersSn" column="orders_sn" /> |
| 187 | <result property="ordersPsn" column="orders_psn" /> | 187 | <result property="ordersPsn" column="orders_psn" /> |
| 188 | <result property="sellerId" column="seller_id" /> | 188 | <result property="sellerId" column="seller_id" /> |
| 189 | <result property="sellerName" column="seller_name" /> | 189 | <result property="sellerName" column="seller_name" /> |
| 190 | <result property="productCateId" column="product_cate_id" /> | 190 | <result property="productCateId" column="product_cate_id" /> |
| 191 | <result property="productId" column="product_id" /> | 191 | <result property="productId" column="product_id" /> |
| 192 | <result property="productGoodsId" column="product_goods_id" /> | 192 | <result property="productGoodsId" column="product_goods_id" /> |
| 193 | <result property="specInfo" column="spec_info" /> | 193 | <result property="specInfo" column="spec_info" /> |
| 194 | <result property="productName" column="product_name" /> | 194 | <result property="productName" column="product_name" /> |
| 195 | <result property="productSku" column="product_sku" /> | 195 | <result property="productSku" column="product_sku" /> |
| 196 | <result property="packageGroupsId" column="package_groups_id" /> | 196 | <result property="packageGroupsId" column="package_groups_id" /> |
| 197 | <result property="mallGroupsId" column="mall_groups_id" /> | 197 | <result property="mallGroupsId" column="mall_groups_id" /> |
| 198 | <result property="giftId" column="gift_id" /> | 198 | <result property="giftId" column="gift_id" /> |
| 199 | <result property="isGift" column="is_gift" /> | 199 | <result property="isGift" column="is_gift" /> |
| 200 | <result property="moneyPrice" column="money_price" /> | 200 | <result property="moneyPrice" column="money_price" /> |
| 201 | <result property="number" column="number" /> | 201 | <result property="number" column="number" /> |
| 202 | <result property="moneyAmount" column="money_amount" /> | 202 | <result property="moneyAmount" column="money_amount" /> |
| 203 | <result property="moneyActSingle" column="money_act_single" /> | 203 | <result property="moneyActSingle" column="money_act_single" /> |
| 204 | <result property="actSingleId" column="act_single_id" /> | 204 | <result property="actSingleId" column="act_single_id" /> |
| 205 | <result property="actGroupId" column="act_group_id" /> | 205 | <result property="actGroupId" column="act_group_id" /> |
| 206 | <result property="actFlashSaleId" column="act_flash_sale_id" /> | 206 | <result property="actFlashSaleId" column="act_flash_sale_id" /> |
| 207 | <result property="actFlashSaleProductId" column="act_flash_sale_product_id" /> | 207 | <result property="actFlashSaleProductId" column="act_flash_sale_product_id" /> |
| 208 | <result property="actBiddingId" column="act_bidding_id" /> | 208 | <result property="actBiddingId" column="act_bidding_id" /> |
| 209 | <result property="actIntegralId" column="act_integral_id" /> | 209 | <result property="actIntegralId" column="act_integral_id" /> |
| 210 | <result property="actIntegralNum" column="act_integral_num" /> | 210 | <result property="actIntegralNum" column="act_integral_num" /> |
| 211 | <result property="actIntegralMoney" column="act_integral_money" /> | 211 | <result property="actIntegralMoney" column="act_integral_money" /> |
| 212 | <result property="systemRemark" column="system_remark" /> | 212 | <result property="systemRemark" column="system_remark" /> |
| 213 | <result property="backNumber" column="back_number" /> | 213 | <result property="backNumber" column="back_number" /> |
| 214 | <result property="exchangeNumber" column="exchange_number" /> | 214 | <result property="exchangeNumber" column="exchange_number" /> |
| 215 | <result property="createTime" column="create_time" /> | 215 | <result property="createTime" column="create_time" /> |
| 216 | <result property="updateTime" column="update_time" /> | 216 | <result property="updateTime" column="update_time" /> |
| 217 | <result property="isEvaluate" column="is_evaluate" /> | 217 | <result property="isEvaluate" column="is_evaluate" /> |
| 218 | </resultMap> | 218 | </resultMap> |
| 219 | 219 | ||
| 220 | 220 | ||
| 221 | <!-- 查询子订单--> | 221 | <!-- 查询子订单--> |
| ... | @@ -223,4 +223,53 @@ | ... | @@ -223,4 +223,53 @@ |
| 223 | SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product | 223 | SELECT product_sku,id,product_name,spec_info,number,money_price,money_act_single FROM orders_product |
| 224 | WHERE orders_sn = #{ordersSn} | 224 | WHERE orders_sn = #{ordersSn} |
| 225 | </select> | 225 | </select> |
| 226 | |||
| 227 | <!-- 地址实体类--> | ||
| 228 | <resultMap id="regionsResult" type="com.sibu.orderHelper.integral.pineapple.model.Regions"> | ||
| 229 | <result property="id" column="id" /> | ||
| 230 | <result property="parentId" column="parentId" /> | ||
| 231 | <result property="regionName" column="regionName" /> | ||
| 232 | <result property="parentPath" column="parentPath" /> | ||
| 233 | <result property="firstLetter" column="firstLetter" /> | ||
| 234 | <result property="regionType" column="regionType" /> | ||
| 235 | <result property="agencyId" column="agencyId" /> | ||
| 236 | <result property="shippingId" column="shippingId" /> | ||
| 237 | <result property="visible" column="visible" /> | ||
| 238 | <result property="rowId" column="rowId" /> | ||
| 239 | </resultMap> | ||
| 240 | |||
| 241 | <!-- 根据条件查询省市级信息--> | ||
| 242 | <select id="getRegionsByMap" parameterType="java.util.Map" resultMap="regionsResult"> | ||
| 243 | SELECT * FROM regions WHERE regionName LIKE concat('%',#{name},'%') AND regionType = #{regionType} | ||
| 244 | </select> | ||
| 245 | |||
| 246 | <!-- 根据id查询省市级信息--> | ||
| 247 | <select id="getRegionsById" parameterType="java.lang.Integer" resultMap="regionsResult"> | ||
| 248 | select | ||
| 249 | * | ||
| 250 | from `regions` | ||
| 251 | where `id` = #{id} | ||
| 252 | </select> | ||
| 253 | |||
| 254 | <!-- 物流公司实体--> | ||
| 255 | <resultMap id="courierCompanyResult" type="com.sibu.orderHelper.integral.pineapple.model.CourierCompany"> | ||
| 256 | <result property="id" column="id" /> | ||
| 257 | <result property="createTime" column="create_time" /> | ||
| 258 | <result property="state" column="state" /> | ||
| 259 | <result property="companyMark" column="company_mark" /> | ||
| 260 | <result property="companyName" column="company_name" /> | ||
| 261 | <result property="seq" column="seq" /> | ||
| 262 | <result property="sellerId" column="seller_id" /> | ||
| 263 | <result property="companyType" column="company_type" /> | ||
| 264 | <result property="imagePath" column="image_path" /> | ||
| 265 | <result property="content" column="content" /> | ||
| 266 | </resultMap> | ||
| 267 | |||
| 268 | <!-- 根据条件查询物流公司--> | ||
| 269 | <select id="getCourierCompanyByName" parameterType="java.util.Map" resultMap="courierCompanyResult"> | ||
| 270 | select | ||
| 271 | * | ||
| 272 | from `courier_company` | ||
| 273 | where company_name LIKE concat('%',#{name},'%') AND seller_id =#{sellerId} | ||
| 274 | </select> | ||
| 226 | </mapper> | 275 | </mapper> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | package com.sibu.orderHelper.integral.pineapple.enums; | ||
| 2 | |||
| 3 | import com.alibaba.druid.util.StringUtils; | ||
| 4 | import com.sibu.orderHelper.enums.PayOrderStatus; | ||
| 5 | import com.sibu.orderHelper.integral.pineapple.constant.PineAppleConst; | ||
| 6 | import org.apache.commons.lang3.EnumUtils; | ||
| 7 | |||
| 8 | import java.util.List; | ||
| 9 | |||
| 10 | /** | ||
| 11 | * @author LauKa | ||
| 12 | * @contact a062431@vip.qq.com | ||
| 13 | * @date 2018/05/15 | ||
| 14 | * @description 新系统丁订单状态 | ||
| 15 | */ | ||
| 16 | public enum EJavaShopOrderStateEnum { | ||
| 17 | WaitPay(1, "待支付"), WaitConfirmed(2, "待确认"), WaitShip(3, "待发货"), | ||
| 18 | HasReceived(4, "已发货"), RefundFail(6, "交易关闭"),Finished(5, "交易完成"); | ||
| 19 | |||
| 20 | private int code; // 错误代码 | ||
| 21 | private String msg; // 错误消息 | ||
| 22 | |||
| 23 | public int getCode() { | ||
| 24 | return code; | ||
| 25 | } | ||
| 26 | |||
| 27 | public String getMsg() { | ||
| 28 | return msg; | ||
| 29 | } | ||
| 30 | |||
| 31 | EJavaShopOrderStateEnum(int code, String msg) { | ||
| 32 | this.code = code; | ||
| 33 | this.msg = msg; | ||
| 34 | } | ||
| 35 | |||
| 36 | public static EJavaShopOrderStateEnum valueOf(int code) { // 手写的从int到enum的转换函数 | ||
| 37 | List<EJavaShopOrderStateEnum> enums = EnumUtils.getEnumList(EJavaShopOrderStateEnum.class); | ||
| 38 | EJavaShopOrderStateEnum result = enums.stream() | ||
| 39 | .filter(p -> p.getCode() == code) | ||
| 40 | .findFirst() | ||
| 41 | .orElse(EJavaShopOrderStateEnum.RefundFail); | ||
| 42 | return result; | ||
| 43 | } | ||
| 44 | |||
| 45 | |||
| 46 | public static EJavaShopOrderStateEnum resolve(String code) { | ||
| 47 | List<EJavaShopOrderStateEnum> enums = EnumUtils.getEnumList(EJavaShopOrderStateEnum.class); | ||
| 48 | EJavaShopOrderStateEnum result = enums.stream() | ||
| 49 | .filter(p -> StringUtils.equalsIgnoreCase(String.valueOf(p.getCode()), code)) | ||
| 50 | .findFirst() | ||
| 51 | .orElse(EJavaShopOrderStateEnum.RefundFail); | ||
| 52 | return result; | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 56 | } |
| 1 | package com.sibu.orderHelper.integral.pineapple.model; | ||
| 2 | |||
| 3 | import lombok.Data; | ||
| 4 | import lombok.ToString; | ||
| 5 | |||
| 6 | import java.io.Serializable; | ||
| 7 | |||
| 8 | @Data | ||
| 9 | @ToString | ||
| 10 | public class CourierCompany implements Serializable{ | ||
| 11 | |||
| 12 | |||
| 13 | private Integer id; | ||
| 14 | private java.util.Date createTime; | ||
| 15 | private Integer state; | ||
| 16 | private String companyMark; | ||
| 17 | private String companyName; | ||
| 18 | private Integer seq; | ||
| 19 | private String companyType; | ||
| 20 | private Integer sellerId; | ||
| 21 | } |
com.sibu.orderHelper.model/src/main/java/com/sibu/orderHelper/integral/pineapple/model/Regions.java
0 → 100644
| 1 | package com.sibu.orderHelper.integral.pineapple.model; | ||
| 2 | |||
| 3 | |||
| 4 | import lombok.Data; | ||
| 5 | import lombok.ToString; | ||
| 6 | |||
| 7 | import java.io.Serializable; | ||
| 8 | |||
| 9 | @Data | ||
| 10 | @ToString | ||
| 11 | public class Regions implements Serializable{ | ||
| 12 | |||
| 13 | private Integer id; | ||
| 14 | private Integer parentId; | ||
| 15 | private String regionName; | ||
| 16 | private String parentPath; | ||
| 17 | private String firstLetter; | ||
| 18 | private Integer regionType; | ||
| 19 | private Integer agencyId; | ||
| 20 | private Integer shippingId; | ||
| 21 | private Integer visible; | ||
| 22 | private String rowId; | ||
| 23 | } |
| ... | @@ -9,8 +9,11 @@ import com.sibu.orderHelper.enums.PineappleEnum; | ... | @@ -9,8 +9,11 @@ import com.sibu.orderHelper.enums.PineappleEnum; |
| 9 | import com.sibu.orderHelper.enums.PineappleMethodsEnum; | 9 | import com.sibu.orderHelper.enums.PineappleMethodsEnum; |
| 10 | import com.sibu.orderHelper.integral.dao.PineappleDao; | 10 | import com.sibu.orderHelper.integral.dao.PineappleDao; |
| 11 | import com.sibu.orderHelper.integral.model.IMDoingOrderBean; | 11 | import com.sibu.orderHelper.integral.model.IMDoingOrderBean; |
| 12 | import com.sibu.orderHelper.integral.pineapple.enums.EJavaShopOrderStateEnum; | ||
| 12 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; | 13 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
| 14 | import com.sibu.orderHelper.integral.pineapple.model.CourierCompany; | ||
| 13 | import com.sibu.orderHelper.integral.pineapple.model.Orders; | 15 | import com.sibu.orderHelper.integral.pineapple.model.Orders; |
| 16 | import com.sibu.orderHelper.integral.pineapple.model.Regions; | ||
| 14 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; | 17 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; |
| 15 | import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; | 18 | import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; |
| 16 | import com.sibu.orderHelper.integral.request.PineappleSendRequest; | 19 | import com.sibu.orderHelper.integral.request.PineappleSendRequest; |
| ... | @@ -18,9 +21,7 @@ import org.apache.log4j.Logger; | ... | @@ -18,9 +21,7 @@ import org.apache.log4j.Logger; |
| 18 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
| 19 | 22 | ||
| 20 | import javax.annotation.Resource; | 23 | import javax.annotation.Resource; |
| 21 | import java.util.Date; | 24 | import java.util.*; |
| 22 | import java.util.HashMap; | ||
| 23 | import java.util.Map; | ||
| 24 | 25 | ||
| 25 | @Service | 26 | @Service |
| 26 | public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSendRequest> { | 27 | public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSendRequest> { |
| ... | @@ -35,19 +36,34 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -35,19 +36,34 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
| 35 | Map<String,Object> params = new HashMap<>(); | 36 | Map<String,Object> params = new HashMap<>(); |
| 36 | params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); | 37 | params.put("orderSn",callRequest.getBizModel().getPlatOrderNo()); |
| 37 | params.put("sellerId",callRequest.getSupplier().getId()); | 38 | params.put("sellerId",callRequest.getSupplier().getId()); |
| 38 | //只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常 | 39 | |
| 39 | Orders orders = pineappleDao.getOrdersByMap(params); | 40 | Orders orders = pineappleDao.getOrdersByMap(params); |
| 40 | if(StringUtil.isNull(orders)){ | 41 | if(StringUtil.isNull(orders)){ |
| 41 | log.error("获取订单数据业务异常:"+callRequest.getBizModel().getPlatOrderNo()); | 42 | log.error(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
| 42 | throw new BizException("获取订单数据业务异常:"+callRequest.getBizModel().getPlatOrderNo()); | 43 | throw new BizException(String.format("订单发货,获取订单数据业务异常:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
| 43 | } | 44 | } |
| 45 | //只有订单状态为12345可以允许修改快递单号,其中状态为123可以修改地址,发货时间,订单状态,其他订单状态直接报业务异常 | ||
| 46 | if(orders.getOrderState().intValue() != EJavaShopOrderStateEnum.RefundFail.getCode()){ | ||
| 47 | |||
| 48 | if(orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitPay.getCode() | ||
| 49 | || orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitConfirmed.getCode() | ||
| 50 | || orders.getOrderState().intValue() == EJavaShopOrderStateEnum.WaitShip.getCode()){ | ||
| 51 | |||
| 52 | //订单状态 | ||
| 53 | params.put("state",EJavaShopOrderStateEnum.HasReceived.getCode()); | ||
| 54 | //收货人名字 | ||
| 55 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){ | ||
| 56 | params.put("name",callRequest.getBizModel().getSenderName()); | ||
| 57 | } | ||
| 58 | //电话 | ||
| 59 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ | ||
| 60 | params.put("mobile",callRequest.getBizModel().getSenderTel()); | ||
| 61 | } | ||
| 62 | //地址、快递信息 | ||
| 63 | this.gainInfo(params,callRequest,orders); | ||
| 64 | |||
| 65 | } | ||
| 44 | 66 | ||
| 45 | if(orders.getOrderState().intValue() == PayOrderStatus.HasReceived.getCode() || orders.getOrderState().intValue() == PayOrderStatus.HasDelive.getCode() | ||
| 46 | || orders.getOrderState().intValue() == PayOrderStatus.WaitShip.getCode()){ | ||
| 47 | if(orders.getOrderState().intValue() == PayOrderStatus.WaitShip.getCode()){ | ||
| 48 | params.put("orderState",PayOrderStatus.HasReceived.getCode()); | ||
| 49 | params.put("deliverTime",new Date()); | ||
| 50 | } | ||
| 51 | //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 | 67 | //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 |
| 52 | int num = pineappleDao.checkLogisticsNumber(params); | 68 | int num = pineappleDao.checkLogisticsNumber(params); |
| 53 | if(num == 0){ | 69 | if(num == 0){ |
| ... | @@ -59,40 +75,10 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -59,40 +75,10 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
| 59 | } | 75 | } |
| 60 | } | 76 | } |
| 61 | } | 77 | } |
| 62 | //收货人名字 | ||
| 63 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderName())){ | ||
| 64 | params.put("name",callRequest.getBizModel().getSenderName()); | ||
| 65 | } | ||
| 66 | //电话 | ||
| 67 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ | ||
| 68 | params.put("mobile",callRequest.getBizModel().getSenderTel()); | ||
| 69 | } | ||
| 70 | //地址 良品不需要更改地址 | ||
| 71 | /* if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){ | ||
| 72 | String [] str = callRequest.getBizModel().getSenderAddress().split(" "); | ||
| 73 | if(!StringUtil.isNull(str) && str.length >3){ | ||
| 74 | params.put("province",str[0]); | ||
| 75 | params.put("city", str[1]); | ||
| 76 | params.put("area",str[2]); | ||
| 77 | StringBuffer address = new StringBuffer(); | ||
| 78 | for(int i = 3;i<str.length;i++){ | ||
| 79 | address.append(str[i]); | ||
| 80 | } | ||
| 81 | params.put("addressAll",str[0]+"-"+str[1]+"-"+str[2]); | ||
| 82 | params.put("addressInfo",str[0]+"-"+str[1]+"-"+str[2]+"-"+address); | ||
| 83 | }else{ | ||
| 84 | log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 85 | throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 86 | } | ||
| 87 | }*/ | ||
| 88 | //物流公司名字 | ||
| 89 | if(StringUtil.isNull(orders.getLogisticsName())){ | ||
| 90 | params.put("expressName",callRequest.getBizModel().getLogisticName()); | ||
| 91 | 78 | ||
| 92 | } | ||
| 93 | }else{ | 79 | }else{ |
| 94 | log.error("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo()); | 80 | log.error(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
| 95 | throw new BizException("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo()); | 81 | throw new BizException(String.format("订单发货接口,该订单状态不允许进行发货操作,订单号:[%s]",callRequest.getBizModel().getPlatOrderNo())); |
| 96 | } | 82 | } |
| 97 | //修改订单信息 | 83 | //修改订单信息 |
| 98 | pineappleDao.updateOrdersState(params); | 84 | pineappleDao.updateOrdersState(params); |
| ... | @@ -101,6 +87,64 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -101,6 +87,64 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
| 101 | return baseResponse; | 87 | return baseResponse; |
| 102 | } | 88 | } |
| 103 | 89 | ||
| 90 | |||
| 91 | private void gainInfo(Map<String,Object> params,CallRequest<PineappleSendRequest> callRequest,Orders orders){ | ||
| 92 | //地址 | ||
| 93 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){ | ||
| 94 | String [] str = callRequest.getBizModel().getSenderAddress().split(" "); | ||
| 95 | if(!StringUtil.isNull(str) && str.length >3){ | ||
| 96 | StringBuffer address = new StringBuffer(); | ||
| 97 | for(int i = 3;i<str.length;i++){ | ||
| 98 | address.append(str[i]); | ||
| 99 | } | ||
| 100 | params.put("addressAll",str[0]+"-"+str[1]+"-"+str[2]); | ||
| 101 | params.put("addressInfo",str[0]+"-"+str[1]+"-"+str[2]+"-"+address); | ||
| 102 | //查询省市级ID 先寻找最低级 然后查询上去 | ||
| 103 | Map<String,Object> map = new HashMap<>(); | ||
| 104 | map.put("regionType",3); | ||
| 105 | map.put("name",str[2]); | ||
| 106 | Regions regions = pineappleDao.getRegionsByMap(map); | ||
| 107 | if(StringUtil.isNull(regions)){ | ||
| 108 | params.put("provinceId","99999990"); | ||
| 109 | params.put("cityId", "99999989"); | ||
| 110 | params.put("areaId","99999988"); | ||
| 111 | }else{ | ||
| 112 | params.put("area",regions.getId()); | ||
| 113 | Regions city = pineappleDao.getRegionsById(regions.getId()); | ||
| 114 | Regions province = null; | ||
| 115 | if(!StringUtil.isNull(city)){ | ||
| 116 | province = pineappleDao.getRegionsById(city.getId()); | ||
| 117 | } | ||
| 118 | if(!StringUtil.isNull(city) && !StringUtil.isNull(province)){ | ||
| 119 | params.put("provinceId", province.getId()); | ||
| 120 | params.put("cityId", city.getId()); | ||
| 121 | }else{ | ||
| 122 | params.put("provinceId","99999990"); | ||
| 123 | params.put("cityId", "99999989"); | ||
| 124 | params.put("areaId","99999988"); | ||
| 125 | } | ||
| 126 | } | ||
| 127 | }else{ | ||
| 128 | log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 129 | throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 130 | } | ||
| 131 | } | ||
| 132 | //物流公司名字 | ||
| 133 | if(StringUtil.isNull(orders.getLogisticsName())){ | ||
| 134 | Map<String,Object> m = new HashMap<>(); | ||
| 135 | m.put("name","orders.getLogisticsName()"); | ||
| 136 | m.put("sellerId",callRequest.getSupplier().getId()); | ||
| 137 | List<CourierCompany> courierCompanyByName = pineappleDao.getCourierCompanyByName(m); | ||
| 138 | if(!StringUtil.isNull(courierCompanyByName) && !courierCompanyByName.isEmpty()){ | ||
| 139 | Optional<CourierCompany> first = courierCompanyByName.stream().findFirst(); | ||
| 140 | params.put("logisticsName",callRequest.getBizModel().getLogisticName()); | ||
| 141 | params.put("logisticsId", first.get().getId()); | ||
| 142 | }else{ | ||
| 143 | params.put("logisticsName","其他"); | ||
| 144 | params.put("logisticsId","999999990"); | ||
| 145 | } | ||
| 146 | } | ||
| 147 | } | ||
| 104 | @Override | 148 | @Override |
| 105 | public String getHandleMethodName() { | 149 | public String getHandleMethodName() { |
| 106 | return PineappleMethodsEnum.Send.getMethod(); | 150 | return PineappleMethodsEnum.Send.getMethod(); | ... | ... |
-
请 注册 或 登录 后发表评论