|
@@ -28,6 +28,7 @@ import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.http.HttpUtil;
|
|
|
import com.ym.mec.util.string.MessageFormatter;
|
|
|
+
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
@@ -41,6 +42,7 @@ 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.time.*;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
@@ -2406,9 +2408,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if (Objects.nonNull(practiceCourseMinutesConfig)) {
|
|
|
practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
|
|
|
}
|
|
|
+
|
|
|
+ SysConfig organIdConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_TEACHER_ORGAN_RANGE);
|
|
|
+
|
|
|
+ if(organIdConfig == null || StringUtils.isBlank(organIdConfig.getParanValue())){
|
|
|
+ throw new BizException("系统参数[{}]未配置", SysConfigService.PRACTICE_TEACHER_ORGAN_RANGE);
|
|
|
+ }
|
|
|
|
|
|
List<Integer> includeTeacherIds = new ArrayList<>();
|
|
|
- List<ExtendTeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject2(sysUser.getOrganId(), subjectId);
|
|
|
+ List<ExtendTeacherBasicDto> organAndSubjectTeachers = teacherDao.findTeaTeachersByOrganAndSubject4(organIdConfig.getParanValue(), subjectId);
|
|
|
if (CollectionUtils.isEmpty(organAndSubjectTeachers)) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
@@ -2613,7 +2621,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
now = now.plusDays(1);
|
|
|
Date applyStartDate = Date.from(now.atStartOfDay(zoneId).toInstant());
|
|
|
- Date applyEndDate = Date.from(now.plusMonths(buyMonths).atStartOfDay(zoneId).toInstant());
|
|
|
+ Date applyEndDate = Date.from(now.plusDays(buyMonths).atStartOfDay(zoneId).toInstant());
|
|
|
Date firstMonday = DateUtil.getWeekDayWithDate(applyStartDate, Calendar.MONDAY);
|
|
|
Date secondSunday = DateUtil.getWeekDayWithDate(applyEndDate, Calendar.SUNDAY);
|
|
|
|
|
@@ -2820,15 +2828,15 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public HttpResponseResult buyPracticeGroup(PracticeGroupBuyDto practiceGroupBuyParams) {
|
|
|
+ public HttpResponseResult buyPracticeGroup(PracticeGroupBuyDto practiceGroupBuyParams, String operatorInfo) {
|
|
|
if (Objects.isNull(practiceGroupBuyParams.getUserId())) {
|
|
|
return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择教师");
|
|
|
}
|
|
|
if (Objects.isNull(practiceGroupBuyParams.getSubjectId())) {
|
|
|
return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择声部");
|
|
|
}
|
|
|
- if (Objects.isNull(practiceGroupBuyParams.getBuyMonths())) {
|
|
|
- return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择需要购买的月数");
|
|
|
+ if (Objects.isNull(practiceGroupBuyParams.getAllCourseNum())) {
|
|
|
+ return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择需要购买的课时数");
|
|
|
}
|
|
|
if (Objects.isNull(practiceGroupBuyParams.getDrillTimesOnWeek())) {
|
|
|
return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择单周陪练次数");
|
|
@@ -2855,14 +2863,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
SysConfig practiceCourseMinutesConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_MINUTES);
|
|
|
Integer practiceCourseMinutes = practiceCourseMinutesConfig.getParanValue(Integer.class);
|
|
|
SysConfig practiceCourseSalaryConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_COURSE_SALARY);
|
|
|
- SysConfig practiceBuyActivityExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_BUY_ACTIVITY_EXPIRE_DATE);
|
|
|
+ /*SysConfig practiceBuyActivityExpireDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_BUY_ACTIVITY_EXPIRE_DATE);
|
|
|
Date practiceBuyActivityExpireDate = DateUtil.stringToDate(practiceBuyActivityExpireDateConfig.getParanValue(), "yyyy-MM-dd HH:mm:ss");
|
|
|
SysConfig practicePromotionActivityStartDateConfig = sysConfigDao.findByParamName(SysConfigService.PRACTICE_PROMOTION_ACTIVITY_START_DATE);
|
|
|
Date practicePromotionActivityStartDate = DateUtil.stringToDate(practicePromotionActivityStartDateConfig.getParanValue(), "yyyy-MM-dd HH:mm:ss");
|
|
|
-
|
|
|
+*/
|
|
|
Date now = new Date();
|
|
|
|
|
|
- int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId(),"2021-03-09 00:00:00");
|
|
|
+// int studentExitChargePractices = practiceGroupDao.checkStudentExitChargePractice(practiceGroupBuyParams.getStudentId(),"2021-03-09 00:00:00");
|
|
|
|
|
|
LocalDate courseStartDay = LocalDate.now();
|
|
|
LocalDate tempCourseLocalDate = LocalDate.parse("2020-03-01", DateUtil.dateFormatter);
|
|
@@ -2902,7 +2910,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseStartDay = courseStartDay.plusDays(1);
|
|
|
Date courseStartDate = Date.from(courseStartDay.atStartOfDay(DateUtil.zoneId).toInstant());
|
|
|
practiceGroupBuyParams.setCoursesStartDate(courseStartDate);
|
|
|
- LocalDate currentExpiredDay = courseStartDay.plusMonths(practiceGroupBuyParams.getBuyMonths());
|
|
|
+ LocalDate currentExpiredDay = courseStartDay.plusDays(practiceGroupBuyParams.getBuyMonths());
|
|
|
Date courseExpiredDate = Date.from(currentExpiredDay.atStartOfDay(DateUtil.zoneId).toInstant());
|
|
|
courseExpiredDate = DateUtil.addSeconds(courseExpiredDate, -1);
|
|
|
practiceGroupBuyParams.setCoursesExpireDate(courseExpiredDate);
|
|
@@ -2969,8 +2977,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if (Objects.isNull(practiceGroupSellPrice)) {
|
|
|
throw new BizException("所在城市暂不参与此活动");
|
|
|
}
|
|
|
- BigDecimal oneMonthPrice;
|
|
|
- if (practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14&& studentExitChargePractices <= 0) {
|
|
|
+ BigDecimal oneMonthPrice = practiceGroupSellPrice.getSingleClassMinutesPrice();
|
|
|
+ /*if (practiceBuyActivityExpireDate.after(now)&&Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14&& studentExitChargePractices <= 0) {
|
|
|
// oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceActivityPrice() : practiceGroupSellPrice.getTwiceActivityPrice();
|
|
|
oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
|
|
|
if (!now.before(practicePromotionActivityStartDate) && practiceGroupBuyParams.getBuyMonths() >= 3 && studentExitChargePractices > 0) {
|
|
@@ -2980,17 +2988,17 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
} else {
|
|
|
oneMonthPrice = practiceGroupBuyParams.getDrillTimesOnWeek() == 1 ? practiceGroupSellPrice.getOnceOriginalPrice() : practiceGroupSellPrice.getTwiceOriginalPrice();
|
|
|
- }
|
|
|
- BigDecimal amount = oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
|
|
|
- if (!now.before(practicePromotionActivityStartDate) && now.before(practiceBuyActivityExpireDate) && Objects.nonNull(sysUser.getOrganId())&&sysUser.getOrganId()==14 && studentExitChargePractices <= 0) {
|
|
|
- amount = oneMonthPrice.multiply(new BigDecimal(1));
|
|
|
- }
|
|
|
+ }*/
|
|
|
+ BigDecimal amount = oneMonthPrice.multiply(new BigDecimal(practiceGroupBuyParams.getAllCourseNum()));
|
|
|
|
|
|
practiceGroupBuyParams.setDrillTimesJson(drillTimesObject.toJSONString());
|
|
|
practiceGroupBuyParams.setOrganId(sysUser.getOrganId());
|
|
|
practiceGroupBuyParams.setSingleClassMinutes(practiceCourseMinutes);
|
|
|
practiceGroupBuyParams.setGroupStatus(GroupStatusEnum.LOCK);
|
|
|
practiceGroupBuyParams.setType(PracticeGroupType.CHARGE);
|
|
|
+ if(StringUtils.isNotBlank(operatorInfo)){
|
|
|
+ practiceGroupBuyParams.setMemo(operatorInfo+",教务代买");
|
|
|
+ }
|
|
|
practiceGroupDao.insert(practiceGroupBuyParams);
|
|
|
|
|
|
//创建班级信息
|
|
@@ -3007,6 +3015,26 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
classGroup.setCreateTime(now);
|
|
|
classGroup.setUpdateTime(now);
|
|
|
classGroupDao.insert(classGroup);
|
|
|
+
|
|
|
+ //使用优惠券
|
|
|
+ StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(),amount,true);
|
|
|
+ amount = studentPaymentOrder.getActualAmount();
|
|
|
+ studentPaymentOrder.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
+ studentPaymentOrder.setGroupType(GroupType.PRACTICE);
|
|
|
+ String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
+ studentPaymentOrder.setOrderNo(orderNo);
|
|
|
+ studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.PRACTICE_GROUP_BUY);
|
|
|
+ if (practiceGroupBuyParams.isRenew()) {
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.PRACTICE_GROUP_RENEW);
|
|
|
+ }
|
|
|
+ studentPaymentOrder.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
+ studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
|
+ studentPaymentOrder.setVersion(0);
|
|
|
+ if(StringUtils.isNotBlank(operatorInfo)){
|
|
|
+ studentPaymentOrder.setMemo(operatorInfo+",教务代买");
|
|
|
+ }
|
|
|
+ studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
|
|
|
//创建班级老师关联记录
|
|
|
ClassGroupTeacherMapper classGroupTeacherMapper = new ClassGroupTeacherMapper();
|
|
@@ -3068,13 +3096,18 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if(teacherDefaultSalary == null){
|
|
|
throw new BizException("请设置教师课酬");
|
|
|
}
|
|
|
- BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
+// BigDecimal studentSingleCourseCost = amount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
|
|
|
- BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
|
|
|
- BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
|
|
|
- BigDecimal studentSingleCourseOriginalCost=originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
+// BigDecimal oneMonthOriginalPrice=practiceGroupBuyParams.getDrillTimesOnWeek()==1?practiceGroupSellPrice.getOnceOriginalPrice():practiceGroupSellPrice.getTwiceOriginalPrice();
|
|
|
+// BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
|
|
|
+// BigDecimal studentSingleCourseOriginalCost=originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
|
|
|
- for (CourseSchedule courseSchedule : practiceCourses) {
|
|
|
+ //实际支付金额,去除优惠券
|
|
|
+ BigDecimal actualPrice = studentPaymentOrder.getExpectAmount();
|
|
|
+ BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), ROUND_DOWN);
|
|
|
+ BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(practiceCourses.size()))).add(divide);
|
|
|
+ for (int i = 0; i < practiceCourses.size(); i++) {
|
|
|
+ CourseSchedule courseSchedule = practiceCourses.get(i);
|
|
|
//课程与老师薪水表
|
|
|
CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
@@ -3094,9 +3127,16 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseScheduleStudentPayment.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
courseScheduleStudentPayment.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
- courseScheduleStudentPayment.setExpectPrice(studentSingleCourseCost);
|
|
|
- courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
- courseScheduleStudentPayment.setOriginalPrice(studentSingleCourseOriginalCost);
|
|
|
+ if(i == 0){
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(firstAmount);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(firstAmount);
|
|
|
+ }else {
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(divide);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(divide);
|
|
|
+ }
|
|
|
+// courseScheduleStudentPayment.setExpectPrice(oneMonthPrice);
|
|
|
+// courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
+ courseScheduleStudentPayment.setOriginalPrice(oneMonthPrice);
|
|
|
courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
|
courseScheduleStudentPayment.setUpdateTime(now);
|
|
@@ -3133,24 +3173,6 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
return BaseController.failed(HttpStatus.FOUND, errMessage);
|
|
|
}
|
|
|
- //使用优惠券
|
|
|
- StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(),amount,true);
|
|
|
- amount = studentPaymentOrder.getActualAmount();
|
|
|
- studentPaymentOrder.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
- studentPaymentOrder.setGroupType(GroupType.PRACTICE);
|
|
|
- String orderNo = idGeneratorService.generatorId("payment") + "";
|
|
|
- studentPaymentOrder.setOrderNo(orderNo);
|
|
|
- studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
- studentPaymentOrder.setType(OrderTypeEnum.PRACTICE_GROUP_BUY);
|
|
|
- if (practiceGroupBuyParams.isRenew()) {
|
|
|
- studentPaymentOrder.setType(OrderTypeEnum.PRACTICE_GROUP_RENEW);
|
|
|
- }
|
|
|
- studentPaymentOrder.setExpectAmount(amount);
|
|
|
- studentPaymentOrder.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
- studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
|
|
|
- studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
|
- studentPaymentOrder.setVersion(0);
|
|
|
- studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
|
|
|
BigDecimal balance = BigDecimal.ZERO;
|
|
|
if (practiceGroupBuyParams.isUseBalancePayment() || studentPaymentOrder.getExpectAmount().doubleValue() == 0) {
|
|
@@ -3257,7 +3279,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public HttpResponseResult createPackagePracticeGroup(PracticeGroupBuyDto practiceGroupBuyParams) {
|
|
|
+ public HttpResponseResult createPackagePracticeGroup(PracticeGroupBuyDto practiceGroupBuyParams, String operatorInfo) {
|
|
|
studentDao.lockUser(practiceGroupBuyParams.getStudentId());
|
|
|
if (Objects.isNull(practiceGroupBuyParams.getUserId())) {
|
|
|
return BaseController.failed(HttpStatus.EXPECTATION_FAILED, "请选择教师");
|
|
@@ -3439,6 +3461,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
practiceGroupBuyParams.setSingleClassMinutes(practiceCourseMinutes);
|
|
|
practiceGroupBuyParams.setGroupStatus(GroupStatusEnum.LOCK);
|
|
|
practiceGroupBuyParams.setType(PracticeGroupType.COME_ON_PACKAGE);
|
|
|
+ if(StringUtils.isNotBlank(operatorInfo)){
|
|
|
+ practiceGroupBuyParams.setMemo(operatorInfo+",教务代买");
|
|
|
+ }
|
|
|
practiceGroupDao.insert(practiceGroupBuyParams);
|
|
|
|
|
|
//创建班级信息
|
|
@@ -3522,7 +3547,14 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
BigDecimal originalAmount = oneMonthOriginalPrice.multiply(new BigDecimal(practiceGroupBuyParams.getBuyMonths()));
|
|
|
BigDecimal studentSingleCourseOriginalCost=originalAmount.divide(new BigDecimal(practiceCourses.size()), CommonConstants.DECIMAL_PLACE, ROUND_DOWN);
|
|
|
|
|
|
- for (CourseSchedule courseSchedule : practiceCourses) {
|
|
|
+ //使用优惠券
|
|
|
+ StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(),amount,true);
|
|
|
+ //实际支付金额,去除优惠券
|
|
|
+ BigDecimal actualPrice = studentPaymentOrder.getExpectAmount();
|
|
|
+ BigDecimal divide = actualPrice.divide(new BigDecimal(practiceCourses.size()), ROUND_DOWN);
|
|
|
+ BigDecimal firstAmount = actualPrice.subtract(divide.multiply(new BigDecimal(practiceCourses.size()))).add(divide);
|
|
|
+ for (int i = 0; i < practiceCourses.size(); i++) {
|
|
|
+ CourseSchedule courseSchedule = practiceCourses.get(i);
|
|
|
//课程与老师薪水表
|
|
|
CourseScheduleTeacherSalary courseScheduleTeacherSalary = new CourseScheduleTeacherSalary();
|
|
|
courseScheduleTeacherSalary.setCourseScheduleId(courseSchedule.getId());
|
|
@@ -3542,8 +3574,13 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
courseScheduleStudentPayment.setMusicGroupId(practiceGroupBuyParams.getId().toString());
|
|
|
courseScheduleStudentPayment.setCourseScheduleId(courseSchedule.getId());
|
|
|
courseScheduleStudentPayment.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
- courseScheduleStudentPayment.setExpectPrice(studentSingleCourseCost);
|
|
|
- courseScheduleStudentPayment.setActualPrice(studentSingleCourseCost);
|
|
|
+ if(i == 0){
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(firstAmount);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(firstAmount);
|
|
|
+ }else {
|
|
|
+ courseScheduleStudentPayment.setExpectPrice(divide);
|
|
|
+ courseScheduleStudentPayment.setActualPrice(divide);
|
|
|
+ }
|
|
|
courseScheduleStudentPayment.setOriginalPrice(studentSingleCourseOriginalCost);
|
|
|
courseScheduleStudentPayment.setClassGroupId(classGroup.getId());
|
|
|
courseScheduleStudentPayment.setCreateTime(now);
|
|
@@ -3580,9 +3617,7 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
return BaseController.failed(HttpStatus.FOUND, errMessage);
|
|
|
}
|
|
|
-
|
|
|
- //使用优惠券
|
|
|
- StudentPaymentOrder studentPaymentOrder = sysCouponCodeService.use(practiceGroupBuyParams.getCouponIdList(),amount,true);
|
|
|
+
|
|
|
amount = studentPaymentOrder.getActualAmount();
|
|
|
studentPaymentOrder.setUserId(practiceGroupBuyParams.getStudentId());
|
|
|
studentPaymentOrder.setGroupType(GroupType.PRACTICE);
|
|
@@ -3598,6 +3633,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
studentPaymentOrder.setActualAmount(studentPaymentOrder.getExpectAmount());
|
|
|
studentPaymentOrder.setClassGroupId(classGroup.getId());
|
|
|
studentPaymentOrder.setVersion(0);
|
|
|
+ if(StringUtils.isNotBlank(operatorInfo)){
|
|
|
+ studentPaymentOrder.setMemo(operatorInfo+",教务代买");
|
|
|
+ }
|
|
|
studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
|
|
|
BigDecimal balance = BigDecimal.ZERO;
|
|
@@ -4376,6 +4414,8 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
if(Objects.nonNull(practiceGroup.getType())&&(PracticeGroupType.CARE_PACKAGE.equals(practiceGroup.getType())||PracticeGroupType.COME_ON_PACKAGE.equals(practiceGroup.getType()))){
|
|
|
practiceCourseMinutes = 50;
|
|
|
}
|
|
|
+
|
|
|
+ practiceBuyResult.setCourseNum(practiceGroup.getAllCourseNum());
|
|
|
|
|
|
if(StringUtils.isNotEmpty(practiceGroup.getDrillTimesJson())){
|
|
|
JSONArray coursesArry = new JSONArray();
|
|
@@ -4557,14 +4597,40 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- @Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public HttpResponseResult cancelWaitPayOrder(Integer userId, Integer groupId) {
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public HttpResponseResult cancelWaitPayOrder(Integer userId, Integer groupId) throws Exception {
|
|
|
PracticeGroup practiceGroup = practiceGroupDao.get(groupId.longValue());
|
|
|
if (practiceGroup.getGroupStatus().equals(GroupStatusEnum.LOCK)) {
|
|
|
groupService.deleteGroupOtherInfo(groupId.toString(), GroupType.PRACTICE);
|
|
|
practiceGroup.setGroupStatus(GroupStatusEnum.CANCEL);
|
|
|
practiceGroup.setMemo("用户手动取消");
|
|
|
practiceGroupDao.update(practiceGroup);
|
|
|
+
|
|
|
+ // 判断是否存在支付中的记录
|
|
|
+ List<StudentPaymentOrder> list = studentPaymentOrderService.queryByCondition(GroupType.PRACTICE, groupId + "", userId, DealStatusEnum.ING,
|
|
|
+ OrderTypeEnum.PRACTICE_GROUP_BUY);
|
|
|
+
|
|
|
+ if (list.size() > 0) {
|
|
|
+ StudentPaymentOrder applyOrder = list.get(list.size() - 1);
|
|
|
+ // 查询订单状态
|
|
|
+ PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
|
|
|
+ if(payStatus == PayStatus.SUCCESSED){
|
|
|
+ throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
+ }/*else if(payStatus == PayStatus.PAYING){
|
|
|
+ throw new BizException("订单还在交易中,请稍后重试");
|
|
|
+ }*/
|
|
|
+ //处理关闭订单
|
|
|
+ applyOrder.setStatus(DealStatusEnum.CLOSE);
|
|
|
+ applyOrder.setMemo("主动关闭订单");
|
|
|
+ if (applyOrder.getBalancePaymentAmount() != null && applyOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ sysUserCashAccountService.updateBalance(applyOrder.getUserId(), applyOrder.getBalancePaymentAmount(),
|
|
|
+ PlatformCashAccountDetailTypeEnum.REFUNDS, "购买网管课支付失败");
|
|
|
+ }
|
|
|
+ studentPaymentOrderService.update(applyOrder);
|
|
|
+ sysCouponCodeService.quit(applyOrder.getCouponCodeId());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
} else if (practiceGroup.getGroupStatus().equals(GroupStatusEnum.NORMAL)) {
|
|
|
return BaseController.failed(HttpStatus.CREATED, "该订单已经支付成功");
|
|
|
} else if (practiceGroup.getGroupStatus().equals(GroupStatusEnum.CANCEL)) {
|
|
@@ -5328,9 +5394,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
|
|
|
if(payStatus == PayStatus.SUCCESSED){
|
|
|
throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }else if(payStatus == PayStatus.PAYING){
|
|
|
+ }/*else if(payStatus == PayStatus.PAYING){
|
|
|
throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }
|
|
|
+ }*/
|
|
|
if(!practiceGroupBuyParams.isRepeatPay()){
|
|
|
return BaseController.failed(HttpStatus.CONTINUE, "您有待支付的订单");
|
|
|
}
|
|
@@ -5515,9 +5581,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
PayStatus payStatus = studentPaymentOrderService.queryPayStatus(order.getPaymentChannel(), order.getOrderNo(), order.getTransNo());
|
|
|
if(payStatus == PayStatus.SUCCESSED){
|
|
|
throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }else if(payStatus == PayStatus.PAYING){
|
|
|
+ }/*else if(payStatus == PayStatus.PAYING){
|
|
|
throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }
|
|
|
+ }*/
|
|
|
if(practiceGroupBuyParams.isRepeatPay()){
|
|
|
//处理关闭订单
|
|
|
order.setStatus(DealStatusEnum.CLOSE);
|
|
@@ -5703,9 +5769,9 @@ public class PracticeGroupServiceImpl extends BaseServiceImpl<Long, PracticeGrou
|
|
|
PayStatus payStatus = studentPaymentOrderService.queryPayStatus(order.getPaymentChannel(), order.getOrderNo(), order.getTransNo());
|
|
|
if(payStatus == PayStatus.SUCCESSED){
|
|
|
throw new BizException("订单已支付成功,请勿重复支付");
|
|
|
- }else if(payStatus == PayStatus.PAYING){
|
|
|
+ }/*else if(payStatus == PayStatus.PAYING){
|
|
|
throw new BizException("订单还在交易中,请稍后重试");
|
|
|
- }
|
|
|
+ }*/
|
|
|
if(buyDoubleEleven2021Dto.isRepeatPay()){
|
|
|
//处理关闭订单
|
|
|
order.setStatus(DealStatusEnum.CLOSE);
|