|
@@ -350,19 +350,19 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public boolean importStudentToMusicGroup(String musicGroupId, Map<String, List<Map<String, Object>>> excelData) {
|
|
|
-
|
|
|
+
|
|
|
MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
-
|
|
|
+
|
|
|
if(musicGroup == null){
|
|
|
throw new BizException("乐团[{}]信息查询失败", musicGroupId);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(musicGroup.getStatus() != MusicGroupStatusEnum.PAY){
|
|
|
throw new BizException("只有[缴费中]状态的乐团才能导入数据");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Integer tenantId = musicGroup.getTenantId();
|
|
|
-
|
|
|
+
|
|
|
List<StudentImportDto> studentBasicList = new ArrayList<StudentImportDto>();
|
|
|
List<Map<String, Object>> sheet = null;
|
|
|
StudentImportDto dto = null;
|
|
@@ -377,12 +377,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(!CommonValidator.isUserName(dto.getName())){
|
|
|
throw new BizException("学生姓名[{}]填写错误", dto.getName());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(row.get("性别") == null || StringUtils.isBlank(row.get("性别").toString())){
|
|
|
throw new BizException("性别不能为空");
|
|
|
}
|
|
|
dto.setSex(row.get("性别").toString());
|
|
|
-
|
|
|
+
|
|
|
if(row.get("手机号码") == null || StringUtils.isBlank(row.get("手机号码").toString())){
|
|
|
throw new BizException("手机号码不能为空");
|
|
|
}
|
|
@@ -390,51 +390,51 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(!CommonValidator.isMobileNo(dto.getMobileNo())){
|
|
|
throw new BizException("手机号码[{}]填写错误", dto.getMobileNo());
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(row.get("学习声部") == null || StringUtils.isBlank(row.get("学习声部").toString())){
|
|
|
throw new BizException("学习声部不能为空");
|
|
|
}
|
|
|
dto.setSubjectName(row.get("学习声部").toString());
|
|
|
-
|
|
|
+
|
|
|
if(row.get("所在年级") == null || StringUtils.isBlank(row.get("所在年级").toString())){
|
|
|
throw new BizException("所在年级不能为空");
|
|
|
}
|
|
|
dto.setGradeName(row.get("所在年级").toString());
|
|
|
-
|
|
|
+
|
|
|
studentBasicList.add(dto);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Date nowDate = new Date();
|
|
|
-
|
|
|
+
|
|
|
//查询导入的声部是否正确
|
|
|
List<String> subjectNameList = studentBasicList.stream().distinct().map(t->t.getSubjectName()).collect(Collectors.toList());
|
|
|
-
|
|
|
+
|
|
|
List<MusicGroupSubjectPlan> musicGroupSubjectPlanList = musicGroupSubjectPlanDao.getMusicSubjectClassPlan(musicGroupId);
|
|
|
-
|
|
|
+
|
|
|
Map<String,Integer> subjectMap = musicGroupSubjectPlanList.stream().collect(Collectors.toMap(MusicGroupSubjectPlan :: getSubName, MusicGroupSubjectPlan :: getSubjectId));
|
|
|
-
|
|
|
+
|
|
|
List<String> allSubjectNameList = musicGroupSubjectPlanList.stream().map(t -> t.getSubName()).collect(Collectors.toList());
|
|
|
-
|
|
|
+
|
|
|
for(String subName : subjectNameList){
|
|
|
if(!allSubjectNameList.contains(subName)){
|
|
|
throw new BizException("当前乐团不支持[{}]声部", subName);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//查询课程费用是否是0
|
|
|
MusicGroupPaymentCalender musicGroupPaymentCalender = musicGroupPaymentCalenderDao.findByMusicGroupRegCalender(musicGroupId);
|
|
|
if(musicGroupPaymentCalender == null){
|
|
|
throw new BizException("请先创建乐团报名缴费");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
List<MusicGroupPaymentCalenderCourseSettings> musicGroupPaymentCalenderCourseSettingsList = musicGroupPaymentCalenderCourseSettingsDao.queryCalenderCourseSettings(musicGroupPaymentCalender.getId());
|
|
|
double d = musicGroupPaymentCalenderCourseSettingsList.stream().mapToDouble(t -> t.getCourseCurrentPrice().doubleValue()).sum();
|
|
|
-
|
|
|
+
|
|
|
if(d > 0){
|
|
|
throw new BizException("缴费项目中的课程费用为[{}]元,不能导入", d);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//检查用户是否已入团或在其他机构已注册
|
|
|
for(StudentImportDto si : studentBasicList){
|
|
|
SysUser sysUser = studentRegistrationDao.getSysUserByPhone(si.getMobileNo());
|
|
@@ -442,7 +442,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("该手机号[{}]已注册", si.getMobileNo());
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
SysUser sysUser = null;
|
|
|
Integer userId = null;
|
|
|
Student student = null;
|
|
@@ -461,15 +461,15 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
sysUser.setUpdateTime(nowDate);
|
|
|
teacherDao.addSysUser(sysUser);
|
|
|
userId = sysUser.getId();
|
|
|
-
|
|
|
+
|
|
|
si.setUserId(userId);
|
|
|
-
|
|
|
+
|
|
|
student = new Student(userId, subjectMap.get(si.getSubjectName()) + "");
|
|
|
student.setCurrentGradeNum(SixPlusGradeEnum.get(si.getGradeName()).getCode());
|
|
|
studentDao.insert(student);
|
|
|
// 添加用户现金账户
|
|
|
sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
|
|
|
-
|
|
|
+
|
|
|
studentRegistration = new StudentRegistration();
|
|
|
String studentGrade = studentService.getStudentGrade(organization.getGradeType(), student.getCurrentGradeNum());
|
|
|
studentRegistration.setCurrentGrade(studentGrade);
|
|
@@ -488,10 +488,10 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
studentRegistration.setMusicGroupId(musicGroupId);
|
|
|
studentRegistration.setCreateTime(nowDate);
|
|
|
studentRegistration.setUpdateTime(nowDate);
|
|
|
-
|
|
|
+
|
|
|
insertList.add(studentRegistration);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (insertList.size() > 0) {
|
|
|
studentRegistrationService.batchInsert(insertList);
|
|
|
|
|
@@ -583,9 +583,9 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
if (insertMusicGroupPaymentCalenderDetailList.size() > 0) {
|
|
|
musicGroupPaymentCalenderDetailDao.batchInsert(insertMusicGroupPaymentCalenderDetailList);
|
|
|
-
|
|
|
+
|
|
|
Map<Integer,Long> musicGroupPaymentCalenderDetailIdMap = insertMusicGroupPaymentCalenderDetailList.stream().collect(Collectors.toMap(MusicGroupPaymentCalenderDetail :: getUserId, MusicGroupPaymentCalenderDetail :: getId));
|
|
|
-
|
|
|
+
|
|
|
if (musicGroupPaymentStudentCourseDetails.size() > 0) {
|
|
|
for(MusicGroupPaymentStudentCourseDetail cd : musicGroupPaymentStudentCourseDetails){
|
|
|
cd.setMusicGroupPaymentCalenderDetailId(musicGroupPaymentCalenderDetailIdMap.get(cd.getUserId()));
|
|
@@ -594,7 +594,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1083,16 +1083,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
|
|
|
private MusicGroupApplyGoodsDto getCalenderTotalAmount(RegisterPayDto registerPayDto, MusicGroupPaymentCalender calender) {
|
|
|
-
|
|
|
+
|
|
|
String musicGroupId = calender.getMusicGroupId();
|
|
|
MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
|
|
|
-
|
|
|
+
|
|
|
if(musicGroup == null){
|
|
|
throw new BizException("乐团[{}]信息查询失败", musicGroupId);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
boolean isGiveAccessories = musicGroup.getIsGiveAccessories();
|
|
|
-
|
|
|
+
|
|
|
MusicGroupApplyGoodsDto goodsDto = new MusicGroupApplyGoodsDto();
|
|
|
//乐器及打包辅件价格
|
|
|
List<MusicGroupSubjectGoodsGroup> goodsGroups;
|
|
@@ -1103,7 +1103,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
for (MusicGroupSubjectGoodsGroup goodsGroup : goodsGroups) {
|
|
|
Map<String, BigDecimal> groupType = JSONObject.parseObject(goodsGroup.getKitGroupPurchaseTypeJson(), new TypeReference<Map<String, BigDecimal>>() {
|
|
|
});
|
|
|
-
|
|
|
+
|
|
|
if(isGiveAccessories && registerPayDto.getBuyCloudTeacher()){
|
|
|
if (goodsGroup.getType().equals(GoodsType.ACCESSORIES)) {
|
|
|
continue;
|
|
@@ -1368,17 +1368,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
Integer userId = studentRegistration.getUserId();
|
|
|
|
|
|
List<StudentPaymentOrder> applyOrderList = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.ING);
|
|
|
-
|
|
|
+
|
|
|
StudentPaymentOrder applyOrder = null;
|
|
|
-
|
|
|
+
|
|
|
if(applyOrderList != null && applyOrderList.size() > 0){
|
|
|
applyOrder = applyOrderList.get(0);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (applyOrder == null) {
|
|
|
throw new BizException("没有支付中订单,请在我的订单中查看订单状态");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 查询订单状态
|
|
|
PayStatus payStatus = studentPaymentOrderService.queryPayStatus(applyOrder.getPaymentChannel(), applyOrder.getOrderNo(), applyOrder.getTransNo());
|
|
|
if(payStatus != PayStatus.FAILED){
|
|
@@ -1393,7 +1393,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
if(musicGroupRegCalender == null){
|
|
|
throw new BizException("缴费信息不存在");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//手动关闭订单
|
|
|
applyOrder.setStatus(DealStatusEnum.FAILED);
|
|
|
applyOrder.setMemo("用户手动关闭");
|
|
@@ -1440,14 +1440,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
remitFee = groupType.get(kitGroupPurchaseType) == null ? BigDecimal.ZERO : groupType.get(kitGroupPurchaseType);
|
|
|
}
|
|
|
goodsGroup.setGoodsList(goodsService.findGoodsByIds(goodsGroup.getGoodsIdList()));
|
|
|
-
|
|
|
+
|
|
|
if(goodsGroup.getType().equals(GoodsType.ACCESSORIES)){
|
|
|
if((registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) && musicGroup.getCourseViewType() == CourseViewTypeEnum.MEMBER_FEE){
|
|
|
goodsGroup.setPrice(BigDecimal.ZERO);
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if(musicGroup.getOrganId() == 55 && (registerPayDto.getNewCourse() == null || registerPayDto.getNewCourse().size() == 0) && !(registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus())){
|
|
|
//取商品零售价
|
|
|
if (StringUtils.isNotBlank(goodsGroup.getGoodsIdList())) {
|
|
@@ -1492,7 +1492,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
//云教练/云教练+
|
|
|
if (registerPayDto.getBuyCloudTeacher() || registerPayDto.getBuyCloudTeacherPlus()) {
|
|
|
-
|
|
|
+
|
|
|
BigDecimal cloudTeacherPrice = BigDecimal.ZERO;
|
|
|
if (musicGroupRegCalender.getMemberRankSettingId() != null) {
|
|
|
cloudTeacherPrice = musicGroupRegCalender.getMemberPaymentAmount();
|
|
@@ -1502,17 +1502,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
cloudTeacherPrice = musicGroup.getCloudTeacherType() == 0 ? cloudTeacher.getPrice() : cloudTeacher.getPlusPrice();
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
orderAmount = orderAmount.add(cloudTeacherPrice);
|
|
|
studentRegistration.setHasCloudTeacher(0);
|
|
|
-
|
|
|
+
|
|
|
|
|
|
//创建订单
|
|
|
cloudTeacherOrder = new CloudTeacherOrder();
|
|
|
|
|
|
cloudTeacherOrder.setType(PeriodEnum.MONTH);//月
|
|
|
cloudTeacherOrder.setTime(musicGroupRegCalender.getMemberValidDate() == null ? 6 : musicGroupRegCalender.getMemberValidDate());
|
|
|
-
|
|
|
+
|
|
|
cloudTeacherOrder.setOrganId(musicGroup.getOrganId());
|
|
|
cloudTeacherOrder.setStudentId(studentRegistration.getUserId());
|
|
|
cloudTeacherOrder.setLevel(musicGroupRegCalender.getMemberRankSettingId() == null ? 1 : musicGroupRegCalender.getMemberRankSettingId());
|
|
@@ -1548,14 +1548,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
throw new BizException("价格异常");
|
|
|
}
|
|
|
boolean canPay = studentPaymentOrder.getClassGroupId() != null && studentPaymentOrder.getClassGroupId().equals(206);
|
|
|
-
|
|
|
+
|
|
|
if(cloudTeacherOrder != null){
|
|
|
cloudTeacherOrder.setOrderId(studentPaymentOrder.getId());
|
|
|
cloudTeacherOrder.setCreateTime(date);
|
|
|
cloudTeacherOrder.setUpdateTime(date);
|
|
|
cloudTeacherOrderService.insert(cloudTeacherOrder);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
BigDecimal balance = BigDecimal.ZERO;
|
|
|
if (registerPayDto.getUseBalancePayment() && amount.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
SysUserCashAccount userCashAccount = sysUserCashAccountService.get(userId);
|
|
@@ -2510,8 +2510,12 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroupQuit.setReason(reason);
|
|
|
musicGroupQuit.setQuitDate(date);
|
|
|
musicGroupQuit.setReasonEnum(reqMusicGroupQuit.getReasonEnum());
|
|
|
+ musicGroupQuit.setIsVisit(reqMusicGroupQuit.getIsVisit());
|
|
|
+ musicGroupQuit.setVisitTime(reqMusicGroupQuit.getVisitTime());
|
|
|
+ musicGroupQuit.setUserComment(reqMusicGroupQuit.getUserComment());
|
|
|
|
|
|
- if (visitDate != null) {
|
|
|
+
|
|
|
+/* if (visitDate != null) {
|
|
|
musicGroupQuit.setVisitTime(visitDate);
|
|
|
musicGroupQuit.setIsVisit(true);
|
|
|
} else {
|
|
@@ -2520,7 +2524,7 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
|
|
|
if (StringUtils.isBlank(musicGroupQuit.getUserComment())) {
|
|
|
musicGroupQuit.setUserComment(reqMusicGroupQuit.getUserComment());
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
BigDecimal returnTotalFee = BigDecimal.ZERO;
|
|
|
|