Browse Source

加日期筛选

master
nili 8 months ago
parent
commit
eeb3a08a05
  1. 16
      game-service/src/main/java/awesome/group/game/service/AdminService.java
  2. 3
      game-service/src/main/java/awesome/group/game/service/bo/AdvRecordQuery.java

16
game-service/src/main/java/awesome/group/game/service/AdminService.java

@ -15,15 +15,19 @@ import awesome.group.game.service.common.exception.PaganiExceptionCode;
import awesome.group.game.service.util.EncryptUtil; import awesome.group.game.service.util.EncryptUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -68,6 +72,16 @@ public class AdminService {
if (StringUtils.hasText(param.deviceId)) { if (StringUtils.hasText(param.deviceId)) {
wrapper.eq(MatrixAdvRecord::getDeviceId, param.deviceId); wrapper.eq(MatrixAdvRecord::getDeviceId, param.deviceId);
} }
if (!CollectionUtils.isEmpty(param.createdAt)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
try {
Date begin = format.parse(param.createdAt.get(0)), end = format.parse(param.createdAt.get(1));
wrapper.between(MatrixAdvRecord::getCreatedAt, new Timestamp(begin.getTime()), new Timestamp(end.getTime()));
} catch (ParseException e) {
throw new PaganiException(PaganiExceptionCode.ILLEGAL_REQUEST, "时间范围有误");
}
}
wrapper.orderByDesc(MatrixAdvRecord::getId); wrapper.orderByDesc(MatrixAdvRecord::getId);
if (ownerId != 1) { if (ownerId != 1) {
List<Integer> appIds = appList.stream().filter(x -> x.getOwnerId() != null && x.getOwnerId() == ownerId).map(MatrixApp::getId).toList(); List<Integer> appIds = appList.stream().filter(x -> x.getOwnerId() != null && x.getOwnerId() == ownerId).map(MatrixApp::getId).toList();

3
game-service/src/main/java/awesome/group/game/service/bo/AdvRecordQuery.java

@ -1,7 +1,10 @@
package awesome.group.game.service.bo; package awesome.group.game.service.bo;
import java.util.List;
public class AdvRecordQuery extends PageParam { public class AdvRecordQuery extends PageParam {
public Integer advType = 3;//默认展示激励视频 public Integer advType = 3;//默认展示激励视频
public Integer platform; public Integer platform;
public String deviceId; public String deviceId;
public List<String> createdAt;
} }

Loading…
Cancel
Save