|
@@ -14,7 +14,9 @@ import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import com.ym.mec.common.constant.CommonConstants;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
|
import com.ym.mec.common.entity.ImGroupModel;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -33,15 +35,18 @@ import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
+import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
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.transaction.interceptor.TransactionAspectSupport;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
+import java.text.MessageFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
@@ -163,7 +168,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
@Override
|
|
|
- public String createVipGroup(VipGroupApplyDto vipGroup) {
|
|
|
+ public HttpResponseResult createVipGroup(VipGroupApplyDto vipGroup) {
|
|
|
|
|
|
if (Objects.isNull(vipGroup.getVipGroupApplyBaseInfo().getUserId())){
|
|
|
throw new BizException("请选择指导老师");
|
|
@@ -242,7 +247,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
|
|
|
//获取活动信息
|
|
|
VipGroupActivity vipGroupActivity = vipGroupActivityDao.get(vipGroup.getVipGroupApplyBaseInfo().getVipGroupActivityId());
|
|
|
- if(Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
|
|
|
+ if(!vipGroup.getAllowOverstepActivityStudentNum()&&Objects.nonNull(vipGroupActivity)&&Objects.nonNull(vipGroupActivity.getStudentMaxUsedTimes())&&vipGroupActivity.getStudentMaxUsedTimes()!=-1&&StringUtils.isNotBlank(vipGroupApplyBaseInfoDto.getStudentIdList())){
|
|
|
List<String> tempStudentIds = Arrays.asList(vipGroupApplyBaseInfoDto.getStudentIdList().split(","));
|
|
|
List<Integer> errStudentIds = new ArrayList<>();
|
|
|
for (String studentIdStr : tempStudentIds) {
|
|
@@ -253,7 +258,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
}
|
|
|
if(errStudentIds.size()>0){
|
|
|
List<SimpleUserDto> students = teacherDao.getUsersSimpleInfo(errStudentIds);
|
|
|
- throw new BizException("学员{}已超过该活动购买次数限制", StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、"));
|
|
|
+ TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
|
|
+ String studentNames = StringUtils.join(students.stream().map(SimpleUserDto::getNickName).collect(Collectors.toList()), "、");
|
|
|
+ return BaseController.failed(HttpStatus.PARTIAL_CONTENT,"学员+"+studentNames+"+已超过该活动购买次数限制");
|
|
|
}
|
|
|
}
|
|
|
//判断课程安排是否超出范围
|
|
@@ -460,7 +467,7 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
|
// }else {
|
|
|
sysMessageService.batchSeoMessage(userIds,MessageTypeEnum.BACKSTAGE_TEACHER_APPLY_VIP, JSONObject.toJSONString(memo),teacher.getRealName());
|
|
|
// }
|
|
|
- return vipGroupApplyBaseInfoDto.getAuditStatus().getCode();
|
|
|
+ return BaseController.succeed(vipGroupApplyBaseInfoDto.getAuditStatus().getCode());
|
|
|
}
|
|
|
|
|
|
@Override
|