| 
					
				 | 
			
			
				@@ -1,147 +0,0 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-package com.ym; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dao.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.CourseScheduleDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.dto.StudentVipGroupDetailDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.CourseSchedule; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.entity.StudentAttendance; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.dal.enums.StudentAttendanceStatusEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.biz.service.CourseScheduleService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.common.security.SecurityUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.ym.mec.web.WebApplication; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import junit.framework.TestCase; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.junit.Test; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.junit.runner.RunWith; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.boot.test.context.SpringBootTest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.http.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.test.context.junit4.SpringRunner; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.util.MultiValueMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.springframework.web.client.RestTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.text.ParseException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * Unit test for simple App. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-@RunWith(SpringRunner.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-@SpringBootTest(classes = WebApplication.class) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-public class webApplicationTest 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    extends TestCase{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private RestTemplate restTemplate; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private CourseScheduleService css; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private StudentAttendanceDao sad; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private ClassGroupDao cgd; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private CourseScheduleDao csd; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private VipGroupDao vipGroupDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    private MusicGroupStudentFeeDao studentFeeDao; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        String url = "http://auth-server/queryUserInfo"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        HttpHeaders headers = new HttpHeaders(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        headers.add("Authorization", "bearer " + SecurityUtils.getAuthentication()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        HttpEntity<MultiValueMap<String, String>> entity = new HttpEntity<MultiValueMap<String, String>>(null, headers); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        ResponseEntity<String> resp = restTemplate.exchange(url, HttpMethod.POST, entity, String.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println("---------"+resp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test1(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<StudentAttendance> sas=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        StudentAttendance sa=new StudentAttendance(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setClassGroupId(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setCourseScheduleId(1L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setMusicGroupId("1"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setRemark("test"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setStatus(StudentAttendanceStatusEnum.LEAVE); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setTeacherId(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sa.setUserId(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sas.add(sa); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        sad.addStudentAttendances(sas); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test2() throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(new StringBuilder("2019-09-11 15:10:01").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:dd").parse("2019-09-11 15:10:01")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(new StringBuilder("2019-09-11 15:10:01").toString())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test3() throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseSchedule> courseSchedules=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CourseSchedule cs1=new CourseSchedule(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs1.setClassDate(new SimpleDateFormat("yyyy-MM-dd").parse("2019-09-17")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs1.setStartClassTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2019-09-17 15:00:00")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs1.setClassGroupId(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        courseSchedules.add(cs1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CourseSchedule cs2=new CourseSchedule(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs2.setClassDate(new SimpleDateFormat("yyyy-MM-dd").parse("2019-09-17")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs2.setStartClassTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2019-09-17 15:00:00")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs2.setClassGroupId(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        courseSchedules.add(cs2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        CourseSchedule cs3=new CourseSchedule(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs3.setClassDate(new SimpleDateFormat("yyyy-MM-dd").parse("2019-09-17")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs3.setStartClassTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2019-09-17 16:00:00")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        cs3.setClassGroupId(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        courseSchedules.add(cs3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Map<Date, List<CourseSchedule>> collect = courseSchedules.stream().collect( 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                Collectors.groupingBy(CourseSchedule::getClassDate)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        for(Date keyDate:collect.keySet()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            List<CourseSchedule> currentCourses=collect.get(keyDate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Map<Date, List<CourseSchedule>> collect1 = currentCourses.stream().collect(Collectors.groupingBy(CourseSchedule::getStartClassTime)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            System.out.println(collect1.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test4(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<Integer> temp=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        temp.add(1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        temp.add(2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Integer[] integers = csd.countStudentInClass(temp); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(integers.length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test5() throws ParseException { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        List<CourseScheduleDto> courseSchedules = csd.getCourseSchedulesWithDate(new SimpleDateFormat("yyyyMMdd").parse("20190912")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(courseSchedules.size()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test6(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        StudentVipGroupDetailDto vipGroupDetail = vipGroupDao.getVipGroupDetail(1L); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(vipGroupDetail.getAvatar()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    @Test 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    public void test7(){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        int i = studentFeeDao.updateStudentAbsenteeismTimes(1, "1", 0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        System.out.println(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 |