package com.rongwei.sfcommon.sys.service.impl;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rongwe.scentity.domian.*;
import com.rongwei.rwadmincommon.system.domain.SysUserDo;
import com.rongwei.rwadmincommon.system.service.SysConfigFeignService;
import com.rongwei.rwadmincommon.system.service.SysUserService;
import com.rongwei.rwcommon.base.BaseDo;
import com.rongwei.rwcommon.utils.SecurityUtil;
import com.rongwei.rwcommon.utils.StringUtils;
import com.rongwei.rwcommon.vo.MailDo;
import com.rongwei.rwcommon.vo.generalsql.GeneralApiParameter;
import com.rongwei.rwcommon.vo.generalsql.GeneralInsertVo;
import com.rongwei.rwcommon.vo.generalsql.SlaveDMLVo;
import com.rongwei.safecommon.utils.JSCommonUtils;
import com.rongwei.sfcommon.sys.dao.SafetyObservationDao;
import com.rongwei.sfcommon.sys.dao.ThemeCheckDao;
import com.rongwei.sfcommon.sys.service.*;
import com.rongwei.sfcommon.utils.MlConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.*;
import java.util.stream.Collectors;

import static com.rongwei.sfcommon.utils.MlConstants.THEME_CHECK_STATUS_WAIT;

@Service("themeCheckService")
public class ThemeCheckServiceImpl extends ServiceImpl<ThemeCheckDao, ThemeCheckDo> implements ThemeCheckService {

    public static final String INSPECTION_TEAM = "%s,%s";
    private static final Logger logger = LoggerFactory.getLogger(ThemeCheckServiceImpl.class);
    /**
     * 检查计划邮件模板
     */
    private static final String DISCOVERY_ITEM_MAIL_CONTENT = "检查主题：【%s】\n组长：【%s】\n组员：【%s】\n检查工段：【%s】\n" +
            "检查时间：【%tF】\n发现项：【%s】\n【%s】 ";
    /**
     * 检查部位和内容信息
     */
    private static final String CHECK_CONTENT = "检查部位：%s 检查内容：%s\n";
    @Autowired
    private CheckTemplateItemsService checkTemplateItemsService;
    @Autowired
    private ThemeCheckItemService themeCheckItemService;
    @Autowired
    private ThemeCheckContentService themeCheckContentService;
    @Autowired
    private SysConfigFeignService sysConfigFeignService;
    @Autowired
    private SysUserService sysUserService;
    @Autowired
    private ThemeCheckWorkparkService themeCheckWorkparkService;
    @Autowired
    private SafetyObservationService safetyObservationService;
    @Autowired
    private SafetyObservationDao safetyObservationDao;
    @Autowired
    private SafeCheckSendNotifyServiceImpl sendNotifyService;
    @Autowired
    private ThemeCheckDao themeCheckDao;

    /**
     * 日常检查保存时拆分任务
     *
     * @param map
     */
    public void themeCheckSplit(Map<String, Object> map) {
        // 日常检查实体类封装
        GeneralApiParameter generalApiParameter = BeanUtil.mapToBeanIgnoreCase(map, GeneralApiParameter.class, true);
        ThemeCheckDo themeCheckDo = BeanUtil.mapToBeanIgnoreCase(generalApiParameter.getMasterPar(), ThemeCheckDo.class, true);
        List<SlaveDMLVo> slaveDMLVos = generalApiParameter.getSlaveDMLVos();
        List<ThemeCheckWorkparkDo> themeCheckWorkparks = new ArrayList<>();
        if (slaveDMLVos != null && slaveDMLVos.size() > 0) {
            for (SlaveDMLVo slaveDMLVo : slaveDMLVos) {
                //字段明细表处理
                if ("asp_theme_check_workpark".equalsIgnoreCase(slaveDMLVo.getTableName())) {
                    for (GeneralInsertVo item : slaveDMLVo.getSlaveInsert()) {
                        ThemeCheckWorkparkDo themeCheckWorkpark = BeanUtil.mapToBeanIgnoreCase(item.getInsertcolumns(), ThemeCheckWorkparkDo.class, true);
                        themeCheckWorkparks.add(themeCheckWorkpark);
                    }
                }
            }
        }
        // 周五专项检查立即生成任务并发送邮件；
        if (MlConstants.THEMECHECK_TYPE_SPECIALCHECK.equals(themeCheckDo.getChecktype())) {
            // 任务拆分
            this.createTask(themeCheckDo, themeCheckWorkparks);
        } else {
            // 经理值班检查只发送邮件
            Map<String, Object> parmap = new HashMap<>();
            parmap.put("CHECKTEMPLATEID", themeCheckDo.getChecktemplateid());
            parmap.put("DELETED", "0");
            List<CheckTemplateItemsDo> checkTemplateItemss = (List<CheckTemplateItemsDo>) checkTemplateItemsService.listByMap(parmap);
            // 邮件发送
            this.sendMail(themeCheckDo, themeCheckWorkparks, checkTemplateItemss);
        }
    }

