功能调整

This commit is contained in:
曹磊 2024-08-20 11:14:52 +08:00
parent 1a1965bd82
commit e260df48a0
10 changed files with 517 additions and 66 deletions

View File

@ -119,9 +119,9 @@ public class ArtificerController {
@ApiOperation("查询技师列表")
public Result selectArtificerList(Integer page, Integer limit, Long massageTypeId, String artificerName,
String longitude,String latitude,Integer sort,Integer authentication,
Integer by,Integer status,String city,String classifyId,String phone,Integer isStart,Integer technicianType,String isBack){
Integer by,Integer status,String city,String classifyId,String phone,Integer isStart,Integer technicianType,String isBack,Integer isGoods){
return artificerService.selectArtificerList(page, limit, massageTypeId, artificerName,longitude,latitude,
sort,authentication,by,status,city,classifyId,phone,null,isStart,technicianType,isBack);
sort,authentication,by,status,city,classifyId,phone,null,isStart,technicianType,isBack,isGoods);
}
@GetMapping("/selectArtificer")
@ -451,19 +451,36 @@ public class ArtificerController {
return Result.success().put("data",result);
}
// @GetMapping("/selectArtificerMoneyList")
// @ApiOperation("技师收益排行榜(在线时长+业绩++加钟率+充值率)")
// public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId){
// return artificerService.selectArtificerMoneyList(page, limit, startTime, endTime, title,classifyId);
// }
@GetMapping("/selectArtificerMoneyList")
@ApiOperation("技师收益排行榜(在线时长+业绩++加钟率+充值率)")
public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId){
return artificerService.selectArtificerMoneyList(page, limit, startTime, endTime, title,classifyId);
public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,Integer status,Integer px,Integer type){
return artificerService.selectArtificerMoneyList(page, limit, startTime, endTime, status, px, type);
}
@GetMapping("/selectArtificerPhbList")
@ApiOperation("排行榜(在线时长+业绩++加钟率+充值率)")
@ApiOperation("排行榜(在线时长+业绩++加钟率+充值率+积分)")
public Result selectArtificerPhbList(Integer page,Integer limit,String startTime,String endTime,String type){
return artificerService.selectArtificerPhbList(page, limit, startTime, endTime, type);
}
@GetMapping("/getJfDetailList")
@ApiOperation("排行榜(积分详情)")
public Result getJfDetailList(Integer page,Integer limit,Long artificerId,String startTime,String endTime,Integer classify){
return artificerService.getJfDetailList(page, limit, artificerId, startTime, endTime, classify);
}
@PostMapping("/insertJfDetail")
@ApiOperation("修改积分")
public Result insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral, String remarks){
artificerService.insertJfDetail(artificerId, artificerName, type, integral, remarks);
return Result.success();
}
@GetMapping("/selectArtificerOrdersList")
@ApiOperation("查询进行中的技师订单")

View File

@ -135,12 +135,12 @@ public class AppArtificerController {
@ApiOperation("查询技师列表")
public Result selectArtificerList(Integer page, Integer limit, Long massageTypeId, String artificerName,
String longitude,String latitude,Integer sort,Integer authentication,
Integer by,String city,String classifyId,String phone, Integer isStart,Integer technicianType,String isBack,Integer status){
Integer by,String city,String classifyId,String phone, Integer isStart,Integer technicianType,String isBack,Integer status,Integer isGoods) {
if(status == null){
status = -1;
}
return artificerService.selectArtificerList(page, limit, massageTypeId, artificerName,longitude,latitude,
sort,authentication,by,status,city,classifyId,phone,1,isStart,technicianType,isBack);
sort,authentication,by,status,city,classifyId,phone,1,isStart,technicianType,isBack,isGoods);
}

View File

