|
@@ -8,7 +8,10 @@ import com.jpsoft.bus.modules.base.entity.OrderInfo;
|
|
import com.jpsoft.bus.modules.base.entity.ProblemFeedback;
|
|
import com.jpsoft.bus.modules.base.entity.ProblemFeedback;
|
|
import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
|
|
import com.jpsoft.bus.modules.base.service.MergeOrderInfoService;
|
|
import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
import com.jpsoft.bus.modules.base.service.OrderInfoService;
|
|
|
|
+import com.jpsoft.bus.modules.bus.dto.ShiftRevenueDTO;
|
|
import com.jpsoft.bus.modules.bus.dto.VehicleDTO;
|
|
import com.jpsoft.bus.modules.bus.dto.VehicleDTO;
|
|
|
|
+import com.jpsoft.bus.modules.bus.dto.VehicleShiftDTO;
|
|
|
|
+import com.jpsoft.bus.modules.bus.dto.VehicleShiftListDTO;
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
import com.jpsoft.bus.modules.bus.entity.*;
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
import com.jpsoft.bus.modules.bus.service.*;
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
import com.jpsoft.bus.modules.common.dto.MessageResult;
|
|
@@ -238,7 +241,7 @@ public class MerchantApiController {
|
|
|
|
|
|
@PostMapping("revenueStatisticsUp")
|
|
@PostMapping("revenueStatisticsUp")
|
|
@ApiOperation(value = "营收统计(上)")
|
|
@ApiOperation(value = "营收统计(上)")
|
|
- public MessageResult<Map> revenueStatisticsUp(String token, @RequestAttribute String subject) {
|
|
|
|
|
|
+ public MessageResult<Map> revenueStatisticsUp(String vehicleId, String token, @RequestAttribute String subject) {
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -248,7 +251,14 @@ public class MerchantApiController {
|
|
throw new Exception("请重新登录");
|
|
throw new Exception("请重新登录");
|
|
}
|
|
}
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
- List<VehicleInfo> vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
|
|
+ List<VehicleInfo> vehicleInfoList = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isBlank(vehicleId)) {
|
|
|
|
+ vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
+ } else {
|
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
|
|
|
|
+ vehicleInfoList.add(vehicleInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
//今日收益
|
|
//今日收益
|
|
BigDecimal todayRevenue = BigDecimal.ZERO;
|
|
BigDecimal todayRevenue = BigDecimal.ZERO;
|
|
//昨日收益
|
|
//昨日收益
|
|
@@ -262,25 +272,38 @@ public class MerchantApiController {
|
|
}
|
|
}
|
|
|
|
|
|
// if (vehicleInfoList.size()>0){
|
|
// 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<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -303,7 +326,7 @@ public class MerchantApiController {
|
|
|
|
|
|
@PostMapping("revenueStatisticsDown")
|
|
@PostMapping("revenueStatisticsDown")
|
|
@ApiOperation(value = "营收统计(下)")
|
|
@ApiOperation(value = "营收统计(下)")
|
|
- public MessageResult<Map> revenueStatisticsDown(String token, @RequestAttribute String subject) {
|
|
|
|
|
|
+ public MessageResult<Map> revenueStatisticsDown(String vehicleId, String token, @RequestAttribute String subject) {
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
|
|
try {
|
|
try {
|
|
@@ -313,7 +336,15 @@ public class MerchantApiController {
|
|
throw new Exception("请重新登录");
|
|
throw new Exception("请重新登录");
|
|
}
|
|
}
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
- List<VehicleInfo> vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
|
|
+ // List<VehicleInfo> vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
+
|
|
|
|
+ List<VehicleInfo> vehicleInfoList = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isBlank(vehicleId)) {
|
|
|
|
+ vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
+ } else {
|
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
|
|
|
|
+ vehicleInfoList.add(vehicleInfo);
|
|
|
|
+ }
|
|
//线上购票款
|
|
//线上购票款
|
|
BigDecimal onlineRevenue = BigDecimal.ZERO;
|
|
BigDecimal onlineRevenue = BigDecimal.ZERO;
|
|
//微信收款
|
|
//微信收款
|
|
@@ -328,36 +359,41 @@ public class MerchantApiController {
|
|
Integer num = 0;
|
|
Integer num = 0;
|
|
|
|
|
|
|
|
|
|
|
|
+ List<ShiftInfo> shiftInfoList = shiftInfoService.findByVehicleDateAccount(DateUtil.beginOfDay(new Date()), DateUtil.endOfDay(new Date()), accountInfo);
|
|
// if (vehicleInfoList.size()>0){
|
|
// 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) {
|
|
if (wechatSum != null) {
|
|
wechatRevenue = wechatSum;
|
|
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) {
|
|
if (alipaySum != null) {
|
|
alipayRevenue = alipaySum;
|
|
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) {
|
|
if (cashSum != null) {
|
|
cashRevenue = cashSum;
|
|
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) {
|
|
if (ticketSum != null) {
|
|
ticketRevenue = ticketSum;
|
|
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) {
|
|
if (ticketNum != null) {
|
|
num = ticketNum;
|
|
num = ticketNum;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
// }
|
|
// }
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -381,6 +417,185 @@ public class MerchantApiController {
|
|
return messageResult;
|
|
return messageResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @PostMapping("vehicleShiftList")
|
|
|
|
+ @ApiOperation(value = "商户的车辆班次列表")
|
|
|
|
+ public MessageResult<Map> vehicleShiftList(String vehicleId, String date, String token, @RequestAttribute String subject, @RequestParam(value = "pageIndex", defaultValue = "1") int pageIndex, @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
|
|
|
|
+ MessageResult<Map> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ AccountInfo accountInfo = accountInfoService.get(subject);
|
|
|
|
+ if (accountInfo == null) {
|
|
|
|
+ throw new Exception("请重新登录");
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
+ List<VehicleInfo> vehicleInfoList = new ArrayList<>();
|
|
|
|
+ if (StringUtils.isBlank(vehicleId)) {
|
|
|
|
+ vehicleInfoList = vehicleInfoService.getAllVehicleByAccount(accountInfo);
|
|
|
|
+ } else {
|
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(vehicleId);
|
|
|
|
+ vehicleInfoList.add(vehicleInfo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ searchParams.put("vehicleInfoList", vehicleInfoList);
|
|
|
|
+ if (StringUtils.isNotBlank(date)){
|
|
|
|
+ searchParams.put("startTime", DateUtil.beginOfDay(DateUtil.parse(date)));
|
|
|
|
+ searchParams.put("endTime", DateUtil.endOfDay(DateUtil.parse(date)));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ 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);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping("vehicleShiftDetail")
|
|
|
|
+ @ApiOperation(value = "商户的车辆班次详情")
|
|
|
|
+ public MessageResult<VehicleShiftDTO> vehicleShiftDetail(String id, String token, @RequestAttribute String subject) {
|
|
|
|
+ MessageResult<VehicleShiftDTO> messageResult = new MessageResult<>();
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+
|
|
|
|
+ AccountInfo accountInfo = accountInfoService.get(subject);
|
|
|
|
+ if (accountInfo == null) {
|
|
|
|
+ throw new Exception("请重新登录");
|
|
|
|
+ }
|
|
|
|
+ VehicleShiftDTO vehicleShiftDTO = new VehicleShiftDTO();
|
|
|
|
+ ShiftInfo shiftInfo = shiftInfoService.get(id);
|
|
|
|
+ VehicleInfo vehicleInfo = vehicleInfoService.get(shiftInfo.getVehicleId());
|
|
|
|
+ DriverInfo driverInfo = driverInfoService.get(shiftInfo.getDriverId());
|
|
|
|
+ //开始站
|
|
|
|
+ StationInfo startStation = stationInfoService.get(shiftInfo.getStartStationId());
|
|
|
|
+ //终点站
|
|
|
|
+ StationInfo endStation = stationInfoService.get(shiftInfo.getEndStationId());
|
|
|
|
+
|
|
|
|
+ String shiftDateStr = DateUtil.format(shiftInfo.getCreateTime(), "HH:mm");
|
|
|
|
+ if ("1".equals(shiftInfo.getStatus())) {
|
|
|
|
+ shiftDateStr = shiftDateStr + "-" + "待结束";
|
|
|
|
+ }
|
|
|
|
+ if ("2".equals(shiftInfo.getStatus())) {
|
|
|
|
+ shiftDateStr = shiftDateStr + "-" + DateUtil.format(shiftInfo.getFinishTime(), "HH:mm");
|
|
|
|
+ }
|
|
|
|
+ vehicleShiftDTO.setRouteName(startStation.getName()+"-" + endStation.getName());
|
|
|
|
+ vehicleShiftDTO.setCarNum(vehicleInfo.getLicensePlateNumber());
|
|
|
|
+ vehicleShiftDTO.setDriverName(driverInfo.getName());
|
|
|
|
+ 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);
|
|
|
|
+ List<Sort> sortList = new ArrayList<>();
|
|
|
|
+ sortList.add(new Sort("a.pay_fee", "asc"));
|
|
|
|
+ Page<OrderInfo> page = orderInfoService.pageSearch(searchParams, 1, 5000, false, sortList);
|
|
|
|
+
|
|
|
|
+ List<OrderInfo> orderInfoList = page.getResult();
|
|
|
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
|
+ Integer personNum = orderInfoList.size();
|
|
|
|
+ List<ShiftRevenueDTO> shiftRevenueDTOList = new ArrayList<>();
|
|
|
|
+ List<BigDecimal> ticketPrice = new ArrayList<>();
|
|
|
|
+ Map<BigDecimal, List<OrderInfo>> map = new LinkedHashMap<>();
|
|
|
|
+ if (orderInfoList.size() > 0) {
|
|
|
|
+ BigDecimal key;
|
|
|
|
+ List<OrderInfo> listTmp;
|
|
|
|
+ for (OrderInfo val : orderInfoList) {
|
|
|
|
+ total = total.add(val.getPayFee());
|
|
|
|
+ key = val.getPayFee();//按这个属性分组,map的Key
|
|
|
|
+ listTmp = map.get(key);
|
|
|
|
+ if (null == listTmp) {
|
|
|
|
+ listTmp = new ArrayList<OrderInfo>();
|
|
|
|
+ map.put(key, listTmp);
|
|
|
|
+ }
|
|
|
|
+ listTmp.add(val);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ for (Map.Entry<BigDecimal, List<OrderInfo>> date : map.entrySet()){
|
|
|
|
+ BigDecimal payFee = date.getKey();
|
|
|
|
+ List<OrderInfo> orderInfos = date.getValue();
|
|
|
|
+ ShiftRevenueDTO shiftRevenueDTO = new ShiftRevenueDTO();
|
|
|
|
+ shiftRevenueDTO.setPrice(payFee);
|
|
|
|
+ shiftRevenueDTO.setNum(orderInfos.size());
|
|
|
|
+ shiftRevenueDTO.setTotal(payFee.multiply(new BigDecimal(orderInfos.size())));
|
|
|
|
+ shiftRevenueDTOList.add(shiftRevenueDTO);
|
|
|
|
+ }
|
|
|
|
+ vehicleShiftDTO.setList(shiftRevenueDTOList);
|
|
|
|
+ vehicleShiftDTO.setPassengerNum(personNum);
|
|
|
|
+ vehicleShiftDTO.setTotal(total);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ messageResult.setData(vehicleShiftDTO);
|
|
|
|
+ messageResult.setResult(true);
|
|
|
|
+ messageResult.setCode(200);
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ log.error(ex.getMessage(), ex);
|
|
|
|
+ messageResult.setCode(400);
|
|
|
|
+ messageResult.setResult(false);
|
|
|
|
+ messageResult.setMessage(ex.getMessage());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return messageResult;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
@PostMapping("merchantVehicleList")
|
|
@PostMapping("merchantVehicleList")
|
|
@ApiOperation(value = "商户的车辆列表")
|
|
@ApiOperation(value = "商户的车辆列表")
|
|
@@ -393,17 +608,22 @@ public class MerchantApiController {
|
|
if (accountInfo == null) {
|
|
if (accountInfo == null) {
|
|
throw new Exception("请重新登录");
|
|
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.setData(list);
|
|
messageResult.setResult(true);
|
|
messageResult.setResult(true);
|
|
messageResult.setCode(200);
|
|
messageResult.setCode(200);
|
|
@@ -431,10 +651,19 @@ public class MerchantApiController {
|
|
try {
|
|
try {
|
|
|
|
|
|
ProfitListDTO profitListDTO = new ProfitListDTO();
|
|
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);
|
|
AccountInfo accountInfo = accountInfoService.get(subject);
|
|
if (accountInfo == null) {
|
|
if (accountInfo == null) {
|
|
throw new Exception("请重新登录");
|
|
throw new Exception("请重新登录");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isBlank(accountInfo.getRoles())){
|
|
|
|
+ throw new Exception("账户未分配角色");
|
|
|
|
+ }
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
List<VehicleInfo> vehicleInfoList = new ArrayList<>();
|
|
List<VehicleInfo> vehicleInfoList = new ArrayList<>();
|
|
if (StringUtils.isNotBlank(vehicleId)) {
|
|
if (StringUtils.isNotBlank(vehicleId)) {
|
|
@@ -447,11 +676,13 @@ public class MerchantApiController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
int n = 0;
|
|
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)) {
|
|
if (StringUtils.isNotBlank(dateStr)) {
|
|
Date date = DateUtil.parse(dateStr, "yyyy-MM");
|
|
Date date = DateUtil.parse(dateStr, "yyyy-MM");
|
|
|
|
|
|
@@ -467,23 +698,24 @@ public class MerchantApiController {
|
|
n = DateUtil.thisDayOfMonth();
|
|
n = DateUtil.thisDayOfMonth();
|
|
}
|
|
}
|
|
|
|
|
|
- BigDecimal revenue = BigDecimal.ZERO;
|
|
|
|
|
|
+
|
|
|
|
|
|
profitListDTO.setDateDesc(dateDesc);
|
|
profitListDTO.setDateDesc(dateDesc);
|
|
|
|
|
|
|
|
|
|
- List<ProfitListDTO> list = new ArrayList<>();
|
|
|
|
|
|
+
|
|
if (n > 0) {
|
|
if (n > 0) {
|
|
for (int m = 0; m < n; m++) {
|
|
for (int m = 0; m < n; m++) {
|
|
ProfitListDTO profitListDTO1 = new ProfitListDTO();
|
|
ProfitListDTO profitListDTO1 = new ProfitListDTO();
|
|
Date baseDate = DateUtil.offsetDay(startDate, -m);
|
|
Date baseDate = DateUtil.offsetDay(startDate, -m);
|
|
Date baseStartDate = DateUtil.beginOfDay(baseDate);
|
|
Date baseStartDate = DateUtil.beginOfDay(baseDate);
|
|
BigDecimal baseSum = BigDecimal.ZERO;
|
|
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.setDateDesc(DateUtil.format(baseDate, "yyyy-MM-dd"));
|
|
profitListDTO1.setRevenue(baseSum == null ? BigDecimal.ZERO : baseSum);
|
|
profitListDTO1.setRevenue(baseSum == null ? BigDecimal.ZERO : baseSum);
|
|
@@ -558,8 +790,8 @@ public class MerchantApiController {
|
|
if (StringUtils.isNotBlank(vehicleId)) {
|
|
if (StringUtils.isNotBlank(vehicleId)) {
|
|
searchParams.put("vehicleId", vehicleId);
|
|
searchParams.put("vehicleId", vehicleId);
|
|
}
|
|
}
|
|
- // searchParams.put("orderCompanyId", companyInfo.getId());
|
|
|
|
- searchParams.put("vehicleInfoList",vehicleInfoList);
|
|
|
|
|
|
+ // searchParams.put("orderCompanyId", companyInfo.getId());
|
|
|
|
+ searchParams.put("vehicleInfoList", vehicleInfoList);
|
|
|
|
|
|
List<Sort> sortList = new ArrayList<>();
|
|
List<Sort> sortList = new ArrayList<>();
|
|
sortList.add(new Sort("a.pay_time", "desc"));
|
|
sortList.add(new Sort("a.pay_time", "desc"));
|
|
@@ -717,9 +949,11 @@ public class MerchantApiController {
|
|
}
|
|
}
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
CompanyInfo companyInfo = companyInfoService.get(accountInfo.getCompanyId());
|
|
List<VehicleInfo> vehicleInfoList = vehicleInfoService.findByCompanyId(companyInfo.getId());
|
|
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){
|
|
// 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);
|
|
todayRevenue = (wechatTodaySum == null ? BigDecimal.ZERO : wechatTodaySum).add(alipayTodaySum == null ? BigDecimal.ZERO : alipayTodaySum);
|
|
|
|
|
|
// }
|
|
// }
|