    /**
     * 任务拆分
     *
     * @param themeCheckDo
     * @param themeCheckWorkparks
     */
    private void createTask(ThemeCheckDo themeCheckDo, List<ThemeCheckWorkparkDo> themeCheckWorkparks) {
        // 任务拆分
        // 检查内容
        Map<String, Object> parmap = new HashMap<>();
        parmap.put("CHECKTEMPLATEID", themeCheckDo.getChecktemplateid());
        parmap.put("DELETED", "0");
        List<CheckTemplateItemsDo> checkTemplateItemss = (List<CheckTemplateItemsDo>) checkTemplateItemsService.listByMap(parmap);
        if (themeCheckWorkparks != null && themeCheckWorkparks.size() > 0) {
            for (ThemeCheckWorkparkDo v : themeCheckWorkparks) {// 检查任务表保存
                ThemeCheckItemDo themeCheckItemDo = new ThemeCheckItemDo();
                themeCheckItemDo.setId(SecurityUtil.getUUID());
                themeCheckItemDo.setThemecheckid(themeCheckDo.getId());
                themeCheckItemDo.setThemecheckname(themeCheckDo.getChecktheme());
                themeCheckItemDo.setPlanstarttime(themeCheckDo.getPlanstarttime());
                themeCheckItemDo.setPlanendtime(themeCheckDo.getPlanendtime());
//                themeCheckItemDo.setThemecheckworkspartid(v.getId());
                themeCheckItemDo.setChargeorgid(v.getChargeorgid());
                themeCheckItemDo.setChargeorgname(v.getChargeorgname());
                // 检查工段
                themeCheckItemDo.setCheckworkspart(v.getCheckitemid());
                themeCheckItemDo.setGroupleader(v.getGroupleader());
                themeCheckItemDo.setGroupusers(v.getGroupusers());
                themeCheckItemDo.setGroupleadername(v.getGroupleadername());
                themeCheckItemDo.setGroupusernames(v.getGroupusernames());
                // 初始化待检查
                themeCheckItemDo.setCheckstatus(THEME_CHECK_STATUS_WAIT);
                themeCheckItemService.save(themeCheckItemDo);

                if (checkTemplateItemss != null && checkTemplateItemss.size() > 0) {
                    List<ThemeCheckContentDo> checkContentDos = new ArrayList<>();
                    for (CheckTemplateItemsDo m : checkTemplateItemss) {// 检查任务明细表保存
                        ThemeCheckContentDo themeCheckContent = new ThemeCheckContentDo();
                        themeCheckContent.setId(SecurityUtil.getUUID());
                        themeCheckContent.setThemecheckitemid(themeCheckItemDo.getId());
                        themeCheckContent.setCheckposition(m.getCheckposition());
                        themeCheckContent.setCheckcontent(m.getCheckcontent());
                        themeCheckContent.setItemsort(m.getItemsort());
                        checkContentDos.add(themeCheckContent);
                    }
                    themeCheckContentService.saveBatch(checkContentDos);
                    // 邮件发送
                    this.sendMail(themeCheckDo, themeCheckWorkparks, checkTemplateItemss);
                }
            }
        }
    }

