技师业绩调整

This commit is contained in:
曹磊 2024-08-22 22:33:26 +08:00
parent 6ab2953c21
commit ad6dad7ec5
11 changed files with 140 additions and 21 deletions

View File

@ -124,6 +124,15 @@ public class ArtificerController {
sort,authentication,by,status,city,classifyId,phone,null,isStart,technicianType,isBack,isGoods);
}
@GetMapping("/selectArtificerListPc")
@ApiOperation("查询技师列表PC端")
public Result selectArtificerListPc(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 isGoods){
return artificerService.selectArtificerListPc(page, limit, massageTypeId, artificerName,longitude,latitude,
sort,authentication,by,status,city,classifyId,phone,null,isStart,technicianType,isBack,isGoods);
}
@GetMapping("/selectArtificer")
@ApiOperation("查询技师列表(不带分页)")
public Result selectArtificer(String city,String classifyId,String artificerName){

View File

@ -84,6 +84,8 @@ public interface OrdersDao extends BaseMapper<Orders> {
List<Orders> selectOrdersStatusByTime(String time);
List<Orders> selectNotAcceptedOrders(String time);
IPage<Map<String,Object>> selectShopMoney(Page<Orders> page,String userName,String phone,String flag,String time);
IPage<Map<String,Object>> selectOneUserMoney(Page<Orders> page,String userName,String phone,String flag,String time);

View File

@ -17,6 +17,10 @@ public interface ArtificerService extends IService<Artificer> {
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 isGoods);
Result selectArtificerListPc(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 isGoods);
Artificer selectArtificerById(Long userId,Long artificerId,String longitude,String latitude);
Artificer selectArtificerByUserId(Long userId);

View File

@ -20,11 +20,14 @@ import com.sqx.modules.artificer.service.AppArtificerIntegralService;
import com.sqx.modules.artificer.vo.HomeVO;
import com.sqx.modules.artificer.vo.UserArtificerVO;
import com.sqx.modules.bl.artificer.dao.ArtificerPartitioningDetailsDao;
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
import com.sqx.modules.bl.artificer.entity.ArtificerPartitioningDetails;
import com.sqx.modules.bl.artificer.service.ArtificerIntegralStatisticsService;
import com.sqx.modules.common.dao.CommonInfoDao;
import com.sqx.modules.common.entity.CommonInfo;
import lombok.AllArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -45,7 +48,8 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
private final CommonInfoDao commonInfoDao;
private final ArtificerDao artificerDao;
private final UserDao userDao;
@Autowired
ArtificerIntegralStatisticsService artificerIntegralStatisticsService;
@Override
public Result home(Long artificerId) {
@ -63,22 +67,28 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
}
orders.setGrade(grade);
ArtificerIntegralStatistics artificerIntegralStatistics =artificerIntegralStatisticsService.getIntegralStatistics(artificerId,startDate,endDate,null);
//当期业绩
Integer currentPerformance = ordersDao.selectOrdersArtificerIntegralAchievement(artificerId, endDate, startDate);
// Integer currentPerformance = ordersDao.selectOrdersArtificerIntegralAchievement(artificerId, endDate, startDate);
BigDecimal currentPerformance = artificerIntegralStatistics.getAchievement();
orders.setCurrentPerformance(String.valueOf(currentPerformance));
//当期收益
// String earnings = ordersDao.earnings(artificerId, endDate, startDate);
BigDecimal earnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endDate, startDate);
earnings = earnings.setScale(2,BigDecimal.ROUND_HALF_UP);
orders.setEarnings(earnings.toString());
// BigDecimal earnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endDate, startDate);
// earnings = earnings.setScale(2,BigDecimal.ROUND_HALF_UP);
// orders.setEarnings(earnings.toString());
BigDecimal earnings = artificerIntegralStatistics.getIncome();
orders.setEarnings(String.valueOf(earnings));
//当日收益
String todayEndIncome = DateUtil.formatDateTime(DateUtil.endOfDay(new Date()));
// String dailyEarnings = ordersDao.earnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
BigDecimal dailyEarnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
dailyEarnings = dailyEarnings.setScale(2,BigDecimal.ROUND_HALF_UP);
orders.setDailyEarnings(dailyEarnings.toString());
// BigDecimal dailyEarnings = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, todayEndIncome, String.valueOf(DateUtil.beginOfDay(new Date())));
// dailyEarnings = dailyEarnings.setScale(2,BigDecimal.ROUND_HALF_UP);
// orders.setDailyEarnings(dailyEarnings.toString());
ArtificerIntegralStatistics todayStatistics =artificerIntegralStatisticsService.getIntegralStatistics(artificerId,startDate,todayEndIncome,null);
orders.setDailyEarnings(String.valueOf(todayStatistics.getIncome()));
//当月收益
//当月结束日
@ -103,14 +113,17 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
// BigDecimal add = a.add(b);
//获取所有积分方法
Map<String,Object> jfMap = getJifenList(artificerId, startDate, endDate);
String zxjf = jfMap.get("zxscjf").toString();
// Map<String,Object> jfMap = getJifenList(artificerId, startDate, endDate);
// String zxjf = jfMap.get("zxscjf").toString();
// BigDecimal b = new BigDecimal(zxjf);
//当前周在线积分数
BigDecimal b = new BigDecimal(zxjf);
ArtificerIntegralStatistics zxjfStatistics =artificerIntegralStatisticsService.getIntegralStatistics(artificerId,startDate,todayEndIncome,1);
BigDecimal b = zxjfStatistics.getIntegral();
//总积分
String sumJf = jfMap.get("sumJf").toString();
BigDecimal add = new BigDecimal(sumJf);
// String sumJf = jfMap.get("sumJf").toString();
// BigDecimal add = new BigDecimal(sumJf);
BigDecimal add = artificerIntegralStatistics.getIntegral();
orders.setIntegral(add);
//当期订单数计算订单发生了按摩行为的订单数订单状态经历了开始服务到订单结束
@ -147,21 +160,21 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
//业绩后面的显示
List<ArtificerPartitioningDetails> lists = artificerPartitioningDetailsDao.selectList(Wrappers.<ArtificerPartitioningDetails>lambdaQuery());
for (int i = 0; i < lists.size(); i++) {
if (currentPerformance >= lists.get(i).getOutstandingAchievement().intValue()) {
if (currentPerformance.compareTo(lists.get(i).getOutstandingAchievement())>=0) {
if (i + 1 < lists.size()) {
BigDecimal bigDecimal = lists.get(i + 1).getOutstandingAchievement();
if (Objects.nonNull(bigDecimal)) {
orders.setSuffix(NumberUtil.toStr(bigDecimal));
}
}
} else if (currentPerformance <= lists.get(i).getOutstandingAchievement().intValue()) {
} else if (currentPerformance.compareTo(lists.get(i).getOutstandingAchievement())<=0) {
orders.setSuffix(NumberUtil.toStr(artificerPartitioningDetailsDao.selectById(5).getOutstandingAchievement()));
}
}
return getResult(currentPerformance, clockRate, divide1, b, add, orders, artificer, classifyId);
}
private Result getResult(Integer currentPerformance, BigDecimal clockRate, BigDecimal divide1, BigDecimal b, BigDecimal add, HomeVO orders, Artificer artificer, String classifyId) {
private Result getResult(BigDecimal currentPerformance, BigDecimal clockRate, BigDecimal divide1, BigDecimal b, BigDecimal add, HomeVO orders, Artificer artificer, String classifyId) {
List<ArtificerPartitioningDetails> artificerPartitioningDetails = artificerPartitioningDetailsDao.selectList(Wrappers.<ArtificerPartitioningDetails>lambdaQuery()
.ne(ArtificerPartitioningDetails::getGrade, "A0"));
@ -186,14 +199,14 @@ public class AppArtificerIntegralServiceImpl implements AppArtificerIntegralServ
ArtificerPartitioningDetails items = artificerPartitioningDetails.get(i + 1);
if (currentPerformance >= outstandingAchievement.intValue()
if (currentPerformance.compareTo(outstandingAchievement)>=0
&& clockRate.compareTo(clockRate1) > -1
&& divide1.compareTo(depositRate) > -1
&& b.intValue() >= durationOnline
&& add.intValue() >= Integer.valueOf(integral)
&& Objects.nonNull(items)
) {
BigDecimal p1 = new BigDecimal(currentPerformance);
BigDecimal p1 = currentPerformance;
//还差多少业绩加钟率积分提升等级
BigDecimal siq = new BigDecimal(items.getOutstandingAchievement().toString());

View File

@ -332,7 +332,63 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
}
}
}
return Result.success().put("data",new PageUtils(artificerIPage));
}
@Override
public Result selectArtificerListPc(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 isGoods){
Page<Artificer> pages=new Page<>(page,limit);
if(StringUtils.isEmpty(longitude)){
longitude = "125.430896";
}
if(StringUtils.isEmpty(latitude)){
latitude = "43.880798";
}
if(StringUtils.isEmpty(city)||StringUtils.equals("请选择城市",city)){
city = "长春市";
}
List<Long> userIdList = new ArrayList<>();
if(classifyId!=null && !classifyId.equals("")){
String[] classifyIdArr = classifyId.split(",");
List<Long> classifyIdList = new ArrayList<>();
if(classifyIdArr.length>0){
for(int i=0;i<classifyIdArr.length;i++){
String classifyIdStr = classifyIdArr[i];
Long classifyIdL = Long.valueOf(classifyIdStr);
classifyIdList.add(classifyIdL);
}
}
if(classifyIdList.size()>0){
userIdList = artificerClassifyService.getUserIdByClassify(classifyIdList);
}
}
IPage<Artificer> artificerIPage = baseMapper.selectArtificerList(pages, massageTypeId, artificerName,
longitude, latitude, sort, authentication, by, status, city, classifyId,phone,user,isStart,technicianType,isBack,userIdList,isGoods);
List<Artificer> records = artificerIPage.getRecords();
for(Artificer artificer:records){
String classifyIds = artificer.getClassifyId();
String[] classifyArr = classifyIds.split(",");
if(classifyArr.length>0){
List<ArtificerClassify> artificerClassifyList = new ArrayList<ArtificerClassify>();
for(int i=0;i<classifyArr.length;i++){
String classifyIdStr = classifyArr[i];
Long cid = Long.valueOf(classifyIdStr);
SysDictEntity sysDictEntity = sysDictService.getById(cid);
if(sysDictEntity!=null){
ArtificerClassify artificerClassify = new ArtificerClassify();
artificerClassify.setClassifyId(cid);
artificerClassify.setClassifyName(sysDictEntity.getValue());
artificerClassifyList.add(artificerClassify);
}
}
artificer.setArtificerClassifyList(artificerClassifyList);
}
}
return Result.success().put("data",new PageUtils(artificerIPage));
}

View File

@ -7818,6 +7818,17 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
baseMapper.updateById(ordersOld);//原单暂变成挂单状态
}
}
//超过服务时间N分钟未接单取消订单
String value2 = commonInfoService.findOne(465).getValue();
ordersList = baseMapper.selectNotAcceptedOrders(value2);
for (Orders orders : ordersList) {
if (orders.getUserPackageDetailId() != null) {
cancelPackageOrders(orders.getUserId(), orders, BigDecimal.ZERO, BigDecimal.ZERO);
} else {
cancelMassageOrders(orders.getUserId(), orders, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO);
}
}
}
@Override

