|
@@ -1,14 +1,93 @@
|
|
package com.ym.mec.biz.service.impl;
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Objects;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
+
|
|
|
|
+import org.apache.commons.lang.StringUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
|
+
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
-import com.ym.mec.biz.dal.dao.*;
|
|
|
|
-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.*;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.ClassGroupDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.ClassGroupStudentMapperDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.ClassGroupTeacherMapperDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.ClassGroupTeacherSalaryDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.CourseScheduleDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.CourseScheduleTeacherSalaryDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.StudentApplyRefundsDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.StudentVipGroupPaymentDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.SubjectDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.SysUserCashAccountDetailDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.TeacherDefaultVipGroupSalaryDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.VipGroupActivityDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.VipGroupCategoryDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.VipGroupClassGroupMapperDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.VipGroupDao;
|
|
|
|
+import com.ym.mec.biz.dal.dao.VipGroupDefaultClassesUnitPriceDao;
|
|
|
|
+import com.ym.mec.biz.dal.dto.StudentVipGroupDetailDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.TeachingRecordBaseInfo;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupApplyBaseInfoDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupApplyDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupBuyParamsDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupCostCountDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupCostCountParamsDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupManageDetailDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupSalaryBaseInfo;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupSalaryDto;
|
|
|
|
+import com.ym.mec.biz.dal.dto.VipGroupSalarySettlementDto;
|
|
|
|
+import com.ym.mec.biz.dal.entity.ClassGroup;
|
|
|
|
+import com.ym.mec.biz.dal.entity.ClassGroupTeacherMapper;
|
|
|
|
+import com.ym.mec.biz.dal.entity.ClassGroupTeacherSalary;
|
|
|
|
+import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
|
|
+import com.ym.mec.biz.dal.entity.CourseSchedule.CourseScheduleType;
|
|
|
|
+import com.ym.mec.biz.dal.entity.StudentApplyRefunds;
|
|
|
|
+import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
|
+import com.ym.mec.biz.dal.entity.StudentVipGroupPayment;
|
|
|
|
+import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
|
+import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
|
+import com.ym.mec.biz.dal.entity.TeacherDefaultVipGroupSalary;
|
|
|
|
+import com.ym.mec.biz.dal.entity.VipGroup;
|
|
|
|
+import com.ym.mec.biz.dal.entity.VipGroupActivity;
|
|
|
|
+import com.ym.mec.biz.dal.entity.VipGroupCategory;
|
|
|
|
+import com.ym.mec.biz.dal.entity.VipGroupClassGroupMapper;
|
|
|
|
+import com.ym.mec.biz.dal.entity.VipGroupDefaultClassesUnitPrice;
|
|
|
|
+import com.ym.mec.biz.dal.enums.AuditStatusEnum;
|
|
|
|
+import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
|
|
|
|
+import com.ym.mec.biz.dal.enums.CourseStatusEnum;
|
|
|
|
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
|
+import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
|
+import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
|
+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.dal.enums.VipGroupStatusEnum;
|
|
|
|
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
|
|
|
|
+import com.ym.mec.biz.dal.page.StudentVipGroupQueryInfo;
|
|
|
|
+import com.ym.mec.biz.dal.page.VipGroupAttendanceQueryInfo;
|
|
|
|
+import com.ym.mec.biz.dal.page.VipGroupQueryInfo;
|
|
|
|
+import com.ym.mec.biz.dal.page.VipGroupSalaryQueryInfo;
|
|
|
|
+import com.ym.mec.biz.dal.page.VipGroupTeachingRecordQueryInfo;
|
|
|
|
+import com.ym.mec.biz.service.ClassGroupService;
|
|
|
|
+import com.ym.mec.biz.service.CourseScheduleRewardsRulesService;
|
|
|
|
+import com.ym.mec.biz.service.CourseScheduleService;
|
|
|
|
+import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
|
|
|
|
+import com.ym.mec.biz.service.CourseScheduleTeacherSalaryService;
|
|
|
|
+import com.ym.mec.biz.service.PayService;
|
|
|
|
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
|
|
|
|
+import com.ym.mec.biz.service.SysUserCashAccountService;
|
|
|
|
+import com.ym.mec.biz.service.VipGroupService;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
import com.ym.mec.common.entity.ImGroupModel;
|
|
import com.ym.mec.common.entity.ImGroupModel;
|
|
@@ -17,15 +96,6 @@ import com.ym.mec.common.page.PageInfo;
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
import com.ym.mec.im.ImFeignService;
|
|
import com.ym.mec.im.ImFeignService;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
-import org.apache.commons.lang.StringUtils;
|
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
-
|
|
|
|
-import java.math.BigDecimal;
|
|
|
|
-import java.util.*;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService {
|
|
public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> implements VipGroupService {
|
|
@@ -81,6 +151,13 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
|
|
private CourseScheduleStudentPaymentService courseScheduleStudentPaymentService;
|
|
@Autowired
|
|
@Autowired
|
|
private PayService payService;
|
|
private PayService payService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ClassGroupStudentMapperDao classGroupStudentMapperDao;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private CourseScheduleRewardsRulesService courseScheduleRewardsRulesService;
|
|
|
|
+
|
|
|
|
+ private SysUserCashAccountDetailService sysUserCashAccountDetailService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Long, VipGroup> getDAO() {
|
|
public BaseDAO<Long, VipGroup> getDAO() {
|
|
@@ -596,7 +673,14 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
if(Objects.isNull(studentApplyRefunds.getId())){
|
|
if(Objects.isNull(studentApplyRefunds.getId())){
|
|
throw new BizException("请指定退费订单!");
|
|
throw new BizException("请指定退费订单!");
|
|
}
|
|
}
|
|
|
|
+
|
|
StudentApplyRefunds oldStudentApplyRefunds=studentApplyRefundsDao.get(studentApplyRefunds.getId());
|
|
StudentApplyRefunds oldStudentApplyRefunds=studentApplyRefundsDao.get(studentApplyRefunds.getId());
|
|
|
|
+
|
|
|
|
+ StudentPaymentOrder studentPaymentOrder = studentPaymentOrderDao.get(oldStudentApplyRefunds.getOrigPaymentOrderId());
|
|
|
|
+ if(null==studentPaymentOrder){
|
|
|
|
+ throw new BizException("未找到原订单信息!");
|
|
|
|
+ }
|
|
|
|
+
|
|
oldStudentApplyRefunds.setStatus(studentApplyRefunds.getStatus());
|
|
oldStudentApplyRefunds.setStatus(studentApplyRefunds.getStatus());
|
|
if(null==studentApplyRefunds.getActualAmount()){
|
|
if(null==studentApplyRefunds.getActualAmount()){
|
|
oldStudentApplyRefunds.setActualAmount(oldStudentApplyRefunds.getExpectAmount());
|
|
oldStudentApplyRefunds.setActualAmount(oldStudentApplyRefunds.getExpectAmount());
|
|
@@ -617,6 +701,9 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
sysUserCashAccountDetail.setBalance(sysUserCashAccount.getBalance());
|
|
sysUserCashAccountDetail.setAttribute(oldStudentApplyRefunds.getId().toString());
|
|
sysUserCashAccountDetail.setAttribute(oldStudentApplyRefunds.getId().toString());
|
|
sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
sysUserCashAccountDetailDao.insert(sysUserCashAccountDetail);
|
|
|
|
+
|
|
|
|
+ classGroupStudentMapperDao.deleteStudentByClassGroupId(studentPaymentOrder.getClassGroupId().longValue(),
|
|
|
|
+ studentPaymentOrder.getUserId().longValue());
|
|
break;
|
|
break;
|
|
case REJECT:
|
|
case REJECT:
|
|
|
|
|
|
@@ -732,4 +819,29 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
|
|
vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
|
|
vipGroup.setStatus(VipGroupStatusEnum.CANCEL);
|
|
vipGroupDao.update(vipGroup);
|
|
vipGroupDao.update(vipGroup);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
|
+ public boolean awardedMonthlyRewards() {
|
|
|
|
+ List<Map<Integer, Integer>> list = courseScheduleDao.queryVipGroupTeachereClassTimesByMonth(new Date(), CourseStatusEnum.OVER);
|
|
|
|
+
|
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
|
+
|
|
|
|
+ Integer organId = null, teacherId = null, coursesTimes = 0;
|
|
|
|
+
|
|
|
|
+ for (Map<Integer, Integer> map : list) {
|
|
|
|
+ organId = map.get("organ_id_");
|
|
|
|
+ teacherId = map.get("teacher_id_");
|
|
|
|
+ coursesTimes = map.get("times");
|
|
|
|
+
|
|
|
|
+ BigDecimal decimal = courseScheduleRewardsRulesService.queryRewardsAmount(organId, CourseScheduleType.VIP, coursesTimes);
|
|
|
|
+ if (decimal.doubleValue() > 0) {
|
|
|
|
+ sysUserCashAccountDetailService.addCashAccountDetail(teacherId, decimal, "", SysUserCashAccountDetailService.ORGAN,
|
|
|
|
+ PlatformCashAccountDetailTypeEnum.REWARDS, null, DealStatusEnum.SUCCESS, "分部奖励");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
}
|
|
}
|