1.菠萝派发货接口-只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常
正在显示
3 个修改的文件
包含
118 行增加
和
31 行删除
| ... | @@ -149,4 +149,7 @@ public interface PineappleDao { | ... | @@ -149,4 +149,7 @@ public interface PineappleDao { |
| 149 | * @throws Exception | 149 | * @throws Exception |
| 150 | */ | 150 | */ |
| 151 | List<DownloadProductSkuBean> getDownloadSkuBean(@Param("skuId") String skuId)throws Exception; | 151 | List<DownloadProductSkuBean> getDownloadSkuBean(@Param("skuId") String skuId)throws Exception; |
| 152 | |||
| 153 | |||
| 154 | IMDoingOrderBean getOrderListByMap(Map<String,Object> params)throws Exception; | ||
| 152 | } | 155 | } | ... | ... |
| ... | @@ -357,6 +357,63 @@ | ... | @@ -357,6 +357,63 @@ |
| 357 | AND supplier_id = #{supplierId} | 357 | AND supplier_id = #{supplierId} |
| 358 | </select> | 358 | </select> |
| 359 | 359 | ||
| 360 | <resultMap type="com.sibu.orderHelper.integral.model.IMDoingOrderBean" id="iMDoingOrderBean2"> | ||
| 361 | <id column="order_id" property="orderId"/> | ||
| 362 | <result column="member_id" property="memberId"/> | ||
| 363 | <result column="order_code" property="orderCode"/> | ||
| 364 | <result column="main_order_code" property="mainOrderCode"/> | ||
| 365 | <result column="order_status" property="orderStatus"/> | ||
| 366 | <result column="order_from" property="orderFrom"/> | ||
| 367 | <result column="order_platform" property="orderPlatform"/> | ||
| 368 | <result column="contact" property="contact"/> | ||
| 369 | <result column="phone" property="phone"/> | ||
| 370 | <result column="province" property="province"/> | ||
| 371 | <result column="city" property="city"/> | ||
| 372 | <result column="area" property="area"/> | ||
| 373 | <result column="address" property="address"/> | ||
| 374 | <result column="zipcode" property="zipcode"/> | ||
| 375 | <result column="buyer_remark" property="buyerRemark"/> | ||
| 376 | <result column="seller_remark" property="sellerRemark"/> | ||
| 377 | <result column="total_integral" property="totalIntegral"/> | ||
| 378 | <result column="total_money" property="totalMoney"/> | ||
| 379 | <result column="freight" property="freight"/> | ||
| 380 | <result column="express_name" property="expressName"/> | ||
| 381 | <result column="express_code" property="expressCode"/> | ||
| 382 | <result column="express_code2" property="expressCode2"/> | ||
| 383 | <result column="create_dt" property="createDt"/> | ||
| 384 | <result column="pay_dt" property="payDt"/> | ||
| 385 | <result column="transaction_id" property="transactionId"/> | ||
| 386 | <result column="pay_type" property="payType"/> | ||
| 387 | <result column="open_id" property="openId"/> | ||
| 388 | <result column="buyer_username" property="buyerUsername"></result> | ||
| 389 | <result column="buyer_phone" property="buyerPhone"></result> | ||
| 390 | <result column="erp_import" property="erpImport"></result> | ||
| 391 | <result column="erp_import_dt" property="erpImportDt"></result> | ||
| 392 | <result column="ship_dt" property="shipDt"></result> | ||
| 393 | <result column="receive_dt" property="receiveDt"/> | ||
| 394 | <result column="user_coupon_money" property="userCouponMoney"/> | ||
| 395 | <result column="deduction_vb" property="deductionVb"/> | ||
| 396 | <result column="deduction_money" property="deductionMoney"/> | ||
| 397 | <result column="prerefund_original_order_status" property="prerefundOriginalOrderStatus"/> | ||
| 398 | <result column="share_member_id" property="shareMemberId"/> | ||
| 399 | <result column="share_order_money" property="shareOrderMoney"/> | ||
| 400 | <result column="platform_type" property="platformType"/> | ||
| 401 | <result column="supplier_id" property="supplierId"/> | ||
| 402 | <result column="supplier_name" property="supplierName"/> | ||
| 403 | <result column="sign_pay_status" property="signPayStatus"/> | ||
| 404 | </resultMap> | ||
| 405 | |||
| 406 | |||
| 407 | |||
| 408 | <select id="getOrderListByMap" parameterType="java.util.Map" resultMap="iMDoingOrderBean2"> | ||
| 409 | SELECT order_id,member_id,order_code,order_status,order_from, | ||
| 410 | contact,phone,total_integral,freight,create_dt,pay_dt,total_money,buyer_username,buyer_phone,open_id, | ||
| 411 | province,city,area,address,zipcode,buyer_remark,pay_type,transaction_id,user_coupon_id,user_coupon_money, | ||
| 412 | express_name,express_code,express_code2,order_platform, | ||
| 413 | erp_import,prerefund_original_order_status FROM ${doingOrderTable} WHERE order_code = #{orderCode} | ||
| 414 | AND supplier_id = #{supplierId} | ||
| 415 | </select> | ||
| 416 | |||
| 360 | <update id="updateBusinessSend" parameterType="java.util.Map"> | 417 | <update id="updateBusinessSend" parameterType="java.util.Map"> |
| 361 | UPDATE ${doingOrderTable} | 418 | UPDATE ${doingOrderTable} |
| 362 | <set> | 419 | <set> |
| ... | @@ -387,11 +444,19 @@ | ... | @@ -387,11 +444,19 @@ |
| 387 | <if test="buyerUsername !=null and buyerUsername !='' "> | 444 | <if test="buyerUsername !=null and buyerUsername !='' "> |
| 388 | buyer_username =#{buyerUsername}, | 445 | buyer_username =#{buyerUsername}, |
| 389 | </if> | 446 | </if> |
| 390 | erp_import = 1,erp_import_dt = now(),ship_dt = now(), | 447 | <if test="erpImportDt !=null and erpImportDt !='' "> |
| 391 | order_status = 4 | 448 | erp_import_dt =#{erpImportDt}, |
| 449 | </if> | ||
| 450 | <if test="shipDt !=null and shipDt !='' "> | ||
| 451 | ship_dt =#{shipDt}, | ||
| 452 | </if> | ||
| 453 | <if test="orderStatus !=null and orderStatus !='' "> | ||
| 454 | order_status =#{orderStatus}, | ||
| 455 | </if> | ||
| 456 | erp_import = 1 | ||
| 392 | </set> | 457 | </set> |
| 393 | WHERE order_code = #{orderCode} | 458 | WHERE order_code = #{orderCode} |
| 394 | AND supplier_id = #{supplierId} AND order_status =#{orderStatus} | 459 | AND supplier_id = #{supplierId} |
| 395 | </update> | 460 | </update> |
| 396 | 461 | ||
| 397 | 462 | ... | ... |
| ... | @@ -8,6 +8,7 @@ import com.sibu.orderHelper.enums.PayOrderStatus; | ... | @@ -8,6 +8,7 @@ import com.sibu.orderHelper.enums.PayOrderStatus; |
| 8 | import com.sibu.orderHelper.enums.PineappleEnum; | 8 | 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.pineapple.exception.BizException; | 12 | import com.sibu.orderHelper.integral.pineapple.exception.BizException; |
| 12 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; | 13 | import com.sibu.orderHelper.integral.pineapple.request.CallRequest; |
| 13 | import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; | 14 | import com.sibu.orderHelper.integral.pineapple.response.BaseResponse; |
| ... | @@ -16,6 +17,7 @@ import org.apache.log4j.Logger; | ... | @@ -16,6 +17,7 @@ import org.apache.log4j.Logger; |
| 16 | import org.springframework.stereotype.Service; | 17 | import org.springframework.stereotype.Service; |
| 17 | 18 | ||
| 18 | import javax.annotation.Resource; | 19 | import javax.annotation.Resource; |
| 20 | import java.util.Date; | ||
| 19 | import java.util.HashMap; | 21 | import java.util.HashMap; |
| 20 | import java.util.Map; | 22 | import java.util.Map; |
| 21 | 23 | ||
| ... | @@ -31,44 +33,61 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen | ... | @@ -31,44 +33,61 @@ public class PineappleSendBizServiceImpl extends AbstractBizService<PineappleSen |
| 31 | BaseResponse baseResponse =new BaseResponse(); | 33 | BaseResponse baseResponse =new BaseResponse(); |
| 32 | Map<String,Object> params = new HashMap<>(); | 34 | Map<String,Object> params = new HashMap<>(); |
| 33 | String redisMysqlDbConfig = ""; | 35 | String redisMysqlDbConfig = ""; |
| 34 | |||
| 35 | |||
| 36 | Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo()); | 36 | Integer dataBaseModule = DbUtil.getOrderInWhichDataBase(callRequest.getBizModel().getPlatOrderNo()); |
| 37 | String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo()); | 37 | String tableIndex = DbUtil.getOrderInWhichTable(callRequest.getBizModel().getPlatOrderNo()); |
| 38 | redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue()); | 38 | redisMysqlDbConfig = String.format(AppConstants.REDIS_DB_TYPE, AppConstants.INTEGRALMALL_ORDER_DATABASE, dataBaseModule.intValue()); |
| 39 | params.put("doingOrderTable","im_doing_order_" + tableIndex); | 39 | params.put("doingOrderTable","im_doing_order_" + tableIndex); |
| 40 | params.put("orderCode",callRequest.getBizModel().getPlatOrderNo()); | 40 | params.put("orderCode",callRequest.getBizModel().getPlatOrderNo()); |
| 41 | params.put("supplierId",callRequest.getSupplier().getId()); | 41 | params.put("supplierId",callRequest.getSupplier().getId()); |
| 42 | if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ | 42 | //只有订单状态为3 4 5 才允许修改地址,快递单号,其中状态为3还可以修改ERP状态与时间,发货时间,订单状态,其他订单状态直接报业务异常 |
| 43 | params.put("expressCode",callRequest.getBizModel().getLogisticNo()); | ||
| 44 | } | ||
| 45 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 | 43 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 |
| 46 | //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 | 44 | IMDoingOrderBean iMDoingOrderBean = pineappleDao.getOrderListByMap(params); |
| 47 | int num = pineappleDao.getOrderByMap(params); | 45 | if(StringUtil.isNull(iMDoingOrderBean)){ |
| 48 | 46 | log.error("获取订单数据业务异常"); | |
| 49 | if(num > 0){ | 47 | throw new BizException("获取订单数据业务异常"); |
| 50 | params.put("expressCode",""); | ||
| 51 | } | 48 | } |
| 52 | if(StringUtil.isNull(callRequest.getBizModel().getSenderName())){ | 49 | |
| 53 | params.put("buyerUsername",""); | 50 | if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasReceived.getCode() || iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.HasDelive.getCode() |
| 54 | } | 51 | || iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){ |
| 55 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ | 52 | if(iMDoingOrderBean.getOrderStatus().intValue() == PayOrderStatus.WaitShip.getCode()){ |
| 56 | params.put("buyerPhone",callRequest.getBizModel().getSenderTel()); | 53 | params.put("orderStatus",PayOrderStatus.HasReceived.getCode()); |
| 57 | } | 54 | params.put("erpImportDt",new Date()); |
| 58 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){ | 55 | params.put("shipDt",new Date()); |
| 59 | String [] str = callRequest.getBizModel().getSenderAddress().split(" "); | ||
| 60 | if(!StringUtil.isNull(str) && str.length >3){ | ||
| 61 | params.put("province",str[0]); | ||
| 62 | params.put("city", str[1]); | ||
| 63 | params.put("area",str[2]); | ||
| 64 | params.put("address",str[0]+"-"+str[1]+"-"+str[2]+"-"+str[3]); | ||
| 65 | }else{ | ||
| 66 | log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 67 | throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 68 | } | 56 | } |
| 57 | if(!StringUtil.isNull(callRequest.getBizModel().getLogisticNo())){ | ||
| 58 | params.put("expressCode",callRequest.getBizModel().getLogisticNo()); | ||
| 59 | } | ||
| 60 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 | ||
| 61 | //判断该快递订单号是否存在,已存在就不允许把该快递订单号添加进去 | ||
| 62 | int num = pineappleDao.getOrderByMap(params); | ||
| 63 | |||
| 64 | if(num > 0){ | ||
| 65 | params.put("expressCode",""); | ||
| 66 | } | ||
| 67 | if(StringUtil.isNull(callRequest.getBizModel().getSenderName())){ | ||
| 68 | params.put("buyerUsername",""); | ||
| 69 | } | ||
| 70 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderTel())){ | ||
| 71 | params.put("buyerPhone",callRequest.getBizModel().getSenderTel()); | ||
| 72 | } | ||
| 73 | if(!StringUtil.isNull(callRequest.getBizModel().getSenderAddress())){ | ||
| 74 | String [] str = callRequest.getBizModel().getSenderAddress().split(" "); | ||
| 75 | if(!StringUtil.isNull(str) && str.length >3){ | ||
| 76 | params.put("province",str[0]); | ||
| 77 | params.put("city", str[1]); | ||
| 78 | params.put("area",str[2]); | ||
| 79 | params.put("address",str[0]+"-"+str[1]+"-"+str[2]+"-"+str[3]); | ||
| 80 | }else{ | ||
| 81 | log.error(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 82 | throw new BizException(String.format("订单号:%s,地址不符合要求:%s,请求method:%s,appket:%s",callRequest.getBizModel().getPlatOrderNo(),callRequest.getBizModel().getSenderAddress(),callRequest.getRequest().getMethod(),callRequest.getRequest().getAppkey())); | ||
| 83 | } | ||
| 84 | } | ||
| 85 | params.put("expressName",callRequest.getBizModel().getLogisticName()); | ||
| 86 | |||
| 87 | }else{ | ||
| 88 | log.error("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo()); | ||
| 89 | throw new BizException("订单发货接口,该订单状态不允许进行发货操作,订单号:"+callRequest.getBizModel().getPlatOrderNo()); | ||
| 69 | } | 90 | } |
| 70 | params.put("expressName",callRequest.getBizModel().getLogisticName()); | ||
| 71 | params.put("orderStatus",PayOrderStatus.WaitShip.getCode()); | ||
| 72 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 | 91 | DBContextHolder.setDBType(redisMysqlDbConfig);//切换数据源 |
| 73 | pineappleDao.updateBusinessSend(params); | 92 | pineappleDao.updateBusinessSend(params); |
| 74 | baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); | 93 | baseResponse.setMessage(PineappleEnum.SUCCESS.getMsg()); | ... | ... |
-
请 注册 或 登录 后发表评论