Commit f7319951 authored by libin's avatar libin

Merge branch 'order_received_statistics'

parents d1a327fd e0fb1200
......@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.vo.AppUserInfoVo;
import com.github.wxiaoqi.security.admin.vo.AppUserVo;
import com.github.wxiaoqi.security.common.biz.BaseBiz;
import com.github.wxiaoqi.security.common.vo.PageDataVO;
import com.xxfc.platform.im.utils.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.collections.CollectionUtils;
......@@ -192,4 +193,13 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
List<UserStaffBo> staffBos = mapper.findAllStaffsByCompanyIdAndPostionId(staffStatisticsFindDTO);
return CollectionUtils.isEmpty(staffBos)?Collections.EMPTY_LIST:staffBos;
}
public AppUserVo findByCode(String code) {
AppUserVo appUserVo = new AppUserVo();
AppUserDetail appUserDetail = new AppUserDetail();
appUserDetail.setCode(code);
appUserDetail = mapper.selectOne(appUserDetail);
org.springframework.beans.BeanUtils.copyProperties(appUserDetail,appUserVo);
return appUserVo;
}
}
......@@ -372,4 +372,10 @@ public class AppUserController extends CommonBaseController{
public List<UserStaffBo> findAllStaffs(){
return userDetailBiz.findAllStaffs();
}
@GetMapping("/app/unauth/code/{code}")
public ObjectRestResponse<AppUserVo> findAppuserInfoByCode(@PathVariable("code") String code){
AppUserVo appUserVo = userDetailBiz.findByCode(code);
return ObjectRestResponse.succ(appUserVo);
}
}
......@@ -137,7 +137,6 @@ public enum StatisticsStatusEnum {
feeTypeBo.setNoDeductibleAmount(feeTypeBo.getNoDeductibleAmount().add(dameSafeAmount));
}
//订单金额(不包含免赔和押金)
feeTypeBo.setTotalAmount(feeTypeBo.getTotalAmount().add(accountDetailEntity.getOrderAmount()).subtract(feeTypeBo.getNoDeductibleAmount()));
} else {
//退款订单押金
......@@ -154,7 +153,6 @@ public enum StatisticsStatusEnum {
feeTypeBo.setNoDeductibleRefundAmount(feeTypeBo.getNoDeductibleRefundAmount().add(dameSafeAmount));
}
}
//遍历消费明细
for (OrderAccountDeduction deduction : deductions) {
BigDecimal deductionAmount = deduction.getAmount();
......@@ -189,6 +187,12 @@ public enum StatisticsStatusEnum {
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;
}
......
......@@ -44,8 +44,16 @@ public class OrderMemberReceivedStatisticsBiz extends BaseBiz<OrderMemberReceive
* @param orderReceivedStatisticsFindDTO
* @return
*/
public List<OrderMemberReceivedStatistics> selectOrderReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderMemberReceivedStatistics(orderReceivedStatisticsFindDTO);
public List<OrderMemberReceivedStatistics> selectOrderReceivedStatisticsGroupByDate(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderMemberReceivedStatisticsGroupByDate(orderReceivedStatisticsFindDTO);
}
public List<OrderMemberReceivedStatistics> selectOrderReceivedStatisticsGroupByMonth(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderMemberReceivedStatisticsGroupByMonth(orderReceivedStatisticsFindDTO);
}
public List<OrderMemberReceivedStatistics> selectOrderReceivedStatisticsGroupByWeekOfYear(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderMemberReceivedStatisticsGroupByWeekOfYear(orderReceivedStatisticsFindDTO);
}
/**
......
......@@ -41,8 +41,16 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
* @param orderReceivedStatisticsFindDTO
* @return
*/
public List<OrderRentVehicleReceivedStatistics> selectOrderReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderRentVehicleReceivedStatistics(orderReceivedStatisticsFindDTO);
public List<OrderRentVehicleReceivedStatistics> selectOrderReceivedStatisticsGroupByDate(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderRentVehicleReceivedStatisticsGroupByDate(orderReceivedStatisticsFindDTO);
}
public List<OrderRentVehicleReceivedStatistics> selectOrderReceivedStatisticsGroupByMonth(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderRentVehicleReceivedStatisticsGroupByMonth(orderReceivedStatisticsFindDTO);
}
public List<OrderRentVehicleReceivedStatistics> selectOrderReceivedStatisticsGroupByWeekOfYear(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear(orderReceivedStatisticsFindDTO);
}
/**
......
......@@ -31,8 +31,14 @@ public class OrderTourReceivedStatisticsBiz extends BaseBiz<OrderTourReceivedSta
private final BaseOrderBiz baseOrderBiz;
private final OrderAccountBiz orderAccountBiz;
public List<OrderTourReceivedStatistics> selectOrderReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderTourReceivedStatistics(orderReceivedStatisticsFindDTO);
public List<OrderTourReceivedStatistics> selectOrderReceivedStatisticsGroupByDate(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderTourReceivedStatisticsGroupByDate(orderReceivedStatisticsFindDTO);
}
public List<OrderTourReceivedStatistics> selectOrderReceivedStatisticsGroupByMonth(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderTourReceivedStatisticsGroupByMonth(orderReceivedStatisticsFindDTO);
}
public List<OrderTourReceivedStatistics> selectOrderReceivedStatisticsGroupByWeekOfYear(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO) {
return mapper.selectOrderTourReceivedStatisticsGroupByWeekOfYear(orderReceivedStatisticsFindDTO);
}
/**
......
......@@ -17,7 +17,8 @@ import java.util.List;
*/
public interface OrderMemberReceivedStatisticsMapper extends Mapper<OrderMemberReceivedStatistics>, InsertListMapper<OrderMemberReceivedStatistics> {
List<OrderMemberReceivedStatistics> selectOrderMemberReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderMemberReceivedStatistics> selectOrderMemberReceivedStatisticsGroupByDate(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderMemberReceivedStatistics> selectOrderMemberReceivedStatisticsGroupByMonth(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderMemberReceivedStatistics> selectOrderMemberReceivedStatisticsGroupByWeekOfYear(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
void inserMemberReceivedtList(@Param("orderMembers") List<OrderMemberReceivedStatistics> orderMemberReceivedStatistics);
}
......@@ -18,7 +18,9 @@ import java.util.List;
*/
public interface OrderReceivedStatisticsMapper extends Mapper<OrderReceivedStatistics>, InsertListMapper<OrderReceivedStatistics> {
List<OrderReceivedStatistics> selectOrderReceivedStatisticsList(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderReceivedStatistics> selectOrderReceivedStatisticsDateList(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderReceivedStatistics> selectOrderReceivedStatisticsMonthList(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderReceivedStatistics> selectOrderReceivedStatisticsWeekOfYearList(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<CompanyPerformanceBo> selectCompanyPerformanceWithDay(CompanyPerformanceFindDTO companyPerformanceFindDTO);
......
......@@ -16,5 +16,7 @@ import java.util.List;
*/
public interface OrderRentVehicleReceivedStatisticsMapper extends Mapper<OrderRentVehicleReceivedStatistics>, InsertListMapper<OrderRentVehicleReceivedStatistics> {
List<OrderRentVehicleReceivedStatistics> selectOrderRentVehicleReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderRentVehicleReceivedStatistics> selectOrderRentVehicleReceivedStatisticsGroupByDate(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderRentVehicleReceivedStatistics> selectOrderRentVehicleReceivedStatisticsGroupByMonth(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderRentVehicleReceivedStatistics> selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
}
......@@ -16,5 +16,7 @@ import java.util.List;
*/
public interface OrderTourReceivedStatisticsMapper extends Mapper<OrderTourReceivedStatistics>, InsertListMapper<OrderTourReceivedStatistics> {
List<OrderTourReceivedStatistics> selectOrderTourReceivedStatistics(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderTourReceivedStatistics> selectOrderTourReceivedStatisticsGroupByDate(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderTourReceivedStatistics> selectOrderTourReceivedStatisticsGroupByMonth(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
List<OrderTourReceivedStatistics> selectOrderTourReceivedStatisticsGroupByWeekOfYear(OrderReceivedStatisticsFindDTO orderReceivedStatisticsFindDTO);
}
......@@ -29,10 +29,12 @@
<result property="crtTime" column="crt_time"/>
</resultMap>
<select id="selectOrderMemberReceivedStatistics" resultMap="orderMemberReceivedStatisticsMap">
select * from `order_member_received_statistics` where 1=1
<select id="selectOrderMemberReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `date`,`year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`,
IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0),
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null">
and `is_finish`=#{orderState}
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
......@@ -53,9 +55,67 @@
`date` <= #{endDate}
]]>
</if>
group by `year`, `date`
order by null
</select>
<delete id="inserMemberReceivedtList">
<select id="selectOrderMemberReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`,
IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0),
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `month`
order by null
</select>
</delete>
<select id="selectOrderMemberReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderMemberReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity`,IFNULL(sum(`toal_common_ammount`),0) as `toalCommonAmmount`
,IFNULL(sum(`total_common_quantity`),0) as `totalCommonQuantity`,IFNULL(sum(`total_gold_amount`),0) as `totalGoldAmount`,IFNULL(sum(`total_gold_quantity`),0),
IFNULL(sum(`total_diamond_ammount`),0) as `totalDiamondAmmount`,IFNULL(sum(`total_diamond_quantity`),0) as `totalDiamondQuantity` from `order_member_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `week_of_year`
order by null
</select>
</mapper>
\ No newline at end of file
......@@ -31,10 +31,10 @@
<result property="crtTime" column="crt_time"/>
</resultMap>
<select id="selectOrderReceivedStatisticsList" resultMap="orderReceivedStatisticsMap">
select * from `order_received_statistics` where 1=1
<select id="selectOrderReceivedStatisticsDateList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null">
and `is_finish`=#{orderState}
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
......@@ -56,6 +56,66 @@
`date` <= #{endDate}
]]>
</if>
group by `year`, `date`
order by null
</select>
<select id="selectOrderReceivedStatisticsMonthList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `month`
order by null
</select>
<select id="selectOrderReceivedStatisticsWeekOfYearList" resultType="com.xxfc.platform.order.entity.OrderReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `week_of_year`
order by null
</select>
<!--按日统计-->
......@@ -139,17 +199,17 @@
`count_date`
) AS `ovss` ON ovss.cyid = ors.companyId
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-->
</select>
<!--按月统计-->
<select id="selectCompanyPerformanceWithMonth"
resultType="com.xxfc.platform.order.bo.CompanyPerformanceBo">
SELECT
ors.*,
IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) as `arrivalNum`
ors.*,
IFNULL(ovss.departureNum,0) as `departureNum`,
IFNULL(ovss.rentDays,0) as `rentDays`,
IFNULL(ovss.arrivalNum,0) as `arrivalNum`
FROM
(
SELECT
......@@ -309,11 +369,11 @@
`count_week`
) AS `ovss` ON ovss.cyid = ors.companyId
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-->
</select>
<select id="selectCountByDate" resultType="int">
select count(*) from (SELECT `date` FROM `order_received_statistics` WHERE `has_pay`=1
select count(*) from (SELECT `date` FROM `order_received_statistics` WHERE `has_pay`=1
<if test="companyName!=null and companyName!=''">
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
......@@ -336,7 +396,7 @@
GROUP BY
company_id,
`year`,
`date`
`date`
) as `ds`
</select>
......
......@@ -18,10 +18,10 @@
<result property="companyId" column="company_id"/>
<result property="crtTime" column="crt_time"/>
</resultMap>
<select id="selectOrderRentVehicleReceivedStatistics" resultMap="orderRentVehicleReceivedStatisticsMap">
select * from `order_rent_vehicle_received_statistics` where 1=1
<select id="selectOrderRentVehicleReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null">
and `is_finish`=#{orderState}
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
......@@ -42,6 +42,63 @@
`date` <= #{endDate}
]]>
</if>
group by `year`, `date`
order by null
</select>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `month`
order by null
</select>
<select id="selectOrderRentVehicleReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_rent_vehicle_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `week_of_year`
order by null
</select>
</mapper>
\ No newline at end of file
......@@ -23,10 +23,10 @@
<result property="crtTime" column="crt_time"/>
</resultMap>
<select id="selectOrderTourReceivedStatistics" resultMap="orderTourReceivedStatisticsMap">
select * from `order_tour_received_statistics` where 1=1
<select id="selectOrderTourReceivedStatisticsGroupByDate" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`date`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null">
and `is_finish`=#{orderState}
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
......@@ -47,6 +47,63 @@
`date` <= #{endDate}
]]>
</if>
group by `year`, `date`
order by null
</select>
<select id="selectOrderTourReceivedStatisticsGroupByMonth" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`month`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `month`
order by null
</select>
<select id="selectOrderTourReceivedStatisticsGroupByWeekOfYear" resultType="com.xxfc.platform.order.entity.OrderTourReceivedStatistics">
select `year`,`week_of_year`,IFNULL(sum(`total_amount`),0) as `totalAmount`,IFNULL(sum(`total_quantity`),0) as `totalQuantity` from `order_tour_received_statistics` where 1=1
<if test="orderState!=null">
and `has_pay`=#{orderState}
</if>
<if test="orderOrigin!=null">
and `order_origin`=#{orderOrigin}
</if>
<if test="payWay!=null">
and `pay_way`=#{payWay}
</if>
<if test="startDate!=null and endDate!=null">
and `date` between #{startDate} and #{endDate}
</if>
<if test="startDate!=null and endDate==null">
and <![CDATA[
`date` >= #{startDate}
]]>
</if>
<if test="startDate==null and endDate!=null">
and <![CDATA[
`date` <= #{endDate}
]]>
</if>
group by `year`, `week_of_year`
order by null
</select>
</mapper>
\ No newline at end of file
......@@ -98,7 +98,7 @@ public class ServiceTest {
@Test
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 endDate = DateUtil.endOfDay(date).toJdkDate();
Map<Integer, String> companyMap = vehicleFeign.findCompanyMap();
......@@ -128,15 +128,14 @@ public class ServiceTest {
public void testOrderReceivedStatisticsJobHandler(){
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);
orderReceivedStatisticsJobHandler.execute("2019-11-29");
/* LocalDate startLocalDate = LocalDate.of(2019, 10, 1);
LocalDate endLocalDate = LocalDate.of(2019,11,29);
/* orderReceivedStatisticsJobHandler.execute("2019-11-29");*/
LocalDate startLocalDate = LocalDate.of(2019, 10, 1);
LocalDate endLocalDate = LocalDate.of(2019,11,30);
while (startLocalDate.isBefore(endLocalDate)){
String dateStr = startLocalDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
startLocalDate = startLocalDate.plusDays(1);
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