Commit 51476920 authored by shiyu's avatar shiyu

计算用户账单

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