|
|
|
@ -57,8 +57,10 @@ public class RankUController {
|
|
|
|
|
|
|
|
|
|
@Data
|
|
|
|
|
static class RankParam {
|
|
|
|
|
@Schema(title = "时间条件", description = "1今日;2本周;3本月;4全年")
|
|
|
|
|
private Integer dateCondition;
|
|
|
|
|
// @Schema(title = "时间条件", description = "1今日;2本周;3本月;4全年")
|
|
|
|
|
// private Integer dateCondition;
|
|
|
|
|
@Schema(title = "月份", description = "格式为yyyy-MM-dd HH:mm:ss")
|
|
|
|
|
private LocalDateTime dateTime;
|
|
|
|
|
@Schema(title = "1经销商2员工", description = "默认1")
|
|
|
|
|
private Integer type;
|
|
|
|
|
private Integer pageNum;
|
|
|
|
@ -71,27 +73,8 @@ public class RankUController {
|
|
|
|
|
public Result list(@Validated @RequestBody RankParam param) {
|
|
|
|
|
Page pg = MybatisPlusUtil.SetNumPage(param.getPageNum(), param.getPageSize());
|
|
|
|
|
QueryWrapper<UserEffectRecords> qw = new QueryWrapper<>();
|
|
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
LocalDate now = LocalDateTime.now().toLocalDate();
|
|
|
|
|
LocalDate before =now.with(TemporalAdjusters.firstDayOfMonth());
|
|
|
|
|
if (param.getDateCondition() != null) {
|
|
|
|
|
switch (param.getDateCondition()) {
|
|
|
|
|
case 1:
|
|
|
|
|
before = now;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
|
|
|
|
before = now.with(DayOfWeek.MONDAY);
|
|
|
|
|
break;
|
|
|
|
|
case 3:
|
|
|
|
|
before = now.with(TemporalAdjusters.firstDayOfMonth());
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
before = now.with(TemporalAdjusters.firstDayOfYear());
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
qw.between("t1.createAt", before, now.plusDays(1));
|
|
|
|
|
LocalDateTime now = param.getDateTime() != null?LocalDateTime.now():param.getDateTime();
|
|
|
|
|
qw.eq("date_format(t1.creatAt, '%Y-%m-%d')",now.toLocalDate());
|
|
|
|
|
IPage page =(param.getType() != null && param.getType() == 1) ? userEffectRecordsMapper.rankByDepartment(pg,qw) : userEffectRecordsMapper.rankByUser(pg,qw);
|
|
|
|
|
return Result.success(page.getRecords(), "请求成功");
|
|
|
|
|
}
|
|
|
|
|