update 更新数据接口

This commit is contained in:
2023-04-18 16:46:47 +08:00
parent 05988af02f
commit 6add0e1b59
3 changed files with 22 additions and 3 deletions

View File

@@ -72,4 +72,12 @@ public class JumpController extends BaseController {
return response;
}
/**
* 更新接口
*/
public RestApiResponse<?> updateOrderDetail() {
orderBasicInfoService.updateElecAmount();
return new RestApiResponse<>();
}
}

View File

@@ -699,8 +699,10 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
public void updateElecAmount() {
// 查询 elecAmount为空的订单数据
int pageNum = 1;
int pageSize = 10;
int pageSize = 500;
int total = 0;
int batch = 1;
while (true) {
// 分页处理
PageHelper.startPage(pageNum, pageSize);
@@ -714,8 +716,12 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
List<OrderDetail> orderDetailList = calculateData(pageInfo.getList());
// 更新数据库
orderBasicInfoMapper.batchUpdateOrderDetail(orderDetailList);
int i = orderBasicInfoMapper.batchUpdateOrderDetail(orderDetailList);
total += i;
logger.info("updateElecAmount==第{}批次更新完成", batch);
batch += 1;
}
logger.info("updateElecAmount==共更新{}条数据", total);
}
// 计算数据

View File

@@ -50,6 +50,7 @@ public class TransactionService {
@Autowired
private MemberWalletInfoMapper memberWalletInfoMapper;
@Autowired
private IOrderBasicInfoService orderBasicInfoService;
@Autowired
@@ -160,7 +161,11 @@ public class TransactionService {
orderBasicInfoMapper.updateOrderDetail(dto.getOrderDetail());
}
// 清缓存
orderBasicInfoService.cleanCacheByOrderCode(orderCode, transactionCode);
try {
orderBasicInfoService.cleanCacheByOrderCode(orderCode, transactionCode);
} catch (Exception e) {
log.error("清缓存异常", e);
}
}
/**