Compare commits

..

2 Commits

Author SHA1 Message Date
0027002591
b990d96f1d php剥离修改 2025-11-18 11:42:58 +08:00
0027002591
6921deb17d php剥离内容修改 2025-11-12 17:00:07 +08:00
9 changed files with 189 additions and 172 deletions

View File

@@ -56,12 +56,11 @@ public class EmailServiceImpl implements IEmailService {
String cfgWord=SysConstant.getConfigValue("xboe.email.security");
Map<String,Object> data=new HashMap<String,Object>();
data.put("to",to);
data.put("subject",subject);
// php剥离不再使用老系统发邮件使用基础服务的发邮件功能
data.put("email",to);
data.put("title",subject);
data.put("content", htmlMsg);
data.put("fromName", cfgFrom);
data.put("cc", "");
data.put("type", 0);
data.put("userName", cfgUser);
ObjectMapper mapper=new ObjectMapper();
String json=mapper.writeValueAsString(data);

View File

@@ -10,7 +10,6 @@ import javax.servlet.http.HttpServletRequest;
import com.xboe.api.ThirdApi;
import com.xboe.module.course.dto.CourseParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -322,7 +321,6 @@ public class CourseAuditApi extends ApiBaseController{
* @return
*/
@PostMapping("/hrbp-submit-audit")
@Transactional(rollbackFor = Exception.class)
public JsonResponse<Boolean> hrbpAudit(String auditId,String courseId,String title,Boolean pass,String remark, HttpServletRequest request){
if(StringUtils.isBlank(auditId)){
return badRequest("参数错误");
@@ -352,19 +350,22 @@ public class CourseAuditApi extends ApiBaseController{
}
}
CurrentUser cu=getCurrent();
service.hrbpSubmitAudit(auditId, courseId,open, pass,cu.getAccountId(),cu.getName(), remark);
try {
CurrentUser cu=getCurrent();
service.hrbpSubmitAudit(auditId, courseId,open, pass,cu.getAccountId(),cu.getName(), remark);
if (pass){
//修改在线课开课状态=已开课
String token = request.getHeader("Xboe-Access-Token");
CourseParam param = new CourseParam();
param.setId(courseId);
param.setOrgId(c.getOrgId());
param.setOrgName(c.getOrgName());
thirdApi.updateOrSaveCourse(param,token);
}
return success(true);
if (pass){
//修改在线课开课状态=已开课
String token = request.getHeader("Xboe-Access-Token");
CourseParam param = new CourseParam();
param.setId(courseId);
thirdApi.updateOnLineStatua(param,token);
}
return success(true);
} catch (Exception e) {
log.error("HRBP审核提交处理错误",e);
return error("审核处理失败",e.getMessage(),false);
}
}
@PostMapping("/last-audit-list")
@@ -389,7 +390,6 @@ public class CourseAuditApi extends ApiBaseController{
* @param dto
* @return
*/
@Transactional(rollbackFor = Exception.class)
@PostMapping("/submit-publish")
@AutoLog(module = "课程",action = "默认管理员提交发布",info = "")
public JsonResponse<Boolean> submitAndPublish(@RequestBody CourseFullDto dto, HttpServletRequest request){
@@ -423,16 +423,23 @@ public class CourseAuditApi extends ApiBaseController{
dto.getCourse().setStatus(Course.STATUS_AUDIT_FINISH);//设置为审核通过状态
dto.getCourse().setEnabled(true);//设置启用状态问题
dto.getCourse().setPublished(false);//重新提交审核设置为未发布状态
try {
courseService.submitAndPublish(dto,cuser.getAccountId(),cuser.getName());
log.info("---------------在线课开始同步到讲师管理 ------- token = " + token);
CourseParam param = new CourseParam();
param.setId(dto.getCourse().getId());
param.setOrgId(dto.getCourse().getOrgId());
param.setOrgName(dto.getCourse().getOrgName());
thirdApi.updateOrSaveCourse(param,token);
log.info("---------------在线课同步到讲师管理完毕 -------");
return success(true);
courseService.submitAndPublish(dto,cuser.getAccountId(),cuser.getName());
log.info("---------------在线课开始同步到讲师管理 ------- token = " + token);
CourseParam param = new CourseParam();
param.setId(dto.getCourse().getId());
param.setOrgId(dto.getCourse().getOrgId());
param.setOrgName(dto.getCourse().getOrgName());
thirdApi.updateOrSaveCourse(param,token);
log.info("---------------在线课同步到讲师管理完毕 -------");
return success(true);
} catch (Exception e) {
log.error("默认管理员提交直接发布处理失败",e);
e.printStackTrace();
return error("发布课程失败",e.getMessage());
}
}

View File

@@ -14,7 +14,6 @@ import com.xboe.api.ThirdApi;
import com.xboe.module.course.dto.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -301,7 +300,6 @@ public class CourseManageApi extends ApiBaseController{
* @return
*/
@PostMapping("/save")
@Transactional(rollbackFor = Exception.class)
@AutoLog(module = "课程",action = "保存课程基本信息",info = "")
public JsonResponse<CourseFullDto> saveCourseFull(@RequestBody CourseFullDto dto, HttpServletRequest request){
if(dto.getCourse()==null){
@@ -323,25 +321,30 @@ public class CourseManageApi extends ApiBaseController{
}
//填充必要的信息
if(StringUtils.isBlank(dto.getCourse().getId())) {
//只有在第一次添加保存时才会这样
fillCourseData(dto.getCourse());
courseService.save(dto);
}else {
//修改后重置,重新提交审核,重新发布
dto.getCourse().setPublished(false);
dto.getCourse().setStatus(Course.STATUS_NONE);
courseService.update(dto);
}
String token = request.getHeader("Xboe-Access-Token");
log.info("---------------在线课开始同步到讲师管理 ------- token = " + token);
CourseParam param = new CourseParam();
param.setId(dto.getCourse().getId());
param.setOrgId(dto.getCourse().getOrgId());
param.setOrgName(dto.getCourse().getOrgName());
thirdApi.updateOrSaveCourse(param,token);
log.info("---------------在线课同步到讲师管理完毕 -------");
return success(dto);
try {
if(StringUtils.isBlank(dto.getCourse().getId())) {
//只有在第一次添加保存时才会这样
fillCourseData(dto.getCourse());
courseService.save(dto);
}else {
//修改后重置,重新提交审核,重新发布
dto.getCourse().setPublished(false);
dto.getCourse().setStatus(Course.STATUS_NONE);
courseService.update(dto);
}
String token = request.getHeader("Xboe-Access-Token");
log.info("---------------在线课开始同步到讲师管理 ------- token = " + token);
CourseParam param = new CourseParam();
param.setId(dto.getCourse().getId());
param.setOrgId(dto.getCourse().getOrgId());
param.setOrgName(dto.getCourse().getOrgName());
thirdApi.updateOrSaveCourse(param,token);
log.info("---------------在线课同步到讲师管理完毕 -------");
return success(dto);
} catch (Exception e) {
log.error("整体保存课程信息错误",e);
return error("保存失败",e.getMessage());
}
}
/***
@@ -440,7 +443,6 @@ public class CourseManageApi extends ApiBaseController{
@PostMapping("/submit")
@Transactional(rollbackFor = Exception.class)
@AutoLog(module = "课程",action = "提交课程",info = "")
public JsonResponse<CourseFullDto> submitCourseFull(@RequestBody CourseFullDto dto){
if(dto.getCourse()==null){
@@ -518,63 +520,68 @@ public class CourseManageApi extends ApiBaseController{
//检查课程内容的完整性
//填充必要的信息
//fillCourseData(dto.getCourse());
CourseHRBPAudit hrbpAudit = hrbpAuditService.hasAuditing(dto.getCourse().getId());
if(hrbpAudit!=null) {
return badRequest("此课程中已有审核,不能再提交审核,如修改请先撤回");
}
if(!isLocalDevelopment()) {
if(StringUtils.isBlank(dto.getAuditUser().getAid())) {
try {
CourseHRBPAudit hrbpAudit = hrbpAuditService.hasAuditing(dto.getCourse().getId());
if(hrbpAudit!=null) {
return badRequest("此课程中已有审核,不能再提交审核,如修改请先撤回");
}
if(!isLocalDevelopment()) {
if(StringUtils.isBlank(dto.getAuditUser().getAid())) {
// if(StringUtils.isBlank(dto.getAuditUser().getKid())) {
// return badRequest("HRBP审核信息人员错误");
// }
//转化用户id
User u = userService.getByUserNo(dto.getAuditUser().getCode());
if(u==null) { //本地没有,需要同步、
//20230815 直接返回错误,这个时候传的用户,在新系统中没有,需要用户登录一下,或着用户中心推送
return badRequest("无关联HRBP审核人员请先同步用户");
//Organization org = orgService.getBySysId(dto.getAuditUser().getOrgkid());
//转化用户id
User u = userService.getByUserNo(dto.getAuditUser().getCode());
if(u==null) { //本地没有,需要同步、
//20230815 直接返回错误,这个时候传的用户,在新系统中没有,需要用户登录一下,或着用户中心推送
return badRequest("无关联HRBP审核人员请先同步用户");
//Organization org = orgService.getBySysId(dto.getAuditUser().getOrgkid());
// UserVo fwUser = fwUserService.getById(dto.getAuditUser().getKid());
// Account a =userService.syncAccountUser(fwUser);
// dto.getAuditUser().setAid(a.getId());
}else {
dto.getAuditUser().setAid(u.getId());
}
}else {
log.info("已获取过hrbp审核人id【"+dto.getAuditUser().getAid()+"】,不需要再转化");
}
}else {
//弄成固定值,用于测试
dto.getAuditUser().setAid(getCurrent().getAccountId());
}
if(StringUtils.isBlank(dto.getAuditUser().getAid())) {
return badRequest("查询组织HRBP审核人员失败");
}
//设置为提交状态
dto.getCourse().setStatus(Course.STATUS_SUBMIT);
dto.getCourse().setEnabled(true);//设置启用状态问题
dto.getCourse().setPublished(false);//重新提交审核设置为未发布状态
courseService.submit(dto);
//提交成功发邮件提醒
try {
String htmlEmail=createEmailHtml(dto.getAuditUser().getName(),dto.getCourse().getOrgId(),
dto.getCourse().getOrgName(),
dto.getCourse().getSysCreateBy(),dto.getCourse().getName());
//邮件发送
String email=dto.getAuditUser().getEmail();
if(!isLocalDevelopment()) {
//只是非开发模式下才可以发送
service.sendMail(email,""+dto.getCourse().getName()+"》课程审核提醒", htmlEmail,"数字化学习平台");
}else {
//service.sendMail("daihaixing@bjxask.com","课程审核提醒", htmlEmail,"数字化学习平台");
}
} catch (Exception ex) {
log.error("邮件发送失败",ex);
return error("课程已提交,但邮件发送失败",ex.getMessage());
}
return success(dto);
}else {
dto.getAuditUser().setAid(u.getId());
}
}else {
log.info("已获取过hrbp审核人id【"+dto.getAuditUser().getAid()+"】,不需要再转化");
}
}else {
//弄成固定值,用于测试
dto.getAuditUser().setAid(getCurrent().getAccountId());
}
if(StringUtils.isBlank(dto.getAuditUser().getAid())) {
return badRequest("查询组织HRBP审核人员失败");
}
//设置为提交状态
dto.getCourse().setStatus(Course.STATUS_SUBMIT);
dto.getCourse().setEnabled(true);//设置启用状态问题
dto.getCourse().setPublished(false);//重新提交审核设置为未发布状态
courseService.submit(dto);
//提交成功发邮件提醒
try {
String htmlEmail=createEmailHtml(dto.getAuditUser().getName(),dto.getCourse().getOrgId(),
dto.getCourse().getOrgName(),
dto.getCourse().getSysCreateBy(),dto.getCourse().getName());
//邮件发送
String email=dto.getAuditUser().getEmail();
if(!isLocalDevelopment()) {
//只是非开发模式下才可以发送
service.sendMail(email,""+dto.getCourse().getName()+"》课程审核提醒", htmlEmail,"数字化学习平台");
}else {
//service.sendMail("daihaixing@bjxask.com","课程审核提醒", htmlEmail,"数字化学习平台");
}
} catch (Exception ex) {
log.error("邮件发送失败",ex);
return error("课程已提交,但邮件发送失败",ex.getMessage());
}
return success(dto);
} catch (Exception e) {
log.error("提交保存课程信息错误",e);
return error("提交课程处理失败",e.getMessage());
}
}
private String createEmailHtml(String name,String orgId, String orgName,String createBy,String courseName) throws Exception {
@@ -608,7 +615,6 @@ public class CourseManageApi extends ApiBaseController{
}
@PostMapping("/sumbits")
@Transactional(rollbackFor = Exception.class)
public JsonResponse<Boolean> sumbitId(HttpServletRequest request,CourseHRBPAudit audit,String ucode,String ukid,String email,String orgName){
if(StringUtils.isBlank(audit.getCourseId())){
return badRequest("参数错误");
@@ -631,23 +637,24 @@ public class CourseManageApi extends ApiBaseController{
return badRequest(error);
}
CourseHRBPAudit hrbpAudit = hrbpAuditService.hasAuditing(audit.getCourseId());
if(hrbpAudit!=null) {
return badRequest("此课程中已有审核,不能再提交审核,如修改请先撤回");
}
if(!isLocalDevelopment()) {
if(StringUtils.isBlank(audit.getAid())) {
try {
CourseHRBPAudit hrbpAudit = hrbpAuditService.hasAuditing(audit.getCourseId());
if(hrbpAudit!=null) {
return badRequest("此课程中已有审核,不能再提交审核,如修改请先撤回");
}
if(!isLocalDevelopment()) {
if(StringUtils.isBlank(audit.getAid())) {
// if(StringUtils.isBlank(ukid)){
// return badRequest("未关联HRBP审核人员");
// }
//转化用户id
User u = userService.getByUserNo(ucode);
if(u==null) { //本地没有,需要同步
return badRequest("无关联HRBP审核人员请先同步用户");
//Organization org = orgService.getBySysId(dto.getAuditUser().getOrgkid());
//20230815 已经不再使用直接查老系统,采用接口同步的方式
//转化用户id
User u = userService.getByUserNo(ucode);
if(u==null) { //本地没有,需要同步
return badRequest("无关联HRBP审核人员请先同步用户");
//Organization org = orgService.getBySysId(dto.getAuditUser().getOrgkid());
//20230815 已经不再使用直接查老系统,采用接口同步的方式
// UserVo fwUser = fwUserService.getById(ukid);
// Account a =userService.syncAccountUser(fwUser);
// audit.setAid(a.getId());
@@ -663,39 +670,43 @@ public class CourseManageApi extends ApiBaseController{
// }catch(Exception exp) {
// log.error("登录同步用户错误",exp);
// }
}else {
audit.setAid(u.getId());
}
}else {
log.info("已获取过hrbp审核人id【"+audit.getAid()+"】,不需要再转化");
}
}else {
//弄成固定值,用于测试
audit.setAid(getCurrent().getAccountId());
}
if(StringUtils.isBlank(audit.getAid())) {
return badRequest("查询组织HRBP审核人员失败");
}
courseService.submit(audit);
//提交成功发邮件提醒
try {
String htmlEmail=createEmailHtml(audit.getAuditUser(),course.getOrgId(), orgName,audit.getCourseUser(),audit.getCourseName());
//邮件发送
if(!isLocalDevelopment()) {
//只是非高度环境上才会发送
service.sendMail(email,""+course.getName()+"》课程审核提醒",htmlEmail,"数字化学习平台");
}
} catch (Exception ex) {
log.error("邮件发送失败",ex);
return error("课程已提交,但邮件发送失败",ex.getMessage());
}
return success(true);
}else {
audit.setAid(u.getId());
}
}else {
log.info("已获取过hrbp审核人id【"+audit.getAid()+"】,不需要再转化");
}
}else {
//弄成固定值,用于测试
audit.setAid(getCurrent().getAccountId());
}
if(StringUtils.isBlank(audit.getAid())) {
return badRequest("查询组织HRBP审核人员失败");
}
courseService.submit(audit);
//提交成功发邮件提醒
try {
String htmlEmail=createEmailHtml(audit.getAuditUser(),course.getOrgId(), orgName,audit.getCourseUser(),audit.getCourseName());
//邮件发送
if(!isLocalDevelopment()) {
//只是非高度环境上才会发送
service.sendMail(email,""+course.getName()+"》课程审核提醒",htmlEmail,"数字化学习平台");
}
} catch (Exception ex) {
log.error("邮件发送失败",ex);
return error("课程已提交,但邮件发送失败",ex.getMessage());
}
return success(true);
}catch(Exception e) {
log.error("提交保存课程信息错误",e);
return error("提交课程处理失败",e.getMessage());
}
}
@PostMapping("/revoke")

View File

@@ -161,14 +161,14 @@ public interface ICourseService {
* 课程信息的整体更新,用于对课程的编辑处理
* @param full
*/
void update(CourseFullDto full);
void update(CourseFullDto full)throws Exception;
/**
* 提交课程,提交进入课程审核,独立的方法处理
* @param full
* @throws Exception
*/
void submit(CourseFullDto full);
void submit(CourseFullDto full)throws Exception;
/**
* 用于默认管理员,直接提交发布,不走审核流程
@@ -177,14 +177,14 @@ public interface ICourseService {
* @param aname 姓名
* @throws Exception
*/
void submitAndPublish(CourseFullDto full,String aid,String aname);
void submitAndPublish(CourseFullDto full,String aid,String aname)throws Exception;
/**
* 提交一个课程
* @param audit
* @throws Exception
*/
void submit(CourseHRBPAudit audit);
void submit(CourseHRBPAudit audit) throws Exception;
/**
* update 传一个id直接改值

View File

@@ -976,7 +976,7 @@ public class CourseServiceImpl implements ICourseService {
}
@Override
public void update(CourseFullDto full) {
public void update(CourseFullDto full) throws Exception {
Course c = full.getCourse();//当前的课程信息
Course nowCourse = courseDao.get(c.getId());//修改之前的课程信息
@@ -1028,7 +1028,7 @@ public class CourseServiceImpl implements ICourseService {
}
@Override
public void submit(CourseFullDto full) {
public void submit(CourseFullDto full) throws Exception {
Course c = full.getCourse();//当前的课程信息
if (c.getVisible() == null) {
@@ -1084,7 +1084,7 @@ public class CourseServiceImpl implements ICourseService {
}
@Override
public void submitAndPublish(CourseFullDto full, String aid, String aname) {
public void submitAndPublish(CourseFullDto full, String aid, String aname) throws Exception {
Course c = full.getCourse();//当前的课程信息
c.setPublished(true);
@@ -1131,7 +1131,7 @@ public class CourseServiceImpl implements ICourseService {
}
@Override
public void submit(CourseHRBPAudit hrbpAudit) {
public void submit(CourseHRBPAudit hrbpAudit) throws Exception {
courseDao.updateMultiFieldById(hrbpAudit.getCourseId(), UpdateBuilder.create("status", Course.STATUS_SUBMIT),
UpdateBuilder.create("published", false), UpdateBuilder.create("publishTime", LocalDateTime.now()));

View File

@@ -44,7 +44,7 @@ public class PhpOnlineStudyRecordScheduledTasks {
RestHighLevelClient restHighLevelClient;
// todo 定时、分批、数据库名
@XxlJob("phpOnlineStudyRecordSyncEsTask")
//@XxlJob("phpOnlineStudyRecordSyncEsTask")
public List<String> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
log.info("开始同步PHP学习记录到ES");

View File

@@ -240,17 +240,17 @@ public class StudyCourseESApi extends ApiBaseController{
* @return
* @throws IOException
*/
@PostMapping("/phpOnlineStudyRecordSyncEs")
public JsonResponse<List<String>> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEs(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
return success(courseStudyDtoList);
}
@PostMapping("/phpOnlineStudyRecordSyncEsOfFull")
public JsonResponse<List<String>> phpOnlineStudyRecordSyncEsOfFull(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEsOfFull(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
return success(courseStudyDtoList);
}
// @PostMapping("/phpOnlineStudyRecordSyncEs")
// public JsonResponse<List<String>> phpOnlineStudyRecordSyncEs(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
// List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEs(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
// return success(courseStudyDtoList);
// }
//
// @PostMapping("/phpOnlineStudyRecordSyncEsOfFull")
// public JsonResponse<List<String>> phpOnlineStudyRecordSyncEsOfFull(Long syncTimePointOfBegin, Long syncTimePointOfEnd, Integer isOnlyRead) throws IOException {
// List<String> courseStudyDtoList = phpOnlineStudyRecordScheduledTasks.phpOnlineStudyRecordSyncEsOfFull(syncTimePointOfBegin, syncTimePointOfEnd, isOnlyRead);
// return success(courseStudyDtoList);
// }
}

View File

@@ -66,7 +66,7 @@ xboe:
user:
password:
email:
url: https://u.boe.com/api/b1/email/send
url: http://u.boe.com/infrasApi/sendMsg/sendMail
from: boeu_learning@boe.com.cn
user:
security:

View File

@@ -104,7 +104,7 @@ xboe:
user: elastic
password: Boe@es123
email:
url: http://10.251.186.27/api/b1/email/send
url: http://127.0.0.1/infrasApi/sendMsg/sendMail
from: boeu_learning@boe.com.cn
user:
security: