Commit 51476920 authored by shiyu's avatar shiyu

计算用户账单

parent a571d2c4
......@@ -335,10 +335,11 @@ public class SysFinanceServiceImpl implements SysFinanceService {
//查询平台历史收入
UserAccountDetailRequestDto queryDto = new UserAccountDetailRequestDto();
queryDto.setState(BillEnum.AccountDetailStateEnum.WAIT_ENTRY.getCode());
long totalWaitEntryAmount = userAccountDetailDao.summaryAmount(dto);
long totalWaitEntryAmount = userAccountDetailDao.summaryAmount(queryDto);
queryDto.setState(BillEnum.AccountDetailStateEnum.ENTRY.getCode());
long totalEntryAmount = userAccountDetailDao.summaryAmount(dto);
long totalEntryAmount = userAccountDetailDao.summaryAmount(queryDto);
Map<String, Object> result = new HashMap<>();
result.put("waitEntryAmount", PriceUtil.convertPriceFenToYuan(waitEntryAmount));
result.put("entryAmount", PriceUtil.convertPriceFenToYuan(entryAmount));
......
......@@ -64,21 +64,22 @@ public class SysUserBillServiceImpl implements SysUserBillService {
UserBill userBill = userBillDao.findOne(accountPeriod, distributionOrder.getSellerId(), BillEnum.BillStateEnum.NOT_PAID.getCode());
UserBill updateBill = new UserBill();
updateBill.setId(userBill.getId());
//订单待入账要减去这笔订单的利润,同时已到账金额要加上这笔订单的金额
long orderWaitEntryAmount = userBill.getOrderWaitEntryAmount() - sellerProfitAmount;
long orderEntryAmount = userBill.getOrderEntryAmount() + sellerProfitAmount;
userBill.setOrderWaitEntryAmount(orderWaitEntryAmount);
userBill.setOrderEntryAmount(orderEntryAmount);
updateBill.setOrderWaitEntryAmount(orderWaitEntryAmount);
updateBill.setOrderEntryAmount(orderEntryAmount);
if (distributionOrder.getShareRecordId().equals(distributionOrder.getSellerId())) {
//表示介绍人是卖家自己
long newIntroduceWaitEntryAmount = userBill.getIntroduceWaitEntryAmount() - introduceCost;
long newIntroduceEntryAmount = userBill.getIntroduceEntryAmount() + introduceCost;
userBill.setIntroduceWaitEntryAmount(newIntroduceWaitEntryAmount);
userBill.setIntroduceEntryAmount(newIntroduceEntryAmount);
updateBill.setIntroduceWaitEntryAmount(newIntroduceWaitEntryAmount);
updateBill.setIntroduceEntryAmount(newIntroduceEntryAmount);
}
updateBill.setTotalWaitEntryAmount(userBill.getOrderWaitEntryAmount() + userBill.getIntroduceWaitEntryAmount());
updateBill.setTotalEntryAmount(userBill.getOrderEntryAmount() + userBill.getIntroduceEntryAmount());
userBillDao.updateByPrimaryKey(userBill);
updateBill.setTotalWaitEntryAmount(updateBill.getOrderWaitEntryAmount() + updateBill.getIntroduceWaitEntryAmount());
updateBill.setTotalEntryAmount(updateBill.getOrderEntryAmount() + updateBill.getIntroduceEntryAmount());
userBillDao.updateByPrimaryKey(updateBill);
return Result.success();
} catch (Exception e) {
logger.error("************ 订单完成后计算订单账单ERROR: {}", e);
......
......@@ -75,7 +75,7 @@ public class RefreshLogisticsJob {
}
logger.info(">>>>>>>>>>>>>>>>>>>>>>> 更新物流状态任务,开始执行 <<<<<<<<<<<<<<<<<<<<<");
try {
//查询7天发货订单未签收的订单
//查询7天发货订单未签收的订单
boolean hasNextPage = true;
DistributionOrderRequestDto distributionOrderRequestDto = new DistributionOrderRequestDto();
Date now = new Date();
......@@ -84,7 +84,7 @@ public class RefreshLogisticsJob {
distributionOrderRequestDto.setStartDeliveryTime(startTime);
distributionOrderRequestDto.setEndDeliveryTime(now);
distributionOrderRequestDto.setState(DistributionEnum.DistributionOrderStateEnum.PRE_SIGNED.getCode());
distributionOrderRequestDto.setNotFilterLogisticsState(LogisticsStateEnum.StateEnum.SIGNED.getCode());
// distributionOrderRequestDto.setNotFilterLogisticsState(LogisticsStateEnum.StateEnum.SIGNED.getCode());
int page = 0;
while (hasNextPage) {
page = page + 1;
......@@ -104,17 +104,21 @@ public class RefreshLogisticsJob {
}
LogisticsInfo logisticsInfo = (LogisticsInfo) result.getData();
int logisticsState = Integer.parseInt(logisticsInfo.getState());
logger.info("logisticsInfo : {}", logisticsInfo);
if (distributionOrder.getLogisticsState() == null || logisticsState != distributionOrder.getLogisticsState().intValue()) {
DistributionOrder updateDto = new DistributionOrder();
updateDto.setDistributionOrderId(orderId);
updateDto.setLogisticsState(logisticsState);
logger.info("logisticsState : {}", logisticsState);
if (logisticsState == LogisticsStateEnum.StateEnum.SIGNED.getCode()) {
List<TrailInfo> trailInfoList = logisticsInfo.getTrailInfoList();
logger.info("trailInfoList : {}", trailInfoList);
TrailInfo lastInfo = trailInfoList.get(0);
updateDto.setSignedTime(DateUtils.parseString(lastInfo.getCreateTime()));
//并修改订单状态为已签收
updateDto.setState(DistributionEnum.DistributionOrderStateEnum.SIGNED.getCode());
}
logger.info("updatedto : {}", updateDto);
distributionOrderDao.update(updateDto);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment