优化机构统计中心
This commit is contained in:
parent
f9309a9b6f
commit
ddd4696f5b
@ -361,11 +361,17 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
if(xhpcChargeOrder.getStartTime() ==null || xhpcChargeOrder.getEndTime()==null){
|
||||
//获取实时数据
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("order:"+xhpcChargeOrder.getSerialNumber());
|
||||
if(cacheMap !=null && cacheMap.get("realtimeDataList") !=null){
|
||||
List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
|
||||
if(list !=null && list.size()>0){
|
||||
xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
if(cacheMap !=null){
|
||||
if(cacheMap.get("realtimeDataList") !=null){
|
||||
List<CacheRealtimeData> list = (List<CacheRealtimeData>) cacheMap.get("realtimeDataList");
|
||||
if(list !=null && list.size()>0){
|
||||
xhpcChargeOrder.setEndTime(DateUtil.parse(list.get(list.size()-1).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcChargeOrder.setStartTime(DateUtil.parse(list.get(0).getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}else{
|
||||
if(cacheMap.get("startTime") !=null) {
|
||||
xhpcChargeOrder.setEndTime(DateUtil.parse(cacheMap.get("startTime").toString(), "yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,6 +27,16 @@ public interface XhpcCommonMapper {
|
||||
*/
|
||||
Map<String, Object> getCustomersUser(@Param("phone") String phone,@Param("userId")Long userId,@Param("serialNumber")String serialNumber,@Param("tenantId") String tenantId);
|
||||
|
||||
List<Map<String, Object>> getCommunityPersonnel(@Param("terminalId")Long terminalId,@Param("operatorId")Long operatorId,@Param("chargingStationId") Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("type")Integer type, @Param("name")String name , @Param("phone")String phone, @Param("account")String account,@Param("number") Integer number,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("startTime")String startTime,@Param("endTime")String endTime);
|
||||
|
||||
|
||||
List<Map<String, Object>> getCustomersPersonnel(@Param("terminalId")Long terminalId,@Param("operatorId")Long operatorId,@Param("chargingStationId") Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("type")Integer type, @Param("name")String name , @Param("phone")String phone, @Param("account")String account,@Param("number") Integer number,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("startTime")String startTime,@Param("endTime")String endTime);
|
||||
|
||||
|
||||
List<Map<String, Object>> getPersonnelStatistics(@Param("terminalId")Long terminalId,@Param("operatorId")Long operatorId,@Param("chargingStationId") Long chargingStationId, @Param("chargingPileId")Long chargingPileId, @Param("type")Integer type, @Param("name")String name , @Param("phone")String phone, @Param("account")String account,@Param("number") Integer number,@Param("userId") Long userId,@Param("tenantId")String tenantId,@Param("startTime")String startTime,@Param("endTime")String endTime);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -139,14 +139,32 @@ public class XhpcCommonServiceImpl extends BaseService implements IXhpcCommonSer
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
list = xhpcCommonMapper.getPersonnelStatistics(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 1,logOperatorId,tenantId,startTime,endTime);
|
||||
if(type==null){
|
||||
list = xhpcCommonMapper.getPersonnelStatistics(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 1,logOperatorId,tenantId,startTime,endTime);
|
||||
}else if(type==1){
|
||||
list = xhpcCommonMapper.getCommunityPersonnel(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 1,logOperatorId,tenantId,startTime,endTime);
|
||||
}else{
|
||||
list = xhpcCommonMapper.getCustomersPersonnel(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 1,logOperatorId,tenantId,startTime,endTime);
|
||||
}
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
list = xhpcCommonMapper.getPersonnelStatistics(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 2,sysUserId,tenantId,startTime,endTime);
|
||||
if(type==null){
|
||||
list = xhpcCommonMapper.getPersonnelStatistics(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 2,sysUserId,tenantId,startTime,endTime);
|
||||
}else if(type==1){
|
||||
list = xhpcCommonMapper.getCommunityPersonnel(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 2,sysUserId,tenantId,startTime,endTime);
|
||||
}else{
|
||||
list = xhpcCommonMapper.getCustomersPersonnel(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 2,sysUserId,tenantId,startTime,endTime);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcCommonMapper.getPersonnelStatistics(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 0,sysUserId,tenantId,startTime,endTime);
|
||||
if(type==null){
|
||||
list =xhpcCommonMapper.getPersonnelStatistics(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 0,sysUserId,tenantId,startTime,endTime);
|
||||
}else if(type==1){
|
||||
list =xhpcCommonMapper.getCommunityPersonnel(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 0,sysUserId,tenantId,startTime,endTime);
|
||||
}else{
|
||||
list =xhpcCommonMapper.getCustomersPersonnel(terminalId,operatorId, chargingStationId, chargingPileId, type, name,phone,account, 0,sysUserId,tenantId,startTime,endTime);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -120,7 +120,6 @@
|
||||
</select>
|
||||
|
||||
<select id="getPersonnelStatistics" resultType="map">
|
||||
<if test="type !=null and type==1">
|
||||
select
|
||||
concat("社区用户") as mechanismName,
|
||||
xcp.account as account,
|
||||
@ -131,107 +130,12 @@
|
||||
IFNULL(sum(xho.total_price),0) totalPrice,
|
||||
IFNULL(sum(xho.promotion_discount),0) promotionDiscount
|
||||
from xhpc_community_personnel as xcp
|
||||
join xhpc_community xc on xc.community_id = xcp.community_id and xc.del_flag =0
|
||||
left join xhpc_community xc on xc.community_id = xcp.community_id and xc.del_flag =0
|
||||
left join xhpc_history_order xho on xho.source =2 and xho.user_id =xcp.community_personnel_id
|
||||
where xcp.tenant_id=#{tenantId} and xcp.del_flag=0
|
||||
<if test="number==1 or number==2">
|
||||
and xcp.create_type=2 and xcp.create_id=#{userId}
|
||||
where xcp.del_flag=0
|
||||
<if test="tenantId !=null and tenantId!=''">
|
||||
and xcp.tenant_id=#{tenantId}
|
||||
</if>
|
||||
<if test="type==1">
|
||||
and xcp.create_type=2 and xcp.create_id=#{userId}
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and xcp.create_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
</if>
|
||||
<if test="operatorId !=null">
|
||||
and xcp.create_id=#{operatorId}
|
||||
</if>
|
||||
<if test="terminalId !=null">
|
||||
and xho.terminal_id=#{terminalId}
|
||||
</if>
|
||||
<if test="chargingPileId !=null">
|
||||
and xcp.create_id=(select operator_id from xhpc_charging_station where charging_station_id=(select terminal_id from xhpc_charging_pile where charging_pile_id=#{chargingPileId}))
|
||||
</if>
|
||||
<if test="name !=null and name !=''">
|
||||
and xcp.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="account !=null and account !=''">
|
||||
and xcp.account like concat('%',#{account},'%')
|
||||
</if>
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xcp.phone like concat('%',#{phone},'%')
|
||||
</if>
|
||||
<if test="startTime !=null and '' !=startTime">
|
||||
and xho.end_time >=#{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and '' !=endTime">
|
||||
and xho.end_time <=#{endTime}
|
||||
</if>
|
||||
GROUP BY xcp.account
|
||||
</if>
|
||||
<if test="type !=null and type==2">
|
||||
select
|
||||
concat("B端用户") as mechanismName,
|
||||
xcup.account as account,
|
||||
xcup.name as name,
|
||||
xcup.phone as phone,
|
||||
count(xho.history_order_id) number,
|
||||
IFNULL(sum(xho.total_power),0) totalPower,
|
||||
IFNULL(sum(xho.total_price),0) totalPrice,
|
||||
IFNULL(sum(xho.promotion_discount),0) promotionDiscount
|
||||
from xhpc_customers_personnel as xcup
|
||||
join xhpc_customers xuc on xuc.customers_id = xcup.customers_personnel_id and xuc.del_flag =0
|
||||
left join xhpc_history_order xho on xho.source =3 and xho.user_id =xcup.customers_personnel_id
|
||||
where xcup.tenant_id=#{tenantId} and xcup.del_flag=0
|
||||
<if test="number==1 or number==2">
|
||||
and xcup.create_type=2 and xcup.create_id=#{userId}
|
||||
</if>
|
||||
<if test="type==1">
|
||||
and xcup.create_type=2 and xcup.create_id=#{userId}
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and xcup.create_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
</if>
|
||||
<if test="operatorId !=null">
|
||||
and xcup.create_id=#{operatorId}
|
||||
</if>
|
||||
<if test="terminalId !=null">
|
||||
and xho.terminal_id=#{terminalId}
|
||||
</if>
|
||||
<if test="chargingPileId !=null">
|
||||
and xcup.create_id=(select operator_id from xhpc_charging_station where charging_station_id=(select terminal_id from xhpc_charging_pile where charging_pile_id=#{chargingPileId}))
|
||||
</if>
|
||||
<if test="name !=null and name !=''">
|
||||
and xcup.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="account !=null and account !=''">
|
||||
and xcup.account like concat('%',#{account},'%')
|
||||
</if>
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xcup.phone like concat('%',#{phone},'%')
|
||||
</if>
|
||||
<if test="startTime !=null and '' !=startTime">
|
||||
and xho.end_time >=#{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and '' !=endTime">
|
||||
and xho.end_time <=#{endTime}
|
||||
</if>
|
||||
GROUP BY xcup.account
|
||||
</if>
|
||||
<if test="type !=1 and type !=2">
|
||||
select
|
||||
concat("社区用户") as mechanismName,
|
||||
xcp.account as account,
|
||||
xcp.name as name,
|
||||
xcp.phone as phone,
|
||||
count(xho.history_order_id) number,
|
||||
IFNULL(sum(xho.total_power),0) totalPower,
|
||||
IFNULL(sum(xho.total_price),0) totalPrice,
|
||||
IFNULL(sum(xho.promotion_discount),0) promotionDiscount
|
||||
from xhpc_community_personnel as xcp
|
||||
join xhpc_community xc on xc.community_id = xcp.community_id and xc.del_flag =0
|
||||
left join xhpc_history_order xho on xho.source =2 and xho.user_id =xcp.community_personnel_id
|
||||
where xcp.tenant_id=#{tenantId} and xcp.del_flag=0
|
||||
<if test="number==1 or number==2">
|
||||
and xcp.create_type=2 and xcp.create_id=#{userId}
|
||||
</if>
|
||||
@ -277,9 +181,12 @@
|
||||
IFNULL(sum(xho.total_price),0) totalPrice,
|
||||
IFNULL(sum(xho.promotion_discount),0) promotionDiscount
|
||||
from xhpc_customers_personnel as xcup
|
||||
join xhpc_customers xuc on xuc.customers_id = xcup.customers_personnel_id and xuc.del_flag =0
|
||||
left join xhpc_customers xuc on xuc.customers_id = xcup.customers_personnel_id and xuc.del_flag =0
|
||||
left join xhpc_history_order xho on xho.source =3 and xho.user_id =xcup.customers_personnel_id
|
||||
where xcup.tenant_id=#{tenantId} and xcup.del_flag=0
|
||||
where xcup.del_flag=0
|
||||
<if test="tenantId !=null and tenantId!=''">
|
||||
and xcup.tenant_id=#{tenantId}
|
||||
</if>
|
||||
<if test="number==1 or number==2">
|
||||
and xcup.create_type=2 and xcup.create_id=#{userId}
|
||||
</if>
|
||||
@ -314,9 +221,113 @@
|
||||
and xho.end_time <=#{endTime}
|
||||
</if>
|
||||
GROUP BY xcup.account
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCommunityPersonnel" resultType="map">
|
||||
select
|
||||
concat("社区用户") as mechanismName,
|
||||
xcp.account as account,
|
||||
xcp.name as name,
|
||||
xcp.phone as phone,
|
||||
count(xho.history_order_id) number,
|
||||
IFNULL(sum(xho.total_power),0) totalPower,
|
||||
IFNULL(sum(xho.total_price),0) totalPrice,
|
||||
IFNULL(sum(xho.promotion_discount),0) promotionDiscount
|
||||
from xhpc_community_personnel as xcp
|
||||
left join xhpc_community xc on xc.community_id = xcp.community_id and xc.del_flag =0
|
||||
left join xhpc_history_order xho on xho.source =2 and xho.user_id =xcp.community_personnel_id
|
||||
where xcp.del_flag=0
|
||||
<if test="tenantId !=null and tenantId!=''">
|
||||
and xcp.tenant_id=#{tenantId}
|
||||
</if>
|
||||
<if test="number==1 or number==2">
|
||||
and xcp.create_type=2 and xcp.create_id=#{userId}
|
||||
</if>
|
||||
<if test="type==1">
|
||||
and xcp.create_type=2 and xcp.create_id=#{userId}
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and xcp.create_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
</if>
|
||||
<if test="operatorId !=null">
|
||||
and xcp.create_id=#{operatorId}
|
||||
</if>
|
||||
<if test="terminalId !=null">
|
||||
and xho.terminal_id=#{terminalId}
|
||||
</if>
|
||||
<if test="chargingPileId !=null">
|
||||
and xcp.create_id=(select operator_id from xhpc_charging_station where charging_station_id=(select terminal_id from xhpc_charging_pile where charging_pile_id=#{chargingPileId}))
|
||||
</if>
|
||||
<if test="name !=null and name !=''">
|
||||
and xcp.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="account !=null and account !=''">
|
||||
and xcp.account like concat('%',#{account},'%')
|
||||
</if>
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xcp.phone like concat('%',#{phone},'%')
|
||||
</if>
|
||||
<if test="startTime !=null and '' !=startTime">
|
||||
and xho.end_time >=#{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and '' !=endTime">
|
||||
and xho.end_time <=#{endTime}
|
||||
</if>
|
||||
GROUP BY xcp.account
|
||||
</select>
|
||||
|
||||
<select id="getCustomersPersonnel" resultType="map">
|
||||
select
|
||||
concat("B端用户") as mechanismName,
|
||||
xcup.account as account,
|
||||
xcup.name as name,
|
||||
xcup.phone as phone,
|
||||
count(xho.history_order_id) number,
|
||||
IFNULL(sum(xho.total_power),0) totalPower,
|
||||
IFNULL(sum(xho.total_price),0) totalPrice,
|
||||
IFNULL(sum(xho.promotion_discount),0) promotionDiscount
|
||||
from xhpc_customers_personnel as xcup
|
||||
left join xhpc_customers xuc on xuc.customers_id = xcup.customers_personnel_id and xuc.del_flag =0
|
||||
left join xhpc_history_order xho on xho.source =3 and xho.user_id =xcup.customers_personnel_id
|
||||
where xcup.del_flag=0
|
||||
|
||||
<if test="tenantId !=null and tenantId!=''">
|
||||
and xcup.tenant_id=#{tenantId}
|
||||
</if>
|
||||
<if test="number==1 or number==2">
|
||||
and xcup.create_type=2 and xcup.create_id=#{userId}
|
||||
</if>
|
||||
<if test="type==1">
|
||||
and xcup.create_type=2 and xcup.create_id=#{userId}
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and xcup.create_id=(select operator_id from xhpc_charging_station where charging_station_id=#{chargingStationId})
|
||||
</if>
|
||||
<if test="operatorId !=null">
|
||||
and xcup.create_id=#{operatorId}
|
||||
</if>
|
||||
<if test="terminalId !=null">
|
||||
and xho.terminal_id=#{terminalId}
|
||||
</if>
|
||||
<if test="chargingPileId !=null">
|
||||
and xcup.create_id=(select operator_id from xhpc_charging_station where charging_station_id=(select terminal_id from xhpc_charging_pile where charging_pile_id=#{chargingPileId}))
|
||||
</if>
|
||||
<if test="name !=null and name !=''">
|
||||
and xcup.name like concat('%',#{name},'%')
|
||||
</if>
|
||||
<if test="account !=null and account !=''">
|
||||
and xcup.account like concat('%',#{account},'%')
|
||||
</if>
|
||||
<if test="phone !=null and phone !=''">
|
||||
and xcup.phone like concat('%',#{phone},'%')
|
||||
</if>
|
||||
<if test="startTime !=null and '' !=startTime">
|
||||
and xho.end_time >=#{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and '' !=endTime">
|
||||
and xho.end_time <=#{endTime}
|
||||
</if>
|
||||
GROUP BY xcup.account
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user