|
@@ -807,14 +807,22 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
|
|
|
if(StringUtils.isEmpty(activityUserMapper.getVipGroupId())){
|
|
|
activityUserMapper.setVipGroupId(groupId.toString());
|
|
|
}else {
|
|
|
- activityUserMapper.setVipGroupId(activityUserMapper.getVipGroupId()+","+groupId);
|
|
|
+ String[] split = activityUserMapper.getVipGroupId().split(",");
|
|
|
+ List<String> idList = Arrays.stream(split).collect(Collectors.toList());
|
|
|
+ if(!idList.contains(groupId.toString())){
|
|
|
+ activityUserMapper.setVipGroupId(activityUserMapper.getVipGroupId()+","+groupId);
|
|
|
+ }
|
|
|
}
|
|
|
activityUserMapper.setVipFlag(2);
|
|
|
}else {
|
|
|
if(StringUtils.isEmpty(activityUserMapper.getPracticeGroupId())){
|
|
|
activityUserMapper.setPracticeGroupId(groupId.toString());
|
|
|
}else {
|
|
|
- activityUserMapper.setPracticeGroupId(activityUserMapper.getPracticeGroupId()+","+groupId);
|
|
|
+ String[] split = activityUserMapper.getPracticeGroupId().split(",");
|
|
|
+ List<String> idList = Arrays.stream(split).collect(Collectors.toList());
|
|
|
+ if(!idList.contains(groupId.toString())){
|
|
|
+ activityUserMapper.setPracticeGroupId(activityUserMapper.getPracticeGroupId()+","+groupId);
|
|
|
+ }
|
|
|
}
|
|
|
//虽然还有剩余价值,但是这里处理为已排课,不再考虑退费问题
|
|
|
activityUserMapper.setPracticeFlag(2);
|
|
@@ -825,14 +833,22 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
|
|
|
if(StringUtils.isEmpty(activityUserMapper.getGiveVipGroupId())){
|
|
|
activityUserMapper.setGiveVipGroupId(groupId.toString());
|
|
|
}else {
|
|
|
- activityUserMapper.setGiveVipGroupId(activityUserMapper.getGiveVipGroupId()+","+groupId);
|
|
|
+ String[] split = activityUserMapper.getGiveVipGroupId().split(",");
|
|
|
+ List<String> idList = Arrays.stream(split).collect(Collectors.toList());
|
|
|
+ if(!idList.contains(groupId.toString())){
|
|
|
+ activityUserMapper.setGiveVipGroupId(activityUserMapper.getGiveVipGroupId()+","+groupId);
|
|
|
+ }
|
|
|
}
|
|
|
activityUserMapper.setGiveVipFlag(2);
|
|
|
}else {
|
|
|
if(StringUtils.isEmpty(activityUserMapper.getGivePracticeGroupId())){
|
|
|
activityUserMapper.setGivePracticeGroupId(groupId.toString());
|
|
|
}else {
|
|
|
- activityUserMapper.setGivePracticeGroupId(activityUserMapper.getGivePracticeGroupId()+","+groupId);
|
|
|
+ String[] split = activityUserMapper.getGivePracticeGroupId().split(",");
|
|
|
+ List<String> idList = Arrays.stream(split).collect(Collectors.toList());
|
|
|
+ if(!idList.contains(groupId.toString())){
|
|
|
+ activityUserMapper.setGivePracticeGroupId(activityUserMapper.getGivePracticeGroupId()+","+groupId);
|
|
|
+ }
|
|
|
}
|
|
|
//虽然还有剩余价值,但是这里处理为已排课,不再考虑退费问题
|
|
|
activityUserMapper.setGivePracticeFlag(2);
|
|
@@ -1044,4 +1060,44 @@ public class ActivityUserMapperServiceImpl extends BaseServiceImpl<Integer, Acti
|
|
|
activityUserMapperDao.insert(activityUserMapper);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public ActivityUserMapperDao getDao() {
|
|
|
+ return activityUserMapperDao;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public BigDecimal use(List<ActivityUserMapper> activityUserMappers, List<ActivityUserMapper> freeActivityUserMappers, int j, int a,Long groupId) {
|
|
|
+ //扣除排课资格
|
|
|
+ if (!org.springframework.util.CollectionUtils.isEmpty(freeActivityUserMappers) && freeActivityUserMappers.size() > j) {
|
|
|
+ ActivityUserMapper activityUserMapper = freeActivityUserMappers.get(j);
|
|
|
+ Integer subCourseNum = activityUserMapper.getSubCourseNum();
|
|
|
+ if(subCourseNum == 1){
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ activityUserMapper.setSubCourseNum(subCourseNum - 1);
|
|
|
+ this.modifyGiveGroupId(activityUserMapper,groupId);
|
|
|
+ return ZERO;
|
|
|
+ }else if(!org.springframework.util.CollectionUtils.isEmpty(activityUserMappers) && activityUserMappers.size() > a){
|
|
|
+ ActivityUserMapper activityUserMapper = activityUserMappers.get(a);
|
|
|
+ BigDecimal consumerPrice = ZERO;
|
|
|
+ Integer subCourseNum = activityUserMapper.getSubCourseNum();
|
|
|
+ if(subCourseNum == 1){
|
|
|
+ a++;
|
|
|
+ consumerPrice = activityUserMapper.getSubNoCoursePrice();
|
|
|
+ activityUserMapper.setSubNoCoursePrice(ZERO);
|
|
|
+ }else {
|
|
|
+ if(activityUserMapper.getActualPrice().compareTo(ZERO) > 0) {
|
|
|
+ //单课金额
|
|
|
+ consumerPrice = activityUserMapper.getActualPrice().divide(new BigDecimal(activityUserMapper.getTotalCourseNum()), BigDecimal.ROUND_CEILING, RoundingMode.DOWN);
|
|
|
+ activityUserMapper.setSubNoCoursePrice(activityUserMapper.getSubNoCoursePrice().subtract(consumerPrice));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ activityUserMapper.setSubCourseNum(subCourseNum - 1);
|
|
|
+ this.modifyGroupId(activityUserMapper,groupId);
|
|
|
+ return consumerPrice;
|
|
|
+ }else {
|
|
|
+ throw new BizException("所选学员排课资格不足");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|