Преглед на файлове

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

# Conflicts:
#	mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
zouxuan преди 5 години
родител
ревизия
a78216f23a
променени са 59 файла, в които са добавени 1087 реда и са изтрити 877 реда
  1. 13 83
      cms/src/main/java/com/ym/mec/cms/config/WebMvcConfig.java
  2. 2 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/AuthServerApplication.java
  3. 13 84
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/WebMvcConfig.java
  4. 19 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java
  5. 11 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherSchoolDao.java
  6. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java
  7. 22 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipGroupDetailDto.java
  8. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipGroupShowListDto.java
  9. 23 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupSubjectPlan.java
  10. 10 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessageConfig.java
  11. 35 12
      mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TeacherDefaultMusicGroupSalary.java
  12. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SalarySettlementTypeEnum.java
  13. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java
  14. 9 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java
  15. 20 0
      mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleTeacherSalaryService.java
  16. 14 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java
  17. 4 3
      mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java
  18. 11 0
      mec-biz/src/main/java/com/ym/mec/biz/service/TeacherSchoolService.java
  19. 20 18
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java
  20. 105 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  21. 92 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java
  22. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java
  23. 16 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java
  24. 92 9
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  25. 14 11
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java
  26. 12 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherSchoolServiceImpl.java
  27. 86 175
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java
  28. 43 5
      mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml
  29. 2 2
      mec-biz/src/main/resources/config/mybatis/DemoGroupMapper.xml
  30. 6 1
      mec-biz/src/main/resources/config/mybatis/MusicGroupSubjectPlanMapper.xml
  31. 3 3
      mec-biz/src/main/resources/config/mybatis/SysAccountMapper.xml
  32. 10 3
      mec-biz/src/main/resources/config/mybatis/SysMessageConfigMapper.xml
  33. 14 6
      mec-biz/src/main/resources/config/mybatis/TeacherDefaultMusicGroupSalaryMapper.xml
  34. 3 0
      mec-biz/src/main/resources/config/mybatis/TeacherSchoolMapper.xml
  35. 30 14
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  36. 2 0
      mec-education/src/main/java/com/ym/mec/education/EducationApplication.java
  37. 13 84
      mec-education/src/main/java/com/ym/mec/education/config/WebMvcConfig.java
  38. 50 0
      mec-education/src/main/java/com/ym/mec/education/enums/ApprovalStatusEnum.java
  39. 3 0
      mec-im/src/main/java/com/ym/SealClassApplication.java
  40. 2 0
      mec-student/src/main/java/com/ym/mec/student/StudentApplication.java
  41. 6 105
      mec-student/src/main/java/com/ym/mec/student/config/WebMvcConfig.java
  42. 8 8
      mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java
  43. 2 0
      mec-task/src/main/java/com/ym/mec/task/TaskApplication.java
  44. 13 56
      mec-task/src/main/java/com/ym/mec/task/config/WebMvcConfig.java
  45. 2 0
      mec-teacher/src/main/java/com/ym/mec/teacher/TeacherApplication.java
  46. 13 56
      mec-teacher/src/main/java/com/ym/mec/teacher/config/WebMvcConfig.java
  47. 6 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipGroupController.java
  48. 66 0
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipSchoolController.java
  49. 0 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/union/UnionPay.java
  50. 0 1
      mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayUtil.java
  51. 4 0
      mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java
  52. 3 3
      mec-util/src/main/java/com/ym/mec/util/json/JsonUtil.java
  53. 2 0
      mec-web/src/main/java/com/ym/mec/web/WebApplication.java
  54. 13 56
      mec-web/src/main/java/com/ym/mec/web/config/WebMvcConfig.java
  55. 4 4
      mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java
  56. 66 0
      mec-web/src/main/java/com/ym/mec/web/controller/TeacherVipSchoolController.java
  57. 9 0
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java
  58. 1 1
      mec-web/src/main/resources/application.yml
  59. 13 56
      mec-workflow/src/main/java/com/ym/mec/workfow/config/WebMvcConfig.java

+ 13 - 83
cms/src/main/java/com/ym/mec/cms/config/WebMvcConfig.java

@@ -1,39 +1,17 @@
 package com.ym.mec.cms.config;
 
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
-import com.ym.mec.common.enums.BaseEnum;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {
@@ -45,62 +23,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }

+ 2 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/AuthServerApplication.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
@@ -20,6 +21,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @ComponentScan(basePackages="com.ym.mec")
 @Configuration
 @EnableSwagger2Doc