@ -9,6 +9,7 @@ import com.sqx.modules.artificer.entity.Artificer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
@ -22,7 +23,7 @@ public interface ArtificerDao extends BaseMapper<Artificer> {
@Param("authentication") Integer authentication,@Param("by") Integer by,
@Param("status") Integer status,@Param("city") String city,
@Param("classifyId") String classifyId,@Param("phone") String phone,
Integer user,@Param("isStart") Integer isStart,@Param("technicianType")Integer technicianType,@Param("isBack")String isBack, @Param("userIdList")List<Long> userIdList);
Integer user,@Param("isStart") Integer isStart,@Param("technicianType")Integer technicianType,@Param("isBack")String isBack, @Param("userIdList")List<Long> userIdList,@Param("isGoods") Integer isGoods);
Artificer selectArtificerById(@Param("userId") Long userId,@Param("artificerId") Long artificerId,@Param("longitude") String longitude,@Param("latitude") String latitude);
@ -55,4 +56,11 @@ public interface ArtificerDao extends BaseMapper<Artificer> {
IPage<Map<String, Object>> getJzlList(Page<Object> objectPage, String startTime, String endTime);
IPage<Map<String, Object>> getCzlList(Page<Object> objectPage, String startTime, String endTime);
IPage<Map<String, Object>> getJfList(Page<Object> objectPage, String startTime, String endTime);
IPage<Map<String, Object>> getJfDetailList(Page<Object> objectPage,@Param("artificerId") Long artificerId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("classify") Integer classify);
void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral,String remarks);
}

View File

@ -106,8 +106,12 @@ public interface OrdersDao extends BaseMapper<Orders> {
String selectOrdersArtificerIntegraladdNum(Long artificerId, String endDate, String startDate);
BigDecimal selectOrdersArtificerAddMoney(Long artificerId, String endDate, String startDate);
String selectOrdersCurrentPeriodRechargeSum(Long artificerId, String endDate, String startDate,@Param("isSfwc") Integer isSfwc);
BigDecimal selectOrdersRechargeMoney(Long artificerId, String endDate, String startDate);
String selectOrdersStoredValueIntegral(Long artificerId, String endDate, String startDate);
String selectOnlineCredits(Long artificerId, String endDate, String startDate);
@ -148,4 +152,6 @@ public interface OrdersDao extends BaseMapper<Orders> {
BigDecimal selectSumRefund(Long artificerId, @Param("startTime") String startTime, @Param("endTime") String endTime);
IPage<Map<String,Object>> selectArtificerMoneyList(Page<Map<String,Object>> page,String startTime,String endTime,Integer status,Integer by);
}

View File

@ -7,6 +7,7 @@ import com.sqx.common.utils.Result;
import com.sqx.modules.artificer.entity.Artificer;
import com.sqx.modules.chat.entity.ChatContent;
import java.math.BigDecimal;
import java.text.ParseException;
@ -14,7 +15,7 @@ public interface ArtificerService extends IService<Artificer> {
Result selectArtificerList(Integer page, Integer limit, Long massageTypeId, String artificerName,
String longitude,String latitude,Integer sort,Integer authentication,
Integer by,Integer status,String city,String classifyId,String phone,Integer user, Integer isStart,Integer technicianType,String isBack);
Integer by,Integer status,String city,String classifyId,String phone,Integer user, Integer isStart,Integer technicianType,String isBack, Integer isGoods);
Artificer selectArtificerById(Long userId,Long artificerId,String longitude,String latitude);
@ -26,7 +27,7 @@ public interface ArtificerService extends IService<Artificer> {
Result signIn(Long userId, String longitude, String latitude, String city,String address);
Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId);
Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,Integer status,Integer px,Integer type);
Result selectUserListByConsortiaId(Integer page,Integer limit,String userName,String phone,Long consortiaId,Long shopId,Integer flag,String time);
@ -49,4 +50,8 @@ public interface ArtificerService extends IService<Artificer> {
Artificer selectByPhone(String mobile);
Result selectArtificerPhbList(Integer page, Integer limit, String startTime, String endTime, String type);
Result getJfDetailList(Integer page,Integer limit,Long artificerId,String startTime,String endTime,Integer classify);
void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral, String remarks);
}

View File

