mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-15 22:06:50 +08:00
Merge branch 'master' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers
# Conflicts: # servers/boe-server-all/src/main/resources/application-pre.properties # servers/boe-server-all/src/main/resources/application-pro.properties
This commit is contained in:
@@ -8,8 +8,8 @@ import javax.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xboe.core.SysConstant;
|
||||
import com.xboe.core.utils.OkHttpUtil;
|
||||
import com.xboe.module.assistance.service.IEmailService;
|
||||
|
||||
@@ -42,23 +42,31 @@ public class EmailServiceImpl implements IEmailService {
|
||||
// $r = TNetworkHelper::HttpPost($url, $arr);
|
||||
// var_dump($r);
|
||||
// }
|
||||
private static final String PostUrl="https://u-pre.boe.com/api/b1/email/send";
|
||||
//private static final String PostUrl="https://u-pre.boe.com/api/b1/email/send";
|
||||
|
||||
@Override
|
||||
public void sendMail(String to, String subject, String htmlMsg, String from) throws Exception {
|
||||
|
||||
String cfgUrl=SysConstant.getConfigValue("xboe.email.url");
|
||||
if(StringUtils.isBlank(cfgUrl)) {
|
||||
throw new Exception("发送邮件失败,未配置邮件信息");
|
||||
}
|
||||
String cfgFrom=SysConstant.getConfigValue("xboe.email.from","boeu_learning@boe.com.cn");
|
||||
String cfgUser=SysConstant.getConfigValue("xboe.email.user");
|
||||
String cfgWord=SysConstant.getConfigValue("xboe.email.security");
|
||||
|
||||
Map<String,Object> data=new HashMap<String,Object>();
|
||||
data.put("to",to);
|
||||
data.put("subject",subject);
|
||||
data.put("content", htmlMsg);
|
||||
data.put("fromName", "boeu_learning@boe.com.cn");
|
||||
data.put("fromName", cfgFrom);
|
||||
data.put("cc", "");
|
||||
data.put("type", 0);
|
||||
ObjectMapper mapper=new ObjectMapper();
|
||||
String json=mapper.writeValueAsString(data);
|
||||
|
||||
String[] headers=new String[] {"Content-Type","application/json","Host","u.boe.com"};
|
||||
String rs=httpUtil.doPostJson(PostUrl,json,headers);
|
||||
String rs=httpUtil.doPostJson(cfgUrl,json,headers);
|
||||
//System.out.println(mailInfo.toString());
|
||||
//System.out.println(rs);
|
||||
if(StringUtils.isNotBlank(rs)) {
|
||||
|
||||
@@ -42,6 +42,7 @@ import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.entity.CourseUpdateLog;
|
||||
import com.xboe.module.course.service.ICourseContentService;
|
||||
import com.xboe.module.course.service.ICourseCrowdService;
|
||||
import com.xboe.module.course.service.ICourseHRBPAuditService;
|
||||
import com.xboe.module.course.service.ICourseSectionService;
|
||||
import com.xboe.module.course.service.ICourseService;
|
||||
import com.xboe.module.course.service.ICourseTeacherService;
|
||||
@@ -94,6 +95,9 @@ public class CourseManageApi extends ApiBaseController{
|
||||
@Resource
|
||||
private IUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ICourseHRBPAuditService hrbpAuditService;
|
||||
|
||||
/**
|
||||
* 管理列表的查询
|
||||
* @param pager
|
||||
@@ -430,12 +434,13 @@ public class CourseManageApi extends ApiBaseController{
|
||||
// }
|
||||
// }
|
||||
//检查课程内容的完整性
|
||||
|
||||
|
||||
//填充必要的信息
|
||||
//fillCourseData(dto.getCourse());
|
||||
|
||||
try {
|
||||
CourseHRBPAudit hrbpAudit = hrbpAuditService.hasAuditing(dto.getCourse().getId());
|
||||
if(hrbpAudit!=null) {
|
||||
return badRequest("此课程中已有审核,不能再提交审核,如修改请先撤回");
|
||||
}
|
||||
if(!isLocalDevelopment()) {
|
||||
//转化用户id
|
||||
User u = userService.getByUserNo(dto.getAuditUser().getCode());
|
||||
@@ -468,8 +473,10 @@ public class CourseManageApi extends ApiBaseController{
|
||||
//邮件发送
|
||||
String email=dto.getAuditUser().getEmail();
|
||||
if(!isLocalDevelopment()) {
|
||||
//只是非高度模式下才可以发送
|
||||
//只是非开发模式下才可以发送
|
||||
service.sendMail(email,"课程审核提醒", htmlEmail,"数字化学习平台");
|
||||
}else {
|
||||
//service.sendMail("daihaixing@bjxask.com","课程审核提醒", htmlEmail,"数字化学习平台");
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
@@ -536,6 +543,10 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
|
||||
try {
|
||||
CourseHRBPAudit hrbpAudit = hrbpAuditService.hasAuditing(audit.getCourseId());
|
||||
if(hrbpAudit!=null) {
|
||||
return badRequest("此课程中已有审核,不能再提交审核,如修改请先撤回");
|
||||
}
|
||||
|
||||
if(!isLocalDevelopment()) {
|
||||
//转化用户id
|
||||
|
||||
@@ -22,6 +22,13 @@ public interface ICourseHRBPAuditService {
|
||||
* */
|
||||
//void audit(String id,Integer status,String remark);
|
||||
|
||||
/**
|
||||
* 检查课程是否已经在审核中了
|
||||
* @param courseId
|
||||
* @return
|
||||
*/
|
||||
CourseHRBPAudit hasAuditing(String courseId);
|
||||
|
||||
/**
|
||||
* 根据课程、id获取课程的审核记录
|
||||
* @param info 审核信息
|
||||
|
||||
@@ -12,7 +12,6 @@ import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.core.orm.FieldFilters;
|
||||
import com.xboe.core.orm.QueryBuilder;
|
||||
import com.xboe.core.orm.UpdateBuilder;
|
||||
import com.xboe.module.course.dao.CourseHRBPAuditDao;
|
||||
import com.xboe.module.course.dto.CourseHRBPAuditDto;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
@@ -158,4 +157,11 @@ public class CourseHRBPAuditServiceImpl implements ICourseHRBPAuditService {
|
||||
return rs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CourseHRBPAudit hasAuditing(String courseId) {
|
||||
//未审核的
|
||||
CourseHRBPAudit hrbp = courseHRBPAuditDao.findOne(FieldFilters.eq("courseId", courseId),FieldFilters.eq("status", 1));
|
||||
return hrbp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -603,6 +603,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
public void submit(CourseFullDto full) throws Exception {
|
||||
|
||||
Course c=full.getCourse();//当前的课程信息
|
||||
//提交审核,不再记录修改日志
|
||||
// Course nowCourse=courseDao.get(c.getId());//修改之前的课程信息
|
||||
// //审核不保存日志了
|
||||
// StringBuffer stringBuffer = new StringBuffer("[");
|
||||
@@ -625,21 +626,21 @@ public class CourseServiceImpl implements ICourseService {
|
||||
full.getCourse().setSysVersion(c.getSysVersion());
|
||||
|
||||
//先清空教师信息, 教师信息如果不一样了,也要加入到日志中
|
||||
// courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
// if(full.getTeachers()!=null && !full.getTeachers().isEmpty()) {
|
||||
// for(CourseTeacher ct : full.getTeachers()) {
|
||||
// ct.setCourseId(c.getId());
|
||||
// courseTeacherDao.saveOrUpdate(ct);
|
||||
// }
|
||||
// }
|
||||
// //先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
// courseCrowdDao.deleteByField("courseId", c.getId());
|
||||
// if(full.getCrowds()!=null && !full.getCrowds().isEmpty()) {
|
||||
// for(CourseCrowd cc : full.getCrowds()) {
|
||||
// cc.setCourseId(c.getId());
|
||||
// courseCrowdDao.saveOrUpdate(cc);
|
||||
// }
|
||||
// }
|
||||
courseTeacherDao.deleteByField("courseId", c.getId());
|
||||
if(full.getTeachers()!=null && !full.getTeachers().isEmpty()) {
|
||||
for(CourseTeacher ct : full.getTeachers()) {
|
||||
ct.setCourseId(c.getId());
|
||||
courseTeacherDao.saveOrUpdate(ct);
|
||||
}
|
||||
}
|
||||
//先清空受众信息,受众信息如果不一样了,也要加入到日志中
|
||||
courseCrowdDao.deleteByField("courseId", c.getId());
|
||||
if(full.getCrowds()!=null && !full.getCrowds().isEmpty()) {
|
||||
for(CourseCrowd cc : full.getCrowds()) {
|
||||
cc.setCourseId(c.getId());
|
||||
courseCrowdDao.saveOrUpdate(cc);
|
||||
}
|
||||
}
|
||||
//保存审核信息
|
||||
CourseHRBPAudit hrbpAudit=new CourseHRBPAudit();
|
||||
hrbpAudit.setCourseId(c.getId());
|
||||
|
||||
@@ -35,4 +35,9 @@ public class StudyCourseSimple {
|
||||
private String sysType3;
|
||||
|
||||
private String aid;
|
||||
|
||||
/**
|
||||
* 删除标识
|
||||
*/
|
||||
private Boolean deleted;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
@@ -417,7 +419,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
@Override
|
||||
public List<StudyCourseSimple> followids(StudyCourseQuery studyCourseQuery) {
|
||||
//分两次查询,查询课程,查询学习记录
|
||||
String courseHql="Select id,coverImg,score,name,sysType1,sysType2,sysType3 from "+Course.class.getSimpleName()+" where id in(?1)";
|
||||
String courseHql="Select id,coverImg,score,name,sysType1,sysType2,sysType3,deleted from "+Course.class.getSimpleName()+" where id in(?1)";
|
||||
String studyHql="Select courseId,addTime,progress,aid from "+StudyCourse.class.getSimpleName()+" where aid in(?1) and courseId in(?2)";
|
||||
|
||||
List<StudyCourseSimple> rs=new ArrayList<>();
|
||||
@@ -425,6 +427,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
List<Object[]> clist= studyCourseDao.findListFields(courseHql,studyCourseQuery.getIds());
|
||||
List<Object[]> slist= studyCourseDao.findListFields(studyHql,studyCourseQuery.getAids(),studyCourseQuery.getIds());
|
||||
//数据数量一般不会太多,不超过20条,所以直接使用嵌套循环
|
||||
Map<String,Object> map=new HashMap<String,Object>();
|
||||
for(Object[] sobjs : slist) {
|
||||
StudyCourseSimple sc=new StudyCourseSimple();
|
||||
sc.setCourseId(ConvertUtil.toStr(sobjs[0]));
|
||||
@@ -441,6 +444,7 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
sc.setSysType1(ConvertUtil.toStr(cobjs[4]));
|
||||
sc.setSysType2(ConvertUtil.toStr(cobjs[5]));
|
||||
sc.setSysType3(ConvertUtil.toStr(cobjs[6]));
|
||||
sc.setDeleted(ConvertUtil.toBool(cobjs[7]));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -449,6 +453,33 @@ public class StudyCourseServiceImpl implements IStudyCourseService{
|
||||
}
|
||||
rs.add(sc);
|
||||
}
|
||||
//检查针对于没有学习记录的课程
|
||||
for(Object[] cobjs : clist) {
|
||||
String cid=ConvertUtil.toStr(cobjs[0]);
|
||||
boolean has=false;
|
||||
for(StudyCourseSimple scs : rs) {
|
||||
if(scs.getCourseId().equals(cid)) {
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!has) {
|
||||
StudyCourseSimple sc=new StudyCourseSimple();
|
||||
sc.setCourseId(cid);
|
||||
sc.setProgress(0f);
|
||||
sc.setAid("");
|
||||
sc.setCourseImage(ConvertUtil.toStr(cobjs[1]));
|
||||
sc.setLastScore(ConvertUtil.toFloat(cobjs[2]));//课程分数,使用此值来承载
|
||||
sc.setCourseName(ConvertUtil.toStr(cobjs[3]));
|
||||
sc.setSysType1(ConvertUtil.toStr(cobjs[4]));
|
||||
sc.setSysType2(ConvertUtil.toStr(cobjs[5]));
|
||||
sc.setSysType3(ConvertUtil.toStr(cobjs[6]));
|
||||
sc.setDeleted(ConvertUtil.toBool(cobjs[7]));
|
||||
rs.add(sc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}catch(Exception e) {
|
||||
log.error("查询错误",e);
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.xboe.constants.Constants;
|
||||
import com.xboe.core.IAuthorizationToken;
|
||||
import com.xboe.core.JsonResponse;
|
||||
import com.xboe.core.api.ApiBaseController;
|
||||
import com.xboe.core.event.IEventDataSender;
|
||||
import com.xboe.system.logs.entity.SysLogLogin;
|
||||
import com.xboe.system.logs.service.ISysLogLoginService;
|
||||
import com.xboe.system.user.entity.SysManager;
|
||||
@@ -61,6 +62,9 @@ public class SysLoginApi extends ApiBaseController {
|
||||
|
||||
@Autowired
|
||||
StringRedisTemplate redisTemplate;
|
||||
|
||||
@Autowired(required = false)
|
||||
private IEventDataSender eventSender;
|
||||
|
||||
@GetMapping("/captcha")
|
||||
public JsonResponse<Map<String, String>> captcha() {
|
||||
@@ -76,6 +80,24 @@ public class SysLoginApi extends ApiBaseController {
|
||||
map.put("image", specCaptcha.toBase64());
|
||||
return success(map);
|
||||
}
|
||||
|
||||
@GetMapping("/login/send")
|
||||
public JsonResponse<Map<String, String>> sendMessage() {
|
||||
Map<String, String> rs=new HashMap<String, String>();
|
||||
|
||||
if(eventSender!=null) {
|
||||
try {
|
||||
eventSender.send("测试消息","keykey", "all测试消息","1231231", "1", "aaaa", "asdqadqw","wqwrqre","");
|
||||
}catch(Exception e) {
|
||||
e.printStackTrace();
|
||||
return error("发送失败"+e.getMessage());
|
||||
}
|
||||
}else {
|
||||
//log.error();
|
||||
return error("未配置事件消息发送的实现");
|
||||
}
|
||||
return success(rs);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户名和密码登录
|
||||
|
||||
@@ -70,6 +70,7 @@ public class OrganizationServiceImpl implements IOrganizationService {
|
||||
|
||||
QueryBuilder qb = QueryBuilder.from(Organization.class);
|
||||
qb.addFilter(FieldFilters.eq("deleted", false));
|
||||
qb.addFilter(FieldFilters.eq("status", 1));
|
||||
|
||||
if (StringUtil.isNotBlank(parentId)) {
|
||||
if(parentId.equals("-1")) {
|
||||
|
||||
@@ -9,7 +9,7 @@ spring.jpa.show-sql = true
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.url=jdbc:mysql://192.168.0.11:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
@@ -52,11 +52,17 @@ jasypt.encryptor.algorithm=PBEWithMD5AndDES
|
||||
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
|
||||
# elasticsearch config
|
||||
xboe.elasticsearch.server.ip=192.168.0.11
|
||||
xboe.elasticsearch.server.ip=127.0.0.1
|
||||
xboe.elasticsearch.server.port=9200
|
||||
xboe.elasticsearch.server.user=
|
||||
xboe.elasticsearch.server.password=
|
||||
# 默认搜索的索引
|
||||
xboe.elasticsearch.index.name=new_resource_list
|
||||
|
||||
## 邮件的配置
|
||||
xboe.email.url=https://u-pre.boe.com/api/b1/email/send
|
||||
xboe.email.from=boeu_learning@boe.com.cn
|
||||
xboe.email.user=
|
||||
xboe.email.security=
|
||||
|
||||
|
||||
|
||||
@@ -48,3 +48,9 @@ xboe.elasticsearch.server.ip=10.251.129.21
|
||||
xboe.elasticsearch.server.port=9200
|
||||
xboe.elasticsearch.server.user=
|
||||
xboe.elasticsearch.server.password=
|
||||
|
||||
## 邮件的配置
|
||||
xboe.email.url=https://u.boe.com/api/b1/email/send
|
||||
xboe.email.from=boeu_learning@boe.com.cn
|
||||
xboe.email.user=
|
||||
xboe.email.security=
|
||||
@@ -1,9 +1,18 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## redis
|
||||
spring.redis.database=3
|
||||
spring.redis.host=10.251.129.122
|
||||
spring.redis.password=qwert!W588
|
||||
spring.redis.port=6379
|
||||
|
||||
|
||||
|
||||
## datasource config
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
@@ -13,7 +22,7 @@ spring.datasource.username=admin
|
||||
spring.datasource.password=boeRds01
|
||||
|
||||
logging.level.org.hibernate.SQL=ERROR
|
||||
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
# logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
@@ -48,3 +57,9 @@ xboe.elasticsearch.server.ip=10.251.129.21
|
||||
xboe.elasticsearch.server.port=9200
|
||||
xboe.elasticsearch.server.user=
|
||||
xboe.elasticsearch.server.password=
|
||||
|
||||
## 邮件的配置
|
||||
xboe.email.url=https://u.boe.com/api/b1/email/send
|
||||
xboe.email.from=boeu_learning@boe.com.cn
|
||||
xboe.email.user=
|
||||
xboe.email.security=
|
||||
@@ -59,4 +59,10 @@ jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator
|
||||
xboe.elasticsearch.server.ip=10.251.129.25
|
||||
xboe.elasticsearch.server.port=9200
|
||||
xboe.elasticsearch.server.user=elastic
|
||||
xboe.elasticsearch.server.password=Boe@es123
|
||||
xboe.elasticsearch.server.password=Boe@es123
|
||||
|
||||
## 邮件的配置
|
||||
xboe.email.url=https://u-pre.boe.com/api/b1/email/send
|
||||
xboe.email.from=boeu_learning@boe.com.cn
|
||||
xboe.email.user=
|
||||
xboe.email.security=
|
||||
Reference in New Issue
Block a user