package com.ruoyi.framework.web.service;


import com.ruoyi.common.constant.CommonConstants;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.jPush.JPushToolUtil;
import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.system.domain.SysHoliday;
import com.ruoyi.system.domain.fgw.FgwJdap;
import com.ruoyi.system.domain.fgw.FgwJdapDw;
import com.ruoyi.system.domain.fgw.FgwXmsb;
import com.ruoyi.system.domain.fgw.FgwYjpz;
import com.ruoyi.system.domain.projectV2.*;
import com.ruoyi.system.domain.projectV2.common.SendSmsConfig;
import com.ruoyi.system.mapper.SysHolidayMapper;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.fgw.FgwJdapDwMapper;
import com.ruoyi.system.mapper.fgw.FgwJdapMapper;
import com.ruoyi.system.mapper.fgw.FgwXmsbMapper;
import com.ruoyi.system.mapper.fgw.FgwYjpzMapper;
import com.ruoyi.system.mapper.projectV2.*;
import com.ruoyi.system.service.ISysUserService;
import com.ruoyi.system.service.projectV2.common.ISendSmsConfigService;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

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

import static com.ruoyi.common.constant.CommonConstants.ONE;

@Component
public class Task {

    @Autowired
    private SysUserMapper userMapper;

    @Autowired
    private ZsyzLcjlMapper zsyzLcjlMapper;

    @Autowired
    private ZsyzShqxPzMapper zsyzShqxPzMapper;

    @Autowired
    private ZsyzShqxXmMapper zsyzShqxXmMapper;

    @Autowired
    private ZsyzDbdMapper zsyzDbdMapper;

    @Autowired
    private ZsyzSbbzbMapper zsyzSbbzbMapper;

    @Autowired
    private ZsyzProjectDeptMapper zsyzProjectDeptMapper;

    @Autowired
    private SysHolidayMapper sysHolidayMapper;

    @Autowired
    private ZsyzJzqkTsMapper zsyzJzqkTsMapper;

    @Autowired
    private ISendSmsConfigService sendSmsConfigService;

    @Autowired
    private ISysUserService sysUserService;

    @Autowired
    private FgwYjpzMapper fgwYjpzMapper;

    @Autowired
    private FgwJdapMapper fgwJdapMapper;

    @Autowired
    private FgwXmsbMapper fgwXmsbMapper;

    @Autowired
    private FgwJdapDwMapper fgwJdapDwMapper;




