Commit ab8bd8ee authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into dev

parents 050ab55e 56b4b783
package com.xxfc.platform.order.bo; package com.xxfc.platform.order.bo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
...@@ -32,10 +30,47 @@ public class CompanyPerformanceBo { ...@@ -32,10 +30,47 @@ public class CompanyPerformanceBo {
private BigDecimal rentVehilceAmount; private BigDecimal rentVehilceAmount;
private BigDecimal travelAmount; private BigDecimal travelAmount;
private BigDecimal noDeductibleAmount; private BigDecimal noDeductibleAmount;
private BigDecimal depositAmount;
private Integer rentDays; private Integer rentDays;
private BigDecimal extralAmount; private BigDecimal extralAmount;
private Integer departureNum; private Integer departureNum;
private Integer arrivalNum; private Integer arrivalNum;
private Date startDate; private Date startDate;
private Date endDate; 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; ...@@ -21,7 +21,6 @@ import java.math.BigDecimal;
public class OrderMemberReceivedStatistics extends OrderReceivedStatisticsBase implements Serializable { public class OrderMemberReceivedStatistics extends OrderReceivedStatisticsBase implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 普通会员订单总额 * 普通会员订单总额
*/ */
......
package com.xxfc.platform.order.entity; package com.xxfc.platform.order.entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
...@@ -18,6 +19,7 @@ import java.math.BigDecimal; ...@@ -18,6 +19,7 @@ import java.math.BigDecimal;
*/ */
@Data @Data
@Table(name = "order_received_statistics") @Table(name = "order_received_statistics")
@ApiModel("订单统计")
public class OrderReceivedStatistics extends OrderReceivedStatisticsBase implements Serializable { public class OrderReceivedStatistics extends OrderReceivedStatisticsBase implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -25,14 +27,38 @@ public class OrderReceivedStatistics extends OrderReceivedStatisticsBase impleme ...@@ -25,14 +27,38 @@ public class OrderReceivedStatistics extends OrderReceivedStatisticsBase impleme
@ApiModelProperty("会员费") @ApiModelProperty("会员费")
private BigDecimal memberAmount; private BigDecimal memberAmount;
@Column(name = "member_refund_amount")
@ApiModelProperty("会员退款费")
private BigDecimal memberRefundAmout;
@Column(name = "member_quantity")
@ApiModelProperty("会员订单量")
private Integer memberQuantity;
@Column(name = "travel_amount") @Column(name = "travel_amount")
@ApiModelProperty("旅游费") @ApiModelProperty("旅游费")
private BigDecimal travelAmount; 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") @Column(name = "rent_vehicle_amount")
@ApiModelProperty("租车费") @ApiModelProperty("租车费")
private BigDecimal rentVehicleAmount; 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") @Column(name = "no_deductible_amount")
@ApiModelProperty("不计免赔费") @ApiModelProperty("不计免赔费")
private BigDecimal noDeductibleAmount; private BigDecimal noDeductibleAmount;
......
...@@ -29,7 +29,7 @@ public class CompanyPerformanceFindDTO extends PageParam { ...@@ -29,7 +29,7 @@ public class CompanyPerformanceFindDTO extends PageParam {
@ApiModelProperty("统计方式 1:日 2:周 3:月") @ApiModelProperty("统计方式 1:日 2:周 3:月")
@NotNull(message = "统计方式不能为null") @NotNull(message = "统计方式不能为null")
private Integer statisticalWay; private Integer statisticalWay;
private String companyName; private String companyName;
private Integer companyId;
} }
...@@ -2,22 +2,24 @@ package com.xxfc.platform.order.biz; ...@@ -2,22 +2,24 @@ package com.xxfc.platform.order.biz;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.github.wxiaoqi.security.common.vo.PageDataVO; 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.contant.enumerate.ReceivedStatisticsEnum;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO; import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import com.xxfc.platform.vehicle.feign.VehicleFeign; import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections.CollectionUtils; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate; import javax.servlet.ServletOutputStream;
import java.util.Calendar; import java.io.IOException;
import java.util.Date; import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* @author libin * @author libin
...@@ -30,9 +32,131 @@ import java.util.stream.Collectors; ...@@ -30,9 +32,131 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class CompanyPerformanceBiz { public class CompanyPerformanceBiz {
private final OrderReceivedStatisticsBiz orderReceivedStatisticsBiz; private final OrderReceivedStatisticsBiz orderReceivedStatisticsBiz;
private final VehicleFeign vehicleFeign; 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) { public PageDataVO<CompanyPerformanceBo> selectCompanyPerformancePage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -73,4 +197,5 @@ public class CompanyPerformanceBiz { ...@@ -73,4 +197,5 @@ public class CompanyPerformanceBiz {
} }
return pageDataVO; return pageDataVO;
} }
} }
...@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,8 +4,6 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; 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.admin.feign.UserFeign;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.exception.BaseException; import com.github.wxiaoqi.security.common.exception.BaseException;
...@@ -660,7 +658,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -660,7 +658,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @return * @return
*/ */
public List<OrderAccountBo> selectByTypeAndDate(Integer orderType, Date startDate, Date endDate) { 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; return CollectionUtils.isEmpty(accountBos)? Collections.EMPTY_LIST:accountBos;
} }
...@@ -671,7 +669,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> { ...@@ -671,7 +669,7 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
* @param staffUserIds * @param staffUserIds
* @return * @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); List<OrderAccountBo> orderAccountBos = mapper.selectByDateAndStatffIds(startDate,endDate,staffUserIds);
return CollectionUtils.isNotEmpty(orderAccountBos)?Collections.EMPTY_LIST:orderAccountBos; return CollectionUtils.isNotEmpty(orderAccountBos)?Collections.EMPTY_LIST:orderAccountBos;
} }
......
...@@ -28,7 +28,6 @@ import java.math.BigDecimal; ...@@ -28,7 +28,6 @@ import java.math.BigDecimal;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -56,16 +55,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -56,16 +55,18 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
/** /**
* 公司业绩(按日统计) * 公司业绩(按日统计)
*
* @param companyPerformanceFindDTO * @param companyPerformanceFindDTO
* @return * @return
*/ */
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithDayPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) { public PageDataVO<CompanyPerformanceBo> selectCompanyPerformanceWithDayPage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(), return PageDataVO.pageInfo(companyPerformanceFindDTO.getPage(), companyPerformanceFindDTO.getLimit(),
() -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO)); () -> mapper.selectCompanyPerformanceWithDay(companyPerformanceFindDTO));
} }
/** /**
* 公司业绩(按月统计) * 公司业绩(按月统计)
*
* @param companyPerformanceFindDTO * @param companyPerformanceFindDTO
* @return * @return
*/ */
...@@ -76,6 +77,7 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -76,6 +77,7 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
/** /**
* 公司业绩(按周统计) * 公司业绩(按周统计)
*
* @param companyPerformanceFindDTO * @param companyPerformanceFindDTO
* @return * @return
*/ */
...@@ -237,34 +239,58 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -237,34 +239,58 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
for (Map.Entry<String, List<OrderRentVehicleReceivedStatistics>> rentVehicleEntry : rentVehicleSet) { for (Map.Entry<String, List<OrderRentVehicleReceivedStatistics>> rentVehicleEntry : rentVehicleSet) {
String stateGroup = rentVehicleEntry.getKey(); String stateGroup = rentVehicleEntry.getKey();
List<OrderRentVehicleReceivedStatistics> rentVehicleEntryValue = rentVehicleEntry.getValue(); List<OrderRentVehicleReceivedStatistics> rentVehicleEntryValue = rentVehicleEntry.getValue();
OrderRentVehicleReceivedStatistics orderRentVehicle = rentVehicleEntryValue.get(0); //创建默认的订单统计对象并设置默认值
OrderReceivedStatistics orderReceivedStatisticsClone = StatisticsStatusEnum.wrapStatisticsObject(date, stateGroup, Collections.EMPTY_MAP, ObjectUtil.clone(orderReceivedStatistics)); 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.setCompanyId(orderRentVehicle.getCompanyId());
//公司名称
orderReceivedStatisticsClone.setCompanyName(orderRentVehicle.getCompanyName()); 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.setDepositAmount(orderRentVehicle.getDepositAmount());
//退款押金
orderReceivedStatisticsClone.setDepositRefundAmount(orderRentVehicle.getDepositRefundAmount()); orderReceivedStatisticsClone.setDepositRefundAmount(orderRentVehicle.getDepositRefundAmount());
//定损
orderReceivedStatisticsClone.setLossSpecifiedAmount(orderRentVehicle.getLossSpecifiedAmount());
//违章
orderReceivedStatisticsClone.setBreakRulesRegulationAmount(orderRentVehicle.getBreakRulesRegulationAmount()); orderReceivedStatisticsClone.setBreakRulesRegulationAmount(orderRentVehicle.getBreakRulesRegulationAmount());
//免赔退款金额
orderReceivedStatisticsClone.setNoDeductibleRefundAmount(orderRentVehicle.getNoDeductibleRefundAmount()); orderReceivedStatisticsClone.setNoDeductibleRefundAmount(orderRentVehicle.getNoDeductibleRefundAmount());
//免赔金额
orderReceivedStatisticsClone.setNoDeductibleAmount(orderRentVehicle.getNoDeductibleAmount()); 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.setMemberAmount(orderMember.getTotalAmount());
orderReceivedStatisticsClone.setMemberRefundAmout(orderMember.getOrderRefundAmount());
//租车订单总额
orderReceivedStatisticsClone.setRentVehicleAmount(orderRentVehicle.getTotalAmount()); orderReceivedStatisticsClone.setRentVehicleAmount(orderRentVehicle.getTotalAmount());
orderReceivedStatisticsClone.setRentVehicleRefundAmount(orderRentVehicle.getOrderRefundAmount());
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 totalAmount = orderRentVehicle.getTotalAmount().add(orderTour.getTotalAmount()).add(orderMember.getTotalAmount());
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(); 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.setLateFeeAmount(lateFeeAmount);
orderReceivedStatisticsClone.setTotalAmount(totalAmount); orderReceivedStatisticsClone.setTotalAmount(totalAmount);
orderReceivedStatisticsClone.setOrderRefundAmount(totalRefundAmount); orderReceivedStatisticsClone.setOrderRefundAmount(totalRefundAmount);
...@@ -272,30 +298,8 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -272,30 +298,8 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
orderReceivedStatisticsList.add(orderReceivedStatisticsClone); orderReceivedStatisticsList.add(orderReceivedStatisticsClone);
} }
//保存
insertReceivedStatisticsBatch(orderReceivedStatisticsList); StatisticsStatusEnum.insertReceivedStatisticsBatch(orderReceivedStatisticsList, mapper);
}
/**
* 批量插入数据 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);
}
} }
/** /**
......
package com.xxfc.platform.order.biz; package com.xxfc.platform.order.biz;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO; import cn.hutool.core.util.ObjectUtil;
import org.springframework.stereotype.Service; 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.entity.OrderTourReceivedStatistics;
import com.xxfc.platform.order.mapper.OrderTourReceivedStatisticsMapper; import com.xxfc.platform.order.mapper.OrderTourReceivedStatisticsMapper;
import com.github.wxiaoqi.security.common.biz.BaseBiz; import com.xxfc.platform.order.pojo.account.OrderAccountBo;
import org.springframework.transaction.annotation.Transactional; import com.xxfc.platform.order.pojo.dto.OrderDTO;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import java.util.List; 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 * @author libin
* @email 18178966185@163.com * @version 1.0 旅游统计
* @date 2019-11-08 18:03:42 * @description
* @data 2019/11/28 9:57
*/ */
@Service @Service
@Transactional(rollbackFor = Exception.class) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class OrderTourReceivedStatisticsBiz extends BaseBiz<OrderTourReceivedStatisticsMapper,OrderTourReceivedStatistics> { @Slf4j
public class OrderTourReceivedStatisticsBiz extends BaseBiz<OrderTourReceivedStatisticsMapper, OrderTourReceivedStatistics> {
private final BaseOrderBiz baseOrderBiz;
private final OrderAccountBiz orderAccountBiz;
public List<OrderTourReceivedStatistics> selectOrderReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) { public List<OrderTourReceivedStatistics> selectOrderReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderTourReceivedStatistics(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 ...@@ -101,7 +101,7 @@ public class OrderViolationBiz extends BaseBiz<OrderViolationMapper, OrderViolat
String filePath = ovUpload + realFileRelPath; String filePath = ovUpload + realFileRelPath;
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath)); // FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return ObjectRestResponse.succ(filePath); return ObjectRestResponse.succ(filePath);
} }
......
...@@ -13,12 +13,12 @@ import com.xxfc.platform.vehicle.feign.VehicleFeign; ...@@ -13,12 +13,12 @@ import com.xxfc.platform.vehicle.feign.VehicleFeign;
import com.xxl.job.core.biz.model.ReturnT; import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.IJobHandler; import com.xxl.job.core.handler.IJobHandler;
import com.xxl.job.core.handler.annotation.JobHandler; import com.xxl.job.core.handler.annotation.JobHandler;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -44,7 +44,12 @@ public class OrderReceivedStatisticsJobHandler extends IJobHandler { ...@@ -44,7 +44,12 @@ public class OrderReceivedStatisticsJobHandler extends IJobHandler {
public ReturnT<String> execute(String arg) throws Exception { public ReturnT<String> execute(String arg) throws Exception {
DateTime yesterday = DateUtil.yesterday(); DateTime yesterday = DateUtil.yesterday();
if (StringUtils.hasText(arg)){ 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(); Date startDate = DateUtil.beginOfDay(yesterday).toJdkDate();
...@@ -52,7 +57,7 @@ public class OrderReceivedStatisticsJobHandler extends IJobHandler { ...@@ -52,7 +57,7 @@ public class OrderReceivedStatisticsJobHandler extends IJobHandler {
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); 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); List<OrderRentVehicleReceivedStatistics> orderRentVehicleReceivedStatisticsList = orderRentVehicleReceivedStatisticsBiz.orderRentVehicleReceivedStatistics(startDate, endDate, companyMap);
//会员订单 //会员订单
......
...@@ -12,6 +12,7 @@ import com.xxfc.platform.order.pojo.order.OrderPageVO; ...@@ -12,6 +12,7 @@ import com.xxfc.platform.order.pojo.order.OrderPageVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -44,9 +45,9 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> { ...@@ -44,9 +45,9 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
public List<BgOrderListVo> getAllOrderList(Map<String, Object> paramMap); public List<BgOrderListVo> getAllOrderList(Map<String, Object> paramMap);
List<OrderDTO> selectOrdersByTypeAndTime(@Param("types") List<Integer> types, List<OrderDTO> selectOrdersByTypeAndTime(@Param("types") List<Integer> types,
@Param("hasPay") Integer hasPay, @Param("hasPay") Integer hasPay,
@Param("startDate") Date startDate, @Param("startDate") Date startDate,
@Param("endDate") Date endDate); @Param("endDate") Date endDate);
List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria); List<Achievement> selectTotalStatistical(QueryCriteria queryCriteria);
......
...@@ -11,12 +11,12 @@ import tk.mybatis.mapper.common.Mapper; ...@@ -11,12 +11,12 @@ import tk.mybatis.mapper.common.Mapper;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 订单帐目 * 订单帐目
* *
* @author zhoujw * @author zhoujw
* @email 18178966185@163.com * @email 18178966185@163.com
* @date 2019-09-09 15:51:16 * @date 2019-09-09 15:51:16
...@@ -25,7 +25,7 @@ public interface OrderAccountMapper extends Mapper<OrderAccount> { ...@@ -25,7 +25,7 @@ public interface OrderAccountMapper extends Mapper<OrderAccount> {
List<OrderAccountDTO> getOrderAccountByOrderType(Term term); 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, List<OrderAccountBo> selectOrderAccountByOrderTypeAndStartTimeAndEndTime(@Param("orderType") Integer orderType,
@Param("startTime") long startTime, @Param("startTime") long startTime,
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.mapper; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.order.mapper;
import com.xxfc.platform.order.entity.OrderTourReceivedStatistics; import com.xxfc.platform.order.entity.OrderTourReceivedStatistics;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO; import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import tk.mybatis.mapper.additional.insert.InsertListMapper;
import tk.mybatis.mapper.common.Mapper; import tk.mybatis.mapper.common.Mapper;
import java.util.List; import java.util.List;
...@@ -13,7 +14,7 @@ import java.util.List; ...@@ -13,7 +14,7 @@ import java.util.List;
* @email 18178966185@163.com * @email 18178966185@163.com
* @date 2019-11-08 18:03:42 * @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); List<OrderTourReceivedStatistics> selectOrderTourReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
} }
...@@ -11,8 +11,10 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler; ...@@ -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.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.rest.BaseController; import com.github.wxiaoqi.security.common.rest.BaseController;
import com.xxfc.platform.order.biz.OrderTourDetailBiz; 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.BaseOrder;
import com.xxfc.platform.order.entity.OrderTourDetail; 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.add.AddTourDTO;
import com.xxfc.platform.order.pojo.order.TourBO; import com.xxfc.platform.order.pojo.order.TourBO;
import com.xxfc.platform.order.pojo.price.TourPriceVO; import com.xxfc.platform.order.pojo.price.TourPriceVO;
...@@ -31,16 +33,21 @@ import org.springframework.web.bind.annotation.RequestMethod; ...@@ -31,16 +33,21 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
@Controller @Controller
@RequestMapping("orderTour") @RequestMapping("orderTour")
@IgnoreClientToken @IgnoreClientToken
@Api(value="旅游订单",tags={"旅游订单"}) @Api(value = "旅游订单", tags = {"旅游订单"})
public class OrderTourController extends BaseController<OrderTourDetailBiz,OrderTourDetail> { public class OrderTourController extends BaseController<OrderTourDetailBiz, OrderTourDetail> {
@Autowired @Autowired
OrderTourService orderTourService; OrderTourService orderTourService;
@Autowired
OrderTourReceivedStatisticsBiz orderTourReceivedStatisticsBiz;
@Autowired @Autowired
TourFeign tourFeign; TourFeign tourFeign;
...@@ -50,33 +57,51 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order ...@@ -50,33 +57,51 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@Autowired @Autowired
UserFeign userFeign; UserFeign userFeign;
public AppUserDTO getUserInfo(){ public AppUserDTO getUserInfo() {
return userFeign.userDetailByToken(userAuthConfig.getToken(request)).getData(); 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 @ResponseBody
@ApiOperation(value = "确认旅游订单") @ApiOperation(value = "确认旅游订单")
public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo){ public ObjectRestResponse<BaseOrder> add(@RequestBody AddTourDTO vo) {
TourBO bo = BeanUtil.toBean(vo, TourBO.class); TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setAppUserDTO(userFeign.userDetailByToken(BaseContextHandler.getToken()).getData()); 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); orderTourService.createOrder(bo);
return ObjectRestResponse.succ(bo.getOrder()); return ObjectRestResponse.succ(bo.getOrder());
} }
@RequestMapping(value = "/calculate-price",method = RequestMethod.GET) @RequestMapping(value = "/calculate-price", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ApiOperation(value = "价格计算") @ApiOperation(value = "价格计算")
@IgnoreUserToken @IgnoreUserToken
public ObjectRestResponse<TourPriceVO> calculatePrice(CalculatePriceVO vo){ public ObjectRestResponse<TourPriceVO> calculatePrice(CalculatePriceVO vo) {
TourBO bo = BeanUtil.toBean(vo, TourBO.class); TourBO bo = BeanUtil.toBean(vo, TourBO.class);
bo.setAppUserDTO(getUserInfo()); bo.setAppUserDTO(getUserInfo());
bo.setAdultNum(vo.getNumber()); bo.setAdultNum(vo.getNumber());
bo.setChildNum(vo.getChildNumber()); bo.setChildNum(vo.getChildNumber());
TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData(); TourGood tourGood = tourFeign.usableGet(bo.getGoodId()).getData();
bo.setTourGood(tourGood); 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)); return ObjectRestResponse.succ(orderTourService.calculatePrice(bo));
} }
......
...@@ -5,19 +5,28 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO; ...@@ -5,19 +5,28 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.order.biz.CompanyPerformanceBiz; import com.xxfc.platform.order.biz.CompanyPerformanceBiz;
import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO; import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.bo.CompanyPerformanceBo; import com.xxfc.platform.order.bo.CompanyPerformanceBo;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; 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 * @author libin
* @version 1.0 * @version 1.0
* @description 公司业绩查询 * @description 公司业绩查询
* @data 2019/11/23 14:32 * @data 2019/11/23 14:32
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/statistics") @RequestMapping("/statistics")
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
...@@ -30,4 +39,22 @@ public class CompanyOrderReceivedStatiscsAdminController { ...@@ -30,4 +39,22 @@ public class CompanyOrderReceivedStatiscsAdminController {
PageDataVO<CompanyPerformanceBo> dataVO = companyPerformanceBiz.selectCompanyPerformancePage(companyPerformanceFindDTO); PageDataVO<CompanyPerformanceBo> dataVO = companyPerformanceBiz.selectCompanyPerformancePage(companyPerformanceFindDTO);
return ObjectRestResponse.succ(dataVO); 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 @@ ...@@ -349,7 +349,7 @@
</select> </select>
<select id="findMemberOrders" resultType="com.xxfc.platform.order.pojo.dto.MemberOrderBo"> <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 SELECT
`id`, `id`,
`no` AS `orderNo`, `no` AS `orderNo`,
...@@ -405,25 +405,24 @@ ...@@ -405,25 +405,24 @@
) AS `bo` ) AS `bo`
INNER JOIN (select * from `order_member_detail` where 1=1 INNER JOIN (select * from `order_member_detail` where 1=1
<if test="level!=null"> <if test="level!=null">
and `member_level`=#{level} and `member_level`=#{level}
</if> </if>
) AS `omd` ON omd.order_id=bo.id ) AS `omd` ON omd.order_id=bo.id
ORDER BY bo.`creatTime` DESC ORDER BY bo.`creatTime` DESC
</select> </select>
<select id="selectOrdersByTypeAndTime" resultType="com.xxfc.platform.order.pojo.dto.OrderDTO"> <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`, 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 `id`,`type`,`status`,`order_amount` AS `orderAmount`, `real_amount`AS bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`) AS `companyId`,
`realAmount`,`order_origin` AS `orderOrigin`, `has_pay` AS `hasPay`, orvd.deposit,orvd.cost_detail_extend AS `costDetailExtend`
`pay_way` AS `payWay` from (select * from `base_order` where 1=1
from `base_order` where 1=1 <if test="hasPay!=null">
<if test="hasPay!=null"> and `has_pay`=#{hasPay}
and `has_pay`=#{hasPay} </if>
</if> and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreach collection="types"
and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreach collection="types" item="type"
item="type" open="(" close=")"
open="(" close=")" separator=",">
separator=",">
#{type} #{type}
</foreach> ) AS `bo` </foreach> ) AS `bo`
LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail_extend` from `order_rent_vehicle_detail`) AS `orvd` ON LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail_extend` from `order_rent_vehicle_detail`) AS `orvd` ON
...@@ -440,7 +439,6 @@ ...@@ -440,7 +439,6 @@
</foreach> </foreach>
</select> </select>
<select id="selectTotalStatistical" parameterType="com.xxfc.platform.order.pojo.QueryCriteria" <select id="selectTotalStatistical" parameterType="com.xxfc.platform.order.pojo.QueryCriteria"
resultType="com.xxfc.platform.order.pojo.Achievement"> resultType="com.xxfc.platform.order.pojo.Achievement">
select select
......
...@@ -92,38 +92,38 @@ ...@@ -92,38 +92,38 @@
`order_account` AS `oa` `order_account` AS `oa`
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id 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_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 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>
<select id="selectByDateAndStatffIds" resultType="com.xxfc.platform.order.pojo.account.OrderAccountBo"> <select id="selectByDateAndStatffIds" resultType="com.xxfc.platform.order.pojo.account.OrderAccountBo">
oa.*, oa.*,
bo.id, bo.id,
bo.`status`, bo.`status`,
bo.order_origin, bo.order_origin,
bo.pay_way, bo.pay_way,
bo.has_pay, bo.has_pay,
bo.parent_user_id as `userId`, bo.parent_user_id as `userId`,
bo.parent_position_id as `postionId`, bo.parent_position_id as `postionId`,
IFNULL(brvd.start_company_id,IFNULL(otd.start_company_id,bo.parent_user_company_id)) AS `companyId`, IFNULL(brvd.start_company_id,IFNULL(otd.start_company_id,bo.parent_user_company_id)) AS `companyId`,
brvd.cost_detail_extend AS `costDetailExtend`, brvd.cost_detail_extend AS `costDetailExtend`,
brvd.damage_safe AS `damageSafe`, brvd.damage_safe AS `damageSafe`,
omd.member_level AS `memberLevel` omd.member_level AS `memberLevel`
FROM FROM
`order_account` AS `oa` `order_account` AS `oa`
LEFT JOIN `base_order` AS `bo` ON bo.id = oa.order_id 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_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 LEFT JOIN `order_member_detail` AS `omd` ON omd.order_id=oa.order_id
WHERE `oa`.account_status=1 WHERE `oa`.account_status=1
AND oa.`crt_time` BETWEEN #{startDate} AND #{endDate} AND oa.`crt_time` BETWEEN #{startDate} AND #{endDate}
<if test="staffUserIds!=null and staffUserIds.size>0"> <if test="staffUserIds!=null and staffUserIds.size>0">
and bo.id IN <foreach collection="staffUserIds" item="staffId" open="(" close=")" separator=","> and bo.id IN <foreach collection="staffUserIds" item="staffId" open="(" close=")" separator=",">
#{staffId} #{staffId}
</foreach> </foreach>
</if> </if>
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -62,25 +62,28 @@ ...@@ -62,25 +62,28 @@
<select id="selectCompanyPerformanceWithDay" resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo"> <select id="selectCompanyPerformanceWithDay" resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT SELECT
ors.*, ors.*,
IFNULL(ovss.departureNum,0), IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0), IFNULL(ovss.rentDays,0) as `departureNum`,
IFNULL(ovss.arrivalNum,0) IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM FROM
( (
SELECT SELECT
`company_id` AS `companyId`, `company_id` AS `companyId`,
`year`, `year`,
`date`, `date`,
SUM(`member_amount` ) AS `memberAmount`, SUM(`member_amount`-`member_refund_amount`) AS `memberAmount`,
SUM(`travel_amount` ) AS `travelAmount`, SUM(`travel_amount`-`travel_refund_amount` ) AS `travelAmount`,
SUM(`rent_vehicle_amount` ) AS `rentVehilceAmount` 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 FROM
`order_received_statistics` `order_received_statistics` WHERE `has_pay`=1
WHERE 1=1
<if test="companyName!=null and companyName!=''"> <if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%') AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if> </if>
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
AND `date` BETWEEN #{startDate} AND #{endDate} AND `date` BETWEEN #{startDate} AND #{endDate}
</if> </if>
...@@ -109,8 +112,10 @@ ...@@ -109,8 +112,10 @@
IFNULL(SUM( `arrival_num` ),0) AS `arrivalNum`, IFNULL(SUM( `arrival_num` ),0) AS `arrivalNum`,
IFNULL(SUM( `rent_num` ),0) AS `rentDays` IFNULL(SUM( `rent_num` ),0) AS `rentDays`
FROM FROM
`order_vehicle_service_statistics` `order_vehicle_service_statistics` WHERE 1=1
WHERE 1=1 <if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
AND `count_date` BETWEEN #{startDate} AND #{endDate} AND `count_date` BETWEEN #{startDate} AND #{endDate}
</if> </if>
...@@ -138,25 +143,28 @@ ...@@ -138,25 +143,28 @@
resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo"> resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT SELECT
ors.*, ors.*,
IFNULL(ovss.departureNum,0), IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0), IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM FROM
( (
SELECT SELECT
company_id AS `companyId`, company_id AS `companyId`,
`year`, `year`,
`month`, `month`,
COALESCE(SUM(`member_amount` ),0) AS `memberAmount`, SUM(`member_amount`-`member_refund_amount`) AS `memberAmount`,
COALESCE(SUM(`travel_amount` ),0) AS `travelAmount`, SUM(`travel_amount`-`travel_refund_amount` ) AS `travelAmount`,
COALESCE(SUM(`rent_vehicle_amount` ),0) AS `rentVehilceAmount` 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 FROM
`order_received_statistics` `order_received_statistics` WHERE `has_pay`=1
WHERE 1=1
<if test="companyName!=null and companyName!=''"> <if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%') AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if> </if>
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
AND `date` BETWEEN #{startDate} AND #{endDate} AND `date` BETWEEN #{startDate} AND #{endDate}
</if> </if>
...@@ -185,8 +193,10 @@ ...@@ -185,8 +193,10 @@
COALESCE(SUM( `arrival_num` ),0) AS `arrivalNum`, COALESCE(SUM( `arrival_num` ),0) AS `arrivalNum`,
COALESCE(SUM( `rent_num` ),0) AS `rentDays` COALESCE(SUM( `rent_num` ),0) AS `rentDays`
FROM FROM
`order_vehicle_service_statistics` `order_vehicle_service_statistics` WHERE 1=1
WHERE 1=1 <if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
AND `count_date` BETWEEN #{startDate} AND #{endDate} AND `count_date` BETWEEN #{startDate} AND #{endDate}
</if> </if>
...@@ -213,25 +223,28 @@ ...@@ -213,25 +223,28 @@
<select id="selectCompanyPerformanceWithWeek" resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo"> <select id="selectCompanyPerformanceWithWeek" resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT SELECT
ors.*, ors.*,
IFNULL(ovss.departureNum,0), IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0), IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM FROM
( (
SELECT SELECT
company_id AS `companyId`, company_id AS `companyId`,
`year`, `year`,
`week_of_year` AS `weekOfYear`, `week_of_year` AS `weekOfYear`,
COALESCE(SUM(`member_amount` ),0) AS `memberAmount`, SUM(`member_amount`-`member_refund_amount`) AS `memberAmount`,
COALESCE(SUM(`travel_amount` ),0) AS `travelAmount`, SUM(`travel_amount`-`travel_refund_amount` ) AS `travelAmount`,
COALESCE(SUM(`rent_vehicle_amount` ),0) AS `rentVehilceAmount` 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 FROM
`order_received_statistics` `order_received_statistics` WHERE `has_pay`=1
WHERE 1=1
<if test="companyName!=null and companyName!=''"> <if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%') AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if> </if>
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
AND `date` BETWEEN #{startDate} AND #{endDate} AND `date` BETWEEN #{startDate} AND #{endDate}
</if> </if>
...@@ -262,6 +275,9 @@ ...@@ -262,6 +275,9 @@
FROM FROM
`order_vehicle_service_statistics` `order_vehicle_service_statistics`
WHERE 1=1 WHERE 1=1
<if test="companyId!=null">
AND `company_id`=#{companyId}
</if>
<if test="startDate!=null and endDate!=null"> <if test="startDate!=null and endDate!=null">
AND `count_date` BETWEEN #{startDate} AND #{endDate} AND `count_date` BETWEEN #{startDate} AND #{endDate}
</if> </if>
......
import cn.hutool.core.date.DateUtil;
import com.xxfc.platform.order.OrderApplication; import com.xxfc.platform.order.OrderApplication;
import com.xxfc.platform.order.biz.DailyOrderStatisticsBiz; import com.xxfc.platform.order.biz.*;
import com.xxfc.platform.order.biz.OrderStatisticsBiz;
import com.xxfc.platform.order.jobhandler.BaseOrderStatisticsJobHandler; 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.order.pojo.HomePageOrderData;
import com.xxfc.platform.vehicle.feign.VehicleFeign;
import lombok.SneakyThrows; import lombok.SneakyThrows;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.junit.Test; import org.junit.Test;
...@@ -15,6 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; ...@@ -15,6 +16,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.Map;
/** /**
* @author libin * @author libin
...@@ -36,8 +38,17 @@ public class ServiceTest { ...@@ -36,8 +38,17 @@ public class ServiceTest {
private BaseOrderStatisticsJobHandler handler; private BaseOrderStatisticsJobHandler handler;
@Autowired @Autowired
private SaffStatisticsJobHandler statisticsJobHandler; private OrderMemberReceivedStatisticsBiz orderMemberReceivedStatisticsBiz;
@Autowired
private OrderRentVehicleReceivedStatisticsBiz orderRentVehicleReceivedStatisticsBiz;
@Autowired
private OrderReceivedStatisticsJobHandler orderReceivedStatisticsJobHandler;
@Autowired
private OrderTourReceivedStatisticsBiz orderTourReceivedStatisticsBiz;
@Autowired
private VehicleFeign vehicleFeign;
@Test @Test
public void testSchedu(){ public void testSchedu(){
...@@ -72,8 +83,8 @@ public class ServiceTest { ...@@ -72,8 +83,8 @@ public class ServiceTest {
@Test @Test
public void test4(){ public void test4(){
// HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null); HomePageOrderData totalOrder = statisticsBiz.getTotalOrder(null,null);
// System.out.println(totalOrder); System.out.println(totalOrder);
} }
...@@ -83,9 +94,35 @@ public class ServiceTest { ...@@ -83,9 +94,35 @@ public class ServiceTest {
} }
@Test @Test
@SneakyThrows public void testMemberStatistics(){
public void testStaffStatisticsJob(){ Date date = DateTime.parse("2019-11-15").toDate();
statisticsJobHandler.execute(""); 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("");
}
} }
...@@ -69,8 +69,10 @@ public interface ThirdFeign { ...@@ -69,8 +69,10 @@ public interface ThirdFeign {
@RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET) @RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> dictionaryGetAll4Map(); public ObjectRestResponse<Map<String, Dictionary>> dictionaryGetAll4Map();
@RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> getDictionaryUseType(); /* @RequestMapping(value = "/dictionary/getAll4Map", method = RequestMethod.GET)
public ObjectRestResponse<Map<String, Dictionary>> getDictionaryUseType();*/
@PostMapping("/dictionary/type_code") @PostMapping("/dictionary/type_code")
public Dictionary findDictionaryByTypeAndCode(@RequestParam(value = "type") String type,@RequestParam(value = "code") String code); public Dictionary findDictionaryByTypeAndCode(@RequestParam(value = "type") String type,@RequestParam(value = "code") String code);
......
...@@ -114,12 +114,12 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> { ...@@ -114,12 +114,12 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
return dictionaryMap; return dictionaryMap;
} }
public Map<String, Dictionary> getDictionaryUseType() { /* public Map<String, Dictionary> getDictionaryUseType() {
List<Dictionary> dictionaries = selectListAll(); List<Dictionary> dictionaries = selectListAll();
Map<String, Dictionary> dictionaryMap = dictionaries.parallelStream().collect(Collectors.toMap(dic -> dic.getType() + "_" + dic.getCode() Map<String, Dictionary> dictionaryMap = dictionaries.parallelStream().collect(Collectors.toMap(dic -> dic.getType() + "_" + dic.getCode()
, Function.identity(), (oldValue, newValue) -> newValue)); , Function.identity(), (oldValue, newValue) -> newValue));
return dictionaryMap; return dictionaryMap;
} }*/
@CacheClear(pre = CACHE_DICTIONARY_PREFIX) @CacheClear(pre = CACHE_DICTIONARY_PREFIX)
......
package com.xxfc.platform.universal.service; package com.xxfc.platform.universal.service;
import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.github.wxiaoqi.security.common.util.process.SystemConfig; import com.github.wxiaoqi.security.common.util.process.SystemConfig;
import com.xxfc.platform.universal.constant.RedisKey; import com.xxfc.platform.universal.constant.RedisKey;
import com.xxfc.platform.universal.utils.ImgBase64Util; import com.xxfc.platform.universal.utils.ImgBase64Util;
...@@ -56,7 +55,7 @@ public class UploadService { ...@@ -56,7 +55,7 @@ public class UploadService {
//文件存放路径 //文件存放路径
String filePath = baseUploadPath + realFileRelPath; 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; realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return realFileRelPath; return realFileRelPath;
} }
...@@ -84,7 +83,7 @@ public class UploadService { ...@@ -84,7 +83,7 @@ public class UploadService {
file.mkdirs(); file.mkdirs();
} }
String str="/" + no + ".jpg"; String str="/" + no + ".jpg";
realFileRelPath = realFileRelPath+str; realFileRelPath = realFileRelPath+str;
filePath=filePath +str; filePath=filePath +str;
//将文件写入指定位置 //将文件写入指定位置
......
...@@ -27,5 +27,9 @@ public class DepartureLogVo extends VehicleDepartureLog { ...@@ -27,5 +27,9 @@ public class DepartureLogVo extends VehicleDepartureLog {
*/ */
private Date actualEndDate; private Date actualEndDate;
/**
* 车牌号码
*/
private String numberPlate;
} }
...@@ -405,7 +405,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany ...@@ -405,7 +405,7 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return pageDataVO; return pageDataVO;
} }
public List<JSONObject> getList(){ public List<JSONObject> getList(){
return mapper.getList(); return mapper.getList();
} }
public ObjectRestResponse branchCompans() { public ObjectRestResponse branchCompans() {
......
...@@ -249,7 +249,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic ...@@ -249,7 +249,7 @@ public class VehicleBookRecordBiz extends BaseBiz<VehicleBookRecordMapper, Vehic
} }
if (vehicleBookRecordVo.getBookUser() != null) { if (vehicleBookRecordVo.getBookUser() != null) {
UserDTO userDTO = userFeign.userinfoByUid(vehicleBookRecordVo.getBookUser()).getData(); UserDTO userDTO = userFeign.userinfoByUid(vehicleBookRecordVo.getBookUser()).getData();
if(userDTO != null) { if (userDTO != null) {
BranchCompany branchCompany = branchCompanyBiz.getById(userDTO.getCompanyId()); BranchCompany branchCompany = branchCompanyBiz.getById(userDTO.getCompanyId());
if (branchCompany != null) { if (branchCompany != null) {
vehicleBookRecordVo.setUserCompanyName(branchCompany.getName()); vehicleBookRecordVo.setUserCompanyName(branchCompany.getName());
......
...@@ -24,7 +24,7 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo ...@@ -24,7 +24,7 @@ public interface VehicleDepartureLogMapper extends BaseMapper<VehicleDepartureLo
@Param("use") String user, @Param("use") String user,
@Param("startTime") String startTime, @Param("startTime") String startTime,
@Param("endTime") String endTime @Param("endTime") String endTime
); );
List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate, List<VehicleDepartureLogVo> selectVoAllNotAllData(@Param("numberPlate") String numberPlate,
@Param("code") Integer code, @Param("code") Integer code,
......
...@@ -201,7 +201,7 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> { ...@@ -201,7 +201,7 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
} }
@GetMapping("/findByAreaId") @GetMapping("/findByAreaId")
public List<Integer> findCompanyIdsByAreaId(@RequestParam(value = "areaId",required = false) Integer areaId){ public List<Integer> findCompanyIdsByAreaId(@RequestParam(value = "areaId") Integer areaId){
return baseBiz.selectCompanyIdsByAreaId(areaId); return baseBiz.selectCompanyIdsByAreaId(areaId);
} }
......
...@@ -9,6 +9,8 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse; ...@@ -9,6 +9,8 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import com.xxfc.platform.order.pojo.order.OrderPageVO; import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.universal.entity.Dictionary; import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.universal.feign.ThirdFeign; import com.xxfc.platform.universal.feign.ThirdFeign;
import com.xxfc.platform.order.pojo.order.OrderPageVO;
import com.xxfc.platform.universal.entity.Dictionary;
import com.xxfc.platform.vehicle.biz.VehicleBiz; import com.xxfc.platform.vehicle.biz.VehicleBiz;
import com.xxfc.platform.vehicle.biz.VehicleDepartureService; import com.xxfc.platform.vehicle.biz.VehicleDepartureService;
import com.xxfc.platform.vehicle.common.RestResponse; import com.xxfc.platform.vehicle.common.RestResponse;
...@@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.*; ...@@ -20,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map;
import static com.xxfc.platform.universal.constant.DictionaryKey.RESERVE; import static com.xxfc.platform.universal.constant.DictionaryKey.RESERVE;
import static com.xxfc.platform.universal.constant.DictionaryKey.VEHICE_ORDER; import static com.xxfc.platform.universal.constant.DictionaryKey.VEHICE_ORDER;
...@@ -166,7 +169,7 @@ public class VehicleDepartureController { ...@@ -166,7 +169,7 @@ public class VehicleDepartureController {
*/ */
@GetMapping("findReserveType") @GetMapping("findReserveType")
public ObjectRestResponse<OrderPageVO> getOrderDetail() { public ObjectRestResponse<OrderPageVO> getOrderDetail() {
Map<String, Dictionary> dictionaryMap = thirdFeign.getDictionaryUseType().getData(); Map<String, Dictionary> dictionaryMap = thirdFeign.dictionaryGetAll4Map().getData();
String reserveType = dictionaryMap.get(VEHICE_ORDER + "_" + RESERVE).getName(); String reserveType = dictionaryMap.get(VEHICE_ORDER + "_" + RESERVE).getName();
return ObjectRestResponse.succ(reserveType); return ObjectRestResponse.succ(reserveType);
} }
......
...@@ -88,21 +88,15 @@ ...@@ -88,21 +88,15 @@
<select id="selectVoAll" resultMap="searchBookRecord"> <select id="selectVoAll" resultMap="searchBookRecord">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date, select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date,
/* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/ /* IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天', IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - - unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName, as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage
as mileage
from vehicle_departure_log from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id 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 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 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"> <trim prefix="where">
1=1 1=1
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
...@@ -113,44 +107,32 @@ ...@@ -113,44 +107,32 @@
vehicle_departure_log.departure_time &gt;= str_to_date(#{startTime}, '%Y-%m-%d %H') vehicle_departure_log.departure_time &gt;= str_to_date(#{startTime}, '%Y-%m-%d %H')
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H') and vehicle_departure_log.arrival_time &gt;= str_to_date(#{endTime}, '%Y-%m-%d %H')
</if> </if>
<if test="code!=null"> <if test="code!=null">
and vehicle.code=#{code} and vehicle.code=#{code}
</if> </if>
<if test="zoneId!=null"> <if test="zoneId!=null">
and bc.zone_id=#{zoneId} and bc.zone_id=#{zoneId}
</if> </if>
<if test="departureId!=null"> <if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId} and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if> </if>
</trim> </trim>
order by create_time desc order by create_time desc
</select> </select>
<select id="selectVoAllNotAllData" resultMap="searchBookRecord"> <select id="selectVoAllNotAllData" resultType="com.xxfc.platform.vehicle.pojo.VehicleDepartureLogVo">
select vehicle_departure_log.*,vehicle.number_plate,bc2.actual_end_date,bc2.actual_start_date,bc2.book_start_date,bc2.book_end_date, select vehicle_departure_log.*,vehicle.number_plate,
/*IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/ /*IFNULL(DATEDIFF(vehicle_departure_log.arrival_time,vehicle_departure_log.departure_time),0)*/
CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - CONCAT(IFNULL(floor((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天',
unix_timestamp(vehicle_departure_log.departure_time)) / 86400),0),'天', IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
IFNULL(floor(IF((unix_timestamp(vehicle_departure_log.arrival_time) - - unix_timestamp(vehicle_departure_log.departure_time)) MOD 86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) - unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
unix_timestamp(vehicle_departure_log.departure_time))>86400,(unix_timestamp(vehicle_departure_log.arrival_time)
- unix_timestamp(vehicle_departure_log.departure_time)) MOD
86400/3600,(unix_timestamp(vehicle_departure_log.arrival_time) -
unix_timestamp(vehicle_departure_log.departure_time))/3600)),0),'小时')
as departureDay,bc.name as departureName,bc1.name as arrivalName, as departureDay,bc.name as departureName,bc1.name as arrivalName,
IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) IF((IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0))>0,IFNULL(vehicle_departure_log.mileage_end,0)-IFNULL(vehicle_departure_log.mileage_start,0),0) as mileage
as mileage
from vehicle_departure_log from vehicle_departure_log
left join vehicle on vehicle_departure_log.vehicle_id = vehicle.id 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 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 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" suffixOverrides="and"> <trim prefix="where" suffixOverrides="and">
<if test="numberPlate != null and numberPlate != ''"> <if test="numberPlate != null and numberPlate != ''">
vehicle.number_plate = #{numberPlate} and vehicle.number_plate = #{numberPlate} and
...@@ -180,24 +162,18 @@ ...@@ -180,24 +162,18 @@
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H') and vehicle_departure_log.arrival_time >= str_to_date(#{endTime}, '%Y-%m-%d %H')
or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{endTime}, '%Y-%m-%d %H')) or TO_DAYS(vehicle_departure_log.arrival_time)=TO_DAYS(str_to_date(#{endTime}, '%Y-%m-%d %H'))
or vehicle_departure_log.arrival_time is null or vehicle_departure_log.arrival_time is null
</if> </if>
<if test="code!=null"> <if test="code!=null">
and vehicle.code=#{code} and vehicle.code=#{code}
</if> </if>
<if test="zoneId!=null"> <if test="zoneId!=null">
and bc.zone_id=#{zoneId} and bc.zone_id=#{zoneId}
</if> </if>
<if test="departureId!=null"> <if test="departureId!=null">
and vehicle_departure_log.departure_branch_company_id=#{departureId} and vehicle_departure_log.departure_branch_company_id=#{departureId}
</if>
<if test="use!=null">
and bc2.book_type=#{use}
</if>
<if test="arrivalBranchCompanyId!=null">
and vehicle_departure_log.arrival_branch_company_id=#{arrivalBranchCompanyId}
</if> </if>
</trim> </trim>
order by create_time desc order by create_time desc
......
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