|
@@ -272,25 +272,38 @@ public class MerchantApiController {
|
|
|
}
|
|
|
|
|
|
// if (vehicleInfoList.size()>0){
|
|
|
- //今日收益
|
|
|
- BigDecimal todaySum = orderInfoService.paySum(vehicleInfoList, null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
- if (todaySum != null) {
|
|
|
- todayRevenue = todaySum;
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()),accountInfo);
|
|
|
+
|
|
|
+ if (shiftInfoList.size()>0){
|
|
|
+ //今日收益
|
|
|
+ BigDecimal todaySum = orderInfoService.paySum(null, shiftInfoList,null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ if (todaySum != null) {
|
|
|
+ todayRevenue = todaySum;
|
|
|
+ }
|
|
|
}
|
|
|
- //昨日收益
|
|
|
- BigDecimal yesterdaySum = orderInfoService.paySum(vehicleInfoList, null, null, DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -1)), DateUtil.endOfDay(DateUtil.offsetDay(new Date(), -1)), null);
|
|
|
- if (yesterdaySum != null) {
|
|
|
- yesterdayRevenue = yesterdaySum;
|
|
|
+
|
|
|
+ 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);
|
|
|
+ if (yesterdaySum != null) {
|
|
|
+ yesterdayRevenue = yesterdaySum;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- //总收益
|
|
|
- BigDecimal totalSum = orderInfoService.paySum(vehicleInfoList, null, null, null, new cn.hutool.core.date.DateTime(), null);
|
|
|
+ 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);
|
|
|
|
|
|
- if (totalSum != null) {
|
|
|
- totalRevenue = totalSum;
|
|
|
+ if (totalSum != null) {
|
|
|
+ totalRevenue = totalSum;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
// }
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -346,36 +359,41 @@ public class MerchantApiController {
|
|
|
Integer num = 0;
|
|
|
|
|
|
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), accountInfo);
|
|
|
// if (vehicleInfoList.size()>0){
|
|
|
+
|
|
|
+ if (shiftInfoList.size() > 0) {
|
|
|
+
|
|
|
+
|
|
|
//微信
|
|
|
- BigDecimal wechatSum = orderInfoService.paySum(vehicleInfoList, null, "wechat", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ 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(vehicleInfoList, null, "alipay", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ 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(vehicleInfoList, null, "cash", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ 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(vehicleInfoList, null, "ticket", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ 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(vehicleInfoList, null, null, DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), null);
|
|
|
+ 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<>();
|
|
@@ -590,17 +608,22 @@ public class MerchantApiController {
|
|
|
if (accountInfo == null) {
|
|
|
throw new Exception("请重新登录");
|
|
|
}
|
|
|
+ List<VehicleDTO> list = new ArrayList<>();
|
|
|
|
|
|
- List<VehicleInfo> vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
|
|
- List<VehicleDTO> list = new ArrayList<>();
|
|
|
- if (vehicleInfoList.size() > 0) {
|
|
|
- for (VehicleInfo vehicleInfo : vehicleInfoList) {
|
|
|
- VehicleDTO vehicleDTO = new VehicleDTO();
|
|
|
- BeanUtils.copyProperties(vehicleInfo, vehicleDTO);
|
|
|
- list.add(vehicleDTO);
|
|
|
+ if (StringUtils.isNotBlank(accountInfo.getRoles())){
|
|
|
+ List<VehicleInfo> vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
+
|
|
|
+
|
|
|
+ if (vehicleInfoList.size() > 0) {
|
|
|
+ for (VehicleInfo vehicleInfo : vehicleInfoList) {
|
|
|
+ VehicleDTO vehicleDTO = new VehicleDTO();
|
|
|
+ BeanUtils.copyProperties(vehicleInfo, vehicleDTO);
|
|
|
+ list.add(vehicleDTO);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
messageResult.setData(list);
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setCode(200);
|
|
@@ -628,10 +651,19 @@ public class MerchantApiController {
|
|
|
try {
|
|
|
|
|
|
ProfitListDTO profitListDTO = new ProfitListDTO();
|
|
|
+ List<ProfitListDTO> list = new ArrayList<>();
|
|
|
+ BigDecimal revenue = BigDecimal.ZERO;
|
|
|
+ Date startDate = DateUtil.endOfDay(new Date());
|
|
|
+ Date newDate = DateUtil.beginOfMonth(new Date());
|
|
|
+ String dateDesc = DateUtil.format(newDate, "yyyy年MM月");
|
|
|
AccountInfo accountInfo = accountInfoService.get(subject);
|
|
|
if (accountInfo == null) {
|
|
|
throw new Exception("请重新登录");
|
|
|
}
|
|
|
+
|
|
|
+ if (StringUtils.isBlank(accountInfo.getRoles())){
|
|
|
+ throw new Exception("账户未分配角色");
|
|
|
+ }
|
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
|
List<VehicleInfo> vehicleInfoList = new ArrayList<>();
|
|
|
if (StringUtils.isNotBlank(vehicleId)) {
|
|
@@ -644,11 +676,13 @@ public class MerchantApiController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
int n = 0;
|
|
|
//开始计算的日期
|
|
|
- Date startDate = DateUtil.endOfDay(new Date());
|
|
|
- Date newDate = DateUtil.beginOfMonth(new Date());
|
|
|
- String dateDesc = DateUtil.format(newDate, "yyyy年MM月");
|
|
|
if (StringUtils.isNotBlank(dateStr)) {
|
|
|
Date date = DateUtil.parse(dateStr, "yyyy-MM");
|
|
|
|
|
@@ -664,23 +698,24 @@ public class MerchantApiController {
|
|
|
n = DateUtil.thisDayOfMonth();
|
|
|
}
|
|
|
|
|
|
- BigDecimal revenue = BigDecimal.ZERO;
|
|
|
+
|
|
|
|
|
|
profitListDTO.setDateDesc(dateDesc);
|
|
|
|
|
|
|
|
|
- List<ProfitListDTO> list = new ArrayList<>();
|
|
|
+
|
|
|
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;
|
|
|
- // if (vehicleInfoList.size()>0){
|
|
|
- baseSum = orderInfoService.paySum(vehicleInfoList, null, payName, baseStartDate, baseDate, 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);
|
|
@@ -914,9 +949,11 @@ 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);
|
|
|
// if (vehicleInfoList.size()>0){
|
|
|
- BigDecimal wechatTodaySum = orderInfoService.paySum(null, companyInfo.getId(), "wechat", DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), false);
|
|
|
- BigDecimal alipayTodaySum = orderInfoService.paySum(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);
|
|
|
|
|
|
// }
|