    /**
     * 根据日常检查ID，发送邮件内容
     *
     * @param themeCheckId
     */
    @Transactional(rollbackFor = Exception.class)
    public void sendMailByCheckId(String themeCheckId) {
        JSCommonUtils.parameterCheck(() -> StringUtils.isBlank(themeCheckId), "检查计划ID 为空", "");

        ThemeCheckDo themeCheckDo = this.getById(themeCheckId);
        JSCommonUtils.parameterCheck(() -> themeCheckDo == null, "无法通过ID 获取到检查计划", "无法通过ID 获取到检查计划", themeCheckId);
        JSCommonUtils.parameterCheck(() -> themeCheckDo.getCreatetask() != null && themeCheckDo.getCreatetask() == 1,
                "此检查计划已生成检查任务", "此检查计划已生成检查任务");
        // 获取本次检查计划的
        List<ThemeCheckWorkparkDo> themeCheckWorkparks = themeCheckWorkparkService
                .list(new LambdaQueryWrapper<ThemeCheckWorkparkDo>().eq(ThemeCheckWorkparkDo::getThemecheckid, themeCheckId));
        JSCommonUtils.parameterCheck(themeCheckWorkparks::isEmpty,
                "本次计划暂无检查小组任务", "本次计划暂无检查小组任务");
        // 获取检查任务中的所有人员ID
        List<String> userIds = themeCheckWorkparks.stream().map(data -> {
            String users = data.getGroupleader();
            if (StringUtils.isNotBlank(data.getGroupusers())) {
                users = String.format(INSPECTION_TEAM, users, data.getGroupusers());
            }
            return users.split(",");
        }).flatMap(Arrays::stream).distinct().collect(Collectors.toList());
        // 获取人员信息
        List<SysUserDo> userList = sysUserService.list(new LambdaQueryWrapper<SysUserDo>().in(SysUserDo::getId, userIds));
        // 当前检查小组的人员信息
        HashSet<String> currentCheckUserIds = new HashSet<>();
        // 需要保存检查任务的相关数据
        List<ThemeCheckItemDo> saveCheckItemList = new ArrayList<ThemeCheckItemDo>();
        List<ThemeCheckContentDo> saveCheckContentList = new ArrayList<ThemeCheckContentDo>();

        // 获取检查小组中的所有检查主题
        List<String> checkTemplateIds = themeCheckWorkparks.stream()
                .map(ThemeCheckWorkparkDo::getChecktemplateid)
                .filter(StringUtils::isNotBlank)
                .collect(Collectors.toList());
        // 检查主题明细
        List<CheckTemplateItemsDo> checkTemplateItemsDos = checkTemplateItemsService.list(new LambdaQueryWrapper<CheckTemplateItemsDo>()
                .eq(BaseDo::getDeleted, "0")
                .in(CheckTemplateItemsDo::getChecktemplateid, checkTemplateIds)
        );
//        String mailSubject = MlConstants.THEMECHECK_TYPE_SPECIALCHECK.equals(themeCheckDo.getChecktype()) ? "周五专项检查" : "全厂检查";
        // 发送提醒的map
        Map<String, String> sendNotifyMap = new HashMap<>();
        // 生成检查任务
        SysUserDo userDo;
        List<CheckTemplateItemsDo> chekTempItems;
        for (ThemeCheckWorkparkDo info : themeCheckWorkparks) {
            String groupLeader = info.getGroupleader();
            String groupUsers = info.getGroupusers();
            currentCheckUserIds.clear();
            if (StringUtils.isNotBlank(groupLeader)) {
                currentCheckUserIds.add(groupLeader);
            }
            if (StringUtils.isNotBlank(groupUsers)) {
                currentCheckUserIds.addAll(new HashSet<>(Arrays.asList(groupUsers.split(","))));
            }
            for (String userId : currentCheckUserIds) {
                userDo = userList.stream().filter(user -> userId.equals(user.getId())).findFirst().orElse(null);
                if (userDo == null) {
                    logger.error("无法根据用户id:{}获取到用户信息", userId);
                    break;
                }
                // 生成检查任务主表信息
                ThemeCheckItemDo themeCheckItemDo = generateThemeCheckItem(userDo, info, themeCheckDo);
                saveCheckItemList.add(themeCheckItemDo);
                chekTempItems = checkTemplateItemsDos.stream()
                        .filter(data -> info.getChecktemplateid().equals(data.getChecktemplateid()))
                        .collect(Collectors.toList());
                int index = 1;
                // 生成检查任务子表
                for (CheckTemplateItemsDo checkTemplate : chekTempItems) {
                    saveCheckContentList.add(generateThemeCheckContent(userDo, themeCheckItemDo, checkTemplate, index));
                    index++;
                }
                // 任务名称  计划检查时间 区域
//                sendNotifyMap.put(String.format(INSPECTION_TASKS_CONTENT, themeCheckDo.getCheckname(), themeCheckDo.getPlanstarttime(),
//                        themeCheckDo.getPlanstarttime(), info.getChargeorgname(), themeCheckItemDo.getId()), userId);
            }

         /* 注释邮件相关功能
            MailDo mail = new MailDo();
            mail.setSubject(mailSubject);
            String groupleadername = info.getGroupleadername();
            String groupusernames = info.getGroupusernames();
            DISCOVERY_ITEM_MAIL_CONTENT*/
        }
        this.update(new LambdaUpdateWrapper<ThemeCheckDo>()
                .set(ThemeCheckDo::getCreatetask, 1)
                .eq(ThemeCheckDo::getId, themeCheckId));
        themeCheckItemService.saveBatch(saveCheckItemList);
        themeCheckContentService.saveBatch(saveCheckContentList);
        sendNotifyService.sendInspectionTasksNotify(sendNotifyMap);
    }


