|
|
@ -53,8 +53,6 @@ public class DeliveryBalanceTask {
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 修改时间 为8点至21点
|
|
|
|
* 修改时间 为8点至21点
|
|
|
|
*
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Scheduled(cron = "0 0/30 8-21 * * ? ")
|
|
|
|
@Scheduled(cron = "0 0/30 8-21 * * ? ")
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ -72,9 +70,8 @@ public class DeliveryBalanceTask {
|
|
|
|
Long userId = list.get(DefaultNumberConstants.ZERO_NUMBER).getUserId();
|
|
|
|
Long userId = list.get(DefaultNumberConstants.ZERO_NUMBER).getUserId();
|
|
|
|
Company companyByUserId = companyService.findCompanyByUserId(userId);
|
|
|
|
Company companyByUserId = companyService.findCompanyByUserId(userId);
|
|
|
|
if (ObjectUtil.isNotNull(companyByUserId)
|
|
|
|
if (ObjectUtil.isNotNull(companyByUserId)
|
|
|
|
&& ObjectUtil.isNotNull(companyByUserId.getTemplateId())
|
|
|
|
|
|
|
|
// 判断价格
|
|
|
|
// 判断价格
|
|
|
|
&& ObjectUtil.isNotNull(companyByUserId.getDeliveryCallFee())) {
|
|
|
|
&& ObjectUtil.isNotNull(companyByUserId.getDmpDeliveryFee())) {
|
|
|
|
// 每次100000 数据
|
|
|
|
// 每次100000 数据
|
|
|
|
List<List<TaskImei>> lists = Lists.partition
|
|
|
|
List<List<TaskImei>> lists = Lists.partition
|
|
|
|
(list, DefaultNumberConstants.ONE_HUNDRED_THOUSAND);
|
|
|
|
(list, DefaultNumberConstants.ONE_HUNDRED_THOUSAND);
|
|
|
@ -82,7 +79,7 @@ public class DeliveryBalanceTask {
|
|
|
|
for (List<TaskImei> taskImeiList : lists) {
|
|
|
|
for (List<TaskImei> taskImeiList : lists) {
|
|
|
|
// 大于100 进行兑换
|
|
|
|
// 大于100 进行兑换
|
|
|
|
if (taskImeiList.size() >= DefaultNumberConstants.ONE_HUNDRED) {
|
|
|
|
if (taskImeiList.size() >= DefaultNumberConstants.ONE_HUNDRED) {
|
|
|
|
BigDecimal decimal = NumberUtil.mul(companyByUserId.getDeliveryCallFee(), BigDecimal.valueOf(taskImeiList.size()));
|
|
|
|
BigDecimal decimal = NumberUtil.mul(companyByUserId.getDmpDeliveryFee(), BigDecimal.valueOf(taskImeiList.size()));
|
|
|
|
BigDecimal sub = NumberUtil.sub(companyByUserId.getUserBalance(), decimal);
|
|
|
|
BigDecimal sub = NumberUtil.sub(companyByUserId.getUserBalance(), decimal);
|
|
|
|
// 判断余额
|
|
|
|
// 判断余额
|
|
|
|
if (sub.compareTo(BigDecimal.valueOf
|
|
|
|
if (sub.compareTo(BigDecimal.valueOf
|
|
|
|