Search in sources :

Example 51 with Project

use of com.itrus.portal.db.Project in project portal by ixinportal.

the class SignStatsController method list.

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "cycle", required = false) Integer cycle, @RequestParam(value = "projectName", required = false) Long projectName, @RequestParam(value = "year1", required = false) Integer year1, @RequestParam(value = "year2", required = false) Integer year2, Model uiModel) throws Exception {
    Map param = new HashMap();
    Map param2 = new HashMap();
    // List<Integer> years = new ArrayList<Integer>();
    /*       int a = year1 - year2;
        if (a ==0){
            years.add(year1);
        }
        else{
            for (int i =0; i <=a; i++){
                years.add(year1+i);
            }
        } */
    Integer year3 = null;
    if (year1 != null) {
        year3 = year1;
    }
    List<Map<Integer, Integer>> list = new ArrayList<Map<Integer, Integer>>();
    java.util.Date nowdate = new java.util.Date();
    String[] monthList = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
    String[] seasonList = { "S1", "S2", "S3", "S4" };
    String month = null;
    String season = null;
    String year = null;
    Calendar calendar = Calendar.getInstance();
    Calendar calendar2 = Calendar.getInstance();
    String projectName1 = null;
    if (null != cycle && cycle == 12) {
        while (year1 <= year2) {
            for (int j = 0; j <= 11; j++) {
                calendar.set(Calendar.YEAR, year1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                // calendar.add(Calendar.MILLISECOND, -1);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, year1);
                calendar2.set(Calendar.MONTH, j + 1);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                // calendar2.add(Calendar.MILLISECOND, -1);
                Date dt2 = calendar2.getTime();
                if (projectName != null && projectName != 0) {
                    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
                    projectName1 = project.getName();
                    param.put("projectName", projectName);
                }
                param2.put("projectName", projectName);
                if (dt2.before(nowdate)) {
                    month = year1 + "-" + monthList[j];
                    param2.put("month", month);
                    SignStatsRecord ssr = sqlSession.selectOne("com.itrus.portal.db.SignStatsRecordMapper.selectByMonth1", param2);
                    if (null != ssr) {
                        Integer count = ssr.getCount1();
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, year1);
                        list.add(map);
                    } else {
                        param.put("queryDate1", dt1);
                        param.put("queryDate2", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountByPeriod", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, year1);
                        list.add(map);
                        SignStatsRecord ssr2 = new SignStatsRecord();
                        ssr2.setMonth1(month);
                        ssr2.setProjectId(projectName);
                        ssr2.setCount1(count);
                        ssr2.setCreateTime(new Date());
                        sqlSession.insert("com.itrus.portal.db.SignStatsRecordMapper.insert", ssr2);
                    }
                } else {
                    param.put("queryDate1", dt1);
                    param.put("queryDate2", dt2);
                    Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountByPeriod", param);
                    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                    map.put(count, year1);
                    list.add(map);
                }
            }
            year1++;
        }
    }
    if (null != cycle && cycle == 4) {
        while (year1 <= year2) {
            for (int j = 0; j <= 9; j = j + 3) {
                calendar.set(Calendar.YEAR, year1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                // calendar.add(Calendar.MILLISECOND, -1);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, year1);
                calendar2.set(Calendar.MONTH, j + 3);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                // calendar2.add(Calendar.MILLISECOND, -1);
                Date dt2 = calendar2.getTime();
                if (projectName != null && projectName != 0) {
                    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
                    projectName1 = project.getName();
                    param.put("projectName", projectName);
                }
                param2.put("projectName", projectName);
                if (dt2.before(nowdate)) {
                    season = year1 + "-" + seasonList[j / 3];
                    param2.put("season", season);
                    SignStatsRecord ssr = sqlSession.selectOne("com.itrus.portal.db.SignStatsRecordMapper.selectBySeason1", param2);
                    if (null != ssr) {
                        Integer count = ssr.getCount1();
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, year1);
                        list.add(map);
                    } else {
                        param.put("queryDate1", dt1);
                        param.put("queryDate2", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountByPeriod", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, year1);
                        list.add(map);
                        SignStatsRecord ssr2 = new SignStatsRecord();
                        ssr2.setSeason1(season);
                        ssr2.setProjectId(projectName);
                        ssr2.setCount1(count);
                        ssr2.setCreateTime(new Date());
                        sqlSession.insert("com.itrus.portal.db.SignStatsRecordMapper.insert", ssr2);
                    }
                } else {
                    param.put("queryDate1", dt1);
                    param.put("queryDate2", dt2);
                    Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountByPeriod", param);
                    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                    map.put(count, year1);
                    list.add(map);
                }
            }
            year1++;
        }
    }
    if (null != cycle && cycle == 1) {
        while (year1 <= year2) {
            calendar.set(Calendar.YEAR, year1);
            calendar.set(Calendar.MONTH, 0);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            // calendar.add(Calendar.MILLISECOND, -1);
            Date dt1 = calendar.getTime();
            calendar2.set(Calendar.YEAR, year1 + 1);
            calendar2.set(Calendar.MONTH, 0);
            calendar2.set(Calendar.DAY_OF_MONTH, 1);
            calendar2.set(Calendar.HOUR_OF_DAY, 0);
            calendar2.set(Calendar.MINUTE, 0);
            calendar2.set(Calendar.SECOND, 0);
            calendar2.set(Calendar.MILLISECOND, 0);
            // calendar2.add(Calendar.MILLISECOND, -1);
            Date dt2 = calendar2.getTime();
            if (projectName != null && projectName != 0) {
                Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
                projectName1 = project.getName();
                param.put("projectName", projectName);
            }
            param2.put("projectName", projectName);
            if (dt2.before(nowdate)) {
                year = year1 + "Y";
                param2.put("year", year);
                SignStatsRecord ssr = sqlSession.selectOne("com.itrus.portal.db.SignStatsRecordMapper.selectByYear1", param2);
                if (null != ssr) {
                    Integer count = ssr.getCount1();
                    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                    map.put(count, year1);
                    list.add(map);
                } else {
                    param.put("queryDate1", dt1);
                    param.put("queryDate2", dt2);
                    Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountByPeriod", param);
                    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                    map.put(count, year1);
                    list.add(map);
                    SignStatsRecord ssr2 = new SignStatsRecord();
                    ssr2.setYear1(year);
                    ssr2.setProjectId(projectName);
                    ssr2.setCount1(count);
                    ssr2.setCreateTime(new Date());
                    sqlSession.insert("com.itrus.portal.db.SignStatsRecordMapper.insert", ssr2);
                }
            } else {
                param.put("queryDate1", dt1);
                param.put("queryDate2", dt2);
                Integer count = sqlSession.selectOne("com.itrus.portal.db.SignRecordMapper.selectCountByPeriod", param);
                Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                map.put(count, year1);
                list.add(map);
            }
            year1++;
        }
    }
    if (null == projectName || 0 == projectName) {
        projectName1 = "所有项目";
    }
    uiModel.addAttribute("list", list);
    uiModel.addAttribute("year1", year3);
    uiModel.addAttribute("year2", year2);
    uiModel.addAttribute("cycle", cycle);
    uiModel.addAttribute("projectName", projectName);
    uiModel.addAttribute("projects", getProjectMapOfAdmin());
    uiModel.addAttribute("projectN", projectName1);
    return "signstats/list";
}
Also used : SignStatsRecord(com.itrus.portal.db.SignStatsRecord) Project(com.itrus.portal.db.Project) java.util(java.util) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 52 with Project

use of com.itrus.portal.db.Project in project portal by ixinportal.

the class MessageStatsController method list.

@RequestMapping(produces = "text/html")
public String list(@RequestParam(value = "cycle", required = false) Integer cycle, @RequestParam(value = "applicationName", required = false) Long applicationName, @RequestParam(value = "year1", required = false) Integer year1, @RequestParam(value = "year2", required = false) Integer year2, @RequestParam(value = "cycle2", required = false) Integer cycle2, @RequestParam(value = "projectName", required = false) Long projectName, @RequestParam(value = "year3", required = false) Integer year4, @RequestParam(value = "year4", required = false) Integer year5, @RequestParam(value = "type", required = false) Integer type, @RequestParam(value = "status_sel", required = false) Integer status_sel, @RequestParam(value = "status_sel2", required = false) Integer status_sel2, Model uiModel) throws Exception {
    Map param = new HashMap();
    Map param2 = new HashMap();
    String applicationName1 = null;
    String projectName1 = null;
    // List<Integer> years = new ArrayList<Integer>();
    /*       int a = year1 - year2;
        if (a ==0){
            years.add(year1);
        }
        else{
            for (int i =0; i <=a; i++){
                years.add(year1+i);
            }
        } */
    Integer year3 = null;
    if (year1 != null) {
        year3 = year1;
    }
    Integer year6 = null;
    if (year4 != null) {
        year6 = year4;
    }
    List<Map<Integer, Integer>> list = new ArrayList<Map<Integer, Integer>>();
    List<Map<Integer, Integer>> list2 = new ArrayList<Map<Integer, Integer>>();
    java.util.Date nowdate = new java.util.Date();
    String[] monthList = { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" };
    String[] seasonList = { "S1", "S2", "S3", "S4" };
    String month = null;
    String season = null;
    String year = null;
    Calendar calendar = Calendar.getInstance();
    Calendar calendar2 = Calendar.getInstance();
    Integer yr1 = null;
    Integer yr2 = null;
    Integer ccl = null;
    if (null != type && type == 1) {
        yr1 = year1;
        yr2 = year2;
        ccl = cycle;
    }
    if (null != type && type == 2) {
        yr1 = year4;
        yr2 = year5;
        ccl = cycle2;
    }
    if (null != ccl && ccl == 12) {
        while (yr1 <= yr2) {
            for (int j = 0; j <= 11; j++) {
                calendar.set(Calendar.YEAR, yr1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                // calendar.add(Calendar.MILLISECOND, -1);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, yr1);
                calendar2.set(Calendar.MONTH, j + 1);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                // calendar2.add(Calendar.MILLISECOND, -1);
                Date dt2 = calendar2.getTime();
                if (type == 1) {
                    if (applicationName != null && applicationName != 0) {
                        AppConfig application = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectByPrimaryKey", applicationName);
                        applicationName1 = application.getAppName();
                        param.put("applicationName", applicationName);
                    }
                    param2.put("applicationName", applicationName);
                    param2.put("type", type);
                    if (status_sel != null && status_sel != 2) {
                        param.put("gate", status_sel);
                    } else {
                        param.put("gate", null);
                    }
                    param2.put("gate", status_sel);
                    if (dt2.before(nowdate)) {
                        month = yr1 + "-" + monthList[j];
                        param2.put("month", month);
                        MsgStatsRecord msr = sqlSession.selectOne("com.itrus.portal.db.MsgStatsRecordMapper.selectByMonth1", param2);
                        if (null != msr) {
                            Integer count = msr.getCount1();
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list.add(map);
                        } else {
                            param.put("queryDate1", dt1);
                            param.put("queryDate2", dt2);
                            Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod", param);
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list.add(map);
                            MsgStatsRecord msr2 = new MsgStatsRecord();
                            msr2.setMonth1(month);
                            msr2.setAppId(applicationName);
                            msr2.setCount1(count);
                            msr2.setType(type);
                            msr2.setGate(status_sel);
                            msr2.setCreateTime(new Date());
                            sqlSession.insert("com.itrus.portal.db.MsgStatsRecordMapper.insert", msr2);
                        }
                    } else {
                        param.put("queryDate1", dt1);
                        param.put("queryDate2", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list.add(map);
                    }
                }
                if (type == 2) {
                    if (projectName != null && projectName != 0) {
                        Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
                        projectName1 = project.getName();
                        param.put("projectName", projectName);
                    }
                    param2.put("projectName", projectName);
                    param2.put("type", type);
                    if (status_sel2 != null && status_sel2 != 2) {
                        param.put("gate", status_sel2);
                    } else {
                        param.put("gate", null);
                    }
                    param2.put("gate", status_sel2);
                    if (dt2.before(nowdate)) {
                        month = yr1 + "-" + monthList[j];
                        param2.put("month", month);
                        MsgStatsRecord msr = sqlSession.selectOne("com.itrus.portal.db.MsgStatsRecordMapper.selectByMonth2", param2);
                        if (null != msr) {
                            Integer count = msr.getCount1();
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list2.add(map);
                        } else {
                            param.put("queryDate3", dt1);
                            param.put("queryDate4", dt2);
                            Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod2", param);
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list2.add(map);
                            MsgStatsRecord msr2 = new MsgStatsRecord();
                            msr2.setMonth1(month);
                            msr2.setAppId(projectName);
                            msr2.setCount1(count);
                            msr2.setType(type);
                            msr2.setGate(status_sel2);
                            msr2.setCreateTime(new Date());
                            sqlSession.insert("com.itrus.portal.db.MsgStatsRecordMapper.insert", msr2);
                        }
                    } else {
                        param.put("queryDate3", dt1);
                        param.put("queryDate4", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod2", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list2.add(map);
                    }
                }
            }
            yr1++;
        }
    }
    if (null != ccl && ccl == 4) {
        while (yr1 <= yr2) {
            for (int j = 0; j <= 9; j = j + 3) {
                calendar.set(Calendar.YEAR, yr1);
                calendar.set(Calendar.MONTH, j);
                calendar.set(Calendar.DAY_OF_MONTH, 1);
                calendar.set(Calendar.HOUR_OF_DAY, 0);
                calendar.set(Calendar.MINUTE, 0);
                calendar.set(Calendar.SECOND, 0);
                calendar.set(Calendar.MILLISECOND, 0);
                // calendar.add(Calendar.MILLISECOND, -1);
                Date dt1 = calendar.getTime();
                calendar2.set(Calendar.YEAR, yr1);
                calendar2.set(Calendar.MONTH, j + 3);
                calendar2.set(Calendar.DAY_OF_MONTH, 1);
                calendar2.set(Calendar.HOUR_OF_DAY, 0);
                calendar2.set(Calendar.MINUTE, 0);
                calendar2.set(Calendar.SECOND, 0);
                calendar2.set(Calendar.MILLISECOND, 0);
                // calendar2.add(Calendar.MILLISECOND, -1);
                Date dt2 = calendar2.getTime();
                if (type == 1) {
                    if (applicationName != null && applicationName != 0) {
                        AppConfig application = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectByPrimaryKey", applicationName);
                        applicationName1 = application.getAppName();
                        param.put("applicationName", applicationName);
                    }
                    param2.put("applicationName", applicationName);
                    param2.put("type", type);
                    if (status_sel != null && status_sel != 2) {
                        param.put("gate", status_sel);
                    } else {
                        param.put("gate", null);
                    }
                    param2.put("gate", status_sel);
                    if (dt2.before(nowdate)) {
                        season = yr1 + "-" + seasonList[j / 3];
                        param2.put("season", season);
                        MsgStatsRecord msr = sqlSession.selectOne("com.itrus.portal.db.MsgStatsRecordMapper.selectBySeason1", param2);
                        if (null != msr) {
                            Integer count = msr.getCount1();
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list.add(map);
                        } else {
                            param.put("queryDate1", dt1);
                            param.put("queryDate2", dt2);
                            Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod", param);
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list.add(map);
                            MsgStatsRecord msr2 = new MsgStatsRecord();
                            msr2.setSeason1(season);
                            msr2.setAppId(applicationName);
                            msr2.setCount1(count);
                            msr2.setType(type);
                            msr2.setGate(status_sel);
                            msr2.setCreateTime(new Date());
                            sqlSession.insert("com.itrus.portal.db.MsgStatsRecordMapper.insert", msr2);
                        }
                    } else {
                        param.put("queryDate1", dt1);
                        param.put("queryDate2", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list.add(map);
                    }
                }
                if (type == 2) {
                    if (projectName != null && projectName != 0) {
                        Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
                        projectName1 = project.getName();
                        param.put("projectName", projectName);
                    }
                    param2.put("projectName", projectName);
                    param2.put("type", type);
                    if (status_sel2 != null && status_sel2 != 2) {
                        param.put("gate", status_sel2);
                    } else {
                        param.put("gate", null);
                    }
                    param2.put("gate", status_sel2);
                    if (dt2.before(nowdate)) {
                        season = yr1 + "-" + seasonList[j / 3];
                        param2.put("season", season);
                        MsgStatsRecord msr = sqlSession.selectOne("com.itrus.portal.db.MsgStatsRecordMapper.selectBySeason2", param2);
                        if (null != msr) {
                            Integer count = msr.getCount1();
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list2.add(map);
                        } else {
                            param.put("queryDate3", dt1);
                            param.put("queryDate4", dt2);
                            Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod2", param);
                            Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                            map.put(count, yr1);
                            list2.add(map);
                            MsgStatsRecord msr2 = new MsgStatsRecord();
                            msr2.setSeason1(season);
                            msr2.setAppId(projectName);
                            msr2.setCount1(count);
                            msr2.setType(type);
                            msr2.setGate(status_sel2);
                            msr2.setCreateTime(new Date());
                            sqlSession.insert("com.itrus.portal.db.MsgStatsRecordMapper.insert", msr2);
                        }
                    } else {
                        param.put("queryDate3", dt1);
                        param.put("queryDate4", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod2", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list2.add(map);
                    }
                }
            }
            yr1++;
        }
    }
    if (null != ccl && ccl == 1) {
        while (yr1 <= yr2) {
            calendar.set(Calendar.YEAR, yr1);
            calendar.set(Calendar.MONTH, 0);
            calendar.set(Calendar.DAY_OF_MONTH, 1);
            calendar.set(Calendar.HOUR_OF_DAY, 0);
            calendar.set(Calendar.MINUTE, 0);
            calendar.set(Calendar.SECOND, 0);
            calendar.set(Calendar.MILLISECOND, 0);
            // calendar.add(Calendar.MILLISECOND, -1);
            Date dt1 = calendar.getTime();
            calendar2.set(Calendar.YEAR, yr1 + 1);
            calendar2.set(Calendar.MONTH, 0);
            calendar2.set(Calendar.DAY_OF_MONTH, 1);
            calendar2.set(Calendar.HOUR_OF_DAY, 0);
            calendar2.set(Calendar.MINUTE, 0);
            calendar2.set(Calendar.SECOND, 0);
            calendar2.set(Calendar.MILLISECOND, 0);
            // calendar2.add(Calendar.MILLISECOND, -1);
            Date dt2 = calendar2.getTime();
            if (type == 1) {
                if (applicationName != null && applicationName != 0) {
                    AppConfig application = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectByPrimaryKey", applicationName);
                    applicationName1 = application.getAppName();
                    param.put("applicationName", applicationName);
                }
                param2.put("applicationName", applicationName);
                param2.put("type", type);
                if (status_sel != null && status_sel != 2) {
                    param.put("gate", status_sel);
                } else {
                    param.put("gate", null);
                }
                param2.put("gate", status_sel);
                if (dt2.before(nowdate)) {
                    year = yr1 + "Y";
                    param2.put("year", year);
                    MsgStatsRecord msr = sqlSession.selectOne("com.itrus.portal.db.MsgStatsRecordMapper.selectByYear1", param2);
                    if (null != msr) {
                        Integer count = msr.getCount1();
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list.add(map);
                    } else {
                        param.put("queryDate1", dt1);
                        param.put("queryDate2", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list.add(map);
                        MsgStatsRecord msr2 = new MsgStatsRecord();
                        msr2.setYear1(year);
                        msr2.setAppId(applicationName);
                        msr2.setCount1(count);
                        msr2.setType(type);
                        // msr2.setGate(status_sel);
                        msr2.setCreateTime(new Date());
                        sqlSession.insert("com.itrus.portal.db.MsgStatsRecordMapper.insert", msr2);
                    }
                } else {
                    param.put("queryDate1", dt1);
                    param.put("queryDate2", dt2);
                    Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod", param);
                    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                    map.put(count, yr1);
                    list.add(map);
                }
            }
            if (type == 2) {
                if (projectName != null && projectName != 0) {
                    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", projectName);
                    projectName1 = project.getName();
                    param.put("projectName", projectName);
                }
                param2.put("projectName", projectName);
                param2.put("type", type);
                if (status_sel2 != null && status_sel2 != 2) {
                    param.put("gate", status_sel2);
                } else {
                    param.put("gate", null);
                }
                param2.put("gate", status_sel2);
                if (dt2.before(nowdate)) {
                    year = yr1 + "Y";
                    param2.put("year", year);
                    MsgStatsRecord msr = sqlSession.selectOne("com.itrus.portal.db.MsgStatsRecordMapper.selectByYear2", param2);
                    if (null != msr) {
                        Integer count = msr.getCount1();
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list2.add(map);
                    } else {
                        param.put("queryDate3", dt1);
                        param.put("queryDate4", dt2);
                        Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod2", param);
                        Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                        map.put(count, yr1);
                        list2.add(map);
                        MsgStatsRecord msr2 = new MsgStatsRecord();
                        msr2.setYear1(year);
                        msr2.setAppId(projectName);
                        msr2.setCount1(count);
                        msr2.setType(type);
                        msr2.setGate(status_sel2);
                        msr2.setCreateTime(new Date());
                        sqlSession.insert("com.itrus.portal.db.MsgStatsRecordMapper.insert", msr2);
                    }
                } else {
                    param.put("queryDate3", dt1);
                    param.put("queryDate4", dt2);
                    Integer count = sqlSession.selectOne("com.itrus.portal.db.AppConfigMapper.selectCountByPeriod2", param);
                    Map<Integer, Integer> map = new HashMap<Integer, Integer>();
                    map.put(count, yr1);
                    list2.add(map);
                }
            }
            yr1++;
        }
    }
    if (null == applicationName || 0 == applicationName) {
        applicationName1 = "所有应用";
    }
    if (null == projectName || 0 == projectName) {
        projectName1 = "所有项目";
    }
    Map<Long, AppConfig> appConfigMap = new HashMap<Long, AppConfig>();
    appConfigMap = sqlSession.selectMap("com.itrus.portal.db.AppConfigMapper.selectByExample", null, "id");
    Map<Long, Project> projectMap = sqlSession.selectMap("com.itrus.portal.db.ProjectMapper.selectByExample", "id");
    uiModel.addAttribute("projectMap", projectMap);
    uiModel.addAttribute("list", list);
    uiModel.addAttribute("year1", year3);
    uiModel.addAttribute("year2", year2);
    uiModel.addAttribute("cycle", cycle);
    uiModel.addAttribute("applicationName", applicationName);
    uiModel.addAttribute("applications", appConfigMap);
    uiModel.addAttribute("applicationN", applicationName1);
    uiModel.addAttribute("list2", list2);
    uiModel.addAttribute("year3", year6);
    uiModel.addAttribute("year4", year5);
    uiModel.addAttribute("cycle2", cycle2);
    uiModel.addAttribute("projectName", projectName);
    uiModel.addAttribute("projectN", projectName1);
    uiModel.addAttribute("projects", getProjectMapOfAdmin());
    uiModel.addAttribute("type", type);
    uiModel.addAttribute("status_sel", status_sel);
    uiModel.addAttribute("status_sel2", status_sel2);
    return "messagestats/list";
}
Also used : AppConfig(com.itrus.portal.db.AppConfig) MsgStatsRecord(com.itrus.portal.db.MsgStatsRecord) Project(com.itrus.portal.db.Project) java.util(java.util) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 53 with Project

use of com.itrus.portal.db.Project in project portal by ixinportal.

the class MsgTemplateController method show.

// 查看消息模版
@RequestMapping(value = "/{id}", produces = "text/html")
public String show(@PathVariable("id") Long id, Model uiModel) {
    MessageTemplate msgTemplate = sqlSession.selectOne("com.itrus.portal.db.MessageTemplateMapper.selectByPrimaryKey", id);
    if (msgTemplate == null) {
        return "status403";
    }
    String adminProject = getRoleProjects();
    if (adminProject != null && adminProject.equals(msgTemplate.getProject())) {
        return "status403";
    }
    Project project = sqlSession.selectOne("com.itrus.portal.db.ProjectMapper.selectByPrimaryKey", msgTemplate.getProject());
    uiModel.addAttribute("msgTemplate", msgTemplate);
    uiModel.addAttribute("project", project);
    return "msgtemplate/show";
}
Also used : MessageTemplate(com.itrus.portal.db.MessageTemplate) Project(com.itrus.portal.db.Project) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 54 with Project

use of com.itrus.portal.db.Project in project portal by ixinportal.

the class OnlineServiceController method selectProject.

@RequestMapping(produces = "text/html")
public String selectProject(@RequestParam(value = "queryDate1", required = false) Date queryDate1, @RequestParam(value = "queryDate2", required = false) Date queryDate2, @RequestParam(value = "projectId", required = false) Long projectId, @RequestParam(value = "phone", required = false) String phone, @RequestParam(value = "enterpriseQq", required = false) String enterpriseQq, @RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, @RequestParam(value = "status", required = false) String status, Model uiModel) {
    if (queryDate1 == null && queryDate2 == null) {
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DATE, 1);
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        calendar.add(Calendar.MILLISECOND, -1);
        queryDate2 = calendar.getTime();
        calendar.add(Calendar.MILLISECOND, 1);
        calendar.add(Calendar.MONTH, -1);
        queryDate1 = calendar.getTime();
    }
    // 管理员项目权限
    Long[] projectsOfAdmin = getProjectLongIdsOfAdmin();
    Map param = new HashMap();
    param.put("hasProjects", Arrays.asList(projectsOfAdmin));
    if (page == null || page < 1)
        page = 1;
    if (size == null || size < 1)
        size = 10;
    Integer offset = size * (page - 1);
    param.put("offset", offset);
    param.put("limit", size);
    param.put("queryDate1", queryDate1);
    param.put("queryDate2", queryDate2);
    if (projectId != null) {
        param.put("projectId", projectId);
    }
    if (StringUtils.isNotEmpty(phone)) {
        param.put("phone", "%" + phone + "%");
    }
    if (StringUtils.isNotEmpty(enterpriseQq)) {
        param.put("enterpriseQq", "%" + enterpriseQq + "%");
    }
    // 查詢qq客服
    List<Map<String, Object>> enterpriseqQq = onlineService.selectQqList(param);
    // 得到數量
    int count = onlineService.selectcount(param);
    uiModel.addAttribute("pages", (count + size - 1) / size);
    if (page > 1 && size * (page - 1) >= count) {
        page = (count + size - 1) / size;
    }
    Map<Long, List<CustomerService>> listmain = new HashMap<Long, List<CustomerService>>();
    for (int i = 0; i < enterpriseqQq.size(); i++) {
        long id = Long.parseLong(enterpriseqQq.get(i).get("id").toString());
        CustomerServiceExample customerE = new CustomerServiceExample();
        CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
        int cid = Integer.parseInt(enterpriseqQq.get(i).get("id").toString());
        serviceE.andEnterpriseIdEqualTo(cid);
        List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
        listmain.put(id, listcustomer);
    }
    ProjectExample projectE = new ProjectExample();
    ProjectExample.Criteria pec = projectE.createCriteria();
    pec.andIdIn(Arrays.asList(projectsOfAdmin));
    List<Project> project = projectService.getProjectByExample(projectE);
    uiModel.addAttribute("listQq", enterpriseqQq);
    uiModel.addAttribute("listmain", listmain);
    uiModel.addAttribute("list", project);
    // 查询默认客服的数据
    EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
    qqEx.andEnterpriseQqStateEqualTo(0L);
    EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
    // 查询默认客服的数据
    CustomerServiceExample customerE = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
    serviceE.andServiceStateEqualTo(0);
    CustomerService customerService = onlineService.selectService(customerE);
    uiModel.addAttribute("enterpriseqq", enterpriseqq);
    uiModel.addAttribute("customerService", customerService);
    uiModel.addAttribute("count", count);
    uiModel.addAttribute("queryDate1", queryDate1);
    uiModel.addAttribute("queryDate2", queryDate2);
    uiModel.addAttribute("projectId", projectId);
    uiModel.addAttribute("phone", phone);
    uiModel.addAttribute("enterpriseQq", enterpriseQq);
    uiModel.addAttribute("size", size);
    uiModel.addAttribute("page", page);
    return "onlineservices/list";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Calendar(java.util.Calendar) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) ArrayList(java.util.ArrayList) List(java.util.List) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 55 with Project

use of com.itrus.portal.db.Project in project portal by ixinportal.

the class OnlineServiceController method updateshow.

/**
 * 跳转修改页面
 *
 * @param id
 * @return
 */
@RequestMapping(value = "/updateshow/{id}", produces = "text/html")
public String updateshow(@PathVariable("id") Long id, Model uiModel) {
    EnterpriseQq enterprise = onlineService.selectEnterprise(id);
    // Long qq_state=enterprise.getQqState();
    // Long custerm_service_state=enterprise.getCustermServiceState();
    // Map<Long, List<CustomerService>> listmain = new HashMap<Long,
    // List<CustomerService>>();
    CustomerServiceExample customerE = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceE = customerE.createCriteria();
    int cid = Integer.parseInt(enterprise.getId().toString());
    serviceE.andEnterpriseIdEqualTo(cid);
    List<CustomerService> listcustomer = onlineService.selectServiceList(customerE);
    // CustomerServiceExample customerE = new CustomerServiceExample();
    // List<CustomerService> customerService =
    // onlineService.selectServiceList(customerE);
    Map<Long, Object> map = new HashMap<>();
    String json = "";
    for (CustomerService c : listcustomer) {
        String str = null;
        try {
            str = jsonTool.writeValueAsString(c);
            ObjectMapper mapper = new ObjectMapper();
            json = mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
        }
        map.put(c.getId(), str);
    }
    try {
        uiModel.addAttribute("json", jsonTool.writeValueAsString(json));
        uiModel.addAttribute("json1", jsonTool.writeValueAsString(listcustomer));
    } catch (Exception e) {
        e.printStackTrace();
    }
    ProjectExample projectE = new ProjectExample();
    List<Project> project = projectService.getProjectByExample(projectE);
    // 查询默认客服的数据
    EnterpriseQqExample enterpriseE = new EnterpriseQqExample();
    EnterpriseQqExample.Criteria qqEx = enterpriseE.createCriteria();
    qqEx.andEnterpriseQqStateEqualTo(0L);
    EnterpriseQq enterpriseqq = onlineService.selectQq(enterpriseE);
    // 查询默认客服的数据
    CustomerServiceExample customerEX = new CustomerServiceExample();
    CustomerServiceExample.Criteria serviceEX = customerEX.createCriteria();
    serviceEX.andServiceStateEqualTo(0);
    CustomerService customerService = onlineService.selectService(customerEX);
    if (customerService == null) {
        uiModel.addAttribute("customerstatus", 1);
    }
    if (enterpriseqq == null) {
        uiModel.addAttribute("qqstatus", 1);
    }
    uiModel.addAttribute("enterprise", enterprise);
    uiModel.addAttribute("listcustomer", listcustomer);
    uiModel.addAttribute("projectList", project);
    return "onlineservices/update";
}
Also used : CustomerService(com.itrus.portal.db.CustomerService) CustomerServiceExample(com.itrus.portal.db.CustomerServiceExample) HashMap(java.util.HashMap) ProjectExample(com.itrus.portal.db.ProjectExample) Project(com.itrus.portal.db.Project) EnterpriseQq(com.itrus.portal.db.EnterpriseQq) JSONObject(com.alibaba.fastjson.JSONObject) EnterpriseQqExample(com.itrus.portal.db.EnterpriseQqExample) ObjectMapper(org.codehaus.jackson.map.ObjectMapper) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Project (com.itrus.portal.db.Project)77 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)59 HashMap (java.util.HashMap)32 UserInfo (com.itrus.portal.db.UserInfo)24 Enterprise (com.itrus.portal.db.Enterprise)20 ExtraProduct (com.itrus.portal.db.ExtraProduct)17 ProjectExample (com.itrus.portal.db.ProjectExample)16 ArrayList (java.util.ArrayList)15 ProjectKeyInfo (com.itrus.portal.db.ProjectKeyInfo)12 UserInfoServiceException (com.itrus.portal.exception.UserInfoServiceException)12 Product (com.itrus.portal.db.Product)10 Date (java.util.Date)10 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)9 BusinessLicense (com.itrus.portal.db.BusinessLicense)8 IdentityCard (com.itrus.portal.db.IdentityCard)8 OrgCode (com.itrus.portal.db.OrgCode)8 TaxRegisterCert (com.itrus.portal.db.TaxRegisterCert)8 UserinfoEnterprise (com.itrus.portal.db.UserinfoEnterprise)8 List (java.util.List)8 Map (java.util.Map)8