|
@@ -19,6 +19,7 @@ import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.im.ImFeignService;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
+
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Propagation;
|
|
@@ -44,6 +45,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Autowired
|
|
|
private MusicGroupPaymentCalenderDao musicGroupPaymentCalenderDao;
|
|
|
@Autowired
|
|
|
+ private MusicGroupPaymentCalenderService musicGroupPaymentCalenderService;
|
|
|
+ @Autowired
|
|
|
private MusicGroupPaymentEntitiesDao musicGroupPaymentEntitiesDao;
|
|
|
@Autowired
|
|
|
private MusicGroupSubjectGoodsGroupDao musicGroupSubjectGoodsGroupDao;
|
|
@@ -80,6 +83,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Autowired
|
|
|
private CourseScheduleTeacherSalaryDao courseScheduleTeacherSalaryDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentOrderService studentPaymentOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private StudentPaymentOrderDetailService studentPaymentOrderDetailService;
|
|
|
|
|
|
@Autowired
|
|
|
private PayService payService;
|
|
@@ -119,10 +128,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (musicGroupSubjectGoodsGroups == null) {
|
|
|
musicGroupSubjectGoodsGroups = new ArrayList<>();
|
|
|
}
|
|
|
- musicGroupSubjectGoodsGroups.forEach(e -> {
|
|
|
- e.setMusicGroupId(musicGroupId);
|
|
|
- musicGroupSubjectGoodsGroupDao.insert(e);
|
|
|
- });
|
|
|
+ musicGroupSubjectGoodsGroupDao.batchInsert(musicGroupSubjectGoodsGroups,musicGroupId);
|
|
|
// 新增聊天群
|
|
|
// ImGroupModel imGroupModel = new ImGroupModel(musicGroupId, musicGroup.getName());
|
|
|
// 教务老师和运营主管加入群组
|
|
@@ -236,27 +242,8 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroup.setUpdateTime(new Date());
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
|
|
|
- // 查询下次缴费时间
|
|
|
- List<MusicGroupPaymentCalender> musicGroupPaymentCalenderList = musicGroupPaymentCalenderDao.findByMusicGroupId(musicGroupId);
|
|
|
- if (musicGroupPaymentCalenderList != null && musicGroupPaymentCalenderList.size() > 0) {
|
|
|
-
|
|
|
- Collections.sort(musicGroupPaymentCalenderList);
|
|
|
-
|
|
|
- Calendar cale = Calendar.getInstance();
|
|
|
- int month = cale.get(Calendar.MONTH) + 1;
|
|
|
-
|
|
|
- MusicGroupPaymentCalender calender = null;
|
|
|
-
|
|
|
- for (MusicGroupPaymentCalender cal : musicGroupPaymentCalenderList) {
|
|
|
- if (cal.getPaymentMonth() >= month) {
|
|
|
- calender = cal;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 重新设置下次缴费时间
|
|
|
- musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId, calender.getStartPaymentDate());
|
|
|
- }
|
|
|
+ // 重新设置下次缴费时间
|
|
|
+ musicGroupStudentFeeDao.updateNextPaymentDate(musicGroupId, musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -372,6 +359,29 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
amount = musicGroupStudentFee.getCourseFee();
|
|
|
}
|
|
|
|
|
|
+ Date date = new Date();
|
|
|
+ StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
|
|
|
+ studentPaymentOrder.setUserId(userId);
|
|
|
+ studentPaymentOrder.setOrderNo(idGeneratorService.generatorId("RENEW") + "");
|
|
|
+ studentPaymentOrder.setType(OrderTypeEnum.RENEW);
|
|
|
+ studentPaymentOrder.setExpectAmount(amount);
|
|
|
+ studentPaymentOrder.setActualAmount(amount);
|
|
|
+ studentPaymentOrder.setStatus(DealStatusEnum.ING);
|
|
|
+ studentPaymentOrder.setPaymentChannel("银联");
|
|
|
+ studentPaymentOrder.setMusicGroupId(musicGroupId);
|
|
|
+ studentPaymentOrderService.insert(studentPaymentOrder);
|
|
|
+
|
|
|
+ ArrayList<StudentPaymentOrderDetail> studentPaymentOrderDetailList = new ArrayList<>();
|
|
|
+ StudentPaymentOrderDetail studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.COURSE);
|
|
|
+ studentPaymentOrderDetail.setPrice(amount);
|
|
|
+ studentPaymentOrderDetail.setCreateTime(date);
|
|
|
+ studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
+ studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+ studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
|
|
|
+
|
|
|
+ studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetailList);
|
|
|
+
|
|
|
try {
|
|
|
return payService.getPayMap(amount, idGeneratorService.generatorId("payment") + "", "https://pay.dayaedu.com/api/yqpay/notify",
|
|
|
"http://dev.dayaedu.com", "测试订单", "测试订单");
|
|
@@ -382,6 +392,35 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
+ public boolean renewForCallback(StudentPaymentOrder studentPaymentOrder) {
|
|
|
+
|
|
|
+ studentPaymentOrderDao.update(studentPaymentOrder);
|
|
|
+
|
|
|
+ Integer userId = studentPaymentOrder.getUserId();
|
|
|
+ String musicGroupId = studentPaymentOrder.getMusicGroupId();
|
|
|
+
|
|
|
+ //更新下次续费时间
|
|
|
+ MusicGroupStudentFee musicGroupStudentFee = musicGroupStudentFeeDao.findByUser(userId, musicGroupId);
|
|
|
+
|
|
|
+ if(musicGroupStudentFee == null){
|
|
|
+ throw new BizException("系统数据异常,找不到学员预缴费信息");
|
|
|
+ }
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+
|
|
|
+ musicGroupStudentFee.setUpdateTime(date);
|
|
|
+ musicGroupStudentFee.setLatestPaidTime(date);
|
|
|
+ musicGroupStudentFee.setPaymentStatus(PaymentStatus.PAID_COMPLETED);
|
|
|
+ musicGroupStudentFee.setTemporaryCourseFee(new BigDecimal(0));
|
|
|
+ musicGroupStudentFee.setNextPaymentDate(musicGroupPaymentCalenderService.getNextPaymentDate(musicGroupId));
|
|
|
+
|
|
|
+ musicGroupStudentFeeDao.update(musicGroupStudentFee);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public boolean updateTeacherCoursesSalary(Long courseScheduleId, Integer teacherId, BigDecimal salary, BigDecimal subsidy, String scope) {
|
|
|
|
|
|
CourseSchedule courseSchedule = courseScheduleDao.get(courseScheduleId);
|