+@EnableAsync
 public class AuthServerApplication {
 
 	public static void main(String[] args) {

+ 13 - 84
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/WebMvcConfig.java

@@ -1,39 +1,17 @@
 package com.ym.mec.auth.config;
 
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
-import com.ym.mec.common.enums.BaseEnum;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {
@@ -45,63 +23,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }

+ 19 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CourseScheduleDao.java

@@ -39,6 +39,16 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
 
     /**
      * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [classDates, classGroupId]
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
+     * @describe 根据班级和上课日期获取课程计划
+     */
+    List<CourseSchedule> findByClassGroupAndDate(@Param("classDates") List<Date> classDates,
+                                                 @Param("classGroupId") Long classGroupId);
+
+    /**
+     * @Author: Joburgess
      * @Date: 2019/9/17
      * 根据日期获取学生当日排课信息
      */
@@ -204,5 +214,14 @@ public interface CourseScheduleDao extends BaseDAO<Long, CourseSchedule> {
      */
     CourseScheduleDto getCourseSchedules(@Param("courseScheduleId") Long courseScheduleId);
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [vipGroupId]
+     * @return java.util.List<com.ym.mec.biz.dal.entity.CourseSchedule>
+     * @describe 获取vip课排课计划
+     */
+    List<CourseSchedule> findVipGroupCourseSchedules(@Param("vipGroupId") Long vipGroupId);
+
 
 }

+ 11 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/TeacherSchoolDao.java

@@ -3,7 +3,17 @@ package com.ym.mec.biz.dal.dao;
 import com.ym.mec.biz.dal.entity.TeacherSchool;
 import com.ym.mec.common.dal.BaseDAO;
 
+import java.util.List;
+
 public interface TeacherSchoolDao extends BaseDAO<Long, TeacherSchool> {
 
-	
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [teacherId]
+     * @return java.util.List<com.ym.mec.biz.dal.entity.TeacherSchool>
+     * @describe 根据教师编号获取教学点信息
+     */
+    List<TeacherSchool> findByTeacherId(Long teacherId);
+
 }

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupDao.java

@@ -166,4 +166,13 @@ public interface VipGroupDao extends BaseDAO<Long, VipGroup> {
      * @describe 统计学生vip课未上课时费用
      */
     List<Map<Long,BigDecimal>> countSurplusCourseFee(Long vipGroupId);
+
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [teacherId]
+     * @return int
+     * @describe 统计老师开启的vip课数
+     */
+    int countTeacherVipGroups(Long teacherId);
 }

+ 22 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipGroupDetailDto.java

@@ -1,6 +1,5 @@
 package com.ym.mec.biz.dal.dto;
 
-import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -12,9 +11,31 @@ import java.util.List;
  */
 public class StudentVipGroupDetailDto extends StudentVipGroupShowListDto {
 
+    @ApiModelProperty(value = "授课地点")
+    private String address;
+
+    @ApiModelProperty(value = "教师vip课申请数量")
+    private Integer numberOfClasses;
+
     @ApiModelProperty(value = "课程列表",required = false)
     private List<CourseSchedule> courseSchedules;
 
+    public Integer getNumberOfClasses() {
+        return numberOfClasses;
+    }
+
+    public void setNumberOfClasses(Integer numberOfClasses) {
+        this.numberOfClasses = numberOfClasses;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
     public List<CourseSchedule> getCourseSchedules() {
         return courseSchedules;
     }

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/StudentVipGroupShowListDto.java

@@ -39,6 +39,9 @@ public class StudentVipGroupShowListDto {
     @ApiModelProperty(value = "学生数量", required = false)
     private Integer studentNum;
 
+    @ApiModelProperty(value = "教师编号")
+    private Integer teacherId;
+
     @ApiModelProperty(value = "教师名称",required = false)
     private String teacherName;
 
@@ -55,6 +58,14 @@ public class StudentVipGroupShowListDto {
 
     private String categoryName;
 
+    public Integer getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Integer teacherId) {
+        this.teacherId = teacherId;
+    }
+
     public String getCategoryName() {
         return categoryName;
     }

+ 23 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/MusicGroupSubjectPlan.java

@@ -36,7 +36,11 @@ public class MusicGroupSubjectPlan {
 	@ApiModelProperty(value = "报名学生数",required = false)
 	private Integer applyStudentNum;
 
-	/** 报名学生数 */
+	/** 已缴费学生数 */
+	@ApiModelProperty(value = "已缴费学生数",required = false)
+	private Integer paidStudentNum;
+
+	/** 未分班学生数 */
 	@ApiModelProperty(value = "未分班学生数",hidden = true)
 	private Integer noClassStudentNum;
 
@@ -58,6 +62,8 @@ public class MusicGroupSubjectPlan {
 	/**  */
 	private java.util.Date updateTime;
 
+	private Integer version;
+
 	public String getSubName() {
 		return subName;
 	}
@@ -153,6 +159,22 @@ public class MusicGroupSubjectPlan {
 	public void setNoClassStudentNum(Integer noClassStudentNum) {
 		this.noClassStudentNum = noClassStudentNum;
 	}
+
+	public Integer getPaidStudentNum() {
+		return paidStudentNum;
+	}
+
+	public void setPaidStudentNum(Integer paidStudentNum) {
+		this.paidStudentNum = paidStudentNum;
+	}
+
+	public Integer getVersion() {
+		return version;
+	}
+
+	public void setVersion(Integer version) {
+		this.version = version;
+	}
 			
 	@Override
 	public String toString() {

+ 10 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMessageConfig.java

@@ -49,6 +49,8 @@ public class SysMessageConfig {
 
 	/** 跳转url */
 	private String url;
+	
+	private String group;
 
 	public void setId(Integer id) {
 		this.id = id;
@@ -98,6 +100,14 @@ public class SysMessageConfig {
 		return this.url;
 	}
 
+	public String getGroup() {
+		return group;
+	}
+
+	public void setGroup(String group) {
+		this.group = group;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 35 - 12
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/TeacherDefaultMusicGroupSalary.java

@@ -1,5 +1,6 @@
 package com.ym.mec.biz.dal.entity;
 
+import com.ym.mec.biz.dal.enums.SalarySettlementTypeEnum;
 import io.swagger.annotations.ApiModelProperty;
 
 import java.math.BigDecimal;
@@ -24,10 +25,18 @@ public class TeacherDefaultMusicGroupSalary {
 	/** 班级类型(参照 course_schedule表的type_字段) */
 	@ApiModelProperty(value = "课程类型",required = false)
 	private CourseScheduleType courseScheduleType;
-	
+
+
+	@ApiModelProperty(value = "结算方式",required = false)
+	private SalarySettlementTypeEnum settlementType;
+
+	/**  */
+	@ApiModelProperty(value = "最小课时长度",required = false)
+	private Integer durationMin;
+
 	/**  */
-	@ApiModelProperty(value = "专业技能",required = false)
-	private Integer subjectId;
+	@ApiModelProperty(value = "最大课时长度",required = false)
+	private Integer durationMax;
 	
 	/** 主教薪酬 */
 	@ApiModelProperty(value = "主教薪酬",required = false)
@@ -78,14 +87,6 @@ public class TeacherDefaultMusicGroupSalary {
 		this.courseScheduleType = courseScheduleType;
 	}
 
-	public void setSubjectId(Integer subjectId){
-		this.subjectId = subjectId;
-	}
-	
-	public Integer getSubjectId(){
-		return this.subjectId;
-	}
-
 	public BigDecimal getMainTeacherSalary() {
 		return mainTeacherSalary;
 	}
@@ -117,7 +118,29 @@ public class TeacherDefaultMusicGroupSalary {
 	public java.util.Date getUpdateTime(){
 		return this.updateTime;
 	}
-			
+	public Integer getDurationMin() {
+		return durationMin;
+	}
+
+	public void setDurationMin(Integer durationMin) {
+		this.durationMin = durationMin;
+	}
+
+	public Integer getDurationMax() {
+		return durationMax;
+	}
+
+	public void setDurationMax(Integer durationMax) {
+		this.durationMax = durationMax;
+	}
+
+	public SalarySettlementTypeEnum getSettlementType() {
+		return settlementType;
+	}
+
+	public void setSettlementType(SalarySettlementTypeEnum settlementType) {
+		this.settlementType = settlementType;
+	}
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/enums/SalarySettlementTypeEnum.java

@@ -10,7 +10,8 @@ public enum SalarySettlementTypeEnum implements BaseEnum<Integer,SalarySettlemen
 
     TEACHER_DEFAULT(1,"老师默认课酬"),
     RATIO_DISCOUNT(2,"课程单价比例折扣"),
-    FIXED_SALARY(3,"固定课酬");
+    FIXED_SALARY(3,"固定课酬"),
+    GRADIENT_SALARY(4,"梯度课酬");
 
     private Integer code;
 

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleService.java

@@ -110,6 +110,15 @@ public interface CourseScheduleService extends BaseService<Long, CourseSchedule>
     void courseSwap(Long courseScheduleId1,Long courseScheduleId2);
 
     /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [day1, day2]
+     * @return void
+     * @describe 对调两天的课程
+     */
+    void courseSwapWithDay(Date day1,Date day2);
+
+    /**
      * 获取班级的课程计划
      *
      * @param classGroupList

+ 9 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleStudentPaymentService.java

@@ -5,4 +5,13 @@ import com.ym.mec.common.service.BaseService;
 
 public interface CourseScheduleStudentPaymentService extends BaseService<Long, CourseScheduleStudentPayment> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [vipGroupId, userId]
+     * @return int
+     * @describe 生成学生vip课单节课时收费信息
+     */
+    int createCourseScheduleStudentPaymentForVipGroup(Long vipGroupId,Long userId);
+
 }

+ 20 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/CourseScheduleTeacherSalaryService.java

@@ -1,8 +1,28 @@
 package com.ym.mec.biz.service;
 
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
+import com.ym.mec.biz.dal.entity.VipGroup;
 import com.ym.mec.common.service.BaseService;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 public interface CourseScheduleTeacherSalaryService extends BaseService<Long, CourseScheduleTeacherSalary> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [vipGroup VIP课程信息,
+     * vipCourseSchedules 排课计划,
+     * onlineTeacherSalary 教师线上课酬,
+     * offlineTeacherSalary 教师线下课酬]
+     * @return int
+     * @describe 创建vip课教师课酬
+     */
+    int createCourseScheduleTeacherVipSalary(VipGroup vipGroup,
+                                             List<CourseSchedule> vipCourseSchedules,
+                                             BigDecimal onlineTeacherSalary,
+                                             BigDecimal offlineTeacherSalary);
+
 }

+ 14 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -95,6 +95,20 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId);
 
 	/**
+	 * 学生注册缴费重新下订单
+	 * @param userId
+	 * @param amount
+	 * @param courseFee
+	 * @param goodsGroups
+	 * @param goodsList
+	 * @return
+	 */
+	StudentPaymentOrder reAddOrder(
+			Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee,
+			List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList,
+			String musicGroupId,StudentPaymentOrder oldOrder);
+
+	/**
 	 * 查询用户指定乐团的报名信息
 	 * @param userId 用户编号
 	 * @param musicGroupId 乐团编号

+ 4 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/SysMessageService.java

@@ -23,10 +23,11 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param errorMsg 错误消息
 	 * @param readStatus 阅读状态
 	 * @param memo 备注
+	 * @param group 消息组
 	 * @return
 	 */
 	public int addMessage(Integer userId, String subject, String content, String receivers, Date triggerTime, MessageSendMode mode, SendStatusEnum status,
-			String errorMsg, Integer readStatus, String memo);
+			String errorMsg, Integer readStatus, String memo, String group);
 
 	/**
 	 * 修改消息对象
@@ -54,14 +55,14 @@ public interface SysMessageService extends BaseService<Long, SysMessage> {
 	 * @param userId 用户编号
 	 * @param mode 消息模式
 	 * @param messageType 消息类型
-	 * @param receiver 消息接受者
+	 * @param receivers 消息接受者(多个用户用逗号分隔)
 	 * @param triggerTime 触发时间
 	 * @param readStatus 阅读状态(0-未读  1-已读)
 	 * @param url 超链接地址
 	 * @param args 参数
 	 * @return
 	 */
-	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType messageType, String receiver, Date triggerTime,
+	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType messageType, String receivers, Date triggerTime,
 			Integer readStatus, String url, Object... args);
 
 	/**

+ 11 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/TeacherSchoolService.java

@@ -3,6 +3,17 @@ package com.ym.mec.biz.service;
 import com.ym.mec.biz.dal.entity.TeacherSchool;
 import com.ym.mec.common.service.BaseService;
 
+import java.util.List;
+
 public interface TeacherSchoolService extends BaseService<Long, TeacherSchool> {
 
+    /**
+     * @Author: Joburgess
+     * @Date: 2019/10/14
+     * @params [teacherId]
+     * @return java.util.List<com.ym.mec.biz.dal.entity.TeacherSchool>
+     * @describe 根据教师编号获取教学点
+     */
+    List<TeacherSchool> findByTeacherId(Long teacherId);
+
 }

+ 20 - 18
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleServiceImpl.java

@@ -10,7 +10,6 @@ import com.ym.mec.biz.dal.dto.CourseScheduleDto;
 import com.ym.mec.biz.dal.dto.TeacherAttendanceDto;
 import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleComplaints;
-import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.SysConfig;
 import com.ym.mec.biz.dal.enums.AuditStatusEnum;
 import com.ym.mec.biz.dal.enums.ParamEnum;
@@ -34,6 +33,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 @Service
 public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSchedule>  implements CourseScheduleService {
@@ -195,12 +195,23 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 	 * @return
 	 */
 	private void checkCourseSchedule(List<CourseSchedule> courseSchedules){
-		Map<Date, List<CourseSchedule>> collect = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getClassDate));
+		List<Date> classDates = courseSchedules.stream().map(CourseSchedule::getClassDate).collect(Collectors.toList());
+		List<CourseSchedule> byClassGroupAndDate = courseScheduleDao.findByClassGroupAndDate(classDates, null);
+		List<CourseSchedule> collect3 = Stream.of(courseSchedules, byClassGroupAndDate).flatMap(Collection::stream).collect(Collectors.toList());
+		Map<Date, List<CourseSchedule>> collect = collect3.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));
-			if(currentCourses.size()==collect1.size()){
+			if(currentCourses.size()==1&&currentCourses.size()==collect1.size()){
 				continue;
+			}else if(currentCourses.size()>1&&currentCourses.size()==collect1.size()){
+				ArrayList<CourseSchedule> collect2 = currentCourses
+						.stream()
+						.collect(Collectors.collectingAndThen(Collectors.toCollection(()
+								-> new TreeSet<>(Comparator.comparing(o -> o.getStartClassTime() + "-" + o.getEndClassTime()))), ArrayList::new));
+				if(collect2.size()!=currentCourses.size()){
+					throw new BizException("课程安排上存在在同一时间开课的课程");
+				}
 			}else{
 				for(Date keyDate2:collect1.keySet()){
 					List<CourseSchedule> currentCourses1=collect1.get(keyDate2);
@@ -223,20 +234,6 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 				}
 			}
 		}
-		//课次创建
-//		Map<Integer, List<CourseSchedule>> classGroupByID = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getClassGroupId));
-//		List<Long> ids=new ArrayList<>();
-//		for (Integer key:classGroupByID.keySet()){
-//			ids.add(Long.valueOf(key));
-//		}
-//		Map<Integer, Integer> maxClassTimes = convertToMap(courseScheduleDao.getMaxClassTimeByClassIds(ids));
-//		courseSchedules.clear();
-//		for (Integer key:classGroupByID.keySet()){
-//			Integer maxClassTime = null == maxClassTimes.get(key) ? 0 : maxClassTimes.get(key);
-//			for(CourseSchedule courseSchedule:classGroupByID.get(key)){
-//				courseSchedules.add(courseSchedule);
-//			}
-//		}
 	}
 
 	/**
@@ -353,7 +350,12 @@ public class CourseScheduleServiceImpl extends BaseServiceImpl<Long, CourseSched
 		courseScheduleDao.update(courseSchedules.get(1));
 	}
 
-    @Override
+	@Override
+	public void courseSwapWithDay(Date day1, Date day2) {
+		
+	}
+
+	@Override
     public List<CourseSchedule> findClassGroupCourseSchedules(List classGroupList) {
 		return courseScheduleDao.findClassGroupCourseSchedules(classGroupList);
     }

+ 105 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -1,23 +1,124 @@
 package com.ym.mec.biz.service.impl;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
 import com.ym.mec.biz.dal.dao.CourseScheduleStudentPaymentDao;
+import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
+import com.ym.mec.biz.dal.dao.VipGroupDao;
+import com.ym.mec.biz.dal.entity.CourseSchedule;
 import com.ym.mec.biz.dal.entity.CourseScheduleStudentPayment;
+import com.ym.mec.biz.dal.entity.VipGroup;
+import com.ym.mec.biz.dal.entity.VipGroupActivity;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+import com.ym.mec.biz.dal.enums.VipGroupActivityTypeEnum;
 import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
 
 @Service
 public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Long, CourseScheduleStudentPayment>  implements CourseScheduleStudentPaymentService {
 	
 	@Autowired
 	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+	@Autowired
+	private VipGroupDao vipGroupDao;
+	@Autowired
+	private VipGroupActivityDao vipGroupActivityDao;
+	@Autowired
+	private CourseScheduleDao courseScheduleDao;
 
 	@Override
 	public BaseDAO<Long, CourseScheduleStudentPayment> getDAO() {
 		return courseScheduleStudentPaymentDao;
 	}
-	
+
+	@Override
+	public int createCourseScheduleStudentPaymentForVipGroup(Long vipGroupId, Long userId) {
+		VipGroup vipGroupApplyBaseInfoDto=vipGroupDao.get(vipGroupId);
+
+		if(Objects.isNull(vipGroupApplyBaseInfoDto)){
+			throw new BizException("未找到相关vip课程");
+		}
+
+		//获取活动信息
+		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroupId.intValue());
+
+		List<CourseSchedule> vipGroupCourseSchedules=courseScheduleDao.findVipGroupCourseSchedules(vipGroupId);
+		if(CollectionUtils.isEmpty(vipGroupCourseSchedules)){
+			throw new BizException("为获取到排课信息");
+		}
+		List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
+		Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroupByTeachMode = vipGroupCourseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
+		for(TeachModeEnum teachModeEnum:courseScheduleGroupByTeachMode.keySet()){
+			List<CourseSchedule> courseSchedules = courseScheduleGroupByTeachMode.get(teachModeEnum)
+					.stream()
+					.sorted(Comparator.comparing(CourseSchedule::getStartClassTime)).collect(Collectors.toList());
+			for(int i=0;i<courseSchedules.size();i++) {
+				//创建学生课程应缴费记录
+				CourseScheduleStudentPayment courseScheduleStudentPayment = new CourseScheduleStudentPayment();
+				courseScheduleStudentPayment.setCourseScheduleId(courseSchedules.get(i).getId());
+
+				if (teachModeEnum == TeachModeEnum.ONLINE) {
+					//学生线上单节课应缴费计算
+					switch (vipGroupActivity.getType()) {
+						case BASE_ACTIVITY:
+							courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
+							break;
+						case DISCOUNT:
+							courseScheduleStudentPayment.setExpectPrice(
+									vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().multiply(
+											new BigDecimal(vipGroupActivity.getAttribute1())
+									)
+							);
+							break;
+						case GIVE_CLASS:
+							if (vipGroupActivity.getType() == VipGroupActivityTypeEnum.GIVE_CLASS
+									&& vipGroupApplyBaseInfoDto.getGiveTeachMode() == teachModeEnum
+									&& i >= Integer.parseInt(vipGroupActivity.getAttribute1())) {
+								courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
+							} else {
+								courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
+							}
+							break;
+						default:
+							throw new BizException("活动类型错误!");
+					}
+				}else{
+					//学生线下单节课应缴费计算
+					switch (vipGroupActivity.getType()) {
+						case BASE_ACTIVITY:
+							courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
+							break;
+						case DISCOUNT:
+							courseScheduleStudentPayment.setExpectPrice(
+									vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().multiply(
+											new BigDecimal(vipGroupActivity.getAttribute1())
+									)
+							);
+							break;
+						case GIVE_CLASS:
+							if (vipGroupActivity.getType() == VipGroupActivityTypeEnum.GIVE_CLASS
+									&& vipGroupApplyBaseInfoDto.getGiveTeachMode() == teachModeEnum
+									&& i >= Integer.parseInt(vipGroupActivity.getAttribute1())) {
+								courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
+							} else {
+								courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
+							}
+							break;
+						default:
+							throw new BizException("活动类型错误!");
+					}
+					courseScheduleStudentPayments.add(courseScheduleStudentPayment);
+				}
+			}
+		}
+		return courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
+	}
 }

+ 92 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleTeacherSalaryServiceImpl.java

@@ -1,23 +1,110 @@
 package com.ym.mec.biz.service.impl;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
+import com.alibaba.fastjson.JSON;
 import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
-import com.ym.mec.biz.dal.entity.CourseScheduleTeacherSalary;
+import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
+import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
+import com.ym.mec.biz.dal.dto.VipGroupSalarySettlementDto;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.enums.TeachModeEnum;
+import com.ym.mec.biz.dal.enums.TeachTypeEnum;
+import com.ym.mec.biz.dal.enums.VipGroupActivityTypeEnum;
 import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @Service
 public class CourseScheduleTeacherSalaryServiceImpl extends BaseServiceImpl<Long, CourseScheduleTeacherSalary>  implements CourseScheduleTeacherSalaryService {
 	
 	@Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
+	@Autowired
+	private TeacherDefaultVipGroupSalaryDao teacherDefaultVipGroupSalaryDao;
+	@Autowired
+	private VipGroupActivityDao vipGroupActivityDao;
 
 	@Override
 	public BaseDAO<Long, CourseScheduleTeacherSalary> getDAO() {
 		return courseScheduleTeacherSalaryDao;
 	}
-	
+
+	@Override
+	public int createCourseScheduleTeacherVipSalary(VipGroup vipGroup,
+													List<CourseSchedule> vipCourseSchedules,
+													BigDecimal onlineTeacherSalary,
+													BigDecimal offlineTeacherSalary) {
+		TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroup.getUserId().longValue(),
+				vipGroup.getVipGroupCategoryId());
+
+		//获取活动信息
+		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
+		VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
+
+		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries=new ArrayList<>();
+		Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroupByTeachMode = vipCourseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
+
+		for(TeachModeEnum teachModeEnum:courseScheduleGroupByTeachMode.keySet()){
+			List<CourseSchedule> courseSchedules = courseScheduleGroupByTeachMode.get(teachModeEnum)
+					.stream()
+					.sorted(Comparator.comparing(CourseSchedule::getStartClassTime)).collect(Collectors.toList());
+			for(int i=0;i<courseSchedules.size();i++){
+				//创建教师课程薪水记录
+				CourseScheduleTeacherSalary courseScheduleTeacherSalary=new CourseScheduleTeacherSalary();
+				courseScheduleTeacherSalary.setCourseScheduleId(courseSchedules.get(i).getId());
+				courseScheduleTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
+				courseScheduleTeacherSalary.setUserId(vipGroup.getUserId());
+
+				if(teachModeEnum==TeachModeEnum.ONLINE){
+					if(vipGroupActivity.getType()== VipGroupActivityTypeEnum.GIVE_CLASS
+							&&vipGroup.getGiveTeachMode()==teachModeEnum
+							&&i>=Integer.parseInt(vipGroupActivity.getAttribute1())
+							&&"0".equals(vipGroupActivity.getGiveClassPaySalaryFlag())){
+						courseScheduleTeacherSalary.setExpectSalary(new BigDecimal(0));
+					}else {
+						//教师课酬线上单课酬计算
+						switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
+							case TEACHER_DEFAULT:
+								courseScheduleTeacherSalary.setExpectSalary(teacherDefaultVipGroupSalary.getOnlineClassesSalary());
+								break;
+							case RATIO_DISCOUNT:
+								courseScheduleTeacherSalary.setExpectSalary(onlineTeacherSalary.multiply(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue()));
+								break;
+							case FIXED_SALARY:
+								courseScheduleTeacherSalary.setExpectSalary(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
+								break;
+							default:
+								throw new BizException("未指定课酬结算标准!");
+						}
+					}
+				}else{
+					//教师线下单课酬计算
+					switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
+						case TEACHER_DEFAULT:
+							courseScheduleTeacherSalary.setExpectSalary(teacherDefaultVipGroupSalary.getOfflineClassesSalary());
+							break;
+						case RATIO_DISCOUNT:
+							courseScheduleTeacherSalary.setExpectSalary(offlineTeacherSalary.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
+							break;
+						case FIXED_SALARY:
+							courseScheduleTeacherSalary.setExpectSalary(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
+							break;
+						default:
+							throw new BizException("未指定课酬结算标准!");
+					}
+				}
+				courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
+			}
+		}
+		return courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
+	}
 }

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupSubjectPlanServiceImpl.java

@@ -59,7 +59,7 @@ public class MusicGroupSubjectPlanServiceImpl extends BaseServiceImpl<Integer, M
 
     @Override
     public MusicGroupSubjectGoodsAndInfoDto getSubjectGoodsAndInfo(String musicGroupId, Integer subjectId) {
-        MusicGroup musicGroup = musicGroupService.get(musicGroupId.toString());
+        MusicGroup musicGroup = musicGroupService.get(musicGroupId);
 
         //课程形态
         Map<String, Object> courseForm = JSON.parseObject(musicGroup.getCourseForm(), Map.class);

+ 16 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/PayServiceImpl.java

@@ -12,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
+import java.util.HashMap;
 import java.util.Map;
+import java.util.Random;
 
 /**
  * 支付服务类
@@ -43,12 +45,20 @@ public class PayServiceImpl implements PayService {
     public Map getPayMap(BigDecimal amount, String orderNo, String notifyUrl, String returnUrl, String orderSubject, String orderBody) throws Exception {
         //支付通道决策
         SysAccount routingAccount = getRoutingAccount(amount);
+        HashMap<String, Object> unionPay = new HashMap<>();
+        String type = "YQPAY";
+        Map payMap;
         if (routingAccount != null) {
             //易乾支付
-            return YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo());
+            payMap = YqPayUtil.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject, orderBody, routingAccount.getMerNo());
         } else {
-            return UnionPay.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject);
+            type = "UNIONPAY";
+            payMap = UnionPay.getPayMap(amount, orderNo, notifyUrl, returnUrl, orderSubject);
         }
+        unionPay.put("orderNo", orderNo);
+        unionPay.put("type", type);
+        unionPay.put("payMap", payMap);
+        return unionPay;
     }
 
     public Map<String, Object> query(String orderNo) throws Exception {
@@ -64,6 +74,10 @@ public class PayServiceImpl implements PayService {
         if (rem > 0 && rem <= 5) { //私人账户
             routingAccount = sysAccountService.getPerAccount(money);
         }
+
+        //临时全返回双乾
+        routingAccount = sysAccountService.getPerAccount(money);
+
         return routingAccount;
     }
 

+ 92 - 9
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -10,6 +10,8 @@ import java.util.Map;
 import javax.annotation.Resource;
 
 import com.ym.mec.biz.dal.dao.TeacherDao;
+import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -22,11 +24,6 @@ import com.ym.mec.biz.dal.dao.StudentRegistrationDao;
 import com.ym.mec.biz.dal.dto.StudentApplyDetailDto;
 import com.ym.mec.biz.dal.dto.StudentFeeDto;
 import com.ym.mec.biz.dal.dto.StudentInfo;
-import com.ym.mec.biz.dal.entity.Goods;
-import com.ym.mec.biz.dal.entity.MusicGroupSubjectGoodsGroup;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
-import com.ym.mec.biz.dal.entity.StudentPaymentOrderDetail;
-import com.ym.mec.biz.dal.entity.StudentRegistration;
 import com.ym.mec.biz.dal.enums.DealStatusEnum;
 import com.ym.mec.biz.dal.enums.GoodsType;
 import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
@@ -54,6 +51,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
     @Autowired
     private TeacherDao teacherDao;
+    @Autowired
+    private MusicGroupSubjectPlanService musicGroupSubjectPlanService;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -140,6 +139,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         }
         studentRegistration.setUserId(sysUser.getId());
         studentRegistrationDao.insert(studentRegistration);
+        //增加报名学生数
+        MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
+        musicOneSubjectClassPlan.setApplyStudentNum(musicOneSubjectClassPlan.getApplyStudentNum()+1);
         return studentRegistration;
     }
 
@@ -227,10 +229,91 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         return studentPaymentOrder;
     }
 
-	@Override
-	public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
-		return studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-	}
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public StudentPaymentOrder reAddOrder(Integer userId, BigDecimal amount, String orderNo, String paymentChannel, BigDecimal courseFee, List<MusicGroupSubjectGoodsGroup> goodsGroups, List<Goods> goodsList, List<Goods> otherGoodsList, String musicGroupId, StudentPaymentOrder oldOrder) {
+        //关闭老订单
+        oldOrder.setStatus(DealStatusEnum.CLOSE);
+        studentPaymentOrderService.update(oldOrder);
+        Date date = new Date();
+        StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+        studentPaymentOrder.setUserId(userId);
+        studentPaymentOrder.setOrderNo(orderNo);
+        studentPaymentOrder.setType(OrderTypeEnum.APPLY);
+        studentPaymentOrder.setExpectAmount(amount);
+        studentPaymentOrder.setActualAmount(amount);
+        studentPaymentOrder.setStatus(DealStatusEnum.ING);
+        studentPaymentOrder.setPaymentChannel(paymentChannel);
+        studentPaymentOrder.setMusicGroupId(musicGroupId);
+        studentPaymentOrderService.insert(studentPaymentOrder);
+
+        ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
+        StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
+        studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
+        studentPaymentOrderDetail.setPrice(courseFee);
+        studentPaymentOrderDetail.setCreateTime(date);
+        studentPaymentOrderDetail.setUpdateTime(date);
+        studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
+        studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
+        //乐器及打包辅件
+        if (goodsGroups != null) {
+            for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
+                StudentPaymentOrderDetail studentPaymentOrderDetail4goodsGroup = new StudentPaymentOrderDetail();
+                OrderDetailTypeEnum type = null;
+                if (goodsGroup.getType().equals(GoodsType.INSTRUMENT)) {
+                    type = OrderDetailTypeEnum.MUSICAL;
+                } else if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
+                    type = OrderDetailTypeEnum.ACCESSORIES;
+                } else if (goodsGroup.getType().equals(GoodsType.OTHER)) {
+                    type = OrderDetailTypeEnum.TEACHING;
+                }
+                studentPaymentOrderDetail4goodsGroup.setType(type);
+                studentPaymentOrderDetail4goodsGroup.setPrice(goodsGroup.getPrice());
+                studentPaymentOrderDetail4goodsGroup.setGoodsIdList(goodsGroup.getGoodsIdList());
+                studentPaymentOrderDetail4goodsGroup.setCreateTime(date);
+                studentPaymentOrderDetail4goodsGroup.setUpdateTime(date);
+                studentPaymentOrderDetail4goodsGroup.setPaymentOrderId(studentPaymentOrder.getId());
+                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goodsGroup);
+            }
+        }
+
+        //单独辅件
+        if (goodsList != null) {
+            for (Goods goods : goodsList) {
+                StudentPaymentOrderDetail studentPaymentOrderDetail4goods = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetail4goods.setType(OrderDetailTypeEnum.ACCESSORIES);
+                studentPaymentOrderDetail4goods.setPrice(goods.getGroupPurchasePrice());
+                studentPaymentOrderDetail4goods.setGoodsIdList(goods.getId().toString());
+                studentPaymentOrderDetail4goods.setCreateTime(date);
+                studentPaymentOrderDetail4goods.setUpdateTime(date);
+                studentPaymentOrderDetail4goods.setPaymentOrderId(studentPaymentOrder.getId());
+                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4goods);
+
+            }
+        }
+        //单独教谱
+        if (otherGoodsList != null) {
+            for (Goods goods : otherGoodsList) {
+                StudentPaymentOrderDetail studentPaymentOrderDetail4otherGoods = new StudentPaymentOrderDetail();
+                studentPaymentOrderDetail4otherGoods.setType(OrderDetailTypeEnum.TEACHING);
+                studentPaymentOrderDetail4otherGoods.setPrice(goods.getGroupPurchasePrice());
+                studentPaymentOrderDetail4otherGoods.setGoodsIdList(goods.getId().toString());
+                studentPaymentOrderDetail4otherGoods.setCreateTime(date);
+                studentPaymentOrderDetail4otherGoods.setUpdateTime(date);
+                studentPaymentOrderDetail4otherGoods.setPaymentOrderId(studentPaymentOrder.getId());
+                studentPaymentOrderDetailList.add(studentPaymentOrderDetail4otherGoods);
+            }
+        }
+
+        studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
+
+        return studentPaymentOrder;
+    }
+
+    @Override
+    public StudentRegistration queryByUserIdAndMusicGroupId(Integer userId, String musicGroupId) {
+        return studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
+    }
 
     @Override
     public StudentRegistration getByPhoneAndMusicGroupId(String musicGroupId, String parentsPhone) {

+ 14 - 11
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMessageServiceImpl.java

@@ -47,9 +47,9 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Autowired
 	private SysUserFeignService sysUserFeignService;
-	
+
 	@Autowired
-	private RedisCache<String,Object> redisCache;
+	private RedisCache<String, Object> redisCache;
 
 	// 验证码有效期
 	public static final int CODE_EXPIRE = 60 * 5;
@@ -69,7 +69,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Override
 	public int addMessage(Integer userId, String subject, String content, String receivers, Date triggerTime, MessageSendMode mode, SendStatusEnum status,
-			String errorMsg, Integer readStatus, String memo) {
+			String errorMsg, Integer readStatus, String memo, String group) {
 		SysMessage message = null;
 		Date date = new Date();
 
@@ -99,6 +99,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 				message.setErrorMsg(errorMsg);
 				message.setReadStatus(readStatus);
 				message.setMemo(memo);
+				message.setGroup(group);
 
 				messages.add(message);
 			}
@@ -143,7 +144,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 				errorMsg = e.getMessage();
 				LOGGER.warn("消息发送失败", e);
 			}
-			return addMessage(null, subject, content, receivers, triggerTime, mode, status, errorMsg, readStatus, memo) > 0;
+			return addMessage(null, subject, content, receivers, triggerTime, mode, status, errorMsg, readStatus, memo, null) > 0;
 		}
 
 		return false;
@@ -151,12 +152,13 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 
 	@Override
 	@Async
-	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType type, String receiver, Date triggerTime,
+	public void sendMessage(MessageSender messageSender, Integer userId, MessageSendMode mode, MessageType type, String receivers, Date triggerTime,
 			Integer readStatus, String url, Object... args) {
 
-		if (StringUtils.isBlank(receiver)) {
+		if (StringUtils.isBlank(receivers)) {
 			throw new BizException("接收地址不能为空");
 		}
+		String[] tos = StringUtils.split(receivers, ',');
 		SysMessageConfig messageConfig = sysMessageConfigService.queryByType(type);
 		if (messageConfig == null) {
 			throw new BizException("消息类型错误");
@@ -168,8 +170,9 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 		if (triggerTime == null || date.after(triggerTime)) {
 			status = SendStatusEnum.SENDING;
 			try {
-				if (debugMode == true || messageSenderPluginContext.send(messageSender, messageConfig.getDescription(),
-								MessageFormatter.arrayFormat(messageConfig.getContent(), args), receiver, url)) {
+				if (debugMode == true
+						|| messageSenderPluginContext.batchSend(messageSender, messageConfig.getDescription(),
+								MessageFormatter.arrayFormat(messageConfig.getContent(), args), tos, url)) {
 					status = SendStatusEnum.SUCCESSED;
 				} else {
 					status = SendStatusEnum.FAILED;
@@ -180,8 +183,8 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 				LOGGER.warn("消息发送失败", e);
 			}
 		}
-		addMessage(userId, type.getCode(), MessageFormatter.arrayFormat(messageConfig.getContent(), args), receiver, triggerTime, mode, status, errorMsg,
-				readStatus, url);
+		addMessage(userId, type.getCode(), MessageFormatter.arrayFormat(messageConfig.getContent(), args), receivers, triggerTime, mode, status, errorMsg,
+				readStatus, url, messageConfig.getGroup());
 	}
 
 	@Override
@@ -209,7 +212,7 @@ public class SysMessageServiceImpl extends BaseServiceImpl<Long, SysMessage> imp
 				LOGGER.warn("消息发送失败", e);
 			}
 		}
-		addMessage(userId, title, content, receiver, triggerTime, mode, status, errorMsg, readStatus, url);
+		addMessage(userId, title, content, receiver, triggerTime, mode, status, errorMsg, readStatus, url, null);
 	}
 
 	@Override

+ 12 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/TeacherSchoolServiceImpl.java

@@ -4,11 +4,15 @@ import com.ym.mec.biz.dal.dao.TeacherSchoolDao;
 import com.ym.mec.biz.dal.entity.TeacherSchool;
 import com.ym.mec.biz.service.TeacherSchoolService;
 import com.ym.mec.common.dal.BaseDAO;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+import java.util.Objects;
+
 @Service
 public class TeacherSchoolServiceImpl extends BaseServiceImpl<Long, TeacherSchool> implements TeacherSchoolService {
 	
@@ -19,5 +23,12 @@ public class TeacherSchoolServiceImpl extends BaseServiceImpl<Long, TeacherSchoo
 	public BaseDAO<Long, TeacherSchool> getDAO() {
 		return teacherSchoolDao;
 	}
-	
+
+	@Override
+	public List<TeacherSchool> findByTeacherId(Long teacherId) {
+		if(Objects.isNull(teacherId)){
+			throw new BizException("请指定教师");
+		}
+		return teacherSchoolDao.findByTeacherId(teacherId);
+	}
 }

+ 86 - 175
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -8,9 +8,7 @@ import com.ym.mec.biz.dal.dto.*;
 import com.ym.mec.biz.dal.entity.*;
 import com.ym.mec.biz.dal.enums.*;
 import com.ym.mec.biz.dal.page.*;
-import com.ym.mec.biz.service.CourseScheduleService;
-import com.ym.mec.biz.service.SysUserCashAccountService;
-import com.ym.mec.biz.service.VipGroupService;
+import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImGroupMember;
 import com.ym.mec.common.entity.ImGroupModel;
@@ -68,14 +66,17 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 	private SysUserCashAccountDetailDao sysUserCashAccountDetailDao;
     @Autowired
 	private ClassGroupTeacherSalaryDao classGroupTeacherSalaryDao;
-    @Autowired
-	private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
+
     @Autowired
 	private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
     @Autowired
 	private ImFeignService imFeignService;
     @Autowired
 	private SubjectDao subjectDao;
+    @Autowired
+	private CourseScheduleTeacherSalaryService courseScheduleTeacherSalaryService;
+    @Autowired
+	private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
 
 	@Override
 	public BaseDAO<Long, VipGroup> getDAO() {
@@ -107,8 +108,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 
         //获取活动信息
         VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId().intValue());
-		VipGroupSalarySettlementDto vipGroupSalarySettlementDto = JSON.parseObject(vipGroupActivity.getSalarySettlementJson(), VipGroupSalarySettlementDto.class);
-		
+
 		//生成vip课信息
 		VipGroupApplyBaseInfoDto vipGroupApplyBaseInfoDto=vipGroup.getVipGroupApplyBaseInfo();
 		List<String> bySubIds = subjectDao.findBySubIds(vipGroupApplyBaseInfoDto.getSubjectIdList());
@@ -119,6 +119,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		vipGroupApplyBaseInfoDto.setTotalPrice(countVipGroupPredictFee(vipGroupApplyBaseInfoDto,
 				vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice(),
 				vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice()).get("totalPrice"));
+		vipGroupApplyBaseInfoDto.setStatus(VipGroupStatusEnum.APPLYING);
 		vipGroupDao.insert(vipGroupApplyBaseInfoDto);
 
 		//获取vip课类型信息
@@ -167,131 +168,18 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
                 &&courseSchedule.getStartClassTime().before(vipGroupActivity.getCoursesStartTime())){
 		        throw new BizException("课时安排时间超出范围!");
             }
+		    courseSchedule.setTeacherId(vipGroupApplyBaseInfoDto.getUserId().longValue());
+			courseSchedule.setStatus(CourseStatusEnum.NOT_START);
 		    courseSchedule.setType(CourseSchedule.CourseScheduleType.VIP);
 			courseSchedule.setClassGroupId(classGroup.getId());
 		});
 		courseScheduleService.batchAddCourseSchedule(vipGroup.getCourseSchedules());
 
-		//创建老师与学生费用相关记录
-		TeacherDefaultVipGroupSalary teacherDefaultVipGroupSalary = teacherDefaultVipGroupSalaryDao.findByTeacherAndCategory(vipGroupApplyBaseInfoDto.getUserId().longValue(),
-				vipGroupApplyBaseInfoDto.getVipGroupCategoryId());
-
-		List<CourseScheduleTeacherSalary> courseScheduleTeacherSalaries=new ArrayList<>();
-		List<CourseScheduleStudentPayment> courseScheduleStudentPayments=new ArrayList<>();
-		Map<TeachModeEnum, List<CourseSchedule>> courseScheduleGroupByTeachMode = vipGroup.getCourseSchedules().stream().collect(Collectors.groupingBy(CourseSchedule::getTeachMode));
-		for(TeachModeEnum teachModeEnum:courseScheduleGroupByTeachMode.keySet()){
-			List<CourseSchedule> courseSchedules = courseScheduleGroupByTeachMode.get(teachModeEnum)
-					.stream()
-					.sorted(Comparator.comparing(CourseSchedule::getStartClassTime)).collect(Collectors.toList());
-			for(int i=0;i<courseSchedules.size();i++){
-				//创建教师课程薪水记录
-				CourseScheduleTeacherSalary courseScheduleTeacherSalary=new CourseScheduleTeacherSalary();
-				courseScheduleTeacherSalary.setCourseScheduleId(courseSchedules.get(i).getId());
-				courseScheduleTeacherSalary.setTeacherRole(TeachTypeEnum.BISHOP);
-				courseScheduleTeacherSalary.setUserId(vipGroupApplyBaseInfoDto.getUserId());
-
-				//创建学生课程应缴费记录
-				CourseScheduleStudentPayment courseScheduleStudentPayment=new CourseScheduleStudentPayment();
-				courseScheduleStudentPayment.setCourseScheduleId(courseSchedules.get(i).getId());
-
-				if(teachModeEnum==TeachModeEnum.ONLINE){
-					if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.GIVE_CLASS
-							&&vipGroupApplyBaseInfoDto.getGiveTeachMode()==teachModeEnum
-							&&i>=Integer.parseInt(vipGroupActivity.getAttribute1())
-							&&"0".equals(vipGroupActivity.getGiveClassPaySalaryFlag())){
-						courseScheduleTeacherSalary.setExpectSalary(new BigDecimal(0));
-					}else {
-						//教师课酬线上单课酬计算
-						switch (vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSalarySettlementType()){
-							case TEACHER_DEFAULT:
-								courseScheduleTeacherSalary.setExpectSalary(teacherDefaultVipGroupSalary.getOnlineClassesSalary());
-								break;
-							case RATIO_DISCOUNT:
-								courseScheduleTeacherSalary.setExpectSalary(vipGroupApplyBaseInfoDto
-										.getOnlineTeacherSalary()
-										.multiply(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue()));
-								break;
-							case FIXED_SALARY:
-								courseScheduleTeacherSalary.setExpectSalary(vipGroupSalarySettlementDto.getOnlineSalarySettlement().getSettlementValue());
-								break;
-							default:
-								throw new BizException("未指定课酬结算标准!");
-						}
-					}
-
-					//学生线上单节课应缴费计算
-					switch (vipGroupActivity.getType()){
-						case BASE_ACTIVITY:
-							courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
-							break;
-						case DISCOUNT:
-							courseScheduleStudentPayment.setExpectPrice(
-									vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice().multiply(
-											new BigDecimal(vipGroupActivity.getAttribute1())
-									)
-							);
-							break;
-						case GIVE_CLASS:
-							if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.GIVE_CLASS
-									&&vipGroupApplyBaseInfoDto.getGiveTeachMode()==teachModeEnum
-									&&i>=Integer.parseInt(vipGroupActivity.getAttribute1())){
-								courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
-							}else {
-								courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOnlineClassesUnitPrice());
-							}
-							break;
-						default:
-							throw new BizException("活动类型错误!");
-					}
-				}else{
-					//教师线下单课酬计算
-					switch (vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSalarySettlementType()){
-						case TEACHER_DEFAULT:
-							courseScheduleTeacherSalary.setExpectSalary(teacherDefaultVipGroupSalary.getOfflineClassesSalary());
-							break;
-						case RATIO_DISCOUNT:
-							courseScheduleTeacherSalary.setExpectSalary(vipGroupApplyBaseInfoDto
-									.getOfflineTeacherSalary()
-									.multiply(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue()));
-							break;
-						case FIXED_SALARY:
-							courseScheduleTeacherSalary.setExpectSalary(vipGroupSalarySettlementDto.getOfflineSalarySettlement().getSettlementValue());
-							break;
-						default:
-							throw new BizException("未指定课酬结算标准!");
-					}
-				}
-
-				//学生线下单节课应缴费计算
-				switch (vipGroupActivity.getType()){
-					case BASE_ACTIVITY:
-						courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
-						break;
-					case DISCOUNT:
-						courseScheduleStudentPayment.setExpectPrice(
-								vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice().multiply(
-										new BigDecimal(vipGroupActivity.getAttribute1())
-								)
-						);
-						break;
-					case GIVE_CLASS:
-						if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.GIVE_CLASS
-								&&vipGroupApplyBaseInfoDto.getGiveTeachMode()==teachModeEnum
-								&&i>=Integer.parseInt(vipGroupActivity.getAttribute1())){
-							courseScheduleStudentPayment.setExpectPrice(new BigDecimal(0));
-						}else {
-							courseScheduleStudentPayment.setExpectPrice(vipGroupApplyBaseInfoDto.getOfflineClassesUnitPrice());
-						}
-						break;
-					default:
-						throw new BizException("活动类型错误!");
-				}
-				courseScheduleTeacherSalaries.add(courseScheduleTeacherSalary);
-				courseScheduleStudentPayments.add(courseScheduleStudentPayment);
-			}
-		}
-		courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
-		courseScheduleTeacherSalaryDao.batchInsert(courseScheduleTeacherSalaries);
+		//创建老师单节课课酬信息
+		courseScheduleTeacherSalaryService.createCourseScheduleTeacherVipSalary(vipGroupApplyBaseInfoDto,
+				vipGroup.getCourseSchedules(),
+				vipGroupApplyBaseInfoDto.getOnlineTeacherSalary(),
+				vipGroupApplyBaseInfoDto.getOfflineTeacherSalary());
 	}
 
 	@Override
@@ -428,7 +316,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 		if(Objects.isNull(vipGroupId)){
 			throw new BizException("请指定vip课程");
 		}
-		return vipGroupDao.getVipGroupDetail(vipGroupId);
+        StudentVipGroupDetailDto vipGroupDetail = vipGroupDao.getVipGroupDetail(vipGroupId);
+        vipGroupDetail.setNumberOfClasses(vipGroupDao.countTeacherVipGroups(vipGroupDetail.getTeacherId().longValue()));
+        return vipGroupDetail;
 	}
 
 	@Override
@@ -474,52 +364,6 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         return new VipGroupCostCountDto(null,teacherSalary);
     }
 
-    @Transactional(rollbackFor = Exception.class)
-    @Override
-    public void buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) {
-	    SysUser user = sysUserFeignService.queryUserInfo();
-        VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
-
-        if(vipGroup.getStatus()!=VipGroupStatusEnum.APPLYING){
-            throw new BizException("该课程已结束报名!");
-        }
-
-        VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
-        StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();
-        studentPaymentOrder.setUserId(user.getId());
-        String orderNo=StringUtils.join(new String[]{user.getId().toString(),String.valueOf(System.currentTimeMillis())});
-        studentPaymentOrder.setOrderNo(orderNo);
-        studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
-        studentPaymentOrder.setExpectAmount(countVipGroupPredictFee(vipGroup,vipGroup.getOnlineClassesUnitPrice(),vipGroup.getOfflineClassesUnitPrice()).get("totalPrice"));
-        if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.DISCOUNT){
-            studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount().multiply(new BigDecimal(vipGroupActivity.getAttribute1())));
-        }else{
-            studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
-        }
-        VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroup.getId());
-        studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
-        studentPaymentOrder.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
-        studentPaymentOrderDao.insert(studentPaymentOrder);
-
-        StudentVipGroupPayment studentVipGroupPayment=new StudentVipGroupPayment();
-        studentVipGroupPayment.setUserId(user.getId());
-		studentVipGroupPayment.setVipGroupId(vipGroup.getId());
-		studentVipGroupPayment.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
-        studentVipGroupPayment.setStudentPaymentOrderId(studentPaymentOrder.getId());
-        studentVipGroupPaymentDao.insert(studentVipGroupPayment);
-
-		ClassGroup classGroup = classGroupDao.get(vipGroupClassGroupMapper.getClassGroupId());
-		int classStudents = classGroupDao.countClassStudent(vipGroupClassGroupMapper.getClassGroupId().longValue());
-		if(classGroup.getExpectStudentNum()==classStudents){
-			vipGroup.setStatus(VipGroupStatusEnum.FINISH);
-			vipGroupDao.update(vipGroup);
-		}
-		classGroup.setStudentNum(classGroup.getStudentNum()+1);
-		classGroupDao.update(classGroup);
-
-		//生成回调地址
-    }
-
     /**
      * @Author: Joburgess
      * @Date: 2019/10/2
@@ -620,11 +464,78 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
         return results;
     }
 
+	@Transactional(rollbackFor = Exception.class)
 	@Override
+	public void buyVipGroup(VipGroupBuyParamsDto vipGroupBuyParams) {
+		SysUser user = sysUserFeignService.queryUserInfo();
+		VipGroup vipGroup = vipGroupDao.get(vipGroupBuyParams.getVipGroupId());
+
+		if(vipGroup.getStatus()!=VipGroupStatusEnum.APPLYING){
+			throw new BizException("该课程已结束报名!");
+		}
+
+		VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupActivityId().intValue());
+		StudentPaymentOrder studentPaymentOrder=new StudentPaymentOrder();
+		studentPaymentOrder.setUserId(user.getId());
+		String orderNo=StringUtils.join(new String[]{user.getId().toString(),String.valueOf(System.currentTimeMillis())});
+		studentPaymentOrder.setOrderNo(orderNo);
+		studentPaymentOrder.setType(OrderTypeEnum.SMALL_CLASS_TO_BUY);
+		studentPaymentOrder.setExpectAmount(countVipGroupPredictFee(vipGroup,vipGroup.getOnlineClassesUnitPrice(),vipGroup.getOfflineClassesUnitPrice()).get("totalPrice"));
+		if(vipGroupActivity.getType()==VipGroupActivityTypeEnum.DISCOUNT){
+			studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount().multiply(new BigDecimal(vipGroupActivity.getAttribute1())));
+		}else{
+			studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
+		}
+		VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroup.getId());
+		studentPaymentOrder.setMusicGroupId(vipGroup.getId().toString());
+		studentPaymentOrder.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
+		studentPaymentOrderDao.insert(studentPaymentOrder);
+
+		//生成回调地址
+	}
+
+	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public void orderCallback(String callbackParams) {
 		/*
 		根据回调信息调整订单状态及vip课程状态等相关信息
 		 */
+		Long vipGroupId=1L,userId=1L;
+
+		VipGroup vipGroup = vipGroupDao.get(vipGroupId);
+
+		if(vipGroup.getStatus()!=VipGroupStatusEnum.APPLYING){
+			throw new BizException("该课程已结束报名!");
+		}
+
+		//生成学生单课缴费信息
+		courseScheduleStudentPaymentService.createCourseScheduleStudentPaymentForVipGroup(vipGroupId,userId);
+
+		VipGroupClassGroupMapper vipGroupClassGroupMapper = vipGroupClassGroupMapperDao.findByVipGroupId(vipGroupId);
+
+		//更新订单状态
+		StudentPaymentOrder studentPaymentOrder=studentPaymentOrderDao.findByStudentVipGroup(vipGroupId,userId);
+		studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
+		studentPaymentOrderDao.update(studentPaymentOrder);
+
+		//生成缴费明细
+		StudentVipGroupPayment studentVipGroupPayment=new StudentVipGroupPayment();
+		studentVipGroupPayment.setUserId(userId.intValue());
+		studentVipGroupPayment.setVipGroupId(vipGroupId);
+		studentVipGroupPayment.setClassGroupId(vipGroupClassGroupMapper.getClassGroupId());
+		studentVipGroupPayment.setStudentPaymentOrderId(studentPaymentOrder.getId());
+		studentVipGroupPaymentDao.insert(studentVipGroupPayment);
+
+		//将学生加入到班级,更新班级报名状态及人数信息
+		ClassGroup classGroup = classGroupDao.get(vipGroupClassGroupMapper.getClassGroupId());
+		int classStudents = classGroupDao.countClassStudent(vipGroupClassGroupMapper.getClassGroupId().longValue());
+		if(classGroup.getExpectStudentNum()==classStudents){
+			vipGroup.setStatus(VipGroupStatusEnum.FINISH);
+			vipGroupDao.update(vipGroup);
+		}
+		classGroup.setStudentNum(classGroup.getStudentNum()+1);
+		classGroupDao.update(classGroup);
+
 	}
 
 	@Override
@@ -769,7 +680,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
     		return;
 		}
 		List<Map<Long, BigDecimal>> maps = vipGroupDao.countSurplusCourseFee(vipGroupId);
-    	if(CollectionUtils.isEmpty(maps)){
+    	if(CollectionUtils.isEmpty(maps)||(maps.size()==1&&Objects.isNull(maps.get(0)))){
 			vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
 			vipGroupDao.update(vipGroup);
 			return;

+ 43 - 5
mec-biz/src/main/resources/config/mybatis/CourseScheduleMapper.xml

@@ -67,16 +67,16 @@
         </selectKey>
         -->
         INSERT INTO course_schedule
-        (id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,teacher_id_,actual_teacher_id_,create_time_,update_time_,type_,name_)
-        VALUES(#{id},#{classGroupId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subsidy},#{classDate},#{startClassTime},#{endClassTime},#{teacherId},#{actualTeacherId},now(),now(),#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{name})
+        (id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,teacher_id_,actual_teacher_id_,create_time_,update_time_,type_,name_,teach_mode_)
+        VALUES(#{id},#{classGroupId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{subsidy},#{classDate},#{startClassTime},#{endClassTime},#{teacherId},#{actualTeacherId},now(),now(),#{type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{name},#{teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
     </insert>
 
-    <insert id="batchAddCourseSchedules" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id_">
+    <insert id="batchAddCourseSchedules" parameterType="java.util.List" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
         INSERT INTO course_schedule
-        (id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,teacher_id_,actual_teacher_id_,create_time_,update_time_,type_,name_)
+        (id_,class_group_id_,status_,subsidy_,class_date_,start_class_time_,end_class_time_,teacher_id_,actual_teacher_id_,create_time_,update_time_,type_,name_,teach_mode_)
         VALUE
         <foreach collection="list" item="course" separator=",">
-            (#{course.id},#{course.classGroupId},#{course.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.subsidy},#{course.classDate},#{course.startClassTime},#{course.endClassTime},#{course.teacherId},#{course.actualTeacherId},now(),now(),#{course.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.name})
+            (#{course.id},#{course.classGroupId},#{course.status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.subsidy},#{course.classDate},#{course.startClassTime},#{course.endClassTime},#{course.teacherId},#{course.actualTeacherId},now(),now(),#{course.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{course.name},#{course.teachMode,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
         </foreach>
     </insert>
 
@@ -580,4 +580,42 @@
             LEFT JOIN sys_user su ON sa.user_id_=su.id_
             WHERE sa.course_schedule_id_=#{courseScheduleId}
     </select>
+    <select id="findVipGroupCourseSchedules" resultMap="CourseSchedule">
+      SELECT
+            cs.*
+        FROM
+            vip_group_class_group_mapper vgcgm
+            LEFT JOIN course_schedule cs ON vgcgm.class_group_id_=cs.class_group_id_
+        WHERE
+            vgcgm.vip_group_id_ =#{vipGroupId}
+    </select>
+    <select id="findByClassGroupAndDate" resultMap="CourseSchedule">
+        SELECT
+        id_,
+        class_group_id_,
+        status_,
+        subsidy_,
+        class_date_,
+        CONCAT(class_date_,' ',start_class_time_) start_class_time_,
+        CONCAT(class_date_,' ',end_class_time_) end_class_time_,
+        teacher_id_,
+        actual_teacher_id_,
+        create_time_,
+        update_time_,
+        type_,name_,
+        teach_mode_
+        FROM
+            course_schedule
+        <where>
+            <if test="classGroupId!=null">
+                AND class_group_id_ = #{classGroupId}
+            </if>
+            <if test="classDates!=null">
+                AND class_date_ IN
+                <foreach collection="classDates" item="classDate" open="(" close=")" separator=",">
+                    #{classDate}
+                </foreach>
+            </if>
+        </where>
+    </select>
 </mapper>

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/DemoGroupMapper.xml

@@ -156,10 +156,10 @@ create_time_ = #{createTime},
 				AND FIND_IN_SET(dg.subject_id_,#{subjectIds})
 			</if>
 			<if test="startTime!=null and endTime==null">
-				AND CONCAT(dgcp.course_date_,' ',dgcp.start_time_)=#{startTime}
+				AND CONCAT(dgcp.course_date_,' ',dgcp.start_time_)&gt;t=#{startTime}
 			</if>
 			<if test="startTime!=null and endTime!=null">
-				AND (CONCAT(dgcp.course_date_,' ',dgcp.start_time_) BETWEEN #{startTime} AND #{endTime})
+				AND (CONCAT(dgcp.course_date_,' ',dgcp.start_time_) BETWEEN DATE_FORMAT(#{startTime},'%Y-%m-%d %H:%i') AND DATE_FORMAT(#{endTime},'%Y-%m-%d %H:%i'))
 			</if>
 		</where>
 	</sql>

+ 6 - 1
mec-biz/src/main/resources/config/mybatis/MusicGroupSubjectPlanMapper.xml

@@ -12,12 +12,14 @@
         <result column="subject_id_" property="subjectId"/>
         <result column="expected_student_num_" property="expectedStudentNum"/>
         <result column="apply_student_num_" property="applyStudentNum"/>
+        <result column="paid_student_num_" property="paidStudentNum"/>
         <result column="fee_" property="fee"/>
         <result column="kit_group_purchase_type_" property="kitGroupPurchaseType"
                 typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="deposit_fee_" property="depositFee"/>
         <result column="create_time_" property="createTime"/>
         <result column="update_time_" property="updateTime"/>
+        <result column="version" property="version"/>
     </resultMap>
 
     <!-- 根据主键查询一条记录 -->
@@ -69,8 +71,11 @@
             <if test="musicGroupId != null">
                 music_group_id_ = #{musicGroupId},
             </if>
+            <if test="version != null">
+                version = version+1,
+            </if>
         </set>
-        WHERE id_ = #{id}
+        WHERE id_ = #{id} AND version =#{version}
     </update>
 
     <!-- 根据主键删除一条记录 -->

+ 3 - 3
mec-biz/src/main/resources/config/mybatis/SysAccountMapper.xml

@@ -90,10 +90,10 @@
         channel_type_ = #{channelType,jdbcType=CHAR},
       </if>
       <if test="version != null">
-        version = #{version,jdbcType=INTEGER},
+        version = version+1,
       </if>
     </set>
-    where id_ = #{id,jdbcType=INTEGER}
+    where id_ = #{id,jdbcType=INTEGER} AND version =#{version}
   </update>
   <update id="updateByPrimaryKey" parameterType="com.ym.mec.biz.dal.entity.SysAccount">
     <!--@mbg.generated-->
@@ -109,6 +109,6 @@
   <select id="find"></select>
   <!-- 获取一个私户账户 -->
   <select id="getPerAccount" resultMap="SysAccount">
-    SELECT * FROM sys_account WHERE channel_type_ = 'YQPAY' AND channel_type_ = 'PER'
+    SELECT * FROM sys_account WHERE channel_ = 'YQPAY' AND channel_type_ = 'PER'
   </select>
 </mapper>

+ 10 - 3
mec-biz/src/main/resources/config/mybatis/SysMessageConfigMapper.xml

@@ -12,6 +12,7 @@
 		<result column="description_" property="description" />
 		<result column="modify_on_" property="modifyOn" />
 		<result column="url_" property="url" />
+		<result column="group_" property="group" />
 	</resultMap>
 
 	<sql id="queryCondition">
@@ -24,7 +25,10 @@
 				and content_ = #{content,jdbcType=VARCHAR},
 			</if>
 			<if test="description != null">
-				and description_ = #{description,jdbcType=TIMESTAMP}
+				and description_ = #{description,jdbcType=VARCHAR}
+			</if>
+			<if test="group != null">
+				and group_ = #{group,jdbcType=VARCHAR}
 			</if>
 		</where>
 	</sql>
@@ -47,8 +51,8 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO sys_message_config
-		(id_,message_type_,content_,description_,modify_on_,url_)
-		VALUES(#{id},#{messageType},#{content},#{description},#{modifyOn},#{url})
+		(id_,message_type_,content_,description_,modify_on_,url_,group_)
+		VALUES(#{id},#{messageType},#{content},#{description},#{modifyOn},#{url},#{group})
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -67,6 +71,9 @@
 			<if test="url != null">
 				url_ = #{url},
 			</if>
+			<if test="group != null">
+				group_ = #{group},
+			</if>
 			<if test="content != null">
 				content_ = #{content},
 			</if>

+ 14 - 6
mec-biz/src/main/resources/config/mybatis/TeacherDefaultMusicGroupSalaryMapper.xml

@@ -8,7 +8,9 @@
 		<result column="id_" property="id" />
 		<result column="user_id_" property="userId" />
 		<result column="course_schedule_type_" property="courseScheduleType" />
-		<result column="subject_id_" property="subjectId" />
+		<result column="settlement_type_" property="settlementType" />
+		<result column="duration_min_" property="durationMin" />
+		<result column="duration_max_" property="durationMax" />
 		<result column="main_teacher_salary_" property="mainTeacherSalary" />
 		<result column="assistant_teacher_salary_" property="assistantTeacherSalary" />
 		<result column="create_time_" property="createTime" />
@@ -33,8 +35,8 @@
 		<!-- <selectKey resultClass="int" keyProperty="id" > SELECT SEQ_WSDEFINITION_ID.nextval 
 			AS ID FROM DUAL </selectKey> -->
 		INSERT INTO teacher_default_music_group_salary
-		(id_,user_id_,course_schedule_type_,subject_id_,main_teacher_salary_,assistant_teacher_salary_,create_time_,update_time_)
-		VALUES(#{id},#{userId},#{courseScheduleType},#{subjectId},#{mainTeacherSalary},#{assistantTeacherSalary},now(),now())
+		(id_,user_id_,course_schedule_type_,settlement_type_,duration_min_,duration_max_,main_teacher_salary_,assistant_teacher_salary_,create_time_,update_time_)
+		VALUES(#{id},#{userId},#{courseScheduleType},#{settlementType},#{durationMin},#{durationMax},#{mainTeacherSalary},#{assistantTeacherSalary},now(),now())
 	</insert>
 
 	<!-- 根据主键查询一条记录 -->
@@ -42,9 +44,6 @@
 		parameterType="com.ym.mec.biz.dal.entity.TeacherDefaultMusicGroupSalary">
 		UPDATE teacher_default_music_group_salary
 		<set>
-			<if test="subjectId != null">
-				subject_id_ = #{subjectId},
-			</if>
 			<if test="userId != null">
 				user_id_ = #{userId},
 			</if>
@@ -54,6 +53,15 @@
 			<if test="courseScheduleType != null">
 				course_schedule_type_ = #{courseScheduleType},
 			</if>
+			<if test="settlementType != null">
+				settlement_type_ = #{settlementType},
+			</if>
+			<if test="duration_min_ != null">
+				duration_min_ = #{durationMin},
+			</if>
+			<if test="duration_max_ != null">
+				duration_max_ = #{durationMax},
+			</if>
 			<if test="mainTeacherSalary != null">
 				main_teacher_salary_ = #{mainTeacherSalary},
 			</if>

+ 3 - 0
mec-biz/src/main/resources/config/mybatis/TeacherSchoolMapper.xml

@@ -85,4 +85,7 @@
     <select id="queryCount" resultType="int">
 		SELECT COUNT(*) FROM teacher_school
 	</select>
+    <select id="findByTeacherId" resultMap="TeacherSchool">
+      SELECT * FROM teacher_school WHERE user_id_=#{teacherId} ORDER BY id_
+    </select>
 </mapper>

+ 30 - 14
mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml

@@ -8,6 +8,7 @@
 
     <resultMap type="com.ym.mec.biz.dal.entity.VipGroup" id="VipGroup">
         <result column="id_" property="id"/>
+        <result column="name_" property="name"/>
         <result column="user_id_" property="userId"/>
         <result column="username_" property="userName"/>
         <result column="single_class_minutes_" property="singleClassMinutes"/>
@@ -40,7 +41,6 @@
     <resultMap id="vipGroupManageDetailDto" type="com.ym.mec.biz.dal.dto.VipGroupManageDetailDto" extends="VipGroup">
         <result property="studentNum" column="student_num_"/>
         <result property="subjectIdList" column="subject_id_list_"/>
-        <result property="latestClassTime" column="current_class_times_"/>
         <result property="categoryName" column="category_name_"/>
         <result column="teacher_school_name_" property="teacherSchoolName"/>
         <!--<collection property="students" ofType="com.ym.mec.auth.api.entity.SysUser" column="student_id_">-->
@@ -50,6 +50,7 @@
     </resultMap>
 
     <resultMap id="studentVipGroupDetailDto" type="com.ym.mec.biz.dal.dto.StudentVipGroupDetailDto" extends="studentVipGroup">
+        <result column="address_" property="address"/>
         <collection property="courseSchedules" resultMap="com.ym.mec.biz.dal.dao.CourseScheduleDao.CourseSchedule" column="cs.id_"/>
     </resultMap>
 
@@ -63,6 +64,7 @@
         <result column="total_price_" property="totalPrice"/>
         <result column="expect_student_num_" property="expectStudentNum"/>
         <result column="student_num_" property="studentNum"/>
+        <result column="user_id_" property="teacherId"/>
         <result column="teacher_name_" property="teacherName"/>
         <result column="introduction_" property="introduction"/>
         <result column="avatar_" property="avatar"/>
@@ -140,8 +142,8 @@
         </selectKey>
         -->
         INSERT INTO vip_group
-        (id_,user_id_,single_class_minutes_,payment_expire_date_,courses_expire_date_,create_time_,update_time_,teacher_school_id_,online_classes_num_,offline_classes_num_,registration_start_time_,organ_id_list_,vip_group_activity_id_,status_,online_classes_unit_price_,offline_classes_unit_price_,total_price_,give_teach_mode_)
-        VALUES(#{id},#{userId},#{singleClassMinutes},#{paymentExpireDate},#{coursesExpireDate},now(),now(),#{teacherSchoolId},#{onlineClassesNum},#{offlineClassesNum},#{registrationStartTime},#{organIdList},#{vipGroupActivityId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{onlineClassesUnitPrice},#{offlineClassesUnitPrice},#{totalPrice},#{giveTeachMode})
+        (id_,user_id_,single_class_minutes_,payment_expire_date_,courses_expire_date_,create_time_,update_time_,teacher_school_id_,online_classes_num_,offline_classes_num_,registration_start_time_,name_,organ_id_list_,vip_group_activity_id_,status_,online_classes_unit_price_,offline_classes_unit_price_,total_price_,give_teach_mode_,vip_group_category_id_)
+        VALUES(#{id},#{userId},#{singleClassMinutes},#{paymentExpireDate},#{coursesExpireDate},now(),now(),#{teacherSchoolId},#{onlineClassesNum},#{offlineClassesNum},#{registrationStartTime},#{name},#{organIdList},#{vipGroupActivityId},#{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{onlineClassesUnitPrice},#{offlineClassesUnitPrice},#{totalPrice},#{giveTeachMode},#{vipGroupCategoryId})
     </insert>
 
     <!-- 根据主键查询一条记录 -->
@@ -176,7 +178,7 @@
                 registration_start_time_ = #{registrationStartTime},
             </if>
             <if test="organIdList!=null">
-                organ_id_list_=#{organIdList}
+                organ_id_list_=#{organIdList},
             </if>
             <if test="auditStatus != null">
                 audit_status_ = #{auditStatus,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
@@ -187,7 +189,7 @@
             <if test="vipGroupActivityId != null">
                 vip_group_activity_id_ = #{vipGroupActivityId},
             </if>
-            <if test="status_ != null">
+            <if test="status != null">
                 status_ = #{status,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
             </if>
             <if test="onlineClassesUnitPrice != null">
@@ -224,11 +226,15 @@
 
     <sql id="studentVipGroupQueryCondition">
         <where>
+            vg.status_!=3
             <if test="subjectId!=null">
-                FIND_IN_SET(#{subjectId},cg.subject_id_list_)
+               AND FIND_IN_SET(#{subjectId},cg.subject_id_list_)
+            </if>
+            <if test="classType!=null and classType.toString()=='0'.toString()">
+                AND vg.offline_classes_num_>0
             </if>
-            <if test="classType!=null">
-                AND cg.teach_mode_=#{classType}
+            <if test="classType!=null and classType.toString()=='1'.toString()">
+                AND vg.online_classes_num_>0
             </if>
             <if test="search!=null">
                 AND vg.name_ like concat('%',#{search},'%')
@@ -258,9 +264,8 @@
             vip_group vg
             LEFT JOIN vip_group_class_group_mapper vgcgm ON vg.id_=vgcgm.vip_group_id_
             LEFT JOIN class_group cg ON vgcgm.class_group_id_=cg.id_
-            LEFT JOIN class_group_teacher_mapper cgtm ON vgcgm.class_group_id_=cgtm.class_group_id_
-            LEFT JOIN teacher t ON cgtm.user_id_=t.id_
-            LEFT JOIN sys_user su ON cgtm.user_id_=su.id_
+            LEFT JOIN teacher t ON vg.user_id_=t.id_
+            LEFT JOIN sys_user su ON vg.user_id_=su.id_
             LEFT JOIN vip_group_activity vga ON vg.vip_group_activity_id_=vga.id_
             LEFT JOIN vip_group_category vgc ON vg.vip_group_category_id_=vgc.id_
             <include refid="studentVipGroupQueryCondition"/>
@@ -344,18 +349,22 @@
     <select id="getVipGroupDetail" resultMap="studentVipGroupDetailDto">
         SELECT
             vg.*,
+            cg.expect_student_num_,
+            cg.student_num_,
             su.username_ teacher_name_,
             su.avatar_,
             t.introduction_,
             cs.id_ course_id_,
+            s.name_ address_,
             cs.*
         FROM
             vip_group vg
             LEFT JOIN vip_group_class_group_mapper vgcgm ON vg.id_=vgcgm.vip_group_id_
+            LEFT JOIN class_group cg ON vgcgm.class_group_id_=cg.id_
             LEFT JOIN course_schedule cs ON vgcgm.class_group_id_=cs.class_group_id_
-            LEFT JOIN class_group_teacher_mapper cgtm ON vgcgm.class_group_id_=cgtm.class_group_id_
-            LEFT JOIN teacher t ON cgtm.user_id_=t.id_
-          LEFT JOIN sys_user su ON cgtm.user_id_=su.id_
+	        LEFT JOIN school s ON vg.teacher_school_id_=s.id_
+            LEFT JOIN teacher t ON vg.user_id_=t.id_
+          LEFT JOIN sys_user su ON vg.user_id_=su.id_
         WHERE vg.id_=#{vipGroupId}
     </select>
     <select id="countSurplusClassTimes" resultType="java.util.Map">
@@ -514,4 +523,11 @@
             WHERE vg.id_=#{vipGroupId} AND cs.status_!='OVER'
         GROUP BY cssp.user_id_
     </select>
+    <select id="countTeacherVipGroups" resultType="int">
+        SELECT
+            COUNT( * )
+        FROM
+            vip_group
+        WHERE user_id_=#{teacherId} AND status_!=3
+    </select>
 </mapper>

+ 2 - 0
mec-education/src/main/java/com/ym/mec/education/EducationApplication.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
@@ -20,6 +21,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @ComponentScan(basePackages = {"com.ym.mec", "org.snaker"})
 @Configuration
 @EnableSwagger2Doc
+@EnableAsync
 public class EducationApplication {
 
     public static void main(String[] args) {

+ 13 - 84
mec-education/src/main/java/com/ym/mec/education/config/WebMvcConfig.java

@@ -1,39 +1,17 @@
 package com.ym.mec.education.config;
 
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
+import java.util.ArrayList;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
-import com.ym.mec.common.enums.BaseEnum;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {
@@ -41,67 +19,18 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	/**
 	 * 枚举类的转换器 addConverterFactory
 	 */
-
 	@Override
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }

+ 50 - 0
mec-education/src/main/java/com/ym/mec/education/enums/ApprovalStatusEnum.java

@@ -0,0 +1,50 @@
+package com.ym.mec.education.enums;
+
+import com.ym.mec.common.enums.BaseEnum;
+import java.util.Arrays;
+
+/**
+ * 审核状态枚举(待审批、审批中、审批拒绝、审批通过)
+ */
+public enum ApprovalStatusEnum implements BaseEnum<String, ApprovalStatusEnum> {
+    PENDING("PENDING", "待审批"),APPROVAL("APPROVAL", "审核中"), REJECT("REJECT", "拒绝"), PASS("PASS", "通过");
+
+	private String code;
+
+	private String msg;
+
+	ApprovalStatusEnum(String code, String msg) {
+		this.code = code;
+		this.msg = msg;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getMsg() {
+		return msg;
+	}
+
+	public void setMsg(String msg) {
+		this.msg = msg;
+	}
+
+	@Override
+	public String getCode() {
+		return this.code;
+	}
+
+    /**
+     * 根据枚举值获取枚举信息
+     *
+     * @param code 枚举值
+     * @return 枚举信息
+     */
+    public static String getMsgByCode(String code) {
+        return Arrays.stream(ApprovalStatusEnum.values())
+            .filter(AuditStatusEnum -> AuditStatusEnum.getCode().equals(code))
+            .findFirst()
+            .map(ApprovalStatusEnum::getMsg).orElse(null);
+    }
+}

+ 3 - 0
mec-im/src/main/java/com/ym/SealClassApplication.java

@@ -1,6 +1,7 @@
 package com.ym;
 
 import lombok.extern.slf4j.Slf4j;
+
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@@ -9,6 +10,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.web.client.RestTemplate;
 
@@ -19,6 +21,7 @@ import org.springframework.web.client.RestTemplate;
 @EnableScheduling
 @EnableDiscoveryClient
 @Configuration
+@EnableAsync
 public class SealClassApplication {
 
 	public static void main(String[] args) {

+ 2 - 0
mec-student/src/main/java/com/ym/mec/student/StudentApplication.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
@@ -20,6 +21,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @ComponentScan(basePackages = "com.ym.mec")
 @Configuration
 @EnableSwagger2Doc
+@EnableAsync
 public class StudentApplication {
 
 	public static void main(String[] args) {

+ 6 - 105
mec-student/src/main/java/com/ym/mec/student/config/WebMvcConfig.java

@@ -1,41 +1,17 @@
 package com.ym.mec.student.config;
 
-import java.io.IOException;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.LocalTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Date;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
-import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import com.fasterxml.jackson.core.JsonGenerator;
-import com.fasterxml.jackson.core.JsonParser;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.DeserializationContext;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonDeserializer;
-import com.fasterxml.jackson.databind.JsonSerializer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.SerializationFeature;
-import com.fasterxml.jackson.databind.SerializerProvider;
-import com.fasterxml.jackson.databind.module.SimpleModule;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
 import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
-import com.ym.mec.common.enums.BaseEnum;
 
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {
@@ -51,85 +27,10 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	@Bean
     public HttpMessageConverters fastJsonHttpMessageConverters(){
 		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
         return new HttpMessageConverters(converter);
     }
 
-	@SuppressWarnings("rawtypes")
-	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		
-		objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>(){
-
-			@Override
-			public void serialize(Object value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
-				// TODO Auto-generated method stub
-				
-			}});
-
-		// 日期和时间格式化
-		SimpleModule javaTimeModule = new SimpleModule();
-
-		javaTimeModule.addSerializer(String.class, new JsonSerializer<String>() {
-
-			@Override
-			public void serialize(String value, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				if (value == null) {
-					jsonGenerator.writeString("");
-				} else {
-					jsonGenerator.writeString(value);
-				}
-			}
-		});
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
-
 }

+ 8 - 8
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupController.java

@@ -138,7 +138,7 @@ public class MusicGroupController extends BaseController {
         }
 
         //判断用户是否已存在订单
-        ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId().toString(), DealStatusEnum.ING);
+        ApplyOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
         if (ApplyOrder != null) {
             return failed(HttpStatus.CONTINUE, "您有待支付的订单");
         }
@@ -192,7 +192,7 @@ public class MusicGroupController extends BaseController {
 
         Map payMap = payService.getPayMap(orderAmount, orderNo, "https://pay.dayaedu.com/api/yqpay/notify", "http://dev.dayaedu.com", "测试订单", "测试订单");
 
-        studentRegistrationService.addOrder(userId, amount, orderNo, "双乾", courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId().toString());
+        studentRegistrationService.addOrder(userId, amount, orderNo, "双乾", courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId());
 
         return succeed(payMap);
     }
@@ -268,7 +268,7 @@ public class MusicGroupController extends BaseController {
 
         Map payMap = payService.getPayMap(orderAmount, orderNo, "https://pay.dayaedu.com/api/yqpay/notify", "http://dev.dayaedu.com", "测试订单", "测试订单");
 
-        studentRegistrationService.addOrder(userId, amount, orderNo, "双乾", courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId().toString());
+        studentRegistrationService.reAddOrder(userId, amount, orderNo, "双乾", courseFee, goodsGroups, goodsList, otherGoodsList, studentRegistration.getMusicGroupId(),ApplyOrder);
 
         return succeed(payMap);
     }
@@ -282,11 +282,11 @@ public class MusicGroupController extends BaseController {
 //
 //        System.out.println(query);
 //
-//        IdWorker idWorker = new IdWorker(0, 0);
-//        String orderNo = "1017" + idWorker.nextId();
-//        BigDecimal amount = new BigDecimal("200");
-//        Map map = payService.getPayMap(amount, orderNo, "https://pay.dayaedu.com/notify", "https://baodiu.com", "测试订单", "测试订单");
-       return succeed(sysUser);
+        IdWorker idWorker = new IdWorker(0, 0);
+        String orderNo = "1017" + idWorker.nextId();
+        BigDecimal amount = new BigDecimal("200");
+        Map map = payService.getPayMap(amount, orderNo, "https://pay.dayaedu.com/notify", "https://baodiu.com", "测试订单", "测试订单");
+       return succeed(map);
     }
 
     @ApiOperation(value = "订单状态查询")

+ 2 - 0
mec-task/src/main/java/com/ym/mec/task/TaskApplication.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
@@ -20,6 +21,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @ComponentScan(basePackages="com.ym.mec")
 @Configuration
 @EnableSwagger2Doc
+@EnableAsync
 public class TaskApplication {
 
 	public static void main(String[] args) {

+ 13 - 56
mec-task/src/main/java/com/ym/mec/task/config/WebMvcConfig.java

@@ -7,12 +7,16 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import com.fasterxml.jackson.core.JsonGenerator;
@@ -33,6 +37,7 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 import com.ym.mec.common.enums.BaseEnum;
 
 @Configuration
@@ -45,62 +50,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }

+ 2 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/TeacherApplication.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
@@ -20,6 +21,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @ComponentScan(basePackages = { "com.ym.mec", "org.snaker.engine" })
 @Configuration
 @EnableSwagger2Doc
+@EnableAsync
 public class TeacherApplication {
 	
 	public static void main(String[] args) {

+ 13 - 56
mec-teacher/src/main/java/com/ym/mec/teacher/config/WebMvcConfig.java

@@ -7,12 +7,16 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import com.fasterxml.jackson.core.JsonGenerator;
@@ -33,6 +37,7 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 import com.ym.mec.common.enums.BaseEnum;
 
 @Configuration
@@ -45,62 +50,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }

+ 6 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipGroupController.java

@@ -14,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Objects;
+
 /**
  * @Author Joburgess
  * @Date 2019/9/21
@@ -33,7 +35,11 @@ public class TeacherVipGroupController extends BaseController {
     @PostMapping("/vipGroupApply")
     public Object vipGroupApply(@RequestBody VipGroupApplyDto vipGroupApplyDto){
         SysUser user = sysUserFeignService.queryUserInfo();
+        if(Objects.isNull(user)){
+            return failed("请登录");
+        }
         vipGroupApplyDto.getVipGroupApplyBaseInfo().setTeacherId(Long.valueOf(user.getId()));
+        vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganIdList(user.getOrganId().toString());
         vipGroupService.createVipGroup(vipGroupApplyDto);
         return succeed();
     }

+ 66 - 0
mec-teacher/src/main/java/com/ym/mec/teacher/controller/TeacherVipSchoolController.java

@@ -0,0 +1,66 @@
+package com.ym.mec.teacher.controller;
+
+import com.ym.mec.biz.dal.entity.TeacherSchool;
+import com.ym.mec.biz.service.TeacherSchoolService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/10/14
+ */
+@Api(value = "教师vip课教学点服务")
+@RequestMapping("teacherVipSchool")
+@RestController
+public class TeacherVipSchoolController extends BaseController {
+
+    @Autowired
+    private TeacherSchoolService teacherSchoolService;
+
+    @ApiOperation("单查询")
+    @GetMapping(value = "/query")
+    public Object query(Long id) {
+        return succeed(teacherSchoolService.get(id));
+    }
+
+    @ApiOperation("根据教师编号获取教学点")
+    @GetMapping(value = "/queryAll")
+    public Object queryAll(Long teacherId) {
+        return succeed(teacherSchoolService.findByTeacherId(teacherId));
+    }
+
+    @ApiOperation("新增")
+    @PostMapping(value = "/add")
+    public Object add(TeacherSchool teacherSchool) {
+        Date date = new Date();
+        teacherSchool.setCreateTime(date);
+        teacherSchool.setUpdateTime(date);
+        teacherSchoolService.insert(teacherSchool);
+        return succeed();
+    }
+
+    @ApiOperation("修改")
+    @PostMapping(value = "/update")
+    public Object update(TeacherSchool teacherSchool) {
+        Date date = new Date();
+        teacherSchool.setUpdateTime(date);
+        teacherSchoolService.update(teacherSchool);
+        return succeed();
+    }
+
+    @ApiOperation("删除")
+    @PostMapping(value = "/delete")
+    public Object delete(Long id) {
+        teacherSchoolService.delete(id);
+        return succeed();
+    }
+
+}

+ 0 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/union/UnionPay.java

@@ -105,7 +105,6 @@ public class UnionPay {
 
         param = getOpenBodySig(wpAppId, wpAppKey, timestamp, nonce, json.toString(), "GET");
         PayMap.put("weChatPay", wpPayUrl + "?" + param);
-        PayMap.put("type","UNIONPAY");
         return PayMap;
     }
 

+ 0 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/yqpay/YqPayUtil.java

@@ -62,7 +62,6 @@ public class YqPayUtil {
         }
         Map<String, Object> payMap = getRequestMap(notifyUrl, contentMap);
         payMap.put("host", payUrl);
-        payMap.put("type","YQPAY");
         return payMap;
     }
 

+ 4 - 0
mec-util/src/main/java/com/ym/mec/util/collection/MapUtil.java

@@ -11,6 +11,7 @@ import java.lang.reflect.Method;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 public class MapUtil {
 
@@ -108,6 +109,9 @@ public class MapUtil {
 	public static <T,K> Map convertMybatisMap(List<Map<T,K>> maps){
 		Map result=new HashMap();
 		maps.forEach(stringIntegerMap -> {
+			if(Objects.isNull(stringIntegerMap)){
+				return;
+			}
 			result.put(stringIntegerMap.get("key"),stringIntegerMap.get("value"));
 		});
 		return result;

+ 3 - 3
mec-util/src/main/java/com/ym/mec/util/json/JsonUtil.java

@@ -169,10 +169,10 @@ public class JsonUtil {
 	}
 
 	public static String toJSONString(Object object, SerializeConfig config, ValueFilter filter, SerializerFeature... features) {
-		
+
 		SerializeWriter out = new SerializeWriter(SerializerFeature.DisableCircularReferenceDetect, SerializerFeature.WriteNullStringAsEmpty,
-				SerializerFeature.WriteMapNullValue, SerializerFeature.QuoteFieldNames);
-		
+				SerializerFeature.WriteMapNullValue, SerializerFeature.QuoteFieldNames, SerializerFeature.WriteNullNumberAsZero);
+
 		JSONSerializer serializer = new JSONSerializer(out, config);
 		for (SerializerFeature feature : features) {
 			serializer.config(feature, true);

+ 2 - 0
mec-web/src/main/java/com/ym/mec/web/WebApplication.java

@@ -9,6 +9,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.ComponentScan;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.web.client.RestTemplate;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
@@ -20,6 +21,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @ComponentScan(basePackages = "com.ym.mec")
 @Configuration
 @EnableSwagger2Doc
+@EnableAsync
 public class WebApplication {
 
 	public static void main(String[] args) {

+ 13 - 56
mec-web/src/main/java/com/ym/mec/web/config/WebMvcConfig.java

@@ -7,12 +7,16 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import com.fasterxml.jackson.core.JsonGenerator;
@@ -33,6 +37,7 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 import com.ym.mec.common.enums.BaseEnum;
 
 @Configuration
@@ -45,62 +50,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					throw new RuntimeException(e);
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }

+ 4 - 4
mec-web/src/main/java/com/ym/mec/web/controller/ClassGroupController.java

@@ -7,9 +7,7 @@ import com.ym.mec.biz.service.ClassGroupService;
 import com.ym.mec.biz.service.ClassGroupTeacherMapperService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.page.QueryInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.annotations.*;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -119,7 +117,9 @@ public class ClassGroupController extends BaseController {
 
     @ApiOperation(value = "获取乐团班级老师课酬")
     @GetMapping("/findMusicGroupClassTeacherSalary")
-    public Object findMusicGroupClassTeacherSalary(@ApiParam(value = "乐团编号", required = true) @RequestParam String musicGroupId) {
+    @ApiImplicitParams({@ApiImplicitParam(name = "musicGroupId", value = "乐团编号", required = true, dataType = "Integer"),
+            @ApiImplicitParam(name = "subjectId", value = "声部编号", required = true, dataType = "Integer")})
+    public Object findMusicGroupClassTeacherSalary(String musicGroupId) {
         return succeed(classGroupService.getClassGroupAndTeacherSalary(musicGroupId));
     }
 

+ 66 - 0
mec-web/src/main/java/com/ym/mec/web/controller/TeacherVipSchoolController.java

@@ -0,0 +1,66 @@
+package com.ym.mec.web.controller;
+
+import com.ym.mec.biz.dal.entity.TeacherSchool;
+import com.ym.mec.biz.service.TeacherSchoolService;
+import com.ym.mec.common.controller.BaseController;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * @Author Joburgess
+ * @Date 2019/10/14
+ */
+@Api(value = "教师vip课教学点服务")
+@RequestMapping("teacherVipSchool")
+@RestController
+public class TeacherVipSchoolController extends BaseController {
+
+    @Autowired
+    private TeacherSchoolService teacherSchoolService;
+
+    @ApiOperation("单查询")
+    @GetMapping(value = "/query")
+    public Object query(Long id) {
+        return succeed(teacherSchoolService.get(id));
+    }
+
+    @ApiOperation("根据教师编号获取教学点")
+    @GetMapping(value = "/queryAll")
+    public Object queryAll(Long teacherId) {
+        return succeed(teacherSchoolService.findByTeacherId(teacherId));
+    }
+
+    @ApiOperation("新增")
+    @PostMapping(value = "/add")
+    public Object add(TeacherSchool teacherSchool) {
+        Date date = new Date();
+        teacherSchool.setCreateTime(date);
+        teacherSchool.setUpdateTime(date);
+        teacherSchoolService.insert(teacherSchool);
+        return succeed();
+    }
+
+    @ApiOperation("修改")
+    @PostMapping(value = "/update")
+    public Object update(TeacherSchool teacherSchool) {
+        Date date = new Date();
+        teacherSchool.setUpdateTime(date);
+        teacherSchoolService.update(teacherSchool);
+        return succeed();
+    }
+
+    @ApiOperation("删除")
+    @PostMapping(value = "/delete")
+    public Object delete(Long id) {
+        teacherSchoolService.delete(id);
+        return succeed();
+    }
+
+}

+ 9 - 0
mec-web/src/main/java/com/ym/mec/web/controller/VipGroupManageController.java

@@ -1,5 +1,7 @@
 package com.ym.mec.web.controller;
 
+import com.ym.mec.auth.api.client.SysUserFeignService;
+import com.ym.mec.auth.api.entity.SysUser;
 import com.ym.mec.biz.dal.dto.ClassDateAdjustDto;
 import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
 import com.ym.mec.biz.dal.entity.StudentApplyRefunds;
@@ -33,10 +35,17 @@ public class VipGroupManageController extends BaseController {
     private VipGroupService vipGroupService;
     @Autowired
     private CourseScheduleService scheduleService;
+    @Autowired
+    private SysUserFeignService sysUserFeignService;
 
     @ApiOperation(value = "vip课申请")
     @PostMapping("/vipGroupApply")
     public Object vipGroupApply(@RequestBody VipGroupApplyDto vipGroupApplyDto){
+        SysUser sysUser = sysUserFeignService.queryUserById(vipGroupApplyDto.getVipGroupApplyBaseInfo().getUserId());
+        if(Objects.isNull(sysUser)){
+            return failed("请指定指导老师!");
+        }
+        vipGroupApplyDto.getVipGroupApplyBaseInfo().setOrganIdList(sysUser.getOrganId().toString());
         vipGroupService.createVipGroup(vipGroupApplyDto);
         return succeed();
     }

+ 1 - 1
mec-web/src/main/resources/application.yml

@@ -41,7 +41,7 @@ spring:
   redis:
     host: 47.99.212.176
     port: 6379
-    password: 
+    password:
     database: 0
     #连接超时时间(毫秒)
     timeout: 10000

+ 13 - 56
mec-workflow/src/main/java/com/ym/mec/workfow/config/WebMvcConfig.java

@@ -7,12 +7,16 @@ import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
 
+import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Primary;
 import org.springframework.format.FormatterRegistry;
+import org.springframework.http.MediaType;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
 import com.fasterxml.jackson.core.JsonGenerator;
@@ -33,6 +37,7 @@ import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
 import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
 import com.ym.mec.common.config.EnumConverterFactory;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 import com.ym.mec.common.enums.BaseEnum;
 
 @Configuration
@@ -45,62 +50,14 @@ public class WebMvcConfig implements WebMvcConfigurer {
 	public void addFormatters(FormatterRegistry registry) {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
-
-	@SuppressWarnings("rawtypes")
+	
 	@Bean
-	@Primary
-	public ObjectMapper ObjectMapper() {
-		ObjectMapper objectMapper = new ObjectMapper();
-		// 对于空的对象转json的时候不抛出错误
-		objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
-		// 禁用遇到未知属性抛出异常
-		objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
-		// 序列化BigDecimal时不使用科学计数法输出
-		objectMapper.configure(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN, true);
-		// 日期和时间格式化
-		JavaTimeModule javaTimeModule = new JavaTimeModule();
-		javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
-		javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
-		javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
-
-		// BaseEnum序列化
-		javaTimeModule.addSerializer(BaseEnum.class, new JsonSerializer<BaseEnum>() {
-
-			@Override
-			public void serialize(BaseEnum enumObj, JsonGenerator jsonGenerator, SerializerProvider serializers) throws IOException {
-				jsonGenerator.writeString(enumObj.getCode().toString());
-			}
-
-		});
-
-		// Date序列化和反序列化
-		javaTimeModule.addSerializer(Date.class, new JsonSerializer<Date>() {
-			@Override
-			public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
-				SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String formattedDate = formatter.format(date);
-				jsonGenerator.writeString(formattedDate);
-			}
-		});
-
-		javaTimeModule.addDeserializer(Date.class, new JsonDeserializer<Date>() {
-			@Override
-			public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
-				SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-				String date = jsonParser.getText();
-				try {
-					return format.parse(date);
-				} catch (ParseException e) {
-					return null;
-				}
-			}
-		});
-
-		objectMapper.registerModule(javaTimeModule);
-		return objectMapper;
-	}
+    public HttpMessageConverters fastJsonHttpMessageConverters(){
+		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();
+        List<MediaType> fastMediaTypes =  new ArrayList<MediaType>();
+        fastMediaTypes.add(MediaType.APPLICATION_JSON_UTF8);
+        converter.setSupportedMediaTypes(fastMediaTypes);
+        return new HttpMessageConverters(converter);
+    }
 
 }