Quellcode durchsuchen

新增
1、新增取消预约接口
2、新增获取指定手机号(人)、指定日期的当日、当周、当月的预约参观数量接口
修改
1、预约模块联调调整功能完善
BUGFIX
1、家属申请外出模块解决未审批通过也能扫码出院的问题
2、解决长者退住后补充日常费用部分信息缺失导致结算时日常费用未同步更新状态的问题

liangwenxuan vor 3 Wochen
Ursprung
Commit
3b6312e1fd
15 geänderte Dateien mit 166 neuen und 20 gelöschten Zeilen
  1. 5 1
      yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java
  2. 1 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/AppointmentConfigController.java
  3. 21 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/JiashuVisitAppointmentController.java
  4. 5 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/vo/AppointmentConfigSaveReqVO.java
  5. 5 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/vo/RefundSettlementOrderPageRespVO.java
  6. 13 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/vo/excel/DailyExpensesExportExcelVO.java
  7. 3 3
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/appointment/AppAppointmentQuotaServiceImpl.java
  8. 6 2
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/AppointmentConfigService.java
  9. 29 12
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/AppointmentConfigServiceImpl.java
  10. 1 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/DailyExpensesServiceImpl.java
  11. 1 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/ElderlyAskLeaveServiceImpl.java
  12. 1 1
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/RefundSettlementOrderServiceImpl.java
  13. 16 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/miniapp/JiashuVisitAppointmentService.java
  14. 57 0
      yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/miniapp/JiashuVisitAppointmentServiceImpl.java
  15. 2 0
      yudao-server/src/main/resources/application.yaml

+ 5 - 1
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java

@@ -277,7 +277,7 @@ public interface ErrorCodeConstants {
     ErrorCode ELDERLY_RENEW_ORDER_NOT_EXISTS = new ErrorCode(1_008_004_000, "长者不存在续签月账单,请先生成!");
     // ========== 外出相关 1-008-005-000 ==========
     ErrorCode ELDERLY_LEAVE_UPDATE_DATE_OVER_EXPIRE = new ErrorCode(1_008_005_000, "返院时间大于合同到期时间,请检查!");
-    ErrorCode ELDERLY_LEAVE_SCAN_OUT_NOT_FOUND = new ErrorCode(1_008_005_001, "未找到外出时间为空的外出记录,无法进行出院扫码!");
+    ErrorCode ELDERLY_LEAVE_SCAN_OUT_NOT_FOUND = new ErrorCode(1_008_005_001, "未找到已审批的外出记录,无法进行出院扫码!");
     ErrorCode ELDERLY_LEAVE_SCAN_RETURN_NOT_FOUND = new ErrorCode(1_008_005_002, "未找到实际返回时间为空的外出记录,无法进行回院扫码!");
     // ========== 菜品相关 1-008-006-000 ==========
     ErrorCode DISHES_EXISTS = new ErrorCode(1_008_006_000, "该菜品已存在,请检查!");
@@ -323,4 +323,8 @@ public interface ErrorCodeConstants {
     ErrorCode APPOINTMENT_PERSON_LIMIT = new ErrorCode(1_002_040_005, "您预约次数已达上限");
     ErrorCode APPOINTMENT_GROUP_LIMIT = new ErrorCode(1_002_040_006, "该时段名额已满");
     ErrorCode APPOINTMENT_TIME_NOT_ALLOWED = new ErrorCode(1_002_040_007, "预约时间段不在可预约范围内");
+
+    // ========== 探访预约(家属小程序) 1-002-041-000 ==========
+    ErrorCode VISIT_APPOINTMENT_NOT_FOUND = new ErrorCode(1_002_041_000, "探访预约记录不存在");
+    ErrorCode VISIT_APPOINTMENT_CANCELED = new ErrorCode(1_002_041_001, "该预约已取消或已删除,无法重复取消");
 }

+ 1 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/AppointmentConfigController.java

@@ -36,7 +36,7 @@ public class AppointmentConfigController {
     }
 
     @PostMapping("/update")
-    @Operation(summary = "预约配置更新(先删除后新增)")
+    @Operation(summary = "预约配置更新")
     public CommonResult<Boolean> update(@RequestBody @Valid AppointmentConfigSaveReqVO reqVO) {
         appointmentConfigService.update(reqVO);
         return success(true);

+ 21 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/JiashuVisitAppointmentController.java

@@ -4,11 +4,14 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
 import cn.iocoder.yudao.framework.common.util.date.DateUtils;
 import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
 import cn.iocoder.yudao.module.system.controller.admin.biz.vo.VisitAppointmentCountRespVO;
+import cn.iocoder.yudao.module.system.dal.dataobject.miniapp.JiashuVisitAppointmentDO;
 import cn.iocoder.yudao.module.system.service.miniapp.JiashuVisitAppointmentService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
@@ -41,4 +44,22 @@ public class JiashuVisitAppointmentController {
         return success(jiashuVisitAppointmentService.getVisitCount(tenantId, date));
     }
 
+    @GetMapping("/countByPhone")
+    @Operation(summary = "获取指定手机号(人)、指定日期的当日、当周、当月的预约参观数量")
+    @PermitAll
+    @TenantIgnore
+    public CommonResult<VisitAppointmentCountRespVO> countByPhone(@RequestParam(name = "phone") String phone,
+                                                                  @RequestParam(name = "date", required = false) @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY) LocalDate date) {
+        return success(jiashuVisitAppointmentService.getVisitCountByPhone(phone, date));
+    }
+
+    @PostMapping("/cancel")
+    @Operation(summary = "取消探访预约")
+    @PermitAll
+    @TenantIgnore
+    public CommonResult<Boolean> cancel(@RequestBody JiashuVisitAppointmentDO appointment) {
+        jiashuVisitAppointmentService.cancelVisitAppointment(appointment.getId());
+        return success(true);
+    }
+
 }

