添加首页流水记录统计

This commit is contained in:
yangjun 2024-06-27 16:14:04 +08:00
parent 63b58ac6b7
commit 5dfaeef8f1
3 changed files with 33 additions and 10 deletions

View File

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
@ -449,16 +450,39 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
Map<String, Object> map = new HashMap<String, Object>();
Page<Orders> pages=new Page<>(page,limit);
IPage<Orders> ordersIPage = null;
//当期订单数计算订单发生了按摩行为的订单数订单状态经历了开始服务到订单结束
String currentPeriodOrdersSum = ordersDao.selectOrdersArtificerIntegral(userId, endTime, startTime);
//订单数
BigDecimal currentPeriodOrdersSumBig = new BigDecimal(currentPeriodOrdersSum);
//查询收益
String earnings = "0";
BigDecimal cy100 = new BigDecimal(100);
if(orderType == 1){//1当期
ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
earnings = ordersDao.earnings(userId, endTime, startTime);
}else if(orderType == 2){//2加钟
//查询列表
ordersIPage = ordersDao.getJiazhongList(pages, userId,isSfwc,startTime,endTime);
//当期加钟率本周期内加钟数/本单数
String jzl = ordersDao.selectOrdersArtificerIntegraladdNum(userId, endTime, startTime);
//加钟数
BigDecimal num = new BigDecimal(jzl);
BigDecimal clockRate = num.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
clockRate = clockRate.multiply(cy100);
earnings = clockRate.intValue()+"%";
System.out.println(currentPeriodOrdersSumBig+"=========="+num+"---"+clockRate);
}else if(orderType == 3){//3充值
ordersIPage = ordersDao.getChongzhiList(pages, userId,isSfwc,startTime,endTime);
//当前周期充值率(本周期内充值订单数/本单数)
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(userId, endTime, startTime);
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
BigDecimal divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);
divide1 = divide1.multiply(cy100);
earnings = divide1.intValue()+"%";
System.out.println(currentPeriodOrdersSumBig+"=========="+c+"---"+divide1);
}
//查询收益
String earnings = ordersDao.earnings(userId, endTime, startTime);
map.put("data",new PageUtils(ordersIPage));
map.put("earnings",earnings);
return Result.success(map);

View File

@ -60,8 +60,8 @@ public class AllTaskServiceImpl implements AllTaskSercice {
* 计算技师升级规则 每天半夜1点执行预留12点到01点之间的计算间隔用于触发其他计算逻辑
* A0,A1,A2,A3,A4,A5等
*/
// @Scheduled(cron = "0 0 0 * * ?")
@Scheduled(cron = "0 * * * * ?")
// @Scheduled(cron = "0 * * * * ?")
@Scheduled(cron = "0 0 0 * * ?")
public void upgradeJishi() {
System.out.println("------------计算技师升级规则-----------");
//1.获取全部参与积分规则的技师

View File

@ -938,7 +938,7 @@
left join tb_user u on u.user_id=o.user_id
left join consortia c on c.consortia_id=o.consortia_id
where o.artificer_id=#{artificerId}
and o.end_times BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate} and o.parent_id = 0
</select>
<!-- 充值率-->
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
@ -950,7 +950,7 @@
left join consortia c on c.consortia_id=o.consortia_id
left join user_recharge uu on uu.orders_id = o.orders_id
where o.artificer_id=#{artificerId}
and o.end_times BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate} and o.parent_id = 0
and uu.type = 2
</select>
<!-- 储值积分数-->
@ -1016,14 +1016,14 @@
select * from orders
where status in (3,5)
and artificer_id = ${userId}
and end_times BETWEEN #{startTime} and #{endTime}
and end_times BETWEEN #{startTime} and #{endTime} and parent_id = 0
</select>
<select id="getJiazhongList" resultType="com.sqx.modules.artificer.entity.Orders">
select * from orders
where status in (3,5)
and artificer_id = ${userId}
and end_times BETWEEN #{startTime} and #{endTime}
and end_times BETWEEN #{startTime} and #{endTime} and parent_id = 0
<if test="isSfwc != null and isSfwc == 0">
and (add_num = 0 or add_num is null)
</if>
@ -1038,10 +1038,9 @@
from orders o
left join artificer a on a.artificer_id=o.artificer_id
left join user_recharge uu on uu.orders_id = o.orders_id
where o.artificer_id=#{userId}
where o.artificer_id=#{userId} and o.parent_id = 0
and o.status in (3,5)
and o.end_times BETWEEN #{startTime} and #{endTime}
<if test="isSfwc != null and isSfwc == 0">
and uu.type is null
</if>