insertOrdersToDatabase sql fix getOnSale

This commit is contained in:
Owen 2025-02-22 12:18:04 +08:00
parent 446abe8a69
commit eb1c8ca0a9
1 changed files with 154 additions and 139 deletions

View File

@ -84,6 +84,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
private OnSaleProductService onSaleProductService; private OnSaleProductService onSaleProductService;
@Resource @Resource
private OrderSyncLogService orderSyncLogService; private OrderSyncLogService orderSyncLogService;
@Override @Override
public void syncOrder(AccessToken accessToken, long createTimeStart, long createTimeEnd) { public void syncOrder(AccessToken accessToken, long createTimeStart, long createTimeEnd) {
// 分页查询订单 // 分页查询订单
@ -94,6 +95,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
/** /**
* 抖音消息推送订单抓取/更新 订单 * 抖音消息推送订单抓取/更新 订单
*
* @param catchRepVO * @param catchRepVO
*/ */
@Override @Override
@ -143,7 +145,9 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
* 2.1 需更新的数据 订单状态 退款状态 * 2.1 需更新的数据 订单状态 退款状态
*/ */
// 所有在售商品 // 所有在售商品
List<OnSaleProductDO> onSaleProductDOS = onSaleProductMapper.selectList(new QueryWrapper<OnSaleProductDO>().eq("deleted", 0).eq("onSale", true)); List<OnSaleProductDO> onSaleProductDOS = onSaleProductMapper.selectList(new LambdaQueryWrapperX<OnSaleProductDO>().eq(OnSaleProductDO::getDeleted, 0)
.eq(OnSaleProductDO::getOnSale, true));
// 所有在售商品sku // 所有在售商品sku
List<String> skuList = onSaleProductDOS.stream().map(OnSaleProductDO::getSku).toList(); List<String> skuList = onSaleProductDOS.stream().map(OnSaleProductDO::getSku).toList();
// 买家备注 // 买家备注
@ -326,7 +330,10 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
* 2.1 需更新的数据 订单状态 退款状态 * 2.1 需更新的数据 订单状态 退款状态
*/ */
// 所有在售商品 // 所有在售商品
List<OnSaleProductDO> onSaleProductDOS = onSaleProductMapper.selectList(new QueryWrapper<OnSaleProductDO>().eq("deleted", 0).eq("onSale", true)); // List<OnSaleProductDO> onSaleProductDOS = onSaleProductMapper.selectList(new QueryWrapper<OnSaleProductDO>().eq("deleted", 0).eq("onSale", true));
List<OnSaleProductDO> onSaleProductDOS = onSaleProductMapper.selectList(new LambdaQueryWrapperX<OnSaleProductDO>().eq(OnSaleProductDO::getDeleted, 0)
.eq(OnSaleProductDO::getOnSale, true));
// 所有在售商品sku // 所有在售商品sku
List<String> skuList = onSaleProductDOS.stream().map(OnSaleProductDO::getSku).toList(); List<String> skuList = onSaleProductDOS.stream().map(OnSaleProductDO::getSku).toList();
// 买家备注 // 买家备注
@ -496,6 +503,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
/** /**
* 将订单数据插入到数据库 * 将订单数据插入到数据库
*
* @param orders 订单数据 * @param orders 订单数据
*/ */
private void insertOrdersToDatabase(List<ShopOrderListItem> orders) { private void insertOrdersToDatabase(List<ShopOrderListItem> orders) {
@ -676,12 +684,14 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
batchDecryptOrderAndUpdate(ordersDOS); batchDecryptOrderAndUpdate(ordersDOS);
} }
} }
private CipherInfosItem createCipherItem(String cipherText, String authId) { private CipherInfosItem createCipherItem(String cipherText, String authId) {
CipherInfosItem item = new CipherInfosItem(); CipherInfosItem item = new CipherInfosItem();
item.setCipherText(cipherText); item.setCipherText(cipherText);
item.setAuthId(authId); item.setAuthId(authId);
return item; return item;
} }
private void updateOrderFields(OrdersDO order, String cipherText, String decryptText) { private void updateOrderFields(OrdersDO order, String cipherText, String decryptText) {
// 检查并更新每个加密字段 // 检查并更新每个加密字段
if (cipherText.equals(order.getEncryptAddress())) { if (cipherText.equals(order.getEncryptAddress())) {
@ -696,6 +706,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
order.setEncryptAddressMobile(decryptText); order.setEncryptAddressMobile(decryptText);
} }
} }
private void batchDecryptOrderAndUpdate(List<OrdersDO> orderList) { private void batchDecryptOrderAndUpdate(List<OrdersDO> orderList) {
List<CipherInfosItem> cipherInfos = new ArrayList<>(); List<CipherInfosItem> cipherInfos = new ArrayList<>();
for (OrdersDO ordersDO : orderList) { for (OrdersDO ordersDO : orderList) {
@ -725,6 +736,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
/** /**
* 使用正则表达式获取手机号 * 使用正则表达式获取手机号
*
* @param skuName * @param skuName
* @return * @return
*/ */
@ -745,6 +757,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
/** /**
* 分页查询订单 * 分页查询订单
*
* @param accessToken 访问令牌 * @param accessToken 访问令牌
* @param createTimeStart 创建时间起始 * @param createTimeStart 创建时间起始
* @param createTimeEnd 创建时间结束 * @param createTimeEnd 创建时间结束
@ -798,6 +811,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
/** /**
* 批量解密接口 * 批量解密接口
*
* @param cipherInfos 待解密数据 一次性最多50条 * @param cipherInfos 待解密数据 一次性最多50条
* @return * @return
*/ */
@ -827,6 +841,7 @@ public class DouDianOrderCatchServiceImpl implements OrderCatchService {
OrderOrderDetailResponse response = request.execute(accessToken); OrderOrderDetailResponse response = request.execute(accessToken);
return response.getData(); return response.getData();
} }
public void refreshToken() { public void refreshToken() {
//设置appKey和appSecret全局设置一次 //设置appKey和appSecret全局设置一次
GlobalConfig.initAppKey("7381306825771091495"); GlobalConfig.initAppKey("7381306825771091495");