通知模块、结班证书通知
This commit is contained in:
@@ -9,10 +9,7 @@ import com.peanut.common.utils.R;
|
|||||||
import com.peanut.common.utils.ShiroUtils;
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
import com.peanut.modules.common.dao.ClassExamUserDao;
|
import com.peanut.modules.common.dao.ClassExamUserDao;
|
||||||
import com.peanut.modules.common.entity.*;
|
import com.peanut.modules.common.entity.*;
|
||||||
import com.peanut.modules.common.service.ClassEntityService;
|
import com.peanut.modules.common.service.*;
|
||||||
import com.peanut.modules.common.service.ClassExamUserService;
|
|
||||||
import com.peanut.modules.common.service.MyUserService;
|
|
||||||
import com.peanut.modules.common.service.UserCertificateService;
|
|
||||||
import com.peanut.modules.medical.service.CourseService;
|
import com.peanut.modules.medical.service.CourseService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
@@ -52,7 +49,7 @@ public class ClassController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ClassExamUserService classExamUserService;
|
private ClassExamUserService classExamUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private StringRedisTemplate redisTemplate;
|
private SysNoticeService sysNoticeService;
|
||||||
|
|
||||||
//班级模型列表
|
//班级模型列表
|
||||||
@RequestMapping("/getClassModelList")
|
@RequestMapping("/getClassModelList")
|
||||||
@@ -478,6 +475,7 @@ public class ClassController {
|
|||||||
ClassEntity classEntity = classEntityService.getById(params.get("classId").toString());
|
ClassEntity classEntity = classEntityService.getById(params.get("classId").toString());
|
||||||
List<Map<String,Object>> userScoreList = classEntityService.userScoreList(params);
|
List<Map<String,Object>> userScoreList = classEntityService.userScoreList(params);
|
||||||
for (Map<String, Object> userScoreMap : userScoreList) {
|
for (Map<String, Object> userScoreMap : userScoreList) {
|
||||||
|
MyUserEntity user = (MyUserEntity)userScoreMap.get("user");
|
||||||
if (new BigDecimal(userScoreMap.get("userScore").toString()).compareTo(new BigDecimal(60))>=0){
|
if (new BigDecimal(userScoreMap.get("userScore").toString()).compareTo(new BigDecimal(60))>=0){
|
||||||
UserCertificate userCertificate = new UserCertificate();
|
UserCertificate userCertificate = new UserCertificate();
|
||||||
userCertificate.setTitle(classEntity.getTitle());
|
userCertificate.setTitle(classEntity.getTitle());
|
||||||
@@ -487,12 +485,17 @@ public class ClassController {
|
|||||||
}
|
}
|
||||||
userCertificate.setType(type);
|
userCertificate.setType(type);
|
||||||
userCertificate.setLabelId(5);
|
userCertificate.setLabelId(5);
|
||||||
MyUserEntity user = (MyUserEntity)userScoreMap.get("user");
|
|
||||||
userCertificate.setUserId(user.getId());
|
userCertificate.setUserId(user.getId());
|
||||||
userCertificate.setClassId(classEntity.getId());
|
userCertificate.setClassId(classEntity.getId());
|
||||||
//查询小班下得课程信息
|
//查询小班下得课程信息
|
||||||
|
String noticeContent = "";
|
||||||
List<Map<String,Object>> classCourseInfoLlist = classEntityService.classCourseInfoClassId(classEntity.getId(),0);
|
List<Map<String,Object>> classCourseInfoLlist = classEntityService.classCourseInfoClassId(classEntity.getId(),0);
|
||||||
for (Map<String,Object> classCourseInfo:classCourseInfoLlist){
|
for (Map<String,Object> classCourseInfo:classCourseInfoLlist){
|
||||||
|
if (StringUtils.isEmpty(noticeContent)){
|
||||||
|
noticeContent = classCourseInfo.get("courseTitle").toString();
|
||||||
|
}else {
|
||||||
|
noticeContent += "、"+classCourseInfo.get("courseTitle").toString();
|
||||||
|
}
|
||||||
if (StringUtils.isNotEmpty(classCourseInfo.get("titleAbbr").toString())
|
if (StringUtils.isNotEmpty(classCourseInfo.get("titleAbbr").toString())
|
||||||
&&StringUtils.isNotEmpty(classCourseInfo.get("courseETitle").toString())){
|
&&StringUtils.isNotEmpty(classCourseInfo.get("courseETitle").toString())){
|
||||||
String certificateNo = classEntityService.getNextCertificateNo(type,classCourseInfo.get("titleAbbr").toString());
|
String certificateNo = classEntityService.getNextCertificateNo(type,classCourseInfo.get("titleAbbr").toString());
|
||||||
@@ -523,6 +526,21 @@ public class ClassController {
|
|||||||
R.error("课程未设置英文名或缩写");
|
R.error("课程未设置英文名或缩写");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SysNotice notice = new SysNotice();
|
||||||
|
notice.setUserId(user.getId());
|
||||||
|
if ("A".equals(type)){
|
||||||
|
notice.setContent("您参与的"+classEntity.getTitle()+"小班,已顺利结课,恭喜您," +
|
||||||
|
"获得"+noticeContent+"课程的A证书,在证书管理填写您的相关信息,即可出证啦!");
|
||||||
|
}else {
|
||||||
|
notice.setContent("您参与的"+classEntity.getTitle()+"小班,已顺利结课,恭喜您," +
|
||||||
|
"获得"+noticeContent+"课程的B证书,在证书管理填写您的相关信息,即可出证啦!");
|
||||||
|
}
|
||||||
|
sysNoticeService.save(notice);
|
||||||
|
}else {
|
||||||
|
SysNotice notice = new SysNotice();
|
||||||
|
notice.setUserId(user.getId());
|
||||||
|
notice.setContent("您参与的"+classEntity.getTitle()+"小班已经结束,很遗憾,您未获得课程证书。期待您下次能考出好的成绩!");
|
||||||
|
sysNoticeService.save(notice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.peanut.modules.common.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.peanut.common.utils.R;
|
||||||
|
import com.peanut.common.utils.ShiroUtils;
|
||||||
|
import com.peanut.modules.common.entity.SysNotice;
|
||||||
|
import com.peanut.modules.common.service.SysNoticeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController("commonSysNotice")
|
||||||
|
@RequestMapping("common/sysNotice")
|
||||||
|
public class SysNoticeController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private SysNoticeService sysNoticeService;
|
||||||
|
|
||||||
|
//消息通知列表
|
||||||
|
@RequestMapping("/getSysNotices")
|
||||||
|
public R getSysNotices(){
|
||||||
|
LambdaQueryWrapper<SysNotice> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(SysNotice::getUserId, ShiroUtils.getUId());
|
||||||
|
wrapper.like(SysNotice::getReadFlag,0);
|
||||||
|
return R.ok().put("list",sysNoticeService.list(wrapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
//查看消息通知
|
||||||
|
@RequestMapping("/readSysNotice")
|
||||||
|
public R readSysNotice(@RequestBody Map<String,Object> params){
|
||||||
|
String[] ids = params.get("id").toString().split(",");
|
||||||
|
for (String id : ids) {
|
||||||
|
SysNotice sysNotice = sysNoticeService.getById(id);
|
||||||
|
sysNotice.setReadFlag(1);
|
||||||
|
sysNotice.setUpdateTime(new Date());
|
||||||
|
sysNoticeService.updateById(sysNotice);
|
||||||
|
}
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.peanut.modules.common.dao;
|
||||||
|
|
||||||
|
import com.github.yulichang.base.MPJBaseMapper;
|
||||||
|
import com.peanut.modules.common.entity.SysNotice;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface SysNoticeDao extends MPJBaseMapper<SysNotice> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.peanut.modules.common.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@TableName("sys_notice")
|
||||||
|
public class SysNotice implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
private Integer userId;
|
||||||
|
|
||||||
|
//姓名
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
private Integer readFlag;
|
||||||
|
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@TableLogic
|
||||||
|
private Integer delFlag;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package com.peanut.modules.common.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.peanut.modules.common.entity.SysNotice;
|
||||||
|
|
||||||
|
public interface SysNoticeService extends IService<SysNotice> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.peanut.modules.common.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.peanut.modules.common.dao.SysNoticeDao;
|
||||||
|
import com.peanut.modules.common.entity.SysNotice;
|
||||||
|
import com.peanut.modules.common.service.SysNoticeService;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service("commonSysNoticeService")
|
||||||
|
public class SysNoticeServiceImpl extends ServiceImpl<SysNoticeDao, SysNotice> implements SysNoticeService {
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user