Browse Source

Merge remote-tracking branch 'origin/master'

zouxuan 4 years ago
parent
commit
1ea40984db

+ 2 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImGroupMemberServiceImpl.java

@@ -160,6 +160,7 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
 	}
 
 	@Override
+	@Transactional(rollbackFor = Exception.class)
 	public boolean quit(Long imGroupId, List<Integer> userIdList) {
 
 		ImGroup imGroup = imGroupDao.getLocked(imGroupId);
@@ -176,7 +177,7 @@ public class ImGroupMemberServiceImpl extends BaseServiceImpl<Long, ImGroupMembe
 
 		imGroupMemberDao.batchDelete(imGroupMemberList);
 
-		imGroup.setMemberNum(imGroup.getMemberNum() - 1);
+		imGroup.setMemberNum(imGroup.getMemberNum() - userIdList.size());
 		imGroup.setUpdateTime(new Date());
 		imGroupDao.update(imGroup);
 

+ 60 - 3
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -20,7 +20,6 @@ import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
-import com.ym.mec.biz.service.*;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -99,6 +98,23 @@ import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
 import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
 import com.ym.mec.biz.dal.enums.StudentMusicGroupStatusEnum;
 import com.ym.mec.biz.dal.page.StudentRegistrationQueryInfo;
+import com.ym.mec.biz.service.ClassGroupService;
+import com.ym.mec.biz.service.ClassGroupStudentMapperService;
+import com.ym.mec.biz.service.ContractService;
+import com.ym.mec.biz.service.CourseScheduleService;
+import com.ym.mec.biz.service.CourseScheduleStudentPaymentService;
+import com.ym.mec.biz.service.ImGroupMemberService;
+import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
+import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
+import com.ym.mec.biz.service.SellOrderService;
+import com.ym.mec.biz.service.StudentPaymentOrderDetailService;
+import com.ym.mec.biz.service.StudentPaymentOrderService;
+import com.ym.mec.biz.service.StudentRegistrationService;
+import com.ym.mec.biz.service.SubjectService;
+import com.ym.mec.biz.service.SysConfigService;
+import com.ym.mec.biz.service.SysMessageService;
+import com.ym.mec.biz.service.SysUserCashAccountDetailService;
+import com.ym.mec.biz.service.SysUserCashAccountService;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
@@ -186,8 +202,6 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     private StudentCourseFeeDetailDao studentCourseFeeDetailDao;
     @Autowired
     private CourseScheduleDao courseScheduleDao;
-    @Autowired
-    private ImUserFriendService imUserFriendService;
 
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
@@ -648,6 +662,9 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         if (studentRegistration == null) {
             throw new BizException("参数校验失败");
         }
+        /*if(studentAddDto.getSignClassId() == null && studentAddDto.getMixClassId() == null){
+            throw new BizException("参数校验失败: 单技班或合奏班必填一项");
+        }*/
         Date date = new Date();
         String musicGroupId = studentRegistration.getMusicGroupId();
         
@@ -677,6 +694,8 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentDao.insert(new Student(userId, studentRegistration.getSubjectId().toString()));
                 //添加用户现金账户
                 sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
+                //添加用户电子签章账户
+//                contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
                 ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), null));
                 sysUser.setImToken(register.getToken());
                 teacherDao.updateUser(sysUser);
@@ -737,7 +756,44 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                     userId, studentRegistration.getSubjectId(), studentAddDto.getCourseFee(),
                     null, studentAddDto.getTemporaryCourseFee(), null);
 
+            /*if (musicGroup.getFeeType() != null && musicGroup.getFeeType() != MusicGroupPaymentCalender.FeeType.OFFLINE && musicGroupStudentFee.getTemporaryCourseFee().doubleValue() * 100 == 0) {
+                musicGroupStudentFee.setRemainNetworkClassTimes(musicGroupStudentFee.getRemainNetworkClassTimes() + 1);
+            }*/
             musicGroupStudentFeeDao.insert(musicGroupStudentFee);
