public void execute() { System.out.println("执行定时任务========================================================="); Map map = new HashMap(); List departmentIds = new ArrayList(); departmentIds.add(4); departmentIds.add(9); departmentIds.add(10); map.put("departmentIds",departmentIds); map.put("status",1); List<SystemUserDetailed> systemUserDetaileds = systemUserService.listAllUsers(map); for (SystemUserDetailed systemUserDetailed : systemUserDetaileds) { DailyAssessment dailyAssessment = new DailyAssessment(); dailyAssessment.setSystemUserId(systemUserDetailed.getId()); dailyAssessment.setSystemUserName(systemUserDetailed.getName()); dailyAssessment.setDepartmentId(systemUserDetailed.getDepartmentId()); dailyAssessment.setRoleId(systemUserDetailed.getRoleId()); dailyAssessment.setMonth(Integer.valueOf(DatetimeUtils.format(new Date(), "yyyyMM"))); if(dailyAssessment.getDepartmentId() == 19){ //信息流竞价助理 if (dailyAssessment.getRoleId() == 10) { int length = 19; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } //信息流竞价专员 if (dailyAssessment.getRoleId() == 9 ) { int length = 18; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } //信息流数据统计员 if (dailyAssessment.getRoleId() == 26 ) { int length = 11; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } //信息流竞价主管 if (dailyAssessment.getRoleId() == 8){ int length = 17; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } }else{ //竞价经理、竞价主管、竞价培训师 if (dailyAssessment.getRoleId() == 8 || dailyAssessment.getRoleId() == 23 || dailyAssessment.getRoleId() == 31) { int length = 17; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } //竞价助理 if (dailyAssessment.getRoleId() == 10 ) { int length = 16; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } //竞价专员、竞价总监助理 if (dailyAssessment.getRoleId() == 9 || dailyAssessment.getRoleId() == 11) { int length = 15; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } //竞价数据统计员 if (dailyAssessment.getRoleId() == 26 ) { int length = 13; int insert = dailyAssessmentService.insertSelective(dailyAssessment); int i = weekAssessmentScoreAdd(dailyAssessment, length); } } } }
private int weekAssessmentScoreAdd(DailyAssessment dailyAssessment, int param) { int insert = 0; for (int x = 1; x <= param; x++) { WeekAssessmentScore weekAssessmentScore = new WeekAssessmentScore(); weekAssessmentScore.setDailyAssessmentId(dailyAssessment.getId()); weekAssessmentScore.setType(x); insert = weekAssessmentScoreService.insertSelective(weekAssessmentScore); } return insert; } }