|
@@ -272,29 +272,29 @@ public class MerchantApiController {
|
|
|
}
|
|
|
|
|
|
// if (vehicleInfoList.size()>0){
|
|
|
- List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()),accountInfo);
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), accountInfo);
|
|
|
|
|
|
- if (shiftInfoList.size()>0){
|
|
|
+ if (shiftInfoList.size() > 0) {
|
|
|
//今日收益
|
|
|
- BigDecimal todaySum = orderInfoService.paySum(null, shiftInfoList,null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ BigDecimal todaySum = orderInfoService.paySum(null, shiftInfoList, null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
if (todaySum != null) {
|
|
|
todayRevenue = todaySum;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<ShiftInfo> shiftInfoList1 = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)), DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)),accountInfo);
|
|
|
- if (shiftInfoList1.size()>0){
|
|
|
+ List<ShiftInfo> shiftInfoList1 = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)), DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)), accountInfo);
|
|
|
+ if (shiftInfoList1.size() > 0) {
|
|
|
//昨日收益
|
|
|
- BigDecimal yesterdaySum = orderInfoService.paySum(null, shiftInfoList1,null, null, DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)), DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)), null);
|
|
|
+ BigDecimal yesterdaySum = orderInfoService.paySum(null, shiftInfoList1, null, null, DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)), DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)), null);
|
|
|
if (yesterdaySum != null) {
|
|
|
yesterdayRevenue = yesterdaySum;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<ShiftInfo> shiftInfoList2 = shiftInfoService.findByVehicleDateAccount(null, new cn.hutool.core.date.DateTime(),accountInfo);
|
|
|
- if (shiftInfoList2.size()>0){
|
|
|
+ List<ShiftInfo> shiftInfoList2 = shiftInfoService.findByVehicleDateAccount(null, new cn.hutool.core.date.DateTime(), accountInfo);
|
|
|
+ if (shiftInfoList2.size() > 0) {
|
|
|
//总收益
|
|
|
- BigDecimal totalSum = orderInfoService.paySum(null, shiftInfoList2,null, null, null, new cn.hutool.core.date.DateTime(), null);
|
|
|
+ BigDecimal totalSum = orderInfoService.paySum(null, shiftInfoList2, null, null, null, new cn.hutool.core.date.DateTime(), null);
|
|
|
|
|
|
if (totalSum != null) {
|
|
|
totalRevenue = totalSum;
|
|
@@ -302,8 +302,6 @@ public class MerchantApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
// }
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -365,35 +363,35 @@ public class MerchantApiController {
|
|
|
if (shiftInfoList.size() > 0) {
|
|
|
|
|
|
|
|
|
- //微信
|
|
|
- BigDecimal wechatSum = orderInfoService.paySum(null, shiftInfoList, null, "wechat", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
- if (wechatSum != null) {
|
|
|
- wechatRevenue = wechatSum;
|
|
|
- }
|
|
|
- //支付宝
|
|
|
- BigDecimal alipaySum = orderInfoService.paySum(null, shiftInfoList, null, "alipay", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
- if (alipaySum != null) {
|
|
|
- alipayRevenue = alipaySum;
|
|
|
- }
|
|
|
+ //微信
|
|
|
+ BigDecimal wechatSum = orderInfoService.paySum(null, shiftInfoList, null, "wechat", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ if (wechatSum != null) {
|
|
|
+ wechatRevenue = wechatSum;
|
|
|
+ }
|
|
|
+ //支付宝
|
|
|
+ BigDecimal alipaySum = orderInfoService.paySum(null, shiftInfoList, null, "alipay", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ if (alipaySum != null) {
|
|
|
+ alipayRevenue = alipaySum;
|
|
|
+ }
|
|
|
|
|
|
- //现金
|
|
|
- BigDecimal cashSum = orderInfoService.paySum(null, shiftInfoList, null, "cash", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
- if (cashSum != null) {
|
|
|
- cashRevenue = cashSum;
|
|
|
- }
|
|
|
+ //现金
|
|
|
+ BigDecimal cashSum = orderInfoService.paySum(null, shiftInfoList, null, "cash", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ if (cashSum != null) {
|
|
|
+ cashRevenue = cashSum;
|
|
|
+ }
|
|
|
|
|
|
- //车票
|
|
|
- BigDecimal ticketSum = orderInfoService.paySum(null, shiftInfoList, null, "ticket", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
- if (ticketSum != null) {
|
|
|
- ticketRevenue = ticketSum;
|
|
|
- }
|
|
|
+ //车票
|
|
|
+ BigDecimal ticketSum = orderInfoService.paySum(null, shiftInfoList, null, "ticket", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ if (ticketSum != null) {
|
|
|
+ ticketRevenue = ticketSum;
|
|
|
+ }
|
|
|
|
|
|
- Integer ticketNum = orderInfoService.payNum(null, shiftInfoList, null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
- if (ticketNum != null) {
|
|
|
- num = ticketNum;
|
|
|
- }
|
|
|
+ Integer ticketNum = orderInfoService.payNum(null, shiftInfoList, null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ if (ticketNum != null) {
|
|
|
+ num = ticketNum;
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
// }
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -437,59 +435,73 @@ public class MerchantApiController {
|
|
|
vehicleInfoList.add(vehicleInfo);
|
|
|
}
|
|
|
|
|
|
+ List<ShiftInfo> shiftInfoList0 = null;
|
|
|
searchParams.put("vehicleInfoList", vehicleInfoList);
|
|
|
- if (StringUtils.isNotBlank(date)){
|
|
|
+ if (StringUtils.isNotBlank(date)) {
|
|
|
searchParams.put("startTime", DateUtil.beginOfDay(DateUtil.parse(date)));
|
|
|
searchParams.put("endTime", DateUtil.endOfDay(DateUtil.parse(date)));
|
|
|
+ shiftInfoList0 = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(DateUtil.parse(date)), DateUtil.endOfDay(DateUtil.parse(date)), accountInfo);
|
|
|
+ } else {
|
|
|
+ shiftInfoList0 = shiftInfoService.findByVehicleDateAccount(null, null, accountInfo);
|
|
|
}
|
|
|
|
|
|
- List<Sort> sortList = new ArrayList<>();
|
|
|
- sortList.add(new Sort("a.vehicle_id", "desc"));
|
|
|
- sortList.add(new Sort("a.create_time", "desc"));
|
|
|
- Page<ShiftInfo> page = shiftInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
- List<ShiftInfo> shiftInfoList = page.getResult();
|
|
|
- List<VehicleShiftListDTO> list = new ArrayList<>();
|
|
|
- if (shiftInfoList.size() > 0) {
|
|
|
- for (ShiftInfo shiftInfo : shiftInfoList) {
|
|
|
- VehicleShiftListDTO vehicleShiftListDTO = new VehicleShiftListDTO();
|
|
|
- VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
- String dateStr1 = DateUtil.format(shiftInfo.getCreateTime(), "yyyy-MM-dd");
|
|
|
- String dateStr2 = DateUtil.format(shiftInfo.getCreateTime(), "HH:mm");
|
|
|
- if ("1".equals(shiftInfo.getStatus())) {
|
|
|
- dateStr2 = dateStr2 + "-" + "待结束";
|
|
|
- }
|
|
|
- if ("2".equals(shiftInfo.getStatus())) {
|
|
|
- dateStr2 = dateStr2 + "-" + DateUtil.format(shiftInfo.getFinishTime(), "HH:mm");
|
|
|
- }
|
|
|
- vehicleShiftListDTO.setId(shiftInfo.getId());
|
|
|
- vehicleShiftListDTO.setCarNum(vehicleInfo.getLicensePlateNumber());
|
|
|
- vehicleShiftListDTO.setDateStr(dateStr1 + " " + dateStr2);
|
|
|
-
|
|
|
- Map<String, Object> searchParams1 = new HashMap<>();
|
|
|
- searchParams1.put("payStatus",20);
|
|
|
- searchParams1.put("vehicleShiftId",shiftInfo.getId());
|
|
|
- List<Sort> sortList1 = new ArrayList<>();
|
|
|
- sortList1.add(new Sort("a.pay_time","desc"));
|
|
|
- List<OrderInfo> orderInfoList = orderInfoService.findBySearchParams(searchParams1,sortList1);
|
|
|
- BigDecimal total = BigDecimal.ZERO;
|
|
|
- if (orderInfoList.size()>0){
|
|
|
- for (OrderInfo orderInfo : orderInfoList){
|
|
|
- total = total.add(orderInfo.getPayFee());
|
|
|
+ Map<String, Object> pageMap = new HashMap<>();
|
|
|
+
|
|
|
+ if (shiftInfoList0 != null && shiftInfoList0.size() > 0) {
|
|
|
+
|
|
|
+ searchParams.put("shiftInfoList", shiftInfoList0);
|
|
|
+
|
|
|
+
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
+ sortList.add(new Sort("a.vehicle_id", "desc"));
|
|
|
+ sortList.add(new Sort("a.create_time", "desc"));
|
|
|
+
|
|
|
+ Page<ShiftInfo> page = shiftInfoService.pageSearch(searchParams, pageIndex, pageSize, true, sortList);
|
|
|
+ List<ShiftInfo> shiftInfoList = page.getResult();
|
|
|
+ List<VehicleShiftListDTO> list = new ArrayList<>();
|
|
|
+ if (shiftInfoList.size() > 0) {
|
|
|
+ for (ShiftInfo shiftInfo : shiftInfoList) {
|
|
|
+ VehicleShiftListDTO vehicleShiftListDTO = new VehicleShiftListDTO();
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
+ String dateStr1 = DateUtil.format(shiftInfo.getCreateTime(), "yyyy-MM-dd");
|
|
|
+ String dateStr2 = DateUtil.format(shiftInfo.getCreateTime(), "HH:mm");
|
|
|
+ if ("1".equals(shiftInfo.getStatus())) {
|
|
|
+ dateStr2 = dateStr2 + "-" + "待结束";
|
|
|
+ }
|
|
|
+ if ("2".equals(shiftInfo.getStatus())) {
|
|
|
+ dateStr2 = dateStr2 + "-" + DateUtil.format(shiftInfo.getFinishTime(), "HH:mm");
|
|
|
+ }
|
|
|
+ vehicleShiftListDTO.setId(shiftInfo.getId());
|
|
|
+ vehicleShiftListDTO.setCarNum(vehicleInfo.getLicensePlateNumber());
|
|
|
+ vehicleShiftListDTO.setDateStr(dateStr1 + " " + dateStr2);
|
|
|
+
|
|
|
+ Map<String, Object> searchParams1 = new HashMap<>();
|
|
|
+ searchParams1.put("payStatus", 20);
|
|
|
+ searchParams1.put("vehicleShiftId", shiftInfo.getId());
|
|
|
+ List<Sort> sortList1 = new ArrayList<>();
|
|
|
+ sortList1.add(new Sort("a.pay_time", "desc"));
|
|
|
+ List<OrderInfo> orderInfoList = orderInfoService.findBySearchParams(searchParams1, sortList1);
|
|
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
+ if (orderInfoList.size() > 0) {
|
|
|
+ for (OrderInfo orderInfo : orderInfoList) {
|
|
|
+ total = total.add(orderInfo.getPayFee());
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+ vehicleShiftListDTO.setTotal(total);
|
|
|
+ list.add(vehicleShiftListDTO);
|
|
|
}
|
|
|
|
|
|
- vehicleShiftListDTO.setTotal(total);
|
|
|
- list.add(vehicleShiftListDTO);
|
|
|
}
|
|
|
|
|
|
+ pageMap.put("recordsTotal", page.getTotal());
|
|
|
+ pageMap.put("recordsFiltered", page.getTotal());
|
|
|
+ pageMap.put("totalPage", page.getPages());
|
|
|
+ pageMap.put("pageNumber", page.getPageNum());
|
|
|
+ pageMap.put("pageSize", page.getPageSize());
|
|
|
+ pageMap.put("data", list);
|
|
|
+
|
|
|
}
|
|
|
- Map<String, Object> pageMap = new HashMap<>();
|
|
|
- pageMap.put("recordsTotal", page.getTotal());
|
|
|
- pageMap.put("recordsFiltered", page.getTotal());
|
|
|
- pageMap.put("totalPage", page.getPages());
|
|
|
- pageMap.put("pageNumber", page.getPageNum());
|
|
|
- pageMap.put("pageSize", page.getPageSize());
|
|
|
- pageMap.put("data", list);
|
|
|
|
|
|
|
|
|
messageResult.setData(pageMap);
|
|
@@ -533,14 +545,13 @@ public class MerchantApiController {
|
|
|
if ("2".equals(shiftInfo.getStatus())) {
|
|
|
shiftDateStr = shiftDateStr + "-" + DateUtil.format(shiftInfo.getFinishTime(), "HH:mm");
|
|
|
}
|
|
|
- vehicleShiftDTO.setRouteName(startStation.getName()+"-" + endStation.getName());
|
|
|
+ vehicleShiftDTO.setRouteName(startStation.getName() + "-" + endStation.getName());
|
|
|
vehicleShiftDTO.setCarNum(vehicleInfo.getLicensePlateNumber());
|
|
|
vehicleShiftDTO.setDriverName(driverInfo.getName());
|
|
|
- vehicleShiftDTO.setDateStr(DateUtil.format(shiftInfo.getCreateTime(),"yyyy-MM-dd"));
|
|
|
+ vehicleShiftDTO.setDateStr(DateUtil.format(shiftInfo.getCreateTime(), "yyyy-MM-dd"));
|
|
|
vehicleShiftDTO.setShiftDateStr(shiftDateStr);
|
|
|
|
|
|
|
|
|
-
|
|
|
Map<String, Object> searchParams = new HashMap<>();
|
|
|
searchParams.put("shiftId", shiftInfo.getId());
|
|
|
searchParams.put("payStatus", 20);
|
|
@@ -568,7 +579,7 @@ public class MerchantApiController {
|
|
|
listTmp.add(val);
|
|
|
}
|
|
|
}
|
|
|
- for (Map.Entry<BigDecimal, List<OrderInfo>> date : map.entrySet()){
|
|
|
+ for (Map.Entry<BigDecimal, List<OrderInfo>> date : map.entrySet()) {
|
|
|
BigDecimal payFee = date.getKey();
|
|
|
List<OrderInfo> orderInfos = date.getValue();
|
|
|
ShiftRevenueDTO shiftRevenueDTO = new ShiftRevenueDTO();
|
|
@@ -582,7 +593,6 @@ public class MerchantApiController {
|
|
|
vehicleShiftDTO.setTotal(total);
|
|
|
|
|
|
|
|
|
-
|
|
|
messageResult.setData(vehicleShiftDTO);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
@@ -611,7 +621,7 @@ public class MerchantApiController {
|
|
|
List<VehicleDTO> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
- if (StringUtils.isNotBlank(accountInfo.getRoles())){
|
|
|
+ if (StringUtils.isNotBlank(accountInfo.getRoles())) {
|
|
|
List<VehicleInfo> vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
|
|
|
|
@@ -661,7 +671,7 @@ public class MerchantApiController {
|
|
|
throw new Exception("请重新登录");
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isBlank(accountInfo.getRoles())){
|
|
|
+ if (StringUtils.isBlank(accountInfo.getRoles())) {
|
|
|
throw new Exception("账户未分配角色");
|
|
|
}
|
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
@@ -676,11 +686,6 @@ public class MerchantApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
int n = 0;
|
|
|
//开始计算的日期
|
|
|
if (StringUtils.isNotBlank(dateStr)) {
|
|
@@ -699,23 +704,21 @@ public class MerchantApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
profitListDTO.setDateDesc(dateDesc);
|
|
|
|
|
|
|
|
|
-
|
|
|
if (n > 0) {
|
|
|
for (int m = 0; m < n; m++) {
|
|
|
ProfitListDTO profitListDTO1 = new ProfitListDTO();
|
|
|
Date baseDate = DateUtil.offsetDay(startDate, -m);
|
|
|
Date baseStartDate = DateUtil.beginOfDay(baseDate);
|
|
|
BigDecimal baseSum = BigDecimal.ZERO;
|
|
|
- List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(baseStartDate,baseDate,accountInfo);
|
|
|
- if (shiftInfoList.size()>0){
|
|
|
- baseSum = orderInfoService.paySum(null,shiftInfoList, null, payName, null, null, null);
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(baseStartDate, baseDate, accountInfo);
|
|
|
+ if (shiftInfoList.size() > 0) {
|
|
|
+ baseSum = orderInfoService.paySum(null, shiftInfoList, null, payName, null, null, null);
|
|
|
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
profitListDTO1.setDateDesc(DateUtil.format(baseDate, "yyyy-MM-dd"));
|
|
|
profitListDTO1.setRevenue(baseSum == null ? BigDecimal.ZERO : baseSum);
|
|
@@ -950,10 +953,10 @@ public class MerchantApiController {
|
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
|
List<VehicleInfo> vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
|
|
|
|
|
|
- List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()),accountInfo);
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), accountInfo);
|
|
|
// if (vehicleInfoList.size()>0){
|
|
|
- BigDecimal wechatTodaySum = orderInfoService.paySum(null,null, companyInfo.getId(), "wechat", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), false);
|
|
|
- BigDecimal alipayTodaySum = orderInfoService.paySum(null, null,companyInfo.getId(), "alipay", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), false);
|
|
|
+ BigDecimal wechatTodaySum = orderInfoService.paySum(null, null, companyInfo.getId(), "wechat", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), false);
|
|
|
+ BigDecimal alipayTodaySum = orderInfoService.paySum(null, null, companyInfo.getId(), "alipay", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), false);
|
|
|
todayRevenue = (wechatTodaySum == null ? BigDecimal.ZERO : wechatTodaySum).add(alipayTodaySum == null ? BigDecimal.ZERO : alipayTodaySum);
|
|
|
|
|
|
// }
|