Commit c3a5dbaf authored by libin's avatar libin

公司业绩统计

parent 208f09f8
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;
......
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,26 @@ public class OrderReceivedStatistics extends OrderReceivedStatisticsBase impleme
@ApiModelProperty("会员费")
private BigDecimal memberAmount;
@Column(name = "member_quantity")
@ApiModelProperty("会员订单量")
private Integer memberQuantity;
@Column(name = "travel_amount")
@ApiModelProperty("旅游费")
private BigDecimal travelAmount;
@Column(name = "travel_quantity")
@ApiModelProperty("旅游订单量")
private Integer travelQuantity;
@Column(name = "rent_vehicle_amount")
@ApiModelProperty("租车费")
private BigDecimal rentVehicleAmount;
@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;
}
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.ServletOutputStream;
import java.time.LocalDate;
import java.util.Calendar;
import java.util.Date;
......@@ -33,6 +34,17 @@ public class CompanyPerformanceBiz {
private final OrderReceivedStatisticsBiz orderReceivedStatisticsBiz;
private final VehicleFeign vehicleFeign;
/**
* 导出数据
* @param companyPerformanceFindDTO
* @param outputStream
*/
public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) {
//1.查询数据
PageDataVO<CompanyPerformanceBo> pageDataVO = selectCompanyPerformancePage(companyPerformanceFindDTO);
List<CompanyPerformanceBo> data = pageDataVO.getData();
}
public PageDataVO<CompanyPerformanceBo> selectCompanyPerformancePage(CompanyPerformanceFindDTO companyPerformanceFindDTO) {
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
......@@ -73,4 +85,5 @@ public class CompanyPerformanceBiz {
}
return pageDataVO;
}
}
......@@ -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,55 @@ 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.setMemberAmount(orderMember.getTotalAmount());
//租车订单总额
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();
//合计订单总额
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 +295,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);
}
/**
......
......@@ -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);
//会员订单
......
......@@ -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("导出数据失败");
}
}
}
......@@ -354,9 +354,9 @@
</select>
<select id="selectOrdersByTypeAndTime" resultType="com.xxfc.platform.order.pojo.dto.OrderDTO">
select bo.*,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
select bo.*,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),bo.`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`
`pay_way` AS `payWay`,`parent_user_company_id`
from `base_order` where (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN <foreach collection="types"
item="type"
open="(" close=")"
......
......@@ -62,7 +62,7 @@
bo.order_origin,
bo.pay_way,
bo.has_pay,
brvd.start_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.damage_safe AS `damageSafe`,
omd.member_level AS `memberLevel`
......@@ -71,7 +71,8 @@
`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 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>
</mapper>
\ No newline at end of file
......@@ -62,9 +62,9 @@
<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
......@@ -75,12 +75,13 @@
SUM(`travel_amount` ) AS `travelAmount`,
SUM(`rent_vehicle_amount` ) AS `rentVehilceAmount`
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 +110,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,9 +141,9 @@
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
......@@ -151,12 +154,13 @@
COALESCE(SUM(`travel_amount` ),0) AS `travelAmount`,
COALESCE(SUM(`rent_vehicle_amount` ),0) AS `rentVehilceAmount`
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 +189,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,9 +219,9 @@
<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
......@@ -226,12 +232,13 @@
COALESCE(SUM(`travel_amount` ),0) AS `travelAmount`,
COALESCE(SUM(`rent_vehicle_amount` ),0) AS `rentVehilceAmount`
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 +269,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.OrderMemberReceivedStatisticsBiz;
import com.xxfc.platform.order.biz.OrderRentVehicleReceivedStatisticsBiz;
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.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;
import org.junit.runner.RunWith;
......@@ -17,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
......@@ -46,6 +46,8 @@ public class ServiceTest {
@Autowired
private OrderReceivedStatisticsJobHandler orderReceivedStatisticsJobHandler;
@Autowired
private OrderTourReceivedStatisticsBiz orderTourReceivedStatisticsBiz;
@Autowired
private VehicleFeign vehicleFeign;
@Test
public void testSchedu(){
......@@ -91,5 +93,36 @@ public class ServiceTest {
handler.execute("2019-09-29");
}
@Test
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("");
}
}
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