Commit c4710bba by 涂亚平

2.2.1上线了。。。。

1 parent e58aafd0
...@@ -50,7 +50,7 @@ public class ClassNoticeController { ...@@ -50,7 +50,7 @@ public class ClassNoticeController {
} }
@PostMapping("queryClassNotices") @PostMapping("queryClassNotices")
@ApiOperation("查看某个课程的通知提醒 classId 课程id noticeType 状态(待发送/已发送)") @ApiOperation("查看某个课程的通知提醒 classId 课程id status 状态(待发送/已发送)")
public ResponseVO queryClassNotices(@RequestBody ClassNoticeDO classNoticeDO){ public ResponseVO queryClassNotices(@RequestBody ClassNoticeDO classNoticeDO){
return ResponseData.generateCreatedResponse(0,classNoticeService.queryClassNotices(classNoticeDO)); return ResponseData.generateCreatedResponse(0,classNoticeService.queryClassNotices(classNoticeDO));
} }
......
...@@ -41,5 +41,9 @@ public class ClassNoticeDO extends BaseModel { ...@@ -41,5 +41,9 @@ public class ClassNoticeDO extends BaseModel {
*/ */
private String noticeTime; private String noticeTime;
/**
* 发送状态
*/
private String status;
} }
...@@ -133,7 +133,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C ...@@ -133,7 +133,7 @@ public class ClassHourDictServiceImpl extends ServiceImpl<ClassHourDictMapper, C
if (classHourDictDO == null) { if (classHourDictDO == null) {
pollingGetVO.setBool(true); pollingGetVO.setBool(true);
} else { } else {
if (total + vodPlayHistoryDO.getPlayLength() <= classHourDictDO.getClassHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() < classHourDictDO.getClassHour() * 3600) {
pollingGetVO.setBool(false); pollingGetVO.setBool(false);
} else { } else {
pollingGetVO.setBool(true); pollingGetVO.setBool(true);
......
...@@ -22,7 +22,6 @@ import com.subsidy.vo.classdict.ClassAndCompanyInfoVO; ...@@ -22,7 +22,6 @@ import com.subsidy.vo.classdict.ClassAndCompanyInfoVO;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -51,18 +50,19 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class ...@@ -51,18 +50,19 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String addNotice(ClassNoticeDO classNoticeDO) { public String addNotice(ClassNoticeDO classNoticeDO) {
if (DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd HH").before(new Date())) { if(DateFormatUtil.parse(classNoticeDO.getNoticeTime(),"yyyy-MM-dd HH").before(new Date())) {
throw new HttpException(70001); throw new HttpException(70001);
} }
classNoticeDO.setStatus(CourseNotification.UNSENT);
this.baseMapper.insert(classNoticeDO); this.baseMapper.insert(classNoticeDO);
ClassDictDO classDictDO = classDictMapper.selectById(classNoticeDO.getClassId()); ClassDictDO classDictDO = classDictMapper.selectById(classNoticeDO.getClassId());
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("classId", classNoticeDO.getClassId()); params.put("classId", classNoticeDO.getClassId());
params.put("id", classNoticeDO.getId()); params.put("id", classNoticeDO.getId());
String name = classDictDO.getClassName() + "-" + classNoticeDO.getNoticeType() + "-" + classNoticeDO.getNoticeTime(); String name = classDictDO.getClassName()+"-"+classNoticeDO.getNoticeType()+"-"+classNoticeDO.getNoticeTime();
quartzUtil.addSimpleJob(CourseNotificationJob.class, DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd HH:mm:ss"), params, name, "CourseNotificationJob"); quartzUtil.addSimpleJob(CourseNotificationJob.class,DateFormatUtil.parse(classNoticeDO.getNoticeTime(), "yyyy-MM-dd HH:mm:ss") , params, name, "CourseNotificationJob");
return ConstantUtils.ADD_SUCCESS; return ConstantUtils.ADD_SUCCESS;
} }
...@@ -78,41 +78,41 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class ...@@ -78,41 +78,41 @@ public class ClassNoticeServiceImpl extends ServiceImpl<ClassNoticeMapper, Class
this.baseMapper.deleteById(classNoticeDO.getId()); this.baseMapper.deleteById(classNoticeDO.getId());
ClassDictDO classDictDO = classDictMapper.selectById(noticeDO.getClassId()); ClassDictDO classDictDO = classDictMapper.selectById(noticeDO.getClassId());
String name = classDictDO.getClassName() + "-" + noticeDO.getNoticeType() + "-" + noticeDO.getNoticeTime(); String name = classDictDO.getClassName()+"-"+noticeDO.getNoticeType()+"-"+noticeDO.getNoticeTime();
quartzUtil.deleteJob(name, "CourseNotificationJob"); quartzUtil.deleteJob(name, "CourseNotificationJob");
return ConstantUtils.DELETE_SUCCESS; return ConstantUtils.DELETE_SUCCESS;
} }
public List<ClassNoticeDO> queryClassNotices(ClassNoticeDO classNoticeDO) { public List<ClassNoticeDO> queryClassNotices(ClassNoticeDO classNoticeDO){
return this.baseMapper.selectList(new QueryWrapper<ClassNoticeDO>() return this.baseMapper.selectList(new QueryWrapper<ClassNoticeDO>()
.lambda() .lambda()
.eq(ClassNoticeDO::getNoticeType, classNoticeDO.getNoticeType()) .eq(ClassNoticeDO::getStatus, classNoticeDO.getStatus())
.eq(ClassNoticeDO::getClassId, classNoticeDO.getClassId())); .eq(ClassNoticeDO::getClassId,classNoticeDO.getClassId()));
} }
@Override @Override
public void sendNotification(SendNotificationDTO sendNotificationDTO) { public void sendNotification(SendNotificationDTO sendNotificationDTO) {
ClassAndCompanyInfoVO cmInfo = classDictMapper.getClassAndCompanyInfoVO(sendNotificationDTO.getClassId()); ClassAndCompanyInfoVO cmInfo = classDictMapper.getClassAndCompanyInfoVO(sendNotificationDTO.getClassId());
if (sendNotificationDTO.getSendType().equals(SmsCode.ALL.getType())) { if(sendNotificationDTO.getSendType().equals(SmsCode.ALL.getType())) {
String params = "{\"company\":\"" + cmInfo.getCompany() + "\", \"course\":\"" + cmInfo.getCourseName() + "\", \"startDate\": \"" + cmInfo.getStartDate() + "\", \"endDate\": \"" + cmInfo.getEndDate() + "\"}"; String params = "{\"company\":\""+ cmInfo.getCompany() +"\", \"course\":\""+ cmInfo.getCourseName() +"\", \"startDate\": \""+ cmInfo.getStartDate()+"\", \"endDate\": \""+ cmInfo.getEndDate()+"\"}";
List<MemberDO> list = memberMapper.getMemberList(sendNotificationDTO.getClassId()); List<MemberDO> list = memberMapper.getMemberList(sendNotificationDTO.getClassId());
if (list != null) { if(list != null) {
for (MemberDO memberDO : list) { for (MemberDO memberDO : list) {
SMSUtils.sendNoticeSMS(SmsCode.ALL.getCode(), memberDO.getTelephone(), params); SMSUtils.sendNoticeSMS(SmsCode.ALL.getCode(), memberDO.getTelephone(), params);
} }
} }
} else if (sendNotificationDTO.getSendType().equals(SmsCode.NOT_SIGNED_IN.getType())) { } else if(sendNotificationDTO.getSendType().equals(SmsCode.NOT_SIGNED_IN.getType())) {
String params = "{ \"name\": \"" + cmInfo.getName() + "\", \"course\":\"" + cmInfo.getCourseName() + "\"}"; String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}";
List<MemberDO> list = memberMapper.getMemberListBySignInRecord(sendNotificationDTO.getClassId()); List<MemberDO> list = memberMapper.getMemberListBySignInRecord(sendNotificationDTO.getClassId());
if (list != null) { if(list != null) {
for (MemberDO memberDO : list) { for (MemberDO memberDO : list) {
SMSUtils.sendNoticeSMS(SmsCode.NOT_SIGNED_IN.getCode(), memberDO.getTelephone(), params); SMSUtils.sendNoticeSMS(SmsCode.NOT_SIGNED_IN.getCode(), memberDO.getTelephone(), params);
} }
} }
} else if (sendNotificationDTO.getSendType().equals(SmsCode.UNFINISHED.getType())) { } else if(sendNotificationDTO.getSendType().equals(SmsCode.UNFINISHED.getType())) {
String params = "{ \"name\": \"" + cmInfo.getName() + "\", \"course\":\"" + cmInfo.getCourseName() + "\"}"; String params = "{ \"name\": \""+ cmInfo.getName() +"\", \"course\":\""+ cmInfo.getCourseName()+"\"}";
List<MemberDO> list = memberMapper.getUnfinishedMemberList(sendNotificationDTO.getClassId()); List<MemberDO> list = memberMapper.getUnfinishedMemberList(sendNotificationDTO.getClassId());
if (list != null) { if(list != null) {
for (MemberDO memberDO : list) { for (MemberDO memberDO : list) {
SMSUtils.sendNoticeSMS(SmsCode.UNFINISHED.getCode(), memberDO.getTelephone(), params); SMSUtils.sendNoticeSMS(SmsCode.UNFINISHED.getCode(), memberDO.getTelephone(), params);
} }
......
...@@ -71,6 +71,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -71,6 +71,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//是否超过时长 没超过 false 超过 true //是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour()*3600-total;
vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
throw new HttpException(13001); throw new HttpException(13001);
} }
} }
...@@ -92,6 +95,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper, ...@@ -92,6 +95,9 @@ public class VodPlayHistoryServiceImpl extends ServiceImpl<VodPlayHistoryMapper,
//是否超过时长 没超过 false 超过 true //是否超过时长 没超过 false 超过 true
if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) { if (total + vodPlayHistoryDO.getPlayLength() >= classHourDictDO.getClassHour() * 3600) {
int playLength = classHourDictDO.getClassHour()*3600-total;
vodPlayHistoryDO.setPlayLength(playLength);
this.baseMapper.insert(vodPlayHistoryDO);
throw new HttpException(13001); throw new HttpException(13001);
} }
} }
......
# 环境配置 # 环境配置
spring.profiles.active=prod spring.profiles.active=dev
# 端口号 # 端口号
spring.server.port=23459 spring.server.port=23457
#嵌入tomcat配置 #嵌入tomcat配置
#和CPU数 #和CPU数
spring.server.acceptorThreadCount=600 spring.server.acceptorThreadCount=600
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!