@ -81,7 +81,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
@Override
public Result selectArtificerList(Integer page, Integer limit, Long massageTypeId,String artificerName,
String longitude,String latitude,Integer sort,Integer authentication,
Integer by,Integer status,String city,String classifyId,String phone,Integer user, Integer isStart,Integer technicianType,String isBack){
Integer by,Integer status,String city,String classifyId,String phone,Integer user, Integer isStart,Integer technicianType,String isBack, Integer isGoods){
Page<Artificer> pages=new Page<>(page,limit);
if(StringUtils.isEmpty(longitude)){
@ -110,7 +110,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
}
}
IPage<Artificer> artificerIPage = baseMapper.selectArtificerList(pages, massageTypeId, artificerName,
longitude, latitude, sort, authentication, by, status, city, classifyId,phone,user,isStart,technicianType,isBack,userIdList);
longitude, latitude, sort, authentication, by, status, city, classifyId,phone,user,isStart,technicianType,isBack,userIdList,isGoods);
List<Artificer> records = artificerIPage.getRecords();
String value = commonInfoService.findOne(392).getValue();
if("30".equals(value)){
@ -612,54 +612,116 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
return Result.success();
}
// @Override
// public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId){
// IPage<Map<String,Object>> pageList = baseMapper.selectArtificerMoneyList(new Page<>(page,limit),startTime,endTime,title,classifyId);
// for(Map<String,Object> map:pageList.getRecords()){
// Long artificerId = Long.parseLong(map.get("artificerId").toString());
// //当期业绩
//// BigDecimal currentPerformance = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endTime, startTime);
// Integer dqyjOld = ordersDao.selectOrdersArtificerIntegralAchievement(artificerId, endTime, startTime);
// BigDecimal currentPerformance = new BigDecimal(dqyjOld);
// currentPerformance = currentPerformance.setScale(2,BigDecimal.ROUND_HALF_UP);
// map.put("yj",String.valueOf(currentPerformance));
//
// //首页
// BigDecimal earnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endTime, startTime);
// map.put("sy",String.valueOf(earnings));
//
// //当期订单数计算订单发生了按摩行为的订单数订单状态经历了开始服务到订单结束
// String currentPeriodOrdersSum = ordersDao.selectOrdersArtificerIntegral(artificerId, endTime, startTime);
// BigDecimal currentPeriodOrdersSumBig = new BigDecimal(currentPeriodOrdersSum);
//
// //当期加钟率本周期内加钟数/本单数
//// String v = ordersDao.selectOrdersArtificerIntegraladdNum(artificerId, endTime, startTime);
//// //加钟数
//// BigDecimal currentPeriodAddBellsSumBig = new BigDecimal(v);
//// //加钟率
//// BigDecimal clockRate = BigDecimal.ZERO;
//// //充值率
//// BigDecimal divide1 = BigDecimal.ZERO;
//// if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
//// clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);//加钟率
////
//// //当前周期充值率(本周期内充值订单数/本单数)
//// String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endTime, startTime,1);
//// BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
//// divide1 = c.divide(currentPeriodOrdersSumBig, 2, BigDecimal.ROUND_HALF_UP);//充值率
//// } else {
//// clockRate = new BigDecimal("0");
//// divide1 = new BigDecimal("0");
//// }
//// map.put("jzl",String.valueOf(clockRate));//加钟率
//// map.put("czl",String.valueOf(divide1));//充值率
//
// BigDecimal addMoney = ordersDao.selectOrdersArtificerAddMoney(artificerId, endTime, startTime);
// BigDecimal divideMoney = ordersDao.selectOrdersRechargeMoney(artificerId, endTime, startTime);
// map.put("jzl",addMoney.toString());//加钟金额
// map.put("czl",divideMoney.toString());//充值金额
//
// //在线时长
// String mint = ordersDao.selectOrdersZxscNum(artificerId,startTime,endTime);
// map.put("zxsc",String.valueOf(mint));//在线时长
// map.put("ddsl",currentPeriodOrdersSum);//订单数量
// }
// return Result.success().put("data",pageList);
// }
@Override
public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId){
IPage<Map<String,Object>> pageList = baseMapper.selectArtificerMoneyList(new Page<>(page,limit),startTime,endTime,title,classifyId);
for(Map<String,Object> map:pageList.getRecords()){
Long artificerId = Long.parseLong(map.get("artificerId").toString());
//当期业绩
// BigDecimal currentPerformance = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endTime, startTime);
Integer dqyjOld = ordersDao.selectOrdersArtificerIntegralAchievement(artificerId, endTime, startTime);
BigDecimal currentPerformance = new BigDecimal(dqyjOld);
currentPerformance = currentPerformance.setScale(0,BigDecimal.ROUND_DOWN);
map.put("yj",String.valueOf(currentPerformance));
//首页
BigDecimal earnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endTime, startTime);
map.put("sy",String.valueOf(earnings));
//当期订单数计算订单发生了按摩行为的订单数订单状态经历了开始服务到订单结束
String currentPeriodOrdersSum = ordersDao.selectOrdersArtificerIntegral(artificerId, endTime, startTime);
BigDecimal currentPeriodOrdersSumBig = new BigDecimal(currentPeriodOrdersSum);
//当期加钟率本周期内加钟数/本单数
String v = ordersDao.selectOrdersArtificerIntegraladdNum(artificerId, endTime, startTime);
//加钟数
BigDecimal currentPeriodAddBellsSumBig = new BigDecimal(v);
//加钟率
BigDecimal clockRate = BigDecimal.ZERO;
//充值率
BigDecimal divide1 = BigDecimal.ZERO;
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//加钟率
//当前周期充值率(本周期内充值订单数/本单数)
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endTime, startTime,1);
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//充值率
} else {
clockRate = new BigDecimal("0");
divide1 = new BigDecimal("0");
public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,Integer status,Integer px,Integer type){
Integer by = 1;
if(px!=null && type!=null){
if(px == 1){
switch (type){
case 1:
by = 1;
break;
case 2:
by = 3;
break;
case 3:
by = 5;
break;
case 4:
by = 7;
break;
case 5:
by = 9;
break;
case 6:
by = 11;
break;
case 7:
by = 11;
break;
}
}else{
switch (type){
case 1:
by = 2;
break;
case 2:
by = 4;
break;
case 3:
by = 6;
break;
case 4:
by = 8;
break;
case 5:
by = 10;
break;
case 6:
by = 12;
break;
case 7:
by = 14;
break;
}
}
map.put("jzl",String.valueOf(clockRate));//加钟率
map.put("czl",String.valueOf(divide1));//充值率
//在线时长
String mint = ordersDao.selectOrdersZxscNum(artificerId,startTime,endTime);
map.put("zxsc",String.valueOf(mint));//在线时长
map.put("ddsl",currentPeriodOrdersSum);//订单数量
}
IPage<Map<String,Object>> pageList = ordersDao.selectArtificerMoneyList(new Page<>(page,limit),startTime,endTime,status,by);
return Result.success().put("data",pageList);
}
@ -749,7 +811,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
public Result getHomeArtificerList(Integer page, Integer limit, Integer isStart,Integer status, String city, String longitude, String latitude){
Map<String, Object> map = new HashMap<String, Object>();
Page<Artificer> pages=new Page<>(page,limit);
IPage<Artificer> artificerIPage = baseMapper.selectArtificerList(pages, null, "",longitude, latitude, 1, 2, 1, status, city, null,"",1,0,null,"",null);
IPage<Artificer> artificerIPage = baseMapper.selectArtificerList(pages, null, "",longitude, latitude, 1, 2, 1, status, city, null,"",1,0,null,"",null,null);
map.put("nearData",new PageUtils(artificerIPage));
map.put("startData",new PageUtils(baseMapper.getHomeStartArtificerList(pages,isStart,status,city)));
return Result.success(map);
@ -936,11 +998,27 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
pageList = baseMapper.getJzlList(new Page<>(page,limit),startTime,endTime);
}else if(StringUtils.equals(type,"4")){//充值率
pageList = baseMapper.getCzlList(new Page<>(page,limit),startTime,endTime);
}else if(StringUtils.equals(type,"5")){//积分
pageList = baseMapper.getJfList(new Page<>(page,limit),startTime,endTime);
}
return Result.success().put("data",pageList);
}
@Override
public Result getJfDetailList(Integer page,Integer limit,Long artificerId,String startTime,String endTime,Integer classify) {
IPage<Map<String,Object>> pageList = null;
if(!StringUtils.isEmpty(endTime)){
endTime = endTime+" 23:59:59";
}
pageList = baseMapper.getJfDetailList(new Page<>(page,limit),artificerId,startTime,endTime,classify);
return Result.success().put("data",pageList);
}
@Override
public void insertJfDetail(Long artificerId, String artificerName, Integer type, BigDecimal integral,String remarks) {
baseMapper.insertJfDetail(artificerId, artificerName, type, integral, remarks);
}
// 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";

