Quellcode durchsuchen

订单报表统计

wangxy vor 1 Woche
Ursprung
Commit
879b9542c6

+ 270 - 274
fs-admin/src/main/java/com/fs/company/controller/CompanyStatisticsController.java

@@ -21,9 +21,12 @@ import com.fs.crm.vo.CrmCustomerStatisticsVO;
 import com.fs.crm.vo.CrmCustomerVisitStatisticsVO;
 import com.fs.his.dto.FsStoreOrderAmountScrmStatsQueryDto;
 import com.fs.his.dto.FsStoreOrderAmountStatsQueryDto;
+import com.fs.his.param.FsPackageOrderParam;
+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.FsOrderReportVO;
 import com.fs.his.vo.FsStoreOrderAmountScrmStatsVo;
 import com.fs.his.vo.FsStoreOrderAmountStatsVo;
 import com.fs.hisStore.service.IFsStoreOrderScrmService;
@@ -35,9 +38,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -48,8 +49,7 @@ import java.util.stream.Collectors;
  */
 @RestController
 @RequestMapping("/company/statistics")
-public class CompanyStatisticsController extends BaseController
-{
+public class CompanyStatisticsController extends BaseController {
 
     @Autowired
     private ICompanyUserService userService;
@@ -76,29 +76,31 @@ public class CompanyStatisticsController extends BaseController
     //app商城订单接口Service
     @Autowired
     private IFsStoreOrderScrmService fsStoreOrderScrmService;
+
+    @Autowired
+    private IFsPackageOrderService fsPackageOrderService;
+
     @GetMapping("/storeOrder")
-    public R storeOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R storeOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsStoreOrderStatisticsList(param);
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<FsStoreOrderStatisticsVO> list = storeOrderService.selectFsStoreOrderStatisticsList(param);
 
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -111,37 +113,34 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
             List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("orderCount", orderCount).put("payPrice", payPrice);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
 
     @GetMapping("/packageOrder")
-    public R storePackageOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R storePackageOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsPackageOrderStatisticsList(param);
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<FsStoreOrderStatisticsVO> list = storeOrderService.selectFsPackageOrderStatisticsList(param);
 
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -154,36 +153,33 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
             List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("orderCount", orderCount).put("payPrice", payPrice);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
     @GetMapping("/afterSalesOrder")
-    public R afterSalesOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R afterSalesOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<FsStoreOrderStatisticsVO> list= storeAfterSalesService.selectFsStoreAfterSalesServiceStatisticsList(param);
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<FsStoreOrderStatisticsVO> list = storeAfterSalesService.selectFsStoreAfterSalesServiceStatisticsList(param);
 
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -193,47 +189,44 @@ public class CompanyStatisticsController extends BaseController
                 beginTime = TimeUtils.formatTime(beginTime);
             }
             Map<String, Object> map = timeEntity.toMap();
-            if (StringUtils.isNotBlank(param.getStartTime())){
-                map.put("startTime",param.getStartTime());
+            if (StringUtils.isNotBlank(param.getStartTime())) {
+                map.put("startTime", param.getStartTime());
             }
-            if (StringUtils.isNotBlank(param.getEndTime())){
-                map.put("endTime",param.getEndTime());
+            if (StringUtils.isNotBlank(param.getEndTime())) {
+                map.put("endTime", param.getEndTime());
             }
             List<JSONObject> jsonObjectList = storeAfterSalesService.selectFsStoreAfterSales(map);
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
             List<BigDecimal> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getBigDecimal("payPrice")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("orderCount", orderCount).put("payPrice", payPrice);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
 
     @GetMapping("/inquiryOrder")
-    public R storeInquiryOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R storeInquiryOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsInquiryOrderStatisticsList(param);
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<FsStoreOrderStatisticsVO> list = storeOrderService.selectFsInquiryOrderStatisticsList(param);
 
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -246,89 +239,80 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
             List<Integer> payPrice = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payPrice")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("orderCount",orderCount).put("payPrice",payPrice);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("orderCount", orderCount).put("payPrice", payPrice);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
 
-
-
     @GetMapping("/exportStoreOrder")
-    public AjaxResult exportStoreOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportStoreOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsStoreOrderStatisticsList(param);
+        List<FsStoreOrderStatisticsVO> list = storeOrderService.selectFsStoreOrderStatisticsList(param);
 
         ExcelUtil<FsStoreOrderStatisticsVO> util = new ExcelUtil<FsStoreOrderStatisticsVO>(FsStoreOrderStatisticsVO.class);
         return util.exportExcel(list, "orderLogs");
     }
 
     @GetMapping("/exportPackageOrder")
-    public AjaxResult exportPackageOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportPackageOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsPackageOrderStatisticsList(param);
+        List<FsStoreOrderStatisticsVO> list = storeOrderService.selectFsPackageOrderStatisticsList(param);
 
         ExcelUtil<FsStoreOrderStatisticsVO> util = new ExcelUtil<FsStoreOrderStatisticsVO>(FsStoreOrderStatisticsVO.class);
         return util.exportExcel(list, "orderLogs");
     }
 
     @GetMapping("/exportAfterSalesOrder")
-    public AjaxResult exportAfterSalesOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportAfterSalesOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<FsStoreOrderStatisticsVO> list= storeAfterSalesService.selectFsStoreAfterSalesServiceStatisticsList(param);
+        List<FsStoreOrderStatisticsVO> list = storeAfterSalesService.selectFsStoreAfterSalesServiceStatisticsList(param);
 
         ExcelUtil<FsStoreOrderStatisticsVO> util = new ExcelUtil<FsStoreOrderStatisticsVO>(FsStoreOrderStatisticsVO.class);
         return util.exportExcel(list, "orderLogs");
@@ -336,53 +320,49 @@ public class CompanyStatisticsController extends BaseController
 
 
     @GetMapping("/exportInquiryOrder")
-    public AjaxResult exportInquiryOrder(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportInquiryOrder(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<FsStoreOrderStatisticsVO> list= storeOrderService.selectFsInquiryOrderStatisticsList(param);
+        List<FsStoreOrderStatisticsVO> list = storeOrderService.selectFsInquiryOrderStatisticsList(param);
 
         ExcelUtil<FsStoreOrderStatisticsVO> util = new ExcelUtil<FsStoreOrderStatisticsVO>(FsStoreOrderStatisticsVO.class);
         return util.exportExcel(list, "orderLogs");
     }
 
     @GetMapping("/storePayment")
-    public R storePayment(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R storePayment(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<FsStorePaymentStatisticsVO> list= storePaymentService.selectFsStorePaymentStatisticsList(param);
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<FsStorePaymentStatisticsVO> list = storePaymentService.selectFsStorePaymentStatisticsList(param);
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -395,34 +375,31 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> orderCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("orderCount")).collect(Collectors.toList());
             List<Integer> payMoney = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("payMoney")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("orderCount",orderCount).put("payMoney",payMoney);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("orderCount", orderCount).put("payMoney", payMoney);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
     @GetMapping("/exportStorePayment")
-    public AjaxResult exportStorePayment(FsStoreStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportStorePayment(FsStoreStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.selectCompanyUserList(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<FsStorePaymentStatisticsVO> list= storePaymentService.selectFsStorePaymentStatisticsList(param);
+        List<FsStorePaymentStatisticsVO> list = storePaymentService.selectFsStorePaymentStatisticsList(param);
 
         ExcelUtil<FsStorePaymentStatisticsVO> util = new ExcelUtil<FsStorePaymentStatisticsVO>(FsStorePaymentStatisticsVO.class);
         return util.exportExcel(list, "paymentLogs");
@@ -431,33 +408,31 @@ public class CompanyStatisticsController extends BaseController
 //分割
 
     @GetMapping("/voiceLogs")
-    public R voiceLogs(CompanyStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R voiceLogs(CompanyStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<CompanyVoiceLogsStatisticsVO> list= voiceLogsService.selectVoiceLogsStatisticsList(param);
-            if(list!=null){
-                for(CompanyVoiceLogsStatisticsVO vo:list){
-                    double f1 = new BigDecimal((float)vo.getCallSuccessCount()/vo.getCallCount()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*100;
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<CompanyVoiceLogsStatisticsVO> list = voiceLogsService.selectVoiceLogsStatisticsList(param);
+            if (list != null) {
+                for (CompanyVoiceLogsStatisticsVO vo : list) {
+                    double f1 = new BigDecimal((float) vo.getCallSuccessCount() / vo.getCallCount()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
                     vo.setCallRate(f1);
                 }
             }
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -472,37 +447,34 @@ public class CompanyStatisticsController extends BaseController
             List<Integer> callSuccessCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("callSuccessCount")).collect(Collectors.toList());
             List<Integer> times = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("times")).collect(Collectors.toList());
             List<Integer> billingTime = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("billingTime")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("callCount",callCount).put("callSuccessCount",callSuccessCount).put("times",times).put("billingTime",billingTime);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("callCount", callCount).put("callSuccessCount", callSuccessCount).put("times", times).put("billingTime", billingTime);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
     @GetMapping("/exportVoiceLogs")
-    public AjaxResult exportVoiceLogs(CompanyStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportVoiceLogs(CompanyStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<CompanyVoiceLogsStatisticsVO> list= voiceLogsService.selectVoiceLogsStatisticsList(param);
-        if(list!=null){
-            for(CompanyVoiceLogsStatisticsVO vo:list){
-                double f1 = new BigDecimal((float)vo.getCallSuccessCount()/vo.getCallCount()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()*100;
+        List<CompanyVoiceLogsStatisticsVO> list = voiceLogsService.selectVoiceLogsStatisticsList(param);
+        if (list != null) {
+            for (CompanyVoiceLogsStatisticsVO vo : list) {
+                double f1 = new BigDecimal((float) vo.getCallSuccessCount() / vo.getCallCount()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
                 vo.setCallRate(f1);
             }
         }
@@ -511,34 +483,26 @@ public class CompanyStatisticsController extends BaseController
     }
 
 
-
-
-
-
-
-
     @GetMapping("/smsLogs")
-    public R smsLogs(CompanyStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R smsLogs(CompanyStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<CompanySmsLogsStatisticsVO> list= smsLogsService.selectSmsLogsStatisticsList(param);
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<CompanySmsLogsStatisticsVO> list = smsLogsService.selectSmsLogsStatisticsList(param);
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -551,34 +515,31 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> smsCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("smsCount")).collect(Collectors.toList());
             List<Integer> successCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("successCount")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("smsCount",smsCount).put("successCount",successCount);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("smsCount", smsCount).put("successCount", successCount);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
     @GetMapping("/exportSmsLogs")
-    public AjaxResult exportSmsLogs(CompanyStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportSmsLogs(CompanyStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<CompanySmsLogsStatisticsVO> list= smsLogsService.selectSmsLogsStatisticsList(param);
+        List<CompanySmsLogsStatisticsVO> list = smsLogsService.selectSmsLogsStatisticsList(param);
 
         ExcelUtil<CompanySmsLogsStatisticsVO> util = new ExcelUtil<CompanySmsLogsStatisticsVO>(CompanySmsLogsStatisticsVO.class);
         return util.exportExcel(list, "voiceLogs");
@@ -586,28 +547,26 @@ public class CompanyStatisticsController extends BaseController
 
 
     @GetMapping("/customer")
-    public R customer(CrmCustomerStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R customer(CrmCustomerStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<CrmCustomerStatisticsVO> list= crmCustomerService.selectCrmCustomerStatisticsList(param);
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<CrmCustomerStatisticsVO> list = crmCustomerService.selectCrmCustomerStatisticsList(param);
 
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -620,63 +579,58 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> receiveCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("receiveCount")).collect(Collectors.toList());
             List<Integer> poolCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("poolCount")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("receiveCount",receiveCount).put("poolCount",poolCount);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("receiveCount", receiveCount).put("poolCount", poolCount);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
     @GetMapping("/exportCustomer")
-    public AjaxResult exportCustomer(CrmCustomerStatisticsParam param)
-    {
-
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportCustomer(CrmCustomerStatisticsParam param) {
+
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
 
-        List<CrmCustomerStatisticsVO> list= crmCustomerService.selectCrmCustomerStatisticsList(param);
+        List<CrmCustomerStatisticsVO> list = crmCustomerService.selectCrmCustomerStatisticsList(param);
         ExcelUtil<CrmCustomerStatisticsVO> util = new ExcelUtil<CrmCustomerStatisticsVO>(CrmCustomerStatisticsVO.class);
         return util.exportExcel(list, "customer");
     }
 
 
     @GetMapping("/customerVisit")
-    public R customerVisit(CrmCustomerStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public R customerVisit(CrmCustomerStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取部门下的所有用户
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        if(param.getUsers()!=null&&param.getUsers().length>0){
-            List<CrmCustomerVisitStatisticsVO> list= crmCustomerVisitService.selectCrmCustomerVisitStatisticsList(param);
+        if (param.getUsers() != null && param.getUsers().length > 0) {
+            List<CrmCustomerVisitStatisticsVO> list = crmCustomerVisitService.selectCrmCustomerVisitStatisticsList(param);
 
-            TimeUtils.TimeEntity timeEntity= TimeUtils.parseTime(param.getType().toString(),param.getStartTime(),param.getEndTime());
+            TimeUtils.TimeEntity timeEntity = TimeUtils.parseTime(param.getType().toString(), param.getStartTime(), param.getEndTime());
             timeEntity.setUserIds(param.getUsers());
             Integer cycleNum = timeEntity.getCycleNum();
             Integer beginTime = timeEntity.getBeginTime();
@@ -689,45 +643,42 @@ public class CompanyStatisticsController extends BaseController
             List<String> dates = jsonObjectList.stream().map(jsonObject -> jsonObject.getString("type")).collect(Collectors.toList());
             List<Integer> customerCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("customerCount")).collect(Collectors.toList());
             List<Integer> visitCount = jsonObjectList.stream().map(jsonObject -> jsonObject.getInteger("visitCount")).collect(Collectors.toList());
-            return R.ok().put("list",list).put("dates",dates).put("customerCount",customerCount).put("visitCount",visitCount);
-        }
-        else {
+            return R.ok().put("list", list).put("dates", dates).put("customerCount", customerCount).put("visitCount", visitCount);
+        } else {
             return R.ok("未查找到数据");
         }
     }
 
     @GetMapping("/exportCustomerVisit")
-    public AjaxResult exportCustomerVisit(CrmCustomerStatisticsParam param)
-    {
-        if(StringUtils.isNotEmpty(param.getUserIds())){
-            String[] userIds=param.getUserIds().split(",");
-            Long[] ids=new Long[userIds.length];
-            for(int i=0;i<ids.length; i++){
-                ids[i]=Long.parseLong(userIds[i]);
+    public AjaxResult exportCustomerVisit(CrmCustomerStatisticsParam param) {
+        if (StringUtils.isNotEmpty(param.getUserIds())) {
+            String[] userIds = param.getUserIds().split(",");
+            Long[] ids = new Long[userIds.length];
+            for (int i = 0; i < ids.length; i++) {
+                ids[i] = Long.parseLong(userIds[i]);
             }
             param.setUsers(ids);
-        }
-        else{
+        } else {
             //获取所有员工
-            CompanyUser usermap=new CompanyUser();
+            CompanyUser usermap = new CompanyUser();
             usermap.setDeptId(param.getDeptId());
             List<CompanyUser> users = userService.getUserListByDeptId(usermap);
             List<Long> userIds = users.stream().map(element -> element.getUserId()).collect(Collectors.toList());
             param.setUsers(userIds.toArray(new Long[userIds.size()]));
         }
-        List<CrmCustomerVisitStatisticsVO> list= crmCustomerVisitService.selectCrmCustomerVisitStatisticsList(param);
+        List<CrmCustomerVisitStatisticsVO> list = crmCustomerVisitService.selectCrmCustomerVisitStatisticsList(param);
         ExcelUtil<CrmCustomerVisitStatisticsVO> util = new ExcelUtil<CrmCustomerVisitStatisticsVO>(CrmCustomerVisitStatisticsVO.class);
         return util.exportExcel(list, "visit");
     }
 
     @GetMapping("/ipadStaticTotal/{dateTime}")
-    public R ipadStaticTotal(@PathVariable("dateTime") String dateTime){
+    public R ipadStaticTotal(@PathVariable("dateTime") String dateTime) {
         List<QwIpadTotalVo> qwIpadTotalVos = userService.selectCompanyByIpadStatus(dateTime);
-        return R.ok().put("list",qwIpadTotalVos);
+        return R.ok().put("list", qwIpadTotalVos);
     }
 
     @GetMapping("/exportIpadStaticByTime/{dateTime}")
-    public AjaxResult exportIpadStaticByTime(@PathVariable("dateTime") String dateTime){
+    public AjaxResult exportIpadStaticByTime(@PathVariable("dateTime") String dateTime) {
         List<QwIpadTotalVo> qwIpadTotalVos = userService.selectCompanyByIpadStatus(dateTime);
         ExcelUtil<QwIpadTotalVo> util = new ExcelUtil<QwIpadTotalVo>(QwIpadTotalVo.class);
         return util.exportExcel(qwIpadTotalVos, "visit");
@@ -735,20 +686,65 @@ public class CompanyStatisticsController extends BaseController
 
     /**
      * 获取互联网医院订单统计数据
-     * */
+     */
     @GetMapping("/hisOrderCountStats")
-    public AjaxResult getHisOrderCount(FsStoreOrderAmountStatsQueryDto statsQueryDto){
+    public AjaxResult getHisOrderCount(FsStoreOrderAmountStatsQueryDto statsQueryDto) {
         FsStoreOrderAmountStatsVo fsStoreOrderAmountStatsVo = storeOrderService.selectFsStoreOrderAmountStats(statsQueryDto);
         return AjaxResult.success(fsStoreOrderAmountStatsVo);
     }
 
     /**
      * 获取App商城订单统计数据
-     * */
+     */
     @GetMapping("/appOrderCountStats")
-    public AjaxResult getAppOrderCount(FsStoreOrderAmountScrmStatsQueryDto statsQueryDto){
+    public AjaxResult getAppOrderCount(FsStoreOrderAmountScrmStatsQueryDto statsQueryDto) {
         FsStoreOrderAmountScrmStatsVo scrmStatsVo = fsStoreOrderScrmService.selectFsStoreOrderAmountScrmStats(statsQueryDto);
         return AjaxResult.success(scrmStatsVo);
     }
 
+    /**
+     * 订单统计报表
+     *
+     * @param param
+     * @return
+     */
+    @GetMapping("/orderReport")
+    public AjaxResult selectFsOrderReportVO(FsPackageOrderParam param) {
+        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);
+    }
+
 }

+ 34 - 7
fs-admin/src/main/java/com/fs/his/controller/FsPackageOrderController.java

@@ -1,7 +1,7 @@
 package com.fs.his.controller;
 
-import java.util.Date;
-import java.util.List;
+import java.math.BigDecimal;
+import java.util.*;
 
 import com.fs.common.core.domain.R;
 import com.fs.common.utils.ParseUtils;
@@ -10,10 +10,7 @@ import com.fs.his.domain.FsExportTask;
 import com.fs.his.mapper.FsStorePaymentMapper;
 import com.fs.his.param.FsPackageOrderParam;
 import com.fs.his.service.IFsExportTaskService;
-import com.fs.his.vo.FsPackageOrderExcelVO;
-import com.fs.his.vo.FsPackageOrderListVO;
-import com.fs.his.vo.FsPackageOrderVO;
-import com.fs.his.vo.FsStoreOrderVO;
+import com.fs.his.vo.*;
 import com.fs.ybPay.service.IPayService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -77,9 +74,39 @@ public class FsPackageOrderController extends BaseController
     @PreAuthorize("@ss.hasPermi('his:packageOrder:report')")
     @GetMapping("/packageOrderReport")
     public AjaxResult  selectFsPackageOrderReportVO(FsPackageOrderParam param){
-        return AjaxResult.success(fsPackageOrderService.selectFsPackageOrderReportVO(param));
+        List<FsPackageOrderReportVO> list = fsPackageOrderService.selectFsPackageOrderReportVO(param);
+        // 计算合计数据
+        FsPackageOrderReportVO totalVo = new FsPackageOrderReportVO();
+        // 计算订单数总和
+        totalVo.setOrderNum(list.stream()
+                .mapToLong(FsPackageOrderReportVO::getOrderNum)
+                .sum());
+
+        // 计算金额总和
+        totalVo.setMoney(list.stream()
+                .map(FsPackageOrderReportVO::getMoney)
+                .filter(Objects::nonNull)
+                .reduce(BigDecimal.ZERO, BigDecimal::add));
+
+        // 计算确认收货订单数总和
+        totalVo.setReceiptOrder(list.stream()
+                .mapToLong(FsPackageOrderReportVO::getReceiptOrder)
+                .sum());
+
+        // 计算确认收货金额总和
+        totalVo.setReceiptMoney(list.stream()
+                .map(FsPackageOrderReportVO::getReceiptMoney)
+                .filter(Objects::nonNull)
+                .reduce(BigDecimal.ZERO, BigDecimal::add));
+
+        // 返回包含数据列表和合计信息的结构
+        Map<String, Object> result = new HashMap<>();
+        result.put("dataList", list);
+        result.put("total", totalVo);
+        return AjaxResult.success(result);
     }
 
+
     /**
      * 导出套餐订单列表
      */

+ 14 - 0
fs-service/src/main/java/com/fs/his/mapper/FsPackageOrderMapper.java

@@ -245,4 +245,18 @@ public interface FsPackageOrderMapper
      * @return
      */
     List<FsPackageOrderReportVO> selectFsPackageOrderReportVO(FsPackageOrderParam param);
+
+    /**
+     * 销售公司订单报表
+     * @param param
+     * @return
+     */
+    List<FsOrderReportVO> selectFsOrderReportVO(FsPackageOrderParam param);
+
+    /**
+     * 销售公司订单报表-部门
+     * @param param
+     * @return
+     */
+    List<FsOrderReportVO> selectFsOrderReportVODept(FsPackageOrderParam param);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/his/service/IFsPackageOrderService.java

@@ -74,6 +74,8 @@ public interface IFsPackageOrderService
 
     List<FsPackageOrderReportVO> selectFsPackageOrderReportVO(FsPackageOrderParam param);
 
+    List<FsOrderReportVO> selectFsOrderReportVO(FsPackageOrderParam param);
+
     Integer PackageOrderRefund(Long orderId);
 
     R confirmOrder(FsPackageOrderConfirmParam param);

+ 12 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsPackageOrderServiceImpl.java

@@ -263,6 +263,18 @@ public class FsPackageOrderServiceImpl implements IFsPackageOrderService
         return fsPackageOrderMapper.selectFsPackageOrderReportVO(param);
     }
 
+    @Override
+    public List<FsOrderReportVO> selectFsOrderReportVO(FsPackageOrderParam param) {
+        List<FsOrderReportVO> list=new ArrayList<>();
+        if(param.getDeptId()!=null){
+            //查询部门维度的订单报表
+            list= fsPackageOrderMapper.selectFsOrderReportVODept(param);
+        }else {
+            //查询公司维度的订单报表
+            list=fsPackageOrderMapper.selectFsOrderReportVO(param);
+        }
+        return  list;
+    }
 
 
     @Override

+ 7 - 0
fs-service/src/main/java/com/fs/his/vo/FsCourseReportVO.java

@@ -0,0 +1,7 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+@Data
+public class FsCourseReportVO {
+}

+ 49 - 0
fs-service/src/main/java/com/fs/his/vo/FsOrderReportVO.java

@@ -0,0 +1,49 @@
+package com.fs.his.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class FsOrderReportVO {
+
+    /**
+     * 公司名称
+     */
+    private String companyName;
+
+    /**
+     * 部门名称
+     */
+    private String deptName;
+
+    /**
+     * 问诊订单数
+     */
+    private Long inquiryOrderCount;
+
+    /**
+     * 问诊金额
+     */
+    private BigDecimal inquiryOrderAmount;
+
+    /**
+     * 积分订单数
+     */
+    private  Long integralOrderCount;
+
+    /**
+     * 积分金额
+     */
+    private BigDecimal integralOrderAmount;
+
+    /**
+     * 套餐订单数
+     */
+    private  Long packageOrderCount;
+
+    /**
+     * 套餐金额
+     */
+    private BigDecimal packageOrderAmount;
+}

+ 117 - 1
fs-service/src/main/resources/mapper/his/FsPackageOrderMapper.xml

@@ -348,7 +348,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="stTime != null">
                 AND DATE(po.start_time) &gt;= DATE(#{stTime})
             </if>
-            <if test="endTime != null">
+            <if test="endEndTime != null">
                 AND DATE(po.finish_time) &lt;= DATE(#{endEndTime})
             </if>
         </where>
@@ -359,4 +359,120 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             , cd.dept_name
         </if>
     </select>
+
+    <select id="selectFsOrderReportVO" resultType="com.fs.his.vo.FsOrderReportVO">
+        SELECT
+        c.company_name AS companyName,
+        <!-- 问诊订单统计 -->
+        COALESCE(inquiryStats.order_count, 0) AS inquiryOrderCount,
+        COALESCE(inquiryStats.order_amount, 0) AS inquiryOrderAmount,
+        <!-- 积分商品订单统计 -->
+        COALESCE(integralStats.order_count, 0) AS integralOrderCount,
+        COALESCE(integralStats.order_amount, 0) AS integralOrderAmount,
+        <!-- 套餐包订单统计 -->
+        COALESCE(packageStats.order_count, 0) AS packageOrderCount,
+        COALESCE(packageStats.order_amount, 0) AS packageOrderAmount
+        FROM company c
+        LEFT JOIN (
+        SELECT
+        company_id,
+        COUNT(*) AS order_count,
+        COALESCE(SUM(pay_money), 0) AS order_amount
+        FROM fs_inquiry_order
+        WHERE status = 3
+        <if test="stTime != null and endEndTime != null">
+            AND create_time BETWEEN #{stTime} AND #{endEndTime}
+        </if>
+        GROUP BY company_id
+        ) AS inquiryStats ON c.company_id = inquiryStats.company_id
+
+        LEFT JOIN (
+        SELECT
+        company_id,
+        COUNT(*) AS order_count,
+        COALESCE(SUM(pay_money), 0) AS order_amount
+        FROM fs_integral_order
+        WHERE status = 3 and pay_money IS NOT NULL
+        <if test="stTime != null and endEndTime != null">
+            AND create_time BETWEEN #{stTime} AND #{endEndTime}
+        </if>
+        GROUP BY company_id
+        ) AS integralStats ON c.company_id = integralStats.company_id
+
+        LEFT JOIN (
+        SELECT
+        company_id,
+        COUNT(*) AS order_count,
+        COALESCE(SUM(pay_money), 0) AS order_amount
+        FROM fs_package_order
+        WHERE status = 3
+        <if test="stTime != null and endEndTime != null">
+            AND create_time BETWEEN #{stTime} AND #{endEndTime}
+        </if>
+        GROUP BY company_id
+        ) AS packageStats ON c.company_id = packageStats.company_id
+
+        WHERE (inquiryStats.order_count > 0
+        OR integralStats.order_count > 0
+        OR packageStats.order_count > 0)
+        <if test="companyId != null">
+            AND c.company_id = #{companyId}
+        </if>
+    </select>
+    <select id="selectFsOrderReportVODept" resultType="com.fs.his.vo.FsOrderReportVO">
+        SELECT
+            d.dept_name AS deptName,
+            COALESCE(SUM(inquiryStats.order_count), 0) AS inquiryOrderCount,
+            COALESCE(SUM(inquiryStats.order_amount), 0) AS inquiryOrderAmount,
+            COALESCE(SUM(integralStats.order_count), 0) AS integralOrderCount,
+            COALESCE(SUM(integralStats.order_amount), 0) AS integralOrderAmount,
+            COALESCE(SUM(packageStats.order_count), 0) AS packageOrderCount,
+            COALESCE(SUM(packageStats.order_amount), 0) AS packageOrderAmount
+            FROM company_dept d LEFT JOIN company c ON d.dept_id = c.dept_id
+            LEFT JOIN ( SELECT
+                company_id,
+                COUNT(*) AS order_count,
+                COALESCE(SUM(pay_money), 0) AS order_amount
+            FROM fs_inquiry_order
+            WHERE status = 3
+        <if test="stTime != null and endEndTime != null">
+            AND create_time BETWEEN #{stTime} AND #{endEndTime}
+        </if>
+            GROUP BY company_id
+        ) AS inquiryStats ON c.company_id = inquiryStats.company_id
+
+                 LEFT JOIN (
+            SELECT
+                company_id,
+                COUNT(*) AS order_count,
+                COALESCE(SUM(pay_money), 0) AS order_amount
+            FROM fs_integral_order
+            WHERE status = 3 AND pay_money IS NOT NULL
+        <if test="stTime != null and endEndTime != null">
+            AND create_time BETWEEN #{stTime} AND #{endEndTime}
+        </if>
+            GROUP BY company_id
+        ) AS integralStats ON c.company_id = integralStats.company_id
+
+                 LEFT JOIN (
+            SELECT
+                company_id,
+                COUNT(*) AS order_count,
+                COALESCE(SUM(pay_money), 0) AS order_amount
+            FROM fs_package_order
+            WHERE status = 3
+        <if test="stTime != null and endEndTime != null">
+            AND create_time BETWEEN #{stTime} AND #{endEndTime}
+        </if>
+            GROUP BY company_id
+        ) AS packageStats ON c.company_id = packageStats.company_id
+
+        WHERE (inquiryStats.order_count > 0
+            OR integralStats.order_count > 0
+            OR packageStats.order_count > 0)
+        <if test="deptId != null and deptId != ''">
+            AND d.dept_id = #{deptId}
+        </if>
+        GROUP BY d.dept_id, d.dept_name
+    </select>
 </mapper>