|
@@ -82,41 +82,62 @@ public class KuaiShouVideoGetController {
|
|
|
|
|
|
|
|
|
@GetMapping(value = "/getVideoList")
|
|
|
- public PageInfo<KuaiShouVideoGetVo> getVideoList(Long accountId,
|
|
|
- String startDate,
|
|
|
- String endDate,
|
|
|
- String materialType,
|
|
|
- String channelType,
|
|
|
- String orderBy,
|
|
|
- @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
- @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
- HttpServletRequest req) {
|
|
|
+ public Result<PageInfo<KuaiShouVideoGetVo>> getVideoList(Long accountId,
|
|
|
+ String startDate,
|
|
|
+ String endDate,
|
|
|
+ String materialType,
|
|
|
+ String channelType,
|
|
|
+ String orderBy,
|
|
|
+ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
|
|
+ @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
|
|
|
|
|
|
- List<KuaiShouVideoGetVo> list = new ArrayList<>();
|
|
|
- PageHelper.startPage(pageNo, pageSize);
|
|
|
- Map<String, Object> requestMap = new HashMap<>();
|
|
|
- requestMap.put("accountId", accountId);
|
|
|
- requestMap.put("orderBy", orderBy);
|
|
|
- requestMap.put("materialType", materialType);
|
|
|
- requestMap.put("channelType", channelType);
|
|
|
- if (orderBy.equals("time")) {
|
|
|
- if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
|
|
|
- requestMap.put("startDate", startDate + " 00:00:00");
|
|
|
- requestMap.put("endDate", endDate + " 59:59:59");
|
|
|
+ Result<PageInfo<KuaiShouVideoGetVo>> result = new Result<>();
|
|
|
+ try {
|
|
|
+ if (Check.isNull(accountId)) {
|
|
|
+ throw new Exception("请传入账户id");
|
|
|
}
|
|
|
-
|
|
|
- list = kuaiShouVideoGetService.getVideoList(requestMap);
|
|
|
-
|
|
|
- } else if (orderBy.equals("cost")) {
|
|
|
- if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
|
|
|
- requestMap.put("startDate", startDate);
|
|
|
- requestMap.put("endDate", endDate);
|
|
|
+ if (Check.isNull(materialType)) {
|
|
|
+ throw new Exception("请传入素材类型");
|
|
|
+ }
|
|
|
+ if (Check.isNull(channelType)) {
|
|
|
+ throw new Exception("请传入素材渠道");
|
|
|
+ }
|
|
|
+ if (Check.isNull(orderBy)) {
|
|
|
+ throw new Exception("请传入排序方式");
|
|
|
+ }
|
|
|
+ List<KuaiShouVideoGetVo> list = new ArrayList<>();
|
|
|
+ PageHelper.startPage(pageNo, pageSize);
|
|
|
+ Map<String, Object> requestMap = new HashMap<>();
|
|
|
+ requestMap.put("accountId", accountId);
|
|
|
+ requestMap.put("orderBy", orderBy);
|
|
|
+ requestMap.put("materialType", materialType);
|
|
|
+ requestMap.put("channelType", channelType);
|
|
|
+ if (orderBy.equals("time")) {
|
|
|
+ if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
|
|
|
+ requestMap.put("startDate", startDate + " 00:00:00");
|
|
|
+ requestMap.put("endDate", endDate + " 59:59:59");
|
|
|
+ }
|
|
|
+ list = kuaiShouVideoGetService.getVideoList(requestMap);
|
|
|
+ } else if (orderBy.equals("cost")) {
|
|
|
+ if (!Check.isNull(startDate) && !Check.isNull(endDate)) {
|
|
|
+ requestMap.put("startDate", startDate);
|
|
|
+ requestMap.put("endDate", endDate);
|
|
|
+ }
|
|
|
+ list = kuaiShouReportDailyMaterialService.getVideoList(requestMap);
|
|
|
}
|
|
|
- list = kuaiShouReportDailyMaterialService.getVideoList(requestMap);
|
|
|
+ PageInfo<KuaiShouVideoGetVo> pageInfo = new PageInfo<>(list);
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(pageInfo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ result.setSuccess(false);
|
|
|
+ result.setMessage(e.getMessage());
|
|
|
}
|
|
|
- PageInfo<KuaiShouVideoGetVo> pageInfo = new PageInfo<>(list);
|
|
|
- return pageInfo;
|
|
|
+
|
|
|
+
|
|
|
+ return result;
|
|
|
|
|
|
}
|
|
|
|