    private ThemeCheckContentDo generateThemeCheckContent(SysUserDo sysUser, ThemeCheckItemDo themeCheckItemDo,
                                                          CheckTemplateItemsDo checkTemplateItemsDo,
                                                          int index) {
        ThemeCheckContentDo themeCheckContentDo = new ThemeCheckContentDo();
        themeCheckContentDo.setId(SecurityUtil.getUUID());
        JSCommonUtils.setBaseDetail(themeCheckContentDo, sysUser);
        themeCheckContentDo.setItemsort(index);
        themeCheckContentDo.setTenantid(themeCheckItemDo.getTenantid());
        themeCheckContentDo.setThemecheckitemid(themeCheckItemDo.getId());
        themeCheckContentDo.setCheckmethod(checkTemplateItemsDo.getChecktype());
        themeCheckContentDo.setCheckposition(checkTemplateItemsDo.getCheckposition());
        themeCheckContentDo.setCheckcontent(checkTemplateItemsDo.getCheckcontent());
        themeCheckContentDo.setManagement(checkTemplateItemsDo.getCheckstandard());
        return themeCheckContentDo;
    }

    /**
     * 生产检查任务信息
     *
     * @param sysUser            检查人信息
     * @param themeCheckWorkPark 检查小组信息
     * @param themeCheck       检查任务ID
     * @return
     */
    private ThemeCheckItemDo generateThemeCheckItem(SysUserDo sysUser, ThemeCheckWorkparkDo themeCheckWorkPark, ThemeCheckDo themeCheck) {
        ThemeCheckItemDo themeCheckItemDo = new ThemeCheckItemDo();
        themeCheckItemDo.setId(SecurityUtil.getUUID());
        themeCheckItemDo.setThemecheckid(themeCheck.getId());
        themeCheckItemDo.setCreateusername(sysUser.getName());
        themeCheckItemDo.setCreateuserid(sysUser.getId());
        themeCheckItemDo.setModifydate(new Date());
        themeCheckItemDo.setModifyuserid(sysUser.getId());
        themeCheckItemDo.setModifyusername(sysUser.getName());
        themeCheckItemDo.setCreatedate(new Date());
        themeCheckItemDo.setTenantid(themeCheck.getTenantid());
        themeCheckItemDo.setThemecheckname(themeCheckWorkPark.getChecktheme());
        themeCheckItemDo.setPlanstarttime(themeCheck.getPlanstarttime());
        themeCheckItemDo.setPlanendtime(themeCheck.getPlanendtime());
        themeCheckItemDo.setThemecheckworkspartid(themeCheckWorkPark.getChargeorgid());
        themeCheckItemDo.setCheckworkspart(themeCheckWorkPark.getChargeorgname());
        themeCheckItemDo.setCheckerid(sysUser.getId());
        themeCheckItemDo.setChecker(sysUser.getName());
        themeCheckItemDo.setGroupleader(themeCheckWorkPark.getGroupleader());
        themeCheckItemDo.setGroupleadername(themeCheckWorkPark.getGroupleadername());
        themeCheckItemDo.setGroupusers(themeCheckWorkPark.getGroupusernames());
        themeCheckItemDo.setGroupusernames(themeCheckWorkPark.getGroupusernames());
        themeCheckItemDo.setCheckstatus(THEME_CHECK_STATUS_WAIT);
        //themeCheck.getChecknum()不为空
        if (StringUtils.isNotBlank(themeCheck.getChecknum())) {
            themeCheckItemDo.setThemechecknum(themeCheck.getChecknum());
        }
        if (StringUtils.isNotBlank(themeCheckWorkPark.getChecktype())) {
            themeCheckItemDo.setChecktype(themeCheckWorkPark.getChecktype());
        }

        return themeCheckItemDo;
    }

