|
@@ -1,10 +1,14 @@
|
|
|
package com.fs.course.controller;
|
|
package com.fs.course.controller;
|
|
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
+import com.fs.common.constant.HttpStatus;
|
|
|
import com.fs.common.core.domain.R;
|
|
import com.fs.common.core.domain.R;
|
|
|
import com.fs.common.core.domain.model.LoginUser;
|
|
import com.fs.common.core.domain.model.LoginUser;
|
|
|
|
|
+import com.fs.common.core.page.PageDomain;
|
|
|
|
|
+import com.fs.common.core.page.TableSupport;
|
|
|
import com.fs.common.utils.ServletUtils;
|
|
import com.fs.common.utils.ServletUtils;
|
|
|
import com.fs.course.config.CourseConfig;
|
|
import com.fs.course.config.CourseConfig;
|
|
|
import com.fs.course.domain.FsUserCoursePeriod;
|
|
import com.fs.course.domain.FsUserCoursePeriod;
|
|
@@ -238,4 +242,48 @@ public class FsCourseRedPacketLogController extends BaseController
|
|
|
List<OptionsVO> optionsVOS = fsUserCourseVideoMapper.selectFsUserCourseVodeAllList(id);
|
|
List<OptionsVO> optionsVOS = fsUserCourseVideoMapper.selectFsUserCourseVodeAllList(id);
|
|
|
return R.ok().put("list", optionsVOS);
|
|
return R.ok().put("list", optionsVOS);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 红包消耗统计
|
|
|
|
|
+ * @param fsCourseRedPacketLog
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/getReadPackageTotal")
|
|
|
|
|
+ public TableDataInfo getReadPackageTotal(FsCourseRedPacketLog fsCourseRedPacketLog) {
|
|
|
|
|
+
|
|
|
|
|
+ List<FsCourseRedPacketLogListPVO> list = fsCourseRedPacketLogService.getReadPackageTotal(fsCourseRedPacketLog);
|
|
|
|
|
+ FsCourseRedPacketLogListPVO fsCourseRedPacketLogListPVO = new FsCourseRedPacketLogListPVO();
|
|
|
|
|
+ fsCourseRedPacketLogListPVO.setCompanyName("合计");
|
|
|
|
|
+ BigDecimal totalAmount = list.stream()
|
|
|
|
|
+ .map(item -> item.getAmount())
|
|
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
|
|
+ fsCourseRedPacketLogListPVO.setAmount(totalAmount);
|
|
|
|
|
+ // 获取分页参数
|
|
|
|
|
+ PageDomain pageDomain = TableSupport.buildPageRequest();
|
|
|
|
|
+ Integer pageNum = pageDomain.getPageNum();
|
|
|
|
|
+ Integer pageSize = pageDomain.getPageSize();
|
|
|
|
|
+
|
|
|
|
|
+ int total = list.size();
|
|
|
|
|
+
|
|
|
|
|
+ if (pageNum != null && pageSize != null) {
|
|
|
|
|
+ int fromIndex = (pageNum - 1) * pageSize;
|
|
|
|
|
+ int toIndex = Math.min(fromIndex + pageSize, total);
|
|
|
|
|
+ // 确保索引不越界
|
|
|
|
|
+ if (fromIndex < total) {
|
|
|
|
|
+ list = list.subList(fromIndex, toIndex);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ list = new ArrayList<>(); // 返回空列表
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ list.add(fsCourseRedPacketLogListPVO); // 将合计行添加到列表末尾
|
|
|
|
|
+ // 构造返回结果
|
|
|
|
|
+ TableDataInfo rspData = new TableDataInfo();
|
|
|
|
|
+ rspData.setCode(HttpStatus.SUCCESS);
|
|
|
|
|
+ rspData.setMsg("查询成功");
|
|
|
|
|
+ rspData.setRows(list);
|
|
|
|
|
+ rspData.setTotal(total);
|
|
|
|
|
+ return rspData;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|