|
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fs.common.core.controller.BaseController;
|
|
|
import com.fs.common.core.domain.AjaxResult;
|
|
|
import com.fs.common.core.domain.R;
|
|
|
+import com.fs.common.core.page.TableDataInfo;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
import com.fs.common.utils.TimeUtils;
|
|
|
import com.fs.common.utils.poi.ExcelUtil;
|
|
|
@@ -28,10 +29,7 @@ import com.fs.his.service.IFsPackageOrderService;
|
|
|
import com.fs.his.service.IFsStoreAfterSalesService;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
|
-import com.fs.his.vo.FsCourseReportVO;
|
|
|
-import com.fs.his.vo.FsOrderReportVO;
|
|
|
-import com.fs.his.vo.FsStoreOrderAmountScrmStatsVo;
|
|
|
-import com.fs.his.vo.FsStoreOrderAmountStatsVo;
|
|
|
+import com.fs.his.vo.*;
|
|
|
import com.fs.hisStore.service.IFsStoreOrderScrmService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
@@ -715,42 +713,43 @@ public class CompanyStatisticsController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/orderReport")
|
|
|
- public AjaxResult selectFsOrderReportVO(FsPackageOrderParam param) {
|
|
|
+ public TableDataInfo selectFsOrderReportVO(FsPackageOrderParam param) {
|
|
|
+ startPage();
|
|
|
List<FsOrderReportVO> list = fsPackageOrderService.selectFsOrderReportVO(param);
|
|
|
- // 创建合计对象
|
|
|
- FsOrderReportVO totalVo = new FsOrderReportVO();
|
|
|
- // 计算各项订单数总和
|
|
|
- totalVo.setInquiryOrderCount(list.stream()
|
|
|
- .mapToLong(FsOrderReportVO::getInquiryOrderCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setIntegralOrderCount(list.stream()
|
|
|
- .mapToLong(FsOrderReportVO::getIntegralOrderCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setPackageOrderCount(list.stream()
|
|
|
- .mapToLong(FsOrderReportVO::getPackageOrderCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- // 计算各项金额总和
|
|
|
- totalVo.setInquiryOrderAmount(list.stream()
|
|
|
- .map(FsOrderReportVO::getInquiryOrderAmount)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- totalVo.setIntegralOrderAmount(list.stream()
|
|
|
- .map(FsOrderReportVO::getIntegralOrderAmount)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- totalVo.setPackageOrderAmount(list.stream()
|
|
|
- .map(FsOrderReportVO::getPackageOrderAmount)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("data", list);
|
|
|
- result.put("total", totalVo);
|
|
|
- return AjaxResult.success(result);
|
|
|
+// // 创建合计对象
|
|
|
+// FsOrderReportVO totalVo = new FsOrderReportVO();
|
|
|
+// // 计算各项订单数总和
|
|
|
+// totalVo.setInquiryOrderCount(list.stream()
|
|
|
+// .mapToLong(FsOrderReportVO::getInquiryOrderCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setIntegralOrderCount(list.stream()
|
|
|
+// .mapToLong(FsOrderReportVO::getIntegralOrderCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setPackageOrderCount(list.stream()
|
|
|
+// .mapToLong(FsOrderReportVO::getPackageOrderCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// // 计算各项金额总和
|
|
|
+// totalVo.setInquiryOrderAmount(list.stream()
|
|
|
+// .map(FsOrderReportVO::getInquiryOrderAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+//
|
|
|
+// totalVo.setIntegralOrderAmount(list.stream()
|
|
|
+// .map(FsOrderReportVO::getIntegralOrderAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+//
|
|
|
+// totalVo.setPackageOrderAmount(list.stream()
|
|
|
+// .map(FsOrderReportVO::getPackageOrderAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+// Map<String, Object> result = new HashMap<>();
|
|
|
+// result.put("data", list);
|
|
|
+// result.put("total", totalVo);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -760,65 +759,118 @@ public class CompanyStatisticsController extends BaseController {
|
|
|
* @return
|
|
|
*/
|
|
|
@GetMapping("/courseReport")
|
|
|
- public AjaxResult selectFsCourseReportVO(FsCourseWatchLogStatisticsListParam param) {
|
|
|
+ public TableDataInfo selectFsCourseReportVO(FsCourseWatchLogStatisticsListParam param) {
|
|
|
+ startPage();
|
|
|
List<FsCourseReportVO> fsCourseReportVOS = fsCourseWatchLogService.selectFsCourseReportVO(param);
|
|
|
- // 创建合计对象
|
|
|
- FsCourseReportVO totalVo = new FsCourseReportVO();
|
|
|
- totalVo.setCompanyName("总计");
|
|
|
-
|
|
|
- // 计算各项人数总和
|
|
|
- totalVo.setAccessCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getAccessCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setPendingCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getPendingCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setWatchingCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getWatchingCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setFinishedCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getFinishedCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setInterruptedCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getInterruptedCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setAnswerUserCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getAnswerUserCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- totalVo.setPacketUserCount(fsCourseReportVOS.stream()
|
|
|
- .mapToInt(FsCourseReportVO::getPacketUserCount)
|
|
|
- .sum());
|
|
|
-
|
|
|
- // 计算金额总和
|
|
|
- totalVo.setPacketAmount(fsCourseReportVOS.stream()
|
|
|
- .map(FsCourseReportVO::getPacketAmount)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
-
|
|
|
- // 重新计算总体看课率和完课率
|
|
|
- int totalCount = totalVo.getAccessCount();
|
|
|
- if (totalCount > 0) {
|
|
|
- BigDecimal watchRate = new BigDecimal((totalVo.getWatchingCount() + totalVo.getFinishedCount()) * 100.0 / totalCount)
|
|
|
- .setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- totalVo.setWatchRate(watchRate);
|
|
|
-
|
|
|
- BigDecimal finishRate = new BigDecimal(totalVo.getFinishedCount() * 100.0 / totalCount)
|
|
|
- .setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
- totalVo.setFinishRate(finishRate);
|
|
|
- } else {
|
|
|
- totalVo.setWatchRate(BigDecimal.ZERO);
|
|
|
- totalVo.setFinishRate(BigDecimal.ZERO);
|
|
|
- }
|
|
|
+// // 创建合计对象
|
|
|
+// FsCourseReportVO totalVo = new FsCourseReportVO();
|
|
|
+// totalVo.setCompanyName("总计");
|
|
|
+//
|
|
|
+// // 计算各项人数总和
|
|
|
+// totalVo.setAccessCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getAccessCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setPendingCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getPendingCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setWatchingCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getWatchingCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setFinishedCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getFinishedCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setInterruptedCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getInterruptedCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setAnswerUserCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getAnswerUserCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setPacketUserCount(fsCourseReportVOS.stream()
|
|
|
+// .mapToInt(FsCourseReportVO::getPacketUserCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// // 计算金额总和
|
|
|
+// totalVo.setPacketAmount(fsCourseReportVOS.stream()
|
|
|
+// .map(FsCourseReportVO::getPacketAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+//
|
|
|
+// // 重新计算总体看课率和完课率
|
|
|
+// int totalCount = totalVo.getAccessCount();
|
|
|
+// if (totalCount > 0) {
|
|
|
+// BigDecimal watchRate = new BigDecimal((totalVo.getWatchingCount() + totalVo.getFinishedCount()) * 100.0 / totalCount)
|
|
|
+// .setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+// totalVo.setWatchRate(watchRate);
|
|
|
+//
|
|
|
+// BigDecimal finishRate = new BigDecimal(totalVo.getFinishedCount() * 100.0 / totalCount)
|
|
|
+// .setScale(2, BigDecimal.ROUND_HALF_UP);
|
|
|
+// totalVo.setFinishRate(finishRate);
|
|
|
+// } else {
|
|
|
+// totalVo.setWatchRate(BigDecimal.ZERO);
|
|
|
+// totalVo.setFinishRate(BigDecimal.ZERO);
|
|
|
+// }
|
|
|
+//
|
|
|
+// Map<String, Object> result = new HashMap<>();
|
|
|
+// result.put("data", fsCourseReportVOS);
|
|
|
+// result.put("total", totalVo);
|
|
|
+ return getDataTable(fsCourseReportVOS);
|
|
|
+ }
|
|
|
|
|
|
- Map<String, Object> result = new HashMap<>();
|
|
|
- result.put("data", fsCourseReportVOS);
|
|
|
- result.put("total", totalVo);
|
|
|
- return AjaxResult.success(result);
|
|
|
+ /**
|
|
|
+ * 用户统计报表
|
|
|
+ *
|
|
|
+ * @param param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping("/userReport")
|
|
|
+ public TableDataInfo selectFsUserReportVO(FsCourseWatchLogStatisticsListParam param) {
|
|
|
+ startPage();
|
|
|
+ List<FsUserReportVO> list = fsCourseWatchLogService.selectFsUserReportVO(param);
|
|
|
+// // 创建合计对象
|
|
|
+// FsUserReportVO totalVo = new FsUserReportVO();
|
|
|
+// totalVo.setCompanyName("总计"); // 或其他标识符表示这是合计行
|
|
|
+//
|
|
|
+// // 对各个数值型字段进行求和计算
|
|
|
+// totalVo.setWatchCount(list.stream()
|
|
|
+// .mapToInt(FsUserReportVO::getWatchCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setAbsentCount(list.stream()
|
|
|
+// .mapToInt(FsUserReportVO::getAbsentCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setPeriodCount(list.stream()
|
|
|
+// .mapToInt(FsUserReportVO::getPeriodCount)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// totalVo.setConsumedIntegral(list.stream()
|
|
|
+// .mapToInt(FsUserReportVO::getConsumedIntegral)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+//
|
|
|
+// totalVo.setReceivedAmount(list.stream()
|
|
|
+// .map(FsUserReportVO::getReceivedAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+//
|
|
|
+// totalVo.setOrderAmount(list.stream()
|
|
|
+// .map(FsUserReportVO::getOrderAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add));
|
|
|
+//
|
|
|
+// totalVo.setIntegral(list.stream()
|
|
|
+// .mapToInt(FsUserReportVO::getIntegral)
|
|
|
+// .sum());
|
|
|
+//
|
|
|
+// Map<String, Object> result = new HashMap<>();
|
|
|
+// result.put("data", list);
|
|
|
+// result.put("total", totalVo);
|
|
|
+ return getDataTable(list);
|
|
|
}
|
|
|
}
|