商家app 增加新的 拣货完成接口
This commit is contained in:
parent
64e772a47c
commit
2fc80bd8bf
@ -197,4 +197,13 @@ public class ShopOrderInfo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "取单号,根据每个店铺每天已支付的订单累加+1")
|
||||
private Long order_pickup_num;
|
||||
|
||||
@ApiModelProperty(value = "拣货完成时间戳")
|
||||
private Long order_picked_time;
|
||||
|
||||
@ApiModelProperty(value = "新建时间")
|
||||
private Long created_at;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Long updated_at;
|
||||
}
|
||||
|
||||
@ -50,6 +50,8 @@ public class MchOrderInfoDTO implements Serializable {
|
||||
private String order_title;
|
||||
@ApiModelProperty(value = "同城配送取单号")
|
||||
private Long order_pickup_num;
|
||||
@ApiModelProperty(value = "拣货完成时间戳")
|
||||
private Long order_picked_time;
|
||||
@ApiModelProperty(value = "同城配送取单号字符串方式")
|
||||
private String order_pickup_num_str;
|
||||
@ApiModelProperty(value = "下单时间")
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
package com.suisung.mall.common.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
@ -48,7 +49,7 @@ public class UniCloudPushServiceImpl implements UniCloudPushService {
|
||||
*/
|
||||
@Override
|
||||
public Pair<Boolean, String> sendBatchPush(String cloudFunctionUrl, List<String> clientIds, String title, String content, JSONObject payload) {
|
||||
if (StrUtil.isBlank(cloudFunctionUrl) || clientIds == null || clientIds.isEmpty() || StrUtil.isBlank(content)) {
|
||||
if (StrUtil.isBlank(cloudFunctionUrl) || CollUtil.isEmpty(clientIds) || StrUtil.isBlank(content)) {
|
||||
return Pair.of(false, "缺少必要参数");
|
||||
}
|
||||
|
||||
|
||||
@ -56,7 +56,7 @@ public class UserInfoService {
|
||||
userDto = getUserByToken();
|
||||
}
|
||||
|
||||
log.info("用户信息:{}", userDto);
|
||||
log.debug("当前登录用户:{}", userDto);
|
||||
return userDto;
|
||||
}
|
||||
|
||||
|
||||
@ -80,5 +80,18 @@ public class ShopOrderInfoController {
|
||||
return CommonResult.success(shopOrderInfoService.remove(order_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单拣货完成
|
||||
* 拣货完成(商家告知餐品制作完成接口),更新订单拣货时间戳
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "拣货完成(仅对顺丰同城)", notes = "拣货完成(仅对顺丰同城)")
|
||||
@RequestMapping(value = "/picking/completed", method = RequestMethod.POST)
|
||||
public CommonResult orderPickingCompleted(@RequestParam(name = "store_id", defaultValue = "0") String storeId, @RequestParam(name = "order_id", defaultValue = "") String orderId) {
|
||||
return shopOrderInfoService.orderPickingCompleted(storeId, orderId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -330,5 +330,7 @@ public class UserOrderController extends BaseControllerImpl {
|
||||
|
||||
return CommonResult.success(data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.suisung.mall.shop.order.service;
|
||||
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.modules.order.ShopOrderInfo;
|
||||
import com.suisung.mall.core.web.service.IBaseService;
|
||||
|
||||
@ -70,4 +71,14 @@ public interface ShopOrderInfoService extends IBaseService<ShopOrderInfo> {
|
||||
*/
|
||||
Long getOrderCountByStoreId(Integer storeId, List<Integer> orderStatusIdList, List<Integer> orderRefundStatusIdList, List<Integer> deliveryTypeList, Long expireSeconds);
|
||||
|
||||
/**
|
||||
* 订单拣货完成
|
||||
* 拣货完成(商家告知餐品制作完成接口),更新订单拣货时间戳
|
||||
*
|
||||
* @param storeId
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
CommonResult orderPickingCompleted(String storeId, String orderId);
|
||||
|
||||
}
|
||||
|
||||
@ -4,8 +4,11 @@ import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.suisung.mall.common.api.CommonResult;
|
||||
import com.suisung.mall.common.api.StateCode;
|
||||
import com.suisung.mall.common.constant.CommonConstant;
|
||||
import com.suisung.mall.common.feignService.AccountService;
|
||||
@ -19,6 +22,7 @@ import com.suisung.mall.common.modules.order.ShopOrderStateLog;
|
||||
import com.suisung.mall.common.modules.pay.PayPlantformResource;
|
||||
import com.suisung.mall.common.modules.plantform.ShopPlantformFeedback;
|
||||
import com.suisung.mall.common.modules.product.ShopProductComment;
|
||||
import com.suisung.mall.common.pojo.res.ThirdApiRes;
|
||||
import com.suisung.mall.common.utils.CommonUtil;
|
||||
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
|
||||
import com.suisung.mall.shop.base.service.AccountBaseConfigService;
|
||||
@ -31,11 +35,14 @@ import com.suisung.mall.shop.plantform.service.ShopPlantformActivityItemService;
|
||||
import com.suisung.mall.shop.plantform.service.ShopPlantformFeedbackService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||
import com.suisung.mall.shop.product.service.ShopProductCommentService;
|
||||
import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreBaseService;
|
||||
import com.suisung.mall.shop.store.service.ShopStorePrinterService;
|
||||
import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
@ -97,6 +104,15 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
private ShopStorePrinterService shopStorePrinterService;
|
||||
@Autowired
|
||||
private ShopOrderInfoMapper shopOrderInfoMapper;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private ShopStoreSfOrderService shopStoreSfOrderService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private SFExpressApiService sfExpressApiService;
|
||||
|
||||
@Autowired
|
||||
private ThreadPoolExecutor executor;
|
||||
|
||||
@ -346,6 +362,62 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
return shopOrderInfoMapper.getOrderCountByStoreId(storeId, orderStatusIdList, orderRefundStatusIdList, deliveryTypeList, expireSeconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单拣货完成
|
||||
* 拣货完成(商家告知餐品制作完成接口),更新订单拣货时间戳
|
||||
*
|
||||
* @param orderId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CommonResult orderPickingCompleted(String storeId, String orderId) {
|
||||
// 参数校验
|
||||
if (StrUtil.isBlank(orderId)) {
|
||||
return CommonResult.failed("orderId 不能为空");
|
||||
}
|
||||
|
||||
// 更新订单拣货时间
|
||||
UpdateWrapper<ShopOrderInfo> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq("order_id", orderId);
|
||||
Long order_picek_time = System.currentTimeMillis();
|
||||
updateWrapper.set("order_picked_time", order_picek_time);
|
||||
|
||||
boolean isUpdated = update(updateWrapper);
|
||||
if (!isUpdated) {
|
||||
logger.warn("订单拣货时间更新失败,orderId: {}", orderId);
|
||||
return CommonResult.failed("订单更新失败");
|
||||
}
|
||||
|
||||
// 获取顺丰订单号并调用 API 通知
|
||||
try {
|
||||
String sfOrderId = shopStoreSfOrderService.getSfOrderIdByShopOrderId(orderId);
|
||||
if (StrUtil.isBlank(sfOrderId)) {
|
||||
logger.warn("未找到对应的顺丰订单号,orderId: {}", orderId);
|
||||
return CommonResult.failed("未找到对应的顺丰订单号");
|
||||
}
|
||||
|
||||
Map<String, Object> requestParams = new HashMap<>();
|
||||
requestParams.put("order_id", sfOrderId);
|
||||
requestParams.put("store_id", storeId);
|
||||
|
||||
ThirdApiRes response = sfExpressApiService.notifyProductReady(requestParams);
|
||||
if (response == null || !Objects.equals(response.getError_code(), 0)) {
|
||||
String errorMsg = response != null ? response.getError_msg() : "未知错误";
|
||||
logger.error("通知顺丰同城失败,orderId: {}, error: {}", orderId, errorMsg);
|
||||
return CommonResult.failed("通知顺丰同城失败:" + errorMsg);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("调用顺丰API异常,orderId: {}, error: {}", orderId, e.getMessage(), e);
|
||||
return CommonResult.failed("调用顺丰API异常,请稍后再试");
|
||||
}
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("order_picked_time", order_picek_time);
|
||||
|
||||
return CommonResult.success(data);
|
||||
}
|
||||
|
||||
// todo 优化多次远程查询
|
||||
private Map dashboardPlantform() {
|
||||
List<Integer> order_state = Arrays.asList(
|
||||
|
||||
@ -162,18 +162,17 @@ public class ShopPageBaseController extends BaseControllerImpl {
|
||||
if (!user.isPlatform()) {
|
||||
String storeId = user.getStore_id();
|
||||
ShopPageBase shopPageBase = shopPageBaseService.getById(page_id);
|
||||
// log.info("storeId:{}", storeId);
|
||||
// log.info("shopPageBase:{}", shopPageBase);
|
||||
|
||||
// 页面不存在 或 当前用户无店铺信息 或 页面归属与当前店铺不符,则禁止删除
|
||||
if (shopPageBase == null || StrUtil.isBlank(storeId) || !storeId.equals(shopPageBase.getStore_id().toString())) {
|
||||
if (shopPageBase == null
|
||||
|| StrUtil.isBlank(storeId)
|
||||
|| !storeId.equals(Convert.toStr(shopPageBase.getStore_id()))) {
|
||||
throw new ApiException(ResultCode.FORBIDDEN);
|
||||
}
|
||||
}
|
||||
|
||||
// 执行删除操作
|
||||
boolean isRemoved = shopPageBaseService.remove(page_id);
|
||||
return isRemoved ? CommonResult.success() : CommonResult.failed();
|
||||
return shopPageBaseService.remove(page_id) ? CommonResult.success() : CommonResult.failed();
|
||||
|
||||
} catch (ApiException e) {
|
||||
// 已知业务异常,直接抛出
|
||||
|
||||
@ -486,7 +486,12 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
return new ThirdApiRes().fail(1003, "请求参数有误!");
|
||||
}
|
||||
|
||||
ShopStoreSameCityTransportBase shopStoreSameCityTransportBase = shopStoreSameCityTransportBaseService.getShopStoreSameCityTransportBaseById((long) params.get("store_id"));
|
||||
Long storeId = Convert.toLong(params.get("store_id"));
|
||||
if (storeId == null || storeId <= 0) {
|
||||
return new ThirdApiRes().fail(1003, "缺少店铺 Id!");
|
||||
}
|
||||
|
||||
ShopStoreSameCityTransportBase shopStoreSameCityTransportBase = shopStoreSameCityTransportBaseService.getShopStoreSameCityTransportBaseById(storeId);
|
||||
if (shopStoreSameCityTransportBase == null) {
|
||||
logger.error("无法获取顺丰店铺 Id!");
|
||||
return new ThirdApiRes().fail(1003, "无法获取店铺Id");
|
||||
|
||||
@ -563,7 +563,6 @@
|
||||
<!--订单对象映射-->
|
||||
<id property="order_id" column="order_id"/>
|
||||
<result property="order_title" column="order_title"/>
|
||||
<result property="order_pickup_num" column="order_pickup_num"/>
|
||||
<result property="order_time" column="order_time"/>
|
||||
<result property="payment_time" column="payment_time"/>
|
||||
<result property="arrival_time" column="arrival_time"/>
|
||||
@ -572,6 +571,8 @@
|
||||
<result property="order_shipping_fee" column="order_shipping_fee"/>
|
||||
<result property="order_discount_amount" column="order_discount_amount"/>
|
||||
<result property="platform_fee" column="platform_fee"/>
|
||||
<result property="order_pickup_num" column="order_pickup_num"/>
|
||||
<result property="order_picked_time" column="order_picked_time"/>
|
||||
<result property="currency_id" column="currency_id"/>
|
||||
<result property="order_state_id" column="order_state_id"/>
|
||||
<result property="delivery_type_id" column="delivery_type_id"/>
|
||||
@ -656,6 +657,7 @@
|
||||
oi.order_pickup_num,
|
||||
oi.delivery_type_id,
|
||||
oi.buyer_user_id,
|
||||
oi.order_picked_time,
|
||||
IF((SELECT count(*) FROM shop_order_base WHERE buyer_user_id = oi.buyer_user_id AND order_state_id IN (2011,
|
||||
2013, 2014, 2020, 2030, 2040))>1,2,1)
|
||||
AS is_new_buyer,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user