Browse Source

web端权限,以及web端首页报表

LiRong 3 months ago
parent
commit
9d43e74f26
25 changed files with 220 additions and 72 deletions
  1. 7 0
      leromro-admin/src/main/java/com/leromro/web/controller/system/SysUserController.java
  2. 1 1
      leromro-common/src/main/java/com/leromro/common/constant/CommonConstants.java
  3. 2 2
      leromro-core/src/main/java/com/leromro/core/controller/LSlideshowController.java
  4. 38 30
      leromro-core/src/main/java/com/leromro/core/controller/OrderRefundController.java
  5. 73 29
      leromro-core/src/main/java/com/leromro/core/controller/OrgStatDataController.java
  6. 10 0
      leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java
  7. 4 0
      leromro-core/src/main/java/com/leromro/core/controller/VolunteerTakeRecordController.java
  8. 6 0
      leromro-core/src/main/java/com/leromro/core/domain/dto/HomePageDTO.java
  9. 3 0
      leromro-core/src/main/java/com/leromro/core/domain/dto/VolunteerInfoDTO.java
  10. 3 0
      leromro-core/src/main/java/com/leromro/core/domain/vo/BusinessManagementVO.java
  11. 3 0
      leromro-core/src/main/java/com/leromro/core/domain/vo/MainOrderInfoVO.java
  12. 7 0
      leromro-core/src/main/java/com/leromro/core/domain/vo/SecondOrderInfoVO.java
  13. 3 0
      leromro-core/src/main/java/com/leromro/core/mapper/VolunteerInfoMapper.java
  14. 3 0
      leromro-core/src/main/java/com/leromro/core/service/IVolunteerInfoService.java
  15. 4 0
      leromro-core/src/main/java/com/leromro/core/service/impl/OrderRefundServiceImpl.java
  16. 9 0
      leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerInfoServiceImpl.java
  17. 12 0
      leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerTakeRecordServiceImpl.java
  18. 1 1
      leromro-core/src/main/resources/mapper/core/BusinessManagementMapper.xml
  19. 1 1
      leromro-core/src/main/resources/mapper/core/MainOrdersMapper.xml
  20. 1 0
      leromro-core/src/main/resources/mapper/core/OrderRefundMapper.xml
  21. 2 3
      leromro-core/src/main/resources/mapper/core/SecondOrdersMapper.xml
  22. 7 1
      leromro-core/src/main/resources/mapper/core/VolunteerInfoMapper.xml
  23. 3 1
      leromro-system/src/main/java/com/leromro/system/mapper/SysUserMapper.java
  24. 6 0
      leromro-system/src/main/java/com/leromro/system/service/impl/SysUserServiceImpl.java
  25. 11 3
      leromro-system/src/main/resources/mapper/system/SysUserMapper.xml

+ 7 - 0
leromro-admin/src/main/java/com/leromro/web/controller/system/SysUserController.java

@@ -17,6 +17,7 @@ import com.leromro.system.service.ISysDeptService;
 import com.leromro.system.service.ISysPostService;
 import com.leromro.system.service.ISysRoleService;
 import com.leromro.system.service.ISysUserService;
+import com.leromro.system.service.impl.SysUserServiceImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.lang3.ArrayUtils;
@@ -28,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 /**
@@ -51,6 +53,8 @@ public class SysUserController extends BaseController
 
     @Autowired
     private ISysPostService postService;
+    @Autowired
+    private SysUserServiceImpl sysUserServiceImpl;
 
     /**
      * 获取用户列表
@@ -70,6 +74,9 @@ public class SysUserController extends BaseController
     public TableDataInfo<SysUser> userList(SysUser user)
     {
         startPage();
+        SysUser sysUser = sysUserServiceImpl.selectUserById(SecurityUtils.getUserId());
+        user.setAreaType(sysUser.getAreaType());
+        user.setDeptId(SecurityUtils.getDeptId());
         List<SysUser> list = userService.userList(user);
         return getDataTable(list);
     }

+ 1 - 1
leromro-common/src/main/java/com/leromro/common/constant/CommonConstants.java

@@ -18,5 +18,5 @@ public class CommonConstants {
     //校验省市区(和志愿者表的联查)
     public static final String CHECK_VOLUNTEER_PROVINCE_CITY_DISTRICT = "lvi.province_code,lvi.city_code,lvi.district_code";
     //校验省市区(无联查)
-    public static final String CHECK_PROVINCE_CITY_DISTRICT = "province_code,city_code,district_code";
+    public static final String CHECK_PROVINCE_CITY_DISTRICT = "province_code,city_code,district_code,service_centre_id";
 }

+ 2 - 2
leromro-core/src/main/java/com/leromro/core/controller/LSlideshowController.java

@@ -83,7 +83,7 @@ public class LSlideshowController extends BaseController
     @ApiOperation("web新增主页轮播图图片,传入图片 前端分割")
     /*@PreAuthorize("@ss.hasPermi('core:slideshow:add')")*/
     @Log(title = "主页轮播图或后续其他广告图片", businessType = BusinessType.INSERT)
