|
@@ -24,7 +24,6 @@ import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
|
import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
-import com.ym.mec.common.page.WrapperUtil;
|
|
|
import com.ym.mec.common.service.IdGeneratorService;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.common.tenant.TenantContextHolder;
|
|
@@ -46,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
-import java.math.RoundingMode;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -69,7 +67,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Autowired
|
|
|
private TeacherDao teacherDao;
|
|
|
@Autowired
|
|
|
- private StudentDao studentDao;
|
|
|
+ private StudentService studentService;
|
|
|
@Autowired
|
|
|
private IdGeneratorService idGeneratorService;
|
|
|
@Autowired
|
|
@@ -173,8 +171,6 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Autowired
|
|
|
private GoodsDao goodsDao;
|
|
|
@Autowired
|
|
|
- private SysUserCashAccountDao sysUserCashAccountDao;
|
|
|
- @Autowired
|
|
|
private ContractService contractService;
|
|
|
@Autowired
|
|
|
private StudentPreRegistrationDao studentPreRegistrationDao;
|
|
@@ -324,9 +320,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean preRegister(StudentPreRegistration studentPreRegistration) {
|
|
|
-
|
|
|
String musicGroupId = studentPreRegistration.getMusicGroupId();
|
|
|
-
|
|
|
// 查询乐团状态
|
|
|
MusicGroup musicGroup = musicGroupDao.getLocked(musicGroupId);
|
|
|
if (musicGroup == null) {
|
|
@@ -335,69 +329,24 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (musicGroup.getStatus() != MusicGroupStatusEnum.PRE_APPLY) {
|
|
|
throw new BizException("乐团当前状态不能预报名");
|
|
|
}
|
|
|
-
|
|
|
StudentPreRegistration originRegistration = studentPreRegistrationDao.queryByMusicGroupIdAndPhone(studentPreRegistration.getPhone(), musicGroupId);
|
|
|
if (originRegistration != null) {
|
|
|
throw new BizException("您已预报名成功,请勿重复提交资料");
|
|
|
}
|
|
|
- Date date = new Date();
|
|
|
|
|
|
- // 判断用户是否存在
|
|
|
- SysUser user = sysUserFeignService.queryUserByMobile(studentPreRegistration.getPhone());
|
|
|
- if (user == null || user.getId() == null) {
|
|
|
- user = new SysUser();
|
|
|
- user.setPhone(studentPreRegistration.getPhone());
|
|
|
- user.setUsername(studentPreRegistration.getUserName());
|
|
|
- user.setOrganId(musicGroup.getOrganId());
|
|
|
- user.setUserType("STUDENT");
|
|
|
- user.setCreateTime(date);
|
|
|
- user.setUpdateTime(date);
|
|
|
- // 注册账户信息
|
|
|
- HttpResponseResult<Integer> result = sysUserFeignService.addUser(user);
|
|
|
-
|
|
|
- Integer userId = result.getData();
|
|
|
- user.setId(userId);
|
|
|
-
|
|
|
- Student student = new Student();
|
|
|
- student.setUserId(userId);
|
|
|
- student.setCreateTime(date);
|
|
|
- student.setUpdateTime(date);
|
|
|
- student.setIsNewUser(true);
|
|
|
- student.setCurrentGradeNum(studentPreRegistration.getCurrentGradeNum());
|
|
|
- student.setCurrentClass(studentPreRegistration.getCurrentClass());
|
|
|
- studentDao.insert(student);
|
|
|
- sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
- } else {
|
|
|
- if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
|
|
|
- //该学员是否在其他的会员团
|
|
|
- boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroupId, user.getId());
|
|
|
- if (hasMemberGroup) {
|
|
|
- throw new BizException("乐团报名失败:该学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
|
|
|
- }
|
|
|
- }
|
|
|
- user.setUsername(studentPreRegistration.getUserName());
|
|
|
- if (!user.getUserType().contains("STUDENT")) {
|
|
|
- user.setUserType(user.getUserType() + ",STUDENT");
|
|
|
+ studentPreRegistration.setTenantId(musicGroup.getTenantId());
|
|
|
+ studentPreRegistration.setOrganId(musicGroup.getOrganId());
|
|
|
+ //保存学员信息
|
|
|
+ SysUser user = studentService.upSetStudent(studentPreRegistration);
|
|
|
|
|
|
- Integer userId = user.getId();
|
|
|
- //添加student
|
|
|
- Student student = new Student();
|
|
|
- student.setUserId(userId);
|
|
|
- student.setCreateTime(date);
|
|
|
- student.setUpdateTime(date);
|
|
|
- student.setIsNewUser(true);
|
|
|
- student.setCurrentGradeNum(studentPreRegistration.getCurrentGradeNum());
|
|
|
- student.setCurrentClass(studentPreRegistration.getCurrentClass());
|
|
|
- studentDao.insert(student);
|
|
|
+ if (musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE) {
|
|
|
+ //该学员是否在其他的会员团
|
|
|
+ boolean hasMemberGroup = studentRegistrationDao.checkHasMemberGroup(musicGroupId, user.getId());
|
|
|
+ if (hasMemberGroup) {
|
|
|
+ throw new BizException("乐团报名失败:该学员已在其他系统收费乐团中,不可报名该乐团请联系教务老师");
|
|
|
}
|
|
|
- user.setUpdateTime(new Date());
|
|
|
- teacherDao.updateUser(user);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- studentPreRegistration.setCreateTime(date);
|
|
|
- studentPreRegistration.setUserId(user.getId());
|
|
|
-
|
|
|
Organization organization = organizationDao.get(musicGroup.getOrganId());
|
|
|
if (organization.getGradeType().equals(GradeTypeEnum.SIX_PLUS)) {
|
|
|
for (SixPlusGradeEnum value : SixPlusGradeEnum.values()) {
|
|
@@ -414,12 +363,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
studentPreRegistrationDao.insert(studentPreRegistration);
|
|
|
-
|
|
|
// 添加成员
|
|
|
imGroupMemberService.join(Long.parseLong(musicGroupId), user.getId(), null, false);
|
|
|
-
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -863,7 +809,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//获取本次商品的总数
|
|
|
AtomicInteger total = getTotalNum(registerPayDto);
|
|
|
//校验优惠券的使用
|
|
|
- couponPayParam = sysCouponCodeService.getCouponPayParam(registerPayDto.getCouponIdList(), total.get(), registerPayDto.getAmount());
|
|
|
+ couponPayParam = sysCouponCodeService.getCouponPayParam(registerPayDto.getCouponIdList());
|
|
|
studentPaymentOrder.setCouponCodeId(StringUtils.join(registerPayDto.getCouponIdList(), ","));
|
|
|
studentPaymentOrder.setCouponRemitFee(couponPayParam.getCouponRemitTotal());
|
|
|
}
|
|
@@ -1415,12 +1361,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
MusicGroup musicGroup = saveLog(musicGroupId, MusicGroupStatusEnum.PREPARE);
|
|
|
|
|
|
//乐器采购清单是否确认
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
- param.put("musicGroupId", musicGroupId);
|
|
|
- int i = musicGroupPurchaseListDao.queryCount(param);
|
|
|
- if (i <= 0) {
|
|
|
- throw new BizException("采购清单未确认");
|
|
|
+ List<StudentPaymentOrderDetail> applyOrder = studentPaymentOrderDetailService.findApplyOrderSuccess(musicGroupId, DealStatusEnum.SUCCESS);
|
|
|
+ if(applyOrder != null && applyOrder.size() > 0){
|
|
|
+ //是否购买了乐器,支持无乐器乐团
|
|
|
+ long count = applyOrder.stream().filter(e -> StringUtils.isNotEmpty(e.getGoodsIdList())).count();
|
|
|
+ if(count > 0l){
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("musicGroupId", musicGroupId);
|
|
|
+ param.put("tenantId", musicGroup.getTenantId());
|
|
|
+ int i = musicGroupPurchaseListDao.queryCount(param);
|
|
|
+ if (i <= 0) {
|
|
|
+ throw new BizException("采购清单未确认");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
//课酬是否确认
|
|
|
Integer courseScheduleNum = courseScheduleDao.countCourseScheduleByMusicGroupId(musicGroupId);
|
|
|
if (courseScheduleNum != null && courseScheduleNum > 0) {
|
|
@@ -1680,7 +1635,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
//获取对外课程务老师
|
|
|
teacherIds.addAll(teacherDao.findCommEducationalTeacherId(studentId));
|
|
|
//获取关联的指导老师
|
|
|
- Student student = studentDao.get(studentId);
|
|
|
+ Student student = studentService.get(studentId);
|
|
|
if (student != null && student.getTeacherId() != null) {
|
|
|
teacherIds.add(student.getTeacherId());
|
|
|
}
|
|
@@ -2015,7 +1970,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (musicGroupQuit.getStatus() == ApprovalStatus.APPROVED) {
|
|
|
throw new BizException("只能分部经理操作退团");
|
|
|
}
|
|
|
- musicGroupQuit.setCurrentApproveRole(SysUserRoleEnum.SECTION_MANAGER.ordinal()+"");
|
|
|
+ musicGroupQuit.setCurrentApproveRole(SysUserRoleEnum.SECTION_MANAGER.ordinal() + "");
|
|
|
}
|
|
|
if (currentOperatorRoleIds.contains(SysUserRoleEnum.SECTION_MANAGER) && !currentOperatorRoleIds.contains(SysUserRoleEnum.EDUCATIONAL_TEACHER)) {
|
|
|
|
|
@@ -2962,7 +2917,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if (user == null) {
|
|
|
throw new BizException("学员 {} 信息不存在", userId);
|
|
|
}
|
|
|
- Student student = studentDao.get(userId);
|
|
|
+ Student student = studentService.get(userId);
|
|
|
if (student == null) {
|
|
|
throw new BizException("学员 {} 信息不存在", userId);
|
|
|
}
|
|
@@ -3847,7 +3802,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<MusicMemberDto> queryMusicMemberList(MusicMemberQueryInfo queryInfo) {
|
|
|
- String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.PUSH_MEMBER_RENEW_QUIT,queryInfo.getTenantId());
|
|
|
+ String configValue = sysTenantConfigService.getTenantConfigValue(SysConfigService.PUSH_MEMBER_RENEW_QUIT, queryInfo.getTenantId());
|
|
|
if (StringUtils.isEmpty(configValue)) {
|
|
|
configValue = "15";
|
|
|
}
|