Commit b9037719 authored by jiaorz's avatar jiaorz

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

parents 5fea7a15 38d67a07
...@@ -153,7 +153,6 @@ public enum StatisticsStatusEnum { ...@@ -153,7 +153,6 @@ public enum StatisticsStatusEnum {
feeTypeBo.setNoDeductibleRefundAmount(feeTypeBo.getNoDeductibleRefundAmount().add(dameSafeAmount)); feeTypeBo.setNoDeductibleRefundAmount(feeTypeBo.getNoDeductibleRefundAmount().add(dameSafeAmount));
} }
} }
//遍历消费明细 //遍历消费明细
for (OrderAccountDeduction deduction : deductions) { for (OrderAccountDeduction deduction : deductions) {
BigDecimal deductionAmount = deduction.getAmount(); BigDecimal deductionAmount = deduction.getAmount();
...@@ -188,6 +187,12 @@ public enum StatisticsStatusEnum { ...@@ -188,6 +187,12 @@ public enum StatisticsStatusEnum {
feeTypeBo.setOrderRefundAmount(feeTypeBo.getOrderRefundAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleRefundAmount())); feeTypeBo.setOrderRefundAmount(feeTypeBo.getOrderRefundAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleRefundAmount()));
} }
} }
/* //订单支付金额(不包含免赔,押金)减去退款的金额
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().subtract(feeTypeBo.getOrderRefundAmount()));
//订单押金减去退款押金
feeTypeBo.setDepositAmount(feeTypeBo.getDepositAmount().subtract(feeTypeBo.getDepositRefundAmount()));
//订单免赔金额减去退款的免赔金额
feeTypeBo.setNoDeductibleAmount(feeTypeBo.getNoDeductibleAmount().subtract(feeTypeBo.getDepositRefundAmount()));*/
return feeTypeBo; return feeTypeBo;
} }
......
...@@ -41,7 +41,7 @@ public class OrderDTO { ...@@ -41,7 +41,7 @@ public class OrderDTO {
/** /**
* 费用其他明细 租车使用 * 费用其他明细 租车使用
*/ */
protected String costDetailExtend; protected String costDetail;
/** /**
* 会员相关 * 会员相关
*/ */
...@@ -55,6 +55,6 @@ public class OrderDTO { ...@@ -55,6 +55,6 @@ public class OrderDTO {
} }
public JSONObject getData() { public JSONObject getData() {
return StringUtils.hasText(costDetailExtend)?JSONUtil.parseObj(costDetailExtend):new JSONObject(); return StringUtils.hasText(costDetail)?JSONUtil.parseObj(costDetail):new JSONObject();
} }
} }
...@@ -44,6 +44,8 @@ public class CompanyPerformanceBiz { ...@@ -44,6 +44,8 @@ public class CompanyPerformanceBiz {
* @param outputStream * @param outputStream
*/ */
public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) throws IOException { public void exportOrderReceivedStatisticsData(CompanyPerformanceFindDTO companyPerformanceFindDTO, ServletOutputStream outputStream) throws IOException {
companyPerformanceFindDTO.setPage(null);
companyPerformanceFindDTO.setLimit(null);
//1.查询数据 //1.查询数据
List<CompanyPerformanceBo> companyPerformanceBos = selectCompanyPerformances(companyPerformanceFindDTO); List<CompanyPerformanceBo> companyPerformanceBos = selectCompanyPerformances(companyPerformanceFindDTO);
......
...@@ -14,6 +14,7 @@ import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO; ...@@ -14,6 +14,7 @@ import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO; import com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO;
import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo; import com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
...@@ -37,6 +38,7 @@ import java.util.stream.Collectors; ...@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
* @email 18178966185@163.com * @email 18178966185@163.com
* @date 2019-11-08 18:03:42 * @date 2019-11-08 18:03:42
*/ */
@Slf4j
@Service @Service
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@RequiredArgsConstructor(onConstructor = @__(@Autowired)) @RequiredArgsConstructor(onConstructor = @__(@Autowired))
...@@ -263,6 +265,7 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -263,6 +265,7 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
OrderReceivedStatistics orderReceivedStatistics = new OrderReceivedStatistics(); OrderReceivedStatistics orderReceivedStatistics = new OrderReceivedStatistics();
Set<Map.Entry<String, List<OrderRentVehicleReceivedStatistics>>> rentVehicleSet = rentVehicleMap.entrySet(); Set<Map.Entry<String, List<OrderRentVehicleReceivedStatistics>>> rentVehicleSet = rentVehicleMap.entrySet();
for (Map.Entry<String, List<OrderRentVehicleReceivedStatistics>> rentVehicleEntry : rentVehicleSet) { for (Map.Entry<String, List<OrderRentVehicleReceivedStatistics>> rentVehicleEntry : rentVehicleSet) {
try {
String stateGroup = rentVehicleEntry.getKey(); String stateGroup = rentVehicleEntry.getKey();
List<OrderRentVehicleReceivedStatistics> rentVehicleEntryValue = rentVehicleEntry.getValue(); List<OrderRentVehicleReceivedStatistics> rentVehicleEntryValue = rentVehicleEntry.getValue();
//创建默认的订单统计对象并设置默认值 //创建默认的订单统计对象并设置默认值
...@@ -322,7 +325,9 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM ...@@ -322,7 +325,9 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
orderReceivedStatisticsClone.setOrderRefundAmount(totalRefundAmount); orderReceivedStatisticsClone.setOrderRefundAmount(totalRefundAmount);
orderReceivedStatisticsClone.setTotalQuantity(totalQuantity); orderReceivedStatisticsClone.setTotalQuantity(totalQuantity);
orderReceivedStatisticsList.add(orderReceivedStatisticsClone); orderReceivedStatisticsList.add(orderReceivedStatisticsClone);
}catch (Exception ex){
log.error("当前状态组合【{}】===日期【{}】",rentVehicleEntry.getKey(),rentVehicleEntry.getValue().get(0).getDate());
}
} }
//保存 //保存
StatisticsStatusEnum.insertReceivedStatisticsBatch(orderReceivedStatisticsList, mapper); StatisticsStatusEnum.insertReceivedStatisticsBatch(orderReceivedStatisticsList, mapper);
......
...@@ -441,7 +441,7 @@ ...@@ -441,7 +441,7 @@
<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_position_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`, 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` orvd.deposit,orvd.cost_detail AS `costDetail`
from (select * from `base_order` where 1=1 from (select * from `base_order` where 1=1
<if test="hasPay!=null"> <if test="hasPay!=null">
and `has_pay`=#{hasPay} and `has_pay`=#{hasPay}
...@@ -452,7 +452,7 @@ ...@@ -452,7 +452,7 @@
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` from `order_rent_vehicle_detail`) AS `orvd` ON
orvd.order_id=bo.id orvd.order_id=bo.id
LEFT JOIN (select `order_id`,`start_company_id` from `order_tour_detail`) AS `otd` ON otd.order_id=bo.id LEFT JOIN (select `order_id`,`start_company_id` from `order_tour_detail`) AS `otd` ON otd.order_id=bo.id
LEFT JOIN (select `order_id`,`member_level` AS `memberLevel` from `order_member_detail`) AS `omd` ON LEFT JOIN (select `order_id`,`member_level` AS `memberLevel` from `order_member_detail`) AS `omd` ON
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
bo.pay_way, bo.pay_way,
bo.has_pay, bo.has_pay,
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 AS `costDetail`,
brvd.damage_safe AS `damageSafe`, brvd.damage_safe AS `damageSafe`,
omd.member_level AS `memberLevel` omd.member_level AS `memberLevel`
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
SELECT SELECT
ors.*, ors.*,
IFNULL(ovss.departureNum,0) as `departureNum`, IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0) as `departureNum`, IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) as `arrivalNum` IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM FROM
( (
...@@ -103,7 +103,9 @@ ...@@ -103,7 +103,9 @@
`company_id` , `company_id` ,
`year`, `year`,
`date` `date`
<if test="page!=null and limit!=null">
limit #{startIndex},#{endInex} limit #{startIndex},#{endInex}
</if>
) AS `ors` ) AS `ors`
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -135,7 +137,6 @@ ...@@ -135,7 +137,6 @@
`company_id`, `company_id`,
`count_year`, `count_year`,
`count_date` `count_date`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId ) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_date = ors.date AND ovss.count_date = ors.date
<!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc--> <!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
...@@ -187,7 +188,9 @@ ...@@ -187,7 +188,9 @@
company_id, company_id,
`year`, `year`,
`month` `month`
<if test="page!=null and limit!=null">
limit #{startIndex},#{endInex} limit #{startIndex},#{endInex}
</if>
) AS `ors` ) AS `ors`
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -219,7 +222,6 @@ ...@@ -219,7 +222,6 @@
`company_id`, `company_id`,
`count_year`, `count_year`,
`count_month` `count_month`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId ) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_month = ors.month AND ovss.count_month = ors.month
<!--order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc--> <!--order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
...@@ -270,7 +272,9 @@ ...@@ -270,7 +272,9 @@
company_id, company_id,
`year`, `year`,
`week_of_year` `week_of_year`
<if test="page!=null and limit!=null">
limit #{startIndex},#{endInex} limit #{startIndex},#{endInex}
</if>
) AS `ors` ) AS `ors`
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
...@@ -303,7 +307,6 @@ ...@@ -303,7 +307,6 @@
`company_id`, `company_id`,
`count_year`, `count_year`,
`count_week` `count_week`
limit #{startIndex},#{endInex}
) AS `ovss` ON ovss.cyid = ors.companyId ) AS `ovss` ON ovss.cyid = ors.companyId
AND ovss.count_week = ors.weekOfYear AND ovss.count_week = ors.weekOfYear
<!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc--> <!-- order by ors.rentVehilceAmount desc,ors.memberAmount desc,ors.travelAmount desc,ors.depositAmount desc,ors.noDeductibleAmount desc ,rentDays desc,departureNum desc, arrivalNum desc-->
......
...@@ -98,7 +98,7 @@ public class ServiceTest { ...@@ -98,7 +98,7 @@ public class ServiceTest {
@Test @Test
public void testMemberStatistics(){ public void testMemberStatistics(){
Date date = DateTime.parse("2019-11-15").toDate(); Date date = DateTime.parse("2019-11-28").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate(); Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate(); Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -107,7 +107,7 @@ public class ServiceTest { ...@@ -107,7 +107,7 @@ public class ServiceTest {
@Test @Test
public void testRentVehicleStatistics(){ public void testRentVehicleStatistics(){
Date date = DateTime.parse("2019-11-15").toDate(); Date date = DateTime.parse("2019-11-29").toDate();
Date startDate = DateUtil.beginOfDay(date).toJdkDate(); Date startDate = DateUtil.beginOfDay(date).toJdkDate();
Date endDate = DateUtil.endOfDay(date).toJdkDate(); Date endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap(); Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
...@@ -126,17 +126,16 @@ public class ServiceTest { ...@@ -126,17 +126,16 @@ public class ServiceTest {
@Test @Test
@SneakyThrows @SneakyThrows
public void testOrderReceivedStatisticsJobHandler(){ public void testOrderReceivedStatisticsJobHandler(){
cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-10-01", "yyyy-MM-dd"); cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd");
cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1); // cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
orderReceivedStatisticsJobHandler.execute("2019-11-29");
LocalDate startLocalDate = LocalDate.of(2019, 10, 1); /* LocalDate startLocalDate = LocalDate.of(2019, 10, 1);
LocalDate endLocalDate = LocalDate.of(2019,11,29); LocalDate endLocalDate = LocalDate.of(2019,11,29);
while (startLocalDate.isBefore(endLocalDate)){ while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1); startLocalDate = startLocalDate.plusDays(1);
orderReceivedStatisticsJobHandler.execute(dateStr); orderReceivedStatisticsJobHandler.execute(dateStr);
} }*/
} }
} }
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