+
+            StudentPaymentOrder waitPayOrder = studentPaymentOrderService.findMusicGroupApplyOrderByStatus(userId, studentRegistration.getMusicGroupId(), DealStatusEnum.WAIT_PAY);
+
+            if (waitPayOrder != null) {
+                waitPayOrder.setStatus(DealStatusEnum.CLOSE);
+                studentPaymentOrderService.update(waitPayOrder);
+            }
+            //生成订单
+            StudentPaymentOrder studentPaymentOrder = new StudentPaymentOrder();
+            studentPaymentOrder.setUserId(userId);
+            studentPaymentOrder.setGroupType(GroupType.MUSIC);
+            studentPaymentOrder.setType(OrderTypeEnum.APPLY);
+            studentPaymentOrder.setStatus(DealStatusEnum.WAIT_PAY);
+            studentPaymentOrder.setMusicGroupId(musicGroupId);
+            studentPaymentOrder.setClassGroupId(studentAddDto.getSignClassId());
+            studentPaymentOrder.setOrganId(musicGroup.getOrganId());
+            studentPaymentOrder.setRoutingOrganId(musicGroup.getOrganId());
+
+            //生成订单明细
+            List<StudentPaymentOrderDetail> studentPaymentOrderDetails = studentAddDto.getStudentPaymentOrderDetails();
+            if (studentPaymentOrderDetails == null) {
+                studentPaymentOrderDetails = new ArrayList<>();
+            }
+            //汇总金额
+
+            BigDecimal reduce = studentPaymentOrderDetails.stream().map(StudentPaymentOrderDetail::getPrice).reduce(BigDecimal.ZERO, BigDecimal::add);
+            if (reduce.compareTo(BigDecimal.ZERO) == 0) {
+                studentPaymentOrder.setStatus(DealStatusEnum.SUCCESS);
+                studentPaymentOrder.setActualAmount(reduce);
+                studentPaymentOrder.setPayTime(date);
+            }
+            studentPaymentOrder.setExpectAmount(reduce);
+            studentPaymentOrderService.insert(studentPaymentOrder);
+            
             //当前学员是否以前存在过当前乐团
             if (phoneAndMusicGroupId != null) {
                 studentRegistration.setId(phoneAndMusicGroupId.getId());
@@ -746,6 +802,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 studentRegistrationDao.insertBasic(studentRegistration);
             }
             studentRegistrationDao.updateCurrentClass(studentRegistration);
+
             return userId;
         }
     }

+ 5 - 1
mec-biz/src/main/java/com/ym/mec/biz/service/impl/VipGroupServiceImpl.java

@@ -2865,7 +2865,11 @@ public class VipGroupServiceImpl extends BaseServiceImpl<Long, VipGroup> impleme
 						salaryMap.get("onlineTeacherSalary"),
 						salaryMap.get("offlineTeacherSalary"));
 			}
-            userRoleMap.put(vipGroup.getUserId(), null);
+            userRoleMap.put(vipGroup.getUserId(), "指导老师");
+            
+            if(vipGroup.getEducationalTeacherId() != null){
+                userRoleMap.put(vipGroup.getEducationalTeacherId(), "乐团主管");
+            }
 		}
 
 		List<CourseSchedule> surplusCourses = courseScheduleDao.findByClassGroupAndStatus(classGroup.getId(), CourseStatusEnum.NOT_START.getCode());

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/StudentRegistrationMapper.xml

@@ -45,7 +45,7 @@
     
     <resultMap type="com.ym.mec.biz.dal.dto.StudentMusicGroupDto" id="StudentMusicGroupDto" extends="StudentRegistration">
     	<result column="music_group_quit_status_" property="musicGroupQuit.status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
-        <result column="music_group_status_" property="musicGroup.status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
+        <result column="group_status_" property="musicGroup.status" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler"/>
         <result column="music_group_name_" property="musicGroup.name"/>
     </resultMap>
 
@@ -718,7 +718,7 @@
     </select>
     
     <select id="queryStudentMusicGroupInfo" resultMap="StudentMusicGroupDto">
-    	select sr.*,s.name_ subject_name_,mg.status_ music_group_status_,mg.name_ music_group_name_,mgq.status_ music_group_quit_status_ 
+    	select sr.*,s.name_ subject_name_,mg.status_ group_status_,mg.name_ music_group_name_,mgq.status_ music_group_quit_status_ 
     	from student_registration sr left join subject s on s.id_ = sr.actual_subject_id_
     	left join music_group mg on sr.music_group_id_ = mg.id_
     	left join (select mgq.* from music_group_quit mgq