Commit 84a39605 authored by libin's avatar libin

Merge branch 'order_received_statistics' into dev

# Conflicts:
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderMemberReceivedStatisticsBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderRentVehicleReceivedStatisticsBiz.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/BaseOrderMapper.java
#	xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/OrderAccountMapper.java
#	xx-order/xx-order-server/src/main/resources/mapper/BaseOrderMapper.xml
#	xx-order/xx-order-server/src/main/resources/mapper/OrderAccountMapper.xml
#	xx-order/xx-order-server/src/test/java/ServiceTest.java
#	xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/DictionaryKey.java
#	xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/DictionaryBiz.java
#	xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/UploadService.java
#	xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBookRecordBiz.java
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleDepartureService.java
#	xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleDepartureController.java
#	xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleDepartureLogMapper.xml
parents e13b5dfa f54558fb
package com.xxfc.platform.order.bo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -32,10 +30,47 @@ public class CompanyPerformanceBo {
private BigDecimal rentVehilceAmount;
private BigDecimal travelAmount;
private BigDecimal noDeductibleAmount;
private BigDecimal depositAmount;
private Integer rentDays;
private BigDecimal extralAmount;
private Integer departureNum;
private Integer arrivalNum;
private Date startDate;
private Date endDate;
public BigDecimal getMemberAmount() {
return memberAmount==null?BigDecimal.ZERO:memberAmount;
}
public BigDecimal getRentVehilceAmount() {
return rentVehilceAmount==null?BigDecimal.ZERO:rentVehilceAmount;
}
public BigDecimal getTravelAmount() {
return travelAmount==null?BigDecimal.ZERO:travelAmount;
}
public BigDecimal getNoDeductibleAmount() {
return noDeductibleAmount==null?BigDecimal.ZERO:noDeductibleAmount;
}
public BigDecimal getDepositAmount() {
return depositAmount==null?BigDecimal.ZERO:depositAmount;
}
public Integer getRentDays() {
return rentDays==null?0:rentDays;
}
public BigDecimal getExtralAmount() {
return extralAmount==null?BigDecimal.ZERO:extralAmount;
}
public Integer getDepartureNum() {
return departureNum==null?0:departureNum;
}
public Integer getArrivalNum() {
return arrivalNum==null?0:arrivalNum;
}
}
package com.xxfc.platform.order.bo;
import cn.hutool.json.JSONObject;
import com.xxfc.platform.order.contant.enumerate.AccountTypeEnum;
import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import com.xxfc.platform.order.contant.enumerate.StatisticsStatusEnum;
import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import com.xxfc.platform.order.pojo.account.OrderAccountDeduction;
import com.xxfc.platform.order.pojo.account.OrderAccountDetail;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
import java.util.Objects;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/11/27 16:10
*/
@Data
@Builder(toBuilder = true)
@AllArgsConstructor
@NoArgsConstructor
public class FeeTypeBo implements Serializable {
private static final long serialVersionUID = 1L;
private BigDecimal noDeductibleRefundAmount = BigDecimal.ZERO;
private BigDecimal noDeductibleAmount = BigDecimal.ZERO;
private BigDecimal totalAmount = BigDecimal.ZERO;
private BigDecimal orderRefundAmount = BigDecimal.ZERO;
private BigDecimal depositAmount = BigDecimal.ZERO;
private BigDecimal depositRefundAmount = BigDecimal.ZERO;
private BigDecimal lateFeeAmount = BigDecimal.ZERO;
private BigDecimal breakRulesRegulationAmount = BigDecimal.ZERO;
private BigDecimal lossSpecifiedAmount = BigDecimal.ZERO;
private BigDecimal extraAmount = BigDecimal.ZERO;
}
......@@ -21,7 +21,6 @@ import java.math.BigDecimal;
public class OrderMemberReceivedStatistics extends OrderReceivedStatisticsBase implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 普通会员订单总额
*/
......
package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -18,6 +19,7 @@ import java.math.BigDecimal;
*/
@Data
@Table(name = "order_received_statistics")
@ApiModel("订单统计")
public class OrderReceivedStatistics extends OrderReceivedStatisticsBase implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -25,14 +27,38 @@ public class OrderReceivedStatistics extends OrderReceivedStatisticsBase impleme
@ApiModelProperty("会员费")
private BigDecimal memberAmount;
@Column(name = "member_refund_amount")
@ApiModelProperty("会员退款费")
private BigDecimal memberRefundAmout;
@Column(name = "member_quantity")
@ApiModelProperty("会员订单量")
private Integer memberQuantity;
@Column(name = "travel_amount")
@ApiModelProperty("旅游费")
private BigDecimal travelAmount;
@Column(name = "travel_refund_amount")
@ApiModelProperty("旅游退款费")
private BigDecimal travelRefundAmount;
@Column(name = "travel_quantity")
@ApiModelProperty("旅游订单量")
private Integer travelQuantity;
@Column(name = "rent_vehicle_amount")
@ApiModelProperty("租车费")
private BigDecimal rentVehicleAmount;
@Column(name = "rent_vehicle_refund_amount")
@ApiModelProperty("租车退款费")
private BigDecimal rentVehicleRefundAmount;
@Column(name = "rent_vehicle_quantity")
@ApiModelProperty("租车订单量")
private Integer rentVehicleQuantity;
@Column(name = "no_deductible_amount")
@ApiModelProperty("不计免赔费")
private BigDecimal noDeductibleAmount;
......
......@@ -29,7 +29,7 @@ public class CompanyPerformanceFindDTO extends PageParam {
@ApiModelProperty("统计方式 1:日 2:周 3:月")
@NotNull(message = "统计方式不能为null")
private Integer statisticalWay;
private String companyName;
private Integer companyId;
}
......@@ -2,22 +2,24 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import com.xxfc.platform.order.contant.enumerate.ReceivedStatisticsEnum;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.ServletOutputStream;
import java.io.IOException;
import java.util.*;
/**
* @author libin
......@@ -30,9 +32,131 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CompanyPerformanceBiz {
private final OrderReceivedStatisticsBiz orderReceivedStatisticsBiz;
private final VehicleFeign vehicleFeign;
private final OrderReceivedStatisticsBiz orderReceivedStatisticsBiz;
private final VehicleFeign vehicleFeign;
/**
* 导出数据
*
* @param companyPerformanceFindDTO
* @param outputStream
*/
public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) throws IOException {
//1.查询数据
PageDataVO<CompanyPerformanceBo> pageDataVO = selectCompanyPerformancePage(companyPerformanceFindDTO);
List<CompanyPerformanceBo> data = pageDataVO.getData();
//excel相关
XSSFWorkbook hssfWorkbook = new XSSFWorkbook();
XSSFSheet sheet = hssfWorkbook.createSheet("公司业绩统计报表");
Row headerRow = sheet.createRow(0);
CellStyle headerCellStyle = createHeaderCellStyle(hssfWorkbook);
String[] headerValue = {"时间", "公司", "会员费", "租车费","押金","不计免赔费", "旅游费", "租借天数", "出车服务次数", "收车服务次数"};
createHeader(headerRow, 0, headerValue, headerCellStyle);
for (int i = 0; i < headerValue.length; i++) {
sheet.setColumnWidth(i, 24 * 256);
}
//设置数据
CellStyle generalCellStyle = createGeneralCellStyle(hssfWorkbook);
List<String[]> companyStatisticsData = getCompanyStatisticsData(data, companyPerformanceFindDTO.getStatisticalWay());
createCompnayStatisticsCellData(sheet, 1, generalCellStyle, companyStatisticsData);
hssfWorkbook.write(outputStream);
hssfWorkbook.close();
}
private void createCompnayStatisticsCellData(Sheet sheet, int startRowIndex, CellStyle cellStyle, List<String[]> staffStatisticsData) {
for (String[] data : staffStatisticsData) {
Row row = sheet.createRow(startRowIndex++);
createCellCount(row, 0, data, cellStyle);
}
}
private void createCellCount(Row row, int CellStartIndex, String[] data, CellStyle cellStyle) {
for (int i = CellStartIndex, y = 0; y < data.length; i++, y++) {
Cell cell = row.createCell(i);
cell.setCellStyle(cellStyle);
cell.setCellValue(data[y]);
}
}
private List<String[]> getCompanyStatisticsData(List<CompanyPerformanceBo> companyPerformanceBos, Integer statisticalWay) {
List<String[]> data = new ArrayList<>(companyPerformanceBos.size());
for (int i = 0; i < companyPerformanceBos.size(); i++) {
String[] companyData = getData(companyPerformanceBos.get(i), statisticalWay);
data.add(companyData);
}
return data;
}
private String[] getData(CompanyPerformanceBo companyPerformanceBo, Integer statisticalWay) {
String dateStr = "";
if (statisticalWay == ReceivedStatisticsEnum.DAY.getWayCode()) {
dateStr = DateUtil.format(companyPerformanceBo.getDate(),"yyyy.MM.dd");
}
if (statisticalWay == ReceivedStatisticsEnum.WEEK.getWayCode()) {
String startDateStr = DateUtil.format(companyPerformanceBo.getStartDate(), "yyyy.MM.dd");
String endDateStr = DateUtil.format(companyPerformanceBo.getEndDate(), "yyyy.MM.dd");
dateStr=String.format("%s~%s",startDateStr,endDateStr);
}
if (statisticalWay == ReceivedStatisticsEnum.MONTH.getWayCode()) {
dateStr = String.format("%d.%s",companyPerformanceBo.getYear(),companyPerformanceBo.getMonth().replace(companyPerformanceBo.getYear()+"",""));
}
return new String[]{
dateStr,
companyPerformanceBo.getCompanyName(),
companyPerformanceBo.getMemberAmount().toString(),
companyPerformanceBo.getRentVehilceAmount().toString(),
companyPerformanceBo.getDepositAmount().toString(),
companyPerformanceBo.getNoDeductibleAmount().toString(),
companyPerformanceBo.getTravelAmount().toString(),
String.valueOf(companyPerformanceBo.getRentDays()),
String.valueOf(companyPerformanceBo.getDepartureNum()),
String.valueOf(companyPerformanceBo.getArrivalNum())};
}
private void createHeader(Row row, int cellStartIndex, String[] header, CellStyle cellStyle) {
for (int i = 0; i < header.length; i++) {
Cell cell = row.createCell(cellStartIndex);
cell.setCellValue(header[i]);
cell.setCellStyle(cellStyle);
cellStartIndex += 1;
}
}
private CellStyle createGeneralCellStyle(XSSFWorkbook hssfWorkbook) {
CellStyle cellStyleGeneral = createHeaderCellStyle(hssfWorkbook);
cellStyleGeneral.setWrapText(true);
XSSFFont generalFont = createFont(hssfWorkbook);
generalFont.setBold(false);
cellStyleGeneral.setFont(generalFont);
return cellStyleGeneral;
}
private CellStyle createHeaderCellStyle(XSSFWorkbook hssfWorkbook) {
XSSFCellStyle cellStyleHeader = hssfWorkbook.createCellStyle();
cellStyleHeader.setAlignment(HorizontalAlignment.CENTER);
cellStyleHeader.setVerticalAlignment(VerticalAlignment.CENTER);
cellStyleHeader.setLocked(false);
XSSFFont headerFont = createFont(hssfWorkbook);
cellStyleHeader.setFont(headerFont);
return cellStyleHeader;
}
private XSSFFont createFont(XSSFWorkbook hssfWorkbook) {
XSSFFont font = hssfWorkbook.createFont();
font.setFontName("黑体");
font.setBold(true);
return font;
}
/**
* 分页查询公司业绩
*
* @param companyPerformanceFindDTO
* @return
*/
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformancePage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
......@@ -73,4 +197,5 @@ public class CompanyPerformanceBiz {
}
return pageDataVO;
}
}
......@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.github.wxiaoqi.security.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException;
......@@ -660,7 +658,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @return
*/
public List<OrderAccountBo> selectByTypeAndDate(Integer orderType, Date startDate, Date endDate) {
List<OrderAccountBo> accountBos = mapper.selectOrderAccountByOrderTypeAndStartTimeAndEndTime(orderType,startDate.getTime(),endDate.getTime());
List<OrderAccountBo> accountBos = mapper.selectOrderAccountByOrderTypeAndStartTimeAndEndTime(orderType,startDate.getTime(),endDate.getTime());
return CollectionUtils.isEmpty(accountBos)? Collections.EMPTY_LIST:accountBos;
}
......@@ -671,7 +669,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @param staffUserIds
* @return
*/
public List<OrderAccountBo> selectByDateAndStatffIds(Date startDate, Date endDate, List<Integer> staffUserIds) {
public List<OrderAccountBo> selectByDateAndStatffIds(Date startDate, Date endDate,List<Integer> staffUserIds) {
List<OrderAccountBo> orderAccountBos = mapper.selectByDateAndStatffIds(startDate,endDate,staffUserIds);
return CollectionUtils.isNotEmpty(orderAccountBos)?Collections.EMPTY_LIST:orderAccountBos;
}
......
......@@ -28,7 +28,6 @@ import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
......@@ -56,16 +55,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
/**
* 公司业绩(按日统计)
*
* @param companyPerformanceFindDTO
* @return
*/
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithDayPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO));
}
/**
* 公司业绩(按月统计)
*
* @param companyPerformanceFindDTO
* @return
*/
......@@ -76,6 +77,7 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
/**
* 公司业绩(按周统计)
*
* @param companyPerformanceFindDTO
* @return
*/
......@@ -237,34 +239,58 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
for (Map.Entry<String, List<OrderRentVehicleReceivedStatistics>> rentVehicleEntry : rentVehicleSet) {
String stateGroup = rentVehicleEntry.getKey();
List<OrderRentVehicleReceivedStatistics> rentVehicleEntryValue = rentVehicleEntry.getValue();
OrderRentVehicleReceivedStatistics orderRentVehicle = rentVehicleEntryValue.get(0);
//创建默认的订单统计对象并设置默认值
OrderReceivedStatistics orderReceivedStatisticsClone = StatisticsStatusEnum.wrapStatisticsObject(date, stateGroup, Collections.EMPTY_MAP, ObjectUtil.clone(orderReceivedStatistics));
//租车单
OrderRentVehicleReceivedStatistics orderRentVehicle = rentVehicleEntryValue.get(0);
//会员单
OrderMemberReceivedStatistics orderMember = memberMap.get(stateGroup).get(0);
//旅游单
OrderTourReceivedStatistics orderTour = tourMap.get(stateGroup).get(0);
//公司id
orderReceivedStatisticsClone.setCompanyId(orderRentVehicle.getCompanyId());
//公司名称
orderReceivedStatisticsClone.setCompanyName(orderRentVehicle.getCompanyName());
OrderMemberReceivedStatistics orderMember = memberMap.get(stateGroup).get(0);
OrderTourReceivedStatistics orderTour = tourMap==null?null:tourMap.get(stateGroup)==null?null:tourMap.get(stateGroup).get(0);
orderReceivedStatisticsClone.setExtraAmount(orderRentVehicle.getExtraAmount());
orderReceivedStatisticsClone.setLossSpecifiedAmount(orderRentVehicle.getLossSpecifiedAmount());
//押金
orderReceivedStatisticsClone.setDepositAmount(orderRentVehicle.getDepositAmount());
//退款押金
orderReceivedStatisticsClone.setDepositRefundAmount(orderRentVehicle.getDepositRefundAmount());
//定损
orderReceivedStatisticsClone.setLossSpecifiedAmount(orderRentVehicle.getLossSpecifiedAmount());
//违章
orderReceivedStatisticsClone.setBreakRulesRegulationAmount(orderRentVehicle.getBreakRulesRegulationAmount());
//免赔退款金额
orderReceivedStatisticsClone.setNoDeductibleRefundAmount(orderRentVehicle.getNoDeductibleRefundAmount());
//免赔金额
orderReceivedStatisticsClone.setNoDeductibleAmount(orderRentVehicle.getNoDeductibleAmount());
orderReceivedStatisticsClone.setTravelAmount(orderTour == null?BigDecimal.ZERO:orderTour.getTotalAmount());
//旅游订单总额
orderReceivedStatisticsClone.setTravelAmount(orderTour.getTotalAmount());
orderReceivedStatisticsClone.setTravelRefundAmount(orderTour.getOrderRefundAmount());
//会员订单总额
orderReceivedStatisticsClone.setMemberAmount(orderMember.getTotalAmount());
orderReceivedStatisticsClone.setMemberRefundAmout(orderMember.getOrderRefundAmount());
//租车订单总额
orderReceivedStatisticsClone.setRentVehicleAmount(orderRentVehicle.getTotalAmount());
BigDecimal totalAmount = orderRentVehicle.getTotalAmount().add(orderTour == null?BigDecimal.ZERO:orderTour.getTotalAmount()).add(orderMember.getTotalAmount());
BigDecimal totalRefundAmount = orderRentVehicle.getOrderRefundAmount().add(orderTour==null?BigDecimal.ZERO:orderTour.getOrderRefundAmount()).add(orderMember.getOrderRefundAmount());
BigDecimal lateFeeAmount = orderRentVehicle.getLateFeeAmount().add(orderTour==null?BigDecimal.ZERO:orderTour.getLateFeeAmount()).add(orderMember.getLateFeeAmount());
Integer totalQuantity = orderRentVehicle.getTotalQuantity() + (orderTour == null?0:orderTour.getTotalQuantity()) + orderMember.getTotalQuantity();
orderReceivedStatisticsClone.setRentVehicleRefundAmount(orderRentVehicle.getOrderRefundAmount());
//合计订单总额
BigDecimal totalAmount = orderRentVehicle.getTotalAmount().add(orderTour.getTotalAmount()).add(orderMember.getTotalAmount());
//合计订单退款总额
BigDecimal totalRefundAmount = orderRentVehicle.getOrderRefundAmount().add(orderTour.getOrderRefundAmount()).add(orderMember.getOrderRefundAmount());
//合计订单违约金
BigDecimal lateFeeAmount = orderRentVehicle.getLateFeeAmount().add(orderTour.getLateFeeAmount()).add(orderMember.getLateFeeAmount());
//合计额外费用
BigDecimal totalExtraAmount = orderRentVehicle.getExtraAmount().add(orderMember.getExtraAmount()).add(orderTour.getExtraAmount());
//会员订单量
orderReceivedStatisticsClone.setMemberQuantity(orderMember.getTotalQuantity());
//旅游订单量
orderReceivedStatisticsClone.setTravelQuantity(orderTour.getTotalQuantity());
//租车订单量
orderReceivedStatisticsClone.setRentVehicleQuantity(orderRentVehicle.getTotalQuantity());
//合计订单量
Integer totalQuantity = orderRentVehicle.getTotalQuantity() + (orderTour.getTotalQuantity()) + orderMember.getTotalQuantity();
orderReceivedStatisticsClone.setExtraAmount(totalExtraAmount);
orderReceivedStatisticsClone.setLateFeeAmount(lateFeeAmount);
orderReceivedStatisticsClone.setTotalAmount(totalAmount);
orderReceivedStatisticsClone.setOrderRefundAmount(totalRefundAmount);
......@@ -272,30 +298,8 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
orderReceivedStatisticsList.add(orderReceivedStatisticsClone);
}
insertReceivedStatisticsBatch(orderReceivedStatisticsList);
}
/**
* 批量插入数据 mysql sql语句默认不能超过4M
*
* @param orderReceivedStatistics
*/
public void insertReceivedStatisticsBatch(List<OrderReceivedStatistics> orderReceivedStatistics) {
orderReceivedStatistics.sort(Comparator.comparing(OrderReceivedStatistics::getCompanyId));
int orderSize = orderReceivedStatistics.size();
int sqlAdq = orderSize / StatisticsStatusEnum.DEFAULT_SQL_SIZE;
int sqlMod = orderSize % StatisticsStatusEnum.DEFAULT_SQL_SIZE;
sqlAdq = sqlMod == 0 ? sqlAdq : sqlAdq + 1;
for (int i = 0; i < sqlAdq; i++) {
int fromIndex = StatisticsStatusEnum.DEFAULT_SQL_SIZE * i;
int toIndex = StatisticsStatusEnum.DEFAULT_SQL_SIZE * (i + 1);
toIndex = toIndex > orderSize ? orderSize : toIndex;
List<OrderReceivedStatistics> orderRentVehicleReceivedStatisticsList = orderReceivedStatistics.subList(fromIndex, toIndex);
mapper.insertList(orderRentVehicleReceivedStatisticsList);
}
//保存
StatisticsStatusEnum.insertReceivedStatisticsBatch(orderReceivedStatisticsList, mapper);
}
/**
......
package com.xxfc.platform.order.biz;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import org.springframework.stereotype.Service;
import cn.hutool.core.util.ObjectUtil;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.google.common.collect.Lists;
import com.xxfc.platform.order.bo.FeeTypeBo;
import com.xxfc.platform.order.contant.enumerate.StatisticsStatusEnum;
import com.xxfc.platform.order.entity.OrderTourReceivedStatistics;
import com.xxfc.platform.order.mapper.OrderTourReceivedStatisticsMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
/**
* 旅游订单统计
*
* @author libin
* @email 18178966185@163.com
* @date 2019-11-08 18:03:42
* @version 1.0 旅游统计
* @description
* @data 2019/11/28 9:57
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrderTourReceivedStatisticsBiz extends BaseBiz<OrderTourReceivedStatisticsMapper,OrderTourReceivedStatistics> {
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Slf4j
public class OrderTourReceivedStatisticsBiz extends BaseBiz<OrderTourReceivedStatisticsMapper, OrderTourReceivedStatistics> {
private final BaseOrderBiz baseOrderBiz;
private final OrderAccountBiz orderAccountBiz;
public List<OrderTourReceivedStatistics> selectOrderReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderTourReceivedStatistics(orderReceivedStatisticsFindDTO);
}
/**
* 订单统计批量插入旅游统计表
* zuoyihang
* 2019-11-12
*
* @param startDate 开始时间
* @param endDate 结束时间
*/
public List<OrderTourReceivedStatistics> orderTourInsertStatisticsNew(Date startDate, Date endDate, Map<Integer, String> companyMap) {
List<OrderTourReceivedStatistics> orderTourReceivedStatisticsList = new ArrayList();
List<String> stisticsActiveState = new ArrayList<>();
//根据旅游类型 时间查询
List<OrderDTO> orderDTOS = baseOrderBiz.selectOrdersByTypeAndTime(Arrays.asList(StatisticsStatusEnum.ORDER_TOUR_TYPE),null, startDate, endDate);
//数据处理 状态组合 按支付状态分组 而后按组合状态
Map<Boolean, Map<String, List<OrderDTO>>> stateGroupMap = StatisticsStatusEnum.processOrdersWithState(stisticsActiveState, orderDTOS);
//订单账目信息
List<OrderAccountBo> orderAccountBoList = orderAccountBiz.selectByTypeAndDate(StatisticsStatusEnum.ORDER_TOUR_TYPE, startDate, endDate);
//账目数据整理 状态组合
Map<String, List<OrderAccountBo>> orderMap = StatisticsStatusEnum.processOrderAccountsWithState(stisticsActiveState,orderAccountBoList);
//已经支付订单
Set<Map.Entry<String, List<OrderAccountBo>>> orderSet = orderMap.entrySet();
for (Map.Entry<String, List<OrderAccountBo>> orderEntry : orderSet) {
String orderKey = orderEntry.getKey();
List<OrderAccountBo> orderAccountBos = orderEntry.getValue();
//创建并设置旅游统计对象默认值
OrderTourReceivedStatistics orderTourReceivedStatistics = StatisticsStatusEnum.wrapStatisticsObject(startDate, orderKey, companyMap, new OrderTourReceivedStatistics());
//账目处理
FeeTypeBo feeTypeBo = StatisticsStatusEnum.getFeeTyBoByOrderAccounts(orderAccountBos);
//旅游订单量
Integer totalQuantity = stateGroupMap == null ?
0 : stateGroupMap.get(Boolean.TRUE) == null ?
0 : stateGroupMap.get(Boolean.TRUE).get(orderKey) == null ?
0 : stateGroupMap.get(Boolean.TRUE).get(orderKey).size();
orderTourReceivedStatistics.setTotalQuantity(totalQuantity);
//复制对应的金额(订单支付金额、退款金额、违约金)
BeanUtils.copyProperties(feeTypeBo,orderTourReceivedStatistics);
orderTourReceivedStatisticsList.add(orderTourReceivedStatistics);
}
//未支付订单
Map<String, List<OrderDTO>> noPayOrderRentvehicleMap = stateGroupMap == null ?
Collections.EMPTY_MAP : stateGroupMap.get(Boolean.FALSE) == null ?
Collections.EMPTY_MAP : stateGroupMap.get(Boolean.FALSE);
List<OrderTourReceivedStatistics> noPayOrderTourReceivedStatisticsList = createNoPayOrderTourReceivedStatisticsListList(startDate, noPayOrderRentvehicleMap, companyMap);
orderTourReceivedStatisticsList.addAll(noPayOrderTourReceivedStatisticsList);
//创建剩余状态组合旅游统计对象
List<OrderTourReceivedStatistics> otherStatisticsStateGroupList = createOtherStatisticsStateGroupList(startDate, stisticsActiveState, companyMap);
orderTourReceivedStatisticsList.addAll(otherStatisticsStateGroupList);
//保存
StatisticsStatusEnum.insertReceivedStatisticsBatch(orderTourReceivedStatisticsList,mapper);
return orderTourReceivedStatisticsList;
}
/**
*创建未支付
* @param startDate 统计的时间
* @param noPayOrdersMap 未支付单map
* @param companyMap 公司map
*/
private List<OrderTourReceivedStatistics> createNoPayOrderTourReceivedStatisticsListList(Date startDate, Map<String, List<OrderDTO>> noPayOrdersMap, Map<Integer, String> companyMap) {
List<OrderTourReceivedStatistics> orderTourReceivedStatisticsList = new ArrayList<>();
if (noPayOrdersMap == null || noPayOrdersMap.isEmpty()) {
return orderTourReceivedStatisticsList;
}
//遍历未支付单
Set<Map.Entry<String, List<OrderDTO>>> noPayOrderSet = noPayOrdersMap.entrySet();
for (Map.Entry<String, List<OrderDTO>> noPayOrderEntry : noPayOrderSet) {
String noPayOrderStateGroup = noPayOrderEntry.getKey();
List<OrderDTO> noPayOrders = noPayOrderEntry.getValue();
//创建旅游统计对象并设置默认值
OrderTourReceivedStatistics orderTourReceivedStatistics = StatisticsStatusEnum.wrapStatisticsObject(startDate, noPayOrderStateGroup, companyMap, new OrderTourReceivedStatistics());
//订单总金额
BigDecimal totalNoPayAmount = noPayOrders.stream().map(OrderDTO::getRealAmount).reduce(BigDecimal.ZERO,BigDecimal::add);
orderTourReceivedStatistics.setTotalQuantity(noPayOrders.size());
orderTourReceivedStatistics.setTotalAmount(totalNoPayAmount);
orderTourReceivedStatisticsList.add(orderTourReceivedStatistics);
}
return orderTourReceivedStatisticsList;
}
/**
* 创建剩余状态数据
*
* @param startDate 时间
* @param statisticsStateGroups 状态组合 集合
* @param companyMap 公司ids
* @return
*/
private List<OrderTourReceivedStatistics> createOtherStatisticsStateGroupList(Date startDate,
List<String> statisticsStateGroups,
Map<Integer, String> companyMap) {
List<OrderTourReceivedStatistics> orderTourReceivedStatisticsList = new ArrayList<>();
//获取剩余状态组合
List<Integer> companyIds = Objects.isNull(companyMap) ? Collections.EMPTY_LIST : Lists.newArrayList(companyMap.keySet());
List<String> otherStatisticsStateGroup = StatisticsStatusEnum.getOtherStatisticsStateGroup(companyIds, statisticsStateGroups);
//创建租车统计克隆对象
OrderTourReceivedStatistics orderTourReceivedStatistics = new OrderTourReceivedStatistics();
//统计对象的生成
otherStatisticsStateGroup.stream().peek(stateGroup -> {
OrderTourReceivedStatistics orderTourReceivedStatisticsClone = StatisticsStatusEnum.wrapStatisticsObject(startDate, stateGroup, companyMap, ObjectUtil.cloneByStream(orderTourReceivedStatistics));
orderTourReceivedStatisticsList.add(orderTourReceivedStatisticsClone);
}).count();
return orderTourReceivedStatisticsList;
}
}
\ No newline at end of file
......@@ -101,7 +101,7 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
String filePath = ovUpload + realFileRelPath;
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return ObjectRestResponse.succ(filePath);
}
......
......@@ -13,12 +13,12 @@ import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -44,7 +44,12 @@ public class OrderReceivedStatisticsJobHandler extends IJobHandler {
public ReturnT<String> execute(String arg) throws Exception {
DateTime yesterday = DateUtil.yesterday();
if (StringUtils.hasText(arg)){
yesterday = DateUtil.parse(arg,"yyyy-MM-dd");
try {
yesterday = DateUtil.parse(arg, "yyyy-MM-dd");
}catch (Exception ex){
XxlJobLogger.log(ex);
yesterday = DateUtil.yesterday();
}
}
Date startDate = DateUtil.beginOfDay(yesterday).toJdkDate();
......@@ -52,7 +57,7 @@ public class OrderReceivedStatisticsJobHandler extends IJobHandler {
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
//旅游订单
List<OrderTourReceivedStatistics> orderTourReceivedStatisticsList = Collections.EMPTY_LIST;
List<OrderTourReceivedStatistics> orderTourReceivedStatisticsList = orderTourReceivedStatisticsBiz.orderTourInsertStatisticsNew(startDate,endDate,companyMap);
//租车订单
List<OrderRentVehicleReceivedStatistics> orderRentVehicleReceivedStatisticsList = orderRentVehicleReceivedStatisticsBiz.orderRentVehicleReceivedStatistics(startDate, endDate, companyMap);
//会员订单
......
......@@ -12,6 +12,7 @@ import com.xxfc.platform.order.pojo.order.OrderPageVO;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -44,9 +45,9 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
public List<BgOrderListVo> getAllOrderList(Map<String, Object> paramMap);
List<OrderDTO> selectOrdersByTypeAndTime(@Param("types") List<Integer> types,
@Param("hasPay") Integer hasPay,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
@Param("hasPay") Integer hasPay,
@Param("startDate") Date startDate,
@Param("endDate") Date endDate);
List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria);
......
......@@ -11,12 +11,12 @@ import tk.mybatis.mapper.common.Mapper;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 订单帐目
*
*
* @author zhoujw
* @email 18178966185@163.com
* @date 2019-09-09 15:51:16
......@@ -25,7 +25,7 @@ public interface OrderAccountMapper extends Mapper<OrderAccount> {
List<OrderAccountDTO> getOrderAccountByOrderType(Term term);
List<ReturnOrderAmount> outStatisticalData(@Param("queryCriteria")QueryCriteria queryCriteria,@Param("startTime") Long startTime,@Param("endTime")Long endTime);
List<ReturnOrderAmount> outStatisticalData(@Param("queryCriteria")QueryCriteria queryCriteria, @Param("startTime") Long startTime, @Param("endTime")Long endTime);
List<OrderAccountBo> selectOrderAccountByOrderTypeAndStartTimeAndEndTime(@Param("orderType") Integer orderType,
@Param("startTime") long startTime,
......
......@@ -2,6 +2,7 @@ package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderTourReceivedStatistics;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.Mapper;
import java.util.List;
......@@ -13,7 +14,7 @@ import java.util.List;
* @email 18178966185@163.com
* @date 2019-11-08 18:03:42
*/
public interface OrderTourReceivedStatisticsMapper extends Mapper<OrderTourReceivedStatistics> {
public interface OrderTourReceivedStatisticsMapper extends Mapper<OrderTourReceivedStatistics>, InsertListMapper<OrderTourReceivedStatistics> {
List<OrderTourReceivedStatistics> selectOrderTourReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
}
......@@ -11,8 +11,10 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.OrderTourDetailBiz;
import com.xxfc.platform.order.biz.OrderTourReceivedStatisticsBiz;
import com.xxfc.platform.order.entity.BaseOrder;
import com.xxfc.platform.order.entity.OrderTourDetail;
import com.xxfc.platform.order.entity.OrderTourReceivedStatistics;
import com.xxfc.platform.order.pojo.order.add.AddTourDTO;
import com.xxfc.platform.order.pojo.order.TourBO;
import com.xxfc.platform.order.pojo.price.TourPriceVO;
......@@ -31,16 +33,21 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
@Controller
@RequestMapping("orderTour")
@IgnoreClientToken
@Api(value="旅游订单",tags={"旅游订单"})
public class OrderTourController extends BaseController<OrderTourDetailBiz,OrderTourDetail> {
@Api(value = "旅游订单", tags = {"旅游订单"})
public class OrderTourController extends BaseController<OrderTourDetailBiz, OrderTourDetail> {
@Autowired
OrderTourService orderTourService;
@Autowired
OrderTourReceivedStatisticsBiz orderTourReceivedStatisticsBiz;
@Autowired
TourFeign tourFeign;
......@@ -50,33 +57,51 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@Autowired
UserFeign userFeign;
public AppUserDTO getUserInfo(){
return userFeign.userDetailByToken(userAuthConfig.getToken(request)).getData();
public AppUserDTO getUserInfo() {
return userFeign.userDetailByToken(userAuthConfig.getToken(request)).getData();
}
@RequestMapping(value = "/orderTourStatistics", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "旅游订单统计")
public ObjectRestResponse<OrderTourReceivedStatistics> orderTourStatistics() {
Date today = new Date();//获取今天的日期
Calendar c = Calendar.getInstance();
c.setTime(today);
c.add(Calendar.DAY_OF_MONTH, 1);
Date tomorrow = c.getTime();//这是明天
c.setTime(today);
c.add(Calendar.DAY_OF_MONTH, -1);
Date yesterday = c.getTime();//这是昨天
orderTourReceivedStatisticsBiz.orderTourInsertStatisticsNew(yesterday, tomorrow,null
);
return ObjectRestResponse.succ();
}
@RequestMapping(value = "add",method = RequestMethod.POST)
@RequestMapping(value = "add", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "确认旅游订单")
public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo){
public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo) {
TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData());
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos()) ? Arrays.asList(vo.getTickerNos().split(",")) : null);
orderTourService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder());
}
@RequestMapping(value = "/calculate-price",method = RequestMethod.GET)
@RequestMapping(value = "/calculate-price", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "价格计算")
@IgnoreUserToken
public ObjectRestResponse<TourPriceVO> calculatePrice(CalculatePriceVO vo){
public ObjectRestResponse<TourPriceVO> calculatePrice(CalculatePriceVO vo) {
TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setAppUserDTO(getUserInfo());
bo.setAdultNum(vo.getNumber());
bo.setChildNum(vo.getChildNumber());
TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData();
bo.setTourGood(tourGood);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos())? Arrays.asList(vo.getTickerNos().split(",")):null);
bo.setTickerNo(StrUtil.isNotBlank(vo.getTickerNos()) ? Arrays.asList(vo.getTickerNos().split(",")) : null);
return ObjectRestResponse.succ(orderTourService.calculatePrice(bo));
}
......
......@@ -5,19 +5,28 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.biz.CompanyPerformanceBiz;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.wxiaoqi.security.common.exception.BaseException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* @author libin
* @version 1.0
* @description 公司业绩查询
* @data 2019/11/23 14:32
*/
@Slf4j
@RestController
@RequestMapping("/statistics")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
......@@ -30,4 +39,22 @@ public class CompanyOrderReceivedStatiscsAdminController {
PageDataVO<CompanyPerformanceBo> dataVO = companyPerformanceBiz.selectCompanyPerformancePage(companyPerformanceFindDTO);
return ObjectRestResponse.succ(dataVO);
}
@ApiOperation("导出")
@PostMapping("/export")
public void exportCompanyPerformance(@RequestBody CompanyPerformanceFindDTO companyPerformanceFindDTO, HttpServletResponse response){
try {
String name = DateTimeFormatter.ofPattern("YYYYMMddHHmmss").format(LocalDateTime.now());
response.setContentType("application/vnd.ms-excel;charset=utf-8");
String filename = String.format("%s-company-statistics.xlsx",name);
response.setHeader("Content-Disposition","attachment;filename="+ new String(filename.getBytes(), "iso8859-1"));
ServletOutputStream outputStream = response.getOutputStream();
companyPerformanceBiz.exportOrderReceivedStatisticsData(companyPerformanceFindDTO,outputStream);
response.setCharacterEncoding("UTF-8");
}catch (Exception ex){
log.error("导出数据失败【{}】",ex);
throw new BaseException("导出数据失败");
}
}
}
......@@ -349,7 +349,7 @@
</select>
<select id="findMemberOrders" resultType="com.xxfc.platform.order.pojo.dto.MemberOrderBo">
select bo.*,omd.member_level AS `memberLevel` from (
select bo.*,omd.member_level AS `memberLevel` from (
SELECT
`id`,
`no` AS `orderNo`,
......@@ -405,25 +405,24 @@
) AS `bo`
INNER JOIN (select * from `order_member_detail` where 1=1
<if test="level!=null">
and `member_level`=#{level}
and `member_level`=#{level}
</if>
) AS `omd` ON omd.order_id=bo.id
ORDER BY bo.`creatTime` DESC
</select>
<select id="selectOrdersByTypeAndTime" resultType="com.xxfc.platform.order.pojo.dto.OrderDTO">
select bo.id,bo.type,bo.status,bo.order_amount,bo.real_amount,bo.order_origin,bo.parent_user_id as `userId`,bo.parent_postion_id as `postionId`,
bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`) AS `companyId`,orvd.deposit,orvd.cost_detail_extend AS `costDetailExtend` from (select `id`,`type`,`status`,`order_amount` AS `orderAmount`, `real_amount`AS
`realAmount`,`order_origin` AS `orderOrigin`, `has_pay` AS `hasPay`,
`pay_way` AS `payWay`
from `base_order` where 1=1
<if test="hasPay!=null">
and `has_pay`=#{hasPay}
</if>
and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreach collection="types"
item="type"
open="(" close=")"
separator=",">
select bo.id,bo.type,bo.status,bo.order_amount,bo.real_amount,bo.order_origin,bo.parent_user_id as `userId`,bo.parent_position_id as `postionId`,
bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`) AS `companyId`,
orvd.deposit,orvd.cost_detail_extend AS `costDetailExtend`
from (select * from `base_order` where 1=1
<if test="hasPay!=null">
and `has_pay`=#{hasPay}
</if>
and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreach collection="types"
item="type"
open="(" close=")"
separator=",">
#{type}
</foreach> ) AS `bo`
LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail_extend` from `order_rent_vehicle_detail`) AS `orvd` ON
......@@ -440,7 +439,6 @@
</foreach>
</select>
<select id="selectTotalStatistical" parameterType="com.xxfc.platform.order.pojo.QueryCriteria"
resultType="com.xxfc.platform.order.pojo.Achievement">
select
......
......@@ -50,28 +50,7 @@
<if test="subdivide !=null and subdivide ==1">
AND date( FROM_UNIXTIME( a.crt_time / 1000 ) ) = date( DATE_SUB( now( ), INTERVAL #{day} DAY ) )
</if>
</select>
<select id="outStatisticalData" resultType="com.xxfc.platform.order.pojo.ReturnOrderAmount">
select oa.crt_time as time ,oupc.no,oupc.type,oa.account_detail as accountDetail ,oupc.realname,oupc.username,oa.account_type
from order_account oa
left join order_user_position_company oupc ON oa.order_id=oupc.id
WHERE oa.account_type!=101
<if test="startTime != null">
and oa.crt_time <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime != null">
and oa.crt_time <![CDATA[<=]]> #{endTime}
</if>
<if test="queryCriteria.jurisdiction != null and queryCriteria.jurisdiction.size() !=0 ">
and oupc.company_id in
<foreach collection="queryCriteria.jurisdiction" index="index" item="companyId" open="(" separator="," close=")">
#{companyId}
</foreach>
</if>
<if test="queryCriteria.orderType != null">
and oupc.type = #{queryCriteria.orderType}
</if>
order by oa.crt_time DESC
</select>
<select id="selectOrderAccountByOrderTypeAndStartTimeAndEndTime"
......@@ -92,38 +71,38 @@
`order_account` AS `oa`
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id
LEFT JOIN `order_rent_vehicle_detail` AS `brvd` ON brvd.order_id=oa.order_id
LEFT JOIN `order_tour_detail` as `otd` ON otd.order_id=oa.order_id
LEFT JOIN `order_tour_detail` AS `otd` ON otd.order_id=oa.order_id
LEFT JOIN `order_member_detail` AS `omd` ON omd.order_id=oa.order_id
WHERE bo.type=#{orderType} AND `oa`.account_status=1 AND oa.`crt_time` BETWEEN #{startTime} AND #{endTime}
WHERE bo.type=#{orderType} AND (`oa`.account_status=1 or(bo.pay_way=0 AND bo.has_pay=1 AND oa.account_status=0)) AND oa.`crt_time` BETWEEN #{startTime} AND #{endTime}
</select>
<select id="selectByDateAndStatffIds" resultType="com.xxfc.platform.order.pojo.account.OrderAccountBo">
oa.*,
bo.id,
bo.`status`,
bo.order_origin,
bo.pay_way,
bo.has_pay,
bo.parent_user_id as `userId`,
bo.parent_position_id as `postionId`,
IFNULL(brvd.start_company_id,IFNULL(otd.start_company_id,bo.parent_user_company_id)) AS `companyId`,
brvd.cost_detail_extend AS `costDetailExtend`,
brvd.damage_safe AS `damageSafe`,
omd.member_level AS `memberLevel`
oa.*,
bo.id,
bo.`status`,
bo.order_origin,
bo.pay_way,
bo.has_pay,
bo.parent_user_id as `userId`,
bo.parent_position_id as `postionId`,
IFNULL(brvd.start_company_id,IFNULL(otd.start_company_id,bo.parent_user_company_id)) AS `companyId`,
brvd.cost_detail_extend AS `costDetailExtend`,
brvd.damage_safe AS `damageSafe`,
omd.member_level AS `memberLevel`
FROM
`order_account` AS `oa`
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id
LEFT JOIN `order_rent_vehicle_detail` AS `brvd` ON brvd.order_id=oa.order_id
LEFT JOIN `order_tour_detail` as `otd` ON otd.order_id=oa.order_id
LEFT JOIN `order_member_detail` AS `omd` ON omd.order_id=oa.order_id
WHERE `oa`.account_status=1
AND oa.`crt_time` BETWEEN #{startDate} AND #{endDate}
<if test="staffUserIds!=null and staffUserIds.size>0">
and bo.id IN <foreach collection="staffUserIds" item="staffId" open="(" close=")" separator=",">
#{staffId}
</foreach>
</if>
`order_account` AS `oa`
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id
LEFT JOIN `order_rent_vehicle_detail` AS `brvd` ON brvd.order_id=oa.order_id
LEFT JOIN `order_tour_detail` as `otd` ON otd.order_id=oa.order_id
LEFT JOIN `order_member_detail` AS `omd` ON omd.order_id=oa.order_id
WHERE `oa`.account_status=1
AND oa.`crt_time` BETWEEN #{startDate} AND #{endDate}
<if test="staffUserIds!=null and staffUserIds.size>0">
and bo.id IN <foreach collection="staffUserIds" item="staffId" open="(" close=")" separator=",">
#{staffId}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -62,25 +62,28 @@
<select id="selectCompanyPerformanceWithDay" resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT
ors.*,
IFNULL(ovss.departureNum,0),
IFNULL(ovss.rentDays,0),
IFNULL(ovss.arrivalNum,0)
IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0) as `departureNum`,
IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM
(
SELECT
`company_id` AS `companyId`,
`year`,
`date`,
SUM(`member_amount` ) AS `memberAmount`,
SUM(`travel_amount` ) AS `travelAmount`,
SUM(`rent_vehicle_amount` ) AS `rentVehilceAmount`
SUM(`member_amount`-`member_refund_amount`) AS `memberAmount`,
SUM(`travel_amount`-`travel_refund_amount` ) AS `travelAmount`,
SUM(`rent_vehicle_amount`-`rent_vehicle_refund_amount`) AS `rentVehilceAmount`,
SUM(`no_deductible_amount` - `no_deductible_refund_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount` - `deposit_refund_amount`) as `depositAmount`
FROM
`order_received_statistics`
WHERE 1=1
`order_received_statistics` WHERE `has_pay`=1
<if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null">
AND `date` BETWEEN #{startDate} AND #{endDate}
</if>
......@@ -109,8 +112,10 @@
IFNULL(SUM( `arrival_num` ),0) AS `arrivalNum`,
IFNULL(SUM( `rent_num` ),0) AS `rentDays`
FROM
`order_vehicle_service_statistics`
WHERE 1=1
`order_vehicle_service_statistics` WHERE 1=1
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null">
AND `count_date` BETWEEN #{startDate} AND #{endDate}
</if>
......@@ -138,25 +143,28 @@
resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT
ors.*,
IFNULL(ovss.departureNum,0),
IFNULL(ovss.rentDays,0),
IFNULL(ovss.arrivalNum,0)
IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM
(
SELECT
company_id AS `companyId`,
`year`,
`month`,
COALESCE(SUM(`member_amount` ),0) AS `memberAmount`,
COALESCE(SUM(`travel_amount` ),0) AS `travelAmount`,
COALESCE(SUM(`rent_vehicle_amount` ),0) AS `rentVehilceAmount`
SUM(`member_amount`-`member_refund_amount`) AS `memberAmount`,
SUM(`travel_amount`-`travel_refund_amount` ) AS `travelAmount`,
SUM(`rent_vehicle_amount`-`rent_vehicle_refund_amount`) AS `rentVehilceAmount`,
SUM(`no_deductible_amount` - `no_deductible_refund_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount` - `deposit_refund_amount`) as `depositAmount`
FROM
`order_received_statistics`
WHERE 1=1
`order_received_statistics` WHERE `has_pay`=1
<if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null">
AND `date` BETWEEN #{startDate} AND #{endDate}
</if>
......@@ -185,8 +193,10 @@
COALESCE(SUM( `arrival_num` ),0) AS `arrivalNum`,
COALESCE(SUM( `rent_num` ),0) AS `rentDays`
FROM
`order_vehicle_service_statistics`
WHERE 1=1
`order_vehicle_service_statistics` WHERE 1=1
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null">
AND `count_date` BETWEEN #{startDate} AND #{endDate}
</if>
......@@ -213,25 +223,28 @@
<select id="selectCompanyPerformanceWithWeek" resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT
ors.*,
IFNULL(ovss.departureNum,0),
IFNULL(ovss.rentDays,0),
IFNULL(ovss.arrivalNum,0)
IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM
(
SELECT
company_id AS `companyId`,
`year`,
`week_of_year` AS `weekOfYear`,
COALESCE(SUM(`member_amount` ),0) AS `memberAmount`,
COALESCE(SUM(`travel_amount` ),0) AS `travelAmount`,
COALESCE(SUM(`rent_vehicle_amount` ),0) AS `rentVehilceAmount`
SUM(`member_amount`-`member_refund_amount`) AS `memberAmount`,
SUM(`travel_amount`-`travel_refund_amount` ) AS `travelAmount`,
SUM(`rent_vehicle_amount`-`rent_vehicle_refund_amount`) AS `rentVehilceAmount`,
SUM(`no_deductible_amount` - `no_deductible_refund_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount` - `deposit_refund_amount`) as `depositAmount`
FROM
`order_received_statistics`
WHERE 1=1
`order_received_statistics` WHERE `has_pay`=1
<if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null">
AND `date` BETWEEN #{startDate} AND #{endDate}
</if>
......@@ -262,6 +275,9 @@
FROM
`order_vehicle_service_statistics`
WHERE 1=1
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null">
AND `count_date` BETWEEN #{startDate} AND #{endDate}
</if>
......
import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz;
import com.xxfc.platform.order.biz.OrderStatisticsBiz;
import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.jobhandler.BaseOrderStatisticsJobHandler;
import com.xxfc.platform.order.jobhandler.SaffStatisticsJobHandler;
import com.xxfc.platform.order.jobhandler.OrderReceivedStatisticsJobHandler;
import com.xxfc.platform.order.pojo.HomePageOrderData;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.SneakyThrows;
import org.joda.time.DateTime;
import org.junit.Test;
......@@ -15,6 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;
/**
* @author libin
......@@ -36,8 +38,17 @@ public class ServiceTest {
private BaseOrderStatisticsJobHandler handler;
@Autowired
private SaffStatisticsJobHandler statisticsJobHandler;
private OrderMemberReceivedStatisticsBiz orderMemberReceivedStatisticsBiz;
@Autowired
private OrderRentVehicleReceivedStatisticsBiz orderRentVehicleReceivedStatisticsBiz;
@Autowired
private OrderReceivedStatisticsJobHandler orderReceivedStatisticsJobHandler;
@Autowired
private OrderTourReceivedStatisticsBiz orderTourReceivedStatisticsBiz;
@Autowired
private VehicleFeign vehicleFeign;
@Test
public void testSchedu(){
......@@ -72,8 +83,8 @@ public class ServiceTest {
@Test
public void test4(){
// HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null);
// System.out.println(totalOrder);
HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null,null);
System.out.println(totalOrder);
}
......@@ -83,9 +94,35 @@ public class ServiceTest {
}
@Test
@SneakyThrows
public void testStaffStatisticsJob(){
statisticsJobHandler.execute("");
public void testMemberStatistics(){
Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
orderMemberReceivedStatisticsBiz.orderMemberReceivedStatistics(startDate,endDate,companyMap);
}
@Test
public void testRentVehicleStatistics(){
Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
orderRentVehicleReceivedStatisticsBiz.orderRentVehicleReceivedStatistics(startDate,endDate,companyMap);
}
@Test
public void testTourStatistics(){
Date date = DateTime.parse("2019-11-15").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
orderTourReceivedStatisticsBiz.orderTourInsertStatisticsNew(startDate,endDate,companyMap);
}
@Test
@SneakyThrows
public void testOrderReceivedStatisticsJobHandler(){
orderReceivedStatisticsJobHandler.execute("");
}
}
......@@ -56,7 +56,7 @@ public class UploadService {
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return realFileRelPath;
}
......@@ -84,7 +84,7 @@ public class UploadService {
file.mkdirs();
}
String str="/" + no + ".jpg";
String str="/" + no + ".jpg";
realFileRelPath = realFileRelPath+str;
filePath=filePath +str;
//将文件写入指定位置
......@@ -166,7 +166,7 @@ public class UploadService {
//文件存放路径
String filePath = videoUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
realFileRelPath=xx_url+SystemConfig.VIDEO_URL+realFileRelPath;
return realFileRelPath;
}
......
......@@ -16,7 +16,7 @@ public enum BookType {
BOOKING(7,"预约中"),
DISABLE(8,"禁用"),
CUSTOMER_APPLY(9, "客户用车"),
OTHER(10, "其他"),
OTHER(10, "其他"),
DISPATCH(11, "调度")
;
/**
......
......@@ -16,7 +16,9 @@ import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Created by ace on 2017/9/15.
......@@ -152,10 +154,8 @@ public interface VehicleFeign {
//cata
/**
* 查询当前车型拥有的标签
*
* @param ids
* @return
*/
......@@ -167,7 +167,6 @@ public interface VehicleFeign {
/**
* 根据位置查询
*
* @param branchCompanyFindDTO
* @return
*/
......@@ -180,6 +179,11 @@ public interface VehicleFeign {
@RequestMapping(value = "/vehicleInfo/bookRecord/update", method = RequestMethod.POST)
public ObjectRestResponse update(@RequestBody BookRecordUpdateLog bookRecordUpdateLog);
@GetMapping(value ="/branchCompany/getCompanyIds")
RestResponse<List<Integer>> getCompanyIds(@RequestParam(value = "dataZone")String dataZone ,@RequestParam(value = "dataCompany")String dataCompany);
@GetMapping(value = "/bookRecord/get")
public ObjectRestResponse<List<BookRecordUpdateLog>> get(@RequestParam(value = "bookRecordId")Long bookRecordId);
/**
* 车型日历价格
......@@ -196,12 +200,6 @@ public interface VehicleFeign {
@RequestParam(value = "vehicleModelId") Integer vehicleModelId,
@RequestParam(value = "userId") Integer userId);
@GetMapping(value ="/branchCompany/getCompanyIds")
RestResponse<List<Integer>> getCompanyIds(@RequestParam(value = "dataZone")String dataZone ,@RequestParam(value = "dataCompany")String dataCompany);
@GetMapping(value = "/bookRecord/get")
public ObjectRestResponse<List<BookRecordUpdateLog>> get(@RequestParam(value = "bookRecordId")Long bookRecordId);
@GetMapping("/branchCompany/company_info")
Map<Integer, String> findCompanyMap();
/**
......
......@@ -277,7 +277,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -225,7 +225,7 @@ public class BranchCompanyStockService {
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -176,7 +176,7 @@ public class CampsiteBiz extends BaseBiz<CampsiteMapper, Campsite> {
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -129,7 +129,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
//文件存放路径
String filePath = baseUploadPath + realFileRelPath;
//将文件写入指定位置
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
// FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
......
......@@ -333,32 +333,32 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
}
public ObjectRestResponse addBookRecord(VehicleBookRecord vehicleBookRecord) {
if (vehicleBookRecord == null) {
return ObjectRestResponse.paramIsEmpty();
}
save(vehicleBookRecord);
if (vehicleBookRecord != null) {
//添加交还车记录
VehicleDepartureLog vehicleDepartureLog = new VehicleDepartureLog();
vehicleDepartureLog.setBookRecordId(vehicleBookRecord.getId());
vehicleDepartureLog.setArrivalBranchCompanyId(vehicleBookRecord.getRetCompany());
vehicleDepartureLog.setArrivalRemark("后台修改停靠分公司,车辆调度");
vehicleDepartureLog.setArrivalTime(new Date());
vehicleDepartureLog.setCheckMan(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setCheckManTel(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setCreateTime(new Date());
vehicleDepartureLog.setDepartureBranchCompanyId(vehicleBookRecord.getLiftCompany());
vehicleDepartureLog.setDepartureRemark("后台修改停靠分公司,车辆调度");
vehicleDepartureLog.setDepartureTime(new Date());
vehicleDepartureLog.setRecycleMan(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setRecycleManTel(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setState(1);
vehicleDepartureLog.setVehicleId(vehicleBookRecord.getVehicleId());
vehicleDepartureLog.setUse("调度");
vehicleDepartureLog.setUser(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setUserTel(vehicleBookRecord.getBookUserName());
vehicleActiveService.save(vehicleDepartureLog);
}
if (vehicleBookRecord == null) {
return ObjectRestResponse.paramIsEmpty();
}
save(vehicleBookRecord);
if (vehicleBookRecord != null) {
//添加交还车记录
VehicleDepartureLog vehicleDepartureLog = new VehicleDepartureLog();
vehicleDepartureLog.setBookRecordId(vehicleBookRecord.getId());
vehicleDepartureLog.setArrivalBranchCompanyId(vehicleBookRecord.getRetCompany());
vehicleDepartureLog.setArrivalRemark("后台修改停靠分公司,车辆调度");
vehicleDepartureLog.setArrivalTime(new Date());
vehicleDepartureLog.setCheckMan(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setCheckManTel(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setCreateTime(new Date());
vehicleDepartureLog.setDepartureBranchCompanyId(vehicleBookRecord.getLiftCompany());
vehicleDepartureLog.setDepartureRemark("后台修改停靠分公司,车辆调度");
vehicleDepartureLog.setDepartureTime(new Date());
vehicleDepartureLog.setRecycleMan(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setRecycleManTel(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setState(1);
vehicleDepartureLog.setVehicleId(vehicleBookRecord.getVehicleId());
vehicleDepartureLog.setUse("调度");
vehicleDepartureLog.setUser(vehicleBookRecord.getBookUserName());
vehicleDepartureLog.setUserTel(vehicleBookRecord.getBookUserName());
vehicleActiveService.save(vehicleDepartureLog);
}
return ObjectRestResponse.succ();
}
......
......@@ -15,7 +15,9 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
VehicleDepartureLog selectLastByVehicleId(String vehicleId);
List<VehicleDepartureLogVo> selectByVehicleId(String vehicleId);
List<VehicleDepartureLog> selectByVehicle(String vehicleId);
List<VehicleDepartureLogVo> selectVoAll(@Param("numberPlate") String numberPlate,
@Param("code") Integer code,
@Param("zoneId") Integer zoneId,
......@@ -23,8 +25,10 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user,
@Param("startTime") String startTime,
@Param("endTime") String endTime
);
@Param("endTime") String endTime,
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user
);
List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate,
@Param("code") Integer code,
......@@ -34,12 +38,15 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("use") String user,
@Param("startTime") String startTime,
@Param("endTime") String endTime,
@Param("companyList") List<Integer> companyList);
@Param("companyList") List<Integer> companyList,
@Param("arrivalBranchCompanyId") Integer arrivalBranchCompanyId,
@Param("use") String user);
Integer selectMileageByVehicleId(String vehicleId);
String selectDayByVehicleId(String vehicleId);
VehicleDepartureLogVo selectByBookRecordId(Long bookRecordId);
Integer selectAllDepartureLog(Map<String, Object> param);
}
......@@ -618,4 +618,10 @@ public class VehicleController extends BaseController<VehicleBiz> implements Use
public List<String> findbyPlateNumberAndVehicleCod(@RequestParam(value = "plateNumber",required = false) String plateNumber,@RequestParam(value = "vehicleCode",required = false) String vehicleCode){
return vehicleBiz.findbyPlateNumberAndVehicleCod(plateNumber,vehicleCode);
}
@GetMapping("/app/unauth/findDictionaryMaps")
@IgnoreUserToken
public ObjectRestResponse findbyDictionaryMaps(@RequestParam(value = "plateNumber",required = false) String plateNumber,@RequestParam(value = "vehicleCode",required = false) String vehicleCode){
return vehicleBookRecordBiz.getOrderDetail();
}
}
......@@ -102,7 +102,6 @@
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id
LEFT JOIN branch_company bc ON vehicle_departure_log.departure_branch_company_id = bc.id
LEFT JOIN branch_company bc1 ON vehicle_departure_log.arrival_branch_company_id = bc1.id
LEFT JOIN vehicle_book_record bc2 ON vehicle_departure_log.book_record_id = bc2.id
<trim prefix="where">
1=1
<if test="numberPlate != null and numberPlate != ''">
......
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