|
@@ -8,10 +8,13 @@ import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.*;
|
|
|
import com.ym.mec.biz.dal.page.StudentQueryInfo;
|
|
|
import com.ym.mec.biz.service.StudentService;
|
|
|
+import com.ym.mec.biz.service.SysConfigService;
|
|
|
+import com.ym.mec.biz.service.SysMessageService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
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.thirdparty.message.MessageSenderPluginContext;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import com.ym.mec.util.date.DateUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -28,6 +31,8 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
|
|
|
@Autowired
|
|
|
private StudentDao studentDao;
|
|
|
+ @Autowired
|
|
|
+ private TeacherDao teacherDao;
|
|
|
|
|
|
@Autowired
|
|
|
private CourseScheduleStudentPaymentDao courseScheduleStudentPaymentDao;
|
|
@@ -41,6 +46,14 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
@Autowired
|
|
|
private PracticeGroupDao practiceGroupDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private MemberRankSettingDao memberRankSettingDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysConfigDao sysConfigDao;
|
|
|
+ @Autowired
|
|
|
+ private SysMessageService sysMessageService;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<Integer, Student> getDAO() {
|
|
|
return studentDao;
|
|
@@ -362,4 +375,58 @@ public class StudentServiceImpl extends BaseServiceImpl<Integer, Student> implem
|
|
|
public void cleanMember(Integer userId) {
|
|
|
studentDao.cleanMember(userId);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateMemberExperience(String studentIds, Integer rankId, Date endTime) {
|
|
|
+ //会员是否存在
|
|
|
+ MemberRankSetting memberRankSetting = memberRankSettingDao.get(rankId);
|
|
|
+ if(memberRankSetting == null){
|
|
|
+ throw new BizException("会员信息不存在");
|
|
|
+ }
|
|
|
+ if(StringUtils.isEmpty(studentIds)){
|
|
|
+ throw new BizException("请选择学员");
|
|
|
+ }
|
|
|
+ //学员是否有会员
|
|
|
+ int memberNum = studentDao.getMemberNum(studentIds);
|
|
|
+ if(memberNum > 0){
|
|
|
+ throw new BizException("操作失败:所选部分学员已有会员权限");
|
|
|
+ }
|
|
|
+ //最多到10月1号
|
|
|
+ String configValue = sysConfigDao.findConfigValue(SysConfigService.EXPERIENCE_MEMBERSHIP_END_TIME);
|
|
|
+ if(StringUtils.isNotEmpty(configValue)){
|
|
|
+ Date date = DateUtil.stringToDate(configValue, DateUtil.ISO_EXPANDED_DATE_FORMAT);
|
|
|
+ int i = DateUtil.daysBetween(date, endTime);
|
|
|
+ if(i > 0){
|
|
|
+ throw new BizException("操作失败:会员试用期不可超过{}",configValue);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ int i = studentDao.updateMemberExperience(studentIds, rankId, endTime);
|
|
|
+ List<Integer> studentIdList = Arrays.stream(studentIds.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
+ if(studentIdList.size() == i){
|
|
|
+ Map<Integer, String> studentPhoneMap = MapUtil.convertMybatisMap(teacherDao.queryPhoneByIds(studentIds));
|
|
|
+ Map<Integer,String> userMap = new HashMap<>(studentIdList.size());
|
|
|
+ Map<Integer,String> userMap1 = new HashMap<>(studentIdList.size());
|
|
|
+ for (Integer studentId : studentIdList) {
|
|
|
+ userMap.put(studentId,studentPhoneMap.get(studentId));
|
|
|
+ userMap1.put(studentId,studentId.toString());
|
|
|
+ }
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.AWSMS,
|
|
|
+ MessageTypeEnum.PUSH_EXPERIENCE_MEMBERSHIP_MESSAGE,
|
|
|
+ userMap,
|
|
|
+ null,
|
|
|
+ 0,
|
|
|
+ null,
|
|
|
+ null);
|
|
|
+
|
|
|
+ sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG,
|
|
|
+ MessageTypeEnum.PUSH_EXPERIENCE_MEMBERSHIP_MESSAGE,
|
|
|
+ userMap1,
|
|
|
+ null,
|
|
|
+ 0,
|
|
|
+ null,
|
|
|
+ "STUDENT");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|