mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-06 17:36:47 +08:00
szx-1194 审批时邮箱的获取由前端传入改为后端获取
This commit is contained in:
@@ -366,6 +366,22 @@ public class ThirdApi {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 虽然当前已存在接口查询用户基本信息,目前仅仅包括用户名、工号、用户ID
|
||||
*/
|
||||
public List<UserBasicInfoVo> getUserBasicInfoByWorkNums(List<String> workNums) {
|
||||
|
||||
UserBasicInfoDto userBasicInfoDto = new UserBasicInfoDto();
|
||||
userBasicInfoDto.setWorkNums(workNums);
|
||||
Response<List<UserAccount>> response = userRemoteClient.getUserBasicInfo(userBasicInfoDto);
|
||||
String respStr = JSON.toJSONString(response);
|
||||
|
||||
UserBasicInfoResultVo userBasicInfoResult = JSONUtil.parseObj(respStr).toBean(UserBasicInfoResultVo.class);
|
||||
List<UserBasicInfoVo> basicInfos = userBasicInfoResult.getResult();
|
||||
return basicInfos;
|
||||
|
||||
}
|
||||
|
||||
public void updateOrSaveCourse(CourseParam param, String token){
|
||||
log.info("---------------准备同步在线课到讲师管理完毕 ------- param " + param);
|
||||
String resp = Optional.ofNullable(
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
@Slf4j
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UserBasicInfoResultVo {
|
||||
|
||||
private String error;
|
||||
private String message;
|
||||
private String permissions;
|
||||
private List<UserBasicInfoVo> result;
|
||||
private int status;
|
||||
private Date timestamp;
|
||||
|
||||
public UserBasicInfoResultVo success() {
|
||||
if (this.status != 200) {
|
||||
log.error("获取用户基本信息失败----{}", JSONUtil.toJsonPrettyStr(this));
|
||||
return null;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.xboe.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBasicInfoVo {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 用户名。
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 工号。
|
||||
*/
|
||||
private String workNum;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
}
|
||||
@@ -11,9 +11,11 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
|
||||
import com.boe.feign.api.infrastructure.entity.Dict;
|
||||
import com.xboe.api.ThirdApi;
|
||||
import com.xboe.api.vo.UserBasicInfoVo;
|
||||
import com.xboe.module.course.dto.*;
|
||||
import com.xboe.module.course.entity.*;
|
||||
import com.xboe.module.course.service.*;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -585,7 +587,10 @@ public class CourseManageApi extends ApiBaseController{
|
||||
dto.getCourse().getOrgName(),
|
||||
dto.getCourse().getSysCreateBy(),dto.getCourse().getName());
|
||||
//邮件发送
|
||||
String email=dto.getAuditUser().getEmail();
|
||||
String email= this.getEmail(dto.getAuditUser().getCode());
|
||||
if (StringUtils.isBlank( email)) {
|
||||
email=dto.getAuditUser().getEmail();
|
||||
}
|
||||
if(!isLocalDevelopment()) {
|
||||
//只是非开发模式下才可以发送
|
||||
service.sendMail(email,"《"+dto.getCourse().getName()+"》课程审核提醒", htmlEmail,"数字化学习平台");
|
||||
@@ -604,6 +609,25 @@ public class CourseManageApi extends ApiBaseController{
|
||||
}
|
||||
}
|
||||
|
||||
private String getEmail(String code) {
|
||||
if (StringUtils.isBlank( code)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
List<String> workNums = new ArrayList(1){{
|
||||
add(code);
|
||||
}};
|
||||
List<UserBasicInfoVo> userBasicInfoVoList = thirdApi.getUserBasicInfoByWorkNums(workNums);
|
||||
if (CollectionUtils.isEmpty(userBasicInfoVoList)) {
|
||||
return null;
|
||||
}
|
||||
return userBasicInfoVoList.get(0).getEmail();
|
||||
} catch (Exception e) {
|
||||
log.error("获取用户邮箱错误",e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String createEmailHtml(String name,String orgId, String orgName,String createBy,String courseName) throws Exception {
|
||||
StringBuffer htmlMsg=new StringBuffer("<div style=\"line-height:30px;border:2px solid #2990ca;padding:20px\">");
|
||||
|
||||
@@ -714,6 +738,10 @@ public class CourseManageApi extends ApiBaseController{
|
||||
//邮件发送
|
||||
if(!isLocalDevelopment()) {
|
||||
//只是非高度环境上才会发送
|
||||
String newEmail = getEmail(ucode);
|
||||
if (StringUtils.isNotBlank(newEmail)) {
|
||||
email = newEmail;
|
||||
}
|
||||
service.sendMail(email,"《"+course.getName()+"》课程审核提醒",htmlEmail,"数字化学习平台");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user