统计篮球订单收益

This commit is contained in:
2024-01-30 20:50:43 +08:00
parent 6736a5c861
commit 73e1431f8f
4 changed files with 60 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ import com.sv.dto.api.MemberEnterOrderDTO;
import com.sv.entity.BarcodeOrderTime;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@@ -40,4 +41,6 @@ public interface BarcodeOrderTimeMapper {
MemberEnterOrderDTO memberOrderEnterDetail(@Param("memberId") Integer memberId,@Param("enterId") Integer enterId);
@NoPlatform
List<MemberEnterOrderDTO> findAll(@Param("starTime") String starTime,@Param("endTime") String endTime,@Param("orderSn") String orderSn,@Param("state") Integer state);
@NoPlatform
BigDecimal orderPageSum(@Param("starTime") String starTime,@Param("endTime") String endTime,@Param("orderSn") String orderSn,@Param("state") Integer state);
}

View File

@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
/**
* Service - 篮球进场订单
@@ -126,5 +127,22 @@ public class MemberEnterVenueLogService extends BaseServiceImpl {
return pagination;
}
/**
* 统计篮球订单
*
* @return 汇总收益金额
*/
public BigDecimal orderPageSum(String starTime,
String endTime, String orderSn, Integer state) {
BigDecimal result = BigDecimal.ZERO;
BigDecimal orderPageSum = barcodeOrderTimeMapper.orderPageSum(starTime,
endTime, orderSn, state);
if (orderPageSum != null) {
result = orderPageSum;
}
return result;
}
}

View File

@@ -336,4 +336,31 @@
order by t.order_start desc
</select>
<select id="orderPageSum" resultType="java.math.BigDecimal">
select
sum((select IFNULL(sum(ot.price),0) from sv_order ot
where ot.member_id = t.member_id and (ot.order_sn = t.order_sn or ot.order_sn = t.order_add_sn)
) - IFNULL(t.sum_pay_money,0)) orderSumMoney
from sv_barcode_order_time t
where 1=1
<if test="state != null and state == 2">
AND (t.status = 1 or t.paying = #{state})
</if>
<if test="state != null and state == 1">
AND t.paying = #{state}
</if>
<if test="state != null and state == 0">
AND t.paying = #{state} and t.status = 0
</if>
<if test="orderSn != ''">
AND t.order_sn = #{orderSn}
</if>
<if test="starTime != ''">
AND t.order_start &gt;= #{starTime}
</if>
<if test="endTime != ''">
AND t.order_start &lt;= #{endTime}
</if>
</select>
</mapper>