mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
更新钱包code为空的数据
This commit is contained in:
@@ -928,4 +928,21 @@ public class TempController extends BaseController {
|
||||
logger.info("时间区间查询订单统计 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新钱包code为空的数据
|
||||
* http://localhost:8080/temp/updateWalletCode
|
||||
*/
|
||||
@PostMapping("/updateWalletCode")
|
||||
public RestApiResponse<?> updateWalletCode() {
|
||||
RestApiResponse<?> response = null;
|
||||
try {
|
||||
tempService.updateWalletCode();
|
||||
response = new RestApiResponse<>();
|
||||
} catch (Exception e) {
|
||||
logger.error("更新钱包code为空数据 error", e);
|
||||
}
|
||||
logger.info("更新钱包code为空数据 result:{}", response);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,6 +80,9 @@ public class TempService {
|
||||
@Autowired
|
||||
private AdapayCallbackRecordService adapayCallbackRecordService;
|
||||
|
||||
@Autowired
|
||||
private MemberBasicInfoService memberBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
protected TransactionService transactionService;
|
||||
|
||||
@@ -131,6 +134,9 @@ public class TempService {
|
||||
@Autowired
|
||||
private NotificationService notificationService;
|
||||
|
||||
@Autowired
|
||||
private MemberWalletInfoService memberWalletInfoService;
|
||||
|
||||
/**
|
||||
* 计算订单耗电量
|
||||
* 内蒙古站点
|
||||
@@ -1331,5 +1337,23 @@ public class TempService {
|
||||
logger.info("查询订单数量结果:{}", JSONObject.toJSONString(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
public void updateWalletCode() {
|
||||
// 查询钱包dode为空的数据
|
||||
List<MemberWalletInfo> memberWalletInfoList = memberWalletInfoService.queryWalletIsNull();
|
||||
|
||||
// 分批处理, 1000条为一批
|
||||
List<List<MemberWalletInfo>> partition = Lists.partition(memberWalletInfoList, 1000);
|
||||
|
||||
partition.parallelStream().forEach(walletInfoList -> {
|
||||
walletInfoList.forEach(walletInfo -> {
|
||||
// 生成钱包code
|
||||
walletInfo.setWalletCode(memberBasicInfoService.generateWalletCode());
|
||||
});
|
||||
// 批量更新钱包code
|
||||
memberWalletInfoService.updateBatchSelective(walletInfoList);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user