购物车,直接下单 打包费 fix bug
This commit is contained in:
parent
147793f4d4
commit
655f71abfd
@ -1,6 +0,0 @@
|
|||||||
package com.suisung.mall.account.RedisKeyManage;
|
|
||||||
|
|
||||||
public class RedisKey {
|
|
||||||
|
|
||||||
public static final String SINGLEPUSHTOKE="singlePush:toke";
|
|
||||||
}
|
|
||||||
@ -1,5 +1,7 @@
|
|||||||
package com.suisung.mall.account.service.impl;
|
package com.suisung.mall.account.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateField;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@ -51,16 +53,22 @@ public class AccountUserBindGeTuiServiceImpl extends BaseServiceImpl<UserDeviceB
|
|||||||
.eq("status", CommonConstant.Enable)
|
.eq("status", CommonConstant.Enable)
|
||||||
.orderByDesc("id");
|
.orderByDesc("id");
|
||||||
|
|
||||||
|
boolean isSuccess;
|
||||||
// 查询是否存在记录
|
// 查询是否存在记录
|
||||||
AccountUserBindGeTui existAccountUserBindGeTui = findOne(wrapper);
|
AccountUserBindGeTui existAccountUserBindGeTui = findOne(wrapper);
|
||||||
if (existAccountUserBindGeTui == null) {
|
if (existAccountUserBindGeTui == null) {
|
||||||
return add(accountUserBindGeTui);
|
isSuccess = add(accountUserBindGeTui);
|
||||||
}
|
} else {
|
||||||
|
|
||||||
// 更新记录
|
// 更新记录
|
||||||
accountUserBindGeTui.setId(existAccountUserBindGeTui.getId());
|
accountUserBindGeTui.setId(existAccountUserBindGeTui.getId());
|
||||||
accountUserBindGeTui.setUpdatedAt(new Date());
|
accountUserBindGeTui.setUpdatedAt(new Date());
|
||||||
return this.updateById(accountUserBindGeTui);
|
isSuccess = updateById(accountUserBindGeTui);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 清理一年未登录的个推绑定记录
|
||||||
|
clearAccountUserBindGeTui();
|
||||||
|
|
||||||
|
return isSuccess;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 捕获异常并记录错误日志
|
// 捕获异常并记录错误日志
|
||||||
log.error("执行 saveAccountUserBindGeTui 方法时发生异常: {}", e.getMessage(), e);
|
log.error("执行 saveAccountUserBindGeTui 方法时发生异常: {}", e.getMessage(), e);
|
||||||
@ -86,4 +94,28 @@ public class AccountUserBindGeTuiServiceImpl extends BaseServiceImpl<UserDeviceB
|
|||||||
if (userId == null || userId <= 0) return Collections.singletonList(new AccountUserBindGeTui());
|
if (userId == null || userId <= 0) return Collections.singletonList(new AccountUserBindGeTui());
|
||||||
return list(new QueryWrapper<AccountUserBindGeTui>().eq("user_id", userId).eq("status", CommonConstant.Enable));
|
return list(new QueryWrapper<AccountUserBindGeTui>().eq("user_id", userId).eq("status", CommonConstant.Enable));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清理一年没有登录的账号推送绑定关系列表
|
||||||
|
* 异步执行以避免阻塞主线程
|
||||||
|
*/
|
||||||
|
private void clearAccountUserBindGeTui() {
|
||||||
|
// 使用新线程异步执行清理任务
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
// 计算一年前的时间
|
||||||
|
Date oneYearAgo = DateUtil.offset(new Date(), DateField.YEAR, -1);
|
||||||
|
|
||||||
|
// 删除一年未更新的记录
|
||||||
|
boolean result = remove(new QueryWrapper<AccountUserBindGeTui>().lt("updated_at", oneYearAgo));
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
log.info("成功清理 {} 条一年未登录的个推绑定记录", result);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// 捕获并记录异常,避免影响主线程
|
||||||
|
log.error("异步清理一年未登录的个推绑定记录时发生异常: {}", e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}, "ClearGeTuiBindThread").start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,9 +52,10 @@ import java.util.Map;
|
|||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class SFExpressApiServiceImpl implements SFExpressApiService {
|
public class SFExpressApiServiceImpl implements SFExpressApiService {
|
||||||
|
|
||||||
private final static String sfExpressApiDomain = "https://openic.sf-express.com/open/api/external/";
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SFExpressApiServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(SFExpressApiServiceImpl.class);
|
||||||
|
|
||||||
|
private static final String sfExpressApiDomain = "https://openic.sf-express.com/open/api/external/";
|
||||||
|
|
||||||
@Value("${sf-express.appid}")
|
@Value("${sf-express.appid}")
|
||||||
private String appId;
|
private String appId;
|
||||||
@Value("${sf-express.appkey}")
|
@Value("${sf-express.appkey}")
|
||||||
@ -112,9 +113,10 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
String longitude, String latitude) {
|
String longitude, String latitude) {
|
||||||
logger.info("开始创建顺丰同城店铺, storeId: {}", storeId);
|
logger.info("开始创建顺丰同城店铺, storeId: {}", storeId);
|
||||||
|
|
||||||
|
try {
|
||||||
// 1. 验证必要参数
|
// 1. 验证必要参数
|
||||||
if (CheckUtil.isEmpty(storeId) || StringUtils.isAnyBlank(shopName, shopAddress, contactName, contactPhone)) {
|
if (CheckUtil.isEmpty(storeId) || StringUtils.isAnyBlank(shopName, shopAddress, contactName, contactPhone)) {
|
||||||
return Pair.of(false, "顺丰同城店铺,缺少必要参数!");
|
return Pair.of(false, "创建顺丰店铺,缺少必要参数!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取或初始化商家配送信息
|
// 2. 获取或初始化商家配送信息
|
||||||
@ -133,6 +135,7 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
|
|
||||||
// 3. 如果已存在顺丰店铺ID,验证其有效性
|
// 3. 如果已存在顺丰店铺ID,验证其有效性
|
||||||
if (CheckUtil.isNotEmpty(transportBase.getShop_id())) {
|
if (CheckUtil.isNotEmpty(transportBase.getShop_id())) {
|
||||||
|
logger.debug("如果存在店铺Id,从顺丰同城平台查询店铺ID,开始验证其有效性!");
|
||||||
ThirdApiRes shopInfo = getSfShopInfo(transportBase.getShop_id());
|
ThirdApiRes shopInfo = getSfShopInfo(transportBase.getShop_id());
|
||||||
if (shopInfo != null && shopInfo.getError_code().equals(0)) {
|
if (shopInfo != null && shopInfo.getError_code().equals(0)) {
|
||||||
logger.info("已成功创建顺丰同城店铺!");
|
logger.info("已成功创建顺丰同城店铺!");
|
||||||
@ -199,6 +202,11 @@ public class SFExpressApiServiceImpl implements SFExpressApiService {
|
|||||||
|
|
||||||
logger.info("成功创建顺丰店铺,店铺ID: {}", sfShopId);
|
logger.info("成功创建顺丰店铺,店铺ID: {}", sfShopId);
|
||||||
return Pair.of(true, sfShopId);
|
return Pair.of(true, sfShopId);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.error("创建顺丰同城店铺时发生异常: ", e);
|
||||||
|
return Pair.of(false, "创建顺丰同城店铺时发生异常: " + e.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -62,6 +62,7 @@ import com.suisung.mall.shop.plantform.service.ShopPlantformSubsiteService;
|
|||||||
import com.suisung.mall.shop.product.mapper.ShopProductIndexMapper;
|
import com.suisung.mall.shop.product.mapper.ShopProductIndexMapper;
|
||||||
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
import com.suisung.mall.shop.product.service.ShopProductBaseService;
|
||||||
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
import com.suisung.mall.shop.product.service.ShopProductIndexService;
|
||||||
|
import com.suisung.mall.shop.sfexpress.service.SFExpressApiService;
|
||||||
import com.suisung.mall.shop.store.mapper.ShopStoreBaseMapper;
|
import com.suisung.mall.shop.store.mapper.ShopStoreBaseMapper;
|
||||||
import com.suisung.mall.shop.store.service.*;
|
import com.suisung.mall.shop.store.service.*;
|
||||||
import com.suisung.mall.shop.user.service.ShopUserFavoritesStoreService;
|
import com.suisung.mall.shop.user.service.ShopUserFavoritesStoreService;
|
||||||
@ -107,6 +108,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ShopStoreBaseServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(ShopStoreBaseServiceImpl.class);
|
||||||
private static List<Map> StoreFilterOptData;
|
private static List<Map> StoreFilterOptData;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ShopPlantformSubsiteService shopPlantformSubsiteService;
|
private ShopPlantformSubsiteService shopPlantformSubsiteService;
|
||||||
@Autowired
|
@Autowired
|
||||||
@ -184,6 +186,10 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BaiduMapServiceImpl baiduMapService;
|
private BaiduMapServiceImpl baiduMapService;
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Autowired
|
||||||
|
private SFExpressApiService sfExpressApiService;
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private WxQrCodeService wxQrCodeService;
|
private WxQrCodeService wxQrCodeService;
|
||||||
@ -3204,7 +3210,7 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
|
|
||||||
// 联系人
|
// 联系人
|
||||||
shopStoreCompany.setContacts_name(shopMchEntry.getContact_name());
|
shopStoreCompany.setContacts_name(shopMchEntry.getContact_name());
|
||||||
shopStoreCompany.setContacts_phone(shopMchEntry.getLogin_mobile());
|
shopStoreCompany.setContacts_phone(contact_mobile);
|
||||||
|
|
||||||
// 公司名
|
// 公司名
|
||||||
String companyName = StrUtil.isBlank(shopMchEntry.getBiz_license_company()) ? shopMchEntry.getStore_name() : shopMchEntry.getBiz_license_company();
|
String companyName = StrUtil.isBlank(shopMchEntry.getBiz_license_company()) ? shopMchEntry.getStore_name() : shopMchEntry.getBiz_license_company();
|
||||||
@ -3282,7 +3288,12 @@ public class ShopStoreBaseServiceImpl extends BaseServiceImpl<ShopStoreBaseMappe
|
|||||||
shopMchEntryService.updateMerchEntryStoreId(shopMchEntry.getId(), storeId);
|
shopMchEntryService.updateMerchEntryStoreId(shopMchEntry.getId(), storeId);
|
||||||
|
|
||||||
// 初始化同城配送默认设置
|
// 初始化同城配送默认设置
|
||||||
storeSameCityTransportBaseService.initDefaultSameCityTransport(storeId);
|
// storeSameCityTransportBaseService.initDefaultSameCityTransport(storeId);
|
||||||
|
|
||||||
|
// 立即创建顺丰店铺,附带初始化同城配送默认设置
|
||||||
|
String[] areaNames = StrUtil.isNotBlank(shopStoreBase.getStore_area()) ? shopStoreBase.getStore_area().split("/") : new String[0];
|
||||||
|
String cityName = areaNames.length >= 2 ? areaNames[1] : shopStoreBase.getStore_area().replace("/", "");
|
||||||
|
sfExpressApiService.createSfExpressShop(storeId, shopStoreBase.getStore_name(), cityName, shopStoreBase.getStore_address(), shopMchEntry.getContact_name(), contact_mobile, shopStoreBase.getStore_longitude(), shopStoreBase.getStore_longitude());
|
||||||
|
|
||||||
return Pair.of(storeId, "新增成功");
|
return Pair.of(storeId, "新增成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@ -126,9 +126,9 @@ public interface ShopUserCartService extends IBaseService<ShopUserCart> {
|
|||||||
* 5、根据选择,计算订单信息,将上一步权限验证并将结果计入数据中, 店铺商品总价 = 加价购商品总价 + 购物车非活动商品总价(按照限时折扣和团购价计算)
|
* 5、根据选择,计算订单信息,将上一步权限验证并将结果计入数据中, 店铺商品总价 = 加价购商品总价 + 购物车非活动商品总价(按照限时折扣和团购价计算)
|
||||||
* 6、
|
* 6、
|
||||||
*
|
*
|
||||||
* @param cart_rows 购物车数据
|
* @param cartItems 购物车数据
|
||||||
*/
|
*/
|
||||||
Map formatCartRows(List<Map> cart_rows, Map activity_rows, ProductVo productVo, FixOrderVo fixOrderVo);
|
Map formatCartRows(List<Map> cartItems, Map activityData, ProductVo productVo, FixOrderVo fixOrderVo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 尝试去操作:配送区域判断及运费, 并修正最终数据
|
* 尝试去操作:配送区域判断及运费, 并修正最终数据
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user