浏览代码

活动排课

zouxuan 3 年之前
父节点
当前提交
aefd6b179f

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

@@ -72,5 +72,5 @@ public interface GroupClassService {
     * @author zx
     * @date 2021/10/13 13:59
     */
-    HttpResponseResult quitActivityGive(Integer activityUserMapperId,Boolean confirmReturnActivityGive,Integer studentId);
+    HttpResponseResult quitActivityGive(Integer activityUserMapperId,boolean confirmReturnActivityGive,Integer studentId);
 }

+ 14 - 4
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GroupClassServiceImpl.java

@@ -214,16 +214,25 @@ public class GroupClassServiceImpl implements GroupClassService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public HttpResponseResult quitActivityGive(Integer activityUserMapperId,Boolean confirmReturnActivityGive,Integer studentId){
+    public HttpResponseResult quitActivityGive(Integer activityUserMapperId,boolean confirmReturnActivityGive,Integer studentId){
         if(activityUserMapperId != null){
             ActivityUserMapper activityUserMapper = activityUserMapperDao.get(activityUserMapperId);
             if(activityUserMapper != null){
                 if(activityUserMapper.getReturnFee()){
-                    throw new BizException("当前课程组无法退费,请联系管理员");
+                    return BaseController.succeed();
                 }
-                if(!confirmReturnActivityGive && activityUserMapper.getGiveMemberFlag() != 0 && activityUserMapper.getGiveVipFlag() != 0 && activityUserMapper.getGivePracticeFlag() != 0){
-                    return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程组为活动购买,退费会退还活动相关所有赠送,是否继续退费?");
+                if(!confirmReturnActivityGive){
+                    if(activityUserMapper.getGiveMemberFlag() != 0){
+                        return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程组为活动购买,退费会退还赠送的会员,是否继续退费?");
+                    }
+                    if(activityUserMapper.getGiveVipFlag() != 0){
+                        return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程组为活动购买,退费会退还赠送的VIP课,是否继续退费?");
+                    }
+                    if(activityUserMapper.getGivePracticeFlag() != 0){
+                        return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"当前课程组为活动购买,退费会退还赠送的网管课,是否继续退费?");
+                    }
                 }
+                activityUserMapper.setReturnFee(true);
                 Date now = new Date();
                 if(activityUserMapper.getGiveMemberFlag() == 2){
                     VipGroupActivity activity = vipGroupActivityDao.get(activityUserMapper.getActivityId());
@@ -301,6 +310,7 @@ public class GroupClassServiceImpl implements GroupClassService {
                     practiceGroupService.update(practiceGroup);
                 }
             }
+            activityUserMapperDao.update(activityUserMapper);
         }
         return BaseController.succeed();
     }

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

@@ -259,7 +259,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 				List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
 				TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
 				String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
-				return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"该活动"+studentNames+"学员已超过该活动购买次数限制");
+				throw new BizException("该活动{}学员已超过该活动购买次数限制",studentNames);
 			}
 		}
 		//判断课程安排是否超出范围

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

@@ -151,7 +151,7 @@
 	</select>
     <select id="findByStudentIdList" resultMap="ActivityUserMapper">
 		SELECT * FROM activity_user_mapper
-		WHERE activity_id_ = #{activityId} AND FIND_IN_SET(user_id_,#{studentIds})
+		WHERE activity_id_ = #{activityId} AND return_fee_ = 0 AND FIND_IN_SET(user_id_,#{studentIds})
 		<if test="type == 'GIVE_VIP'">
 			AND give_vip_flag_ = 1
 		</if>