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