mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
Merge branch 'master' of codeup.aliyun.com:6265f483e4166464dc2f9c14/boeu/baseservers
This commit is contained in:
@@ -93,6 +93,8 @@ public class ArticleServiceImpl implements IArticleService{
|
||||
@Override
|
||||
public List<Article> mobileList(Integer type) {
|
||||
QueryBuilder builder = QueryBuilder.from(Article.class);
|
||||
//builder.addField("new Article(id,title,coverurl,views,comments,praises,shares,favorites)");
|
||||
builder.addField("new Article(id,title,coverurl,summary,sysCreateBy,sysCreateAid,sysCreateTime,publishTime, views, comments, praises, shares,favorites, source, enabled, deleted)");
|
||||
if(type==2){
|
||||
builder.addOrder(OrderCondition.desc("views"));
|
||||
}else{
|
||||
@@ -101,11 +103,12 @@ public class ArticleServiceImpl implements IArticleService{
|
||||
builder.addFilter(FieldFilters.eq("status", Article.STATUS_PUBLISH));
|
||||
builder.addFilter(FieldFilters.eq("enabled",true));
|
||||
builder.addFilter(FieldFilters.eq("deleted",false));
|
||||
|
||||
builder.addFilter(FieldFilters.isNotNull("coverurl"));
|
||||
builder.addFilter(FieldFilters.ge("coverurl", ""));
|
||||
builder.addFilter(FieldFilters.ne("coverurl", ""));
|
||||
|
||||
builder.setPageSize(4);
|
||||
builder.addFields("new Article(id,coverUrl,title,views,comments,praises,shares,favorites)");
|
||||
|
||||
List<Article> list = dao.findList(builder.builder());
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -392,13 +392,15 @@ public class CourseManageApi extends ApiBaseController{
|
||||
if(dto.getAuditUser()==null) {
|
||||
return badRequest("HRBP审核信息错误");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(dto.getAuditUser().getKid())) {
|
||||
return badRequest("HRBP审核信息人员错误");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(dto.getAuditUser().getCode())) {
|
||||
return badRequest("HRBP审核信息人员错误");
|
||||
//此判断用于本地测试
|
||||
if(!isLocalDevelopment()) {
|
||||
if(StringUtils.isBlank(dto.getAuditUser().getKid())) {
|
||||
return badRequest("HRBP审核信息人员错误");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(dto.getAuditUser().getCode())) {
|
||||
return badRequest("HRBP审核信息人员错误");
|
||||
}
|
||||
}
|
||||
|
||||
// //检查资源内容的完整性,内容需要在前端检查 ,修改,提交必须是在编辑区域才有的操作
|
||||
|
||||
@@ -383,4 +383,32 @@ public class CoursePortalApi extends ApiBaseController{
|
||||
return success(map);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 移动端二期新增 详情页的推荐课程列表
|
||||
* */
|
||||
@PostMapping("/mobile-recommend")
|
||||
public JsonResponse<List<Course>> mobileList(Integer num,CourseQueryDto courseQueryDto){
|
||||
if(num==null){
|
||||
num=6;
|
||||
}
|
||||
List<Course> courses = courseService.mobiledelList(num, courseQueryDto);
|
||||
|
||||
//提取教师信息
|
||||
List<String> ids=new ArrayList<String>();
|
||||
for(Course c :courses) {
|
||||
ids.add(c.getId());
|
||||
}
|
||||
List<CourseTeacher> teachers = courseService.findTeachersByCourseIds(ids);
|
||||
//注意对于多个教师的情况,这里只是设置第一个教师
|
||||
for(Course c :courses) {
|
||||
for(CourseTeacher ct : teachers) {
|
||||
if(ct.getCourseId().equals(c.getId())) {
|
||||
c.setTeacherId(ct.getTeacherId());
|
||||
c.setTeacher(ct.getTeacherName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return success(courses);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,27 @@ public class Course extends BaseEntity {
|
||||
this.isTop=isTop;
|
||||
}
|
||||
|
||||
public Course(String id,Integer type,String name,String coverImg, Float score,Integer studys,Integer comments,Integer shares,Integer praises,Integer favorites
|
||||
,String forUsers,String value,LocalDateTime publishTime,Boolean isTop,String sysType1,String sysType2,String sysType3) {
|
||||
this.setId(id);
|
||||
this.setType(type);
|
||||
this.setName(name);
|
||||
this.setCoverImg(coverImg);
|
||||
this.setScore(score);
|
||||
this.setComments(comments);
|
||||
this.setStudys(studys);
|
||||
this.setShares(shares);
|
||||
this.setPraises(praises);
|
||||
this.setFavorites(favorites);
|
||||
this.forUsers=forUsers;
|
||||
this.value=value;
|
||||
this.publishTime=publishTime;
|
||||
this.isTop=isTop;
|
||||
this.sysType1=sysType1;
|
||||
this.sysType2=sysType2;
|
||||
this.sysType3=sysType3;
|
||||
}
|
||||
|
||||
public Course(String id,Integer type,String name,String coverImg, Float score,Integer studys,Integer comments,Integer shares,Integer praises,Integer favorites
|
||||
,String forUsers,String value,String summary,LocalDateTime publishTime,Boolean isTop,String sysType1,String sysType2,String sysType3) {
|
||||
this.setId(id);
|
||||
@@ -80,7 +101,7 @@ public class Course extends BaseEntity {
|
||||
this.setStudys(studys);
|
||||
this.setShares(shares);
|
||||
this.setPraises(praises);
|
||||
this.setFavorites(praises);
|
||||
this.setFavorites(favorites);
|
||||
this.forUsers=forUsers;
|
||||
this.value=value;
|
||||
this.summary=summary;
|
||||
|
||||
@@ -314,4 +314,10 @@ public interface ICourseService {
|
||||
List<Course> userHobbyList(String aid,String orderField,Boolean orderAsc);
|
||||
|
||||
|
||||
/**
|
||||
* 移动端详情页 推荐课程,同内容分类的
|
||||
* */
|
||||
List<Course> mobiledelList(Integer num,CourseQueryDto courseQueryDto);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ public class CourseServiceImpl implements ICourseService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Course> findSimpleList(int pageIndex,String currentAid, CourseQueryDto dto) {
|
||||
public List<Course> findSimpleList(int number,String currentAid, CourseQueryDto dto) {
|
||||
List<IFieldFilter> filters = createFilters(dto);
|
||||
//自动添加过滤已删除
|
||||
filters.add(FieldFilters.eq("deleted",false));
|
||||
@@ -1115,6 +1115,38 @@ public class CourseServiceImpl implements ICourseService {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Course> mobiledelList(Integer num, CourseQueryDto courseQueryDto) {
|
||||
QueryBuilder builder = QueryBuilder.from(Course.class);
|
||||
builder.setPageSize(num);
|
||||
builder.addFilter(FieldFilters.eq("deleted",false));
|
||||
builder.addFilter(FieldFilters.eq("enabled",true));
|
||||
builder.addFilter(FieldFilters.eq("status",Course.STATUS_AUDIT_FINISH));
|
||||
builder.addFilter(FieldFilters.eq("published", true));
|
||||
if(courseQueryDto!=null){
|
||||
if(StringUtil.isNotBlank(courseQueryDto.getSysType1())){
|
||||
builder.addFilter(FieldFilters.eq("sysType1",courseQueryDto.getSysType1()));
|
||||
}
|
||||
if(StringUtil.isNotBlank(courseQueryDto.getSysType2())){
|
||||
builder.addFilter(FieldFilters.eq("sysType2",courseQueryDto.getSysType2()));
|
||||
}
|
||||
if(StringUtil.isNotBlank(courseQueryDto.getSysType3())){
|
||||
builder.addFilter(FieldFilters.eq("sysType3",courseQueryDto.getSysType3()));
|
||||
}
|
||||
}
|
||||
//排序规则按学习人数
|
||||
builder.addOrder(OrderCondition.desc("studys"));
|
||||
builder.addFields("new Course(id,type,name,coverImg,score,studys,comments,shares,praises,favorites,forUsers,value,publishTime,isTop,sysType1,sysType2,sysType3)");
|
||||
List<Course> list = courseDao.findList(builder.builder());
|
||||
if(!list.isEmpty()&& list.size()<num){
|
||||
List<Course> list1 = courseDao.findList(num - list.size(),OrderCondition.desc("studys"), FieldFilters.eq("deleted", false), FieldFilters.eq("enabled", true), FieldFilters.eq("status", Course.STATUS_AUDIT_FINISH),
|
||||
FieldFilters.eq("published", true));
|
||||
list.addAll(list1);
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int countWaitAudit(String aid) {
|
||||
//查询待审核的课程
|
||||
|
||||
@@ -63,6 +63,14 @@ public class AloneExam extends IdBaseEntity {
|
||||
*/
|
||||
@Column(name = "ucode", length = 30)
|
||||
private String ucode;
|
||||
|
||||
/**关联类型*/
|
||||
@Column(name = "ref_type", length = 30)
|
||||
private String refType;
|
||||
|
||||
/**关联ID*/
|
||||
@Column(name = "ref_id", length = 32)
|
||||
private String refId;
|
||||
|
||||
/**
|
||||
* 对应考试的id
|
||||
|
||||
@@ -49,6 +49,12 @@ public class AloneExamAnswer extends IdBaseEntity {
|
||||
*/
|
||||
@Column(name = "aid", nullable = false, length = 20)
|
||||
private String aid;
|
||||
|
||||
/**
|
||||
* 独立考试任务的id
|
||||
*/
|
||||
@Column(name = "alone_id",length = 20)
|
||||
private String aloneId;
|
||||
|
||||
/**
|
||||
* 答卷人姓名
|
||||
|
||||
@@ -46,12 +46,12 @@ public class CommentsApi extends ApiBaseController{
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value="/page",method= {RequestMethod.GET,RequestMethod.POST})
|
||||
public JsonResponse<PageList<Comments>> findPage(Pagination pager,Integer type,String id,Integer clevel,String author){
|
||||
public JsonResponse<PageList<Comments>> findPage(Pagination pager,Integer type,String id,Integer clevel,String author,String orderField){
|
||||
if(clevel==null) {
|
||||
//return badRequest("未指定级别");
|
||||
clevel=1;
|
||||
}
|
||||
PageList<Comments> list=service.findPage(pager.getPageIndex(),pager.getPageSize(),type, id, clevel, author);
|
||||
PageList<Comments> list=service.findPage(pager.getPageIndex(),pager.getPageSize(),type, id, clevel, author,orderField);
|
||||
//查询二级回复内容
|
||||
List<String> ids=new ArrayList<String>();
|
||||
for(Comments c: list.getList()) {
|
||||
|
||||
@@ -128,7 +128,7 @@ public interface ICommentsService {
|
||||
* @param aid
|
||||
* @return
|
||||
*/
|
||||
PageList<Comments> findPage(int pageIndex,int pageSize, int objType,String objId,int clevel,String aid);
|
||||
PageList<Comments> findPage(int pageIndex,int pageSize, int objType,String objId,int clevel,String aid,String orderField);
|
||||
|
||||
/**
|
||||
* 查询@我的全部
|
||||
|
||||
@@ -170,10 +170,15 @@ public class CommentsServiceImpl implements ICommentsService{
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageList<Comments> findPage(int pageIndex, int pageSize, int objType, String objId, int clevel, String aid) {
|
||||
public PageList<Comments> findPage(int pageIndex, int pageSize, int objType, String objId, int clevel, String aid,String orderField) {
|
||||
QueryBuilder query=QueryBuilder.from(Comments.class);
|
||||
query.setPageIndex(pageIndex);
|
||||
query.setPageSize(pageSize);
|
||||
if(StringUtil.isNotBlank(orderField)){
|
||||
query.addOrder(OrderCondition.desc(orderField));
|
||||
}else{
|
||||
query.addOrder(OrderCondition.desc("sysCreateTime"));
|
||||
}
|
||||
//query.addOrder(OrderCondition.desc("id"));
|
||||
query.addFilter(FieldFilters.eq("objType", objType));
|
||||
query.addFilter(FieldFilters.eq("objId", objId));
|
||||
|
||||
@@ -255,12 +255,43 @@ public class PortalIndexApi extends ApiBaseController{
|
||||
List<Article> articles = articleService.mobileList(type);
|
||||
return success(articles);
|
||||
} catch (Exception e) {
|
||||
log.error("查询包含图片以的文章失败",e);
|
||||
return error("查询失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 课程关联的推荐
|
||||
* @param pager
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/course-for-recommend")
|
||||
public JsonResponse<List<Course>> courseRecommend(Course course){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
CourseQueryDto dto=new CourseQueryDto();
|
||||
dto.setPublish(true);
|
||||
dto.setYearFilter(true);
|
||||
//还应该根据课程的规则查询
|
||||
List<Course> list = courseService.findSimpleList(6, aid,dto);
|
||||
//提取教师信息
|
||||
List<String> ids=new ArrayList<String>();
|
||||
|
||||
|
||||
|
||||
for(Course c :list) {
|
||||
ids.add(c.getId());
|
||||
}
|
||||
List<CourseTeacher> teachers = courseService.findTeachersByCourseIds(ids);
|
||||
//注意对于多个教师的情况,这里只是设置第一个教师
|
||||
for(Course c :list) {
|
||||
for(CourseTeacher ct : teachers) {
|
||||
if(ct.getCourseId().equals(c.getId())) {
|
||||
c.setTeacherId(ct.getTeacherId());
|
||||
c.setTeacher(ct.getTeacherName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return success(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -123,10 +124,50 @@ public class MessageApi extends ApiBaseController {
|
||||
return error("设置已读失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置已读
|
||||
* */
|
||||
|
||||
//@AutoLog(module = "消息",action = "未的全部设置为已读")
|
||||
@GetMapping("/readall")
|
||||
public JsonResponse<Boolean> readAll(){
|
||||
|
||||
String aid=getCurrent().getAccountId();
|
||||
if(StringUtils.isBlank(aid)) {
|
||||
return badRequest("获取用户信息异常");
|
||||
}
|
||||
|
||||
try {
|
||||
service.setReadByAcceptId(aid);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("设置已读失败",e);
|
||||
return error("设置已读失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/clearall")
|
||||
public JsonResponse<Boolean> clearAll(){
|
||||
|
||||
String aid=getCurrent().getAccountId();
|
||||
if(StringUtils.isBlank(aid)) {
|
||||
return badRequest("获取用户信息异常");
|
||||
}
|
||||
|
||||
try {
|
||||
service.cleanByAcceptId(aid);
|
||||
return success(true);
|
||||
} catch (Exception e) {
|
||||
log.error("清空消息错误",e);
|
||||
return error("清空消息失败",e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 移动端
|
||||
* 消息页面,按用户分组返回
|
||||
* 消息页面,按用户分组返回 暂时不用
|
||||
*
|
||||
* */
|
||||
@GetMapping("/mess-group")
|
||||
@@ -141,7 +182,7 @@ public class MessageApi extends ApiBaseController {
|
||||
|
||||
/**
|
||||
* 移动端
|
||||
* 按用户删除消息
|
||||
* 按用户删除消息 暂时不用
|
||||
* */
|
||||
@GetMapping("/remove")
|
||||
public JsonResponse<Boolean> remove(String aid){
|
||||
@@ -156,6 +197,19 @@ public class MessageApi extends ApiBaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户消息 查最新的一条
|
||||
* */
|
||||
@GetMapping
|
||||
public JsonResponse<List<Message>> userMess(){
|
||||
String aid = this.getCurrent().getAccountId();
|
||||
if(StringUtil.isBlank(aid)){
|
||||
return badRequest("参数异常");
|
||||
}
|
||||
List<Message> messages = service.userMess(aid);
|
||||
return success(messages);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -40,12 +40,26 @@ public class Message extends IdEntity {
|
||||
@Column(name = "ref_type",nullable = true)
|
||||
private String refType;
|
||||
|
||||
/**跳转的url*/
|
||||
@Column(name = "page_url",nullable = true,length=200)
|
||||
private String pageUrl;
|
||||
|
||||
/**
|
||||
* 数据来源,1表新系统,2表外部系统
|
||||
*/
|
||||
@Column(name = "source",nullable = true)
|
||||
private Integer source;
|
||||
|
||||
/**
|
||||
* 发送人,如果是系统消息,就写“系统”
|
||||
*/
|
||||
@Column(name = "send_name",nullable = true)
|
||||
private String sendName;
|
||||
|
||||
/**发送人id*/
|
||||
@Column(name = "send_aid",nullable = true,length=20)
|
||||
private String sendAid;
|
||||
|
||||
/**
|
||||
* 发送方式,1直接消息,邮件,短信
|
||||
* */
|
||||
@@ -81,6 +95,7 @@ public class Message extends IdEntity {
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Column(name = "msg_time")
|
||||
private LocalDateTime msgTime;
|
||||
|
||||
/**
|
||||
* 课程类型 微课 录播课
|
||||
* */
|
||||
|
||||
@@ -35,6 +35,21 @@ public interface IMessageService {
|
||||
* 未读消息条数
|
||||
* */
|
||||
Integer isRead(String aid);
|
||||
|
||||
/**
|
||||
* 设置全部未读消息为已读
|
||||
* @param aid
|
||||
* @return
|
||||
*/
|
||||
void setReadByAcceptId(String aid);
|
||||
|
||||
/**
|
||||
* 清空所有的消息,按接收人
|
||||
* @param aid
|
||||
* @return
|
||||
*/
|
||||
void cleanByAcceptId(String aid);
|
||||
|
||||
/**
|
||||
* 批量设置已读
|
||||
* */
|
||||
@@ -50,5 +65,9 @@ public interface IMessageService {
|
||||
* */
|
||||
void remove(String aid);
|
||||
|
||||
/**
|
||||
* 查询最新的一条消息,每个用户
|
||||
* */
|
||||
List<Message> userMess(String aid);
|
||||
|
||||
}
|
||||
|
||||
@@ -98,4 +98,25 @@ public class MessageServiceImpl implements IMessageService {
|
||||
public void remove(String aid) {
|
||||
dao.deleteByFilter(FieldFilters.eq("acceptId",aid));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Message> userMess(String aid) {
|
||||
QueryBuilder builder = QueryBuilder.from(Message.class);
|
||||
builder.addFilter(FieldFilters.eq("acceptId",aid));
|
||||
builder.addGroupBy("acceptId");
|
||||
builder.addOrder(OrderCondition.desc("msgTime"));
|
||||
List<Message> list = dao.findList(builder.builder());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadByAcceptId(String aid) {
|
||||
dao.update("Update "+Message.class.getSimpleName()+" set isRead=?1 where acceptId=?2 and isRead=?3", true,aid,false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanByAcceptId(String aid) {
|
||||
dao.deleteByField("acceptId", aid);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ xboe.local.dev=true
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=E:/Projects/BOE/10/static/temp
|
||||
xboe.upload.file.save_path=E:/Projects/BOE/10/static/upload
|
||||
xboe.upload.file.http_path=http://192.168.0.10:9090/cdn/upload
|
||||
xboe.upload.file.http_path=http://192.168.0.11:9090/cdn/upload
|
||||
|
||||
## 外部接口调用地址 旧系统机构及用户数据接口
|
||||
xboe.externalinterface.url.system=http://localhost:9091
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</parent>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>org-user-sync</artifactId>
|
||||
<version>2.0.0</version>
|
||||
<version>2.0.1</version>
|
||||
<name>org-user-sync</name>
|
||||
<description>用户机构的数据同步</description>
|
||||
<properties>
|
||||
@@ -22,11 +22,6 @@
|
||||
<artifactId>xboe-core</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xboe</groupId>
|
||||
<artifactId>xboe-redis</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<!-- java-jwt -->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
@@ -57,20 +52,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.session</groupId>
|
||||
<artifactId>spring-session-data-redis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.27</version>
|
||||
|
||||
@@ -1,22 +1,20 @@
|
||||
package com.xboe;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.xboe.common.utils.StringUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.xboe.basic.entity.OldOrganization;
|
||||
import com.xboe.basic.entity.OldUser;
|
||||
import com.xboe.basic.service.IOldService;
|
||||
import com.xboe.primary.entity.MainOrganization;
|
||||
import com.xboe.primary.entity.MainUser;
|
||||
import com.xboe.primary.service.IMainDbSyncService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -45,10 +43,10 @@ public class StartRunner implements ApplicationRunner {
|
||||
try {
|
||||
//同步机构
|
||||
List<OldOrganization> allList =oldService.listAll();
|
||||
for(OldOrganization org :allList) {
|
||||
|
||||
Set<String> oldIds=new HashSet<String>();
|
||||
for(OldOrganization org :allList){
|
||||
oldIds.add(org.getKid());
|
||||
MainOrganization mainOrg = mainService.findByKid(org.getKid());
|
||||
|
||||
if(mainOrg==null) {
|
||||
//添加
|
||||
mainOrg=organizationToEntity(org);
|
||||
@@ -58,46 +56,58 @@ public class StartRunner implements ApplicationRunner {
|
||||
copyOrganizationToEntity(mainOrg,org);
|
||||
mainService.update(mainOrg);
|
||||
}
|
||||
|
||||
mainOrgMap.put(org.getKid(),mainOrg.getId());//
|
||||
|
||||
}
|
||||
//本地的检查 ,如果老库中没有,新库中有,也要设置为删除
|
||||
List<MainOrganization> localList=mainService.getAllSysIdAndId();
|
||||
for(MainOrganization mainOrg : localList) {
|
||||
if(!oldIds.contains(mainOrg.getSysId())) {
|
||||
//把本地的设置为已删除
|
||||
if(StringUtils.isNotBlank(mainOrg.getId())) {
|
||||
mainService.deletedOrg(mainOrg.getId());
|
||||
}else {
|
||||
log.error("id错误【"+mainOrg.getSysId()+"】");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//同步用户信息,2022/11/04同步用户学习时长
|
||||
//查询出本地用户
|
||||
List<MainUser> allUsers=mainService.findAll();
|
||||
for(MainUser mainUser : allUsers) {
|
||||
|
||||
OldUser oldUser = oldService.getByUserKid(mainUser.getSysId());
|
||||
if(oldUser!=null) {
|
||||
|
||||
String newId=mainOrgMap.get(oldUser.getOrgnizationId());
|
||||
|
||||
if(StringUtils.isBlank(newId)) {
|
||||
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());
|
||||
|
||||
}
|
||||
}
|
||||
// List<MainUser> allUsers=mainService.findAll();
|
||||
// for(MainUser mainUser : allUsers) {
|
||||
//
|
||||
// OldUser oldUser = oldService.getByUserKid(mainUser.getSysId());
|
||||
// if(oldUser!=null) {
|
||||
// String newId=mainOrgMap.get(oldUser.getOrgnizationId());
|
||||
//
|
||||
// if(StringUtils.isBlank(newId)) {
|
||||
// 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());
|
||||
//
|
||||
// }
|
||||
// }
|
||||
|
||||
System.exit(0);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("执行失败",e);
|
||||
|
||||
@@ -26,4 +26,7 @@ public interface MainOrganizationDao extends JpaRepository<MainOrganization,Stri
|
||||
|
||||
@Query(value = "from MainOrganization where sysId=?1")
|
||||
public List<MainOrganization> findBySysId(String sysId);
|
||||
|
||||
@Query(value = "Select new MainOrganization(id,sysId) from MainOrganization")
|
||||
public List<MainOrganization> getSysIdAndId();
|
||||
}
|
||||
|
||||
@@ -113,5 +113,14 @@ public class MainOrganization extends BaseEntity {
|
||||
|
||||
@Column(name="deleted",length = 1)
|
||||
private Boolean deleted;
|
||||
|
||||
public MainOrganization() {
|
||||
|
||||
}
|
||||
|
||||
public MainOrganization(String id,String sysId) {
|
||||
this.setId(id);
|
||||
this.sysId=sysId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,14 @@ public interface IMainDbSyncService {
|
||||
List<MainUser> findAll();
|
||||
|
||||
MainOrganization findByKid(String kid);
|
||||
|
||||
void deletedOrg(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 获取已有的机构的sys_id和id
|
||||
* @return
|
||||
*/
|
||||
List<MainOrganization> getAllSysIdAndId();
|
||||
|
||||
void save(MainOrganization mainOrg);
|
||||
|
||||
|
||||
@@ -73,4 +73,20 @@ public class MainDbSyncServiceImpl implements IMainDbSyncService {
|
||||
accountDao.updateStatusAndDeleted(muser.getStatus(),muser.getDeleted(), muser.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<MainOrganization> getAllSysIdAndId() {
|
||||
List<MainOrganization> orgs=orgDao.getSysIdAndId();
|
||||
return orgs;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void deletedOrg(String id) {
|
||||
|
||||
orgDao.setDeleted(id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
# redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=127.0.0.1
|
||||
spring.redis.password=ENC(zA5LNV8xw3yEx6LMwdGGBGgNsOaD3Cg+)
|
||||
spring.redis.port=6379
|
||||
|
||||
|
||||
# datasource config
|
||||
# basic数据库
|
||||
spring.jpa.hibernate.ddl-auto=update
|
||||
spring.jpa.hibernate.ddl-auto=none
|
||||
spring.jpa.open-in-view=false
|
||||
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
|
||||
|
||||
@@ -14,7 +10,7 @@ spring.datasource.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
# 当前数据库 basic 对应的数据库
|
||||
spring.datasource.db1.driverClassName=com.mysql.jdbc.Driver
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://127.0.0.1:3306/boeu_basic?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.jdbc-url=jdbc:mysql://127.0.0.1:3306/boe_old?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db1.username=root
|
||||
spring.datasource.db1.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
@@ -23,27 +19,23 @@ spring.datasource.db1.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
# 主数据库 all 对应的数据库
|
||||
spring.datasource.db2.driverClassName=com.mysql.jdbc.Driver
|
||||
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://127.0.0.1:3306/boe_base3?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.jdbc-url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
|
||||
spring.datasource.db2.username=root
|
||||
spring.datasource.db2.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
|
||||
|
||||
|
||||
logging.level.org.hibernate.SQL=DEBUG
|
||||
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
logging.level.org.hibernate.SQL=ERROR
|
||||
#logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
|
||||
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-dev.xml
|
||||
logging.config=classpath:log/logback-pro.xml
|
||||
|
||||
## 静态文件目录,默认是在static下面,以后独立到nginx下面配置
|
||||
spring.web.resources.static-locations=file:E:/Projects/BOE/java/static
|
||||
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=E:/Projects/BOE/java/static/temp
|
||||
xboe.upload.file.save_path=E:/Projects/BOE/java/static/upload
|
||||
xboe.upload.file.http_path=http://localhost:9090/cdn/upload
|
||||
xboe.upload.file.temp_path=
|
||||
xboe.upload.file.save_path=
|
||||
xboe.upload.file.http_path=
|
||||
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://localhost:9090
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
## redis
|
||||
spring.redis.database=2
|
||||
spring.redis.host=10.251.160.38
|
||||
spring.redis.password=qwert!W577
|
||||
spring.redis.port=6379
|
||||
|
||||
# datasource config
|
||||
# basic数据库
|
||||
@@ -37,16 +32,12 @@ logging.level.org.hibernate.SQL=ERROR
|
||||
# 设置logback.xml位置
|
||||
logging.config=classpath:log/logback-pro.xml
|
||||
|
||||
## xboe config
|
||||
xboe.api.cross_filter=true
|
||||
|
||||
## 上传相磁的路径配置
|
||||
xboe.upload.file.temp_path=
|
||||
xboe.upload.file.save_path=
|
||||
xboe.upload.file.http_path=
|
||||
|
||||
## 新系统的内部地址,可以不通过nginx调用
|
||||
xboe.inner.data.sync.baseurl=http://localhost:9090
|
||||
|
||||
#加密盐
|
||||
#jasypt.encryptor.password=jasypt
|
||||
|
||||
Reference in New Issue
Block a user