| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | |
| | | .ne("type", 1) |
| | | .isNotNull("orderType")); |
| | | }else{ |
| | | if (time == 5 && insertTime==null){ |
| | | if (time == 5 && !StringUtils.hasLength(insertTime)){ |
| | | incomes = tIncomeService.selectList(new EntityWrapper<Income>() |
| | | .eq("userType", 1) |
| | | .eq("objectId",1) |
| | |
| | | } |
| | | |
| | | EntityWrapper<SettlementDetail> settlementDetailEntityWrapper = new EntityWrapper<>(); |
| | | if (time == 5 && insertTime==null){ |
| | | if (time == 5 && !StringUtils.hasLength(insertTime)){ |
| | | |
| | | }else{ |
| | | settlementDetailEntityWrapper.between("createTime", start, end); |
| | |
| | | platformVO.setMoney(bigDecimal1); |
| | | platformVO.setPayType("现金支付"); |
| | | if (settlementDetail.getSettlementRecordId()!=null){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | if (settlementRecord.getPaymentStatus()!=null && settlementRecord.getPaymentStatus()==2){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | // 未结算 |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | } |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | } |
| | | // 未结算 |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | } |
| | | |
| | | res.add(platformVO); |
| | |
| | | platformVO.setInsertTime(format.format(tOrderLogistics.getInsertTime())); |
| | | platformVO.setPayType("现金支付"); |
| | | if (settlementDetail.getSettlementRecordId()!=null){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | if (settlementRecord.getPaymentStatus()!=null && settlementRecord.getPaymentStatus()==2){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | // 未结算 |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | } |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | } |
| | | // 未结算 |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | } |
| | | res.add(platformVO); |
| | | break; |
| | |
| | | @RequestMapping(value = "/water/getCount") |
| | | @ResponseBody |
| | | public Object getCount1(Integer time,String insertTime,Integer payType,Integer type) { |
| | | if (payType!=null){ |
| | | switch (payType){ |
| | | case 1: |
| | | payType = 2; |
| | | break; |
| | | case 2: |
| | | payType = 1; |
| | | break; |
| | | } |
| | | } |
| | | if (time == null){ |
| | | time = 1; |
| | | } |
| | |
| | | EntityWrapper<TOrderLogistics> tOrderLogisticsEntityWrapper = new EntityWrapper<>(); |
| | | // 司机手动结算金额 |
| | | Wrapper<SettlementDetail> orderType1 = new EntityWrapper<SettlementDetail>(); |
| | | if (time == 5 && insertTime==null){ |
| | | if (time == 5 && !StringUtils.hasLength(insertTime)){ |
| | | // 余额充值wrapper |
| | | orderType = new EntityWrapper<TPubTransactionDetails>() |
| | | .eq("userType",1) |
| | |
| | | break; |
| | | } |
| | | |
| | | |
| | | |
| | | // 司机提现 |
| | | for (TPubWithdrawal tPubWithdrawal : driver) { |
| | | if(payType!=null && payType == 2){ |
| | | if(payType!=null && payType == 1){ |
| | | break; |
| | | } |
| | | WaterVO waterVO = new WaterVO(); |
| | |
| | | } |
| | | // 用户提现 |
| | | for (TPubWithdrawal tPubWithdrawal : user) { |
| | | if(payType!=null && payType == 2){ |
| | | if(payType!=null && payType == 1){ |
| | | break; |
| | | } |
| | | WaterVO waterVO = new WaterVO(); |
| | | waterVO.setInsertTime(format.format(tPubWithdrawal.getHandleTime())); |
| | | if (tPubWithdrawal.getHandleTime()!=null){ |
| | | waterVO.setInsertTime(format.format(tPubWithdrawal.getHandleTime())); |
| | | } |
| | | waterVO.setCode(tPubWithdrawal.getCode()); |
| | | TUser user2 = appUserService.selectById(tPubWithdrawal.getUserId()); |
| | | if (user2!=null){ |
| | |
| | | Integer orderId = tPubTransactionDetail.getOrderId(); |
| | | PaymentRecord paymentRecord = paymentRecordService.selectById(orderId); |
| | | if (paymentRecord!=null){ |
| | | if (paymentRecord.getState() == 1){ |
| | | // 临时数据 |
| | | continue; |
| | | } |
| | | waterVO.setInsertTime(format.format(paymentRecord.getInsertTime())); |
| | | waterVO.setCode(paymentRecord.getCode()); |
| | | if (paymentRecord.getPayType()!=null){ |
| | |
| | | case 1: |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(income.getSettlementRecordId()); |
| | | if (settlementRecord!=null){ |
| | | if (settlementRecord.getPayType()!=null){ |
| | | if (settlementRecord.getPaymentStatus()!=null && settlementRecord.getPaymentStatus() == 2){ |
| | | switch (settlementRecord.getPayType()){ |
| | | case 1: |
| | | if (payType!=null){ |
| | | if (payType == 1){ |
| | | if (payType != 1){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | break; |
| | | case 2: |
| | | if (payType!=null){ |
| | | if (payType == 2){ |
| | | if (payType != 2){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | }else{ |
| | | continue; |
| | | } |
| | | }else{ |
| | | continue; |
| | |
| | | break; |
| | | case 4: |
| | | SettlementRecord settlementRecord1 = settlementRecordService.selectById(income.getSettlementRecordId()); |
| | | if (settlementRecord1==null){ |
| | | if (settlementRecord1!=null&& settlementRecord1.getPaymentStatus()!=null && settlementRecord1.getPaymentStatus() == 2){ |
| | | if (settlementRecord1.getPayType()!=null){ |
| | | switch (settlementRecord1.getPayType()){ |
| | | case 1: |
| | | if (payType!=null){ |
| | | if (payType == 1){ |
| | | if (payType != 1){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | break; |
| | | case 2: |
| | | if (payType!=null){ |
| | | if (payType == 2){ |
| | | if (payType != 2){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | }else { |
| | | continue; |
| | | } |
| | | // 小件物流 |
| | | // 查询订单信息 |
| | |
| | | break; |
| | | } |
| | | } |
| | | // 过滤掉res中insertTime未空的数据 |
| | | res.removeIf(waterVO -> waterVO.getInsertTime() == null); |
| | | Collections.sort(res, Comparator.comparing(WaterVO::getInsertTime).reversed()); |
| | | WaterMoneyVO waterMoneyVO = new WaterMoneyVO(); |
| | | BigDecimal add = userRecharge.add(userConsume).add(balance).subtract(driverWithdrawal).subtract(userWithdrawal); |
| | |
| | | @RequestMapping(value = "/water/list") |
| | | @ResponseBody |
| | | public Object list1(Integer time,String insertTime,Integer payType,Integer type) { |
| | | if (payType!=null){ |
| | | switch (payType){ |
| | | case 1: |
| | | payType = 2; |
| | | break; |
| | | case 2: |
| | | payType = 1; |
| | | break; |
| | | } |
| | | } |
| | | if (time == null){ |
| | | time = 1; |
| | | } |
| | |
| | | EntityWrapper<TOrderLogistics> tOrderLogisticsEntityWrapper = new EntityWrapper<>(); |
| | | // 司机手动结算金额 |
| | | Wrapper<SettlementDetail> orderType1 = new EntityWrapper<SettlementDetail>(); |
| | | if (time == 5 && insertTime==null){ |
| | | if (time == 5 && !StringUtils.hasLength(insertTime)){ |
| | | // 余额充值wrapper |
| | | orderType = new EntityWrapper<TPubTransactionDetails>() |
| | | .eq("userType",1) |
| | |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | WaterVO waterVO = new WaterVO(); |
| | | waterVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | | waterVO.setType("用户订单消费"); |
| | |
| | | } |
| | | // 司机提现 |
| | | for (TPubWithdrawal tPubWithdrawal : driver) { |
| | | if(payType!=null && payType == 2){ |
| | | if(payType!=null && payType == 1){ |
| | | break; |
| | | } |
| | | WaterVO waterVO = new WaterVO(); |
| | |
| | | } |
| | | // 用户提现 |
| | | for (TPubWithdrawal tPubWithdrawal : user) { |
| | | if(payType!=null && payType == 2){ |
| | | if(payType!=null && payType == 1){ |
| | | break; |
| | | } |
| | | WaterVO waterVO = new WaterVO(); |
| | |
| | | Integer orderId = tPubTransactionDetail.getOrderId(); |
| | | PaymentRecord paymentRecord = paymentRecordService.selectById(orderId); |
| | | if (paymentRecord!=null){ |
| | | if (paymentRecord.getState() == 1){ |
| | | // 临时数据 |
| | | continue; |
| | | } |
| | | waterVO.setInsertTime(format.format(paymentRecord.getInsertTime())); |
| | | waterVO.setCode(paymentRecord.getCode()); |
| | | if (paymentRecord.getPayType()!=null){ |
| | |
| | | userRecharge = userRecharge.add(new BigDecimal(paymentRecord.getAmount().toString())); |
| | | } |
| | | // 查询所有已结算的订单 |
| | | // 查询所有已结算的订单 |
| | | for (SettlementDetail income : settlementDetails1) { |
| | | WaterVO platformVO = new WaterVO(); |
| | | platformVO.setType("司机结算"); |
| | | switch (income.getOrderType()){ |
| | | case 1: |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(income.getSettlementRecordId()); |
| | | if (settlementRecord!=null){ |
| | | if (settlementRecord!=null && settlementRecord.getPaymentStatus()!=null && settlementRecord.getPaymentStatus() == 2){ |
| | | if (settlementRecord.getPayType()!=null){ |
| | | switch (settlementRecord.getPayType()){ |
| | | case 1: |
| | | if (payType!=null){ |
| | | if (payType == 1){ |
| | | if (payType != 1){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | break; |
| | | case 2: |
| | | if (payType!=null){ |
| | | if (payType == 2){ |
| | | if (payType != 2){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | // 小件物流 |
| | | // 查询订单信息 |
| | | SettlementRecord settlementRecord1 = settlementRecordService.selectById(income.getSettlementRecordId()); |
| | | if (settlementRecord1==null){ |
| | | if (settlementRecord1.getPayType()!=null){ |
| | | if (settlementRecord1!=null){ |
| | | if (settlementRecord1.getPaymentStatus()!=null && settlementRecord1.getPaymentStatus() == 2){ |
| | | switch (settlementRecord1.getPayType()){ |
| | | case 1: |
| | | if (payType!=null){ |
| | | if (payType == 1){ |
| | | if (payType != 1){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | break; |
| | | case 2: |
| | | if (payType!=null){ |
| | | if (payType == 2){ |
| | | if (payType != 2){ |
| | | continue; |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | }else{ |
| | | continue; |
| | | } |
| | | }else{ |
| | | continue; |
| | | } |
| | | TOrderLogistics tOrderLogistics1 = orderLogisticsService.selectById(income.getOrderId()); |
| | | if (tOrderLogistics1==null){ |
| | |
| | | .ne("type", 1) |
| | | .isNotNull("orderType")); |
| | | }else{ |
| | | if (time == 5 && insertTime==null){ |
| | | |
| | | if (time == 5 && !StringUtils.hasLength(insertTime)){ |
| | | incomes = tIncomeService.selectList(new EntityWrapper<Income>() |
| | | .eq("userType", 1) |
| | | .eq("objectId",1) |
| | |
| | | } |
| | | } |
| | | EntityWrapper<SettlementDetail> settlementDetailEntityWrapper = new EntityWrapper<>(); |
| | | if (time == 5 && insertTime==null){ |
| | | if (time == 5 && !StringUtils.hasLength(insertTime)){ |
| | | |
| | | }else{ |
| | | settlementDetailEntityWrapper.between("createTime", start, end); |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | // 查询所有现金支付的订单 |
| | | for (SettlementDetail settlementDetail : settlementDetails) { |
| | | PlatformVO platformVO = new PlatformVO(); |
| | |
| | | platformVO.setDriverName(tDriver.getFirstName()+tDriver.getLastName()); |
| | | platformVO.setDriverPhone(tDriver.getPhone()); |
| | | } |
| | | |
| | | platformVO.setRemark(tOrderPrivateCar.getRemark()); |
| | | |
| | | platformVO.setInsertTime(format.format(tOrderPrivateCar.getInsertTime())); |
| | | String string = settlementDetail.getPrice().toString(); |
| | | BigDecimal bigDecimal1 = new BigDecimal(string); |
| | | platformVO.setMoney(bigDecimal1); |
| | | platformVO.setPayType("现金支付"); |
| | | |
| | | if (settlementDetail.getSettlementRecordId()!=null){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | if (settlementRecord.getPaymentStatus()!=null && settlementRecord.getPaymentStatus()==2){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getPayTime())); |
| | | }else{ |
| | | // 未结算 |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | } |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | } |
| | | // 未结算 |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | } |
| | | |
| | | res.add(platformVO); |
| | | break; |
| | | case 4: |
| | |
| | | platformVO.setInsertTime(format.format(tOrderLogistics.getInsertTime())); |
| | | platformVO.setPayType("现金支付"); |
| | | if (settlementDetail.getSettlementRecordId()!=null){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | SettlementRecord settlementRecord = settlementRecordService.selectById(settlementDetail.getSettlementRecordId()); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | if (settlementRecord.getPaymentStatus()!=null && settlementRecord.getPaymentStatus()==2){ |
| | | if (state!=null && state!=1){ |
| | | continue; |
| | | } |
| | | // 已结算 |
| | | platformVO.setState(1); |
| | | balance = balance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | }else{ |
| | | // 未结算 |
| | | if (state!=null && state!=2){ |
| | | continue; |
| | | } |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | platformVO.setEndTime(format.format(settlementRecord.getDay())); |
| | | } |
| | | // 未结算 |
| | | platformVO.setState(2); |
| | | unBalance = unBalance.add(new BigDecimal(settlementDetail.getPrice())); |
| | | } |
| | | res.add(platformVO); |
| | | break; |