View File

@ -1,6 +1,6 @@
package com.sqx.modules.dlssqjl.controller.app;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sqx.common.utils.Result;
import com.sqx.modules.dlssqjl.entity.Dlssqjl;
import com.sqx.modules.dlssqjl.service.DlssqjlService;
@ -8,9 +8,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/app/dlssqjl")
@ -23,7 +22,10 @@ public class AppDlssqjlController {
@PostMapping("/insertDlssqjl")
@ApiOperation("添加代理商")
public Result insertDlssqjl(@RequestBody Dlssqjl dlssqjl){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
List<Dlssqjl> list = dlssqjlService.list(new QueryWrapper<Dlssqjl>().eq("phone",dlssqjl.getPhone()));
if(list.size()>0){
return Result.error("您已申请!");
}
dlssqjl.setCreateTime(new Date());
dlssqjlService.save(dlssqjl);
return Result.success();
@ -43,7 +45,6 @@ public class AppDlssqjlController {
return Result.success();
}
@GetMapping("/selectDlssqjlPage")
@ApiOperation("查询代理商(分页)")
public Result selectDlssqjlPage(Integer page,Integer limit,String name,String phone){

View File

@ -23,6 +23,9 @@
<if test="isStart!=null and isStart!=0">
and a.is_start=#{isStart}
</if>
<if test="isGoods!=null and isGoods!=0">
and a.is_goods=#{isGoods}
</if>
<!-- <if test="classifyId!=null and classifyId!=0">-->
<!-- and FIND_IN_SET(#{classifyId},a.classify_id) > 0-->
<!-- </if>-->
@ -428,4 +431,63 @@
GROUP BY t.artificer_id
order by IFNULL(ur.num,0) / IFNULL(count(*),0) desc
</select>
<select id="getJfList" resultType="Map">
select t.artificer_id as artificerId,t.artificer_name as artificerName,
sum(case when type = 1 then IFNULL(t.integral,0) else -IFNULL(t.integral,0) end) AS typeval
from bl_artificer_integral_statistics t
<where>
<if test="startTime!=null and startTime!=''">
and t.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
and t.create_time &lt;= #{endTime}
</if>
</where>
group BY t.artificer_id,t.artificer_name
order by IFNULL(SUM(integral),0) desc
</select>
<select id="getJfDetailList" resultType="Map">
select t.artificer_id as artificerId,t.artificer_name as artificerName,
t.create_time as createTime,t.classify,t.type,t.achievement,t.integral,
t.orders_no as ordersNo,t.remarks
from bl_artificer_integral_statistics t
<where>
<if test="artificerId!=null">
and t.artificer_id = #{artificerId}
</if>
<if test="classify!=null">
and t.classify = #{classify}
</if>
<if test="startTime!=null and startTime!=''">
and t.create_time >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
and t.create_time &lt;= #{endTime}
</if>
</where>
order by t.create_time,t.type
</select>
<insert id="insertJfDetail">
insert into bl_artificer_integral_statistics(
artificer_id,
artificer_name,
create_time,
classify,
type,
integral,
remarks
)values(
#{artificerId},
#{artificerName},
date_format(now(),'%Y-%m-%d %H:%i:%s'),
4,
#{type},
#{integral},
#{remarks}
)
</insert>
</mapper>

View File

@ -1400,6 +1400,52 @@
and o.status in (3,5)
) t
</select>
<!-- 加钟金额-->
<select id="selectOrdersArtificerAddMoney" resultType="java.math.BigDecimal">
select
IFNULL(SUM(artificer_money),0) AS currentPeriodAddMoneySum
from (
select o.*
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.artificer_id = #{artificerId}
and o.old_orders_id is not null
and o.status not in (4,11,15)
and o.add_num > 0
<if test="startDate!=null and startDate !=''">
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startDate}
</if>
<if test="endDate!=null and endDate !=''">
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
</if>
and o.status in (3,5)
union all
select o.*
from orders o
where o.artificer_id = #{artificerId}
and o.parent_id = 0
and o.old_orders_id is null
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
)
and o.add_num > 0
<if test="startDate!=null and startDate !=''">
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') >= #{startDate}
</if>
<if test="endDate!=null and endDate !=''">
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
</if>
and o.status in (3,5)
) t
</select>
<!-- 充值率-->
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
select IFNULL( count(*),'0') AS currentPeriodRechargeSum
@ -1490,6 +1536,23 @@
and o.status in (3,5)
) t
</select>
<!-- 充值金额-->
<select id="selectOrdersRechargeMoney" resultType="java.math.BigDecimal">
select IFNULL(sum(money),0) AS currentPeriodRechargeMoney
from user_money_details t
inner join artificer a on a.user_id=t.user_id
where t.classify = 4
and t.state = 2
<if test="startDate!=null and startDate !=''">
and date_format(t.create_time,'%Y-%m-%d %H:%i:%s') >= #{startDate}
</if>
<if test="endDate!=null and endDate !=''">
and date_format(t.create_time,'%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
</if>
<if test="artificerId!=null and artificerId !=''">
and a.artificer_id = #{artificerId}
</if>
</select>
<!-- 储值积分数-->
<select id="selectOrdersStoredValueIntegral" resultType="java.lang.String">
SELECT
@ -1778,4 +1841,200 @@
) t
</select>
<select id="selectArtificerMoneyList" resultType="Map">
select artificerId,artificerName,sum(ddsl) as ddsl,sum(sy) as sy,sum(yj) as yj,sum(zxsc) as zxsc,sum(jzl) as jzl,sum(czl) as czl,sum(jf) as jf
from (
select artificerId,artificerName,IFNULL(count(*),0) AS ddsl,IFNULL(sum(artificer_money_total),0) AS sy,IFNULL(SUM(price_total),0) yj,0 zxsc,0 jzl,0 czl,0 jf
from (
select a.artificer_id as artificerId,a.artificer_name as artificerName,
(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,
((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 artificer a
inner join tb_user b on a.user_id = b.user_id
inner join orders o on a.artificer_id = o.artificer_id
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 in (3,5)
<if test="startTime!=null and startTime !=''">
and date_format(o.end_times,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime !=''">
and date_format(o.end_times,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="status!=null and status==1">
and b.status = 1
</if>
<if test="status!=null and status==2">
and b.status in (2,3)
</if>
union all
select a.artificer_id as artificerId,a.artificer_name as artificerName,
o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total,
o.price + ifnull(o.add_price,0) as price_total
from artificer a
inner join tb_user b on a.user_id = b.user_id
inner join orders o on a.artificer_id = o.artificer_id
where o.parent_id = 0
and o.status in (3,5)
and o.old_orders_id is null
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') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime !=''">
and date_format(o.end_times,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="status!=null and status==1">
and b.status = 1
</if>
<if test="status!=null and status==2">
and b.status in (2,3)
</if>
) t
group by artificerId,artificerName
union all
select a.artificer_id as artificerId,a.artificer_name as artificerName,0 ddsl,0 sy,0 yj,IFNULL(SUM(user_recharge),0) zxsc,0 jzl,0 czl,0 jf
from artificer a
inner join tb_user b on a.user_id = b.user_id
inner join bl_user_zxsc c on a.artificer_id = c.artificer_id
<where>
<if test="startTime!=null and startTime!=''">
and date_format(c.end_times,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(c.end_times,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="status!=null and status==1">
and b.status = 1
</if>
<if test="status!=null and status==2">
and b.status in (2,3)
</if>
</where>
group by a.artificer_id,a.artificer_name
union all
select a.artificer_id as artificerId,a.artificer_name as artificerName,0 ddsl,0 sy,0 yj,0 zxsc,IFNULL(SUM(artificer_money),0) jzl,0 czl,0 jf
from artificer a
inner join tb_user b on a.user_id = b.user_id
inner join orders o on a.artificer_id = o.artificer_id
where o.status in (3,5)
and o.add_num > 0
<if test="startTime!=null and startTime !=''">
and date_format(o.end_times,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime !=''">
and date_format(o.end_times,'%Y-%m-%d %H:%i:%s') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="status!=null and status==1">
and b.status = 1
</if>
<if test="status!=null and status==2">
and b.status in (2,3)
</if>
group by a.artificer_id,a.artificer_name
union all
select a.artificer_id as artificerId,a.artificer_name as artificerName,0 ddsl,0 sy,0 yj,0 zxsc,0 jzl,IFNULL(sum(money),0) AS czl,0 jf
from artificer a
inner join tb_user b on a.user_id = b.user_id
inner join user_money_details c on b.user_id=c.user_id
where c.classify = 4
and c.state = 2
<if test="startTime!=null and startTime !=''">
and date_format(c.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime !=''">
and date_format(c.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="status!=null and status==1">
and b.status = 1
</if>
<if test="status!=null and status==2">
and b.status in (2,3)
</if>
group by a.artificer_id,a.artificer_name
union all
select a.artificer_id as artificerId,a.artificer_name as artificerName,
0 ddsl,0 sy,0 yj,0 zxsc,0 jzl,0 AS czl,
sum(case when c.type = 1 then IFNULL(c.integral,0) else -IFNULL(c.integral,0) end) AS jf
from artificer a
inner join tb_user b on a.user_id = b.user_id
inner join bl_artificer_integral_statistics c on a.artificer_id = c.artificer_id
<where>
<if test="startTime!=null and startTime!=''">
and date_format(c.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
</if>
<if test="endTime!=null and endTime!=''">
and date_format(c.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
</if>
<if test="status!=null and status==1">
and b.status = 1
</if>
<if test="status!=null and status==2">
and b.status in (2,3)
</if>
</where>
group BY a.artificer_id,a.artificer_name
) tt
group by artificerId,artificerName
<if test="by!=null and by==1">
order by ddsl asc
</if>
<if test="by!=null and by==2">
order by ddsl desc
</if>
<if test="by!=null and by==3">
order by sy asc
</if>
<if test="by!=null and by==4">
order by sy desc
</if>
<if test="by!=null and by==5">
order by yj asc
</if>
<if test="by!=null and by==6">
order by yj desc
</if>
<if test="by!=null and by==7">
order by zxsc asc
</if>
<if test="by!=null and by==8">
order by zxsc desc
</if>
<if test="by!=null and by==9">
order by jzl asc
</if>
<if test="by!=null and by==10">
order by jzl desc
</if>
<if test="by!=null and by==11">
order by czl asc
</if>
<if test="by!=null and by==12">
order by czl desc
</if>
<if test="by!=null and by==13">
order by jf asc
</if>
<if test="by!=null and by==14">
order by jf desc
</if>
</select>
</mapper>

View File

@ -67,7 +67,7 @@
<select id="findPackageAndMassagePage" resultType="com.sqx.modules.bl.massage.entity.MassagePackage">
select a.id,title,a.type,b.value as type_name,old_price,price,package_img,content,content_img,add_num,sales,labels,'套餐' as flag,is_can_coupon,is_can_vip,
(case when a.type in (105,106) then
(case when a.type in (105,106,114) then
(
select sum(service_count) from bl_massage_package_detail d
inner join massage_type t on t.massage_type_id = d.massage_type_id and t.status = 1
@ -84,6 +84,12 @@
<if test="params.title!=null and params.title!=''">
and a.title like concat('%',#{params.title},'%')
</if>
<if test="params.classifyId!=null">
and a.classifyId = #{classifyId}
</if>
<if test="params.type!=null">
and a.type = #{params.title}
</if>
union all
select massage_type_id as id,title,classify_id as type,b.value as type_name,old_price,price,massage_img,jianjie,content_img,add_num,sales,labels,'项目' as flag,1 as is_can_coupon,1 as is_can_vip,
1 as service_count
@ -96,6 +102,15 @@
<if test="params.title!=null and params.title!=''">
and a.title like concat('%',#{params.title},'%')
</if>
<if test="params.classifyId!=null">
and a.classifyId = #{classifyId}
</if>
<if test="params.type!=null and type ==1">
and 1=1
</if>
<if test="params.type!=null and type !=1">
and 1=2
</if>
order by sales desc,id asc
</select>