View File

@ -6,5 +6,5 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ArtificerIntegralStatisticsDao extends BaseMapper<ArtificerIntegralStatistics> {
ArtificerIntegralStatistics getIntegralStatistics(Long artificerId,String startDate,String endDate,Integer classify);
}

View File

@ -4,5 +4,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
public interface ArtificerIntegralStatisticsService extends IService<ArtificerIntegralStatistics> {
ArtificerIntegralStatistics getIntegralStatistics(Long artificerId,String startDate,String endDate,Integer classify);
}

View File

@ -8,5 +8,7 @@ import org.springframework.stereotype.Service;
@Service
public class ArtificerIntegralStatisticsServiceImpl extends ServiceImpl<ArtificerIntegralStatisticsDao, ArtificerIntegralStatistics> implements ArtificerIntegralStatisticsService {
public ArtificerIntegralStatistics getIntegralStatistics(Long artificerId,String startDate,String endDate,Integer classify){
return baseMapper.getIntegralStatistics(artificerId,startDate,endDate,classify);
}
}

View File

@ -1042,6 +1042,10 @@
select * from orders where now()>= DATE_ADD( create_time, INTERVAL #{time} MINUTE ) and status=1
</select>
<select id="selectNotAcceptedOrders" resultType="com.sqx.modules.artificer.entity.Orders">
select * from orders where now()>= DATE_ADD( serve_time, INTERVAL #{time} MINUTE ) and status in (2,9)
</select>
<select id="selectShopMoney" resultType="Map">
select ifnull(sum(o.shop_money),0.00) as money,o.shop_user_name as userName,o.shop_user_id as userId
from orders o

View File

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao">
<select id="getIntegralStatistics" resultType="com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics">
select
sum(case when type = 1 then IFNULL(achievement,0) else -IFNULL(achievement,0) end) AS achievement,
sum(case when type = 1 then IFNULL(income,0) else -IFNULL(income,0) end) AS income,
sum(case when type = 1 then IFNULL(integral,0) else -IFNULL(integral,0) end) AS integral
from bl_artificer_integral_statistics
where artificer_id = #{artificerId}
and date_format(create_time,'%Y-%m-%d %H:%i:%s') >= #{startDate}
and date_format(create_time,'%Y-%m-%d %H:%i:%s') &lt;= #{endDate}
<if test="classify!=null">
and classify = #{classify}
</if>
</select>
</mapper>