-    @PostMapping
+    @PutMapping
     public AjaxResult add(@RequestBody Slideshow slideshow)
     {
         return toAjax(lSlideshowService.save(slideshow));
@@ -95,7 +95,7 @@ public class LSlideshowController extends BaseController
     @ApiOperation("web修改主页轮播图或后续其他广告图片")
   //  @PreAuthorize("@ss.hasPermi('core:slideshow:edit')")
     @Log(title = "主页轮播图或后续其他广告图片", businessType = BusinessType.UPDATE)
-    @PutMapping
+    @PostMapping
     public AjaxResult edit(@RequestBody Slideshow slideshow)
     {
         return toAjax(lSlideshowService.updateLSlideshow(slideshow));

+ 38 - 30
leromro-core/src/main/java/com/leromro/core/controller/OrderRefundController.java

@@ -1,10 +1,14 @@
 package com.leromro.core.controller;
 
 import java.util.List;
+import java.util.Objects;
 
+import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.MainOrders;
 import com.leromro.core.domain.vo.OrderRefundVO;
 import com.leromro.core.domain.vo.WebOrderRefundVO;
+import com.leromro.system.mapper.SysUserMapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import com.leromro.common.core.domain.R;
@@ -27,23 +31,24 @@ import com.leromro.common.core.page.TableDataInfo;
 
 /**
  * 订单取消/退款Controller
- * 
+ *
  * @author ruoyi
  * @date 2025-04-21
  */
 @RestController
 @Api(tags = "订单取消,退款")
 @RequestMapping("/core/users/refund")
-public class OrderRefundController extends BaseController
-{
+public class OrderRefundController extends BaseController {
     @Autowired
     private IOrderRefundService lOrderRefundService;
+    @Autowired
+    private SysUserMapper sysUserMapper;
 
     /**
      * 查询订单取消/退款列表
      */
-/*    @ApiOperation(value ="查询 ", notes = "订单取消/退款列表")
-    *//*@PreAuthorize("@ss.hasPermi('core:refund:list')")*//*
+    /*    @ApiOperation(value ="查询 ", notes = "订单取消/退款列表")
+     *//*@PreAuthorize("@ss.hasPermi('core:refund:list')")*//*
     @GetMapping("/list")
     public TableDataInfo<OrderRefund> list(OrderRefund orderRefund)
     {
@@ -51,10 +56,15 @@ public class OrderRefundController extends BaseController
         List<OrderRefund> list = lOrderRefundService.selectLOrderRefundList(orderRefund);
         return getDataTable(list);
     }*/
-    @ApiOperation(value ="web端 退款列表", notes = "传入分页参数")
+    @ApiOperation(value = "web端 退款列表", notes = "传入分页参数")
     @GetMapping("web/list")
-    public TableDataInfo<WebOrderRefundVO> refundList(MainOrders mainOrders){
-        startPage();;
+    public TableDataInfo<WebOrderRefundVO> refundList(MainOrders mainOrders) {
+        startPage();
+        SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
+        if (Objects.equals(sysUser.getAreaType(), "4")) {
+            //如果是服务中心,那就把服务中心id传进去,查的时候联查
+            mainOrders.setServiceCenterId(SecurityUtils.getDeptId());
+        }
         List<WebOrderRefundVO> list = lOrderRefundService.selectWebOrderRefundList(mainOrders);
         return getDataTable(list);
     }
@@ -77,43 +87,41 @@ public class OrderRefundController extends BaseController
     /**
      * 获取订单取消/退款详细信息
      */
-    @ApiOperation(value =" web 获取 订单取消/退款详细信息", notes = "传入路径参数,退款单号id")
+    @ApiOperation(value = " web 获取 订单取消/退款详细信息", notes = "传入路径参数,退款单号id")
     /*@PreAuthorize("@ss.hasPermi('core:refund:query')")*/
     @GetMapping(value = "/refundInfo/{orderRefundId}")
-    public R<OrderRefund> getInfo(@PathVariable("orderRefundId") Long orderRefundId)
-    {
+    public R<OrderRefund> getInfo(@PathVariable("orderRefundId") Long orderRefundId) {
+
         return R.ok(lOrderRefundService.selectLOrderRefundByOrderRefundId(orderRefundId));
     }
 
     /**
      * 获取订单取消/退款详细信息
      */
-    @ApiOperation(value =" 小程序端 订单取消/退款信息 回显 ", notes = "传入主订单id")
+    @ApiOperation(value = " 小程序端 订单取消/退款信息 回显 ", notes = "传入主订单id")
     /*@PreAuthorize("@ss.hasPermi('core:refund:query')")*/
     @GetMapping(value = "/orderInfo/{mainOrderId}")
-    public R<OrderRefundVO> getRefundIdInfo(@PathVariable("mainOrderId") Long mainOrderId)
-    {
+    public R<OrderRefundVO> getRefundIdInfo(@PathVariable("mainOrderId") Long mainOrderId) {
         return R.ok(lOrderRefundService.selectOrderRefundByMainOrderId(mainOrderId));
     }
 
     /**
      * 新增订单取消/退款
      */
-    @ApiOperation(value ="小程序端 新增订单取消/退款 传入主订单id,退款图片以及原因")
-/*    @PreAuthorize("@ss.hasPermi('core:refund:add')")*/
-   /* @Log(title = "新增订单取消/退款  ", businessType = BusinessType.INSERT)*/
+    @ApiOperation(value = "小程序端 新增订单取消/退款 传入主订单id,退款图片以及原因")
+    /*    @PreAuthorize("@ss.hasPermi('core:refund:add')")*/
+    /* @Log(title = "新增订单取消/退款  ", businessType = BusinessType.INSERT)*/
     @PostMapping("/newOrderRefund")
-    public AjaxResult add(@RequestBody OrderRefund orderRefund)
-    {
+    public AjaxResult add(@RequestBody OrderRefund orderRefund) {
         return lOrderRefundService.insertLOrderRefund(orderRefund);
     }
 
     /**
      * 修改订单取消/退款
      */
- /*   @ApiOperation(value ="修改订单取消/退款", notes = "传入分页参数")
-   *//* @PreAuthorize("@ss.hasPermi('core:refund:edit')")*//*
-    *//*@Log(title = "修改订单取消/退款", businessType = BusinessType.UPDATE)*//*
+    /*   @ApiOperation(value ="修改订单取消/退款", notes = "传入分页参数")
+     *//* @PreAuthorize("@ss.hasPermi('core:refund:edit')")*//*
+     *//*@Log(title = "修改订单取消/退款", businessType = BusinessType.UPDATE)*//*
     @PutMapping("/updateRefund")
     public AjaxResult edit(@RequestBody OrderRefund orderRefund)
     {
@@ -123,23 +131,23 @@ public class OrderRefundController extends BaseController
     /**
      * 删除订单取消/退款
      */
-/*    @ApiOperation( value ="删除订单取消/退款", notes = "传入id数组,批量删除")
-   *//* @PreAuthorize("@ss.hasPermi('core:refund:remove')")*//*
-   *//* @Log(title = "删除订单取消/退款", businessType = BusinessType.DELETE)*//*
+    /*    @ApiOperation( value ="删除订单取消/退款", notes = "传入id数组,批量删除")
+     *//* @PreAuthorize("@ss.hasPermi('core:refund:remove')")*//*
+     *//* @Log(title = "删除订单取消/退款", businessType = BusinessType.DELETE)*//*
 	@DeleteMapping("/{orderRefundIds}")
     public R<Integer> remove(@PathVariable Long[] orderRefundIds)
     {
         return R.ok(lOrderRefundService.deleteLOrderRefundByOrderRefundIds(orderRefundIds));
     }*/
+
     /**
      * 审批通过订单退款 以及后续流程。
      */
     @ApiOperation(value = "web端 订单退款审批接口传入mainOrderId  orderRefundId refundAmount 状态", notes = "传入mainOrderId  orderRefundId refundAmount 还有状态")
-   /* @PreAuthorize("@ss.hasPermi('core:refund:remove')")*/
-  /*  @Log(title = "订单退款 审批", businessType = BusinessType.UPDATE)*/
-	@PostMapping("/checkOrderRefund")
-    public AjaxResult checkOrderRefund(@RequestBody OrderRefund orderRefund)
-    {
+    /* @PreAuthorize("@ss.hasPermi('core:refund:remove')")*/
+    /*  @Log(title = "订单退款 审批", businessType = BusinessType.UPDATE)*/
+    @PostMapping("/checkOrderRefund")
+    public AjaxResult checkOrderRefund(@RequestBody OrderRefund orderRefund) {
 
         return lOrderRefundService.checkOrderRefund(orderRefund);
     }

+ 73 - 29
leromro-core/src/main/java/com/leromro/core/controller/OrgStatDataController.java

@@ -6,9 +6,13 @@ import java.util.*;
 import java.util.stream.Collectors;
 import javax.servlet.http.HttpServletResponse;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.leromro.common.core.domain.entity.SysDept;
+import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.utils.DateUtils;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.Address;
 import com.leromro.core.domain.SecondOrder;
@@ -20,7 +24,10 @@ import com.leromro.core.domain.vo.UserSummaryVO;
 import com.leromro.core.service.IAddressService;
 import com.leromro.core.service.ISecondOrderService;
 import com.leromro.core.service.IVolunteerInfoService;
+import com.leromro.framework.web.domain.server.Sys;
+import com.leromro.system.mapper.SysUserMapper;
 import com.leromro.system.service.ISysDeptService;
+import com.leromro.system.service.impl.SysUserServiceImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import com.leromro.common.core.domain.R;
@@ -46,7 +53,7 @@ import com.leromro.common.core.page.TableDataInfo;
 
 /**
  * 平台机构数据统计Controller
- * 
+ *
  * @author ruoyi
  * @date 2025-04-30
  */
@@ -54,8 +61,7 @@ import com.leromro.common.core.page.TableDataInfo;
 @Api(tags = "(首页)平台机构数据统计")
 @RequiredArgsConstructor
 @RequestMapping("/core/org/stat")
-public class OrgStatDataController extends BaseController
-{
+public class OrgStatDataController extends BaseController {
     private final IOrgStatDataService orgStatDataService;
 
     private final ISecondOrderService secondOrderService;
@@ -66,61 +72,100 @@ public class OrgStatDataController extends BaseController
 
     private final ISysDeptService deptService;
 
+    private final SysUserServiceImpl sysUserServiceImpl;
+    private final SysUserMapper sysUserMapper;
+
     /**
      * 订单总览
      */
     @ApiOperation(value = "订单总览", notes = "前端计算今日,昨天,本周到startDate字段,全部则传null")
     @PostMapping("/orderSummary")
-    public R<OrderSummaryVO> orderSummary(@RequestBody HomePageDTO dto)
-    {
+    public R<OrderSummaryVO> orderSummary(@RequestBody HomePageDTO dto) {
         OrderSummaryVO orderSummaryVO = new OrderSummaryVO();
         //根据服务中心进行区分
         SysDept sysDept = deptService.selectDeptById(SecurityUtils.getDeptId());
-        if (sysDept.getAreaType().equals("4")){
+        if (sysDept.getAreaType().equals("4")) {
             dto.setDeptId(SecurityUtils.getDeptId());
         }
+        LocalDate today = LocalDate.now();
+        switch (dto.getPageType()) {
+            case "1":
+                //昨天
+                dto.setStartDate(today.minusDays(1));
+                dto.setEndDate(today);
+                break;
+            case "2":
+                //今天
+                dto.setStartDate(today);
+                dto.setEndDate(today.plusDays(1));
+                break;
+            case "3":
+                //本月
+                LocalDate firstDayOfMonth = today.withDayOfMonth(1);
+                LocalDate lastDayOfMonth = today.withDayOfMonth(today.lengthOfMonth());
+                dto.setStartDate(firstDayOfMonth);
+                dto.setEndDate(lastDayOfMonth);
+                break;
+        }
+
         //获取指定时间范围的订单
         List<SecondOrder> list = secondOrderService.getCurrentOrgSecondOrderList(dto);
         //订单总量
         orderSummaryVO.setOrderTotal(list.size());
         //取消单量
-        orderSummaryVO.setOrderCancelTotal((int) list.stream().filter(item ->  "4".equals(item.getOrderStatus())).count());
+        orderSummaryVO.setOrderCancelTotal((int) list.stream().filter(item -> "4".equals(item.getOrderStatus())).count());
         //订单金额
         orderSummaryVO.setOrderTotalAmount(BigDecimal.valueOf(list.stream().mapToDouble(item -> item.getServiceTotalPrice().doubleValue()).sum()));
         //完成单量
-        orderSummaryVO.setOrderFinishTotal((int) list.stream().filter(item ->  "2".equals(item.getOrderStatus())).count());
+        orderSummaryVO.setOrderFinishTotal((int) list.stream().filter(item -> "2".equals(item.getOrderStatus())).count());
         return R.ok(orderSummaryVO);
     }
 
     /**
      * 人员总览
      */
-    @ApiOperation(value = "人员总览", notes = "前端计算今日,昨天,本周到startDate字段,全部则传null")
+    @ApiOperation(value = "人员总览", notes = "前端传入人员类型")
     @PostMapping("/userSummary")
-    public R<UserSummaryVO> userSummary(@RequestBody HomePageDTO dto)
-    {
+    public R<UserSummaryVO> userSummary(@RequestBody HomePageDTO dto) {
         UserSummaryVO userSummaryVO = new UserSummaryVO();
         //判断人员类型是否有值
         if (ObjectUtil.isNull(dto.getUserType())) {
             return R.fail("人员类型不能为空");
         }
-        //获取当前机构本月记录,并按照日期映射
-        List<OrgStatData> statDataList = orgStatDataService.getCurrentOrgMonthStatDataList(dto);
-        Map<LocalDate, OrgStatData> statDataMap = statDataList.stream().collect(Collectors.toMap(OrgStatData::getStatDate, l -> l));
-        if (dto.getUserType() == 1){
+        //根据服务中心进行区分
+        SysUser sysUser = new SysUser();
+        SysDept sysDept = deptService.selectDeptById(SecurityUtils.getDeptId());
+        if (sysDept.getAreaType().equals("4")) {
+            sysUser.setDeptId(SecurityUtils.getDeptId());
+        }
+        // 获取今天、昨天、本月第一天/最后一天(时间部分为 00:00:00)
+        Date today = DateUtil.beginOfDay(DateUtils.getNowDate());
+        Date yesterday = DateUtil.beginOfDay(DateUtil.offsetDay(today, -1));
+        Date firstDayOfMonth = DateUtil.beginOfDay(DateUtil.beginOfMonth(today));
+        Date lastDayOfMonth = DateUtil.beginOfDay(DateUtil.endOfMonth(today));
+
+        if (dto.getUserType() == 1) {
+            //查看sysUser表 如果是用户,则openId != null user_platform = 0 del_flag = 0
+            List<SysUser> clientList = sysUserServiceImpl.selectClientList(sysUser);
+            //查到所有的用户,然后根据时间分类就好了
+            userSummaryVO.setUserTotal(clientList.size());
+            userSummaryVO.setTodayAdd((int) clientList.stream().filter(user -> DateUtil.beginOfDay(user.getCreateTime()).equals(today)).count());
+            userSummaryVO.setYesterdayAdd((int) clientList.stream().filter(user -> DateUtil.beginOfDay(user.getCreateTime()).equals(yesterday)).count());
+            userSummaryVO.setMonthAdd((int) clientList.stream()
+                    .filter(user -> DateUtil.beginOfDay(user.getCreateTime()).after(firstDayOfMonth))
+                    .filter(user -> DateUtil.beginOfDay(user.getCreateTime()).before(lastDayOfMonth))
+                    .count());
             //如果为用户则查看用户地址
-            List<Address> addressList = addressService.getCurrentOrgClientList(dto);
-            userSummaryVO.setUserTotal(addressList.size());
-            userSummaryVO.setTodayAdd(ObjectUtil.isNull(statDataMap.get(LocalDate.now()))? addressList.size():(addressList.size() - statDataMap.get(LocalDate.now()).getAllClientTotal()));
-            userSummaryVO.setYesterdayAdd(ObjectUtil.isNull(statDataMap.get(LocalDate.now().minusDays(1)))? addressList.size():(addressList.size() - statDataMap.get(LocalDate.now().minusDays(1)).getAllClientTotal()));
-            userSummaryVO.setMonthAdd(ObjectUtil.isNull(statDataMap.get(LocalDate.now().withDayOfMonth(1)))? addressList.size():(addressList.size() - statDataMap.get(LocalDate.now().withDayOfMonth(1)).getAllClientTotal()));
-        }else {
+        } else {
             //如果为志愿者则查看志愿者审批通过时间
-            List<VolunteerInfo> volunteerInfoList = volunteerInfoService.getCurrentOrgVolunteerList(dto);
+            List<VolunteerInfo> volunteerInfoList = volunteerInfoService.selectVolunteerGroupByUserId(sysUser);
             userSummaryVO.setUserTotal(volunteerInfoList.size());
-            userSummaryVO.setTodayAdd(ObjectUtil.isNull(statDataMap.get(LocalDate.now()))? volunteerInfoList.size():(volunteerInfoList.size() - statDataMap.get(LocalDate.now()).getAllVolunteerTotal()));
-            userSummaryVO.setYesterdayAdd(ObjectUtil.isNull(statDataMap.get(LocalDate.now().minusDays(1)))? volunteerInfoList.size():(volunteerInfoList.size() - statDataMap.get(LocalDate.now().minusDays(1)).getAllVolunteerTotal()));
-            userSummaryVO.setMonthAdd(ObjectUtil.isNull(statDataMap.get(LocalDate.now().withDayOfMonth(1)))? volunteerInfoList.size():(volunteerInfoList.size() - statDataMap.get(LocalDate.now().withDayOfMonth(1)).getAllVolunteerTotal()));
+            userSummaryVO.setTodayAdd((int) volunteerInfoList.stream().filter(user -> DateUtil.beginOfDay(user.getCreateTime()).equals(today)).count());
+            userSummaryVO.setYesterdayAdd((int) volunteerInfoList.stream().filter(user -> DateUtil.beginOfDay(user.getCreateTime()).equals(yesterday)).count());
+            userSummaryVO.setMonthAdd((int) volunteerInfoList.stream()
+                    .filter(user -> DateUtil.beginOfDay(user.getCreateTime()).after(firstDayOfMonth))
+                    .filter(user -> DateUtil.beginOfDay(user.getCreateTime()).before(lastDayOfMonth))
+                    .count());
         }
         return R.ok(userSummaryVO);
     }
@@ -130,17 +175,16 @@ public class OrgStatDataController extends BaseController
      */
     @ApiOperation(value = "机构排名", notes = "默认查询所有区县")
     @PostMapping("/orgRank")
-    public R<OrgRankVO> orgRank(@RequestBody HomePageDTO dto)
-    {
+    public R<OrgRankVO> orgRank(@RequestBody HomePageDTO dto) {
         OrgRankVO orgRankVO = new OrgRankVO();
         //获取今天所有订单
         List<SecondOrder> list = secondOrderService.getTodayAllOrderList(dto);
-        if (ObjectUtil.isEmpty(list)){
+        if (ObjectUtil.isEmpty(list)) {
             return R.ok(orgRankVO);
         }
         //获取所有区县机构(不含服务中心)
         List<SysDept> deptList = deptService.getAllOrgList();
-        if (ObjectUtil.isEmpty(deptList)){
+        if (ObjectUtil.isEmpty(deptList)) {
             return R.ok(orgRankVO);
         }
         Map<String, String> codeMapName = deptList.stream().collect(Collectors.toMap(SysDept::getDistrictCode, SysDept::getDeptName));

+ 10 - 0
leromro-core/src/main/java/com/leromro/core/controller/VolunteerInfoController.java

@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
 import com.leromro.common.core.controller.BaseController;
 import com.leromro.common.core.domain.AjaxResult;
 import com.leromro.common.core.domain.R;
+import com.leromro.common.core.domain.entity.SysUser;
 import com.leromro.common.core.page.TableDataInfo;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.VolunteerInfo;
@@ -14,6 +15,7 @@ import com.leromro.core.domain.vo.VolunteerInfoVO;
 import com.leromro.core.service.IVolunteerInfoService;
 import com.leromro.core.utils.SendSmsUtil;
 import com.leromro.framework.config.ConstantsConfig;
+import com.leromro.system.mapper.SysUserMapper;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
@@ -22,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
+import java.util.Objects;
 
 
 /**
@@ -35,6 +38,8 @@ import java.util.List;
 public class VolunteerInfoController extends BaseController {
     @Autowired
     private IVolunteerInfoService volunteerInfoService;
+    @Autowired
+    private SysUserMapper sysUserMapper;
 
     /**
      * 新增志愿者信息
@@ -79,6 +84,11 @@ public class VolunteerInfoController extends BaseController {
     public TableDataInfo<VolunteerInfo> webList(VolunteerInfoDTO dto)
     {
         startPage();
+        SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
+        if (Objects.equals(sysUser.getAreaType(), "4")){
+            //如果是服务中心,那就把服务中心id传进去,查的时候联查
+            dto.setServiceCenterId(SecurityUtils.getDeptId());
+        }
         List<VolunteerInfo> list = volunteerInfoService.webList(dto);
         return getDataTable(list);
     }

+ 4 - 0
leromro-core/src/main/java/com/leromro/core/controller/VolunteerTakeRecordController.java

@@ -5,8 +5,11 @@ import javax.servlet.http.HttpServletResponse;
 
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.leromro.common.core.domain.entity.SysUser;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.VolunteerInfo;
+import com.leromro.system.mapper.SysUserMapper;
+import com.leromro.system.service.impl.SysUserServiceImpl;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import com.leromro.common.core.domain.R;
@@ -43,6 +46,7 @@ public class VolunteerTakeRecordController extends BaseController
     @Autowired
     private IVolunteerTakeRecordService volunteerTakeRecordService;
 
+
     /**
      * 查询志愿者提现申请记录列表
      */

+ 6 - 0
leromro-core/src/main/java/com/leromro/core/domain/dto/HomePageDTO.java

@@ -15,6 +15,12 @@ public class HomePageDTO {
     @ApiModelProperty("开始日期")
     private LocalDate startDate;
 
+    @ApiModelProperty("结束日期")
+    private LocalDate endDate;
+
+    @ApiModelProperty("报表类型:(1昨天 2今天 3本月 4总数)")
+    private String pageType;
+
     @ApiModelProperty("省级区划编号")
     private String provinceCode;
 

+ 3 - 0
leromro-core/src/main/java/com/leromro/core/domain/dto/VolunteerInfoDTO.java

@@ -14,4 +14,7 @@ public class VolunteerInfoDTO extends VolunteerInfo {
 
     @ApiModelProperty(value = "验证码")
     private String code;
+
+    @ApiModelProperty(value = "服务中心id")
+    private Long serviceCenterId;
 }

+ 3 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/BusinessManagementVO.java

@@ -55,6 +55,9 @@ public class BusinessManagementVO implements INode<BusinessManagementVO> {
     @ApiModelProperty("图片")
     private String businessIcon;
 
+    @ApiModelProperty("描述")
+    private String businessDescribe;
+
     @ApiModelProperty("最低价格")
     private String minPrice;
 

+ 3 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/MainOrderInfoVO.java

@@ -107,6 +107,9 @@ public class MainOrderInfoVO {
     @ApiModelProperty("志愿者信息-志愿者照片")
     private String volunteerPicture;
 
+    @ApiModelProperty("订单信息-创建时间")
+    private String createTime;
+
     @ApiModelProperty("小订单列表")
     private List<SecondOrderInfoVO> secondOrderList;
 

+ 7 - 0
leromro-core/src/main/java/com/leromro/core/domain/vo/SecondOrderInfoVO.java

@@ -141,4 +141,11 @@ public class SecondOrderInfoVO {
 
     @ApiModelProperty("业务单号")
     private String secondOutTradeNo;
+
+    @ApiModelProperty("服务实际开始时间")
+    private String serviceStartTime;
+    @ApiModelProperty("服务实际结束时间")
+    private String serviceEndTime;
+
+
 }

+ 3 - 0
leromro-core/src/main/java/com/leromro/core/mapper/VolunteerInfoMapper.java

@@ -1,6 +1,7 @@
 package com.leromro.core.mapper;
 
 import com.leromro.common.core.domain.ListPermission;
+import com.leromro.common.core.domain.entity.SysUser;
 import com.leromro.core.domain.VolunteerInfo;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.leromro.core.domain.dto.HomePageDTO;
@@ -28,4 +29,6 @@ public interface VolunteerInfoMapper extends BaseMapper<VolunteerInfo> {
 
 
     List<VolunteerInfo> getCurrentOrgVolunteerList(ListPermission listPermission,@Param("dto") HomePageDTO dto);
+
+    List<VolunteerInfo> selectVolunteerGroupByUserId(ListPermission listPermission,@Param("user") SysUser sysUser);
 }

+ 3 - 0
leromro-core/src/main/java/com/leromro/core/service/IVolunteerInfoService.java

@@ -1,5 +1,6 @@
 package com.leromro.core.service;
 
+import com.leromro.common.core.domain.entity.SysUser;
 import com.leromro.core.domain.VolunteerInfo;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.leromro.core.domain.dto.HomePageDTO;
@@ -37,4 +38,6 @@ public interface IVolunteerInfoService extends IService<VolunteerInfo> {
      * @param volunteerInfo
      */
     void approval(VolunteerInfo volunteerInfo);
+
+    List<VolunteerInfo> selectVolunteerGroupByUserId(SysUser sysUser);
 }

+ 4 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/OrderRefundServiceImpl.java

@@ -19,6 +19,7 @@ import com.github.binarywang.wxpay.service.WxPayService;
 import com.leromro.common.constant.CommonConstants;
 import com.leromro.common.core.domain.AjaxResult;
 import com.leromro.common.core.domain.ListPermission;
+import com.leromro.common.core.domain.entity.SysUser;
 import com.leromro.common.exception.ServiceException;
 import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.domain.*;
@@ -26,6 +27,7 @@ import com.leromro.core.domain.vo.OrderRefundVO;
 import com.leromro.core.domain.vo.WebOrderRefundVO;
 import com.leromro.core.mapper.*;
 import com.leromro.core.utils.DateTimeUtil;
+import com.leromro.system.mapper.SysUserMapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.math3.stat.inference.OneWayAnova;
 import org.hibernate.validator.internal.constraintvalidators.bv.time.futureorpresent.FutureOrPresentValidatorForReadableInstant;
@@ -66,6 +68,8 @@ public class OrderRefundServiceImpl extends ServiceImpl<OrderRefundMapper, Order
     @Autowired
     @Qualifier("wxMiniPayRefundService")
     private WxPayService wxMiniPayRefundService;
+    @Autowired
+    private SysUserMapper sysUserMapper;
 
     /**
      * 查询订单取消/退款

+ 9 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerInfoServiceImpl.java

@@ -196,6 +196,15 @@ public class VolunteerInfoServiceImpl extends ServiceImpl<VolunteerInfoMapper, V
         userToVolunteerPointHandler(info.getVolunteerId());
     }
 
+    /**
+     * @param sysUser
+     * @return
+     */
+    @Override
+    public List<VolunteerInfo> selectVolunteerGroupByUserId(SysUser sysUser) {
+        return volunteerInfoMapper.selectVolunteerGroupByUserId(new ListPermission(SecondOrder.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT),sysUser);
+    }
+
     /**
      * 用户成为志愿者积分处理
      */

+ 12 - 0
leromro-core/src/main/java/com/leromro/core/service/impl/VolunteerTakeRecordServiceImpl.java

@@ -1,9 +1,14 @@
 package com.leromro.core.service.impl;
 
 import java.util.List;
+import java.util.Objects;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.leromro.common.core.domain.entity.SysUser;
+import com.leromro.common.utils.SecurityUtils;
 import com.leromro.core.mapper.VolunteerTakeRecordMapper;
 import com.leromro.common.utils.DateUtils;
+import com.leromro.system.service.impl.SysUserServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.leromro.core.mapper.VolunteerTakeRecordMapper;
@@ -22,6 +27,9 @@ public class VolunteerTakeRecordServiceImpl extends ServiceImpl<VolunteerTakeRec
     @Autowired
     private VolunteerTakeRecordMapper volunteerTakeRecordMapper;
 
+    @Autowired
+    private SysUserServiceImpl sysUserService;
+
     /**
      * 查询志愿者提现申请记录
      * 
@@ -43,6 +51,10 @@ public class VolunteerTakeRecordServiceImpl extends ServiceImpl<VolunteerTakeRec
     @Override
     public List<VolunteerTakeRecord> selectVolunteerTakeRecordList(VolunteerTakeRecord volunteerTakeRecord)
     {
+        SysUser sysUser = sysUserService.selectUserById(SecurityUtils.getUserId());
+        if (!Objects.equals(sysUser.getAreaType(), "0")){
+            throw new RuntimeException("当前权限不足!");
+        }
         return volunteerTakeRecordMapper.selectVolunteerTakeRecordList(volunteerTakeRecord);
     }
 

+ 1 - 1
leromro-core/src/main/resources/mapper/core/BusinessManagementMapper.xml

@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where business_management_id = #{businessManagementId} and del_flag ='0'
     </select>
     <select id="getTreeList" resultType="com.leromro.core.domain.vo.BusinessManagementVO">
-        select business_management_id as id,parent_id,business_name,business_tier_name,business_icon
+        select business_management_id as id,parent_id,business_name,business_tier_name,business_icon ,business_describe
         from l_business_management
         <where>
             find_in_set(#{parentId},ancestors)

+ 1 - 1
leromro-core/src/main/resources/mapper/core/MainOrdersMapper.xml

@@ -165,7 +165,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select
             lmo.address,lmo.client_name as name,lmo.client_telephone as telephone, lmo.province_name,lmo.city_name ,lmo.district_name,lmo.service_total_price,lmo.payment_method,lmo.order_status,lmo.main_order_id,lmo.out_trade_no,
             lvi.volunteer_info_id,lvi.volunteer_id,lvi.age,lvi.certification_picture,lvi.name as volunteerName ,lvi.phonenumber,lvi.sex,lvi.skill_describe,lvi.volunteer_picture,
-            lmo.service_category,lmo.service_duration,lmo.service_one_price,lvi.business_unit,lmo.single_quantity,lmo.total_times,lvi.business_describe,
+            lmo.service_category,lmo.service_duration,lmo.service_one_price,lvi.business_unit,lmo.single_quantity,lmo.total_times,lvi.create_time,lvi.business_describe,
             lmo.business_management_id,(select lbm.business_tier_name from l_business_management lbm where lmo.business_management_id = lbm.business_management_id) as businessManagementName
         from l_main_orders lmo left join l_volunteer_info lvi on lmo.volunteer_info_id = lvi.volunteer_info_id where main_order_id = #{mainOrderId} ;
     </select>

+ 1 - 0
leromro-core/src/main/resources/mapper/core/OrderRefundMapper.xml

@@ -90,6 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="mainOrders.clientName != null and mainOrders.clientName != ''">and lmo.client_name = #{mainOrders.clientName}</if>
             <if test="mainOrders.clientTelephone != null and mainOrders.clientTelephone != ''">and lmo.clien_telephone = #{mainOrders.clientTelephone}</if>
             <if test="mainOrders.businessManagementId != null and mainOrders.businessManagementId != ''">and lmo.business_management_id = #{mainOrders.businessManagementId}</if>
+            <if test="mainOrders.serviceCenterId != null and mainOrders.serviceCenterId != ''">and lmo.service_center_id = #{mainOrders.serviceCenterId}</if>
         </where>
 
     </select>

+ 2 - 3
leromro-core/src/main/resources/mapper/core/SecondOrdersMapper.xml

@@ -299,8 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="dto.provinceCode != null">and province_code = #{dto.provinceCode}</if>
             <if test="dto.cityCode != null">and city_code = #{dto.cityCode}</if>
             <if test="dto.districtCode != null">and district_code = #{dto.districtCode}</if>
-            <if test="dto.startDate != null">and create_time   &gt;= #{dto.startDate}</if>
-         <!--   <if test="dto.startDate != null">and create_time   &lt;= #{dto.startDate+1}</if>-->
+            <if test="dto.startDate != null and dto.pageType==1 or dto.pageType==2 or dto.pageType==3">and create_time &gt;= #{dto.startDate} AND create_time &lt;= #{dto.endDate}</if>
             <if test="dto.deptId != null">and service_center_id = #{dto.deptId}</if>
         </where>
     </select>
@@ -446,7 +445,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select
             lso.second_order_id,lso.score,lso.service_total_price,lso.order_status,lso.volunteer_settlement_status,lso.address,
             lso.volunteer_review,lso.volunteer_picture,lso.service_category,lso.user_review,lso.user_picture,
-            lso.ability_score,lso.clothing_score,lso.protocol_score,lso.quality_score,lso.province_code,lso.province_name,lso.city_name,lso.city_code,
+            lso.ability_score,lso.clothing_score,lso.protocol_score,lso.quality_score,lso.province_code,lso.province_name,lso.city_name,lso.city_code,lso.service_start_time,lso.service_end_time,
             lso.work_date,lso.work_start_time,lso.single_quantity,lso.work_number,lso.out_trade_no as secondOutTradeNo,lso.service_duration,
             (select sd.dept_name from sys_dept sd where lso.area_distribution_id = sd.dept_id) as areaDistributionName,
             (select sd.dept_name from sys_dept sd where lso.service_center_id = sd.dept_id) as serviceCenterName

+ 7 - 1
leromro-core/src/main/resources/mapper/core/VolunteerInfoMapper.xml

@@ -37,12 +37,13 @@
 
     <select id="webList" resultType="com.leromro.core.domain.VolunteerInfo"
             parameterType="com.leromro.core.domain.VolunteerInfo">
-        select * from l_volunteer_info lvi
+        select * from l_volunteer_info lvi left join sys_user su on lvi.volunteer_id = su.user_id
         <where>
             <if test="dto.serviceCategory != null "> and service_category = #{dto.serviceCategory}</if>
             <if test="dto.phonenumber != null">and phonenumber = #{dto.phonenumber}</if>
             <if test="dto.appStatus != null  and dto.appStatus != '' and dto.appStatus == 1"> and app_status in (1,3)</if>
             <if test="dto.appStatus != null  and dto.appStatus != '' and dto.appStatus == 2"> and app_status = 2</if>
+            <if test="dto.serviceCenterId != null  and dto.serviceCenterId != '' "> and su.service_centre_id = #{dto.serviceCenterId}</if>
             <!--<if test="name != null  and name != ''"> and lvi.name like concat('%', #{name}, '%')</if>
             <if test="score != null "> and lvi.score = #{score}</if>
             <if test="skillDescribe != null  and skillDescribe != ''"> and lvi.skill_describe = #{skillDescribe}</if>
@@ -71,6 +72,11 @@
         select * from l_volunteer_info
         where app_status = 2
     </select>
+    <select id="selectVolunteerGroupByUserId" resultType="com.leromro.core.domain.VolunteerInfo">
+        select lvi.volunteer_id ,s.create_time  from sys_user s left join l_volunteer_info lvi on s.user_id = lvi.volunteer_id
+        where s.del_flag = 0 and s.user_platform = 0 and lvi.volunteer_id
+        group by lvi.volunteer_id;
+    </select>
 
 
 </mapper>

+ 3 - 1
leromro-system/src/main/java/com/leromro/system/mapper/SysUserMapper.java

@@ -130,7 +130,7 @@ public interface SysUserMapper extends BaseMapper<SysUser>
      */
     public SysUser checkEmailUnique(String email);
 
-    List<SysUser> userList(ListPermission listPermission, SysUser user);
+    List<SysUser> userList(ListPermission listPermission,@Param("user") SysUser user);
 
     void addPoint(SysUser user);
 
@@ -139,4 +139,6 @@ public interface SysUserMapper extends BaseMapper<SysUser>
     UserPointInfoVO getUserPointInfo(Long userId);
 
     void unfreezePoint(@Param("userUnfreezePointDTOList") List<UserUnfreezePointDTO> userUnfreezePointDTOList);
+
+    List<SysUser> selectClientList(ListPermission listPermission,@Param("user")SysUser sysUser);
 }

+ 6 - 0
leromro-system/src/main/java/com/leromro/system/service/impl/SysUserServiceImpl.java

@@ -67,6 +67,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
 
     @Autowired
     protected Validator validator;
+    @Autowired
+    private SysUserMapper sysUserMapper;
 
     /**
      * 根据条件分页查询用户列表
@@ -590,4 +592,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     public void unfreezePoint(List<UserUnfreezePointDTO> userUnfreezePointDTOList) {
         baseMapper.unfreezePoint(userUnfreezePointDTOList);
     }
+
+    public List<SysUser> selectClientList(SysUser sysUser) {
+       return sysUserMapper.selectClientList(new ListPermission(SysUser.class, CommonConstants.CHECK_PROVINCE_CITY_DISTRICT), sysUser);
+    }
 }

+ 11 - 3
leromro-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -165,8 +165,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		select user_id, email from sys_user where email = #{email} and del_flag = '0' limit 1
 	</select>
 	<select id="userList" resultType="com.leromro.common.core.domain.entity.SysUser">
-		select * from sys_user where del_flag = '0' /*and user_or_worker != 0*/
-	</select>
+        select * from sys_user
+        <where>
+            del_flag = '0' /*and user_or_worker != 0*/
+			<if test="user.deptId != null and user.deptId != '' and user.areaType='4'">and service_centre_id = #{user.deptId}</if>
+        </where>
+    </select>
 
     <select id="getUserPointInfo" resultType="com.leromro.system.domain.vo.UserPointInfoVO">
 		select
@@ -175,8 +179,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		from sys_user a
 		where user_id = #{userId}
 	</select>
+	<select id="selectClientList" resultType="com.leromro.common.core.domain.entity.SysUser">
+		select * from sys_user where  user_open_id is not null and  user_platform = 0 and del_flag = 0;
+		<if test="user.serviceCentreId != null and user.serviceCentreId != ''"> and service_center_id =#{user.serviceCentreId}</if>
+	</select>
 
-    <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
+	<insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId">
  		insert into sys_user(
  			<if test="userId != null and userId != 0">user_id,</if>
  			<if test="deptId != null and deptId != 0">dept_id,</if>