|
@@ -1,54 +1,16 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
-import java.io.IOException;
|
|
|
-import java.math.BigDecimal;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
-
|
|
|
-import com.ym.mec.biz.dal.dao.*;
|
|
|
-import com.ym.mec.biz.dal.dto.*;
|
|
|
-import com.ym.mec.biz.dal.entity.*;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Propagation;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
-
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.auth.api.entity.SysUserRole;
|
|
|
+import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dto.*;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.entity.MusicGroupStudentFee.PaymentStatus;
|
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupStudentStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.ClassGroupTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.CourseStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.GoodsType;
|
|
|
-import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
-import com.ym.mec.biz.dal.enums.KitGroupPurchaseTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.MessageTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.MusicGroupStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.OrderDetailTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.OrderTypeEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PaymentStatusEnum;
|
|
|
-import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
+import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.MusicGroupQueryInfo;
|
|
|
-import com.ym.mec.biz.service.ClassGroupService;
|
|
|
-import com.ym.mec.biz.service.GoodsService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupPaymentCalenderService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectGoodsGroupService;
|
|
|
-import com.ym.mec.biz.service.MusicGroupSubjectPlanService;
|
|
|
-import com.ym.mec.biz.service.PayService;
|
|
|
-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.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.biz.service.*;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
import com.ym.mec.common.entity.ImGroupMember;
|
|
|
import com.ym.mec.common.entity.ImGroupModel;
|
|
@@ -61,6 +23,18 @@ import com.ym.mec.thirdparty.message.MessageSenderPluginContext.MessageSender;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import com.ym.mec.util.http.HttpUtil;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+
|
|
|
+import java.io.IOException;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@Service
|
|
|
public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> implements MusicGroupService {
|
|
@@ -540,19 +514,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String orderSubject = "乐团报名";
|
|
|
- if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)){
|
|
|
- orderSubject = "乐团相关费用";
|
|
|
- }
|
|
|
-
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
Map payMap = payService.getPayMap(
|
|
|
amount,
|
|
|
orderNo,
|
|
|
baseApiUrl + "/api-student/studentOrder/notify",
|
|
|
baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
- orderSubject,
|
|
|
- orderSubject,
|
|
|
+ "乐团报名",
|
|
|
+ "乐团报名",
|
|
|
userId,
|
|
|
classFee,
|
|
|
musicGroup.getOrganId()
|
|
@@ -736,18 +705,14 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String orderSubject = "乐团报名";
|
|
|
- if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType().equals(CooperationOrgan.OwnershipType.COOPERATION)){
|
|
|
- orderSubject = "乐团相关费用";
|
|
|
- }
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
Map payMap = payService.getPayMap(
|
|
|
amount,
|
|
|
orderNo,
|
|
|
baseApiUrl + "/api-student/studentOrder/notify",
|
|
|
baseApiUrl + "/api-student/studentOrder/paymentResult?orderNo=" + orderNo,
|
|
|
- orderSubject,
|
|
|
- orderSubject,
|
|
|
+ "乐团报名",
|
|
|
+ "乐团报名",
|
|
|
userId,
|
|
|
classFee,
|
|
|
musicGroup.getOrganId()
|
|
@@ -944,15 +909,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);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1053,14 +1020,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(), ""));
|
|
@@ -1606,12 +1575,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) {
|
|
@@ -1619,13 +1590,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;
|
|
|
}
|
|
@@ -1864,20 +1838,21 @@ public class MusicGroupServiceImpl extends BaseServiceImpl<String, MusicGroup> i
|
|
|
musicGroup.setPaymentExpireDate(DateUtil.toDate(expireDate));
|
|
|
musicGroup.setStatus(MusicGroupStatusEnum.PAY);
|
|
|
musicGroupDao.update(musicGroup);
|
|
|
-
|
|
|
- //获取所有已报名学员列表
|
|
|
- HashMap<Integer, String> map = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(studentRegistrationDao.findMapByMusicGroupId(musicGroupId, 0))), HashMap.class);
|
|
|
- if (map != null && map.size() > 0) {
|
|
|
- String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
|
|
|
- String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
|
|
|
- sysMessageService.batchSendMessage(MessageSender.YIMEI, MessageTypeEnum.SMS_PAYMENT_MESSAGE,
|
|
|
- map, null, 0, "", musicGroup.getName(), studentApplyUrl, DateUtil.format(musicGroup.getPaymentExpireDate(), DateUtil.DATE_FORMAT_MIN), serverPhone);
|
|
|
+ //三方乐团不发送缴费通知
|
|
|
+ if(musicGroup.getOwnershipType() != null && musicGroup.getOwnershipType() == CooperationOrgan.OwnershipType.OWN){
|
|
|
+ //获取所有已报名学员列表
|
|
|
+ HashMap<Integer,String> map = JSONObject.parseObject(JSONObject.toJSONString(MapUtil.convertMybatisMap(studentRegistrationDao.findMapByMusicGroupId(musicGroupId,0))), HashMap.class);
|
|
|
+ if(map != null && map.size() > 0){
|
|
|
+ String studentApplyUrl = sysConfigDao.findConfigValue(SysConfigService.STUDENT_APPLY_URL) + musicGroupId;
|
|
|
+ String serverPhone = sysConfigDao.findConfigValue(SysConfigService.SERVER_PHONE);
|
|
|
+ sysMessageService.batchSendMessage(MessageSender.YIMEI,MessageTypeEnum.SMS_PAYMENT_MESSAGE,
|
|
|
+ map,null,0,"",musicGroup.getName(),studentApplyUrl,DateUtil.format(musicGroup.getPaymentExpireDate(),DateUtil.DATE_FORMAT_MIN),serverPhone);
|
|
|
+ }
|
|
|
}
|
|
|
Set<Integer> roleIds = new HashSet<>(3);
|
|
|
roleIds.add(SysUserRole.SECTION_MANAGER);
|
|
|
roleIds.add(SysUserRole.EDUCATIONAL_TEACHER);
|
|
|
roleIds.add(SysUserRole.OPERATION_EXECUTIVE);
|
|
|
-
|
|
|
sysMessageService.batchSeoMessage(musicGroupDao.queryUserIdByRoleId(roleIds, musicGroup.getOrganId() + ""), MessageTypeEnum.BACKSTAGE_ACTION_PAYMENT, "", musicGroup.getName());
|
|
|
//所有人开启缴费
|
|
|
studentRegistrationDao.musicGroupOpenPay(musicGroupId, PaymentStatusEnum.OPEN);
|
|
@@ -1947,24 +1922,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());
|
|
|
}
|
|
|
}
|