+ 5 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/vo/AppointmentConfigSaveReqVO.java

@@ -29,4 +29,9 @@ public class AppointmentConfigSaveReqVO {
     @Valid
     private List<AppointmentGroupDO> group;
 
+    /**
+     * 待删除的预约组 id 列表(前端删除组时传入其 id,后端据此删除)
+     */
+    private List<Long> deleteIds;
+
 }

+ 5 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/vo/RefundSettlementOrderPageRespVO.java

@@ -1,11 +1,14 @@
 package cn.iocoder.yudao.module.system.controller.admin.biz.vo;
 
 import cn.iocoder.yudao.module.system.dal.dataobject.biz.RefundSettlementOrderDO;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 
 import java.time.LocalDate;
 
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
+
 @Schema(description = "管理后台 - 长者退住结算单分页 Response VO")
 @Data
 @ToString(callSuper = true)
@@ -15,9 +18,11 @@ import java.time.LocalDate;
 public class RefundSettlementOrderPageRespVO extends RefundSettlementOrderDO {
 
     @Schema(description = "退住日期")
+    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
     private LocalDate retreatDate;
 
     @Schema(description = "费用截止日期")
+    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
     private LocalDate costDeadlineDate;
 
 }

+ 13 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/biz/vo/excel/DailyExpensesExportExcelVO.java

@@ -1,6 +1,8 @@
 package cn.iocoder.yudao.module.system.controller.admin.biz.vo.excel;
 
 import com.alibaba.excel.annotation.ExcelProperty;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -8,6 +10,9 @@ import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
 
 import java.math.BigDecimal;
+import java.time.LocalDate;
+
+import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
 
 @Data
 @Builder
