Pārlūkot izejas kodu

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 5 gadi atpakaļ
vecāks
revīzija
bb7f133149

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/StudentRegistrationDao.java

@@ -257,4 +257,11 @@ public interface StudentRegistrationDao extends BaseDAO<Long, StudentRegistratio
     int deleteClassGroup(@Param("classGroupId") Integer classGroupId);
 
     int findMusicGroupStudentNum(@Param("musicGroupId") String musicGroupId);
+
+    /**
+     * 更新用户信息
+     *
+     * @return
+     */
+    int updateUser(@Param("id") Integer id,@Param("realName") String realName, @Param("idCardNo") String idCardNo);
 }

+ 7 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/StudentRegistrationService.java

@@ -213,4 +213,11 @@ public interface StudentRegistrationService extends BaseService<Long, StudentReg
 	 * @return
 	 */
 	List<Map<Integer,String>> findParentId(String parentPhones);
+
+	/**
+	 * 更新用户注册信息
+	 * @param studentRegistration
+	 * @return
+	 */
+	StudentRegistration updateStudent(StudentRegistration studentRegistration);
 }

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

@@ -1601,8 +1601,8 @@ public class ClassGroupServiceImpl extends BaseServiceImpl<Integer, ClassGroup>
             highClassGroup.setTeacherName(bishopTeacher.getUserName());
             highClassGroup.setUserId(bishopTeacher.getUserId());
             CourseSchedule courseSchedule = courseScheduleDao.findOneCourseScheduleByClassGroupId(highClassGroup.getId());
-            highClassGroup.setStartClassTime(DateUtil.format(courseSchedule.getStartClassTime(), "HH:mm:ss"));
-            highClassGroup.setEndClassTime(DateUtil.format(courseSchedule.getEndClassTime(), "HH:mm:ss"));
+            highClassGroup.setStartClassTime(DateUtil.format(courseSchedule.getStartClassTime(), "HH:mm"));
+            highClassGroup.setEndClassTime(DateUtil.format(courseSchedule.getEndClassTime(), "HH:mm"));
 
             Calendar calendar = Calendar.getInstance();
             calendar.setTime(courseSchedule.getClassDate());

+ 40 - 25
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -16,6 +16,7 @@ import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
 import com.ym.mec.common.entity.ImResult;
 import com.ym.mec.common.entity.ImUserModel;
+import com.ym.mec.common.exception.BizException;
 import com.ym.mec.common.page.PageInfo;
 import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
@@ -110,20 +111,20 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public Integer batchUpdateSubject(Integer userId, Integer subId, String musicGroupId) throws Exception {
         //获取当前学员的当前声部
         StudentRegistration studentRegistration = studentRegistrationDao.queryByUserIdAndMusicGroupId(userId, musicGroupId);
-        if(studentRegistration == null){
+        if (studentRegistration == null) {
             throw new Exception("学员信息不存在");
         }
         //当前专业报名人数减一
-        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,studentRegistration.getActualSubjectId(),-1);
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, studentRegistration.getActualSubjectId(), -1);
         //批量调剂(未缴费学员)
         int i = studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
         //修改专业已报名人数
-        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId,subId,1);
+        musicGroupSubjectPlanService.addApplyStudentNum(musicGroupId, subId, 1);
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
         Set<Integer> roleIds = new HashSet<>(2);
         roleIds.add(SysUserRole.SECTION_MANAGER);
         roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
-        sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds),MessageTypeEnum.BACKSTAGE_STUDENT_SUBJECT_CHANGE,"",musicGroup.getName());
+        sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds), MessageTypeEnum.BACKSTAGE_STUDENT_SUBJECT_CHANGE, "", musicGroup.getName());
         return studentRegistrationDao.batchUpdateSubject(userId, subId, musicGroupId);
     }
 
@@ -188,10 +189,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             userId = sysUser.getId();
             //添加用户现金账户
             sysUserCashAccountDao.insert(new SysUserCashAccount(userId, "CNY"));
-			// 添加用户电子签章账户
-			//contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
+            // 添加用户电子签章账户
+            //contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
             //注册到融云
-            if(StringUtils.isEmpty(sysUser.getAvatar())){
+            if (StringUtils.isEmpty(sysUser.getAvatar())) {
                 sysUser.setAvatar(sysConfigDao.findConfigValue(SysConfigService.USER_DEFAULT_HEAD_URL));
             }
             ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
@@ -204,19 +205,19 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         studentRegistration.setUserId(sysUser.getId());
         studentRegistrationDao.insert(studentRegistration);
         //增加报名学生数
-        musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
+        musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(), 1);
         //报名成功后,发送短信
         String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + studentRegistration.getMusicGroupId();
         String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
         Subject subject = subjectDao.get(studentRegistration.getActualSubjectId());
         MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
 
-        Map<Integer,String> map = new HashMap<>(1);
-        map.put(studentRegistration.getUserId(),studentRegistration.getParentsPhone());
+        Map<Integer, String> map = new HashMap<>(1);
+        map.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
         sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
-                MessageTypeEnum.SMS_APPLY_MESSAGE,map,null,0,"",
-                studentRegistration.getParentsName(),subject.getName(), HttpUtil.getSortUrl(studentApplyUrl),
-                DateUtil.format(musicGroup.getApplyExpireDate(),DateUtil.DATE_FORMAT_MIN),serverPhone);
+                MessageTypeEnum.SMS_APPLY_MESSAGE, map, null, 0, "",
+                studentRegistration.getParentsName(), subject.getName(), HttpUtil.getSortUrl(studentApplyUrl),
+                DateUtil.format(musicGroup.getApplyExpireDate(), DateUtil.DATE_FORMAT_MIN), serverPhone);
         return studentRegistration;
     }
 
