BAOLH
2025-06-06 46ee062359b677be53cea7b0bbabf3cd607c8da3
添加企微周报填写提醒相关功能
3 files modified
51 ■■■■■ changed files
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java 7 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java 34 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/OpenApiWeComMethod.java 10 ●●●●● patch | view | raw | blame | history
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/constant/Constant.java
@@ -441,4 +441,11 @@
    public static final String CONTRACT_REAL_SIGN_N = "N";
    // 合同真实合同标识:会签订
    public static final String CONTRACT_REAL_SIGN_Y = "Y";
    // 企微机器人参数
    public static final String WECOM_ROBOT_PARAM = "wecom_robot_param";
    // 企微机器人参数:提醒填写周报机器人KEY
    public static final String REMIND_REPORT_WEBHOOK_KEY = "remind_report_webhook_key";
    // 企微机器人参数:提醒填写周报消息内容
    public static final String REMIND_REPORT_MSG = "remind_report_msg";
}
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/service/impl/WeComServiceImpl.java
@@ -8,6 +8,7 @@
import me.chanjar.weixin.cp.api.WxCpService;
import me.chanjar.weixin.cp.bean.message.WxCpMessage;
import me.chanjar.weixin.cp.bean.oa.WxCpCheckinData;
import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
import me.zhengjie.exception.BadRequestException;
import me.zhengjie.modules.attendance.domain.*;
import me.zhengjie.modules.attendance.repository.*;
@@ -1093,6 +1094,39 @@
    /**
     * 发送企微每周报告
     */
    public void remindWeeklyReport() {
        // 校验当天
        LocalDate todayDate = LocalDate.now();
        SysConfigHoliday todayHolidayConfig = sysConfigHolidayRepository.findByHolidayDate(todayDate.toString());
        if (isNonWorkingDay(todayDate, todayHolidayConfig)) {
            return;
        }
        // 校验第二天
        LocalDate tomorrowDate = todayDate.plusDays(1);
        SysConfigHoliday tomorrowHolidayConfig = sysConfigHolidayRepository.findByHolidayDate(tomorrowDate.toString());
        if (isWorkingDay(tomorrowDate, tomorrowHolidayConfig)) {
            return;
        }
        try {
            // 获取企微机器人参数
            Map<String, String> robotParamMap = dictDetailRepository.findByDictName(Constant.WECOM_ROBOT_PARAM).stream().collect(Collectors.toMap(DictDetail::getLabel, DictDetail::getValue));
            if (robotParamMap.containsKey(Constant.REMIND_REPORT_WEBHOOK_KEY) && robotParamMap.containsKey(Constant.REMIND_REPORT_MSG)) {
                // 发送消息
                WxCpDefaultConfigImpl wxCpDefaultConfig = new WxCpDefaultConfigImpl();
                wxCpDefaultConfig.setWebhookKey(robotParamMap.get(Constant.REMIND_REPORT_WEBHOOK_KEY));
                wxCpService.setWxCpConfigStorage(wxCpDefaultConfig);
                wxCpService.getGroupRobotService().sendText(robotParamMap.get(Constant.REMIND_REPORT_MSG), Arrays.asList("@all"), Arrays.asList());
            }
        } catch (WxErrorException wxErrorException) {
            wxErrorException.printStackTrace();
        }
    }
    /**
     * 发送企微每周报告
     */
    public void toWecomSheetPushReport() {
        // 校验当天
        LocalDate todayDate = LocalDate.now();
eladmin-master/eladmin-system/src/main/java/me/zhengjie/modules/quartz/task/OpenApiWeComMethod.java
@@ -40,7 +40,15 @@
    }
    /**
     * 每周最后一天14:00执行,更新企微周报
     * 每周最后一天10:30执行,提醒填写企微周报
     */
    public void remindWeeklyReport() throws Exception {
        // 下午10:30执行,提醒填写企微周报
        weComService.remindWeeklyReport();
    }
    /**
     * 每周最后一天16:30执行,更新企微周报
     */
    public void getWeComWeeklyReport() throws Exception {
        // 下午14:00执行,更新企微周报