提交 574f762a authored 作者: aiqingguo's avatar aiqingguo

承运结算单建表

上级 b0dd1f3d
......@@ -2,6 +2,7 @@ package com.clx.performance.controller.pc;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.IntegralTruckAddParam;
import com.clx.performance.param.pc.PageIntegralTruckRankParam;
import com.clx.performance.param.pc.PageIntegralTruckParam;
import com.clx.performance.service.IntegralTruckService;
import com.clx.performance.vo.pc.IntegralTruckVO;
......@@ -67,4 +68,12 @@ public class IntegralTruckController {
return Result.ok(integralTruckService.getTruckCount(truckEchelon));
}
@ApiOperation(value = "获取车辆积分排名", notes = "<br>By:艾庆国")
@RequestMapping(value = "pageTruckRank", method = RequestMethod.POST)
public Result<PageData<IntegralTruckVO>> pageTruckRank(@RequestBody @Validated PageIntegralTruckRankParam param) {
IPage<IntegralTruckVO> page = integralTruckService.pageTruckRank(param);
return Result.page(page.getRecords(), page.getTotal(), page.getPages());
}
}
......@@ -31,4 +31,7 @@ public interface IntegralStatisticsDao extends BaseDao<IntegralStatisticsMapper,
List<IntegralStatistics> selectByStatisticsDate(@Param("statisticsDate")String statisticsDate);
List<IntegralStatistics> selectListByStatisticsDateAndTruckNoList(@Param("statisticsDate")String statisticsDate, @Param("list")List<String> truckNoList);
}
......@@ -3,6 +3,7 @@ package com.clx.performance.dao;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.mapper.IntegralTruckMapper;
import com.clx.performance.model.IntegralTruck;
import com.clx.performance.param.pc.PageIntegralTruckRankParam;
import com.clx.performance.param.pc.PageIntegralTruckParam;
import com.clx.performance.vo.pc.IntegralTruckVO;
import com.msl.common.base.Optional;
......@@ -32,4 +33,6 @@ public interface IntegralTruckDao extends BaseDao<IntegralTruckMapper, IntegralT
List<IntegralTruck> listByTruckNoList(@Param("truckNoList") List<String> truckNoList);
IPage<IntegralTruckVO> pageTruckRank(PageIntegralTruckRankParam param);
}
......@@ -67,4 +67,12 @@ public class IntegralStatisticsDaoImpl extends BaseDaoImpl<IntegralStatisticsMap
.eq(IntegralStatistics::getStatisticsDate, statisticsDate)
.orderByDesc(IntegralStatistics::getIntegral));
}
@Override
public List<IntegralStatistics> selectListByStatisticsDateAndTruckNoList(String statisticsDate, List<String> truckNoList) {
return list(lQrWrapper()
.eq(IntegralStatistics::getStatisticsDate, statisticsDate)
.in(IntegralStatistics::getTruckNo, truckNoList));
}
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.dao.IntegralTruckDao;
import com.clx.performance.mapper.IntegralTruckMapper;
import com.clx.performance.model.IntegralTruck;
import com.clx.performance.param.pc.PageIntegralTruckRankParam;
import com.clx.performance.param.pc.PageIntegralTruckParam;
import com.clx.performance.vo.pc.IntegralTruckVO;
import com.msl.common.base.Optional;
......@@ -70,4 +71,10 @@ public class IntegralTruckDaoImpl extends BaseDaoImpl<IntegralTruckMapper, Integ
return list(lQrWrapper().in(IntegralTruck::getTruckNo, truckNoList));
}
@Override
public IPage<IntegralTruckVO> pageTruckRank(PageIntegralTruckRankParam param) {
baseMapper.pageTruckRank(Page.of(param.getPage(), param.getPageSize()));
return null;
}
}
......@@ -34,4 +34,14 @@ public interface IntegralTruckMapper extends BaseMapper<IntegralTruck> {
@SelectProvider(type = IntegralTruckSqlProvider.class, method = "pageByParam")
IPage<IntegralTruckVO> pageByParam(@Param("page") Page<IntegralTruckVO> page, @Param("param") PageIntegralTruckParam param);
@Select("select id, truck_no, rank, " +
" id, truck_no, " +
" driver_name, driver_mobile, " +
" echelon, integral, rank, " +
" date_format(create_time, '%Y-%m-%d %H:%i:%s') as createTime, " +
" date_format(modified_time, '%Y-%m-%d %H:%i:%s') as modifiedTime " +
" from integral_truck " +
" order by integral desc, create_time desc ")
IPage<IntegralTruckVO> pageTruckRank(@Param("page") Page<IntegralTruckVO> page);
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package com.clx.performance.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.IntegralTruckAddParam;
import com.clx.performance.param.pc.PageIntegralTruckRankParam;
import com.clx.performance.param.pc.PageIntegralTruckParam;
import com.clx.performance.vo.pc.IntegralTruckVO;
......@@ -14,4 +15,6 @@ public interface IntegralTruckService {
IntegralTruckVO getTruckDriverInfo(String truckNo);
Integer getTruckCount(Integer truckEchelon);
IPage<IntegralTruckVO> pageTruckRank(PageIntegralTruckRankParam param);
}
......@@ -10,6 +10,7 @@ import com.clx.performance.model.IntegralStatistics;
import com.clx.performance.model.IntegralTruck;
import com.clx.performance.param.pc.IntegralTruckAddParam;
import com.clx.performance.param.pc.PageIntegralTruckParam;
import com.clx.performance.param.pc.PageIntegralTruckRankParam;
import com.clx.performance.service.IntegralMqService;
import com.clx.performance.service.IntegralRecordService;
import com.clx.performance.service.IntegralStatisticsService;
......@@ -23,6 +24,10 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Slf4j
@Service
@AllArgsConstructor
......@@ -114,4 +119,23 @@ public class IntegralTruckServiceImpl implements IntegralTruckService {
return count;
}
@Override
public IPage<IntegralTruckVO> pageTruckRank(PageIntegralTruckRankParam param) {
IPage<IntegralTruckVO> page = integralTruckDao.pageTruckRank(param);
List<String> truckNoList = page.getRecords().stream().map(item -> item.getTruckNo()).collect(Collectors.toList());
if (!truckNoList.isEmpty()) {
List<IntegralStatistics> statisticsList = integralStatisticsDao.selectListByStatisticsDateAndTruckNoList(LocalDateTimeUtils.getWeekStart(), truckNoList);
Map<String, Integer> rankMap = statisticsList.stream().collect(Collectors.toMap(item -> item.getTruckNo(), item -> item.getRank()));
for (IntegralTruckVO item : page.getRecords()) {
item.setRank(rankMap.get(item.getTruckNo()));
}
}
return page;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论