瀏覽代碼

Merge branch 'master' into yonge

# Conflicts:
#	mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java
yonge 5 年之前
父節點
當前提交
322d738182

+ 54 - 44
mec-biz/src/main/java/com/ym/mec/biz/service/impl/MusicGroupServiceImpl.java

@@ -946,15 +946,17 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
     @Override
     public void pushMessage(String musicGroupId) throws IOException {
         MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
-        //3.0发送该消息
-        if (new Integer(3).equals(musicGroup.getChargeTypeId())) {
-            Map<Integer, String> studentMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(studentRegistrationDao.findIdMapByMusicGroupId(musicGroupId, 2))), HashMap.class);
-            if (studentMap != null && studentMap.size() > 0) {
-                String baseURL = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-                String url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId;
-                String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
-                sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE,
-                        studentMap, null, 0, "5?" + url, musicGroup.getName(), HttpUtil.getSortUrl(url), serverPhone);
+        if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
+            //3.0发送该消息
+            if (new Integer(3).equals(musicGroup.getChargeTypeId())) {
+                Map<Integer, String> studentMap = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(studentRegistrationDao.findIdMapByMusicGroupId(musicGroupId, 2))), HashMap.class);
+                if (studentMap != null && studentMap.size() > 0) {
+                    String baseURL = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+                    String url = baseURL + "/#/smallRegister?musicGroupId=" + musicGroupId;
+                    String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
+                    sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE,
+                            studentMap, null, 0, "5?" + url, musicGroup.getName(), HttpUtil.getSortUrl(url), serverPhone);
+                }
             }
         }
     }
@@ -1055,14 +1057,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                     + musicGroupId, "", PlatformCashAccountDetailTypeEnum.REFUNDS, null, DealStatusEnum.SUCCESS, "取消乐团");
         }
         //获取当前乐团所有已报名学员
-        List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroupId, null);
-        if (registrations != null && registrations.size() > 0) {
-            Map<Integer, String> map = new HashMap<>(registrations.size());
-            registrations.forEach(e -> {
-                map.put(e.getUserId(), e.getUserId().toString());
-            });
-            sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_CLOSE,
-                    map, null, 0, "1", musicGroup.getName(), sysConfigDao.findConfigValue(SysConfigService.REFUND_PERIOD));
+        if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
+            List<StudentRegistration> registrations = studentRegistrationDao.findClassGroupStu(musicGroupId, null);
+            if (registrations != null && registrations.size() > 0) {
+                Map<Integer, String> map = new HashMap<>(registrations.size());
+                registrations.forEach(e -> {
+                    map.put(e.getUserId(), e.getUserId().toString());
+                });
+                sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_CLOSE,
+                        map, null, 0, "1", musicGroup.getName(), sysConfigDao.findConfigValue(SysConfigService.REFUND_PERIOD));
+            }
         }
         //记录建团日志
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, "取消乐团", sysUser.getId(), ""));
@@ -1608,12 +1612,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
             paymentDetail.setComAmount(studentPaymentOrder.getComAmount().negate());
             paymentDetail.setPerAmount(studentPaymentOrder.getPerAmount().negate());
             sysUserCashAccountDetailService.insert(paymentDetail);
-
-            // 发送续费结果通知
-            sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, push, null, 0, "1",
-                    studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
-            sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, yimei, null, 0, "1",
-                    studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
+            MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+            if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
+                // 发送续费结果通知
+                sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, push, null, 0, "1",
+                        studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
+                sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.STUDENT_SMS_MUSIC_GROUP_RENEW_SUCCESS, yimei, null, 0, "1",
+                        studentRegistration.getParentsName(), studentPaymentOrder.getActualAmount());
+            }
             return true;
         } else {
             if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().doubleValue() > 0) {
@@ -1621,13 +1627,16 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
                         "乐团续费失败");
             }
         }
