对账单修改
parent
fb7f39a1f0
commit
0f6db1bc67
|
|
@ -23,7 +23,10 @@ public class MoneyBillResult {
|
|||
private Long orderId;
|
||||
private BigDecimal discountMoney;
|
||||
private BigDecimal settleMoney;
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 净重
|
||||
*/
|
||||
private Integer settleWeight;
|
||||
/**
|
||||
* 开始时间(用于时间范围查询)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class MoneyBillQuartz {
|
|||
|
||||
private final MoneyBillMapper moneyBillMapper;
|
||||
|
||||
// @Scheduled(cron = "0 0/1 * * * ?")//每1分钟一次
|
||||
// @Scheduled(cron = "0 0/1 * * * ?")//每1分钟一次
|
||||
@Scheduled(cron = "0 0 1 27 * ?")//每月27号凌晨1点执行
|
||||
public void syncAssetsDiscover() {
|
||||
generateMoneyBill();
|
||||
|
|
@ -89,20 +89,15 @@ public class MoneyBillQuartz {
|
|||
.count();
|
||||
entity.setOrderCount((int) orderCount);
|
||||
|
||||
// 2. 总质量:quantity求和,条件是计费策略不等于"车"
|
||||
// 2. 车数=订单数
|
||||
entity.setCarCount((int) orderCount);
|
||||
|
||||
// 3. 总质量
|
||||
int totalWeight = itemGroupResults.stream()
|
||||
.filter(result -> !MoneyStrategy.Che.getVal().equals(result.getMoneyStrategy()))
|
||||
.mapToInt(MoneyBillResult::getQuantity)
|
||||
.mapToInt(MoneyBillResult::getSettleWeight)
|
||||
.sum();
|
||||
entity.setTotalWeight(totalWeight);
|
||||
|
||||
// 3. 车数:quantity求和,条件是计费策略等于"车"
|
||||
int totalCars = itemGroupResults.stream()
|
||||
.filter(result -> MoneyStrategy.Che.getVal().equals(result.getMoneyStrategy()))
|
||||
.mapToInt(MoneyBillResult::getQuantity)
|
||||
.sum();
|
||||
entity.setCarCount(totalCars);
|
||||
|
||||
// 4. 优惠金额:discountMoney求和,可能是负数
|
||||
BigDecimal totalDiscountMoney = itemGroupResults.stream()
|
||||
.map(MoneyBillResult::getDiscountMoney)
|
||||
|
|
@ -121,7 +116,7 @@ public class MoneyBillQuartz {
|
|||
entity.setGoodsName(firstResult.getExpenseItemName());
|
||||
entityList.add(entity);
|
||||
log.info("生成账单实体: transCompanyId={}, originExpenseItemId={}, 订单数={}, 总质量={}, 车数={}, 优惠金额={}, 账单金额={}",
|
||||
transCompanyId, originExpenseItemId, orderCount, totalWeight, totalCars, totalDiscountMoney, totalSettleMoney);
|
||||
transCompanyId, originExpenseItemId, orderCount, totalWeight, orderCount, totalDiscountMoney, totalSettleMoney);
|
||||
}
|
||||
}
|
||||
// 账单入库
|
||||
|
|
|
|||
|
|
@ -117,19 +117,14 @@ public class MoneyBillService extends ServiceImpl<MoneyBillMapper, MoneyBillEnti
|
|||
.count();
|
||||
entity.setOrderCount((int) orderCount);
|
||||
|
||||
// 2. 总质量:quantity求和,条件是计费策略不等于"车"
|
||||
// 2. 总质量
|
||||
int totalWeight = billResults.stream()
|
||||
.filter(result -> !MoneyStrategy.Che.getVal().equals(result.getMoneyStrategy()))
|
||||
.mapToInt(MoneyBillResult::getQuantity)
|
||||
.mapToInt(MoneyBillResult::getSettleWeight)
|
||||
.sum();
|
||||
entity.setTotalWeight(totalWeight);
|
||||
|
||||
// 3. 车数:quantity求和,条件是计费策略等于"车"
|
||||
int totalCars = billResults.stream()
|
||||
.filter(result -> MoneyStrategy.Che.getVal().equals(result.getMoneyStrategy()))
|
||||
.mapToInt(MoneyBillResult::getQuantity)
|
||||
.sum();
|
||||
entity.setCarCount(totalCars);
|
||||
// 3. 车数 = 订单数
|
||||
entity.setCarCount((int) orderCount);
|
||||
|
||||
// 4. 优惠金额:discountMoney求和,可能是负数
|
||||
BigDecimal totalDiscountMoney = billResults.stream()
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
mb.bill_period as billPeriod,
|
||||
mb.goods_id as goodsId,
|
||||
mb.order_count as orderCount,
|
||||
mb.total_weight as totalWeight,
|
||||
ROUND(mb.total_weight / 1000, 2 ) AS totalWeight,
|
||||
mb.discount_money as discountMoney,
|
||||
mb.total_money as totalMoney,
|
||||
mb.creator_id as creatorId,
|
||||
|
|
@ -75,12 +75,13 @@
|
|||
oei.order_id,
|
||||
oei.discount_money,
|
||||
oei.settle_money,
|
||||
oei.quantity
|
||||
ocio.settle_weight
|
||||
FROM
|
||||
order_expense_items oei
|
||||
LEFT JOIN order_info oi ON oi.id = oei.order_id
|
||||
LEFT JOIN biz_company bc ON oi.trans_company_id = bc.id
|
||||
LEFT JOIN sys_user su ON bc.user_id = su.id
|
||||
LEFT JOIN order_car_in_out ocio ON ocio.id = oi.car_in_out_id
|
||||
WHERE
|
||||
oi.order_status = 'YiWanCheng'
|
||||
<if test="entity.startTime != null">
|
||||
|
|
|
|||
Loading…
Reference in New Issue