顺丰完成订单时候,发出催促确认收货的通知-> 微信
This commit is contained in:
parent
6637180cbf
commit
56a62f6673
@ -831,7 +831,6 @@ public class LakalaApiServiceImpl implements LakalaApiService {
|
||||
logDate = DateUtil.format(new Date(), "yyyyMMdd"); // 当前时间
|
||||
}
|
||||
|
||||
|
||||
log.debug("[确认收货通知] 获取基础交易信息: logNo={} tradeNo={} logDate={}", logNo, tradeNo, logDate);
|
||||
|
||||
// 查询用途
|
||||
|
||||
@ -99,6 +99,7 @@ import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||
import com.suisung.mall.shop.store.service.*;
|
||||
import com.suisung.mall.shop.sync.service.SyncThirdDataService;
|
||||
import com.suisung.mall.shop.user.service.*;
|
||||
import com.suisung.mall.shop.wechat.service.WxOrderShippingService;
|
||||
import io.seata.common.util.StringUtils;
|
||||
import io.seata.core.context.RootContext;
|
||||
import io.seata.core.exception.TransactionException;
|
||||
@ -376,6 +377,10 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
@Autowired
|
||||
private LakalaApiService lakalaApiService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private WxOrderShippingService wxOrderShippingService;
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
private SyncThirdDataService syncThirdDataService;
|
||||
@ -5037,6 +5042,9 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
continue;
|
||||
}
|
||||
|
||||
/// 服务号确认收货通知跳转链接设置
|
||||
wxOrderShippingService.setMsgJumpPath(order_id);
|
||||
|
||||
BigDecimal order_points_add = order_data_row.getOrder_points_add();
|
||||
BigDecimal order_double_points_add = order_data_row.getOrder_double_points_add();
|
||||
BigDecimal order_points_add_all = order_points_add != null ? order_points_add : BigDecimal.ZERO;
|
||||
@ -8560,13 +8568,18 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取(确认收货之后)多久后可提现(时间戳毫秒)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long getWithdrawTime() {
|
||||
//订单可提现时间
|
||||
Date now = new Date();
|
||||
Long withdraw_time = now.getTime();
|
||||
Long withdraw_time;
|
||||
|
||||
float withdraw_received_day = accountBaseConfigService.getConfig("withdraw_received_day", 7f);
|
||||
float withdraw_received_day = accountBaseConfigService.getConfig("withdraw_received_day", 1f); // 确认收货之后多久可以提现,默认1天
|
||||
int second = NumberUtil.mul(withdraw_received_day, 60, 60, 24).intValue();
|
||||
|
||||
if (withdraw_received_day >= 0) {
|
||||
|
||||
@ -498,7 +498,7 @@ public class ShopOrderInfoServiceImpl extends BaseServiceImpl<ShopOrderInfoMappe
|
||||
updateWrapper.eq("order_id", orderId)
|
||||
.ne("order_is_received", CommonConstant.Enable);
|
||||
updateWrapper.set("order_is_received", CommonConstant.Enable)
|
||||
.set("order_deal_time", System.currentTimeMillis());
|
||||
.set("order_deal_time", System.currentTimeMillis()); // 确认收货时间戳
|
||||
|
||||
boolean result = update(updateWrapper);
|
||||
if (result) {
|
||||
|
||||
@ -549,6 +549,9 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
if (is_denyreturn) {
|
||||
// 获取更详细的拒绝退货原因
|
||||
String denyReason = getDenyReturnReason(shopOrderInfo, shopOrderItem, shopProductIndex);
|
||||
if (StrUtil.isBlank(denyReason)) {
|
||||
denyReason = "此商品不允许退货!";
|
||||
}
|
||||
throw new ApiException(denyReason);
|
||||
}
|
||||
|
||||
@ -2099,7 +2102,7 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
* @return
|
||||
*/
|
||||
public boolean ifDenyReturn(ShopOrderInfo shopOrderInfo, ShopOrderItem shopOrderItem, ShopProductIndex shopProductIndex) {
|
||||
// 默认允许退货
|
||||
// 是否禁止退货?默认允许退货
|
||||
boolean is_denyreturn = false;
|
||||
|
||||
if (shopOrderItem == null) {
|
||||
@ -2120,17 +2123,18 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
// 1、商品是否允许
|
||||
if (contractTypeIds.contains(new Integer(StateCode.CONTRACT_TYPE_DENY_RETURN))) {
|
||||
is_denyreturn = true;
|
||||
throw new ApiException(I18nUtil._("此商品不允许退货!"));
|
||||
// throw new ApiException(I18nUtil._("此商品不允许退货!"));
|
||||
}
|
||||
|
||||
// 2、是否已经可结算, 进入可结算,不允许退货。
|
||||
if (shopOrderInfo.getOrder_state_id().intValue() == StateCode.ORDER_STATE_RECEIVED || shopOrderInfo.getOrder_state_id().intValue() == StateCode.ORDER_STATE_FINISH) {
|
||||
// 可提现时间
|
||||
Long withdrawTime = shopOrderBaseService.getWithdrawTime();
|
||||
|
||||
//order_qs_time
|
||||
//order_deal_time
|
||||
if (withdrawTime.compareTo(shopOrderInfo.getOrder_deal_time()) > 0) {
|
||||
is_denyreturn = true;
|
||||
throw new ApiException(I18nUtil._("此商品已过退货期,不允许退货!"));
|
||||
//throw new ApiException(I18nUtil._("此商品已过退货期,不允许退货!"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2550,12 +2554,14 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
}
|
||||
|
||||
if (lklOrderSeparateService.isOrderSeparated(orderId)) {
|
||||
// TODO 后期如果已经分账的订单,一定强硬退款,可能需要拉卡拉撤销分账,再退款
|
||||
// TODO 后期如果已经分账的订单,一定强硬退款,可能需要拉卡拉撤销分账,再退款,已提现的,真的没有办法退款了
|
||||
return CommonResult.failed("订单已三方结清,无法退款");
|
||||
}
|
||||
|
||||
List<ShopOrderItem> orderItems = shopOrderItemService.find(new QueryWrapper<ShopOrderItem>().eq("order_id", orderId));
|
||||
if (CollectionUtil.isEmpty(orderItems)) return CommonResult.failed("无可退货商品");
|
||||
if (CollectionUtil.isEmpty(orderItems)) {
|
||||
return CommonResult.failed("无可退货商品");
|
||||
}
|
||||
|
||||
// === 3. 检查退货单 ===
|
||||
ShopOrderReturn refundOrder = findOne(new QueryWrapper<ShopOrderReturn>()
|
||||
@ -2712,9 +2718,10 @@ public class ShopOrderReturnServiceImpl extends BaseServiceImpl<ShopOrderReturnM
|
||||
|
||||
// 2、是否已经超过退货期
|
||||
if (shopOrderInfo.getOrder_state_id().intValue() == StateCode.ORDER_STATE_RECEIVED || shopOrderInfo.getOrder_state_id().intValue() == StateCode.ORDER_STATE_FINISH) {
|
||||
// 可提现时间
|
||||
Long withdrawTime = shopOrderBaseService.getWithdrawTime();
|
||||
|
||||
//order_qs_time
|
||||
//order_deal_time 当前状态的处理时间
|
||||
if (withdrawTime.compareTo(shopOrderInfo.getOrder_deal_time()) > 0) {
|
||||
return "订单已超过退货期限,无法退货";
|
||||
}
|
||||
|
||||
@ -1021,7 +1021,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
pushRemark = "已完成配送";
|
||||
orderStatus = StateCode.ORDER_STATE_RECEIVED; //已签收
|
||||
|
||||
// 通知微信用户确认收货(同城配送不能调用微信的确认收货)
|
||||
// 顺丰送达后,发出催促微信用户确认收货通知 (同城配送不能调用微信的确认收货)
|
||||
wxOrderShippingService.notifyConfirmReceive(shopStoreSfOrder.getShop_order_id());
|
||||
|
||||
// 不要提前 订单确认收货,等微信拉卡拉确认通知
|
||||
@ -1117,13 +1117,14 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
throw new ApiException(I18nUtil._("状态处理失败!"));
|
||||
}
|
||||
|
||||
// 通知微信用户确认收货(同城配送不能调用该微信接口)
|
||||
// wxOrderShippingService.notifyConfirmReceive(shopStoreSfOrder.getShop_order_id());
|
||||
String orderId = shopStoreSfOrder.getShop_order_id();
|
||||
|
||||
// 顺丰送达后,发出催促微信用户确认收货通知 (同城配送不能调用微信的确认收货)
|
||||
wxOrderShippingService.notifyConfirmReceive(orderId);
|
||||
|
||||
// 订单确认收货
|
||||
// shopOrderBaseService.receive(shopStoreSfOrder.getShop_order_id(), null);
|
||||
|
||||
String orderId = shopStoreSfOrder.getShop_order_id();
|
||||
|
||||
// 消息推送
|
||||
// JSONObject payload = new JSONObject();
|
||||
@ -1131,7 +1132,6 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||
// payload.put("orderId", orderId);
|
||||
// pushMessageService.noticeMerchantEmployeeOrderAction(null, orderId, "", "顺丰同城订单[" + orderId + "]已完成配送。", null);
|
||||
|
||||
|
||||
return new ThirdApiRes().success("success");
|
||||
}
|
||||
|
||||
|
||||
@ -128,21 +128,17 @@ public class WxOrderShippingServiceImpl implements WxOrderShippingService {
|
||||
|
||||
// Step 4: Prepare request payload
|
||||
JSONArray shippingList = new JSONArray().put(shippingItem);
|
||||
// String mchId = orderBaseInfo.getMch_id();
|
||||
|
||||
JSONObject paramsJSON = new JSONObject()
|
||||
.set("order_key", new JSONObject().set("order_number_type", 2).set("transaction_id", orderBaseInfo.getTransaction_id()))
|
||||
// .set("order_key", new JSONObject().set("order_number_type", 1).set("out_trade_no", orderBaseInfo.getOut_trade_no()).set("mchid", mchId))
|
||||
.set("delivery_mode", 1)
|
||||
.set("logistics_type", logisticsType)
|
||||
.set("shipping_list", shippingList)
|
||||
.set("upload_time", DateTimeUtils.formatDateTimeRFC3339(new Date()))
|
||||
.set("payer", new JSONObject().set("openid", orderBaseInfo.getOpen_id()));
|
||||
|
||||
|
||||
// Step 5: Send request to WeChat API
|
||||
String postUrl = "https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token=" + accessToken;
|
||||
log.debug("发货信息录入请求: {} \n {}", postUrl, paramsJSON);
|
||||
log.debug("发货信息录入请求: {} \n 响应数据 {}", postUrl, paramsJSON);
|
||||
|
||||
JSONObject respObj = RestTemplateHttpUtil.sendPost(
|
||||
postUrl,
|
||||
@ -161,7 +157,7 @@ public class WxOrderShippingServiceImpl implements WxOrderShippingService {
|
||||
return Pair.of(false, "发货信息录入失败: " + errorMsg);
|
||||
}
|
||||
|
||||
// 跳转链接设置
|
||||
// 服务号发货通知跳转链接设置
|
||||
setMsgJumpPath(orderId);
|
||||
|
||||
log.info("发货信息录入成功, 订单ID: {}", orderId);
|
||||
@ -235,9 +231,9 @@ public class WxOrderShippingServiceImpl implements WxOrderShippingService {
|
||||
return Pair.of(false, "通知微信用户确认收货失败: " + errorMsg);
|
||||
}
|
||||
|
||||
// 跳转链接设置
|
||||
/// 服务号催促确认收货通知跳转链接设置
|
||||
setMsgJumpPath(orderId);
|
||||
|
||||
|
||||
log.info("通知微信用户确认收货成功, 订单ID: {}", orderId);
|
||||
return Pair.of(true, "通知微信用户确认收货成功");
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user