    /**
     * 日常检查完成时邮件发送
     *
     * @param themeCheckDo
     * @param themeCheckWorkparks
     * @param checkTemplateItemss
     */
    private void sendMail(ThemeCheckDo themeCheckDo, List<ThemeCheckWorkparkDo> themeCheckWorkparks, List<CheckTemplateItemsDo> checkTemplateItemss) {
        if (themeCheckWorkparks != null && !themeCheckWorkparks.isEmpty()) {
            for (ThemeCheckWorkparkDo themeCheckWorkpark : themeCheckWorkparks) {
                // 邮件发送
                MailDo mail = new MailDo();
                if (MlConstants.THEMECHECK_TYPE_SPECIALCHECK.equals(themeCheckDo.getChecktype())) {
                    mail.setSubject("周五专项检查");
                } else if (MlConstants.THEMECHECK_TYPE_DAYCHECK.equals(themeCheckDo.getChecktype())) {
                    mail.setSubject("全厂检查");
                }

                // 邮件发送人
                Set<String> mialUsers = new HashSet<>();
                List<String> ids = new ArrayList<>();
                if (themeCheckWorkpark.getGroupleader() != null) {
                    ids.addAll(Arrays.asList(themeCheckWorkpark.getGroupleader().split(",")));
//                    ids.add(themeCheckWorkpark.getGroupleader());
                }
                if (themeCheckWorkpark.getGroupusers() != null) {
                    ids.addAll(Arrays.asList(themeCheckWorkpark.getGroupusers().split(",")));
                }
                if (ids.size() > 0) {
                    List<SysUserDo> users = (List<SysUserDo>) sysUserService.listByIds(ids);
                    if (users != null && users.size() > 0) {
                        for (SysUserDo m : users) {
                            if (StringUtils.isNotEmpty(m.getEmail())) {
                                mialUsers.add(m.getEmail());
                            }
                        }
                    }
                }
                if (mialUsers != null && !mialUsers.isEmpty()) {
                    String[] userArray = new String[mialUsers.size()];
                    mail.setReceiveEmail(mialUsers.toArray(userArray));
                    StringBuilder mailContent = new StringBuilder();
                    // 邮件内容拼接
                    mailContent.append("检查主题：").append(themeCheckDo.getChecktheme()).append("\n");
                    mailContent.append("组长：");
                    if (StringUtils.isNotEmpty(themeCheckWorkpark.getGroupleadername())) {
                        mailContent.append(themeCheckWorkpark.getGroupleadername());
                    }
                    mailContent.append("\n");
                    if (StringUtils.isNotEmpty(themeCheckWorkpark.getGroupusernames())) {
                        mailContent.append("组员：").append(themeCheckWorkpark.getGroupusernames()).append("\n");
                    }
                    mailContent.append("检查工段：");
                    if (StringUtils.isNotEmpty(themeCheckWorkpark.getChargeorgname())) {
                        mailContent.append(themeCheckWorkpark.getChargeorgname());
                    }
                    mailContent.append("\n")
                            .append("检查时间：").append(DateUtil.format(themeCheckDo.getPlanstarttime(), "yyyy-MM-dd HH:mm:ss"))
                            .append(" 至 ").append(DateUtil.format(themeCheckDo.getPlanendtime(), "yyyy-MM-dd HH:mm:ss")).append("\n")
                            .append("检查项：").append("\n");
                    if (checkTemplateItemss != null && checkTemplateItemss.size() > 0) {
                        for (CheckTemplateItemsDo themeCheckContent : checkTemplateItemss) {
                            mailContent.append("检查部位：").append(themeCheckContent.getCheckposition() == null ? "" : themeCheckContent.getCheckposition()).append(";")
                                    .append("检查内容：").append(themeCheckContent.getCheckcontent() == null ? "" : themeCheckContent.getCheckcontent()).append("\n");
                        }
                    }
                    mailContent.append(" ");
                    mail.setContent(mailContent.toString());
                    // 邮件发送服务调用
                    sysConfigFeignService.sendTextMail(mail);
                } else {
                    logger.error("日常检查保存邮件发送异常：组长组员为填写或未给这些员工配置邮箱");
                }
            }
        }
    }

