소스 검색

Merge branch 'system_fee' of http://git.dayaedu.com/yonge/mec into goods_organ

zouxuan 4 년 전
부모
커밋
e9ec7ccbcf
35개의 변경된 파일531개의 추가작업 그리고 197개의 파일을 삭제
  1. 10 0
      mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUserDevice.java
  2. 5 0
      mec-auth/mec-auth-server/pom.xml
  3. 1 1
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/AuthServerApplication.java
  4. 7 1
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/AuthorizationServerConfig.java
  5. 16 4
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/WebMvcConfig.java
  6. 37 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/interceptor/OperationLogInterceptor.java
  7. 42 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserDeviceController.java
  8. 38 0
      mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/queryInfo/SysUserDeviceQueryInfo.java
  9. 33 2
      mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml
  10. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherDao.java
  11. 1 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherOrderDao.java
  12. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java
  13. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupActivityDao.java
  14. 9 1
      mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java
  15. 3 0
      mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java
  16. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupActivityService.java
  17. 39 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CloudTeacherOrderServiceImpl.java
  18. 2 1
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java
  19. 115 108
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java
  20. 4 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java
  21. 2 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java
  22. 16 23
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java
  23. 35 19
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
  24. 9 3
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java
  25. 23 5
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java
  26. 5 0
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java
  27. 12 4
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupActivityServiceImpl.java
  28. 2 4
      mec-biz/src/main/resources/config/mybatis/CloudTeacherOrderMapper.xml
  29. 4 0
      mec-biz/src/main/resources/config/mybatis/StudentMapper.xml
  30. 3 1
      mec-biz/src/main/resources/config/mybatis/VipGroupActivityMapper.xml
  31. 4 2
      mec-biz/src/main/resources/config/mybatis/VipGroupMapper.xml
  32. 11 6
      mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupActivityController.java
  33. 10 3
      mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuitController.java
  34. 22 4
      mec-web/src/main/java/com/ym/mec/web/controller/VipGroupActivityController.java
  35. 1 1
      mec-web/src/main/java/com/ym/mec/web/controller/education/EduVipGroupActivityController.java

+ 10 - 0
mec-auth/mec-auth-api/src/main/java/com/ym/mec/auth/api/entity/SysUserDevice.java

