技师首页-业绩、收益
This commit is contained in:
parent
c66ba90caa
commit
0fd37f61ca
|
@ -11,6 +11,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -56,6 +57,8 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
||||||
|
|
||||||
IPage<Orders> selectTodayOrder(Page<Orders> pages,@Param("artificerId") Long artificerId,@Param("type") Integer type,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("minutes") Integer minutes);
|
IPage<Orders> selectTodayOrder(Page<Orders> pages,@Param("artificerId") Long artificerId,@Param("type") Integer type,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("minutes") Integer minutes);
|
||||||
|
|
||||||
|
IPage<Orders> selectDividedIntoDetails(Page<Orders> pages,@Param("artificerId") Long artificerId,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("isSfwc") Integer isSfwc);
|
||||||
|
|
||||||
IPage<Orders> selectArtificerOrder(Page<Orders> pages, Long userId, Integer status);
|
IPage<Orders> selectArtificerOrder(Page<Orders> pages, Long userId, Integer status);
|
||||||
|
|
||||||
int selectOrdersCountByUnderway(@Param("artificerId") Long artificerId);
|
int selectOrdersCountByUnderway(@Param("artificerId") Long artificerId);
|
||||||
|
@ -93,13 +96,15 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
||||||
|
|
||||||
Double selectNewUserOrdersRate();
|
Double selectNewUserOrdersRate();
|
||||||
|
|
||||||
|
Integer selectOrdersArtificerIntegralAchievement(Long artificerId, String endDate, String startDate);
|
||||||
|
|
||||||
Integer selectOrdersArtificerIntegralEarnings(Long artificerId, String endDate, String startDate);
|
Integer selectOrdersArtificerIntegralEarnings(Long artificerId, String endDate, String startDate);
|
||||||
|
|
||||||
String selectOrdersArtificerIntegral(Long artificerId, String endDate, String startDate);
|
String selectOrdersArtificerIntegral(Long artificerId, String endDate, String startDate);
|
||||||
|
|
||||||
String selectOrdersArtificerIntegraladdNum(Long artificerId, String endDate, String startDate);
|
String selectOrdersArtificerIntegraladdNum(Long artificerId, String endDate, String startDate);
|
||||||
|
|
||||||
String selectOrdersCurrentPeriodRechargeSum(Long artificerId, String endDate, String startDate);
|
String selectOrdersCurrentPeriodRechargeSum(Long artificerId, String endDate, String startDate,@Param("isSfwc") Integer isSfwc);
|
||||||
|
|
||||||
String selectOrdersStoredValueIntegral(Long artificerId, String endDate, String startDate);
|
String selectOrdersStoredValueIntegral(Long artificerId, String endDate, String startDate);
|
||||||
|
|
||||||
|
@ -123,7 +128,7 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
||||||
|
|
||||||
IPage<Orders> getJiazhongList(Page<Orders> pages, Long userId, Integer isSfwc, String startTime, String endTime);
|
IPage<Orders> getJiazhongList(Page<Orders> pages, Long userId, Integer isSfwc, String startTime, String endTime);
|
||||||
|
|
||||||
IPage<Orders> getChongzhiList(Page<Orders> pages, Long userId, Integer isSfwc, String startTime, String endTime);
|
IPage<Orders> getChongzhiList(Page<Orders> pages, Long artificerId, Integer isSfwc, String startTime, String endTime);
|
||||||
|
|
||||||
String selectOrdersZxscNum(Long artificerId, String startTime, String endTime);
|
String selectOrdersZxscNum(Long artificerId, String startTime, String endTime);
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,13 @@ public class Orders implements Serializable {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private BigDecimal artificerMoneyTotal;
|
private BigDecimal artificerMoneyTotal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总业绩
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private BigDecimal priceTotal;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 服务费用
|
* 服务费用
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -67,23 +67,26 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
|
||||||
orders.setGrade(grade);
|
orders.setGrade(grade);
|
||||||
|
|
||||||
//当期业绩
|
//当期业绩
|
||||||
Integer currentPerformance = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endDate, startDate);
|
Integer currentPerformance = ordersDao.selectOrdersArtificerIntegralAchievement(artificerId, endDate, startDate);
|
||||||
orders.setCurrentPerformance(String.valueOf(currentPerformance));
|
orders.setCurrentPerformance(String.valueOf(currentPerformance));
|
||||||
|
|
||||||
//当期收益
|
//当期收益
|
||||||
String earnings = ordersDao.earnings(artificerId, endDate, startDate);
|
// String earnings = ordersDao.earnings(artificerId, endDate, startDate);
|
||||||
|
String earnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endDate, startDate).toString();
|
||||||
orders.setEarnings(earnings);
|
orders.setEarnings(earnings);
|
||||||
|
|
||||||
//当日收益
|
//当日收益
|
||||||
String todayEndIncome = DateUtil.formatDateTime(DateUtil.endOfDay(new Date()));
|
String todayEndIncome = DateUtil.formatDateTime(DateUtil.endOfDay(new Date()));
|
||||||
String dailyEarnings = ordersDao.earnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
|
// String dailyEarnings = ordersDao.earnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
|
||||||
|
String dailyEarnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date()))).toString();
|
||||||
orders.setDailyEarnings(dailyEarnings);
|
orders.setDailyEarnings(dailyEarnings);
|
||||||
|
|
||||||
//当月收益
|
//当月收益
|
||||||
//当月结束日
|
//当月结束日
|
||||||
String startFundDataformat = DateUtil.formatDateTime(DateUtil.beginOfMonth(new Date()));
|
String startFundDataformat = DateUtil.formatDateTime(DateUtil.beginOfMonth(new Date()));
|
||||||
String endFundDataformat = DateUtil.formatDateTime(DateUtil.endOfMonth(new Date()));
|
String endFundDataformat = DateUtil.formatDateTime(DateUtil.endOfMonth(new Date()));
|
||||||
String currentMonthsIncome = ordersDao.earnings(artificerId, endFundDataformat, startFundDataformat);
|
// String currentMonthsIncome = ordersDao.earnings(artificerId, endFundDataformat, startFundDataformat);
|
||||||
|
String currentMonthsIncome = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endFundDataformat, startFundDataformat).toString();
|
||||||
orders.setCurrentMonthsIncome(currentMonthsIncome);
|
orders.setCurrentMonthsIncome(currentMonthsIncome);
|
||||||
|
|
||||||
//当期结束日
|
//当期结束日
|
||||||
|
@ -128,7 +131,7 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
|
||||||
orders.setCurrentPeriodAddBellsSum(clockRate.toString());
|
orders.setCurrentPeriodAddBellsSum(clockRate.toString());
|
||||||
|
|
||||||
//当前周期充值率(本周期内充值订单数/本单数)
|
//当前周期充值率(本周期内充值订单数/本单数)
|
||||||
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endDate, startDate);
|
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endDate, startDate,1);
|
||||||
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
||||||
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
||||||
orders.setCurrentPeriodRechargeSum(divide1.toString());
|
orders.setCurrentPeriodRechargeSum(divide1.toString());
|
||||||
|
@ -315,7 +318,7 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
|
||||||
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
|
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
|
||||||
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
||||||
//当前周期充值率(本周期内充值订单数/本单数)
|
//当前周期充值率(本周期内充值订单数/本单数)
|
||||||
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, date, cycleTime);
|
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, date, cycleTime,1);
|
||||||
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
||||||
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
||||||
} else {
|
} else {
|
||||||
|
@ -424,7 +427,7 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
|
||||||
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
|
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
|
||||||
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
||||||
//当前周期充值率(本周期内充值订单数/本单数)
|
//当前周期充值率(本周期内充值订单数/本单数)
|
||||||
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, date, cycleTime);
|
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, date, cycleTime,1);
|
||||||
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
||||||
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -550,7 +550,7 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
||||||
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//加钟率
|
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//加钟率
|
||||||
|
|
||||||
//当前周期充值率(本周期内充值订单数/本单数)
|
//当前周期充值率(本周期内充值订单数/本单数)
|
||||||
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endTime, startTime);
|
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endTime, startTime,1);
|
||||||
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
||||||
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//充值率
|
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//充值率
|
||||||
} else {
|
} else {
|
||||||
|
@ -689,11 +689,14 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
||||||
String earnings = "0";
|
String earnings = "0";
|
||||||
BigDecimal cy100 = new BigDecimal(100);
|
BigDecimal cy100 = new BigDecimal(100);
|
||||||
if(orderType == 1){//1当期
|
if(orderType == 1){//1当期
|
||||||
ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
|
// ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
|
||||||
earnings = ordersDao.earnings(userId, endTime, startTime);
|
ordersIPage = ordersDao.selectDividedIntoDetails(pages, userId,startTime,endTime,null);
|
||||||
|
int yeji = ordersDao.selectOrdersArtificerIntegralEarnings(userId, endTime, startTime);
|
||||||
|
earnings = yeji+"";
|
||||||
}else if(orderType == 2){//2加钟
|
}else if(orderType == 2){//2加钟
|
||||||
//查询列表
|
//查询列表
|
||||||
ordersIPage = ordersDao.getJiazhongList(pages, userId,isSfwc,startTime,endTime);
|
// ordersIPage = ordersDao.getJiazhongList(pages, userId,isSfwc,startTime,endTime);
|
||||||
|
ordersIPage = ordersDao.selectDividedIntoDetails(pages, userId,startTime,endTime,isSfwc);
|
||||||
//当期加钟率:本周期内,加钟数/本单数
|
//当期加钟率:本周期内,加钟数/本单数
|
||||||
String jzl = ordersDao.selectOrdersArtificerIntegraladdNum(userId, endTime, startTime);
|
String jzl = ordersDao.selectOrdersArtificerIntegraladdNum(userId, endTime, startTime);
|
||||||
//加钟数
|
//加钟数
|
||||||
|
@ -704,17 +707,17 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
||||||
System.out.println(currentPeriodOrdersSumBig+"=========="+num+"---"+clockRate);
|
System.out.println(currentPeriodOrdersSumBig+"=========="+num+"---"+clockRate);
|
||||||
}else if(orderType == 3){//3充值
|
}else if(orderType == 3){//3充值
|
||||||
ordersIPage = ordersDao.getChongzhiList(pages, userId,isSfwc,startTime,endTime);
|
ordersIPage = ordersDao.getChongzhiList(pages, userId,isSfwc,startTime,endTime);
|
||||||
|
|
||||||
//当前周期充值率(本周期内充值订单数/本单数)
|
//当前周期充值率(本周期内充值订单数/本单数)
|
||||||
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(userId, endTime, startTime);
|
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(userId, endTime, startTime,1);
|
||||||
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
||||||
BigDecimal divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
BigDecimal divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
|
||||||
divide1 = divide1.multiply(cy100);
|
divide1 = divide1.multiply(cy100);
|
||||||
earnings = divide1.intValue()+"%";
|
earnings = divide1.intValue()+"%";
|
||||||
System.out.println(currentPeriodOrdersSumBig+"=========="+c+"---"+divide1);
|
System.out.println(currentPeriodOrdersSumBig+"=========="+c+"---"+divide1);
|
||||||
}else if(orderType == 4){//业绩
|
}else if(orderType == 4){//业绩
|
||||||
ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
|
// ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
|
||||||
int yeji = ordersDao.selectOrdersArtificerIntegralEarnings(userId, endTime, startTime);
|
ordersIPage = ordersDao.selectDividedIntoDetails(pages, userId,startTime,endTime,null);
|
||||||
|
int yeji = ordersDao.selectOrdersArtificerIntegralAchievement(userId, endTime, startTime);
|
||||||
earnings = yeji+"";
|
earnings = yeji+"";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6667,20 +6667,24 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public Result selectDividedIntoDetails(Integer page, Integer limit, Period period) {
|
public Result selectDividedIntoDetails(Integer page, Integer limit, Period period) {
|
||||||
IPage<Orders> page1 = new Page(page, limit);
|
Page<Orders> page1 = new Page(page, limit);
|
||||||
QueryWrapper<Orders> queryWrapper = new QueryWrapper();
|
// QueryWrapper<Orders> queryWrapper = new QueryWrapper();
|
||||||
queryWrapper.eq("artificer_id", period.getArtificerId());
|
// queryWrapper.eq("artificer_id", period.getArtificerId());
|
||||||
if(StringUtil.isNotEmpty(period.getStartFundData().toString())){
|
// if(StringUtil.isNotEmpty(period.getStartFundData().toString())){
|
||||||
queryWrapper.between("end_times", period.getStartFundData(), period.getEndFundData());
|
// queryWrapper.between("end_times", period.getStartFundData(), period.getEndFundData());
|
||||||
}
|
// }
|
||||||
//只查询已完成和待评价的订单
|
// //只查询已完成和待评价的订单
|
||||||
queryWrapper.in("status", Arrays.asList(5, 3));
|
// queryWrapper.in("status", Arrays.asList(5, 3));
|
||||||
//只查询根节点数据
|
// //只查询根节点数据
|
||||||
queryWrapper.eq("parent_id", 0);
|
// queryWrapper.eq("parent_id", 0);
|
||||||
queryWrapper.orderByDesc("end_times");
|
// queryWrapper.orderByDesc("end_times");
|
||||||
IPage<Orders> page2 = baseMapper.selectPage(page1, queryWrapper);
|
// IPage<Orders> page2 = baseMapper.selectPage(page1, queryWrapper);
|
||||||
//分成明细添加到返回对象中
|
// //分成明细添加到返回对象中
|
||||||
return Result.success().put("data", page2);
|
// return Result.success().put("data", page2);
|
||||||
|
String startFundData = DateUtils.format(period.getStartFundData());
|
||||||
|
String endFundData = DateUtils.format(period.getEndFundData());
|
||||||
|
return Result.success().put("data", baseMapper.selectDividedIntoDetails(page1,Long.valueOf(period.getArtificerId()),startFundData,endFundData,0));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -762,6 +762,73 @@
|
||||||
order by serve_time desc
|
order by serve_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectDividedIntoDetails" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
|
select o.*,
|
||||||
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
||||||
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
||||||
|
(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
|
||||||
|
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.artificer_id = #{artificerId}
|
||||||
|
and 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') >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null and endTime!=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 0">
|
||||||
|
and ifnull(o.add_num,0) = 0
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 1">
|
||||||
|
and o.add_num > 0
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.*,
|
||||||
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
||||||
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
||||||
|
o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total
|
||||||
|
from orders o
|
||||||
|
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.artificer_id = #{artificerId}
|
||||||
|
and 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') >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null and endTime!=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 0">
|
||||||
|
and ifnull(o.add_num,0) = 0
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 1">
|
||||||
|
and o.add_num > 0
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
order by serve_time desc
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="selectArtificerOrder" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="selectArtificerOrder" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select o.*,a.artificer_name as artificerName,a.artificer_img as artificerImg,a.user_id as artificerUserId
|
select o.*,a.artificer_name as artificerName,a.artificer_img as artificerImg,a.user_id as artificerUserId
|
||||||
from orders o
|
from orders o
|
||||||
|
@ -1038,80 +1105,281 @@
|
||||||
FROM tb_user u
|
FROM tb_user u
|
||||||
WHERE date_format(DATE_ADD(u.create_time, INTERVAL 7 DAY ), '%Y-%m-%d') >= date_format(now(),'%Y-%m-%d')) a
|
WHERE date_format(DATE_ADD(u.create_time, INTERVAL 7 DAY ), '%Y-%m-%d') >= date_format(now(),'%Y-%m-%d')) a
|
||||||
</select>
|
</select>
|
||||||
<!--当期业绩-->
|
<!--当期业绩-->
|
||||||
|
<select id="selectOrdersArtificerIntegralAchievement" resultType="java.lang.Integer">
|
||||||
|
select IFNULL(SUM(price_total),0) AS currentAchievement
|
||||||
|
from (
|
||||||
|
select o.*,
|
||||||
|
(
|
||||||
|
(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.artificer_id = #{artificerId}
|
||||||
|
and o.old_orders_id is not null
|
||||||
|
and o.status not in (4,11,15)
|
||||||
|
<if test="startDate!=null and startDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.*,
|
||||||
|
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.artificer_id = #{artificerId}
|
||||||
|
and 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="startDate!=null and startDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
) t
|
||||||
|
</select>
|
||||||
|
<!--当期收益-->
|
||||||
<select id="selectOrdersArtificerIntegralEarnings" resultType="java.lang.Integer">
|
<select id="selectOrdersArtificerIntegralEarnings" resultType="java.lang.Integer">
|
||||||
select
|
select IFNULL(SUM(artificer_money_total),0) AS currentEarnings
|
||||||
IFNULL( SUM(o.price ),0) AS currentPerformance
|
from (
|
||||||
from orders o
|
select (case when o.status = 4
|
||||||
left join artificer a on a.artificer_id=o.artificer_id
|
then o.artificer_money + ifnull(o.add_artificer_money,0)
|
||||||
left join tb_user u on u.user_id=o.user_id
|
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)
|
||||||
left join consortia c on c.consortia_id=o.consortia_id
|
end) as artificer_money_total
|
||||||
where o.artificer_id=#{artificerId}
|
from orders o
|
||||||
<if test="startDate!=null and startDate !=''">
|
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||||
and o.end_times >= #{startDate}
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||||
</if>
|
where o.artificer_id = #{artificerId}
|
||||||
<if test="endDate!=null and endDate !=''">
|
and o.old_orders_id is not null
|
||||||
and o.end_times <= #{endDate}
|
and o.status not in (4,11,15)
|
||||||
</if>
|
<if test="startDate!=null and startDate !=''">
|
||||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate}-->
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
and o.status in (3,5)
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total
|
||||||
|
from orders o
|
||||||
|
where o.artificer_id = #{artificerId}
|
||||||
|
and 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="startDate!=null and startDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
) t
|
||||||
</select>
|
</select>
|
||||||
<!-- 订单数-->
|
<!-- 订单数-->
|
||||||
<select id="selectOrdersArtificerIntegral" resultType="java.lang.String">
|
<select id="selectOrdersArtificerIntegral" resultType="java.lang.String">
|
||||||
select
|
select IFNULL( count(*),'0') AS currentPeriodOrdersSum
|
||||||
IFNULL( count(o.orders_id ),'0') AS currentPeriodOrdersSum
|
from (
|
||||||
from orders o
|
select (case when o.status = 4
|
||||||
left join artificer a on a.artificer_id=o.artificer_id
|
then o.artificer_money + ifnull(o.add_artificer_money,0)
|
||||||
left join tb_user u on u.user_id=o.user_id
|
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)
|
||||||
left join consortia c on c.consortia_id=o.consortia_id
|
end) as artificer_money_total
|
||||||
where o.artificer_id=#{artificerId}
|
from orders o
|
||||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate}-->
|
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||||
<if test="startDate!=null and startDate !=''">
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||||
and o.end_times >= #{startDate}
|
where o.artificer_id = #{artificerId}
|
||||||
</if>
|
and o.old_orders_id is not null
|
||||||
<if test="endDate!=null and endDate !=''">
|
and o.status not in (4,11,15)
|
||||||
and o.end_times <= #{endDate}
|
<if test="startDate!=null and startDate !=''">
|
||||||
</if>
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
and o.status in (3,5)
|
</if>
|
||||||
and o.parent_id = 0
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total
|
||||||
|
from orders o
|
||||||
|
where o.artificer_id = #{artificerId}
|
||||||
|
and 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="startDate!=null and startDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
) t
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<!-- 加钟率-->
|
<!-- 加钟率-->
|
||||||
<select id="selectOrdersArtificerIntegraladdNum" resultType="java.lang.String">
|
<select id="selectOrdersArtificerIntegraladdNum" resultType="java.lang.String">
|
||||||
select
|
select IFNULL(count(*),0) AS currentPeriodAddBellsSum
|
||||||
IFNULL( count(o.add_num ),'0') AS currentPeriodAddBellsSum
|
from (
|
||||||
from orders o
|
select o.*
|
||||||
left join artificer a on a.artificer_id=o.artificer_id
|
from orders o
|
||||||
left join tb_user u on u.user_id=o.user_id
|
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||||
left join consortia c on c.consortia_id=o.consortia_id
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||||
where o.artificer_id=#{artificerId}
|
where o.artificer_id = #{artificerId}
|
||||||
<if test="startDate!=null and startDate !=''">
|
and o.old_orders_id is not null
|
||||||
and o.end_times >= #{startDate}
|
and o.status not in (4,11,15)
|
||||||
</if>
|
and o.add_num > 0
|
||||||
<if test="endDate!=null and endDate !=''">
|
<if test="startDate!=null and startDate !=''">
|
||||||
and o.end_times <= #{endDate}
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
</if>
|
</if>
|
||||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate} -->
|
<if test="endDate!=null and endDate !=''">
|
||||||
and o.parent_id = 0
|
and date_format(o.end_times,'%Y-%m-%d') <= #{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.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') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
) t
|
||||||
</select>
|
</select>
|
||||||
<!-- 充值率-->
|
<!-- 充值率-->
|
||||||
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
|
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
|
||||||
select
|
select IFNULL( count(*),'0') AS currentPeriodRechargeSum
|
||||||
IFNULL( count(user_recharge ),'0') AS currentPeriodRechargeSum
|
from (
|
||||||
from orders o
|
select o.*,
|
||||||
left join artificer a on a.artificer_id=o.artificer_id
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
||||||
left join tb_user u on u.user_id=o.user_id
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
||||||
left join consortia c on c.consortia_id=o.consortia_id
|
(case when o.status = 4
|
||||||
left join user_recharge uu on uu.orders_id = o.orders_id
|
then o.artificer_money + ifnull(o.add_artificer_money,0)
|
||||||
where o.artificer_id=#{artificerId}
|
else o.artificer_money + ifnull(o.add_artificer_money,0) + ifnull(o2.artificer_money,0) +
|
||||||
<if test="startDate!=null and startDate !=''">
|
ifnull(o2.add_artificer_money,0) + ifnull(o3.artificer_money,0) + ifnull(o3.add_artificer_money,0)
|
||||||
and o.end_times >= #{startDate}
|
end) as artificer_money_total
|
||||||
</if>
|
from orders o
|
||||||
<if test="endDate!=null and endDate !=''">
|
left join orders o2 on o.old_orders_id = o2.orders_id and o2.status != 4
|
||||||
and o.end_times <= #{endDate}
|
left join orders o3 on o2.old_orders_id = o3.orders_id and o3.status != 4
|
||||||
</if>
|
left join orders_massage om on om.orders_id=o.orders_id
|
||||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate} -->
|
left join massage_type m on m.massage_type_id=om.massage_id
|
||||||
and o.parent_id = 0
|
LEFT JOIN bl_user_package_detail bl ON bl.id = om.massage_id
|
||||||
and uu.type = 2
|
where o.artificer_id = #{artificerId}
|
||||||
|
and o.old_orders_id is not null
|
||||||
|
and o.status not in (4,11,15)
|
||||||
|
<if test="startDate!=null and startDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 0">
|
||||||
|
and o.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
and (
|
||||||
|
case when o2.orders_id is not null then
|
||||||
|
o2.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
else 1=1 end)
|
||||||
|
and (
|
||||||
|
case when o3.orders_id is not null then
|
||||||
|
o3.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
else 1=1 end)
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 1">
|
||||||
|
and (o.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
or o2.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
or o3.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.*,
|
||||||
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
||||||
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
||||||
|
o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total
|
||||||
|
from orders o
|
||||||
|
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.artificer_id = #{artificerId}
|
||||||
|
and 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="startDate!=null and startDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate!=null and endDate !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endDate}
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 0">
|
||||||
|
and o.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 1">
|
||||||
|
and o.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and
|
||||||
|
type = '2' and orders_id is not null)
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
) t
|
||||||
</select>
|
</select>
|
||||||
<!-- 储值积分数-->
|
<!-- 储值积分数-->
|
||||||
<select id="selectOrdersStoredValueIntegral" resultType="java.lang.String">
|
<select id="selectOrdersStoredValueIntegral" resultType="java.lang.String">
|
||||||
|
@ -1176,7 +1444,6 @@
|
||||||
and o.status in (3,5,15)
|
and o.status in (3,5,15)
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getDangqiList" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getDangqiList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select a.*,b.massage_img from orders a
|
select a.*,b.massage_img from orders a
|
||||||
left join massage_type b on a.massage_type_id = b.massage_type_id
|
left join massage_type b on a.massage_type_id = b.massage_type_id
|
||||||
|
@ -1201,47 +1468,170 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getChongzhiList" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getChongzhiList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select
|
<!-- select-->
|
||||||
o.*,uu.user_recharge as userRecharge,b.massage_img
|
<!-- o.*,uu.user_recharge as userRecharge,b.massage_img-->
|
||||||
from orders o
|
<!-- from orders o-->
|
||||||
left join artificer a on a.artificer_id=o.artificer_id
|
<!-- left join artificer a on a.artificer_id=o.artificer_id-->
|
||||||
left join user_recharge uu on uu.orders_id = o.orders_id
|
<!-- left join user_recharge uu on uu.orders_id = o.orders_id-->
|
||||||
left join massage_type b on o.massage_type_id = b.massage_type_id
|
<!-- left join massage_type b on o.massage_type_id = b.massage_type_id-->
|
||||||
where o.artificer_id=#{userId} and o.parent_id = 0
|
<!-- where o.artificer_id=#{userId} and o.parent_id = 0-->
|
||||||
and o.status in (3,5,15)
|
<!-- and o.status in (3,5,15)-->
|
||||||
and o.end_times BETWEEN #{startTime} and #{endTime}
|
<!-- and o.end_times BETWEEN #{startTime} and #{endTime}-->
|
||||||
<if test="isSfwc != null and isSfwc == 0">
|
<!-- <if test="isSfwc != null and isSfwc == 0">-->
|
||||||
and uu.type is null
|
<!-- and uu.type is null-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
<if test="isSfwc != null and isSfwc == 1">
|
<!-- <if test="isSfwc != null and isSfwc == 1">-->
|
||||||
and uu.type = 2
|
<!-- and uu.type = 2-->
|
||||||
</if>
|
<!-- </if>-->
|
||||||
|
select o.*,
|
||||||
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
||||||
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
||||||
|
(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
|
||||||
|
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.artificer_id = #{artificerId}
|
||||||
|
and 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') >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null and endTime!=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 0">
|
||||||
|
and o.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
and (
|
||||||
|
case when o2.orders_id is not null then
|
||||||
|
o2.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
else 1=1 end)
|
||||||
|
and (
|
||||||
|
case when o3.orders_id is not null then
|
||||||
|
o3.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
else 1=1 end)
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 1">
|
||||||
|
and (o.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
or o2.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
or o3.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.*,
|
||||||
|
(case when o.user_package_detail_id is null then m.title else bl.title end ) as title,
|
||||||
|
(case when o.user_package_detail_id is null then m.massage_img else bl.massage_img end ) as massageImg,
|
||||||
|
o.artificer_money + ifnull(o.add_artificer_money,0) as artificer_money_total
|
||||||
|
from orders o
|
||||||
|
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.artificer_id = #{artificerId}
|
||||||
|
and 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') >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null and endTime!=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 0">
|
||||||
|
and o.orders_id not in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
</if>
|
||||||
|
<if test="isSfwc != null and isSfwc == 1">
|
||||||
|
and o.orders_id in (select distinct orders_id from user_recharge where artificer_id = #{artificerId} and type = '2' and orders_id is not null)
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
order by serve_time desc
|
||||||
</select>
|
</select>
|
||||||
<!-- 获取业绩积分-->
|
<!-- 获取业绩积分-->
|
||||||
<select id="getYjjfList" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getYjjfList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select a.*,a.price as jifen,a.end_times as jftime,b.massage_img from orders a
|
select t.*,price_total AS jifen
|
||||||
left join massage_type b on a.massage_type_id = b.massage_type_id
|
from (
|
||||||
where a.status in (3,5,15)
|
select o.*,
|
||||||
and a.artificer_id = ${userId}
|
(
|
||||||
and a.end_times BETWEEN #{startTime} and #{endTime}
|
(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.artificer_id = ${userId}
|
||||||
|
and 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') >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endTime}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
union all
|
||||||
|
select o.*,
|
||||||
|
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.artificer_id = ${userId}
|
||||||
|
and 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') >= #{startTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime!=null and endTime !=''">
|
||||||
|
and date_format(o.end_times,'%Y-%m-%d') <= #{endTime}
|
||||||
|
</if>
|
||||||
|
and o.status in (3,5)
|
||||||
|
) t
|
||||||
</select>
|
</select>
|
||||||
<!-- 获取储值积分(为他充值的)-->
|
<!-- 获取储值积分(为他充值的)-->
|
||||||
<select id="getCzjfList" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getCzjfList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select id,user_recharge as jifen,create_time as jftime from user_recharge
|
select id,user_recharge as jifen,create_time as jftime from user_recharge
|
||||||
where type = 2 and orders_id is null
|
where type = 2
|
||||||
|
and orders_id is null
|
||||||
and artificer_id = ${userId}
|
and artificer_id = ${userId}
|
||||||
and create_time BETWEEN #{startTime} and #{endTime}
|
and create_time BETWEEN #{startTime} and #{endTime}
|
||||||
</select>
|
</select>
|
||||||
<!-- 获取订单充值积分-->
|
<!-- 获取订单充值积分-->
|
||||||
<select id="getDdczList" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getDdczList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select id,user_recharge as jifen,a.create_time as jftime,b.* from user_recharge a , orders b
|
select id,user_recharge as jifen,create_time as jftime
|
||||||
where a.orders_id = b.orders_id and type = 2
|
from user_recharge
|
||||||
and a.artificer_id =${userId}
|
where type = 2
|
||||||
and a.create_time BETWEEN #{startTime} and #{endTime}
|
and orders_id is not null
|
||||||
|
and artificer_id =${userId}
|
||||||
|
and create_time BETWEEN #{startTime} and #{endTime}
|
||||||
</select>
|
</select>
|
||||||
<!-- 获取在线时长积分-->
|
<!-- 获取在线时长积分-->
|
||||||
<select id="getZxscList" resultType="com.sqx.modules.artificer.entity.Orders">
|
<select id="getZxscList" resultType="com.sqx.modules.artificer.entity.Orders">
|
||||||
select id,sum(user_recharge) as jifen,DATE_FORMAT(create_time,'%Y-%m-%d') as jftime from user_recharge
|
select id,sum(user_recharge) as jifen,DATE_FORMAT(create_time,'%Y-%m-%d') as jftime
|
||||||
|
from user_recharge
|
||||||
where type = 1
|
where type = 1
|
||||||
and artificer_id =${userId}
|
and artificer_id =${userId}
|
||||||
and create_time BETWEEN #{startTime} and #{endTime}
|
and create_time BETWEEN #{startTime} and #{endTime}
|
||||||
|
|
Loading…
Reference in New Issue