优化顺丰下单逻辑

This commit is contained in:
Jack 2024-12-09 00:48:42 +08:00
parent 9f8e793d9f
commit 6fc21b3e3f
2 changed files with 22 additions and 87 deletions

View File

@ -19,7 +19,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.suisung.mall.common.api.*;
import com.suisung.mall.common.constant.CommonConstant;
import com.suisung.mall.common.constant.ConfigConstant;
import com.suisung.mall.common.constant.ConstantError;
import com.suisung.mall.common.constant.MqConstant;
import com.suisung.mall.common.domain.UserDto;
import com.suisung.mall.common.exception.ApiException;
@ -65,7 +64,6 @@ import com.suisung.mall.common.pojo.to.UserLevelTO;
import com.suisung.mall.common.pojo.vo.ShopStoreOrderProductPrintVO;
import com.suisung.mall.common.service.MessageService;
import com.suisung.mall.common.utils.*;
import com.suisung.mall.core.web.service.RedisService;
import com.suisung.mall.core.web.service.impl.BaseServiceImpl;
import com.suisung.mall.shop.activity.service.*;
import com.suisung.mall.shop.base.service.*;
@ -97,7 +95,6 @@ import io.seata.core.exception.TransactionException;
import io.seata.spring.annotation.GlobalTransactional;
import io.seata.tm.api.GlobalTransaction;
import io.seata.tm.api.GlobalTransactionContext;
import io.swagger.models.auth.In;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.slf4j.Logger;
@ -138,233 +135,161 @@ import static com.suisung.mall.common.utils.ContextUtil.getCurrentUser;
@Service
public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMapper, ShopOrderBase> implements ShopOrderBaseService {
private final Logger logger = LoggerFactory.getLogger(ShopOrderBaseServiceImpl.class);
@Autowired
private ShopOrderBaseMapper shopOrderBaseMapper;
@Autowired
private ShopOrderInfoService shopOrderInfoService;
@Autowired
private ShopOrderReturnService orderReturnService;
@Autowired
private ShopOrderReturnItemService orderReturnItemService;
@Autowired
private ShopStoreBaseService shopStoreBaseService;
@Autowired
private ShopStoreInfoService shopStoreInfoService;
@Autowired
private ShopOrderItemService shopOrderItemService;
@Autowired
private ShopOrderDataService shopOrderDataService;
@Autowired
private ShopBaseActivityTypeService activityTypeService;
@Autowired
private PayService payService;
@Autowired
private ShopOrderChainCodeService orderChainCodeService;
@Autowired
private ShopChainBaseService shopChainBaseService;
@Autowired
private ShopOrderLogisticsService orderLogisticsService;
@Autowired
private ShopStoreExpressLogisticsService expressLogisticsService;
@Autowired
private ShopOrderDeliveryAddressService orderDeliveryAddressService;
@Autowired
private ShopOrderInvoiceService orderInvoiceService;
@Autowired
private ShopProductBaseService shopProductBaseService;
@Autowired
private ShopProductIndexService shopProductIndexService;
@Autowired
private ShopProductItemService shopProductItemService;
@Autowired
private ShopBaseProductUnitService baseProductUnitService;
@Autowired
private ShopBaseStateCodeService shopBaseStateCodeService;
@Autowired
private ShopProductValidPeriodService validPeriodService;
@Autowired
private ShopActivityGroupbookingService activityGroupbookingService;
@Autowired
private ShopActivityGroupbookingHistoryService groupbookingHistoryService;
@Autowired
private ShopOrderStateLogService shopOrderStateLogService;
@Autowired
private InvoicingStockBillService invoicingStockBillService;
@Autowired
private InvoicingStockBillItemService invoicingStockBillItemService;
@Autowired
private ShopStoreConfigService shopStoreConfigService;
@Autowired
private InvoicingWarehouseBaseService warehouseBaseService;
@Autowired
private ShopChainItemService shopChainItemService;
@Autowired
private ShopOrderDeliveryAddressService deliveryAddressService;
@Autowired
private ShopUserDeliveryAddressService userDeliveryAddressService;
@Autowired
private CityMarketOrderBaseService cityMarketOrderBaseService;
@Autowired
private AccountBaseConfigService accountBaseConfigService;
@Autowired
private AccountService accountService;
@Autowired
private ShopUserInvoiceService shopUserInvoiceService;
@Autowired
private ShopUserCartService shopUserCartService;
@Autowired
private ShopStoreActivityBaseService shopStoreActivityBaseService;
@Autowired
private ShopStoreEmployeeService storeEmployeeService;
@Autowired
private ShopUserProductBuyService shopUserProductBuyService;
@Autowired
private ShopUserVoucherService shopUserVoucherService;
@Autowired
private ShopBaseCurrencyService shopBaseCurrencyService;
@Autowired
private ShopOrderCbService shopOrderCbService;
@Autowired
private ShopActivityPfGroupbuyStoreHistoryService activityPfGroupbuyStoreHistoryService;
@Autowired
private ShopActivityCutpriceService activityCutpriceService;
@Autowired
private ShopBaseProductCategoryService shopBaseProductCategoryService;
@Autowired
private InvoicingCustomerBaseService invoicingCustomerBaseService;
@Autowired
private UserInfoService userInfoService;
@Autowired
private ShopOrderBaseService shopOrderBaseService;
@Autowired
private ShopOrderReturnService shopOrderReturnService;
@Autowired
private ShopActivityGroupbuyStoreService shopActivityGroupbuyStoreService;
@Autowired
private ShopNumberSeqService shopNumberSeqService;
@Autowired
private ShopStoreAnalyticsService shopStoreAnalyticsService;
@Autowired
private ShopProductAnalyticsService shopProductAnalyticsService;
@Autowired
private ShopUserExpHistoryService shopUserExpHistoryService;
@Autowired
private ShopBaseExpressService shopBaseExpressService;
@Autowired
private ShopStoreShippingAddressService shopStoreShippingAddressService;
@Autowired
private ShopOrderShippingAddressService shopOrderShippingAddressService;
@Autowired
private ShopStoreEmployeeService shopStoreEmployeeService;
@Autowired
private ShopDistributionUserOrderService shopDistributionUserOrderService;
@Autowired
private ShopDistributionUserOrderItemService shopDistributionUserOrderItemService;
@Autowired
private ShopDistributionPlantformUserService shopDistributionPlantformUserService;
@Autowired
private DataSourceTransactionManager transactionManager;
@Autowired
private TransactionDefinition transactionDefinition;
@Autowired
private MessageService messageService;
@Autowired
private EduService eduService;
@Autowired
private ShopStoreActivityCodeService shopStoreActivityCodeService;
@Autowired
private MqMessageService mqMessageService;
@Autowired
private RedisService redisService;
@Autowired
private ThreadPoolExecutor executor;
@Autowired
private ShopActivityCutpriceService shopActivityCutpriceService;
@Resource
private ShopOrderDeliveryAddressService shopOrderDeliveryAddressService;
@Resource
private ShopStoreSameCityTransportBaseService shopStoreSameCityTransportBaseService;
@Value("${sf-express.enable}")
private Integer enable_sf_express;
private final Logger logger = LoggerFactory.getLogger(ShopOrderBaseServiceImpl.class);
@Override
public List<Map<String, Object>> statisticState() {
UserDto user = getCurrentUser();
if (user == null) {
return null;
}
Integer store_id = null;
Integer chain_id = null;
Integer subsite_id = null;
@ -388,9 +313,6 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
//待评价数量
long countNum = 0;
QueryWrapper<ShopOrderInfo> orderInfoQueryWrapper = new QueryWrapper<>();
if (store_id != null) {
@ -404,7 +326,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
orderInfoQueryWrapper.in("order_state_id", Arrays.asList(StateCode.ORDER_STATE_RECEIVED, StateCode.ORDER_STATE_FINISH));
orderInfoQueryWrapper.eq("order_buyer_evaluation_status", 0);
countNum = shopOrderInfoService.count(orderInfoQueryWrapper);
long countNum = shopOrderInfoService.count(orderInfoQueryWrapper);
Map map = new HashMap();
@ -419,6 +341,10 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
@Override
public List<Map<String, Object>> statisticCount(Date end, int days) {
UserDto user = getCurrentUser();
if (user != null) {
return null;
}
if (user.isStore()) {
Integer store_id = Convert.toInt(user.getStore_id());
return shopOrderBaseMapper.statisticCountSeller(end, days, store_id, null, null);
@ -527,7 +453,11 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
public Map getUserOrder(OrdeListVo ordeListVo, Integer page, Integer rows) {
UserDto user = getCurrentUser();
Integer user_id = ObjectUtil.isNotNull(user) ? user.getId() : null;
if (user == null) {
return null;
}
Integer user_id = ObjectUtil.isNotNull(user.getId()) ? user.getId() : null;
String order_key = ordeListVo.getOrder_key();
Integer order_state_id = ordeListVo.getState_type();
@ -1573,7 +1503,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
if (address_row != null) {
Integer district_id = Convert.toInt(address_row.get("ud_city_id"));
// 重要配送费检测和计算
shopUserCartService.tryCalTransportFreight(cart_data, district_id,true);
shopUserCartService.tryCalTransportFreight(cart_data, district_id, true);
boolean can_delivery = (boolean) cart_data.get("can_delivery");
if (!can_delivery) {
@ -5955,7 +5885,7 @@ public class ShopOrderBaseServiceImpl extends BaseServiceImpl<ShopOrderBaseMappe
// 如果没有配送地址则忽略地址选择问题
if (deliveryAddress != null && deliveryAddress.getUd_city_id() != null) {
Integer district_id = deliveryAddress.getUd_city_id();
shopUserCartService.tryCalTransportFreight(cart_data, district_id,true); // 配送运费检测和计算
shopUserCartService.tryCalTransportFreight(cart_data, district_id, true); // 配送运费检测和计算
} else {
throw new ApiException(I18nUtil._("请选择正确的收货地址!"));
}

View File

@ -18,6 +18,7 @@ import com.suisung.mall.shop.store.service.ShopStoreSfOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Date;
@ -55,6 +56,10 @@ public class ShopStoreSfOrderServiceImpl extends BaseServiceImpl<ShopStoreSfOrde
return "";
}
if(StrUtil.startWith(shopOrderId,"JS")){ // 顺丰同城的订单号标志
return shopOrderId;
}
QueryWrapper<ShopStoreSfOrder> wrapper = new QueryWrapper<>();
wrapper.eq("shop_order_id", shopOrderId);
wrapper.select("sf_order_id");