|
@@ -14,6 +14,8 @@ import com.fs.company.service.ICompanySmsLogsService;
|
|
|
import com.fs.company.service.ICompanyUserService;
|
|
import com.fs.company.service.ICompanyUserService;
|
|
|
import com.fs.company.service.ICompanyVoiceLogsService;
|
|
import com.fs.company.service.ICompanyVoiceLogsService;
|
|
|
import com.fs.company.vo.*;
|
|
import com.fs.company.vo.*;
|
|
|
|
|
+import com.fs.course.param.FsCourseWatchLogStatisticsListParam;
|
|
|
|
|
+import com.fs.course.service.IFsCourseWatchLogService;
|
|
|
import com.fs.crm.param.CrmCustomerStatisticsParam;
|
|
import com.fs.crm.param.CrmCustomerStatisticsParam;
|
|
|
import com.fs.crm.service.ICrmCustomerService;
|
|
import com.fs.crm.service.ICrmCustomerService;
|
|
|
import com.fs.crm.service.ICrmCustomerVisitService;
|
|
import com.fs.crm.service.ICrmCustomerVisitService;
|
|
@@ -26,6 +28,7 @@ import com.fs.his.service.IFsPackageOrderService;
|
|
|
import com.fs.his.service.IFsStoreAfterSalesService;
|
|
import com.fs.his.service.IFsStoreAfterSalesService;
|
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
import com.fs.his.service.IFsStoreOrderService;
|
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
import com.fs.his.service.IFsStorePaymentService;
|
|
|
|
|
+import com.fs.his.vo.FsCourseReportVO;
|
|
|
import com.fs.his.vo.FsOrderReportVO;
|
|
import com.fs.his.vo.FsOrderReportVO;
|
|
|
import com.fs.his.vo.FsStoreOrderAmountScrmStatsVo;
|
|
import com.fs.his.vo.FsStoreOrderAmountScrmStatsVo;
|
|
|
import com.fs.his.vo.FsStoreOrderAmountStatsVo;
|
|
import com.fs.his.vo.FsStoreOrderAmountStatsVo;
|
|
@@ -80,6 +83,9 @@ public class CompanyStatisticsController extends BaseController {
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IFsPackageOrderService fsPackageOrderService;
|
|
private IFsPackageOrderService fsPackageOrderService;
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IFsCourseWatchLogService fsCourseWatchLogService;
|
|
|
|
|
+
|
|
|
@GetMapping("/storeOrder")
|
|
@GetMapping("/storeOrder")
|
|
|
public R storeOrder(FsStoreStatisticsParam param) {
|
|
public R storeOrder(FsStoreStatisticsParam param) {
|
|
|
if (StringUtils.isNotEmpty(param.getUserIds())) {
|
|
if (StringUtils.isNotEmpty(param.getUserIds())) {
|
|
@@ -747,4 +753,72 @@ public class CompanyStatisticsController extends BaseController {
|
|
|
return AjaxResult.success(result);
|
|
return AjaxResult.success(result);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 课程统计报表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/courseReport")
|
|
|
|
|
+ public AjaxResult selectFsCourseReportVO(FsCourseWatchLogStatisticsListParam param) {
|
|
|
|
|
+ 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);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
|
|
|
+ result.put("data", fsCourseReportVOS);
|
|
|
|
|
+ result.put("total", totalVo);
|
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|