    /**
     * 工段主管每天检查定时生成检查任务
     */
    public void dayCheckCreateTask() {
        // 判断日期是否为星期日，星期日不生成任务
        int weekday = DateUtil.dayOfWeek(new Date());
        // 非周日生成工段主管每天检查任务
        if (weekday != 1) {
            Map<String, Object> queryMap = new HashMap<>();
            queryMap.put("CHECKTYPE", MlConstants.THEMECHECK_TYPE_DAYCHECK);
            List<ThemeCheckDo> themeCheckDos = (List<ThemeCheckDo>) this.listByMap(queryMap);
            if (themeCheckDos != null && themeCheckDos.size() > 0) {
                for (ThemeCheckDo themeCheckDo : themeCheckDos) {
                    Date nowDate = new Date();
                    // 起止时间中的才会生成经理值班检查任务
                    if (nowDate.after(themeCheckDo.getPlanstarttime()) && nowDate.before(themeCheckDo.getPlanendtime())) {
                        // 任务分组查询
                        Map<String, Object> workMap = new HashMap<>();
                        workMap.put("THEMECHECKID", themeCheckDo.getId());
                        List<ThemeCheckWorkparkDo> themeCheckWorkparks = (List<ThemeCheckWorkparkDo>) themeCheckWorkparkService.listByMap(workMap);
                        // 任务拆分
                        this.createTask(themeCheckDo, themeCheckWorkparks);
                        // 邮件发送
                        // this.sendMailByCheckId(themeCheckDo.getId());
                    }
                }
            }
        }
    }

    @Override
    public void weekChecksafeTask() {
        // 邮件发送
        MailDo mail = new MailDo();
        mail.setSubject("安全观察提醒");
        // 邮件发送人
        Set<String> mialUsers = new HashSet<>();
        int count = safetyObservationService.countSafe();
        //  int count=5;
        List<SysUserDo> users = safetyObservationDao.listSafe(count);
        if (users != null && users.size() > 0) {
            for (SysUserDo m : users) {
                if (StringUtils.isNotEmpty(m.getEmail())) {
                    mialUsers.add(m.getEmail());
                }
            }
        }
        if (mialUsers != null && mialUsers.size() > 0) {
            String[] userArray = new String[mialUsers.size()];
            mail.setReceiveEmail(mialUsers.toArray(userArray));
            StringBuilder mailContent = new StringBuilder();
            // 邮件内容拼接
            mailContent.append("您好!\n" +
                    "    请确认您本周的安全观察是否完成，如已完成，请忽略本次提醒。 ");
            mail.setContent(mailContent.toString());
            // 邮件发送服务调用
            sysConfigFeignService.sendTextMail(mail);
        } else {
            logger.error("安全观察提醒邮件发送异常：组长组员为填写或未给这些员工配置邮箱");
        }

    }

    /**
     * 查询未生成任务的检查模板
     *
     * @param createTask
     * @return {@link List< ThemeCheckDo>}
     * @date 2023/12/27 13:44
     * @author shangmi
     */
    @Override
    public List<ThemeCheckDo> getListByCreateTask(int createTask) {
        LambdaQueryWrapper<ThemeCheckDo> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(ThemeCheckDo::getCreatetask, createTask)
                .eq(BaseDo::getDeleted, 0);
        return themeCheckDao.selectList(queryWrapper);
    }
}