@@ -304,7 +305,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
         MusicGroupSubjectPlan musicOneSubjectClassPlan = musicGroupSubjectPlanService.getMusicOneSubjectClassPlan(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId());
         int paidNum = musicOneSubjectClassPlan.getPaidStudentNum() == null ? 0 : musicOneSubjectClassPlan.getPaidStudentNum();
         musicOneSubjectClassPlan.setPaidStudentNum(paidNum + 1);
-        if(musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()){
+        if (musicOneSubjectClassPlan.getPaidStudentNum() > musicOneSubjectClassPlan.getExpectedStudentNum()) {
             throw new Exception("乐团人数已满");
         }
         musicGroupSubjectPlanService.update(musicOneSubjectClassPlan);
@@ -430,7 +431,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 //添加用户电子签章账户
                 contractService.register(userId, sysUser.getRealName(), sysUser.getIdCardNo(), sysUser.getPhone());
                 //注册到融云
-                if(StringUtils.isEmpty(sysUser.getAvatar())){
+                if (StringUtils.isEmpty(sysUser.getAvatar())) {
                     sysUser.setAvatar(sysConfigDao.findConfigValue(SysConfigService.USER_DEFAULT_HEAD_URL));
                 }
                 ImResult register = imFeignService.register(new ImUserModel(userId.toString(), sysUser.getUsername(), sysUser.getAvatar()));
@@ -448,7 +449,7 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             MusicGroup musicGroup = musicGroupDao.get(studentRegistration.getMusicGroupId());
             Set<Integer> roleIds = new HashSet<>(1);
             roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
-            sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds),MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT,"",musicGroup.getName(),studentRegistration.getName());
+            sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds), MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_ADD_STUDENT, "", musicGroup.getName(), studentRegistration.getName());
             //增加报名学生数
 //            musicGroupSubjectPlanService.addApplyStudentNum(studentRegistration.getMusicGroupId(), studentRegistration.getSubjectId(),1);
             if (studentRegistration.getClassGroupId() != null) {
@@ -596,15 +597,15 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             sysUserCashAccountDetailService.insert(paymentDetail);
 
             //发送缴费成功通知(短信 + push)
-            Map<Integer,String> map = new HashMap<>(1);
-            map.put(studentPaymentOrder.getUserId(),studentRegistration.getParentsPhone());
+            Map<Integer, String> map = new HashMap<>(1);
+            map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
-                    MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS,map,null,0,"1",
-                    studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
+                    MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1",
+                    studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
             //push
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
-                    MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS,map,null,0,"1",
-                    studentRegistration.getParentsName(),studentPaymentOrder.getActualAmount());
+                    MessageTypeEnum.STUDENT_SMS_PAYMENT_SUCCESS, map, null, 0, "1",
+                    studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
         }
 
         //失败减去已收款金额
@@ -616,10 +617,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
             //发送缴费成功通知(短信 + push)
             String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL + studentRegistration.getMusicGroupId());
 
-            Map<Integer,String> map = new HashMap<>(1);
-            map.put(studentPaymentOrder.getUserId(),studentRegistration.getParentsPhone());
+            Map<Integer, String> map = new HashMap<>(1);
+            map.put(studentPaymentOrder.getUserId(), studentRegistration.getParentsPhone());
             sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI,
-                    MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
+                    MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED, map, null, 0, "1",
                     studentApplyUrl);
 //            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
 //                    MessageTypeEnum.STUDENT_SMS_PAYMENT_FAILED,map,null,0,"1",
@@ -693,4 +694,18 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     public List<Map<Integer, String>> findParentId(String parentPhones) {
         return studentRegistrationDao.findParentId(parentPhones);
     }
+
+    @Override
+    @Transactional
+    public StudentRegistration updateStudent(StudentRegistration studentRegistration) {
+        StudentRegistration student = get(studentRegistration.getId());
+        if (student == null) {
+            throw new BizException("用户注册信息不存在,无法更新");
+        }
+        student.setParentsName(studentRegistration.getParentsName());
+        student.setIdCardNo(studentRegistration.getIdCardNo());
+        update(student);
+        studentRegistrationDao.updateUser(studentRegistration.getUserId(), studentRegistration.getParentsName(), studentRegistration.getIdCardNo());
+        return student;
+    }
 }

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

@@ -500,4 +500,8 @@
     <select id="findMusicGroupStudentNum" resultType="integer">
         SELECT Count(*) FROM student_registration WHERE music_group_id_ = #{musicGroupId} AND payment_status_ = '2'
     </select>
+
+    <update id="updateUser">
+        UPDATE sys_user SET real_name_ = #{realName},id_card_no_=#{idCardNo} WHERE id_=#{id}
+    </update>
 </mapper>

+ 4 - 0
mec-student/src/main/java/com/ym/mec/student/controller/MusicGroupRegisterController.java

@@ -40,6 +40,10 @@ public class MusicGroupRegisterController extends BaseController {
         if (musicGroup == null) {
             return failed("乐团信息不存在");
         }
+        if(studentRegistration.getId() != null){
+            return  succeed(studentRegistrationService.updateStudent(studentRegistration));
+        }
+
         StudentRegistration hasReg = studentRegistrationService.getByPhoneAndMusicGroupId(studentRegistration.getMusicGroupId(), studentRegistration.getParentsPhone());
         if (hasReg != null) {
             return failed("该乐团您已报名");