@@ -35,6 +40,14 @@ public class DailyExpensesExportExcelVO {
     @ExcelProperty("归属账单月")
     private String attributionBillTime;
 
+    @ExcelProperty("开始日期")
+    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private LocalDate startDate;
+
+    @ExcelProperty("结束日期")
+    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
+    private LocalDate endDate;
+
     @ExcelProperty("数量")
     private Integer count;
 

+ 3 - 3
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/appointment/AppAppointmentQuotaServiceImpl.java

@@ -221,21 +221,21 @@ public class AppAppointmentQuotaServiceImpl implements AppAppointmentQuotaServic
     }
 
     private void checkPersonLimit(AppointmentConfigDO config, Long tenantId, String phone, LocalDate date) {
-        if (config.getPersonDailyLimit() != null) {
+        if (config.getPersonDailyLimit() != null && config.getPersonDailyLimit() != -1) {
             Long db = countByPhoneInMiniapp(phone, date, date);
             Long redis = appointmentQuotaRedisDAO.getCount(appointmentQuotaRedisDAO.formatPersonDailyKey(tenantId, phone, date));
             if (db + redis >= config.getPersonDailyLimit()) {
                 throw exception(ErrorCodeConstants.APPOINTMENT_PERSON_LIMIT);
             }
         }
-        if (config.getPersonWeeklyLimit() != null) {
+        if (config.getPersonWeeklyLimit() != null && config.getPersonWeeklyLimit() != -1) {
             Long db = countByPhoneInMiniapp(phone, date.with(DayOfWeek.MONDAY), date.with(DayOfWeek.SUNDAY));
             Long redis = appointmentQuotaRedisDAO.getCount(appointmentQuotaRedisDAO.formatPersonWeeklyKey(tenantId, phone, date));
             if (db + redis >= config.getPersonWeeklyLimit()) {
                 throw exception(ErrorCodeConstants.APPOINTMENT_PERSON_LIMIT);
             }
         }
-        if (config.getPersonMonthlyLimit() != null) {
+        if (config.getPersonMonthlyLimit() != null && config.getPersonMonthlyLimit() != -1) {
             Long db = countByPhoneInMiniapp(phone, date.withDayOfMonth(1), date.withDayOfMonth(date.lengthOfMonth()));
             Long redis = appointmentQuotaRedisDAO.getCount(appointmentQuotaRedisDAO.formatPersonMonthlyKey(tenantId, phone, date));
             if (db + redis >= config.getPersonMonthlyLimit()) {

+ 6 - 2
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/AppointmentConfigService.java

@@ -18,9 +18,13 @@ public interface AppointmentConfigService {
     void add(AppointmentConfigSaveReqVO reqVO);
 
     /**
-     * 更新预约配置(先删除后新增)
+     * 更新预约配置
      *
-     * @param reqVO 包含 config 对象与 group 数组
+     * 不再采取先删除后新增的方式:id 为 null 视为新增,id 存在则更新,
+     * 以保证依赖 id 拼接的 redis key 不会因 id 变化而失效。
+     * deleteIds 中的 id 对应的预约组会被删除。
+     *
+     * @param reqVO 包含 config 对象、group 数组以及待删除的 deleteIds
      */
     void update(AppointmentConfigSaveReqVO reqVO);
 

+ 29 - 12
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/AppointmentConfigServiceImpl.java

@@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -54,28 +55,44 @@ public class AppointmentConfigServiceImpl implements AppointmentConfigService {
     public void update(AppointmentConfigSaveReqVO reqVO) {
         AppointmentConfigDO config = reqVO.getConfig();
         Long tenantId = config.getTenantId() != null ? config.getTenantId() : TenantContextHolder.getTenantId();
-
-        // 先删除:清除该机构下已有的配置与预约组
-        appointmentConfigMapper.delete(new LambdaQueryWrapper<AppointmentConfigDO>()
-                .eq(AppointmentConfigDO::getTenantId, tenantId));
-        appointmentGroupMapper.delete(new LambdaQueryWrapper<AppointmentGroupDO>()
-                .eq(AppointmentGroupDO::getTenantId, tenantId));
-
-        // 后新增
-        config.setId(null);
         config.setTenantId(tenantId);
-        appointmentConfigMapper.insert(config);
 
+        // 配置:id 为 null 表示新增,否则更新(保留原 id,避免依赖 id 拼接的 redis key 失效)
+        if (config.getId() == null) {
+            appointmentConfigMapper.insert(config);
+        } else {
+            appointmentConfigMapper.updateById(config);
+        }
+
+        // 预约组:拆分新增与更新,分别批量处理(id 为 null 新增,否则更新),控制 DB 访问次数
         List<AppointmentGroupDO> groupList = reqVO.getGroup();
         if (!CollectionUtils.isEmpty(groupList)) {
+            List<AppointmentGroupDO> toInsert = new ArrayList<>();
+            List<AppointmentGroupDO> toUpdate = new ArrayList<>();
             groupList.forEach(group -> {
-                group.setId(null);
                 group.setTenantId(tenantId);
                 if (group.getEnable() == null) {
                     group.setEnable(1); // 未传使用状态时默认启用
                 }
+                if (group.getId() == null) {
+                    toInsert.add(group);
+                } else {
+                    toUpdate.add(group);
+                }
             });
-            appointmentGroupMapper.insertBatch(groupList);
+            if (!toInsert.isEmpty()) {
+                appointmentGroupMapper.insertBatch(toInsert);
+            }
+            if (!toUpdate.isEmpty()) {
+                appointmentGroupMapper.updateBatch(toUpdate);
+            }
+        }
+
+        // 删除列表:批量删除指定 id 的预约组(单次 SQL,不再整表清空)
+        List<Long> deleteIds = reqVO.getDeleteIds();
+        if (!CollectionUtils.isEmpty(deleteIds)) {
+            appointmentGroupMapper.delete(new LambdaQueryWrapper<AppointmentGroupDO>()
+                    .in(AppointmentGroupDO::getId, deleteIds));
         }
     }
 

+ 1 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/DailyExpensesServiceImpl.java

@@ -717,6 +717,7 @@ public class DailyExpensesServiceImpl implements DailyExpensesService {
             orderItem.setActualRefundAmount(dailyExpensesDO.getAmount()); // 总金额
             orderItem.setTenantId(dailyExpensesDO.getTenantId());
             orderItem.setSourceItemId(dailyExpensesDO.getId());
+            orderItem.setExpenseSource(BusinessConstants.DAILY_EXPENSES);
             refundSettlementOrderItemMapper.insert(orderItem);
             // 更新账单总金额
             BigDecimal currentAmount = refundSettlementOrderDO.getRefundAmount() != null ? refundSettlementOrderDO.getRefundAmount() : BigDecimal.ZERO;

+ 1 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/ElderlyAskLeaveServiceImpl.java

@@ -935,6 +935,7 @@ public class ElderlyAskLeaveServiceImpl implements ElderlyAskLeaveService {
                 new LambdaQueryWrapperX<ElderlyAskLeaveDO>()
                         .eq(ElderlyAskLeaveDO::getElderId, elderId)
                         .isNull(ElderlyAskLeaveDO::getOutDate)
+                        .eq(ElderlyAskLeaveDO::getLeaveStatus,1)
                         .orderByDesc(ElderlyAskLeaveDO::getId)
                         .last("LIMIT 1"));
         if (askLeave == null) {

+ 1 - 1
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/biz/RefundSettlementOrderServiceImpl.java

@@ -1999,7 +1999,7 @@ public class RefundSettlementOrderServiceImpl implements RefundSettlementOrderSe
                 expenseOrderItemIds.add(refundItem.getSourceOrderItemId());
             }
             if (refundItem.getSourceItemId() != null) {
-                if (BusinessConstants.DAILY_EXPENSES.equals(refundItem.getExpenseSource())) {
+                if (BusinessConstants.DAILY_EXPENSES.equals(refundItem.getExpenseSource()) || refundItem.getType() == 2) {
                     dailyExpenseIds.add(refundItem.getSourceItemId());
                 } else if (BusinessConstants.CONSUMER_VOUCHER.equals(refundItem.getExpenseSource())) {
                     voucherIds.add(refundItem.getSourceItemId());

+ 16 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/miniapp/JiashuVisitAppointmentService.java

@@ -20,4 +20,20 @@ public interface JiashuVisitAppointmentService {
      */
     VisitAppointmentCountRespVO getVisitCount(Long tenantId, LocalDate date);
 
+    /**
+     * 获取指定预约人(手机号)、指定日期的当日、当周、当月的预约参观数量
+     *
+     * @param phone 预约人手机号(代表这个人)
+     * @param date  基准日期(前端传入),据此计算当日 / 当周 / 当月的预约数量
+     * @return 当日 / 当周 / 当月的预约数量
+     */
+    VisitAppointmentCountRespVO getVisitCountByPhone(String phone, LocalDate date);
+
+    /**
+     * 取消探访预约
+     *
+     * @param id 预约记录 id(对应 visit_appointment 表主键)
+     */
+    void cancelVisitAppointment(Long id);
+
 }

+ 57 - 0
yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/miniapp/JiashuVisitAppointmentServiceImpl.java

@@ -1,14 +1,17 @@
 package cn.iocoder.yudao.module.system.service.miniapp;
 
+import cn.iocoder.yudao.framework.common.exception.ServiceException;
 import cn.iocoder.yudao.module.system.controller.admin.biz.vo.VisitAppointmentCountRespVO;
 import cn.iocoder.yudao.module.system.dal.dataobject.miniapp.JiashuVisitAppointmentDO;
 import cn.iocoder.yudao.module.system.dal.mysql.miniapp.JiashuVisitAppointmentMapper;
+import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.time.DayOfWeek;
 import java.time.LocalDate;
+import java.time.LocalDateTime;
 
 /**
  * 探访预约 Service 实现(yanglao-jiashu 数据源)
@@ -33,6 +36,35 @@ public class JiashuVisitAppointmentServiceImpl implements JiashuVisitAppointment
         return respVO;
     }
 
+    @Override
+    public VisitAppointmentCountRespVO getVisitCountByPhone(String phone, LocalDate date) {
+        // 前端未传日期时,默认以当天作为基准日期
+        LocalDate baseDate = date != null ? date : LocalDate.now();
+        VisitAppointmentCountRespVO respVO = new VisitAppointmentCountRespVO();
+        respVO.setTodayCount(getTodayCountByPhone(phone, baseDate));
+        respVO.setWeekCount(getWeekCountByPhone(phone, baseDate));
+        respVO.setMonthCount(getMonthCountByPhone(phone, baseDate));
+        return respVO;
+    }
+
+    @Override
+    public void cancelVisitAppointment(Long id) {
+        JiashuVisitAppointmentDO existing = jiashuVisitAppointmentMapper.selectById(id);
+        if (existing == null) {
+            throw new ServiceException(ErrorCodeConstants.VISIT_APPOINTMENT_NOT_FOUND);
+        }
+        // 状态:0-待确认,1-已预约,2-已取消,3-已完成,4-已删除
+        Integer status = existing.getStatus();
+        if (status != null && (status == 2 || status == 4)) {
+            throw new ServiceException(ErrorCodeConstants.VISIT_APPOINTMENT_CANCELED);
+        }
+        JiashuVisitAppointmentDO updateDO = new JiashuVisitAppointmentDO();
+        updateDO.setId(id);
+        updateDO.setStatus(2);
+        updateDO.setUpdatedAt(LocalDateTime.now());
+        jiashuVisitAppointmentMapper.updateById(updateDO);
+    }
+
     /**
      * 当日预约参观数量(以传入的基准日期为准)
      */
@@ -58,4 +90,29 @@ public class JiashuVisitAppointmentServiceImpl implements JiashuVisitAppointment
         return jiashuVisitAppointmentMapper.countByVisitDateRange(firstDay, lastDay, tenantId);
     }
 
+    /**
+     * 当日预约参观数量(以传入的基准日期为准,按手机号过滤)
+     */
+    private Long getTodayCountByPhone(String phone, LocalDate baseDate) {
+        return jiashuVisitAppointmentMapper.countByPhoneAndDateRange(phone, baseDate, baseDate);
+    }
+
+    /**
+     * 当周(周一至周日)预约参观数量(以传入的基准日期所在周为准,按手机号过滤)
+     */
+    private Long getWeekCountByPhone(String phone, LocalDate baseDate) {
+        LocalDate monday = baseDate.with(DayOfWeek.MONDAY);
+        LocalDate sunday = baseDate.with(DayOfWeek.SUNDAY);
+        return jiashuVisitAppointmentMapper.countByPhoneAndDateRange(phone, monday, sunday);
+    }
+
+    /**
+     * 当月(1号至月末)预约参观数量(以传入的基准日期所在月为准,按手机号过滤)
+     */
+    private Long getMonthCountByPhone(String phone, LocalDate baseDate) {
+        LocalDate firstDay = baseDate.withDayOfMonth(1);
+        LocalDate lastDay = baseDate.withDayOfMonth(baseDate.lengthOfMonth());
+        return jiashuVisitAppointmentMapper.countByPhoneAndDateRange(phone, firstDay, lastDay);
+    }
+
 }

+ 2 - 0
yudao-server/src/main/resources/application.yaml

@@ -256,6 +256,8 @@ yudao:
       - /admin-api/elderly/askLeave/scanReturn
       - /admin-api/system/appointment-quota/query
       - /admin-api/jiashu/visitAppointment/count
+      - /admin-api/jiashu/visitAppointment/countByPhone
+      - /admin-api/jiashu/visitAppointment/cancel
 #      - /admin-api/bpm/check-in-wait/create
     ignore-tables:
       - system_tenant