|
@@ -1,5 +1,6 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
+import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
@@ -93,6 +94,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Autowired
|
|
|
private PayService payService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private SysUserFeignService sysUserFeignService;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<String, MusicGroup> getDAO() {
|
|
|
return musicGroupDao;
|
|
@@ -337,6 +341,53 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Override
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
+ public boolean directQuitMusicGroup(String musicGroupId, Integer userId, String reason) {
|
|
|
+
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserById(userId);
|
|
|
+ if (sysUser == null) {
|
|
|
+ throw new BizException("获取用户信息失败");
|
|
|
+ }
|
|
|
+
|
|
|
+ Date date = new Date();
|
|
|
+
|
|
|
+ MusicGroupQuit musicGroupQuit = new MusicGroupQuit();
|
|
|
+ musicGroupQuit.setCreateTime(date);
|
|
|
+ musicGroupQuit.setJoinDate(sysUser.getCreateTime());
|
|
|
+ musicGroupQuit.setMusicGroupId(musicGroupId);
|
|
|
+ musicGroupQuit.setUserId(sysUser.getId());
|
|
|
+ musicGroupQuit.setStatus(ApprovalStatus.APPROVED);
|
|
|
+ musicGroupQuit.setReason(reason);
|
|
|
+ musicGroupQuit.setQuitDate(date);
|
|
|
+
|
|
|
+ musicGroupQuitDao.insert(musicGroupQuit);
|
|
|
+
|
|
|
+ classGroupStudentMapperDao.deleteStudentByMusicGroupId(musicGroupId, userId);
|
|
|
+
|
|
|
+ // 判断乐器是否是租赁
|
|
|
+ StudentRegistration studentRegistration = studentRegistrationService.queryByUserIdAndMusicGroupId(userId, musicGroupId);
|
|
|
+ if (studentRegistration == null) {
|
|
|
+ throw new BizException("用户注册信息不存在");
|
|
|
+ }
|
|
|
+ // 退团
|
|
|
+ studentRegistration.setMusicGroupStatus(ClassGroupStudentStatusEnum.QUIT);
|
|
|
+ studentRegistration.setUpdateTime(date);
|
|
|
+
|
|
|
+ Integer subjectId = studentRegistration.getActualSubjectId();
|
|
|
+ MusicGroupSubjectPlan musicGroupSubjectPlan = musicGroupSubjectPlanDao.getMusicOneSubjectClassPlan(musicGroupId, subjectId);
|
|
|
+ if (musicGroupSubjectPlan == null) {
|
|
|
+ throw new BizException("乐团声部费用设置不存在");
|
|
|
+ }
|
|
|
+ if (musicGroupSubjectPlan.getDepositFee().doubleValue() > 0) {
|
|
|
+ // 增加交易流水
|
|
|
+ sysUserCashAccountDetailService.addCashAccountDetail(userId, musicGroupSubjectPlan.getDepositFee(), SysUserCashAccountDetailService.MUSIC_GROUP
|
|
|
+ + musicGroupId, "", PlatformCashAccountDetailTypeEnum.REFUNDS, null, DealStatusEnum.SUCCESS, "退出乐团");
|
|
|
+ }
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public Map renew(String musicGroupId, Integer userId) {
|
|
|
|
|
|
MusicGroup musicGroup = this.get(musicGroupId);
|