修改C端数据维度,订单时间最多查询半年
This commit is contained in:
parent
92bf282038
commit
34418b0749
@ -181,7 +181,7 @@ public interface XhpcStatisticsServiceMapper {
|
|||||||
* @param type 1 平台 2 运营商 3流量方
|
* @param type 1 平台 2 运营商 3流量方
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("tenantId")Long sysUserId,@Param("tenantId")Integer number);
|
List<Map<String,Object>> getSumSourceList(@Param("startTime")String startTime, @Param("endTime")String endTime,@Param("sourceIds")List<String> sourceIds, @Param("userId")Long userId, @Param("type")Integer type,@Param("chargingStationIdList")List<String> chargingStationIdList,@Param("tenantId")String tenantId,@Param("tenantId")Long sysUserId,@Param("number")Integer number);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取登陆用户信息
|
* 获取登陆用户信息
|
||||||
|
|||||||
@ -149,5 +149,5 @@ public interface XhpcUserMapper {
|
|||||||
|
|
||||||
public int getOrderTimeNumber(@Param("userId")String userId,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("tenantId")String tenantId);
|
public int getOrderTimeNumber(@Param("userId")String userId,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
List<Map<String,Object>> getUserDimension(@Param("number")Integer number,@Param("userId")String userId,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("tenantId")String tenantId,@Param("activity")Integer activity,@Param("frequency")Integer frequency,@Param("amount") BigDecimal amount,@Param("phone")String phone);
|
List<Map<String,Object>> getUserDimension(@Param("userId")String userId,@Param("startTime")String startTime,@Param("endTime")String endTime,@Param("tenantId")String tenantId,@Param("activity")Integer activity,@Param("frequency")Integer frequency,@Param("amount") BigDecimal amount,@Param("phone")String phone);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -231,9 +231,9 @@ public class XhpcUserServiceImpl extends BaseService implements IXhpcUserService
|
|||||||
String tenantId = loginUser.getTenantId();
|
String tenantId = loginUser.getTenantId();
|
||||||
|
|
||||||
//时间范围内的所有订单总数
|
//时间范围内的所有订单总数
|
||||||
int orderTimeNumber = xhpcUserMapper.getOrderTimeNumber(null, startTime, endTime, tenantId);
|
// int orderTimeNumber = xhpcUserMapper.getOrderTimeNumber(null, startTime, endTime, tenantId);
|
||||||
startPage();
|
startPage();
|
||||||
List<Map<String, Object>> userDimension = xhpcUserMapper.getUserDimension(orderTimeNumber, null, startTime, endTime, tenantId,activity,frequency,amount,phone);
|
List<Map<String, Object>> userDimension = xhpcUserMapper.getUserDimension(null, startTime, endTime, tenantId,activity,frequency,amount,phone);
|
||||||
|
|
||||||
return userDimension;
|
return userDimension;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -326,36 +326,22 @@
|
|||||||
|
|
||||||
<select id="getUserDimension" resultType="map">
|
<select id="getUserDimension" resultType="map">
|
||||||
SELECT
|
SELECT
|
||||||
us.number number,
|
count(xho.history_order_id) number,
|
||||||
us.totalPrice totalPrice,
|
IFNULL(SUM(xho.total_price),0) totalPrice,
|
||||||
us.activity activity,
|
xaus.app_user_id appUserId,
|
||||||
us.appUserId appUserId,
|
xaus.phone phone
|
||||||
us.phone phone
|
from xhpc_app_user AS xaus
|
||||||
from xhpc_app_user AS xaus
|
LEFT JOIN xhpc_history_order xho on xaus.app_user_id = xho.user_id and xho.source = 0 and xho.tenant_id =#{tenantId}
|
||||||
JOIN (
|
WHERE
|
||||||
SELECT
|
xaus.del_flag = 0 and YEAR(xho.end_time)=YEAR(NOW())
|
||||||
count(xho.history_order_id) number,
|
<if test="startTime !=null and startTime !=''">
|
||||||
IFNULL(SUM(xho.total_price),0) totalPrice,
|
and xho.end_time >=#{startTime}
|
||||||
IFNULL(TRUNCATE((count(xho.history_order_id)/#{number})*100,0),0) activity,
|
</if>
|
||||||
xau.app_user_id appUserId,
|
<if test="endTime !=null and endTime !=''">
|
||||||
xau.phone phone
|
and xho.end_time <= #{endTime}
|
||||||
from xhpc_app_user as xau
|
</if>
|
||||||
LEFT JOIN xhpc_history_order xho on xau.app_user_id = xho.user_id and xho.source = 0 and xho.tenant_id =#{tenantId}
|
<if test="phone !=null and phone !=''">
|
||||||
where xau.del_flag =0
|
and xau.phone like concat('%', #{phone}, '%')
|
||||||
<if test="startTime !=null and startTime !=''">
|
|
||||||
and xho.end_time >=#{startTime}
|
|
||||||
</if>
|
|
||||||
<if test="endTime !=null and endTime !=''">
|
|
||||||
and xho.end_time <= #{endTime}
|
|
||||||
</if>
|
|
||||||
<if test="phone !=null and phone !=''">
|
|
||||||
and xau.phone like concat('%', #{phone}, '%')
|
|
||||||
</if>
|
|
||||||
GROUP BY xau.app_user_id
|
|
||||||
order by totalPrice desc) us on xaus.app_user_id = us.appUserId
|
|
||||||
where xaus.del_flag = 0
|
|
||||||
<if test="activity !=null">
|
|
||||||
and us.activity >= #{activity}
|
|
||||||
</if>
|
</if>
|
||||||
<if test="frequency !=null">
|
<if test="frequency !=null">
|
||||||
and us.number >= #{frequency}
|
and us.number >= #{frequency}
|
||||||
@ -370,8 +356,7 @@
|
|||||||
and xaus.user_id = #{userId}
|
and xaus.user_id = #{userId}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY xaus.app_user_id
|
GROUP BY xaus.app_user_id
|
||||||
order by totalPrice desc,number desc,activity desc
|
order by totalPrice desc,number desc
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user