diff --git a/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerServiceImpl.java b/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerServiceImpl.java index d6ee979..05ea9ac 100644 --- a/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerServiceImpl.java +++ b/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerServiceImpl.java @@ -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 i Map map = new HashMap(); Page pages=new Page<>(page,limit); IPage 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); diff --git a/src/main/java/com/sqx/modules/task/service/impl/AllTaskServiceImpl.java b/src/main/java/com/sqx/modules/task/service/impl/AllTaskServiceImpl.java index 5cb57eb..8084170 100644 --- a/src/main/java/com/sqx/modules/task/service/impl/AllTaskServiceImpl.java +++ b/src/main/java/com/sqx/modules/task/service/impl/AllTaskServiceImpl.java @@ -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.获取全部参与积分规则的技师 diff --git a/src/main/resources/mapper/artificer/OrdersDao.xml b/src/main/resources/mapper/artificer/OrdersDao.xml index 9707f85..d68fb83 100644 --- a/src/main/resources/mapper/artificer/OrdersDao.xml +++ b/src/main/resources/mapper/artificer/OrdersDao.xml @@ -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 @@ -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