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:
dongruihua
2022-11-08 11:33:47 +08:00
23 changed files with 232 additions and 41 deletions

View File

@@ -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)) {

View File

@@ -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

View File

@@ -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 审核信息

View File

@@ -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;
}
}

View File

@@ -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());

View File

@@ -35,4 +35,9 @@ public class StudyCourseSimple {
private String sysType3;
private String aid;
/**
* 删除标识
*/
private Boolean deleted;
}

View File

@@ -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();

View File

@@ -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);
}
/**
* 根据用户名和密码登录

View File

@@ -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")) {

View File

@@ -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=

View File

@@ -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=

View File

@@ -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=

View File

@@ -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=

View File

@@ -187,7 +187,13 @@ public class CaseDataSyncRunner {
return first;
}
// public static void main(String[] args) {
// String str="显示-前台SBU1__eol__包括前台MNT SBU、NB SBU、TPC SBU、TV SBU、F1 SBU、Mobile SBU、产销管理中心、车载SBU、SC SBU、C SBU、显示事业数字化变革管理办公室终端营销协调组MNT终端产品线、TV终端产品线、NB终端产品线、TPC终端产品线、3D显示特战队中台产销管理中心";
// CaseDataSyncRunner runner=new CaseDataSyncRunner();
// System.out.println(runner.getNameStr(str));
// System.out.println("显示-前台SBU1__eol__");
// }
//
public void doParser(String json) throws Exception {
@@ -239,7 +245,7 @@ public class CaseDataSyncRunner {
}
//组织领域,无根据名称查找 再根据找到filter 对应code去找上级的名称
if(StringUtil.isNotBlank(csr.getCaseOwnerOrg())) {
if(StringUtils.isNotBlank(csr.getCaseOwnerOrg())) {
String firstName=null;
DictItem dictItem=null;
List<DictItem> items=syncService.findDictItemByName(csr.getCaseOwnerOrg());
@@ -272,8 +278,7 @@ public class CaseDataSyncRunner {
}else {
csr.setStatus(1);
csr.setErrorInfo(csr.getErrorInfo()+ ",未匹配到组织领域【"+csr.getCaseOwnerOrg()+"");
appendError(csr,"无组织领域【"+csr.getCaseOwnerOrg()+"");
}
//专业分类
if(StringUtil.isNotBlank(csr.getCaseSpecialtySequence()) ) {

View File

@@ -4,6 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.xboe.common.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
@@ -61,7 +62,7 @@ public class StartRunner implements ApplicationRunner {
mainOrgMap.put(org.getKid(),mainOrg.getId());//
}
//同步用户信息
//同步用户信息,2022/11/04同步用户学习时长
//查询出本地用户
List<MainUser> allUsers=mainService.findAll();
for(MainUser mainUser : allUsers) {
@@ -72,13 +73,29 @@ public class StartRunner implements ApplicationRunner {
String newId=mainOrgMap.get(oldUser.getOrgnizationId());
if(StringUtils.isBlank(newId)) {
log.error("未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
log.error("本地未找到【"+oldUser.getKid()+"】对应的机构id,不更新用户");
}else {
mainUser.setSysDepartId(oldUser.getOrgnizationId());
mainUser.setCompanyId(oldUser.getCompanyId());
mainUser.setDepartId(newId);
mainUser.setLearningDuration(oldUser.getLearningDuration());
mainUser.setStatus(oldUser.getStatus());
if(oldUser.getIsDeleted()!=null) {
mainUser.setDeleted(oldUser.getIsDeleted()==0? false:true);
}
if(mainUser.getDeleted()) {
if(StringUtils.isNotBlank(oldUser.getEmployeeStatus())){
mainUser.setDeleted(oldUser.getEmployeeStatus().equals("3")? true:false);
}
}
mainService.updateUser(mainUser);
}
}else {
//本地应该删除
log.error("原系统中无【"+mainUser.getSysId()+"】对应的用户id,本地标识删除此用户");
mainService.deleteAccount(mainUser.getId());
}
}

View File

@@ -21,12 +21,23 @@ public class OldTreeNode {
@Column(name = "kid", length = 36)
private String kid;
@Column(name = "tree_node_code", length = 50)
private String nodeCode;
@Column(name = "tree_node_name", length = 100)
private String nodeName;
@Column(name = "display_number")
private Integer displayNumber;
@Column(name = "node_name_path", length = 500)
private String namePath;
@Column(name = "parent_node_id", length = 50)
private String parentNodeId;
@Column(name = "is_deleted", length = 1)
private Integer isDeleted;
}

View File

@@ -31,13 +31,18 @@ public class OldUser implements java.io.Serializable{
*/
@Column(name = "user_no", length = 90)
private String userNo;
@Column(name = "employee_status", length = 50)
private String employeeStatus;
/**
* 状态0临时1正常2停用
*/
@Column(name = "status", length = 3)
private String status;
private Integer status;
/**
* 企业ID
@@ -50,10 +55,14 @@ public class OldUser implements java.io.Serializable{
*/
@Column(name = "orgnization_id", length = 150)
private String orgnizationId;
/**用户学习时长*/
@Column(name = "learning_duration")
private Float learningDuration;
/**
* 删除标记0正常1已删除
*/
@Column(name = "is_deleted", length = 3)
private String isDeleted;
private Integer isDeleted;
}

View File

@@ -11,7 +11,6 @@ import com.xboe.basic.dao.OldUserDao;
import com.xboe.basic.entity.OldOrganization;
import com.xboe.basic.entity.OldUser;
import com.xboe.basic.service.IOldService;
import com.xboe.common.OrderCondition;
/**

View File

@@ -15,7 +15,10 @@ public interface MainAccountDao extends JpaRepository<MainAccount,String>{
@Modifying
@Query(value = "update MainAccount set deleted=true where id=?1")
// @Transactional(rollbackFor = Exception.class)
public Integer setDeleted(String id);
@Modifying
@Query(value = "update MainAccount set status=?1,deleted=?2 where id=?3")
public Integer updateStatusAndDeleted(Integer status,Boolean deleted,String id);
}

View File

@@ -64,13 +64,22 @@ public class MainUser extends IdEntity {
*/
@Column(name = "sass_id", length = 36)
private String sassId;
/**用户学习时长*/
@Column(name = "learning_duration")
private Float learningDuration;
/**
* 删除标识
* */
@Column(name="deleted",length = 1)
// @Column(name="deleted",length = 1)
private Boolean deleted;
/**
* 用户的状态
*/
private Integer status;
public MainUser() {
}

View File

@@ -27,5 +27,11 @@ public interface IMainDbSyncService {
void update(MainOrganization mainOrg);
void updateUser(MainUser muser);
/**
* 把账号设置为已删除
* @param id
*/
void deleteAccount(String id);
}

View File

@@ -59,10 +59,18 @@ public class MainDbSyncServiceImpl implements IMainDbSyncService {
return userDao.findAll();
}
@Override
@Transactional("transactionManagerPrimary")
public void deleteAccount(String id) {
accountDao.setDeleted(id);
}
@Override
@Transactional("transactionManagerPrimary")
public void updateUser(MainUser muser) {
userDao.update(muser.getDepartId(),muser.getSysDepartId(),muser.getCompanyId(),muser.getId());
accountDao.updateStatusAndDeleted(muser.getStatus(),muser.getDeleted(), muser.getId());
}
}