@@ -22,6 +22,8 @@ public class SysUserDevice {
 	/** 设备类型 */
 	private String deviceType;
 	
+	private SysUser user;
+	
 	public void setId(Integer id){
 		this.id = id;
 	}
@@ -62,6 +64,14 @@ public class SysUserDevice {
 		return this.deviceType;
 	}
 			
+	public SysUser getUser() {
+		return user;
+	}
+
+	public void setUser(SysUser user) {
+		this.user = user;
+	}
+
 	@Override
 	public String toString() {
 		return ToStringBuilder.reflectionToString(this);

+ 5 - 0
mec-auth/mec-auth-server/pom.xml

@@ -74,6 +74,11 @@
 			<groupId>com.ym</groupId>
 			<artifactId>mec-client-api</artifactId>
 		</dependency>
+		
+		<dependency>
+			<groupId>com.yonge.log</groupId>
+			<artifactId>audit-log</artifactId>
+		</dependency>
 
 		<dependency>
 			<groupId>org.apache.commons</groupId>

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

@@ -18,7 +18,7 @@ import com.spring4all.swagger.EnableSwagger2Doc;
 @EnableDiscoveryClient
 @EnableFeignClients({"com.ym.mec"})
 @MapperScan("com.ym.mec.auth.dal.dao")
-@ComponentScan(basePackages="com.ym.mec")
+@ComponentScan(basePackages={"com.ym.mec", "com.yonge.log"})
 @Configuration
 @EnableSwagger2Doc
 @EnableAsync

+ 7 - 1
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/AuthorizationServerConfig.java

@@ -53,6 +53,11 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
 	@Override
 	public void configure(ClientDetailsServiceConfigurer clients) throws Exception {
 
+		clients.withClientDetails(jdbcClientDetailsService());
+	}
+
+	@Bean
+	public JdbcClientDetailsService jdbcClientDetailsService() {
 		JdbcClientDetailsService clientDetailsService = new JdbcClientDetailsService(dataSource);
 
 		clientDetailsService
@@ -60,7 +65,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
 		clientDetailsService
 				.setFindClientDetailsSql("select id_, CONCAT('{noop}',client_secret_) as client_secret, resource_ids_, scope_, authorized_grant_types_, web_server_redirect_uri_, authorities_, access_token_validity_, refresh_token_validity_, additional_information_, autoapprove_ from sys_oauth_client_details order by id_");
 
-		clients.withClientDetails(clientDetailsService);
+		return clientDetailsService;
 	}
 
 	@Bean
@@ -77,6 +82,7 @@ public class AuthorizationServerConfig extends AuthorizationServerConfigurerAdap
 		CustomTokenServices tokenServices = new CustomTokenServices();
 		tokenServices.setTokenStore(redisTokenStore());
 		tokenServices.setSupportRefreshToken(true);
+		tokenServices.setClientDetailsService(jdbcClientDetailsService());
 		//tokenServices.setAccessTokenValiditySeconds(60 * 60 * 24); // token有效期自定义设置,默认12小时
 		//tokenServices.setRefreshTokenValiditySeconds(60 * 60 * 24 * 30);// 默认30天,这里修改
 		return tokenServices;

+ 16 - 4
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/config/WebMvcConfig.java

@@ -1,19 +1,26 @@
 package com.ym.mec.auth.config;
 
-import com.ym.mec.common.config.EnumConverterFactory;
-import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.format.FormatterRegistry;
 import org.springframework.http.MediaType;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
 import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 
-import java.util.ArrayList;
-import java.util.List;
+import com.ym.mec.auth.interceptor.OperationLogInterceptor;
+import com.ym.mec.common.config.EnumConverterFactory;
+import com.ym.mec.common.config.LocalFastJsonHttpMessageConverter;
 
 @Configuration
 public class WebMvcConfig implements WebMvcConfigurer {
+	
+	@Autowired
+	private OperationLogInterceptor operationLogInterceptor;
 
 	/**
 	 * 枚举类的转换器 addConverterFactory
@@ -23,6 +30,11 @@ public class WebMvcConfig implements WebMvcConfigurer {
 		registry.addConverterFactory(new EnumConverterFactory());
 	}
 	
+	@Override
+	public void addInterceptors(InterceptorRegistry registry) {
+		registry.addInterceptor(operationLogInterceptor).addPathPatterns("/userDevice/unbind").excludePathPatterns("/*");
+	}
+	
 	@Bean
     public HttpMessageConverters fastJsonHttpMessageConverters(){
 		LocalFastJsonHttpMessageConverter converter = new LocalFastJsonHttpMessageConverter();

+ 37 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/interceptor/OperationLogInterceptor.java

@@ -0,0 +1,37 @@
+package com.ym.mec.auth.interceptor;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.ym.mec.auth.api.entity.SysUser;
+import com.ym.mec.auth.service.SysUserService;
+import com.ym.mec.common.security.AuthUser;
+import com.ym.mec.common.security.SecurityUtils;
+import com.yonge.log.interceptor.AuditLogInterceptor;
+
+@Component
+public class OperationLogInterceptor extends AuditLogInterceptor {
+
+	@Autowired
+	private SysUserService sysUserService;
+
+	@Override
+	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws ServletException, IOException {
+		AuthUser authUser = SecurityUtils.getUser();
+		if (authUser != null) {
+			SysUser sysUser = sysUserService.get(authUser.getUserId());
+
+			if (sysUser != null) {
+				setUsername(sysUser.getRealName(), sysUser.getId());
+			}
+		}
+		return true;
+	}
+
+}

+ 42 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserDeviceController.java

@@ -0,0 +1,42 @@
+package com.ym.mec.auth.web.controller;
+
+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 com.ym.mec.auth.service.SysUserDeviceService;
+import com.ym.mec.auth.service.SysUserService;
+import com.ym.mec.auth.web.controller.queryInfo.SysUserDeviceQueryInfo;
+import com.ym.mec.common.controller.BaseController;
+import com.yonge.log.model.AuditLogAnnotation;
+
+@RestController()
+@RequestMapping("userDevice")
+@Api(tags = "会员设备服务")
+public class UserDeviceController extends BaseController {
+
+	@Autowired
+	private SysUserService sysUserService;
+	
+	@Autowired
+	private SysUserDeviceService sysUserDeviceService;
+
+	@ApiOperation(value = "分页查询用户信息")
+	@GetMapping(value = "/queryPage")
+	public Object queryPage(SysUserDeviceQueryInfo queryInfo) {
+		return succeed(sysUserDeviceService.queryPage(queryInfo));
+	}
+
+	@ApiOperation(value = "设备号解除绑定")
+	@PostMapping(value = "/unbind")
+	@AuditLogAnnotation(operateName = "设备号解除绑定",interfaceURL = "userDevice/unbind")
+	public Object unbind(Integer id) {
+		return succeed(sysUserDeviceService.delete(id));
+	}
+
+}

+ 38 - 0
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/queryInfo/SysUserDeviceQueryInfo.java

@@ -0,0 +1,38 @@
+package com.ym.mec.auth.web.controller.queryInfo;
+
+import java.util.Date;
+
+import com.ym.mec.common.page.QueryInfo;
+
+public class SysUserDeviceQueryInfo extends QueryInfo {
+
+	private String deviceNum;
+
+	private Date bindStartTime;
+
+	private Date bindEndTime;
+
+	public String getDeviceNum() {
+		return deviceNum;
+	}
+
+	public void setDeviceNum(String deviceNum) {
+		this.deviceNum = deviceNum;
+	}
+
+	public Date getBindStartTime() {
+		return bindStartTime;
+	}
+
+	public void setBindStartTime(Date bindStartTime) {
+		this.bindStartTime = bindStartTime;
+	}
+
+	public Date getBindEndTime() {
+		return bindEndTime;
+	}
+
+	public void setBindEndTime(Date bindEndTime) {
+		this.bindEndTime = bindEndTime;
+	}
+}

+ 33 - 2
mec-auth/mec-auth-server/src/main/resources/config/mybatis/SysUserDeviceMapper.xml

@@ -9,6 +9,8 @@
 		<result column="device_num_" property="deviceNum" />
 		<result column="bind_time_" property="bindTime" />
 		<result column="device_type_" property="deviceType" />
+		<result column="phone_" property="user.phone" />
+		<result column="real_name_" property="user.realName" />
 	</resultMap>
 
 	<!-- 根据主键查询一条记录 -->
@@ -63,13 +65,42 @@
 
 	<!-- 分页查询 -->
 	<select id="queryPage" resultMap="SysUserDevice" parameterType="map">
-		SELECT * FROM sys_user_device ORDER BY id_
+		SELECT ud.*,u.phone_,u.real_name_ FROM sys_user_device ud left join sys_user u on ud.user_id_ = u.id_ 
+		<where>
+			<if test="search != null and search != ''">
+				and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
+			</if>
+			<if test="deviceNum != null">
+				and device_num_ = #{deviceNum}
+			</if>
+			<if test="bindStartTime != null">
+				and date(bind_time_) &gt;= #{bindStartTime}
+			</if>
+			<if test="bindEndTime != null">
+				and date(bind_time_) &lt;= #{bindEndTime}
+			</if>
+		</where>
+		ORDER BY id_
 		<include refid="global.limit" />
 	</select>
 
 	<!-- 查询当前表的总记录数 -->
 	<select id="queryCount" resultType="int">
-		SELECT COUNT(*) FROM sys_user_device
+		SELECT COUNT(ud.user_id_) FROM sys_user_device ud left join sys_user u on ud.user_id_ = u.id_
+		<where>
+			<if test="search != null and search != ''">
+				and (u.real_name_ LIKE CONCAT('%',#{search},'%') OR u.phone_ LIKE CONCAT('%',#{search},'%') OR u.id_ like CONCAT('%',#{search},'%'))
+			</if>
+			<if test="deviceNum != null">
+				and device_num_ = #{deviceNum}
+			</if>
+			<if test="bindStartTime != null">
+				and date(bind_time_) &gt;= #{bindStartTime}
+			</if>
+			<if test="bindEndTime != null">
+				and date(bind_time_) &lt;= #{bindEndTime}
+			</if>
+		</where>
 	</select>
 	
 	<select id="queryByUserId" resultMap="SysUserDevice">

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/CloudTeacherDao.java

@@ -1,9 +1,12 @@
 package com.ym.mec.biz.dal.dao;
 
 import com.ym.mec.biz.dal.entity.CloudTeacher;
+import com.ym.mec.biz.dal.entity.CloudTeacherOrder;
 import com.ym.mec.common.dal.BaseDAO;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 
 public interface CloudTeacherDao extends BaseDAO<Long, CloudTeacher> {
 
@@ -14,4 +17,5 @@ public interface CloudTeacherDao extends BaseDAO<Long, CloudTeacher> {
      * @return
      */
     CloudTeacher getByStudentId(@Param("studentId") Integer studentId);
+
 }

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

@@ -39,7 +39,7 @@ public interface CloudTeacherOrderDao extends BaseDAO<Long, CloudTeacherOrder> {
      * @param musicGroupId
      * @return
      */
-    CloudTeacherOrder getStudentCloudTeacherOrder(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
+    List<CloudTeacherOrder> getStudentCloudTeacherOrder(@Param("studentId") Integer studentId, @Param("musicGroupId") String musicGroupId);
     
     /**
      * 根据订单编号查询订单详情

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentDao.java

@@ -242,4 +242,6 @@ public interface StudentDao extends com.ym.mec.common.dal.BaseDAO<Integer, Stude
      * 清空学员会员
      */
     void cleanStudentMember();
+
+    void cleanMember(Integer userId);
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/VipGroupActivityDao.java

@@ -17,7 +17,8 @@ public interface VipGroupActivityDao extends BaseDAO<Integer, VipGroupActivity>
 	 */
 	List<VipGroupActivity> findByCategory(@Param("categoryId") Long categoryId,
 										  @Param("organIds") String organIds,
-										  @Param("applyToStudentType") Integer applyToStudentType);
+										  @Param("applyToStudentType") Integer applyToStudentType,
+										  @Param("includeClosed") Boolean includeClosed);
 
 	/**
 	 * 根据活动方案编号列表获取名称

+ 9 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/CloudTeacherOrderService.java

@@ -53,7 +53,15 @@ public interface CloudTeacherOrderService extends BaseService<Long, CloudTeacher
      * @param musicGroupId
      * @return
      */
-    CloudTeacherOrder getStudentCloudTeacherOrder(Integer studentId, String musicGroupId);
+    List<CloudTeacherOrder> getStudentCloudTeacherOrder(Integer studentId, String musicGroupId);
+
+    /**
+     * 退云教练
+     * @param cloudTeacherOrders
+     * @param refundAmount
+     * @return
+     */
+    Boolean quitCloudTeacherOrders(List<CloudTeacherOrder> cloudTeacherOrders, BigDecimal refundAmount);
 
     /**
      * 退云教练

+ 3 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentService.java

@@ -88,4 +88,7 @@ public interface StudentService extends BaseService<Integer, Student> {
     List<String> getStudentNames(List<Integer> studentIdList);
 
     Student getLocked(Integer userId);
+
+    void cleanMember(Integer userId);
+
 }

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/VipGroupActivityService.java

@@ -29,7 +29,8 @@ public interface VipGroupActivityService extends BaseService<Integer, VipGroupAc
      * @Date: 2019/10/2
      * 根据课程类型获取VIP课相关活动方案
      */
-    List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId, Integer applyToStudentType);
+    List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId,
+                                                  Integer applyToStudentType, Boolean includeClosed);
 
     /**
      * 导出vip活动

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

@@ -158,12 +158,50 @@ public class CloudTeacherOrderServiceImpl extends BaseServiceImpl<Long, CloudTea
     }
 
     @Override
-    public CloudTeacherOrder getStudentCloudTeacherOrder(Integer studentId, String musicGroupId) {
+    public List<CloudTeacherOrder> getStudentCloudTeacherOrder(Integer studentId, String musicGroupId) {
         return cloudTeacherOrderDao.getStudentCloudTeacherOrder(studentId, musicGroupId);
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
+    public Boolean quitCloudTeacherOrders(List<CloudTeacherOrder> cloudTeacherOrders, BigDecimal refundAmount) {
+        Date nowDate = new Date();
+        for (int i = 0; i < cloudTeacherOrders.size(); i++) {
+            CloudTeacherOrder cloudTeacherOrder = cloudTeacherOrders.get(i);
+            if (cloudTeacherOrder.getStatus().equals(3)) {
+                throw new BizException("云教练已退,请勿重复退");
+            }
+            if (cloudTeacherOrder.getStatus().equals(2) && cloudTeacherOrder.getEndTime().compareTo(nowDate) <= 0) {
+                throw new BizException("云教练已过服务期,不可退费");
+            }
+            Integer oldStatus = cloudTeacherOrder.getStatus();
+            cloudTeacherOrder.setStatus(3);
+            if(i == 0){
+                cloudTeacherOrder.setRefundAmount(refundAmount);
+            }else {
+                cloudTeacherOrder.setRefundAmount(BigDecimal.ZERO);
+            }
+            cloudTeacherOrder.setUpdateTime(nowDate);
+            if (cloudTeacherOrderDao.update(cloudTeacherOrder) <= 0) {
+                throw new BizException("云教练退费处理失败,请重试");
+            }
+
+            if (oldStatus.equals(1)) {
+                return true;
+            }
+            int days = DateUtil.daysBetween(DateUtil.trunc(nowDate), cloudTeacherOrder.getEndTime());
+            CloudTeacher cloudTeacher = cloudTeacherDao.getByStudentId(cloudTeacherOrder.getStudentId());
+            Date endDate = DateUtil.addDays(cloudTeacherOrder.getEndTime(), -days);
+            cloudTeacher.setEndTime(endDate);
+            cloudTeacher.setUpdateTime(nowDate);
+            if (cloudTeacherDao.update(cloudTeacher) <= 0) {
+                throw new BizException("云教练服务有效期更新失败,请重试");
+            }
+        }
+        return true;
+    }
+    @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean quitCloudTeacherOrder(CloudTeacherOrder cloudOrder, BigDecimal refundAmount) {
         Date nowDate = new Date();
         if (cloudOrder.getStatus().equals(3)) {

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

@@ -26,6 +26,7 @@ import org.springframework.context.annotation.Lazy;
 import org.springframework.http.HttpStatus;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Isolation;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
@@ -973,7 +974,7 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 	}
 
 	@Override
-	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
+	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRES_NEW)
 	public boolean transferProduceContract(Integer userId,String musicGroupId) {
 		SysUser user = studentDao.lockUserReturnInfo(userId);
 

+ 115 - 108
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CourseScheduleStudentPaymentServiceImpl.java

@@ -420,134 +420,141 @@ public class CourseScheduleStudentPaymentServiceImpl extends BaseServiceImpl<Lon
 	@Override
 	@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
 	public void createForMusicGroup(String musicGroupId, List<CourseSchedule> courseSchedules, List<Integer> studentIds) {
-		Map<CourseSchedule.CourseScheduleType, Map<Integer, Integer>> courseTypeCourseDurationMap = new HashMap<>();
-		Map<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCourseMap = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getType));
-
-		List<CourseScheduleStudentPayment> css = courseScheduleStudentPaymentDao.getWithGroup(musicGroupId, GroupType.MUSIC, studentIds);
-		Map<Integer, Set<Long>> studentCourseIdsMap = new HashMap<>();
-		if(!CollectionUtils.isEmpty(css)){
-			studentCourseIdsMap = css.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getUserId, Collectors.mapping(CourseScheduleStudentPayment::getCourseScheduleId, Collectors.toSet())));
-		}
-
-		for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCoursesEntry : typeCourseMap.entrySet()) {
-			Map<Integer, Integer> sdMap = new HashMap<>();
-			for (Integer studentId : studentIds) {
-				int totalCourseDuration = 0;
-				for (CourseSchedule courseSchedule : typeCoursesEntry.getValue()) {
-					if(courseSchedule.getMemberFlag() == 1){
-						continue;
+		Map<Integer, List<CourseSchedule>> memberCourseMap = courseSchedules.stream().collect(Collectors.groupingBy(CourseSchedule::getMemberFlag));
+		for (Integer memberFlag : memberCourseMap.keySet()) {
+			List<CourseSchedule> courseScheduleList = memberCourseMap.get(memberFlag);
+			if(courseScheduleList != null && courseScheduleList.size() > 0){
+				if(memberFlag == 1){
+					createForMemberMusicGroup(musicGroupId,courseScheduleList,studentIds);
+				}else {
+					Map<CourseSchedule.CourseScheduleType, Map<Integer, Integer>> courseTypeCourseDurationMap = new HashMap<>();
+					Map<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCourseMap = courseScheduleList.stream().collect(Collectors.groupingBy(CourseSchedule::getType));
+
+					List<CourseScheduleStudentPayment> css = courseScheduleStudentPaymentDao.getWithGroup(musicGroupId, GroupType.MUSIC, studentIds);
+					Map<Integer, Set<Long>> studentCourseIdsMap = new HashMap<>();
+					if(!CollectionUtils.isEmpty(css)){
+						studentCourseIdsMap = css.stream().collect(Collectors.groupingBy(CourseScheduleStudentPayment::getUserId, Collectors.mapping(CourseScheduleStudentPayment::getCourseScheduleId, Collectors.toSet())));
 					}
-					//课程时长
-					int courseDuration = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
-					totalCourseDuration += courseDuration;
-				}
-				sdMap.put(studentId, totalCourseDuration);
-			}
-			courseTypeCourseDurationMap.put(typeCoursesEntry.getKey(), sdMap);
-		}
 
-		List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
-
-		List<String> allBatchNos = new ArrayList<>();
-
-		for (Integer studentId : studentIds) {
-			Set<Long> existCourseIds = new HashSet<>();
-			if(studentCourseIdsMap.containsKey(studentId)){
-				existCourseIds = studentCourseIdsMap.get(studentId);
-			}
-			for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> courseScheduleTypeListEntry : typeCourseMap.entrySet()) {
-				//当前课程类型总课程时长
-				Integer typeCourseDuration = courseTypeCourseDurationMap.get(courseScheduleTypeListEntry.getKey()).get(studentId);
+					for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> typeCoursesEntry : typeCourseMap.entrySet()) {
+						Map<Integer, Integer> sdMap = new HashMap<>();
+						for (Integer studentId : studentIds) {
+							int totalCourseDuration = 0;
+							for (CourseSchedule courseSchedule : typeCoursesEntry.getValue()) {
+								if(courseSchedule.getMemberFlag() == 1){
+									continue;
+								}
+								//课程时长
+								int courseDuration = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
+								totalCourseDuration += courseDuration;
+							}
+							sdMap.put(studentId, totalCourseDuration);
+						}
+						courseTypeCourseDurationMap.put(typeCoursesEntry.getKey(), sdMap);
+					}
 
-				String batchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, studentId, courseScheduleTypeListEntry.getKey(),null);
+					List<CourseScheduleStudentPayment> courseScheduleStudentPayments = new ArrayList<>();
 
-				List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = musicGroupPaymentStudentCourseDetailDao.getUnUseWithStudentAndCourseTypeAndCourseMinutes(batchNo, studentId, courseScheduleTypeListEntry.getKey());
-				int totalCourseMinutes = musicGroupPaymentStudentCourseDetails.stream().mapToInt(MusicGroupPaymentStudentCourseDetail::getTotalCourseMinutes).reduce(0, Integer::sum);
-				if(CollectionUtils.isEmpty(musicGroupPaymentStudentCourseDetails) || totalCourseMinutes < typeCourseDuration){
-					SysUser user = teacherDao.getUser(studentId);
-					throw new BizException("{}在{}课程类型上的课程时长不足", user.getUsername(), courseScheduleTypeListEntry.getKey().getMsg());
-				}
+					List<String> allBatchNos = new ArrayList<>();
 
-				Set<Long> calenderIds = musicGroupPaymentStudentCourseDetails.stream().map(MusicGroupPaymentStudentCourseDetail::getMusicGroupPaymentCalenderId).collect(Collectors.toSet());
+					for (Integer studentId : studentIds) {
+						Set<Long> existCourseIds = new HashSet<>();
+						if(studentCourseIdsMap.containsKey(studentId)){
+							existCourseIds = studentCourseIdsMap.get(studentId);
+						}
+						for (Map.Entry<CourseSchedule.CourseScheduleType, List<CourseSchedule>> courseScheduleTypeListEntry : typeCourseMap.entrySet()) {
+							//当前课程类型总课程时长
+							Integer typeCourseDuration = courseTypeCourseDurationMap.get(courseScheduleTypeListEntry.getKey()).get(studentId);
 
-				List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.queryByIds(calenderIds);
-				if(CollectionUtils.isEmpty(musicGroupPaymentCalenders)||musicGroupPaymentCalenders.size()!=calenderIds.size()){
-					throw new BizException("缴费设置异常");
-				}
+							String batchNo = musicGroupPaymentStudentCourseDetailDao.getUnUseBatchNoWithStudentAndCourseTypeAndCourseMinutes(musicGroupId, studentId, courseScheduleTypeListEntry.getKey(),null);
 
-				List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalendersAndCourseType(calenderIds, courseScheduleTypeListEntry.getKey());
-				int originalCourseTotalMinutes = musicGroupPaymentCalenderCourseSettings.stream().mapToInt(MusicGroupPaymentCalenderCourseSettings::getCourseTotalMinuties).reduce(0, Integer::sum);
-				if(Objects.isNull(musicGroupPaymentCalenderCourseSettings)||originalCourseTotalMinutes!=totalCourseMinutes){
-					throw new BizException("缴费设置异常");
-				}
+							List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetails = musicGroupPaymentStudentCourseDetailDao.getUnUseWithStudentAndCourseTypeAndCourseMinutes(batchNo, studentId, courseScheduleTypeListEntry.getKey());
+							int totalCourseMinutes = musicGroupPaymentStudentCourseDetails.stream().mapToInt(MusicGroupPaymentStudentCourseDetail::getTotalCourseMinutes).reduce(0, Integer::sum);
+							if(CollectionUtils.isEmpty(musicGroupPaymentStudentCourseDetails) || totalCourseMinutes < typeCourseDuration){
+								SysUser user = teacherDao.getUser(studentId);
+								throw new BizException("{}在{}课程类型上的课程时长不足", user.getUsername(), courseScheduleTypeListEntry.getKey().getMsg());
+							}
 
-				allBatchNos.add(batchNo);
+							Set<Long> calenderIds = musicGroupPaymentStudentCourseDetails.stream().map(MusicGroupPaymentStudentCourseDetail::getMusicGroupPaymentCalenderId).collect(Collectors.toSet());
 
-				BigDecimal totalCourseOriginalPrice = musicGroupPaymentCalenderCourseSettings.stream().map(MusicGroupPaymentCalenderCourseSettings::getCourseOriginalPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
-				BigDecimal totalCourseCurrentPrice = musicGroupPaymentCalenderCourseSettings.stream().map(MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+							List<MusicGroupPaymentCalender> musicGroupPaymentCalenders = musicGroupPaymentCalenderDao.queryByIds(calenderIds);
+							if(CollectionUtils.isEmpty(musicGroupPaymentCalenders)||musicGroupPaymentCalenders.size()!=calenderIds.size()){
+								throw new BizException("缴费设置异常");
+							}
 
-				//课程每分钟原价
-				BigDecimal unitMinuteOriginalPrice = totalCourseOriginalPrice.divide(new BigDecimal(originalCourseTotalMinutes), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
-				//课程每分钟现价
-				BigDecimal unitMinuteCurrentPrice = totalCourseCurrentPrice.divide(new BigDecimal(originalCourseTotalMinutes), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
+							List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettings = musicGroupPaymentCalenderCourseSettingsDao.getWithPaymentCalendersAndCourseType(calenderIds, courseScheduleTypeListEntry.getKey());
+							int originalCourseTotalMinutes = musicGroupPaymentCalenderCourseSettings.stream().mapToInt(MusicGroupPaymentCalenderCourseSettings::getCourseTotalMinuties).reduce(0, Integer::sum);
+							if(Objects.isNull(musicGroupPaymentCalenderCourseSettings)||originalCourseTotalMinutes!=totalCourseMinutes){
+								throw new BizException("缴费设置异常");
+							}
 
-				if(MusicGroupPaymentCalender.PayUserType.SCHOOL.equals(musicGroupPaymentCalenders.get(0).getPayUserType())){
-					unitMinuteCurrentPrice = new BigDecimal("0");
-				}
+							allBatchNos.add(batchNo);
 
-				List<CourseScheduleStudentPayment> typeCourseStudentPayments = new ArrayList<>();
-				courseScheduleTypeListEntry.getValue().sort(Comparator.comparing(CourseSchedule::getStartClassTime));
-				BigDecimal typeCourseTotalOriginalPrice = new BigDecimal("0"), typeCourseTotalCurrentPrice = new BigDecimal("0");
-				for (CourseSchedule courseSchedule : courseScheduleTypeListEntry.getValue()) {
-					if(existCourseIds.contains(courseSchedule.getId())){
-						throw new BizException("该学员已在此班级{}课程中", courseSchedule.getId());
-					}
-					//课程时长
-					int courseDuration = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
+							BigDecimal totalCourseOriginalPrice = musicGroupPaymentCalenderCourseSettings.stream().map(MusicGroupPaymentCalenderCourseSettings::getCourseOriginalPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+							BigDecimal totalCourseCurrentPrice = musicGroupPaymentCalenderCourseSettings.stream().map(MusicGroupPaymentCalenderCourseSettings::getCourseCurrentPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
 
-					//课程原价
-					BigDecimal courseOriginalPrice = unitMinuteOriginalPrice.multiply(new BigDecimal(courseDuration)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
-					typeCourseTotalOriginalPrice = typeCourseTotalOriginalPrice.add(courseOriginalPrice);
+							//课程每分钟原价
+							BigDecimal unitMinuteOriginalPrice = totalCourseOriginalPrice.divide(new BigDecimal(originalCourseTotalMinutes), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
+							//课程每分钟现价
+							BigDecimal unitMinuteCurrentPrice = totalCourseCurrentPrice.divide(new BigDecimal(originalCourseTotalMinutes), CommonConstants.DECIMAL_PLACE, BigDecimal.ROUND_DOWN);
 
-					//课程现价
-					BigDecimal courseCurrentPrice = unitMinuteCurrentPrice.multiply(new BigDecimal(courseDuration)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
-					typeCourseTotalCurrentPrice = typeCourseTotalCurrentPrice.add(courseCurrentPrice);
+							if(MusicGroupPaymentCalender.PayUserType.SCHOOL.equals(musicGroupPaymentCalenders.get(0).getPayUserType())){
+								unitMinuteCurrentPrice = new BigDecimal("0");
+							}
 
-					CourseScheduleStudentPayment cssp = new CourseScheduleStudentPayment();
-					cssp.setGroupType(courseSchedule.getGroupType());
-					cssp.setMusicGroupId(courseSchedule.getMusicGroupId());
-					cssp.setCourseScheduleId(courseSchedule.getId());
-					cssp.setClassGroupId(courseSchedule.getClassGroupId());
-					cssp.setBatchNo(batchNo);
-					cssp.setUserId(studentId);
-					cssp.setOriginalPrice(courseOriginalPrice);
-					cssp.setExpectPrice(courseCurrentPrice);
-					cssp.setActualPrice(BigDecimal.ZERO);
-					cssp.setBeMerged(false);
-					typeCourseStudentPayments.add(cssp);
-				}
+							List<CourseScheduleStudentPayment> typeCourseStudentPayments = new ArrayList<>();
+							courseScheduleTypeListEntry.getValue().sort(Comparator.comparing(CourseSchedule::getStartClassTime));
+							BigDecimal typeCourseTotalOriginalPrice = new BigDecimal("0"), typeCourseTotalCurrentPrice = new BigDecimal("0");
+							for (CourseSchedule courseSchedule : courseScheduleTypeListEntry.getValue()) {
+								if(existCourseIds.contains(courseSchedule.getId())){
+									throw new BizException("该学员已在此班级{}课程中", courseSchedule.getId());
+								}
+								//课程时长
+								int courseDuration = DateUtil.minutesBetween(courseSchedule.getStartClassTime(), courseSchedule.getEndClassTime());
+
+								//课程原价
+								BigDecimal courseOriginalPrice = unitMinuteOriginalPrice.multiply(new BigDecimal(courseDuration)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+								typeCourseTotalOriginalPrice = typeCourseTotalOriginalPrice.add(courseOriginalPrice);
+
+								//课程现价
+								BigDecimal courseCurrentPrice = unitMinuteCurrentPrice.multiply(new BigDecimal(courseDuration)).setScale(CommonConstants.DECIMAL_FINAL_PLACE, BigDecimal.ROUND_DOWN);
+								typeCourseTotalCurrentPrice = typeCourseTotalCurrentPrice.add(courseCurrentPrice);
+
+								CourseScheduleStudentPayment cssp = new CourseScheduleStudentPayment();
+								cssp.setGroupType(courseSchedule.getGroupType());
+								cssp.setMusicGroupId(courseSchedule.getMusicGroupId());
+								cssp.setCourseScheduleId(courseSchedule.getId());
+								cssp.setClassGroupId(courseSchedule.getClassGroupId());
+								cssp.setBatchNo(batchNo);
+								cssp.setUserId(studentId);
+								cssp.setOriginalPrice(courseOriginalPrice);
+								cssp.setExpectPrice(courseCurrentPrice);
+								cssp.setActualPrice(BigDecimal.ZERO);
+								cssp.setBeMerged(false);
+								typeCourseStudentPayments.add(cssp);
+							}
 
-				typeCourseStudentPayments.get(0).setOriginalPrice(typeCourseStudentPayments.get(0).getOriginalPrice().add(totalCourseOriginalPrice.subtract(typeCourseTotalOriginalPrice)));
-				if(MusicGroupPaymentCalender.PayUserType.STUDENT.equals(musicGroupPaymentCalenders.get(0).getPayUserType())) {
-					typeCourseStudentPayments.get(0).setExpectPrice(typeCourseStudentPayments.get(0).getExpectPrice().add(totalCourseCurrentPrice.subtract(typeCourseTotalCurrentPrice)));
-				}
-				courseScheduleStudentPayments.addAll(typeCourseStudentPayments);
-				for (MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail : musicGroupPaymentStudentCourseDetails) {
-					if(typeCourseDuration>musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes()){
-						musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes());
-						typeCourseDuration = typeCourseDuration-musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes();
-					}else{
-						musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(typeCourseDuration);
-						typeCourseDuration = 0;
+							typeCourseStudentPayments.get(0).setOriginalPrice(typeCourseStudentPayments.get(0).getOriginalPrice().add(totalCourseOriginalPrice.subtract(typeCourseTotalOriginalPrice)));
+							if(MusicGroupPaymentCalender.PayUserType.STUDENT.equals(musicGroupPaymentCalenders.get(0).getPayUserType())) {
+								typeCourseStudentPayments.get(0).setExpectPrice(typeCourseStudentPayments.get(0).getExpectPrice().add(totalCourseCurrentPrice.subtract(typeCourseTotalCurrentPrice)));
+							}
+							courseScheduleStudentPayments.addAll(typeCourseStudentPayments);
+							for (MusicGroupPaymentStudentCourseDetail musicGroupPaymentStudentCourseDetail : musicGroupPaymentStudentCourseDetails) {
+								if(typeCourseDuration>musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes()){
+									musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes());
+									typeCourseDuration = typeCourseDuration-musicGroupPaymentStudentCourseDetail.getTotalCourseMinutes();
+								}else{
+									musicGroupPaymentStudentCourseDetail.setUsedCourseMinutes(typeCourseDuration);
+									typeCourseDuration = 0;
+								}
+							}
+							musicGroupPaymentStudentCourseDetailDao.batchUpdate(musicGroupPaymentStudentCourseDetails);
+						}
 					}
+					courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
 				}
-				musicGroupPaymentStudentCourseDetailDao.batchUpdate(musicGroupPaymentStudentCourseDetails);
 			}
 		}
-		courseScheduleStudentPaymentDao.batchInsert(courseScheduleStudentPayments);
-//		for (String batchNo : allBatchNos) {
-//			updateForMusicGroupWithPaymentCalender(batchNo);
-//		}
 	}
 
 	@Override

+ 4 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -221,6 +221,8 @@ public class ExportServiceImpl implements ExportService {
                     } else if (row.getChargeType() != null && (SporadicChargeTypeEnum.RECHARGE.getCode().equals(row.getChargeType()) ||
                             SporadicChargeTypeEnum.HIGH_ONLINE_ACTIVITY.getCode().equals(row.getChargeType()))) {
                         row.setRechargeFee(row.getActualAmount());
+                    } else if (row.getChargeType() != null && SporadicChargeTypeEnum.CLOUD_TEACHER_BUY.getCode().equals(row.getChargeType())) {
+                        row.setCloudTeacherFee(row.getActualAmount());
                     } else {
                         row.setOtherFee(row.getActualAmount());
                     }
@@ -512,6 +514,8 @@ public class ExportServiceImpl implements ExportService {
                     } else if (row.getChargeType() != null && (SporadicChargeTypeEnum.RECHARGE.getCode().equals(row.getChargeType()) ||
                             SporadicChargeTypeEnum.HIGH_ONLINE_ACTIVITY.getCode().equals(row.getChargeType()))) {
                         row.setRechargeFee(row.getActualAmount());
+                    } else if (row.getChargeType() != null && SporadicChargeTypeEnum.CLOUD_TEACHER_BUY.getCode().equals(row.getChargeType())) {
+                        row.setCloudTeacherFee(row.getActualAmount());
                     } else {
                         row.setOtherFee(row.getActualAmount());
                     }

+ 2 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderDetailServiceImpl.java

@@ -171,6 +171,8 @@ public class MusicGroupPaymentCalenderDetailServiceImpl extends BaseServiceImpl<
 					cloudTeacherOrder.setTime(calender.getMemberValidDate());
 					//只用会员价格
 					cloudTeacherOrder.setAmount(expectMemberAmount);
+					cloudTeacherOrder.setStudentId(e.getUserId());
+					cloudTeacherOrder.setLevel(calender.getMemberRankSettingId());
 					cloudTeacherOrder.setStatus(2);
 					cloudTeacherOrder.setStartTime(date);
 					cloudTeacherOrder.setEndTime(DateUtil.addMonths(date,calender.getMemberValidDate()));

+ 16 - 23
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupPaymentCalenderServiceImpl.java

@@ -127,6 +127,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 	@Autowired
 	private GroupEventSource groupEventSource;
 	@Autowired
+	private StudentPaymentOrderDao studentPaymentOrderDao;
+	@Autowired
 	private MemberFeeSettingDao memberFeeSettingDao;
 	@Autowired
 	private MemberRankSettingDao memberRankSettingDao;
@@ -1022,6 +1024,8 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 						cloudTeacherOrder.setLevel(musicGroupPaymentCalender.getMemberRankSettingId());
 						cloudTeacherOrder.setOrganId(musicGroup.getOrganId());
 						cloudTeacherOrder.setType(2);
+						cloudTeacherOrder.setStudentId(Integer.parseInt(studentId));
+						cloudTeacherOrder.setOrderId(musicGroup.getOrganId().longValue());
 						cloudTeacherOrder.setTime(musicGroupPaymentCalender.getMemberValidDate());
 						cloudTeacherOrder.setAmount(expectMemberAmount);
 						cloudTeacherOrder.setStatus(2);
@@ -1537,33 +1541,22 @@ public class MusicGroupPaymentCalenderServiceImpl extends BaseServiceImpl<Long,
 		if (calender == null) {
 			throw new BizException("缴费信息不存在");
 		}
-		if (calender.getStatus() != PaymentCalenderStatusEnum.AUDITING && calender.getStatus() != PaymentCalenderStatusEnum.NO
-				&& calender.getStatus() != PaymentCalenderStatusEnum.REJECT && calender.getStatus() != DRAFT) {
-			throw new BizException("删除失败,{} 的缴费项目不允许删除");
-		}
-		MusicGroupStudentClassAdjust byBatchNo = musicGroupStudentClassAdjustDao.findByBatchNo(calender.getBatchNo());
-		if(byBatchNo != null){
-			throw new BizException("删除失败,班级调整的缴费项目不允许删除");
+		
+		//缴费项目中没有学生即可删除缴费项目
+		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryByCalenderId(id, null);
+		if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
+			throw new BizException("缴费项目中已存在学员,不能删除");
 		}
 
-		List<MusicGroupPaymentCalenderDetail> musicGroupPaymentCalenderDetailList = musicGroupPaymentCalenderDetailDao.queryByCalenderId(id,null);
-		if (musicGroupPaymentCalenderDetailList != null && musicGroupPaymentCalenderDetailList.size() > 0) {
-			List<MusicGroupPaymentCalenderDetail> paidList = musicGroupPaymentCalenderDetailList.stream()
-					.filter(MusicGroupPaymentCalenderDetail -> MusicGroupPaymentCalenderDetail.getPaymentStatus() != PaymentStatus.NON_PAYMENT)
-					.collect(Collectors.toList());
-			if (paidList.size() > 0) {
-				throw new BizException("存在已缴费的学生不能删除");
-			}
-			
-			List<Long> calenderDetailIdList = musicGroupPaymentCalenderDetailList.stream().map(cd -> cd.getId()).collect(Collectors.toList());
-			//是否已排课
-			List<MusicGroupPaymentStudentCourseDetail> musicGroupPaymentStudentCourseDetailList = musicGroupPaymentStudentCourseDetailDao.queryByMusicGroupPaymentStudentCourseDetailId(calenderDetailIdList);
-			long count = musicGroupPaymentStudentCourseDetailList.stream().filter(e -> e.getUsedCourseMinutes() > 0).count();
-			if(count > 0){
-				throw new BizException("存在已排课的学员");
+		if (calender.getPaymentType() == PaymentType.MUSIC_APPLY) {
+			// 是否存在缴费中的
+			List<StudentPaymentOrder> studentPaymentOrderList = studentPaymentOrderDao.queryByDealStatus(calender.getMusicGroupId(), OrderTypeEnum.APPLY,
+					DealStatusEnum.ING);
+			if (studentPaymentOrderList != null && studentPaymentOrderList.size() > 0) {
+				throw new BizException("存在缴费中的学生,不能删除");
 			}
 		}
-
+		
 		musicGroupPaymentCalenderDao.delete(id);
 		musicGroupPaymentCalenderDetailDao.deleteByCalenderId(id);
 		musicGroupPaymentStudentCourseDetailDao.deleteByMusicGroupPaymentCalenderId(id);

+ 35 - 19
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -2018,19 +2018,24 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             //退云教练费用
             if (cloudTeacherAmount != null) {
                 Date nowDate = new Date();
-                CloudTeacherOrder studentCloudTeacherOrder = cloudTeacherOrderService.getStudentCloudTeacherOrder(userId, musicGroupId);
-                if (cloudTeacherAmount.compareTo(BigDecimal.ZERO) > 0) {
-                    if (studentCloudTeacherOrder == null || (studentCloudTeacherOrder.getEndTime() != null && studentCloudTeacherOrder.getEndTime().compareTo(nowDate) <= 0)) {
-                        throw new BizException("学生云教练已过有效期,不能退费");
+                List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderService.getStudentCloudTeacherOrder(userId, musicGroupId);
+                if(cloudTeacherOrders.size() > 0){
+                    List<CloudTeacherOrder> quitCloudTeacherOrders = new ArrayList<>();
+                    BigDecimal orderAmount = BigDecimal.ZERO;
+                    for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
+                        if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
+                            quitCloudTeacherOrders.add(cloudTeacherOrder);
+                            orderAmount = orderAmount.add(cloudTeacherOrder.getAmount());
+                        }
                     }
-                    if (cloudTeacherAmount.compareTo(studentCloudTeacherOrder.getAmount()) > 0) {
+                    if (cloudTeacherAmount.compareTo(orderAmount) > 0) {
                         throw new BizException("云教练退费金额不能大于原始订单金额");
                     }
+                    cloudTeacherOrderService.quitCloudTeacherOrders(quitCloudTeacherOrders, cloudTeacherAmount);
                 }
                 amount = amount.add(cloudTeacherAmount);
-                if (cloudTeacherAmount.compareTo(BigDecimal.ZERO) > 0 && studentCloudTeacherOrder != null) {
-                    cloudTeacherOrderService.quitCloudTeacherOrder(studentCloudTeacherOrder, cloudTeacherAmount);
-                }
+                //清除学员云教练
+                studentService.cleanMember(userId);
             }
 
             if (amount.doubleValue() > 0) {
@@ -2263,19 +2268,24 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         //退云教练费用
         if (cloudTeacherAmount != null) {
             Date nowDate = new Date();
-            CloudTeacherOrder studentCloudTeacherOrder = cloudTeacherOrderService.getStudentCloudTeacherOrder(userId, musicGroupId);
-            if (cloudTeacherAmount.compareTo(BigDecimal.ZERO) > 0) {
-                if (studentCloudTeacherOrder == null || (studentCloudTeacherOrder.getEndTime() != null && studentCloudTeacherOrder.getEndTime().compareTo(nowDate) <= 0)) {
-                    throw new BizException("学生云教练已过有效期,不能退费");
+            List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderService.getStudentCloudTeacherOrder(userId, musicGroupId);
+            if(cloudTeacherOrders.size() > 0){
+                List<CloudTeacherOrder> quitCloudTeacherOrders = new ArrayList<>();
+                BigDecimal orderAmount = BigDecimal.ZERO;
+                for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
+                    if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
+                        quitCloudTeacherOrders.add(cloudTeacherOrder);
+                        orderAmount = orderAmount.add(cloudTeacherOrder.getAmount());
+                    }
                 }
-                if (cloudTeacherAmount.compareTo(studentCloudTeacherOrder.getAmount()) > 0) {
+                if (cloudTeacherAmount.compareTo(orderAmount) > 0) {
                     throw new BizException("云教练退费金额不能大于原始订单金额");
                 }
+                cloudTeacherOrderService.quitCloudTeacherOrders(quitCloudTeacherOrders, cloudTeacherAmount);
             }
             amount = amount.add(cloudTeacherAmount);
-            if (cloudTeacherAmount.compareTo(BigDecimal.ZERO) > 0 && studentCloudTeacherOrder != null) {
-                cloudTeacherOrderService.quitCloudTeacherOrder(studentCloudTeacherOrder, cloudTeacherAmount);
-            }
+            //清除学员云教练
+            studentService.cleanMember(userId);
         }
 
         if (amount.doubleValue() > 0) {
@@ -3358,9 +3368,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             Date date = new Date();
             dataList.forEach(e->{
                 if (studentCloudTeacherMap.containsKey(e.getUserId())) {
-                    CloudTeacherOrder cloudTeacherOrder = studentCloudTeacherMap.get(e.getUserId()).get(0);
-                    if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(date) > 0) {
-                        e.setCloudTeacherAmount(cloudTeacherOrder.getAmount());
+                    List<CloudTeacherOrder> cloudTeacherOrders = studentCloudTeacherMap.get(e.getUserId());
+                    if(cloudTeacherOrders != null && cloudTeacherOrders.size() > 0){
+                        BigDecimal cloudAmount = BigDecimal.ZERO;
+                        for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
+                            if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(date) > 0) {
+                                cloudAmount = cloudAmount.add(cloudTeacherOrder.getAmount());
+                            }
+                        }
+                        e.setCloudTeacherAmount(cloudAmount);
                     }
                 }
             });

+ 9 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentManageServiceImpl.java

@@ -526,9 +526,15 @@ public class StudentManageServiceImpl implements StudentManageService {
                     e.setHasMaintenance(true);
                 }
                 if (studentCloudTeacherMap.containsKey(e.getUserId())) {
-                    CloudTeacherOrder cloudTeacherOrder = studentCloudTeacherMap.get(e.getUserId()).get(0);
-                    if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
-                        e.setCloudTeacherAmount(cloudTeacherOrder.getAmount());
+                    List<CloudTeacherOrder> cloudTeacherOrders = studentCloudTeacherMap.get(e.getUserId());
+                    if(cloudTeacherOrders != null && cloudTeacherOrders.size() > 0){
+                        BigDecimal cloudAmount = BigDecimal.ZERO;
+                        for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
+                            if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
+                                cloudAmount = cloudAmount.add(cloudTeacherOrder.getAmount());
+                            }
+                        }
+                        e.setCloudTeacherAmount(cloudAmount);
                     }
                 }
             });

+ 23 - 5
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -189,9 +189,15 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     e.setHasMaintenance(true);
                 }
                 if (studentCloudTeacherMap.containsKey(e.getStudentId())) {
-                    CloudTeacherOrder cloudTeacherOrder = studentCloudTeacherMap.get(e.getStudentId()).get(0);
-                    if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
-                        e.setCloudTeacherAmount(cloudTeacherOrder.getAmount());
+                    List<CloudTeacherOrder> cloudTeacherOrders = studentCloudTeacherMap.get(e.getStudentId());
+                    if(cloudTeacherOrders != null && cloudTeacherOrders.size() > 0){
+                        BigDecimal cloudAmount = BigDecimal.ZERO;
+                        for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
+                            if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
+                                cloudAmount = cloudAmount.add(cloudTeacherOrder.getAmount());
+                            }
+                        }
+                        e.setCloudTeacherAmount(cloudAmount);
                     }
                 }
             });
@@ -1081,8 +1087,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentRegistration.setTemporaryCourseFee(new BigDecimal(0));
             }
             studentRegistration.setPaymentStatus(YES);
-            studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
-
+            
             if (studentPaymentOrder.getClassGroupId() == null || !studentPaymentOrder.getClassGroupId().equals(206)) {
                 studentRegistration.setPayingStatus(0);
             }
@@ -1097,6 +1102,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     .filter(o -> !o.getType().getCode().equals("CLOUD_TEACHER_PLUS"))
                     .map(o -> o.getPrice().subtract(o.getRemitFee() == null ? BigDecimal.ZERO : o.getRemitFee()))
                     .reduce(BigDecimal.ZERO, BigDecimal::add);
+            
+            //已购买内容
+            List<OrderDetailTypeEnum> orderTypeList = allDetails.stream().map(t -> t.getType()).collect(Collectors.toList());
+            
+			if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
+				if (studentRegistration.getNoneNeedCloudTeacher() == 1 || orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER)
+						|| orderTypeList.contains(OrderDetailTypeEnum.CLOUD_TEACHER_PLUS)) {
+					studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+				}
+			} else {
+				studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
+			}
 
             //累加充值金额
             studentRegistration.setSurplusCourseFee(studentRegistration.getSurplusCourseFee().add(courseFee));
@@ -1915,6 +1932,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             throw new BizException("该学生状态已更新,请刷新查看");
         }
         studentRegistration.setPayingStatus(0);
+        studentRegistration.setMusicGroupStatus(StudentMusicGroupStatusEnum.NORMAL);
         studentRegistrationDao.update(studentRegistration);
         StudentPaymentOrder order = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(studentRegistration.getUserId(), studentRegistration.getMusicGroupId(), DealStatusEnum.SUCCESS);
         order.setPaymentAccountNo("200");

+ 5 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentServiceImpl.java

@@ -386,4 +386,9 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
 	public Student getLocked(Integer userId) {
 		return studentDao.getLocked(userId);
 	}
+
+    @Override
+    public void cleanMember(Integer userId) {
+        studentDao.cleanMember(userId);
+    }
 }

+ 12 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupActivityServiceImpl.java

@@ -10,10 +10,10 @@ import com.ym.mec.biz.dal.entity.Teacher;
 import com.ym.mec.biz.dal.entity.VipGroupActivity;
 import com.ym.mec.biz.dal.page.VipGroupActivityQueryInfo;
 import com.ym.mec.biz.event.source.EntityChangeEventSource;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.VipGroupActivityService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.exception.BizException;
-import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.util.collection.MapUtil;
 import org.apache.commons.lang3.StringUtils;
@@ -21,7 +21,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 @Service
 public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGroupActivity>  implements VipGroupActivityService {
@@ -32,6 +35,8 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 	private TeacherDao teacherDao;
 	@Autowired
 	private EntityChangeEventSource entityChangeEventSource;
+	@Autowired
+	private SysConfigService sysConfigService;
 
 	@Override
 	public BaseDAO<Integer, VipGroupActivity> getDAO() {
@@ -146,7 +151,7 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 	}
 
 	@Override
-	public List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId, Integer applyToStudentType) {
+	public List<VipGroupActivity> findByVipGroupCategory(Long categoryId, String organIds, Integer teacherId, Integer applyToStudentType, Boolean includeClosed) {
 		if(Objects.isNull(categoryId)){
 			throw new BizException("请选择课程形态!");
 		}
@@ -163,7 +168,10 @@ public class VipGroupActivityServiceImpl extends BaseServiceImpl<Integer, VipGro
 				organIds += "," + teacher.getFlowOrganRange();
 			}
 		}
-		return vipGroupActivityDao.findByCategory(categoryId,organIds, applyToStudentType);
+
+		List<VipGroupActivity> vipGroupActivities = vipGroupActivityDao.findByCategory(categoryId, organIds, applyToStudentType, includeClosed);
+
+		return vipGroupActivities;
 	}
 
 	@Override

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

@@ -160,8 +160,7 @@
         WHERE order_id_ IN (
         SELECT MAX(id_)
         FROM student_payment_order
-        WHERE type_ = 'APPLY'
-        AND music_group_id_ = #{musicGroupId}
+        WHERE music_group_id_ = #{musicGroupId}
         AND status_ = 'SUCCESS'
         AND user_id_ IN
         <foreach collection="studentIds" item="studentId" open="(" close=")" separator=",">
@@ -182,8 +181,7 @@
         WHERE order_id_ = (
             SELECT MAX(id_)
             FROM student_payment_order
-            WHERE type_ = 'APPLY'
-              AND music_group_id_ = #{musicGroupId}
+            WHERE music_group_id_ = #{musicGroupId}
               AND status_ = 'SUCCESS'
               AND user_id_ = #{studentId}
         )

+ 4 - 0
mec-biz/src/main/resources/config/mybatis/StudentMapper.xml

@@ -756,4 +756,8 @@
         UPDATE student SET member_rank_setting_id_ = NULL,membership_start_time_ = NULL,membership_end_time_ = NULL
         WHERE DATEDIFF(NOW(),membership_end_time_) > 0
     </update>
+    <update id="cleanMember">
+        UPDATE student SET member_rank_setting_id_ = NULL,membership_start_time_ = NULL,membership_end_time_ = NULL
+        WHERE user_id_ = #{userId}
+    </update>
 </mapper>

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

@@ -204,7 +204,9 @@
 			vip_group_activity
 		WHERE
 			FIND_IN_SET( #{categoryId}, vip_group_category_id_list_ )
-			AND (end_time_ IS NULL OR NOW() BETWEEN start_time_ AND end_time_)
+		  	<if test="includeClosed==null">
+				AND (end_time_ IS NULL OR NOW() BETWEEN start_time_ AND end_time_)
+			</if>
 			AND del_flag_=0
 			AND INTE_ARRAY(organ_id_,#{organIds})
 			<if test="applyToStudentType!=null">

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

@@ -1048,8 +1048,10 @@
     <select id="countStudentUseingActivityNum" resultType="int">
         SELECT COUNT(DISTINCT vg.id_)
         FROM vip_group vg
-                 LEFT JOIN class_group_student_mapper cgsm ON vg.id_=cgsm.music_group_id_ AND cgsm.group_type_='VIP'
+            LEFT JOIN class_group_student_mapper cgsm ON vg.id_=cgsm.music_group_id_ AND cgsm.group_type_='VIP'
+            LEFT JOIN class_group cg ON cgsm.class_group_id_=cg.id_
         WHERE vg.vip_group_activity_id_=#{vipGroupActivityId}
-          AND cgsm.user_id_=#{studentId}
+            AND cg.del_flag_!=1
+            AND cgsm.user_id_=#{studentId}
     </select>
 </mapper>

+ 11 - 6
mec-teacher/src/main/java/com/ym/mec/teacher/controller/VipGroupActivityController.java

@@ -98,7 +98,7 @@ public class VipGroupActivityController extends BaseController {
         }
         String organIds = student.getOrganId().toString();
 
-        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, sysUser.getId(),applyToStudentType);
+        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, sysUser.getId(),applyToStudentType, onlySpecialActivity?true:null);
         SysConfig sysConfig = sysConfigService.findByParamName(SysConfigService.VIP_SPECIAL_ACTIVITY_IDS);
         if(onlySpecialActivity){
             if(Objects.isNull(sysConfig)|| StringUtils.isBlank(sysConfig.getParanValue())){
@@ -108,12 +108,17 @@ public class VipGroupActivityController extends BaseController {
             List<VipGroupActivity> results = vipGroupActivities.stream().filter(e -> specialActivityIds.contains(e.getId())).collect(Collectors.toList());
             return succeed(results);
         }else{
-            if(Objects.isNull(sysConfig)|| StringUtils.isBlank(sysConfig.getParanValue())){
-                return succeed(vipGroupActivities);
+            if(Objects.nonNull(sysConfig)&&StringUtils.isNotBlank(sysConfig.getParanValue())){
+                Set<Integer> activityIds = Arrays.stream(sysConfig.getParanValue().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toSet());
+                Iterator<VipGroupActivity> iterator = vipGroupActivities.iterator();
+                while(iterator.hasNext()){
+                    VipGroupActivity vipGroupActivity = iterator.next();
+                    if(activityIds.contains(vipGroupActivity.getId())){
+                        iterator.remove();
+                    }
+                }
             }
-            Set<Integer> specialActivityIds = Arrays.stream(sysConfig.getParanValue().split(",")).map(Integer::valueOf).collect(Collectors.toSet());
-            List<VipGroupActivity> results = vipGroupActivities.stream().filter(e -> !specialActivityIds.contains(e.getId())).collect(Collectors.toList());
-            return succeed(results);
+            return succeed(vipGroupActivities);
         }
     }
 

+ 10 - 3
mec-web/src/main/java/com/ym/mec/web/controller/MusicGroupQuitController.java

@@ -29,6 +29,7 @@ import com.ym.mec.common.entity.HttpResponseResult;
 
 import java.math.BigDecimal;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 
@@ -89,9 +90,15 @@ public class MusicGroupQuitController extends BaseController {
                 if (studentMaintenance != null) {
                     row.setHasMaintenance(true);
                 }
-                CloudTeacherOrder cloudTeacherOrder = cloudTeacherOrderDao.getStudentCloudTeacherOrder(row.getUserId(), row.getMusicGroupId());
-                if (cloudTeacherOrder != null && (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0)) {
-                    row.setCloudTeacherAmount(cloudTeacherOrder.getAmount());
+                List<CloudTeacherOrder> cloudTeacherOrders = cloudTeacherOrderDao.getStudentCloudTeacherOrder(row.getUserId(), row.getMusicGroupId());
+                if(cloudTeacherOrders.size() > 0){
+                    BigDecimal orderAmount = BigDecimal.ZERO;
+                    for (CloudTeacherOrder cloudTeacherOrder : cloudTeacherOrders) {
+                        if (cloudTeacherOrder.getEndTime() == null || cloudTeacherOrder.getEndTime().compareTo(nowDate) > 0) {
+                            orderAmount = orderAmount.add(cloudTeacherOrder.getAmount());
+                        }
+                    }
+                    row.setCloudTeacherAmount(orderAmount);
                 }
             }
         }

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

@@ -8,7 +8,10 @@ import com.ym.mec.biz.dal.dao.TeacherDao;
 import com.ym.mec.biz.dal.dto.VipGroupActivityAddDto;
 import com.ym.mec.biz.dal.entity.Employee;
 import com.ym.mec.biz.dal.entity.Student;
+import com.ym.mec.biz.dal.entity.SysConfig;
+import com.ym.mec.biz.dal.entity.VipGroupActivity;
 import com.ym.mec.biz.dal.page.VipGroupActivityQueryInfo;
+import com.ym.mec.biz.service.SysConfigService;
 import com.ym.mec.biz.service.VipGroupActivityService;
 import com.ym.mec.common.controller.BaseController;
 import com.ym.mec.common.exception.BizException;
@@ -22,9 +25,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -47,6 +48,8 @@ public class VipGroupActivityController extends BaseController {
     private TeacherDao teacherDao;
 	@Autowired
     private StudentDao studentDao;
+	@Autowired
+    private SysConfigService sysConfigService;
 
     @ApiOperation(value = "新增vip课活动方案")
     @PostMapping("/addVipGroupActivity")
@@ -127,7 +130,22 @@ public class VipGroupActivityController extends BaseController {
             return failed("学员信息不存在");
         }
         String organIds = student.getOrganId().toString();
-        return succeed(vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, teacherId, applyToStudentType));
+
+        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, teacherId, applyToStudentType, null);
+
+        SysConfig doubleElevenIdConfig = sysConfigService.findByParamName(SysConfigService.VIP_SPECIAL_ACTIVITY_IDS);
+        if(Objects.nonNull(doubleElevenIdConfig)&&StringUtils.isNotBlank(doubleElevenIdConfig.getParanValue())){
+            Set<Integer> activityIds = Arrays.stream(doubleElevenIdConfig.getParanValue().split(",")).map(id->Integer.valueOf(id)).collect(Collectors.toSet());
+            Iterator<VipGroupActivity> iterator = vipGroupActivities.iterator();
+            while(iterator.hasNext()){
+                VipGroupActivity vipGroupActivity = iterator.next();
+                if(activityIds.contains(vipGroupActivity.getId())){
+                    iterator.remove();
+                }
+            }
+        }
+
+        return succeed(vipGroupActivities);
     }
 
 }

+ 1 - 1
mec-web/src/main/java/com/ym/mec/web/controller/education/EduVipGroupActivityController.java

@@ -79,7 +79,7 @@ public class EduVipGroupActivityController extends BaseController {
             return failed("学员信息不存在");
         }
         String organIds = student.getOrganId().toString();
-        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, teacherId, applyToStudentType);
+        List<VipGroupActivity> vipGroupActivities = vipGroupActivityService.findByVipGroupCategory(categoryId, organIds, teacherId, applyToStudentType, null);
         Iterator<VipGroupActivity> iterator = vipGroupActivities.iterator();
         while (iterator.hasNext()){
             VipGroupActivity vipGroupActivity = iterator.next();