    /***
     * 生成督办信息
     * */
    @Async
    //@Scheduled(cron = "0 0/2 * * * ? ")
    //@Scheduled(cron = "0 1 0 * * ? ")
    public void generateDb() throws Exception {

        //查询当前年的借鉴日信息
        String year = DateUtils.getYear();

        SysHoliday sysHoliday = new SysHoliday();
        sysHoliday.setYear(year);
        // 法律规定的放假日期
        sysHoliday.setType("1");
        List<SysHoliday> sysHolidayListLaw  = sysHolidayMapper.selectSysHolidayList(sysHoliday);
        List<String> lawHolidays = sysHolidayListLaw.stream().map(SysHoliday::getDay).collect(Collectors.toList());
        // 由于放假需要额外工作的周末
        sysHoliday.setType("2");
        List<SysHoliday> sysHolidayListExtra  = sysHolidayMapper.selectSysHolidayList(sysHoliday);
        List<String> extraWorkdays = sysHolidayListExtra.stream().map(SysHoliday::getDay).collect(Collectors.toList());

        List<ZsyzDbd> zsyzDbds = new ArrayList<>();

        //查询配置表配置期限
        List<ZsyzShqxPz> zsyzShqxPzList = zsyzShqxPzMapper.selectZsyzShqxPzList(new ZsyzShqxPz());
        ZsyzShqxPz zsyzShqxPzHuang = new ZsyzShqxPz();
        ZsyzShqxPz zsyzShqxPzHong = new ZsyzShqxPz();
        for (ZsyzShqxPz zsyzShqxPz : zsyzShqxPzList) {
            if ("1".equals(zsyzShqxPz.getType())) {
                zsyzShqxPzHuang = zsyzShqxPz;
            } else {
                zsyzShqxPzHong = zsyzShqxPz;
            }
        }
        //获取每个项目的配置
        List<ZsyzShqxXm> zsyzShqxXmList = zsyzShqxXmMapper.selectZsyzShqxXmList(new ZsyzShqxXm());
        //一项目id进行分组
        Map<Long, List<ZsyzShqxXm>> zsyzShqxXmcollect = zsyzShqxXmList.stream().collect(Collectors.groupingBy(ZsyzShqxXm::getXmId));

        //获取流程记录中每条项目最新的数据
        List<ZsyzLcjl> zsyzLcjlList = zsyzLcjlMapper.selectZsyzLcjlListQc();

        //获取数据库所有督办信息
        ZsyzDbd zsyzDbd = new ZsyzDbd();
        zsyzDbd.setIsHf("N");
        List<ZsyzDbd> zsyzDbdList = zsyzDbdMapper.selectZsyzDbdList(zsyzDbd);

        //查询所有项目信息
        List<ZsyzSbbzb> zsyzSbbzbList = zsyzSbbzbMapper.selectZsyzSbbzbList(new ZsyzSbbzb());
        Long deptId = null;
        String deptName = "";
        String qx = "";
        for (ZsyzLcjl zsyzLcjl : zsyzLcjlList) {
            //项目首谈阶段
            if (zsyzLcjl.getProgress().equals(CommonConstants.ONE)) {

                if(zsyzLcjl.getXmStatus().equals(CommonConstants.ONE)){
                    //项目首谈待审核（判断首谈审核期限）
                    //查询招商中心
                    deptId = 100L;
                    deptName = "招商";
                    //获取项目首谈保存时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.STSHQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds,qx ,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }

            }else if (zsyzLcjl.getProgress().equals(CommonConstants.TWO)) {
                //项目承接阶段
                if(zsyzLcjl.getXmStatus().equals(CommonConstants.ONE)){
                    //项目承接待审核（判断承接地期限和要素部门审核期限）
                    //判断是把督办发给承接地还是要素部门
                    //查询当前项目所归属的单位
                    ZsyzProjectDept zsyzProjectDept = new ZsyzProjectDept();
                    zsyzProjectDept.setXmId(zsyzLcjl.getXmId());
                    zsyzProjectDept.setIsHf("N");
                    List<ZsyzProjectDept>  zsyzProjectDeptList = zsyzProjectDeptMapper.selectZsyzProjectDeptList(zsyzProjectDept);
                    for (ZsyzProjectDept projectDept : zsyzProjectDeptList) {
                        //不给招商引荐单位发送督办信息
                        if(!projectDept.equals(CommonConstants.THR) && projectDept.getIsHf().equals("N")){

                            if(projectDept.equals(CommonConstants.ONE)){
                                qx = CommonConstants.CJDCJQX;
                            }else{
                                qx = CommonConstants.YSBMSHQX;
                            }

                            deptId = projectDept.getDeptId();
                            deptName = projectDept.getDeptName();

                            //获取项目首谈分配的保存时间
                            String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                            List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                            //黄牌
                            judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                            //红牌
                            judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);

                        }

                    }
                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.TWO)){
                    //项目承接已通过（判断签约信息录入期限，由承接地录入）
                    //查询承接地
                    for (ZsyzSbbzb zsyzSbbzb : zsyzSbbzbList) {
                        if(zsyzSbbzb.getId().equals(zsyzLcjl.getXmId())){
                            deptId = zsyzSbbzb.getCjdId();
                            deptName = zsyzSbbzb.getCjdName();
                        }
                    }

                    //获取项目承接已通过的保存时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.QYLRQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);

                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.THR)){
                    //项目承接未通过（判断首谈审核期限）
                    //查询招商中心
                    deptId = 100L;
                    deptName = "招商";
                    //获取项目首谈保存时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.STSHQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }


            }else if (zsyzLcjl.getProgress().equals(CommonConstants.THR)) {

                //项目签约阶段
                if(zsyzLcjl.getXmStatus().equals(CommonConstants.ONE)){
                    //项目签约待审核（判断签约信息审核期限）
                    //查询招商中心
                    deptId = 100L;
                    deptName = "招商";
                    //获取项目签约保存时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.QYSHQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.TWO)){
                    //项目签约已通过（判断开工信息录入期限，由承接地录入）
                    //查询承接地
                    for (ZsyzSbbzb zsyzSbbzb : zsyzSbbzbList) {
                        if(zsyzSbbzb.getId().equals(zsyzLcjl.getXmId())){
                            deptId = zsyzSbbzb.getCjdId();
                            deptName = zsyzSbbzb.getCjdName();
                        }
                    }

                    //获取项目签约已通过的记录时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.KGLRQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);

                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.THR)){
                    //项目签约未通过（判断签约信息录入期限，由承接地录入）
                    //查询承接地
                    for (ZsyzSbbzb zsyzSbbzb : zsyzSbbzbList) {
                        if(zsyzSbbzb.getId().equals(zsyzLcjl.getXmId())){
                            deptId = zsyzSbbzb.getCjdId();
                            deptName = zsyzSbbzb.getCjdName();
                        }
                    }

                    //获取项目签约未通过的记录时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.QYLRQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }


            }else if (zsyzLcjl.getProgress().equals(CommonConstants.FOR)) {
                //项目开工阶段
                if(zsyzLcjl.getXmStatus().equals(CommonConstants.ONE)){
                    //项目开工待审核（判断开工信息审核期限）
                    //查询招商中心
                    deptId = 100L;
                    deptName = "招商";
                    //获取项目开工保存时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.KGSHQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.TWO)){
                    //项目开工已通过（判断投产信息录入期限，由承接地录入）
                    //查询承接地
                    for (ZsyzSbbzb zsyzSbbzb : zsyzSbbzbList) {
                        if(zsyzSbbzb.getId().equals(zsyzLcjl.getXmId())){
                            deptId = zsyzSbbzb.getCjdId();
                            deptName = zsyzSbbzb.getCjdName();
                        }
                    }

                    //获取项目开工已通过的记录时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.TCLRQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);

                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.THR)){
                    //项目开工未通过（判断开工信息录入期限，由承接地录入）
                    //查询承接地
                    for (ZsyzSbbzb zsyzSbbzb : zsyzSbbzbList) {
                        if(zsyzSbbzb.getId().equals(zsyzLcjl.getXmId())){
                            deptId = zsyzSbbzb.getCjdId();
                            deptName = zsyzSbbzb.getCjdName();
                        }
                    }

                    //获取项目开工未通过的记录时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.KGLRQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }

            }else if (zsyzLcjl.getProgress().equals(CommonConstants.FIV)) {
                //项目开工阶段
                if(zsyzLcjl.getXmStatus().equals(CommonConstants.ONE)){
                    //项目投产待审核（判断投产信息审核期限）
                    //查询招商中心
                    deptId = 100L;
                    deptName = "招商";
                    //获取项目投产保存时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.TCSHQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.TWO)){
                    //项目投产审核通过
                    //流程结束

                }else if(zsyzLcjl.getXmStatus().equals(CommonConstants.THR)){
                    //项目投产未通过（判断投产信息录入期限，由承接地录入）
                    //查询承接地
                    for (ZsyzSbbzb zsyzSbbzb : zsyzSbbzbList) {
                        if(zsyzSbbzb.getId().equals(zsyzLcjl.getXmId())){
                            deptId = zsyzSbbzb.getCjdId();
                            deptName = zsyzSbbzb.getCjdName();
                        }
                    }

                    //获取项目投产未通过的记录时间
                    String strTime = DateFormatUtils.format(zsyzLcjl.getClTime(), "yyyy-MM-dd");

                    List<ZsyzShqxXm> zsyzShqxXms = zsyzShqxXmcollect.get(zsyzLcjl.getXmId());
                    qx = CommonConstants.TCLRQX;
                    //黄牌
                    judgmentHuangP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHuang, deptId,deptName,lawHolidays,extraWorkdays);
                    //红牌
                    judgmentHongP(zsyzShqxXms,strTime,zsyzDbdList,zsyzLcjl,zsyzDbds, qx,zsyzShqxPzHong, deptId,deptName,lawHolidays,extraWorkdays);
                }

            }
        }

        for (ZsyzDbd dbd : zsyzDbds) {
            zsyzDbdMapper.insertZsyzDbd(dbd);
            List<SendSmsConfig> sendSmsConfigs = new ArrayList<>();
            //发送短信
            List<SysUser> sysUsers = sysUserService.selectUserByDeptId(dbd.getDeptId());
            if (sysUsers != null) {
                //发极光推送
                String notificationTitle = "消息通知";
                String msgTitle = "督办";
                String msgContent = "您有一条督办信息，请及时处理！";
                String jPushVO = "";
                List<String> listS = sysUsers.stream().map(SysUser::getJgId).collect(Collectors.toList());
                listS.removeAll(Collections.singleton(null));
                if(listS!=null && listS.size()>0){
                    String[]  registrationId = listS.toArray(new String[listS.size()]);
                    JPushToolUtil.sendToRegistrationId(notificationTitle,msgTitle,msgContent,jPushVO,registrationId);
                }

                for (SysUser sysUser : sysUsers) {
                    if (StringUtils.isNotEmpty(sysUser.getPhonenumber())) {
                        SendSmsConfig sendSmsConfig = new SendSmsConfig();
                        sendSmsConfig.setPhone(sysUser.getPhonenumber());
                        sendSmsConfigs.add(sendSmsConfig);
                    }
                }
                if (sendSmsConfigs.size() > 0) {
                    AsyncManager.me().execute(AsyncFactory.sendSms(sendSmsConfigs, "SMS_272470945"));
                }
            }
        }
        System.out.println("定时任务结束");


    }

    /***
     * 进行红牌判定
     * @param zsyzShqxXms 项目的期限配置
     * @param strTime 操作的时间
     * @param zsyzDbdList  已经存在的督办信息
     * @param zsyzLcjl 流程记录
     * @param zsyzDbds 最后要保存的督办信息集合
     * @param qx  督办期限判断权限字符
     * @param zsyzShqxPzHong 系统的配置期限（红牌）
     * @param deptId 部门id
     * @param deptName 部门名称
     * @param lawHolidays 所有的法律规定的放假日期
     * @param extraWorkdays 由于放假需要额外工作的周末
     * @throws Exception
     */
    private void judgmentHongP(List<ZsyzShqxXm> zsyzShqxXms, String strTime, List<ZsyzDbd> zsyzDbdList, ZsyzLcjl zsyzLcjl,
                               List<ZsyzDbd> zsyzDbds, String qx, ZsyzShqxPz zsyzShqxPzHong,Long deptId,String deptName,List<String> lawHolidays,
                               List<String> extraWorkdays) throws Exception {

        //黄牌
        if (zsyzShqxXms != null && zsyzShqxXms.size() > 0) {
            Boolean bls = true;
            for (ZsyzShqxXm zsyzShqxXm : zsyzShqxXms) {
                if ("2".equals(zsyzShqxXm.getType())) {
                    String endTime = DateUtils.getDate();
                    //计算strTime和endTime之间的工作日
                    int count = DateUtils.calc(strTime, endTime,lawHolidays,extraWorkdays);
                    //如果超过时间并且督办中不存在则录入督办
                    String ts = "";

                    if(CommonConstants.STSHQX.equals(qx)){
                        ts = zsyzShqxXm.getStshqx();
                    }else if(CommonConstants.YSBMSHQX.equals(qx)){
                        ts = zsyzShqxXm.getYsbmshqx();
                    }else if(CommonConstants.CJDCJQX.equals(qx)){
                        ts = zsyzShqxXm.getCjdcjqx();
                    }else if(CommonConstants.QYLRQX.equals(qx)){
                        ts = zsyzShqxXm.getQylrqx();
                    }else if(CommonConstants.QYSHQX.equals(qx)){
                        ts = zsyzShqxXm.getQyshqx();
                    }else if(CommonConstants.KGLRQX.equals(qx)){
                        ts = zsyzShqxXm.getKglrqx();
                    }else if(CommonConstants.KGSHQX.equals(qx)){
                        ts = zsyzShqxXm.getKgshqx();
                    }else if(CommonConstants.TCLRQX.equals(qx)){
                        ts = zsyzShqxXm.getTclrqx();
                    }else if(CommonConstants.TCSHQX.equals(qx)){
                        ts = zsyzShqxXm.getTcshqx();
                    }

                    if (Integer.parseInt(ts) > count) {
                        break;
                    }


                    Boolean bl = true;
                    for (ZsyzDbd dbd : zsyzDbdList) {
                        if ("2".equals(dbd.getDbType()) && zsyzLcjl.getXmId().equals(dbd.getXmId()) && zsyzLcjl.getProgress().equals(dbd.getProgress()) && zsyzLcjl.getXmStatus().equals(dbd.getProgress())) {
                            //存在数据
                            bl = false;
                            break;
                        }
                    }
                    if (bl) {
                        //录入系统
                        ZsyzDbd zsyzDb = new ZsyzDbd();
                        zsyzDb.setDh(sjs());
                        zsyzDb.setXmId(zsyzLcjl.getXmId());
                        zsyzDb.setXmbh(zsyzLcjl.getXmbh());
                        zsyzDb.setXmbh(zsyzLcjl.getXmmc());
                        //todo 查询督办部门
                        zsyzDb.setDeptId(deptId);
                        zsyzDb.setDeptName(deptName);

                        zsyzDb.setIsHf("N");
                        zsyzDb.setDbTime(DateUtils.getNowDate());
                        zsyzDb.setBlsx(ts);
                        zsyzDb.setDbsx("该项目已超过" + ts + "天未填报进展，请予以说明。");
                        zsyzDb.setDbType("2");
                        zsyzDb.setProgress(zsyzLcjl.getProgress());
                        zsyzDb.setXmStatus(zsyzLcjl.getXmStatus());
                        zsyzDbds.add(zsyzDb);
                    }
                    bls = false;
                }
            }
            if(bls){
                String endTime = DateUtils.getDate();
                //计算strTime和endTime之间的工作日
                int count = DateUtils.calc(strTime, endTime,lawHolidays,extraWorkdays);
                //如果超过时间并且督办中不存在则录入督办

                String ts = "";

                if(CommonConstants.STSHQX.equals(qx)){
                    ts = zsyzShqxPzHong.getStshqx();
                }else if(CommonConstants.YSBMSHQX.equals(qx)){
                    ts = zsyzShqxPzHong.getYsbmshqx();
                }else if(CommonConstants.CJDCJQX.equals(qx)){
                    ts = zsyzShqxPzHong.getCjdcjqx();
                }else if(CommonConstants.QYLRQX.equals(qx)){
                    ts = zsyzShqxPzHong.getQylrqx();
                }else if(CommonConstants.QYSHQX.equals(qx)){
                    ts = zsyzShqxPzHong.getQyshqx();
                }else if(CommonConstants.KGLRQX.equals(qx)){
                    ts = zsyzShqxPzHong.getKglrqx();
                }else if(CommonConstants.KGSHQX.equals(qx)){
                    ts = zsyzShqxPzHong.getKgshqx();
                }else if(CommonConstants.TCLRQX.equals(qx)){
                    ts = zsyzShqxPzHong.getTclrqx();
                }else if(CommonConstants.TCSHQX.equals(qx)){
                    ts = zsyzShqxPzHong.getTcshqx();
                }

                if (Integer.parseInt(ts) > count) {
                    return;
                }


                Boolean bl = true;
                for (ZsyzDbd dbd : zsyzDbdList) {
                    if ("2".equals(dbd.getDbType()) && zsyzLcjl.getXmId().equals(dbd.getXmId()) && zsyzLcjl.getProgress().equals(dbd.getProgress()) && zsyzLcjl.getXmStatus().equals(dbd.getProgress())) {
                        //存在数据
                        bl = false;
                        break;
                    }
                }
                if (bl) {
                    //录入系统
                    ZsyzDbd zsyzDb = new ZsyzDbd();
                    zsyzDb.setDh(sjs());
                    zsyzDb.setXmId(zsyzLcjl.getXmId());
                    zsyzDb.setXmbh(zsyzLcjl.getXmbh());
                    zsyzDb.setXmbh(zsyzLcjl.getXmmc());
                    //todo 查询督办部门
                    zsyzDb.setDeptId(deptId);
                    zsyzDb.setDeptName(deptName);

                    zsyzDb.setIsHf("N");
                    zsyzDb.setDbTime(DateUtils.getNowDate());
                    zsyzDb.setBlsx(ts);
                    zsyzDb.setDbsx("该项目已超过" + ts + "天未填报进展，请予以说明。");
                    zsyzDb.setDbType("2");
                    zsyzDb.setProgress(zsyzLcjl.getProgress());
                    zsyzDb.setXmStatus(zsyzLcjl.getXmStatus());
                    zsyzDbds.add(zsyzDb);
                }
            }

        } else {
            String endTime = DateUtils.getDate();
            //计算strTime和endTime之间的工作日
            int count = DateUtils.calc(strTime, endTime,lawHolidays,extraWorkdays);
            //如果超过时间并且督办中不存在则录入督办

            String ts = "";
            if(CommonConstants.STSHQX.equals(qx)){
                ts = zsyzShqxPzHong.getStshqx();
            }else if(CommonConstants.YSBMSHQX.equals(qx)){
                ts = zsyzShqxPzHong.getYsbmshqx();
            }else if(CommonConstants.CJDCJQX.equals(qx)){
                ts = zsyzShqxPzHong.getCjdcjqx();
            }else if(CommonConstants.QYLRQX.equals(qx)){
                ts = zsyzShqxPzHong.getQylrqx();
            }else if(CommonConstants.QYSHQX.equals(qx)){
                ts = zsyzShqxPzHong.getQyshqx();
            }else if(CommonConstants.KGLRQX.equals(qx)){
                ts = zsyzShqxPzHong.getKglrqx();
            }else if(CommonConstants.KGSHQX.equals(qx)){
                ts = zsyzShqxPzHong.getKgshqx();
            }else if(CommonConstants.TCLRQX.equals(qx)){
                ts = zsyzShqxPzHong.getTclrqx();
            }else if(CommonConstants.TCSHQX.equals(qx)){
                ts = zsyzShqxPzHong.getTcshqx();
            }

            if (Integer.parseInt(ts) > count) {
                return;
            }

            Boolean bl = true;
            for (ZsyzDbd dbd : zsyzDbdList) {
                if ("2".equals(dbd.getDbType()) && zsyzLcjl.getXmId().equals(dbd.getXmId()) && zsyzLcjl.getProgress().equals(dbd.getProgress()) && zsyzLcjl.getXmStatus().equals(dbd.getProgress())) {
                    //存在数据
                    bl = false;
                    break;
                }
            }
            if (bl) {
                //录入系统
                ZsyzDbd zsyzDb = new ZsyzDbd();
                zsyzDb.setDh(sjs());
                zsyzDb.setXmId(zsyzLcjl.getXmId());
                zsyzDb.setXmbh(zsyzLcjl.getXmbh());
                zsyzDb.setXmbh(zsyzLcjl.getXmmc());
                //todo 查询督办部门
                zsyzDb.setDeptId(deptId);
                zsyzDb.setDeptName(deptName);

                zsyzDb.setIsHf("N");
                zsyzDb.setDbTime(DateUtils.getNowDate());
                zsyzDb.setBlsx(ts);
                zsyzDb.setDbsx("该项目已超过" + ts + "天未填报进展，请予以说明。");
                zsyzDb.setDbType("2");
                zsyzDb.setProgress(zsyzLcjl.getProgress());
                zsyzDb.setXmStatus(zsyzLcjl.getXmStatus());
                zsyzDbds.add(zsyzDb);
            }
        }
    }

    /***
     * 进行黄牌判定
     * @param zsyzShqxXms 项目的期限配置
     * @param strTime 操作的时间
     * @param zsyzDbdList  已经存在的督办信息
     * @param zsyzLcjl 流程记录
     * @param zsyzDbds 最后要保存的督办信息集合
     * @param qx  督办期限判断权限字符
     * @param zsyzShqxPzHuang 系统的配置期限（黄牌）
     * @param deptId 部门id
     * @param deptName 部门名称
     * @param lawHolidays 所有的法律规定的放假日期
     * @param extraWorkdays 由于放假需要额外工作的周末
     * @throws Exception
     */
    public void judgmentHuangP(List<ZsyzShqxXm>zsyzShqxXms,String strTime,List<ZsyzDbd> zsyzDbdList,ZsyzLcjl zsyzLcjl,
                               List<ZsyzDbd> zsyzDbds,String qx,ZsyzShqxPz zsyzShqxPzHuang,Long deptId,String deptName,List<String> lawHolidays,
                               List<String> extraWorkdays ) throws Exception {
        //黄牌
        if (zsyzShqxXms != null && zsyzShqxXms.size() > 0) {
            Boolean bls = true;
            for (ZsyzShqxXm zsyzShqxXm : zsyzShqxXms) {
                if ("1".equals(zsyzShqxXm.getType())) {
                    String endTime = DateUtils.getDate();
                    //计算strTime和endTime之间的工作日
                    int count = DateUtils.calc(strTime, endTime,lawHolidays,extraWorkdays);
                    //如果超过时间并且督办中不存在则录入督办
                    String ts = "";
                    if(CommonConstants.STSHQX.equals(qx)){
                        ts = zsyzShqxXm.getStshqx();
                    }else if(CommonConstants.YSBMSHQX.equals(qx)){
                        ts = zsyzShqxXm.getYsbmshqx();
                    }else if(CommonConstants.CJDCJQX.equals(qx)){
                        ts = zsyzShqxXm.getCjdcjqx();
                    }else if(CommonConstants.QYLRQX.equals(qx)){
                        ts = zsyzShqxXm.getQylrqx();
                    }else if(CommonConstants.QYSHQX.equals(qx)){
                        ts = zsyzShqxXm.getQyshqx();
                    }else if(CommonConstants.KGLRQX.equals(qx)){
                        ts = zsyzShqxXm.getKglrqx();
                    }else if(CommonConstants.KGSHQX.equals(qx)){
                        ts = zsyzShqxXm.getKgshqx();
                    }else if(CommonConstants.TCLRQX.equals(qx)){
                        ts = zsyzShqxXm.getTclrqx();
                    }else if(CommonConstants.TCSHQX.equals(qx)){
                        ts = zsyzShqxXm.getTcshqx();
                    }

                    if (Integer.parseInt(ts) > count) {
                        break;
                    }

                    Boolean bl = true;
                    for (ZsyzDbd dbd : zsyzDbdList) {
                        if ("1".equals(dbd.getDbType()) && zsyzLcjl.getXmId().equals(dbd.getXmId()) && zsyzLcjl.getProgress().equals(dbd.getProgress()) && zsyzLcjl.getXmStatus().equals(dbd.getProgress())) {
                            //存在数据
                            bl = false;
                            break;
                        }
                    }
                    if (bl) {
                        //录入系统
                        ZsyzDbd zsyzDb = new ZsyzDbd();
                        zsyzDb.setDh(sjs());
                        zsyzDb.setXmId(zsyzLcjl.getXmId());
                        zsyzDb.setXmbh(zsyzLcjl.getXmbh());
                        zsyzDb.setXmbh(zsyzLcjl.getXmmc());
                        //todo 查询督办部门
                        zsyzDb.setDeptId(deptId);
                        zsyzDb.setDeptName(deptName);

                        zsyzDb.setIsHf("N");
                        zsyzDb.setDbTime(DateUtils.getNowDate());
                        zsyzDb.setBlsx(ts);
                        zsyzDb.setDbsx("该项目已超过" + ts + "天未填报进展，请予以说明。");
                        zsyzDb.setDbType("1");
                        zsyzDb.setProgress(zsyzLcjl.getProgress());
                        zsyzDb.setXmStatus(zsyzLcjl.getXmStatus());
                        zsyzDbds.add(zsyzDb);
                    }
                    bls = false;
                }
            }
            if(bls){
                String endTime = DateUtils.getDate();
                //计算strTime和endTime之间的工作日
                int count = DateUtils.calc(strTime, endTime,lawHolidays,extraWorkdays);
                //如果超过时间并且督办中不存在则录入督办

                String ts = "";
                if(CommonConstants.STSHQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getStshqx();
                }else if(CommonConstants.YSBMSHQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getYsbmshqx();
                }else if(CommonConstants.CJDCJQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getCjdcjqx();
                }else if(CommonConstants.QYLRQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getQylrqx();
                }else if(CommonConstants.QYSHQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getQyshqx();
                }else if(CommonConstants.KGLRQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getKglrqx();
                }else if(CommonConstants.KGSHQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getKgshqx();
                }else if(CommonConstants.TCLRQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getTclrqx();
                }else if(CommonConstants.TCSHQX.equals(qx)){
                    ts = zsyzShqxPzHuang.getTcshqx();
                }

                if (Integer.parseInt(ts) > count) {
                    return;
                }

                Boolean bl = true;
                for (ZsyzDbd dbd : zsyzDbdList) {
                    if ("1".equals(dbd.getDbType()) && zsyzLcjl.getXmId().equals(dbd.getXmId()) && zsyzLcjl.getProgress().equals(dbd.getProgress()) && zsyzLcjl.getXmStatus().equals(dbd.getProgress())) {
                        //存在数据
                        bl = false;
                        break;
                    }
                }
                if (bl) {
                    //录入系统
                    ZsyzDbd zsyzDb = new ZsyzDbd();
                    zsyzDb.setDh(sjs());
                    zsyzDb.setXmId(zsyzLcjl.getXmId());
                    zsyzDb.setXmbh(zsyzLcjl.getXmbh());
                    zsyzDb.setXmbh(zsyzLcjl.getXmmc());
                    //todo 查询督办部门
                    zsyzDb.setDeptId(deptId);
                    zsyzDb.setDeptName(deptName);

                    zsyzDb.setIsHf("N");
                    zsyzDb.setDbTime(DateUtils.getNowDate());
                    zsyzDb.setBlsx(ts);
                    zsyzDb.setDbsx("该项目已超过" + ts + "天未填报进展，请予以说明。");
                    zsyzDb.setDbType("1");
                    zsyzDb.setProgress(zsyzLcjl.getProgress());
                    zsyzDb.setXmStatus(zsyzLcjl.getXmStatus());
                    zsyzDbds.add(zsyzDb);
                }
            }

        } else {
            String endTime = DateUtils.getDate();
            //计算strTime和endTime之间的工作日
            int count = DateUtils.calc(strTime, endTime,lawHolidays,extraWorkdays);
            //如果超过时间并且督办中不存在则录入督办

            String ts = "";
            if(CommonConstants.STSHQX.equals(qx)){
                ts = zsyzShqxPzHuang.getStshqx();
            }else if(CommonConstants.YSBMSHQX.equals(qx)){
                ts = zsyzShqxPzHuang.getYsbmshqx();
            }else if(CommonConstants.CJDCJQX.equals(qx)){
                ts = zsyzShqxPzHuang.getCjdcjqx();
            }else if(CommonConstants.QYLRQX.equals(qx)){
                ts = zsyzShqxPzHuang.getQylrqx();
            }else if(CommonConstants.QYSHQX.equals(qx)){
                ts = zsyzShqxPzHuang.getQyshqx();
            }else if(CommonConstants.KGLRQX.equals(qx)){
                ts = zsyzShqxPzHuang.getKglrqx();
            }else if(CommonConstants.KGSHQX.equals(qx)){
                ts = zsyzShqxPzHuang.getKgshqx();
            }else if(CommonConstants.TCLRQX.equals(qx)){
                ts = zsyzShqxPzHuang.getTclrqx();
            }else if(CommonConstants.TCSHQX.equals(qx)){
                ts = zsyzShqxPzHuang.getTcshqx();
            }

            if (Integer.parseInt(ts) > count) {
                return;
            }

            Boolean bl = true;
            for (ZsyzDbd dbd : zsyzDbdList) {
                if ("1".equals(dbd.getDbType()) && zsyzLcjl.getXmId().equals(dbd.getXmId()) && zsyzLcjl.getProgress().equals(dbd.getProgress()) && zsyzLcjl.getXmStatus().equals(dbd.getProgress())) {
                    //存在数据
                    bl = false;
                    break;
                }
            }
            if (bl) {
                //录入系统
                ZsyzDbd zsyzDb = new ZsyzDbd();
                zsyzDb.setDh(sjs());
                zsyzDb.setXmId(zsyzLcjl.getXmId());
                zsyzDb.setXmbh(zsyzLcjl.getXmbh());
                zsyzDb.setXmbh(zsyzLcjl.getXmmc());
                //todo 查询督办部门
                zsyzDb.setDeptId(deptId);
                zsyzDb.setDeptName(deptName);

                zsyzDb.setIsHf("N");
                zsyzDb.setDbTime(DateUtils.getNowDate());
                zsyzDb.setBlsx(ts);
                zsyzDb.setDbsx("该项目已超过" + ts + "天未填报进展，请予以说明。");
                zsyzDb.setDbType("1");
                zsyzDb.setProgress(zsyzLcjl.getProgress());
                zsyzDb.setXmStatus(zsyzLcjl.getXmStatus());
                zsyzDbds.add(zsyzDb);
            }
        }
    }


    public String sjs() {
        return "DB" + String.valueOf(System.currentTimeMillis() / 1000) + String.valueOf(Math.round((Math.random() + 1) * 1000));
    }


    /***
     * 15天未填写签约的数据生成弹窗
     * @throws Exception
     */
    @Async
    //@Scheduled(cron = "0 0/2 * * * ? ")
    @Scheduled(cron = "0 1 0 * * ? ")
    public void popover() throws Exception {
        //获取当前时间
        String endTime = DateUtils.getYear();
        //查询在承接地承接阶段的项目
        ZsyzSbbzb zsyzSbbzb = new ZsyzSbbzb();
        zsyzSbbzb.setType("1");
        zsyzSbbzb.setProgress("2");
        zsyzSbbzb.setXmStatus("2");
        List<ZsyzSbbzb> zsyzSbbzbList = zsyzSbbzbMapper.selectZsyzSbbzbList(zsyzSbbzb);
        //停留在该状态时间超过15天的弹窗
        for (ZsyzSbbzb sbbzb : zsyzSbbzbList) {
            String strTime = DateFormatUtils.format(sbbzb.getUpdateTime(), "yyyy-MM-dd");
            int i = DateUtils.daysBetween(strTime,endTime);
            if(i>15){
                ZsyzJzqkTs zsyzJzqkTs = new ZsyzJzqkTs();
                zsyzJzqkTs.setXmId(sbbzb.getId());
                zsyzJzqkTs.setXmbh(sbbzb.getXmbh());
                zsyzJzqkTs.setXmmc(sbbzb.getXmxsmc());
                zsyzJzqkTs.setDeptId(sbbzb.getCjdId());
                zsyzJzqkTs.setDeptName(sbbzb.getCjdName());
                zsyzJzqkTs.setDetails("已超过15天为填写签约信息，请补充当前项目进展情况。");
                zsyzJzqkTs.setIsDel("N");
                zsyzJzqkTs.setCreateTime(DateUtils.getNowDate());
                zsyzJzqkTs.setUpdateTime(DateUtils.getNowDate());
                zsyzJzqkTsMapper.insertZsyzJzqkTs(zsyzJzqkTs);

                //发送短信
                List<SendSmsConfig> sendSmsConfigs = new ArrayList<>();
                List<SysUser> sysUsers = sysUserService.selectUserByDeptId(sbbzb.getCjdId());
                if (sysUsers != null) {

                    //发极光推送
                    String notificationTitle = "消息通知";
                    String msgTitle = "督办";
                    String msgContent = "您有一条督办信息，请及时处理！";
                    String jPushVO = "";
                    List<String> listS = sysUsers.stream().map(SysUser::getJgId).collect(Collectors.toList());
                    listS.removeAll(Collections.singleton(null));
                    if(listS!=null && listS.size()>0){
                        String[]  registrationId = listS.toArray(new String[listS.size()]);
                        JPushToolUtil.sendToRegistrationId(notificationTitle,msgTitle,msgContent,jPushVO,registrationId);
                    }

                    for (SysUser sysUser : sysUsers) {
                        if (StringUtils.isNotEmpty(sysUser.getPhonenumber())) {
                            SendSmsConfig sendSmsConfig = new SendSmsConfig();
                            sendSmsConfig.setPhone(sysUser.getPhonenumber());
                            sendSmsConfigs.add(sendSmsConfig);
                        }
                    }
                    if (sendSmsConfigs.size() > 0) {
                        AsyncManager.me().execute(AsyncFactory.sendSms(sendSmsConfigs, "SMS_272615944"));
                    }
                }

            }
        }
    }


    /***
     * 发改委节点安排未完成数据推送
     */
    @Async
    @Scheduled(cron = "0 18 0 * * ? ")
    public void jdapY() throws Exception {
        //将消息推送给相关人员
        List<SendSmsConfig> sendSmsConfigs = new ArrayList<>();
        List<SysUser> sysUserList = new ArrayList<>();

        //获取当前年月
        String nowTime = DateUtils.getYearMonth();
        //当前时间
        //查询预警配置时间
        FgwYjpz fgwYjpz = fgwYjpzMapper.selectFgwYjpzNew();
        //预警项目
        List<FgwJdap> fgwJdapList = fgwJdapMapper.selectFgwJdapNum(fgwYjpz.getYjts());
        List<FgwXmsb> fgwXmsbList = new ArrayList<>();
        List<FgwJdapDw> fgwJdapDwList = new ArrayList<>();
        FgwXmsb fgwXmsb = new FgwXmsb();
        if (fgwJdapList!=null && fgwJdapList.size() > 0) {
            List<Long> xmidList = fgwJdapList.stream().map(FgwJdap::getXmId).collect(Collectors.toList());
            fgwXmsb.setIdList(xmidList);
            fgwXmsbList = fgwXmsbMapper.selectFgwXmsbList(fgwXmsb);

            //查询项目的所有人员
            List<Long> idList = fgwJdapList.stream().map(FgwJdap::getId).collect(Collectors.toList());
            fgwJdapDwList = fgwJdapDwMapper.selectFgwJdapDwListByXmid(idList);

        }

        if (fgwXmsbList!=null && fgwXmsbList.size() > 0) {

            for (FgwXmsb xmsb : fgwXmsbList) {
                SysUser sysUse = userMapper.selectUserById(xmsb.getUserId());
                sysUserList.add(sysUse);
            }

        }

        if (fgwJdapDwList!=null && fgwJdapDwList.size() > 0) {
            List<Long> deptIdList = fgwJdapDwList.stream().map(FgwJdapDw::getDeptId).collect(Collectors.toList());
            List<SysUser> sysUsers = userMapper.selectUserByDeptIdList(deptIdList);
            sysUserList.addAll(sysUsers);
        }
        if (sysUserList != null) {
            //发极光推送
            String notificationTitle = "消息通知";
            String msgTitle = "节点催办";
            String msgContent = "您有一条节点催办信息，请及时处理！";
            String jPushVO = "";
            List<String> listS = sysUserList.stream().map(SysUser::getJgId).collect(Collectors.toList());
            listS.removeAll(Collections.singleton(null));
            if(listS!=null && listS.size()>0){
                String[]  registrationId = listS.toArray(new String[listS.size()]);
                JPushToolUtil.sendToRegistrationId(notificationTitle,msgTitle,msgContent,jPushVO,registrationId);
            }

            for (SysUser sysUser : sysUserList) {
                if (StringUtils.isNotEmpty(sysUser.getPhonenumber())) {
                    SendSmsConfig sendSmsConfig = new SendSmsConfig();
                    sendSmsConfig.setPhone(sysUser.getPhonenumber());
                    sendSmsConfigs.add(sendSmsConfig);
                }
            }
            if (sendSmsConfigs.size() > 0) {
                //TOdo 模板
                //AsyncManager.me().execute(AsyncFactory.sendSms(sendSmsConfigs, "SMS_272470945"));
            }
        }
    }

}
