添加排行榜功能
This commit is contained in:
parent
7b105d4dfc
commit
247af4b65c
|
@ -450,6 +450,13 @@ public class ArtificerController {
|
|||
}
|
||||
|
||||
|
||||
@GetMapping("/selectArtificerPhbList")
|
||||
@ApiOperation("排行榜(在线时长+业绩++加钟率+充值率)")
|
||||
public Result selectArtificerPhbList(Integer page,Integer limit,String startTime,String endTime,String type){
|
||||
return artificerService.selectArtificerPhbList(page, limit, startTime, endTime, type);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/selectArtificerOrdersList")
|
||||
@ApiOperation("查询进行中的技师订单")
|
||||
public Result selectArtificerOrdersList(Integer page,Integer limit,String artificerName,
|
||||
|
|
|
@ -47,4 +47,12 @@ public interface ArtificerDao extends BaseMapper<Artificer> {
|
|||
List<Artificer> selectInlineList(Artificer artificer);
|
||||
|
||||
Artificer selectByPhone(@Param("phone")String mobile);
|
||||
|
||||
IPage<Map<String, Object>> getZxscList(Page<Object> objectPage,@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
IPage<Map<String, Object>> getYejiList(Page<Object> objectPage,@Param("startTime") String startTime, @Param("endTime") String endTime);
|
||||
|
||||
IPage<Map<String, Object>> getJzlList(Page<Object> objectPage, String startTime, String endTime);
|
||||
|
||||
IPage<Map<String, Object>> getCzlList(Page<Object> objectPage, String startTime, String endTime);
|
||||
}
|
|
@ -47,4 +47,6 @@ public interface ArtificerService extends IService<Artificer> {
|
|||
Result updateShz(Artificer artificer);
|
||||
|
||||
Artificer selectByPhone(String mobile);
|
||||
|
||||
Result selectArtificerPhbList(Integer page, Integer limit, String startTime, String endTime, String type);
|
||||
}
|
|
@ -3,12 +3,12 @@ package com.sqx.modules.artificer.service.impl;
|
|||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.alibaba.druid.util.StringUtils;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baidu.aip.face.AipFace;
|
||||
import com.baidu.aip.face.MatchRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
|
@ -516,7 +516,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
messageService.saveBody(messageInfo);
|
||||
artificer.setLatitude(latitude);
|
||||
artificer.setLongitude(longitude);
|
||||
if(StringUtils.isNotEmpty(latitude) && StringUtils.isNotEmpty(longitude)){
|
||||
if(!StringUtils.isEmpty(latitude) && !StringUtils.isEmpty(longitude)){
|
||||
JSONObject adInfo = CommonMapUtils.getLocationToAdInfo(messageInfo.getTypeId(), messageInfo.getTypeName());
|
||||
String cityName = adInfo.getString("city");
|
||||
artificer.setCity(cityName);
|
||||
|
@ -781,7 +781,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
if(artificer.getArtificerId()!=null){
|
||||
|
||||
try {
|
||||
if(StringUtils.isNotEmpty(artificer.getLifePhoto())){
|
||||
if(!StringUtils.isEmpty(artificer.getLifePhoto())){
|
||||
String lifePhoto = artificer.getLifePhoto();//生活照
|
||||
if(artificer.getLifePhoto().indexOf(",")>-1){
|
||||
lifePhoto = artificer.getLifePhoto().split(",")[0];
|
||||
|
@ -835,6 +835,25 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
return baseMapper.selectByPhone(mobile);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result selectArtificerPhbList(Integer page, Integer limit, String startTime, String endTime, String type) {
|
||||
IPage<Map<String,Object>> pageList = null;
|
||||
if(!StringUtils.isEmpty(endTime)){
|
||||
endTime = endTime+" 23:59:59";
|
||||
}
|
||||
if(StringUtils.equals(type,"1")){//在线时长
|
||||
pageList = baseMapper.getZxscList(new Page<>(page,limit),startTime,endTime);
|
||||
}else if(StringUtils.equals(type,"2")){//业绩
|
||||
pageList = baseMapper.getYejiList(new Page<>(page,limit),startTime,endTime);
|
||||
}else if(StringUtils.equals(type,"3")){//加钟率
|
||||
pageList = baseMapper.getJzlList(new Page<>(page,limit),startTime,endTime);
|
||||
}else if(StringUtils.equals(type,"4")){//充值率
|
||||
pageList = baseMapper.getCzlList(new Page<>(page,limit),startTime,endTime);
|
||||
|
||||
}
|
||||
return Result.success().put("data",pageList);
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// String lifePhoto = "http://1.92.152.160/file/uploadPath/2024/07/09/a892623c518812421cec310d3d5e8d0a.jpg";
|
||||
// String artificerImg = "https://sausers.blxinchuang.com/file/uploadPath/2024/07/03/423843a244c16b04819a131c2160c0af.png";
|
||||
|
|
|
@ -227,4 +227,183 @@
|
|||
inner join tb_user u on a.user_id=u.user_id
|
||||
where u.phone = #{phone}
|
||||
</select>
|
||||
|
||||
|
||||
<!--按照业绩倒叙-->
|
||||
<select id="getYejiList" resultType="Map">
|
||||
select t.*,sum(price_total) AS typeval,a.artificer_name as artificerName
|
||||
from (
|
||||
select o.artificer_id,
|
||||
(
|
||||
(case when o.is_supplement in (1,3,4) then 0 else o.price end) + ifnull(o.add_price,0)
|
||||
+ ifnull((case when o2.is_supplement in (1,3,4) then 0 else o2.price end),0) + ifnull(o2.add_price,0)
|
||||
+ ifnull((case when o3.is_supplement in (1,3,4) then 0 else o3.price end),0) + ifnull(o3.add_price,0)
|
||||
) as price_total
|
||||
from orders o
|
||||
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||
left join orders_massage om on om.orders_id=o.orders_id
|
||||
left join massage_type m on m.massage_type_id=om.massage_id
|
||||
LEFT JOIN bl_user_package_detail bl ON bl.id = om.massage_id
|
||||
where o.old_orders_id is not null
|
||||
and o.status not in (4,11,15)
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
union all
|
||||
select o.artificer_id,
|
||||
o.price + ifnull(o.add_price,0) as price_total
|
||||
from orders o
|
||||
left join orders_massage om on om.orders_id=o.orders_id
|
||||
where o.parent_id = 0
|
||||
and o.orders_id not in (
|
||||
select orders_id from orders
|
||||
where old_orders_id is not null
|
||||
and status != 4
|
||||
)
|
||||
and o.orders_id not in (
|
||||
select old_orders_id from orders
|
||||
where old_orders_id is not null
|
||||
and status != 4
|
||||
)
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
) t
|
||||
left join artificer a on t.artificer_id = a.artificer_id
|
||||
where a.artificer_name is not null
|
||||
GROUP BY t.artificer_id
|
||||
order by sum(price_total) desc
|
||||
</select>
|
||||
<!-- 在线时长-->
|
||||
<select id="getZxscList" resultType="Map">
|
||||
select t.artificer_id,IFNULL( SUM(t.user_recharge),0) AS typeval,a.artificer_name as artificerName
|
||||
from bl_user_zxsc t
|
||||
left join artificer a on t.artificer_id = a.artificer_id
|
||||
<where>
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and t.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and t.create_time <= #{endTime}
|
||||
</if>
|
||||
</where>
|
||||
group BY t.artificer_id
|
||||
order by IFNULL( SUM(user_recharge),0) desc
|
||||
</select>
|
||||
|
||||
<!-- 加钟率-->
|
||||
<select id="getJzlList" resultType="Map">
|
||||
|
||||
select t.artificer_id,IFNULL( count(*),'0') AS a,sum(add_num) as b, round(sum(add_num)/IFNULL( count(*),'0'),2) * 100 as typeval,a.artificer_name as artificerName
|
||||
from (
|
||||
select o.artificer_id,(case when o.status = 4
|
||||
then o.artificer_money + ifnull(o.add_artificer_money,0)
|
||||
else o.artificer_money + ifnull(o.add_artificer_money,0) + ifnull(o2.artificer_money,0) + ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
|
||||
end) as artificer_money_total,if(o.add_num is null ,0,1) as add_num
|
||||
from orders o
|
||||
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||
where o.old_orders_id is not null
|
||||
and o.status not in (4,11,15)
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
union all
|
||||
select o.artificer_id,o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total,if(add_num is null ,0,1) add_num
|
||||
from orders o
|
||||
where o.parent_id = 0
|
||||
and o.orders_id not in (
|
||||
select orders_id from orders
|
||||
where old_orders_id is not null
|
||||
and status != 4
|
||||
)
|
||||
and o.orders_id not in (
|
||||
select old_orders_id from orders
|
||||
where old_orders_id is not null
|
||||
and status != 4
|
||||
)
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
) t
|
||||
left join artificer a on t.artificer_id = a.artificer_id
|
||||
|
||||
GROUP BY artificer_id
|
||||
order by round(sum(add_num)/IFNULL( count(*),'0'),2) * 100 desc
|
||||
</select>
|
||||
|
||||
<!-- 充值率-->
|
||||
<select id="getCzlList" resultType="Map">
|
||||
select t.artificer_id,
|
||||
IFNULL(count(*),0) AS tt,
|
||||
IFNULL(ur.num,0) as num,
|
||||
IFNULL(ur.num,0) / IFNULL(count(*),0) as typeval,a.artificer_name as artificerName
|
||||
from (
|
||||
select o.artificer_id
|
||||
from orders o
|
||||
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||
where o.old_orders_id is not null
|
||||
and o.status not in (4,11,15)
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
GROUP BY o.artificer_id
|
||||
union all
|
||||
select o.artificer_id
|
||||
from orders o
|
||||
where o.parent_id = 0
|
||||
and o.orders_id not in (
|
||||
select orders_id from orders
|
||||
where old_orders_id is not null
|
||||
and status != 4
|
||||
)
|
||||
and o.orders_id not in (
|
||||
select old_orders_id from orders
|
||||
where old_orders_id is not null
|
||||
and status != 4
|
||||
GROUP BY o.artificer_id
|
||||
)
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
) t
|
||||
LEFT JOIN (select artificer_id,count(*) as num from user_recharge
|
||||
where orders_id is not null
|
||||
<if test="startTime!=null and startTime !=''">
|
||||
and date_format(create_time,'%Y-%m-%d %H:%i:%s') >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime!=null and endTime !=''">
|
||||
and date_format(create_time,'%Y-%m-%d %H:%i:%s') <= #{endTime}
|
||||
</if>
|
||||
GROUP BY artificer_id) ur on t.artificer_id = ur.artificer_id
|
||||
left join artificer a on t.artificer_id = a.artificer_id
|
||||
GROUP BY t.artificer_id
|
||||
order by IFNULL(ur.num,0) / IFNULL(count(*),0) desc
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue