package com.yida.data.attendance.service.impl;

import cc.mrbird.febs.common.redis.service.RedisService;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.LocalDateTimeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.yida.data.attendance.dto.DayReportDataDTO;
import com.yida.data.attendance.service.AttendanceReportStrategyService;
import com.yida.data.attendance.service.AttendanceRuleRemindService;
import com.yida.data.attendance.service.NoticeService;
import com.yida.data.common.core.entity.attendance.attendance.AttendanceRecord;
import com.yida.data.common.core.entity.attendance.attendance.AttendanceReportStrategy;
import com.yida.data.common.core.entity.attendance.attendance.AttendanceResult;
import com.yida.data.common.core.entity.attendance.attendance.AttendanceRule;
import com.yida.data.common.core.entity.attendance.attendance.AttendanceRuleRemind;
import com.yida.data.common.core.entity.constant.AppConstant;
import com.yida.data.common.core.entity.constant.NoticeTypeConstant;
import com.yida.data.common.core.entity.notice.app.AppNotice;
import com.yida.data.common.core.entity.notice.app.inside.PushMessage;
import com.yida.data.common.core.entity.notice.qywx.NewsSchoolNotice;
import com.yida.data.common.core.entity.notice.qywx.TemplateCardStaffNotice;
import com.yida.data.common.core.entity.notice.qywx.TextCardStaffNotice;
import com.yida.data.common.core.entity.notice.qywx.inside.Article;
import com.yida.data.common.core.entity.notice.qywx.inside.News;
import com.yida.data.common.core.entity.notice.qywx.inside.TemplateCardNotice;
import com.yida.data.common.core.entity.notice.qywx.inside.TextCard;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.CardAction;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.HorizontalContent;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.Jump;
import com.yida.data.common.core.entity.notice.qywx.inside.templateCard.MainTitle;
import com.yida.data.common.core.entity.school.EduYidaAppAccount;
import com.yida.data.common.core.entity.system.Dept;
import com.yida.data.common.core.entity.system.EduApp;
import com.yida.data.common.core.entity.system.EduYidaApp;
import com.yida.data.common.core.entity.user.EduParent;
import com.yida.data.common.core.entity.user.EduStaff;
import com.yida.data.common.core.entity.user.EduStudent;
import com.yida.data.common.core.enums.UserTypeEnum;
import com.yida.data.common.core.enums.attendance.AttendanceUserTypeEnum;
import com.yida.data.common.core.enums.leave.LeaveRequestTypeEnum;
import com.yida.data.common.core.utils.AppUtil;
import com.yida.data.common.core.utils.WxUtil;
import com.yida.data.common.service.CommonService;
import com.yida.data.user.feign.RemoteStaffService;
import com.yida.data.user.feign.RemoteStudentApplyService;
import com.yida.data.user.feign.RemoteStudentService;
import java.time.Duration;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.catalina.User;
import org.apache.poi.hssf.record.PageBreakRecord.Break;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Service;

@Service
@Slf4j
@RefreshScope
public class NoticeServiceImpl implements NoticeService {

    @Resource
    private RemoteStudentService remoteStudentService;

    @Resource
    private RemoteStaffService remoteStaffService;

    @Resource
    private AttendanceReportStrategyService attendanceReportStrategyService;

    @Resource
    private CommonService commonService;
    @Resource
    private WxUtil wxUtil;
    @Value("${febs.pageUrl}")
    private String pageUrl;
    @Resource
    private RedisService redisService;

    @Resource
    private RemoteStudentApplyService remoteStudentApplyService;
    //schoolHomePage

    private static final String STUDENT_RECORD_DETAIL_URL = "/attendance/parents/home";
    private static final String STUDENT_RECORD_DETAIL_URL_NEW = "/schoolHomePage/#/stuAttAll";
    private static final String PARENT_COLLECT_FAIL_URL = "/collection/parent/index.html";
    //管理员查看学生考勤统计详情
    private static final String PARENT_TEACHER_ATTENDANCE_DETAIL_URL = "/schoolHomePage/#/stuTeacherdetail";
    //管理员查看教职工考勤统计详情
    private static final String STAFF_TEACHER_ATTENDANCE_DETAIL_URL = "/schoolHomePage/#/stuTeacherdetail";
    //学院领导查看日报统计信息
    private static final String STUDENT_DAY_REPORT_URL = "/schoolHomePage/#/attentionSentStastic";
    //通行记录默认图
    private static final String DEFAULT_ACCESS_IMG = "http://zbz.yd-data.com:8864/pic/other/2023111/8147045ffb904f208c8905ad7328d024.png";

    @Override
    public void sendAttendanceNotice(AttendanceRecord record) {
        // 时间差异常  不进行推送
        LocalDateTime now = LocalDateTime.now();
        LocalDateTime deviceTime = record.getCreateTime();
        Duration duration = LocalDateTimeUtil.between(deviceTime, now);
        // 时间差大于30分钟 不推送
        if (duration.toMinutes() > 30L) {
            log.info("时间差过大，不推送通行消息,当前时间:[{}],设备时间:[{}],recordId:[{}]", now, deviceTime, record.getId());
            return;
        }
        if (ObjectUtil.isNull(record.getDeviceId())) {
            return;
        }
        //目前推送进出学校
//        if (!ObjectUtil.equals(0, record.getZone())) {
//            return;
//        }

        //TODO 判断学生是否购买服务
//        EduAttendanceConfig config =
//            (EduAttendanceConfig) redisService.hget(CachePrefixConstant.ATTENDANCE_CONFIG,
//                result.getRecord().getSchoolId().toString());
//        if (config == null) {
//            config = eduAttendanceConfigService.getConfig(result.getRecord().getSchoolId());
//            redisService.hset(CachePrefixConstant.ATTENDANCE_CONFIG, result.getRecord().getSchoolId().toString(), config);
//        }
//        if (ObjectUtil.equal("1", config.getPushState())) { //启用缴费才推送进出记录
//            //查询学生是否缴费
//            if (!remoteStudentApplyService.hasApply(result.getStudent().getId(), ApplyConstant.ATTENDANCE).getData()) {
//                return;
//            }
//        }

        //查询家长推送提示是否开启
//        AttendanceReportStrategy strategy = attendanceReportStrategyService
//            .getOne(Wrappers.lambdaQuery(new AttendanceReportStrategy())
//                .eq(AttendanceReportStrategy::getSchoolId, record.getSchoolId())
//                .eq(AttendanceReportStrategy::getType, 2));
//
//        if (ObjectUtil.isNull(strategy) || !ObjectUtil.equals(1, strategy.getParentEnrollReport())) {
//            return;
//        }

        if (ObjectUtil.equals(UserTypeEnum.PARENT_USER_TYPE.getType(), record.getUserType())) {
            //家长端
            EduStudent student = commonService.getStudentById(record.getUserId());
            //查询学校信息
            Dept school = commonService.getDept(student.getSchoolId());
            List<EduParent> parentList = student.getParents();
            if (CollUtil.isNotEmpty(parentList)) {
                if (CollUtil.isNotEmpty(parentList)) {
                    // 推微信消息
                    if (school.getSchoolType().contains(Dept.TYPE_QYWX)) {
                        // 从redis获取应用数据
                        EduApp app = commonService.getAppByCodeAndSchool(AppConstant.INDEX_PARENT, null,
                            student.getSchoolId());
                        String token = wxUtil.getAccessToken(app.getWxCorpId(), app.getWxSecret());
                        NewsSchoolNotice newsSchoolNotice = new NewsSchoolNotice();
                        newsSchoolNotice.setAgentid(app.getWxAgentId());
                        Article article = new Article();
                        article.setPicurl(ObjectUtil.isEmpty(record.getPicUrl()) ? DEFAULT_ACCESS_IMG : record.getPicUrl());
                        String detailUrl = pageUrl + STUDENT_RECORD_DETAIL_URL_NEW
                            + "?appId=" + app.getWxCorpId()
                            + "&userType=1"
                            + "&schoolId=" + student.getSchoolId()
                            + "&time=" + LocalDateTimeUtil.format(record.getCreateTime(), "yyyy" +
                            "-MM-dd")
                            + "&id=" + student.getId()
                            + "&recordId=" + record.getId()
                            + "&stuName=" + student.getStuName();
                        article.setUrl(detailUrl);
                        article.setTitle("平安校园通知");
                        newsSchoolNotice.setNews(new News(Collections.singletonList(article)));
                        for (EduParent parent : parentList) {
                            String wxId = parent.getWxId();
                            String msg = "";
                            if (ObjectUtil.equals(0, record.getZone())) {
                                //校门
                                msg = String.format("尊敬的%s%s，%s在%s时间通过%s通道%s%s。【%s】",
                                    student.getStuName(),
                                    parent.getParentType(),
                                    student.getStuName(),
                                    LocalDateTimeUtil.format(record.getCreateTime(), "yyyy-MM-dd HH:mm:ss"),
                                    record.getDeviceName(),
                                    "0".equals(record.getScope().toString()) ? "进入" : "离开",
                                    "0".equals(record.getZone().toString()) ? "学校" : "宿舍",
                                    student.getSchoolName());
                            } else {
                                //宿舍
                                msg = String.format("尊敬的%s，%s时间在%s打卡成功,。【%s】",
                                    student.getStuName(),
                                    LocalDateTimeUtil.format(record.getCreateTime(), "yyyy-MM-dd HH:mm:ss"),
                                    record.getDeviceName(),
                                    student.getSchoolName());
                            }

                            article.setDescription(msg);
                            newsSchoolNotice.setTo_parent_userid(Collections.singletonList(wxId));
                            wxUtil.pushSchoolNotice(token, newsSchoolNotice);
                        }
//                        log.info("push msg:{}", newsSchoolNotice);
                    }
                    // 推app消息
                    if (school.getSchoolType().contains(Dept.TYPE_YIDA_APP)) {
                        // 从redis获取应用数据
                        EduYidaApp yidaApp = commonService.getYidaApp(student.getSchoolId());
                        EduYidaAppAccount account = commonService.getYidaAppAccount(student.getSchoolId(), 0);
                        AppNotice appNotice = new AppNotice();
                        PushMessage msg = new PushMessage();
                        msg.setTitle("平安校园通知");
                        String detailUrl = pageUrl + STUDENT_RECORD_DETAIL_URL
                            + "?appId=" + school.getDeptId()
                            + "&type=1"
                            + "&loginType=2"
                            + "&id=" + student.getId().toString()
                            + "&aid=" + record.getId().toString()
                            + "&date=" + LocalDateTimeUtil.format(record.getCreateTime(), "yyyy" +
                            "-MM-dd");
                        msg.setHtmlUrl(detailUrl);
                        msg.setImgUrl(ObjectUtil.isEmpty(record.getPicUrl()) ? DEFAULT_ACCESS_IMG : record.getPicUrl());
                        msg.setAccountId(account.getYidaAppAccountId());
                        msg.setMsgType(PushMessage.ARTICLE);
                        msg.setServiceId(account.getYidaAppAccountId());
                        appNotice.setMsgList(Collections.singletonList(msg));
                        for (EduParent parent : parentList) {
                            msg.setContent(String.format("尊敬的%s%s，%s在%s时间通过%s通道%s%s。【%s】",
                                student.getStuName(),
                                parent.getParentType(),
                                student.getStuName(),
                                LocalDateTimeUtil.format(record.getCreateTime(), "yyyy-MM-dd HH:mm:ss"),
                                record.getDeviceName(),
                                "0".equals(record.getScope().toString()) ? "进入" : "离开",
                                "0".equals(record.getZone().toString()) ? "学校" : "宿舍",
                                school.getDeptName()
                            ));
                            appNotice.setUserIds(Collections.singletonList(parent.getYidaAppUserId()));
                            appNotice.setPushMessage(new PushMessage(school.getDeptName() + "智慧校园",
                                account.getYidaAppAccountId()));
                            AppUtil.sendMsg(appNotice, yidaApp);
                        }
                        log.info("push attendance yida msg:{}", appNotice);
                    }
                }
            }
        } else {
            //TODO 职工段推送信息
        }
    }

    @Override
    public void sendCollectFailNotice(String picUrl, Long userId, Integer type) {
        Dept school = null;
        EduApp app;
        // 学生和职工的通知样式不同

        NewsSchoolNotice newsSchoolNotice = new NewsSchoolNotice();

        Article article = new Article();
        article.setTitle("人脸审核不通过");

        newsSchoolNotice.setNews(new News(Collections.singletonList(article)));

        if (type == 0) {
            EduStudent student = remoteStudentService.getStudentNoPermission(userId).getData();
            school = commonService.getDept(student.getSchoolId());
            app = commonService.getAppByCodeAndSchool(AppConstant.COLLECT_PARENT, null, school.getDeptId());
            String token = wxUtil.getAccessToken(app.getWxCorpId(), app.getWxSecret());
            article.setPicurl(picUrl);
            newsSchoolNotice.setAgentid(app.getWxAgentId());
            // 跳转链接
            String url = pageUrl + PARENT_COLLECT_FAIL_URL + "?studentId=" + student.getId() + "&corpId=" +
                app.getWxCorpId();
            article.setUrl(url);
            article.setDescription("点击图片重新采集");
            newsSchoolNotice.setTo_student_userid(Collections.singletonList(student.getWxId()));
            // 每个家长发送消息
            wxUtil.pushSchoolNotice(token, newsSchoolNotice);
        }
    }

    @Override
    public void sendLateNoticeToParent(AttendanceResult result) {
        //封装卡片消息内容
        JSONObject notice = new JSONObject();
        EduStudent student = commonService.getStudentById(result.getUserId());
        Dept school = commonService.getDept(student.getSchoolId());
        EduApp app = commonService.getAppByCodeAndSchool(AppConstant.INDEX_PARENT, null, school.getDeptId());
        String token = wxUtil.getAccessToken(app.getWxCorpId(), app.getWxSecret());
        notice.put("msgtype", "textcard");
        notice.put("agentid", app.getWxAgentId());
        JSONObject textcard = new JSONObject();
        textcard.put("title", "迟到提醒");
        textcard.put("description",
            "<div class='gray'>" + LocalDate.now()
                + "</div> <div class='normal'>" + student.getStuName() + "同学已迟到" + Duration
                .between(result.getStartStiTime(), LocalTime.now()).toMinutes()
                + "，请注意核实学生安全，如有特殊是由请及时告知相应教师。</div>");

        StringBuilder detailUrl = new StringBuilder();
        detailUrl.append(pageUrl).append(STUDENT_RECORD_DETAIL_URL_NEW)
            .append("?appId=").append(app.getWxCorpId())
            .append("&userType=1")
            .append("&schoolId=").append(student.getSchoolId())
            .append("&date=").append(LocalDateTimeUtil.format(result.getCreateTime(), "yyyy" +
            "-MM-dd"));
        textcard.put("url", detailUrl);
        notice.put("textcard", textcard);
        List<EduParent> parentList = student.getParents();
        for (EduParent parent : parentList) {
            notice.put("touser", parent.getWxId());
//            wxUtil.pushSchoolNotice(token, newsSchoolNotice);
        }
    }

    @Override
    public void sendStudentAttendanceLateReportToStaff(List<AttendanceResult> resultList, Long staffId, AttendanceRule rule,
        Long lateMinute) {
        EduStaff staff = remoteStaffService.getStaff(staffId).getData();
        //文本卡片消息
        TextCardStaffNotice textCardStaffNotice = new TextCardStaffNotice();
        textCardStaffNotice.setTouser(staff.getWxId());
        TextCard textCard = new TextCard();
        textCard
            .setTitle(ObjectUtil.equals(AttendanceUserTypeEnum.STUDENT_TO_DORM.getValue(), rule.getUserType()) ? "晚归提醒" : "迟到提醒");

        EduApp app = commonService.getAppByCodeAndSchool(AppConstant.CONTACT_SELECT, null,
            staff.getSchoolId());
        if (ObjectUtil.isNull(app)) {
            app = commonService.getAppByCodeAndSchool(AppConstant.ATTENDANCE_STAFF, null,
                staff.getSchoolId());
        }
        if (ObjectUtil.isNull(app)) {
            log.error("学校【{}】无智慧校园应用,无法发送迟到报告", staff.getSchoolId());
            return;
        }
        textCardStaffNotice.setAgentid(app.getWxAgentId());
        String accessToken = wxUtil.getAccessToken(app.getWxCorpId(), app.getWxSecret());
        String url = String
            .format("%s?corpId=%s&schoolId=%s&userType=%s&type=%s&startData=%s&endData=%s&timeName=%s&status=%s",
                pageUrl + PARENT_TEACHER_ATTENDANCE_DETAIL_URL,
                app.getWxCorpId(),
                staff.getSchoolId(), 0, 1, LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                    "-MM-dd"), LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                    "-MM-dd"), LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                    "-MM-dd"), 3);
        //学生信息
        List<String> studentNameList = new ArrayList<>();
        for (AttendanceResult result : resultList) {
            if (studentNameList.size() > 4) {
                break;
            }
            EduStudent student = remoteStudentService.getStudentNoPermission(result.getUserId()).getData();
            if (ObjectUtil.isNotNull(student)) {
                studentNameList.add(student.getStuName());
            }
        }
        String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));

        String msg = String.format("<div class=\"gray\">%s</div>"
                + "<div class=\"gray\">%s</div>"
                + " <div class=\"normal\">%s等%S名学生已迟到%s分钟，请及时联系并核实情况！</div>",
            format, rule.getName(), studentNameList.stream().collect(Collectors.joining(",")), resultList.size(), lateMinute);

        if (ObjectUtil.equals(AttendanceUserTypeEnum.STUDENT_TO_DORM.getValue(), rule.getUserType())) {
            //宿舍考勤
            msg = String.format("<div class=\"gray\">%s</div>"
                    + "<div class=\"gray\">%s</div>"
                    + " <div class=\"normal\">%s等%S名学生超出截止归寝时间%s分钟未归寝，请及时联系并核实情况！</div>",
                format, rule.getName(), studentNameList.stream().collect(Collectors.joining(",")), resultList.size(), lateMinute);
        }

        textCard.setDescription(msg);

        textCard.setUrl(url);
        textCardStaffNotice.setTextcard(textCard);
        //发送微信通知
        wxUtil.pushStaffNotice(accessToken, textCardStaffNotice);
    }

    @Override
    public void sendAttendanceDayReportToStaff(Long staffId, List<DayReportDataDTO> dtoList, AttendanceRule rule,
        Integer userType, Boolean isLeader) {
        EduStaff staff = commonService.getStaffById(staffId);
        Dept dept = commonService.getDept(staff.getSchoolId());
        //发送企业微信通知
        if (dept.getSchoolType().contains("0")) {
            EduApp app = commonService.getAppByCodeAndSchool(AppConstant.CONTACT_SELECT, null,
                staff.getSchoolId());
            if (ObjectUtil.isNull(app)) {
                log.info("学校【{}】未开通智慧校园应用,无法推送消息", staff.getSchoolId());
                return;
            }
            String accessToken = wxUtil.getAccessToken(app.getWxCorpId(), app.getWxSecret());
            String url = "";
            String title = "";
            String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
            StringBuilder msg = new StringBuilder(String
                .format("<div class=\"gray\">%s</div>",
                    rule.getName()));

            if (ObjectUtil.equals(UserTypeEnum.PARENT_USER_TYPE.getType(), userType)) {
                //学生日报
                url = String
                    .format(
                        "%s?corpId=%s&schoolId=%s&userType=%s&type=%s&startData=%s&endData=%s&timeName=%s&status=%s&staffId=%s&ruleId=%s&searchUserType=%s",
                        pageUrl + (isLeader ? STUDENT_DAY_REPORT_URL : PARENT_TEACHER_ATTENDANCE_DETAIL_URL),
                        app.getWxCorpId(),
                        staff.getSchoolId(), 0, userType,
                        LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                            "-MM-dd"), LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                            "-MM-dd"), LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                            "-MM-dd"), 3, staff.getId(), rule.getId(), userType);
                title = format + "学生考勤日报";
                for (DayReportDataDTO dayReportDataDTO : dtoList) {
//                String scoreStr = "";
//                if (dayReportDataDTO.getTotalNum() == 0) {
//                    scoreStr = "0.00%";
//                } else {
//                    double score =
//                        (double) ((dayReportDataDTO.getTotalNum() - dayReportDataDTO.getAbNum()) * 100) / dayReportDataDTO
//                            .getTotalNum();
//                    scoreStr = String.format("%.2f", score) + "%";
//                }
                    msg.append(String.format(" <div class=\"normal\">%s：总人数:%s 异常:%s  </div>", dayReportDataDTO.getDeptName(),
                        dayReportDataDTO.getTotalNum(), dayReportDataDTO.getAbNum()));
                }
            } else {
                //职工日报
                url = String
                    .format(
                        "%s?corpId=%s&schoolId=%s&userType=%s&type=%s&startData=%s&endData=%s&timeName=%s&status=%s&staffId=%s&ruleId=%s&searchUserType=%s",
                        pageUrl + STAFF_TEACHER_ATTENDANCE_DETAIL_URL,
                        app.getWxCorpId(),
                        staff.getSchoolId(), 0, userType,
                        LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                            "-MM-dd"), LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                            "-MM-dd"), LocalDateTimeUtil.format(LocalDateTime.now(), "yyyy" +
                            "-MM-dd"), 3, staff.getId(), rule.getId(), userType);
                title = format + "职工考勤日报";
                Integer totalNum = 0;
                Integer abNum = 0;
                for (DayReportDataDTO dayReportDataDTO : dtoList) {
                    totalNum += dayReportDataDTO.getTotalNum();
                    abNum += dayReportDataDTO.getAbNum();
                }
                msg.append(String.format(" <div class=\"normal\">总人数: %s </div> <div class=\"normal\">正常人数: %s </div>",
                    totalNum, totalNum - abNum));
            }

            //文本卡片消息
            TextCardStaffNotice textCardStaffNotice = new TextCardStaffNotice();
            textCardStaffNotice.setTouser(staff.getWxId());
            TextCard textCard = new TextCard();
            textCardStaffNotice.setAgentid(app.getWxAgentId());
            textCard.setTitle(title);
            textCard.setDescription(msg.toString());
            textCard.setUrl(url);
            textCardStaffNotice.setTextcard(textCard);
            //发送微信通知
            wxUtil.pushStaffNotice(accessToken, textCardStaffNotice);
//
//            //模板卡片消息--文本通知型
//            TemplateCardNotice templateCardNotice = new TemplateCardNotice();
//            templateCardNotice.setCard_type(NoticeTypeConstant.TEMPLATE_NOTICE_TYPE_TEXT);
//            String title = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日")) + "考勤日报";
//            templateCardNotice.setMain_title(MainTitle.builder().title(title).build());
//            templateCardNotice.setSub_title_text(rule.getName());
//
//            List<HorizontalContent> horizontalContentList = new ArrayList<>();
//
//            for (DayReportDataDTO dayReportDataDTO : dtoList) {
//                HorizontalContent horizontalContent = new HorizontalContent();
//                horizontalContent.setValue(dayReportDataDTO.getDeptName());
//                horizontalContent.setKeyname(dayReportDataDTO.getTotalNum() + "/" + dayReportDataDTO.getAbNum());
//                horizontalContentList.add(horizontalContent);
//            }
//            templateCardNotice.setHorizontal_content_list(horizontalContentList);
//
//            templateCardNotice.setCard_action(CardAction.builder().type(1).url(url).build());
//            templateCardNotice
//                .setJump_list(Collections.singletonList(Jump.builder().type(1).title("查看详情").url(url).build()));
//            TemplateCardStaffNotice templateCardStaffNotice = new TemplateCardStaffNotice();
//            templateCardStaffNotice.setTouser(staff.getWxId());
//            templateCardStaffNotice.setAgentid(app.getWxAgentId());
//            templateCardStaffNotice.setTemplate_card(templateCardNotice);
//            //发送微信通知
//            wxUtil.pushStaffNotice(accessToken, templateCardStaffNotice);
        }
    }


}