-        if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
-            String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
-            String memo = baseUrl + "/#/renew?musicGroupId=" + musicGroupId;
-            //4?http://mstudev.dayaedu.com/#/renew?musicGroupId=" +musicGroupId
-            sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED, push, null, 0, "4?" + memo,
-                    HttpUtil.getSortUrl(memo));
-            return false;
+        MusicGroup musicGroup = musicGroupDao.get(musicGroupId);
+        if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
+            if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
+                String baseUrl = sysConfigDao.findConfigValue(SysConfigService.BASE_API_URL);
+                String memo = baseUrl + "/#/renew?musicGroupId=" + musicGroupId;
+                //4?http://mstudev.dayaedu.com/#/renew?musicGroupId=" +musicGroupId
+                sysMessageService.batchSendMessage(MessageSender.JIGUANG, MessageTypeEnum.STUDENT_PUSH_MUSIC_GROUP_RENEW_FAILED, push, null, 0, "4?" + memo,
+                        HttpUtil.getSortUrl(memo));
+                return false;
+            }
         }
         return false;
     }
@@ -1951,24 +1960,25 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
         musicGroupBuildLogDao.insert(new MusicGroupBuildLog(musicGroupId, event, sysUser.getId(), ""));
         musicGroup.setStatus(MusicGroupStatusEnum.PREPARE);
         musicGroupDao.update(musicGroup);
-        //给家长发送乐团基础训练课短信
-        //获取所有乐团学员列表
-        List<StudentRegistration> students = studentRegistrationDao.queryStudentByMusicGroupId(musicGroupId);
-        if (students != null && students.size() > 0) {
-            // 获取所有家长电话
-            Set<String> parentsPhones = students.stream().map(StudentRegistration::getParentsPhone).collect(Collectors.toSet());
-            // 获取对应家长的用户编号
-            Map<Integer, String> userIds = MapUtil.convertMybatisMap(studentRegistrationDao.findParentId(StringUtils.join(parentsPhones, ",")));
-            userIds = JSONObject.parseObject(JSONObject.toJSONString(userIds), HashMap.class);
-            if (userIds != null && userIds.size() > 0) {
-                String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
-                String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
-                sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE, userIds, null, 0, "", musicGroup.getName(), studentApplyUrl, serverPhone);
+        if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
+            //给家长发送乐团基础训练课短信
+            //获取所有乐团学员列表
+            List<StudentRegistration> students = studentRegistrationDao.queryStudentByMusicGroupId(musicGroupId);
+            if (students != null && students.size() > 0) {
+                // 获取所有家长电话
+                Set<String> parentsPhones = students.stream().map(StudentRegistration::getParentsPhone).collect(Collectors.toSet());
+                // 获取对应家长的用户编号
+                Map<Integer, String> userIds = MapUtil.convertMybatisMap(studentRegistrationDao.findParentId(StringUtils.join(parentsPhones, ",")));
+                userIds = JSONObject.parseObject(JSONObject.toJSONString(userIds), HashMap.class);
+                if (userIds != null && userIds.size() > 0) {
+                    String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
+                    String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
+                    sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.SMS_BASICS_SKILL_APPLY_MESSAGE, userIds, null, 0, "", musicGroup.getName(), studentApplyUrl, serverPhone);
+                }
             }
         }
         Set<Integer> roleIds = new HashSet<>(1);
         roleIds.add(SysUserRole.SECTION_MANAGER);
-
         sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds,musicGroup.getOrganId()),MessageTypeEnum.BACKSTAGE_MUSIC_GROUP_MARKING,"",musicGroup.getName());
     }
 }

+ 10 - 8
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -652,14 +652,16 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 e.setPaymentOrderId(studentPaymentOrder.getId());
             });
             studentPaymentOrderDetailService.batchAdd(studentPaymentOrderDetails);
-            Map<Integer, String> receivers = new HashMap<>(1);
-            receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
-            if (reduce == BigDecimal.ZERO) {
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT_FREE,
-                        receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName());
-            }else {
-                String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
-                sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
+            if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
+                Map<Integer, String> receivers = new HashMap<>(1);
+                receivers.put(studentRegistration.getUserId(), studentRegistration.getParentsPhone());
+                if (reduce == BigDecimal.ZERO) {
+                    sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT_FREE,
+                            receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName());
+                }else {
+                    String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
+                    sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.SMS_MUSIC_GROUP_ADD_STUDENT,receivers, null, 0, null, studentRegistration.getParentsName(), studentRegistration.getName(), musicGroup.getName(),HttpUtil.getSortUrl(studentApplyUrl));
+                }
             }
             return userId;
         }